@xleddyl/443-components-vue 0.16.102 → 0.16.103
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/CATALOG.md +147 -147
- package/README.md +49 -28
- package/dist/components/layout/AppShell.vue +89 -1
- package/dist/components/layout/AppShell.vue.d.ts +12 -2
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +8 -0
- package/dist/components/overlays/ConfirmHost.vue.d.ts +8 -0
- package/dist/components/overlays/Drawer.vue +9 -1
- package/dist/components/overlays/Drawer.vue.d.ts +10 -0
- package/dist/components/overlays/Modal.vue.d.ts +8 -0
- package/dist/components/overlays/Toaster.vue +2 -1
- package/dist/components/templates/DashboardLayout.vue +11 -1
- package/dist/components/templates/DashboardLayout.vue.d.ts +10 -0
- package/dist/components/templates/FormDrawer.vue +3 -1
- package/dist/components/templates/FormDrawer.vue.d.ts +6 -0
- package/dist/components/templates/FormModal.vue.d.ts +4 -0
- package/dist/components/templates/SettingsModal.vue.d.ts +8 -0
- package/dist/composables/usePreferences.d.ts +1 -0
- package/dist/composables/usePreferences.mjs +2 -1
- package/dist/composables/useRouteRecord.mjs +6 -4
- package/dist/icons/builtin.d.ts +3 -0
- package/dist/icons/builtin.mjs +9 -0
- package/dist/internal/forms/leave.mjs +9 -2
- package/dist/internal/overlays/DialogFrame.vue +152 -90
- package/dist/internal/overlays/DialogFrame.vue.d.ts +8 -0
- package/dist/internal/overlays/OverlayView.vue.d.ts +10 -0
- package/dist/internal/overlays/avoid.mjs +16 -0
- package/dist/internal/overlays/dialog.d.ts +3 -0
- package/dist/internal/overlays/dialog.mjs +61 -15
- package/dist/internal/overlays/dock.d.ts +16 -0
- package/dist/internal/overlays/dock.mjs +10 -0
- package/dist/locale/de.mjs +8 -0
- package/dist/locale/en.mjs +8 -0
- package/dist/locale/it.mjs +8 -0
- package/dist/locale/types.d.ts +8 -0
- package/dist/styles/feedback/skeleton.css +6 -0
- package/dist/styles/layout/app-shell.css +75 -0
- package/dist/styles/layout/stack.css +7 -0
- package/dist/styles/overlays/drawer.css +59 -0
- package/dist/styles/overlays/modal.css +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,11 @@ import { nextTick, onBeforeUnmount, onMounted, ref, shallowReactive, watch } fro
|
|
|
2
2
|
import { useScrollLock } from "../../composables/useScrollLock.mjs";
|
|
3
3
|
import { activeElement, hasFocusWithin, isFocusLost } from "../core/focus.mjs";
|
|
4
4
|
import { waitForAnimations } from "../floating/support.mjs";
|
|
5
|
+
import { dockedStack, releaseDocked } from "./dock.mjs";
|
|
5
6
|
export const modalStack = shallowReactive([]);
|
|
7
|
+
export function topDialog() {
|
|
8
|
+
return modalStack[modalStack.length - 1] ?? dockedStack[dockedStack.length - 1];
|
|
9
|
+
}
|
|
6
10
|
export function releaseModal(dialog) {
|
|
7
11
|
const index = dialog ? modalStack.indexOf(dialog) : -1;
|
|
8
12
|
if (index !== -1) modalStack.splice(index, 1);
|
|
@@ -13,6 +17,9 @@ export function useModalDialog(options) {
|
|
|
13
17
|
let returnTarget = null;
|
|
14
18
|
let pressedOnBackdrop = false;
|
|
15
19
|
let closing = false;
|
|
20
|
+
let shownModal = false;
|
|
21
|
+
let silentCloses = 0;
|
|
22
|
+
const isModal = () => options.modal?.() ?? true;
|
|
16
23
|
async function allowClose(reason) {
|
|
17
24
|
const guard = options.beforeClose?.();
|
|
18
25
|
if (!guard) return true;
|
|
@@ -28,18 +35,41 @@ export function useModalDialog(options) {
|
|
|
28
35
|
}
|
|
29
36
|
async function requestClose(reason) {
|
|
30
37
|
if (!options.open.value) return true;
|
|
38
|
+
if (options.interceptClose?.(reason)) return false;
|
|
31
39
|
if (!await allowClose(reason)) return false;
|
|
32
40
|
options.open.value = false;
|
|
33
41
|
return true;
|
|
34
42
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
if (!
|
|
43
|
+
function display(dialog) {
|
|
44
|
+
shownModal = isModal();
|
|
45
|
+
if (!shownModal) {
|
|
46
|
+
dialog.show();
|
|
47
|
+
releaseDocked(dialog);
|
|
48
|
+
dockedStack.push(dialog);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
38
51
|
try {
|
|
39
52
|
dialog.showModal();
|
|
40
53
|
} catch {
|
|
41
54
|
dialog.setAttribute("open", "");
|
|
42
55
|
}
|
|
56
|
+
scrollLock.lock();
|
|
57
|
+
releaseModal(dialog);
|
|
58
|
+
modalStack.push(dialog);
|
|
59
|
+
}
|
|
60
|
+
function conceal(dialog, silent) {
|
|
61
|
+
scrollLock.unlock();
|
|
62
|
+
shownModal = false;
|
|
63
|
+
releaseModal(dialog);
|
|
64
|
+
releaseDocked(dialog);
|
|
65
|
+
if (!dialog.open) return;
|
|
66
|
+
if (silent) silentCloses += 1;
|
|
67
|
+
dialog.close();
|
|
68
|
+
}
|
|
69
|
+
function reopen() {
|
|
70
|
+
const dialog = options.dialog.value;
|
|
71
|
+
if (!dialog || dialog.open || !options.open.value) return;
|
|
72
|
+
display(dialog);
|
|
43
73
|
}
|
|
44
74
|
async function show() {
|
|
45
75
|
present.value = true;
|
|
@@ -48,27 +78,21 @@ export function useModalDialog(options) {
|
|
|
48
78
|
if (!dialog || !options.open.value) return;
|
|
49
79
|
if (dialog.open) return;
|
|
50
80
|
returnTarget = activeElement();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
dialog.setAttribute("open", "");
|
|
55
|
-
}
|
|
56
|
-
scrollLock.lock();
|
|
57
|
-
releaseModal(dialog);
|
|
58
|
-
modalStack.push(dialog);
|
|
59
|
-
if (!dialog.querySelector("[autofocus]")) options.panel.value?.focus({ preventScroll: true });
|
|
81
|
+
display(dialog);
|
|
82
|
+
if (shownModal && !dialog.querySelector("[autofocus]"))
|
|
83
|
+
options.panel.value?.focus({ preventScroll: true });
|
|
60
84
|
options.onOpen?.();
|
|
61
85
|
}
|
|
62
86
|
function hide() {
|
|
63
87
|
const dialog = options.dialog.value;
|
|
64
|
-
scrollLock.unlock();
|
|
65
88
|
if (!dialog) {
|
|
89
|
+
scrollLock.unlock();
|
|
90
|
+
shownModal = false;
|
|
66
91
|
present.value = false;
|
|
67
92
|
return;
|
|
68
93
|
}
|
|
69
94
|
const focusInside = hasFocusWithin(dialog);
|
|
70
|
-
|
|
71
|
-
if (dialog.open) dialog.close();
|
|
95
|
+
conceal(dialog, false);
|
|
72
96
|
const target = returnTarget;
|
|
73
97
|
returnTarget = null;
|
|
74
98
|
if ((focusInside || isFocusLost(dialog)) && target?.isConnected)
|
|
@@ -81,12 +105,30 @@ export function useModalDialog(options) {
|
|
|
81
105
|
});
|
|
82
106
|
}
|
|
83
107
|
watch(options.open, (value) => value ? show() : hide());
|
|
108
|
+
watch(
|
|
109
|
+
isModal,
|
|
110
|
+
(modal) => {
|
|
111
|
+
const dialog = options.dialog.value;
|
|
112
|
+
if (!dialog?.isConnected || !options.open.value || !present.value) return;
|
|
113
|
+
if (dialog.open && modal === shownModal && dialog.matches(":modal") === modal) return;
|
|
114
|
+
const focused = hasFocusWithin(dialog) ? activeElement() : null;
|
|
115
|
+
conceal(dialog, true);
|
|
116
|
+
display(dialog);
|
|
117
|
+
if (focused?.isConnected) focused.focus({ preventScroll: true });
|
|
118
|
+
else if (shownModal && !dialog.querySelector("[autofocus]"))
|
|
119
|
+
options.panel.value?.focus({ preventScroll: true });
|
|
120
|
+
},
|
|
121
|
+
{ flush: "post" }
|
|
122
|
+
);
|
|
84
123
|
onMounted(() => {
|
|
85
124
|
if (options.open.value) show();
|
|
86
125
|
});
|
|
87
126
|
onBeforeUnmount(() => {
|
|
88
127
|
const dialog = options.dialog.value;
|
|
128
|
+
scrollLock.unlock();
|
|
129
|
+
shownModal = false;
|
|
89
130
|
releaseModal(dialog);
|
|
131
|
+
releaseDocked(dialog);
|
|
90
132
|
if (dialog?.open) dialog.close();
|
|
91
133
|
if (returnTarget?.isConnected) returnTarget.focus({ preventScroll: true });
|
|
92
134
|
});
|
|
@@ -96,6 +138,10 @@ export function useModalDialog(options) {
|
|
|
96
138
|
if (options.dismissible()) requestClose("escape");
|
|
97
139
|
}
|
|
98
140
|
async function onClose() {
|
|
141
|
+
if (silentCloses > 0) {
|
|
142
|
+
silentCloses -= 1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
99
145
|
if (!options.open.value) return;
|
|
100
146
|
if (!options.beforeClose?.()) {
|
|
101
147
|
options.open.value = false;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue';
|
|
2
|
+
export declare const DOCK_BREAKPOINT = 1280;
|
|
3
|
+
export declare const DOCK_WIDTH: {
|
|
4
|
+
readonly initial: 480;
|
|
5
|
+
readonly min: 352;
|
|
6
|
+
readonly max: 768;
|
|
7
|
+
readonly share: 0.45;
|
|
8
|
+
};
|
|
9
|
+
export interface DockHost {
|
|
10
|
+
target: Readonly<Ref<HTMLElement | null>>;
|
|
11
|
+
wide: Readonly<Ref<boolean>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const DOCK_KEY: InjectionKey<DockHost>;
|
|
14
|
+
export declare const dockedStack: import("vue").ShallowReactive<HTMLDialogElement[]>;
|
|
15
|
+
export declare const dockFrame: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
16
|
+
export declare function releaseDocked(dialog: HTMLDialogElement | null | undefined): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { shallowReactive, shallowRef } from "vue";
|
|
2
|
+
export const DOCK_BREAKPOINT = 1280;
|
|
3
|
+
export const DOCK_WIDTH = { initial: 480, min: 352, max: 768, share: 0.45 };
|
|
4
|
+
export const DOCK_KEY = Symbol("k-dock");
|
|
5
|
+
export const dockedStack = shallowReactive([]);
|
|
6
|
+
export const dockFrame = shallowRef(null);
|
|
7
|
+
export function releaseDocked(dialog) {
|
|
8
|
+
const index = dialog ? dockedStack.indexOf(dialog) : -1;
|
|
9
|
+
if (index !== -1) dockedStack.splice(index, 1);
|
|
10
|
+
}
|
package/dist/locale/de.mjs
CHANGED
|
@@ -259,6 +259,14 @@ export const de = {
|
|
|
259
259
|
confirm: "\xC4nderungen verwerfen",
|
|
260
260
|
cancel: "Weiter bearbeiten"
|
|
261
261
|
},
|
|
262
|
+
dock: {
|
|
263
|
+
label: "Details",
|
|
264
|
+
emptyTitle: "Nichts ausgew\xE4hlt",
|
|
265
|
+
emptyDescription: "W\xE4hlen Sie ein Element der Liste, um hier seine Details zu sehen.",
|
|
266
|
+
resize: "Gr\xF6\xDFe des Detailbereichs \xE4ndern",
|
|
267
|
+
expand: "Erweitern",
|
|
268
|
+
collapse: "Seitlich andocken"
|
|
269
|
+
},
|
|
262
270
|
formDrawer: {
|
|
263
271
|
discardDescription: "Die \xC4nderungen an diesem Element gehen verloren."
|
|
264
272
|
},
|
package/dist/locale/en.mjs
CHANGED
|
@@ -259,6 +259,14 @@ export const en = {
|
|
|
259
259
|
confirm: "Discard changes",
|
|
260
260
|
cancel: "Keep editing"
|
|
261
261
|
},
|
|
262
|
+
dock: {
|
|
263
|
+
label: "Details",
|
|
264
|
+
emptyTitle: "Nothing selected",
|
|
265
|
+
emptyDescription: "Select an item in the list to see its details here.",
|
|
266
|
+
resize: "Resize the details panel",
|
|
267
|
+
expand: "Expand",
|
|
268
|
+
collapse: "Dock to the side"
|
|
269
|
+
},
|
|
262
270
|
formDrawer: {
|
|
263
271
|
discardDescription: "The changes to this item will be lost."
|
|
264
272
|
},
|
package/dist/locale/it.mjs
CHANGED
|
@@ -259,6 +259,14 @@ export const it = {
|
|
|
259
259
|
confirm: "Scarta modifiche",
|
|
260
260
|
cancel: "Continua a modificare"
|
|
261
261
|
},
|
|
262
|
+
dock: {
|
|
263
|
+
label: "Dettagli",
|
|
264
|
+
emptyTitle: "Nessun elemento selezionato",
|
|
265
|
+
emptyDescription: "Seleziona un elemento della lista per vederne qui i dettagli.",
|
|
266
|
+
resize: "Ridimensiona il pannello dei dettagli",
|
|
267
|
+
expand: "Espandi",
|
|
268
|
+
collapse: "Riduci a lato"
|
|
269
|
+
},
|
|
262
270
|
formDrawer: {
|
|
263
271
|
discardDescription: "Le modifiche a questo elemento andranno perse."
|
|
264
272
|
},
|
package/dist/locale/types.d.ts
CHANGED
|
@@ -246,6 +246,14 @@ export interface KMessages {
|
|
|
246
246
|
confirm: string;
|
|
247
247
|
cancel: string;
|
|
248
248
|
};
|
|
249
|
+
dock: {
|
|
250
|
+
label: string;
|
|
251
|
+
emptyTitle: string;
|
|
252
|
+
emptyDescription: string;
|
|
253
|
+
resize: string;
|
|
254
|
+
expand: string;
|
|
255
|
+
collapse: string;
|
|
256
|
+
};
|
|
249
257
|
formDrawer: {
|
|
250
258
|
discardDescription: string;
|
|
251
259
|
};
|
|
@@ -169,6 +169,77 @@ html.k-root body {
|
|
|
169
169
|
min-height: 0;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
.k-shell-dock {
|
|
173
|
+
position: relative;
|
|
174
|
+
display: none;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
width: var(--k-shell-dock-width, 30rem);
|
|
177
|
+
min-width: 0;
|
|
178
|
+
min-height: 0;
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.k-shell-dock-frame {
|
|
183
|
+
position: relative;
|
|
184
|
+
display: flex;
|
|
185
|
+
flex: 1;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
min-height: 0;
|
|
188
|
+
margin: var(--k-shell-gap) var(--k-shell-gap) var(--k-shell-gap) 0;
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
background: var(--k-surface);
|
|
191
|
+
border: 1px solid var(--k-line);
|
|
192
|
+
border-radius: var(--k-radius-xl);
|
|
193
|
+
box-shadow: var(--k-shadow-xs);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.k-shell-dock-slot {
|
|
197
|
+
display: contents;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.k-shell-dock-empty {
|
|
201
|
+
flex: 1;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.k-shell-dock-frame:has(> .k-shell-dock-slot > .k-drawer[open]) > .k-shell-dock-empty {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.k-shell-dock-handle.k-resize-handle-vertical {
|
|
210
|
+
position: absolute;
|
|
211
|
+
inset-block: calc(var(--k-shell-gap) + var(--k-radius-xl));
|
|
212
|
+
left: calc(var(--k-shell-gap) / -2);
|
|
213
|
+
z-index: 3;
|
|
214
|
+
background: transparent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.k-shell-dock-handle.k-resize-handle-vertical::before {
|
|
218
|
+
inset: 0 calc(var(--k-shell-gap) / -2 - 0.125rem);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.k-shell[data-variant='sidebar'] .k-shell-dock-frame {
|
|
222
|
+
margin: 0;
|
|
223
|
+
border-width: 0 0 0 1px;
|
|
224
|
+
border-radius: 0;
|
|
225
|
+
box-shadow: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.k-shell[data-variant='sidebar'] .k-shell-dock-handle.k-resize-handle-vertical {
|
|
229
|
+
inset-block: 0;
|
|
230
|
+
left: -1px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.k-shell[data-variant='floating'] .k-shell-dock-frame {
|
|
234
|
+
box-shadow: var(--k-shadow-sm);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@container k-shell (min-width: 1280px) {
|
|
238
|
+
.k-shell:has(.k-drawer.is-dockable) > .k-shell-dock {
|
|
239
|
+
display: flex;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
172
243
|
.k-shell[data-variant='sidebar'] .k-shell-sidebar {
|
|
173
244
|
border-right: 1px solid var(--k-line);
|
|
174
245
|
}
|
|
@@ -214,6 +285,10 @@ html.k-root body {
|
|
|
214
285
|
view-transition-name: k-shell-body;
|
|
215
286
|
}
|
|
216
287
|
|
|
288
|
+
.k-shell.is-named .k-shell-dock {
|
|
289
|
+
view-transition-name: k-shell-dock;
|
|
290
|
+
}
|
|
291
|
+
|
|
217
292
|
@container k-shell (min-width: 768px) {
|
|
218
293
|
.k-shell.is-collapsed .k-shell-sidebar {
|
|
219
294
|
width: var(--k-shell-rail);
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
overflow-y: auto;
|
|
127
127
|
overscroll-behavior: contain;
|
|
128
128
|
padding: 1.5rem;
|
|
129
|
+
container: k-drawer / inline-size;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
.k-drawer-footer {
|
|
@@ -133,6 +134,64 @@
|
|
|
133
134
|
padding: 0.75rem 1rem 0.75rem 1.25rem;
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
.k-drawer-panel {
|
|
138
|
+
container: k-drawer-panel / inline-size;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@container k-drawer-panel (max-width: 40rem) {
|
|
142
|
+
.k-drawer-header {
|
|
143
|
+
flex-wrap: wrap;
|
|
144
|
+
row-gap: 0.5rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.k-drawer-heading {
|
|
148
|
+
min-width: min(100%, 12rem);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.k-drawer-actions {
|
|
152
|
+
margin-inline-start: auto;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.k-drawer-body {
|
|
156
|
+
padding: 1.25rem;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.k-drawer.is-docked {
|
|
161
|
+
position: static;
|
|
162
|
+
inset: auto;
|
|
163
|
+
flex: 1;
|
|
164
|
+
width: auto;
|
|
165
|
+
height: auto;
|
|
166
|
+
min-height: 0;
|
|
167
|
+
padding: 0;
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
transition: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.k-drawer.is-docked[open] {
|
|
173
|
+
display: flex;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.k-drawer.is-docked[open] > .k-drawer-panel {
|
|
177
|
+
max-width: none;
|
|
178
|
+
height: auto;
|
|
179
|
+
flex: 1;
|
|
180
|
+
min-height: 0;
|
|
181
|
+
background: transparent;
|
|
182
|
+
border-radius: 0;
|
|
183
|
+
box-shadow: none;
|
|
184
|
+
transform: none;
|
|
185
|
+
transition: none;
|
|
186
|
+
animation: k-dock-enter var(--k-duration-lg) var(--k-ease-out);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes k-dock-enter {
|
|
190
|
+
from {
|
|
191
|
+
opacity: 0;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
136
195
|
@media (max-width: 640px) {
|
|
137
196
|
.k-drawer.k-drawer-left,
|
|
138
197
|
.k-drawer.k-drawer-right {
|
package/package.json
CHANGED