Skip to content

Commit 9ee6e9e

Browse files
committed
Chore(ts): more ts support
1 parent 3dfc67b commit 9ee6e9e

24 files changed

+6210
-8833
lines changed

docs/.vuepress/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {defineAsyncComponent} from "vue";
22
import { defineClientConfig } from 'vuepress/client'
3-
import DialogPlugin from "../../src/plugin/index";
3+
import {PromiseDialog} from "../../src/plugin/index";
44

55

66
export default defineClientConfig({
@@ -10,7 +10,7 @@ export default defineClientConfig({
1010
defineAsyncComponent(() => import(`../components/examples/${fileName}.vue`))
1111
)
1212

13-
app.use(DialogPlugin, {})
13+
app.use(PromiseDialog)
1414
registerComponent('UIExamplesButton')
1515
registerComponent('UIExamplesWrapper')
1616
registerComponent('FeaturesExampleAlert')

docs/components/examples/FeaturesExampleAlert.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<script setup>
66
import {inject} from 'vue'
7+
import {injectionKey} from "../../../src/plugin/index.ts";
78
89
defineOptions({
910
name: "FeaturesExampleAlert"
1011
})
1112
12-
const $dialog = inject('$dialog')
13+
const $dialog = inject(injectionKey)
1314
const openDialog = () => $dialog.alert({
1415
title: 'Alert example',
1516
body: 'Session expired. Please login again to continue.',

docs/components/examples/FeaturesExampleConfirm.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<script setup>
66
import {inject} from 'vue'
7+
import {injectionKey} from "../../../src/plugin/index.ts";
78
89
defineOptions({
910
name: "FeaturesExampleConfirm"
1011
})
1112
12-
const $dialog = inject('$dialog')
13+
const $dialog = inject(injectionKey)
1314
const openDialog = () => $dialog.confirm({
1415
title: 'Confirm example',
1516
body: 'The is a low risk operation. Single click required to confirm.',
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<template>
2-
<UIExamplesButton @click="openDialog">Show confirm | basic</UIExamplesButton>
2+
<UIExamplesButton @click="openDialog">Show confirm | hard</UIExamplesButton>
33
</template>
44

55
<script setup>
66
import {inject} from 'vue'
7+
import {injectionKey} from "../../../src/plugin/index.ts";
78
89
defineOptions({
910
name: "FeaturesExampleConfirm"
1011
})
1112
12-
const $dialog = inject('$dialog')
13+
const $dialog = inject(injectionKey)
1314
const openDialog = () => $dialog.confirm({
1415
title: 'Confirm example',
1516
body: 'The requested resource is no longer available. It may have been moved or deleted',
1617
}, {
1718
cancelText: 'No',
18-
okText: 'Yes'
19+
okText: 'Yes',
20+
type: 'hard'
1921
})
2022
</script>

docs/components/examples/FeaturesExampleConfirmSoft.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<script setup>
66
import {inject} from 'vue'
7+
import {injectionKey} from "../../../src/plugin/index.ts";
78
89
defineOptions({
910
name: "FeaturesExampleConfirmSoft"
1011
})
1112
12-
const $dialog = inject('$dialog')
13+
const $dialog = inject(injectionKey)
1314
const openDialog = () => $dialog.confirm({
1415
title: 'Soft confirm example',
1516
body: 'This is a medium risk action. Multiple clicks required to confirm',

docs/components/examples/FeaturesExamplePrompt.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<script setup>
66
import {inject} from 'vue'
7+
import {injectionKey} from "../../../src/plugin/index.ts";
78
89
defineOptions({
910
name: "FeaturesExamplePrompt"
1011
})
1112
12-
const $dialog = inject('$dialog')
13+
const $dialog = inject(injectionKey)
1314
const openDialog = () => $dialog.prompt({
1415
title: 'Prompt Example',
1516
body: 'What is the most important thing in life?',

docs/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,35 @@ app.mount('#app')
6969
<!--// Tell Vue to install the plugin.-->
7070
<!--window.Vue.use(VuejsDialog.main.default)-->
7171
<!--</script>-->
72+
73+
74+
// <link href="./path/to/vuejs-dialog.min.css" rel="stylesheet">
75+
// <script src="https://unpkg.com/vue@3.5.4/dist/vue.global.js"></script>
76+
// <script src="../vuejs-dialog.umd.js"></script>
77+
//
78+
// ...then...
79+
//
80+
// <div id="app">{{ message }}</div>
81+
// <script>
82+
// // Create Vue 3 app
83+
// const app = Vue.createApp({
84+
// data() {
85+
// return {
86+
// message: 'Hello Vue 3!',
87+
// };
88+
// },
89+
// });
90+
//
91+
// app.use(window.VuejsDialog.PromiseDialog, {
92+
// message: {
93+
// title: 'Quick one',
94+
// body: 'Please confirm that you wish to proceed'
95+
// }
96+
// })
97+
//
98+
// // Mount the app to the DOM element
99+
// app.mount('#app');
100+
// </script>
72101
```
73102

74103
## Opening a dialog

0 commit comments

Comments
 (0)