@sveltia/ui 0.26.4 → 0.26.6
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/dist/components/util/modal.svelte +7 -20
- package/package.json +21 -21
|
@@ -36,15 +36,12 @@
|
|
|
36
36
|
/* eslint-enable prefer-const */
|
|
37
37
|
} = $props();
|
|
38
38
|
|
|
39
|
-
let opening = false;
|
|
40
|
-
let closing = false;
|
|
41
|
-
|
|
42
39
|
/**
|
|
43
40
|
* Close the modal.
|
|
44
41
|
* @param {string} returnValue Return value to be used for `<dialog>`.
|
|
45
42
|
*/
|
|
46
43
|
export const close = (returnValue) => {
|
|
47
|
-
if (!dialog
|
|
44
|
+
if (!dialog) {
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
47
|
|
|
@@ -80,15 +77,10 @@
|
|
|
80
77
|
* Show the modal.
|
|
81
78
|
*/
|
|
82
79
|
const openDialog = async () => {
|
|
83
|
-
if (!dialog || dialog?.open
|
|
84
|
-
if (closing) {
|
|
85
|
-
open = false;
|
|
86
|
-
}
|
|
87
|
-
|
|
80
|
+
if (!dialog || dialog?.open) {
|
|
88
81
|
return;
|
|
89
82
|
}
|
|
90
83
|
|
|
91
|
-
opening = true;
|
|
92
84
|
onOpening?.(new CustomEvent('Opening'));
|
|
93
85
|
showContent = true;
|
|
94
86
|
dialog.showModal();
|
|
@@ -97,24 +89,18 @@
|
|
|
97
89
|
setOpenClass = true;
|
|
98
90
|
await waitForTransition();
|
|
99
91
|
setActiveClass = true;
|
|
100
|
-
opening = false;
|
|
101
92
|
};
|
|
102
93
|
|
|
103
94
|
/**
|
|
104
95
|
* Hide the modal.
|
|
105
96
|
*/
|
|
106
97
|
const closeDialog = async () => {
|
|
107
|
-
if (!dialog || !dialog.open
|
|
108
|
-
if (opening) {
|
|
109
|
-
open = false;
|
|
110
|
-
}
|
|
111
|
-
|
|
98
|
+
if (!dialog || !dialog.open) {
|
|
112
99
|
return;
|
|
113
100
|
}
|
|
114
101
|
|
|
115
102
|
const { returnValue } = dialog;
|
|
116
103
|
|
|
117
|
-
closing = true;
|
|
118
104
|
onClosing?.(new CustomEvent('Closing'));
|
|
119
105
|
// Prevent a button behind the `<dialog>` from being clicked erroneously (Svelte bug)
|
|
120
106
|
document.body.inert = true;
|
|
@@ -135,7 +121,6 @@
|
|
|
135
121
|
|
|
136
122
|
onClose?.(new CustomEvent('Close', { detail: { returnValue } }));
|
|
137
123
|
dialog.returnValue = '';
|
|
138
|
-
closing = false;
|
|
139
124
|
};
|
|
140
125
|
|
|
141
126
|
$effect(() => {
|
|
@@ -177,7 +162,8 @@
|
|
|
177
162
|
lightDismiss &&
|
|
178
163
|
/** @type {HTMLElement | undefined} */ (target)?.matches('dialog')
|
|
179
164
|
) {
|
|
180
|
-
|
|
165
|
+
dialog.returnValue = 'cancel';
|
|
166
|
+
open = false;
|
|
181
167
|
}
|
|
182
168
|
}}
|
|
183
169
|
oncancel={(event) => {
|
|
@@ -185,7 +171,8 @@
|
|
|
185
171
|
|
|
186
172
|
// Escape key is pressed
|
|
187
173
|
if (dialog && escapeDismiss) {
|
|
188
|
-
|
|
174
|
+
dialog.returnValue = 'cancel';
|
|
175
|
+
open = false;
|
|
189
176
|
}
|
|
190
177
|
}}
|
|
191
178
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"test:unit": "vitest"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lexical/code": "^0.
|
|
32
|
-
"@lexical/dragon": "^0.
|
|
33
|
-
"@lexical/history": "^0.
|
|
34
|
-
"@lexical/link": "^0.
|
|
35
|
-
"@lexical/list": "^0.
|
|
36
|
-
"@lexical/markdown": "^0.
|
|
37
|
-
"@lexical/rich-text": "^0.
|
|
38
|
-
"@lexical/selection": "^0.
|
|
39
|
-
"@lexical/table": "^0.
|
|
40
|
-
"@lexical/utils": "^0.
|
|
41
|
-
"@sveltia/utils": "^0.7.
|
|
42
|
-
"lexical": "^0.
|
|
31
|
+
"@lexical/code": "^0.31.0",
|
|
32
|
+
"@lexical/dragon": "^0.31.0",
|
|
33
|
+
"@lexical/history": "^0.31.0",
|
|
34
|
+
"@lexical/link": "^0.31.0",
|
|
35
|
+
"@lexical/list": "^0.31.0",
|
|
36
|
+
"@lexical/markdown": "^0.31.0",
|
|
37
|
+
"@lexical/rich-text": "^0.31.0",
|
|
38
|
+
"@lexical/selection": "^0.31.0",
|
|
39
|
+
"@lexical/table": "^0.31.0",
|
|
40
|
+
"@lexical/utils": "^0.31.0",
|
|
41
|
+
"@sveltia/utils": "^0.7.3",
|
|
42
|
+
"lexical": "^0.31.0",
|
|
43
43
|
"prismjs": "^1.30.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -48,31 +48,31 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@playwright/test": "^1.52.0",
|
|
50
50
|
"@sveltejs/adapter-auto": "^6.0.0",
|
|
51
|
-
"@sveltejs/kit": "^2.20.
|
|
51
|
+
"@sveltejs/kit": "^2.20.8",
|
|
52
52
|
"@sveltejs/package": "^2.3.11",
|
|
53
53
|
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
54
|
-
"cspell": "^8.19.
|
|
54
|
+
"cspell": "^8.19.3",
|
|
55
55
|
"eslint": "^8.57.1",
|
|
56
56
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
57
57
|
"eslint-config-prettier": "^10.1.2",
|
|
58
58
|
"eslint-plugin-import": "^2.31.0",
|
|
59
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
59
|
+
"eslint-plugin-jsdoc": "^50.6.11",
|
|
60
60
|
"eslint-plugin-svelte": "^2.46.1",
|
|
61
61
|
"postcss": "^8.5.3",
|
|
62
62
|
"postcss-html": "^1.8.0",
|
|
63
63
|
"prettier": "^3.5.3",
|
|
64
64
|
"prettier-plugin-svelte": "^3.3.3",
|
|
65
|
-
"sass": "^1.
|
|
66
|
-
"stylelint": "^16.
|
|
65
|
+
"sass": "^1.87.0",
|
|
66
|
+
"stylelint": "^16.19.1",
|
|
67
67
|
"stylelint-config-recommended-scss": "^14.1.0",
|
|
68
68
|
"stylelint-scss": "^6.11.1",
|
|
69
|
-
"svelte": "5.28.
|
|
69
|
+
"svelte": "5.28.2",
|
|
70
70
|
"svelte-check": "^4.1.6",
|
|
71
71
|
"svelte-i18n": "^4.0.1",
|
|
72
72
|
"svelte-preprocess": "^6.0.3",
|
|
73
73
|
"tslib": "^2.8.1",
|
|
74
|
-
"vite": "^6.3.
|
|
75
|
-
"vitest": "^3.1.
|
|
74
|
+
"vite": "^6.3.4",
|
|
75
|
+
"vitest": "^3.1.2"
|
|
76
76
|
},
|
|
77
77
|
"exports": {
|
|
78
78
|
".": {
|