@kws3/ui 5.0.0-alpha.8 → 5.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/helpers/Dialog/index.js +9 -19
- package/package.json +1 -1
package/helpers/Dialog/index.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
+
import { mount, unmount } from "svelte";
|
|
1
2
|
import { default as _Dialog } from "./Dialog.svelte";
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {import('@kws3/ui/types').DialogProps} DialogProps
|
|
5
|
-
*/
|
|
4
|
+
/** @typedef {import("@kws3/ui/types").DialogProps} DialogProps */
|
|
6
5
|
|
|
7
6
|
function createDialog(msg, props) {
|
|
8
7
|
props = Object.assign(props, { _text: msg });
|
|
9
8
|
|
|
10
9
|
const promise = new Promise((fulfil) => {
|
|
11
10
|
//@ts-ignore
|
|
12
|
-
const dialog =
|
|
11
|
+
const dialog = mount(_Dialog, {
|
|
13
12
|
target: document.body,
|
|
14
13
|
props,
|
|
15
14
|
intro: true,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//https://github.com/sveltejs/svelte/issues/4056
|
|
23
|
-
//@ts-ignore
|
|
24
|
-
dialog.$destroy();
|
|
15
|
+
events: {
|
|
16
|
+
_done: ({ detail }) => {
|
|
17
|
+
fulfil(detail);
|
|
18
|
+
unmount(dialog);
|
|
19
|
+
},
|
|
20
|
+
},
|
|
25
21
|
});
|
|
26
22
|
});
|
|
27
23
|
|
|
@@ -30,7 +26,6 @@ function createDialog(msg, props) {
|
|
|
30
26
|
|
|
31
27
|
class Dialog {
|
|
32
28
|
/**
|
|
33
|
-
*
|
|
34
29
|
* @param {string} msg
|
|
35
30
|
* @param {DialogProps} [props={}]
|
|
36
31
|
*/
|
|
@@ -40,7 +35,6 @@ class Dialog {
|
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
/**
|
|
43
|
-
*
|
|
44
38
|
* @param {string} msg
|
|
45
39
|
* @param {DialogProps} [props={}]
|
|
46
40
|
*/
|
|
@@ -49,7 +43,6 @@ class Dialog {
|
|
|
49
43
|
}
|
|
50
44
|
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
53
46
|
* @param {string} msg
|
|
54
47
|
* @param {DialogProps} [props={}]
|
|
55
48
|
*/
|
|
@@ -59,7 +52,6 @@ class Dialog {
|
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
/**
|
|
62
|
-
*
|
|
63
55
|
* @param {string} msg
|
|
64
56
|
* @param {DialogProps} [props={}]
|
|
65
57
|
*/
|
|
@@ -69,7 +61,6 @@ export function alert(msg, props) {
|
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
/**
|
|
72
|
-
*
|
|
73
64
|
* @param {string} msg
|
|
74
65
|
* @param {DialogProps} [props={}]
|
|
75
66
|
*/
|
|
@@ -79,7 +70,6 @@ export function prompt(msg, props) {
|
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
/**
|
|
82
|
-
*
|
|
83
73
|
* @param {string} msg
|
|
84
74
|
* @param {DialogProps} [props={}]
|
|
85
75
|
*/
|