@shwfed/nuxt 0.10.13 → 0.10.15
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/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/components/app.d.vue.ts +2 -1
- package/dist/runtime/components/app.vue.d.ts +2 -1
- package/dist/runtime/components/button.d.vue.ts +63 -4
- package/dist/runtime/components/button.vue +12 -2
- package/dist/runtime/components/button.vue.d.ts +63 -4
- package/dist/runtime/components/modal.d.vue.ts +53 -0
- package/dist/runtime/components/modal.vue +141 -0
- package/dist/runtime/components/modal.vue.d.ts +53 -0
- package/dist/runtime/components/ui/app/App.d.vue.ts +7 -5
- package/dist/runtime/components/ui/app/App.vue +23 -8
- package/dist/runtime/components/ui/app/App.vue.d.ts +7 -5
- package/dist/runtime/components/ui/app/OverlayHost.d.vue.ts +3 -0
- package/dist/runtime/components/ui/app/OverlayHost.vue +91 -0
- package/dist/runtime/components/ui/app/OverlayHost.vue.d.ts +3 -0
- package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.d.vue.ts +52 -0
- package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue.d.ts +52 -0
- package/dist/runtime/components/ui/buttons/Buttons.d.vue.ts +54 -2
- package/dist/runtime/components/ui/buttons/Buttons.vue +56 -3
- package/dist/runtime/components/ui/buttons/Buttons.vue.d.ts +54 -2
- package/dist/runtime/components/ui/buttons/schema.d.ts +307 -0
- package/dist/runtime/components/ui/buttons/schema.js +11 -2
- package/dist/runtime/components/ui/drawer/Drawer.d.vue.ts +31 -0
- package/dist/runtime/components/ui/drawer/Drawer.vue +38 -0
- package/dist/runtime/components/ui/drawer/Drawer.vue.d.ts +31 -0
- package/dist/runtime/components/ui/drawer/DrawerClose.d.vue.ts +14 -0
- package/dist/runtime/components/ui/drawer/DrawerClose.vue +19 -0
- package/dist/runtime/components/ui/drawer/DrawerClose.vue.d.ts +14 -0
- package/dist/runtime/components/ui/drawer/DrawerContent.d.vue.ts +20 -0
- package/dist/runtime/components/ui/drawer/DrawerContent.vue +50 -0
- package/dist/runtime/components/ui/drawer/DrawerContent.vue.d.ts +20 -0
- package/dist/runtime/components/ui/drawer/DrawerDescription.d.vue.ts +18 -0
- package/dist/runtime/components/ui/drawer/DrawerDescription.vue +26 -0
- package/dist/runtime/components/ui/drawer/DrawerDescription.vue.d.ts +18 -0
- package/dist/runtime/components/ui/drawer/DrawerFooter.d.vue.ts +17 -0
- package/dist/runtime/components/ui/drawer/DrawerFooter.vue +15 -0
- package/dist/runtime/components/ui/drawer/DrawerFooter.vue.d.ts +17 -0
- package/dist/runtime/components/ui/drawer/DrawerHeader.d.vue.ts +17 -0
- package/dist/runtime/components/ui/drawer/DrawerHeader.vue +15 -0
- package/dist/runtime/components/ui/drawer/DrawerHeader.vue.d.ts +17 -0
- package/dist/runtime/components/ui/drawer/DrawerOverlay.d.vue.ts +7 -0
- package/dist/runtime/components/ui/drawer/DrawerOverlay.vue +19 -0
- package/dist/runtime/components/ui/drawer/DrawerOverlay.vue.d.ts +7 -0
- package/dist/runtime/components/ui/drawer/DrawerTitle.d.vue.ts +18 -0
- package/dist/runtime/components/ui/drawer/DrawerTitle.vue +26 -0
- package/dist/runtime/components/ui/drawer/DrawerTitle.vue.d.ts +18 -0
- package/dist/runtime/components/ui/drawer/DrawerTrigger.d.vue.ts +14 -0
- package/dist/runtime/components/ui/drawer/DrawerTrigger.vue +19 -0
- package/dist/runtime/components/ui/drawer/DrawerTrigger.vue.d.ts +14 -0
- package/dist/runtime/components/ui/drawer/index.d.ts +8 -0
- package/dist/runtime/components/ui/drawer/index.js +8 -0
- package/dist/runtime/composables/useOverlay.d.ts +86 -0
- package/dist/runtime/composables/useOverlay.js +201 -0
- package/dist/runtime/layouts/default.d.vue.ts +2 -1
- package/dist/runtime/layouts/default.vue.d.ts +2 -1
- package/dist/runtime/plugins/overlay/index.d.ts +6 -0
- package/dist/runtime/plugins/overlay/index.js +12 -0
- package/dist/runtime/plugins/toast/index.d.ts +2 -2
- package/package.json +2 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Scope } from 'effect';
|
|
2
2
|
import { Effect } from 'effect';
|
|
3
|
+
import { type OverlayService as OverlayRuntimeService } from '../../../composables/useOverlay.js';
|
|
3
4
|
import { type Sidebar as SidebarType } from '../../../composables/useNavigationTabs.js';
|
|
5
|
+
type UiCommandEffect = Effect.Effect<void, never, Scope.Scope | OverlayRuntimeService>;
|
|
4
6
|
type ProfileCommandInputItem = Readonly<{
|
|
5
7
|
id: string | number;
|
|
6
8
|
title: string;
|
|
7
9
|
icon?: string;
|
|
8
10
|
hidden?: boolean;
|
|
9
11
|
disabled?: boolean;
|
|
10
|
-
effect?:
|
|
12
|
+
effect?: UiCommandEffect;
|
|
11
13
|
keywords?: Array<string>;
|
|
12
14
|
}>;
|
|
13
15
|
type ProfileCommandInputGroup = Readonly<{
|
|
@@ -67,13 +69,13 @@ type __VLS_Props = {
|
|
|
67
69
|
*/
|
|
68
70
|
commands?: Array<ProfileCommandInputItem | ProfileCommandInputGroup>;
|
|
69
71
|
};
|
|
70
|
-
declare var
|
|
72
|
+
declare var __VLS_113: {}, __VLS_129: {}, __VLS_352: {};
|
|
71
73
|
type __VLS_Slots = {} & {
|
|
72
|
-
menu?: (props: typeof
|
|
74
|
+
menu?: (props: typeof __VLS_113) => any;
|
|
73
75
|
} & {
|
|
74
|
-
profile?: (props: typeof
|
|
76
|
+
profile?: (props: typeof __VLS_129) => any;
|
|
75
77
|
} & {
|
|
76
|
-
default?: (props: typeof
|
|
78
|
+
default?: (props: typeof __VLS_352) => any;
|
|
77
79
|
};
|
|
78
80
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
79
81
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, defineComponent } from "vue";
|
|
3
|
+
import ShwfedModal from "../../modal.vue";
|
|
4
|
+
import { useOverlay } from "../../../composables/useOverlay";
|
|
5
|
+
const overlay = useOverlay();
|
|
6
|
+
const OverlayBody = defineComponent({
|
|
7
|
+
name: "OverlayBody",
|
|
8
|
+
props: {
|
|
9
|
+
render: {
|
|
10
|
+
type: Function,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
slotProps: {
|
|
14
|
+
type: Object,
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(props) {
|
|
19
|
+
return () => props.render(props.slotProps);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
function handleOpenUpdate(sessionId, open) {
|
|
23
|
+
if (open) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
overlay.closeSync(sessionId, {
|
|
27
|
+
_tag: "OverlayAborted",
|
|
28
|
+
reason: "dismiss"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const renderedSessions = computed(() => {
|
|
32
|
+
const nextSessions = [];
|
|
33
|
+
for (const session of overlay.sessions) {
|
|
34
|
+
const definition = overlay.definitions[session.definitionId];
|
|
35
|
+
if (!definition) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
nextSessions.push({
|
|
39
|
+
sessionId: session.sessionId,
|
|
40
|
+
definitionId: session.definitionId,
|
|
41
|
+
shell: session.shell,
|
|
42
|
+
props: session.props,
|
|
43
|
+
definition
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return nextSessions;
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<template
|
|
52
|
+
v-for="session in renderedSessions"
|
|
53
|
+
:key="session.sessionId"
|
|
54
|
+
>
|
|
55
|
+
<ShwfedModal
|
|
56
|
+
:open="true"
|
|
57
|
+
:breakpoint="session.shell.breakpoint"
|
|
58
|
+
:show-close-button="session.shell.showCloseButton"
|
|
59
|
+
:dismissible="session.shell.dismissible"
|
|
60
|
+
@update:open="handleOpenUpdate(session.sessionId, $event)"
|
|
61
|
+
>
|
|
62
|
+
<template
|
|
63
|
+
v-if="session.shell.title"
|
|
64
|
+
#title
|
|
65
|
+
>
|
|
66
|
+
{{ session.shell.title }}
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<template
|
|
70
|
+
v-if="session.shell.description"
|
|
71
|
+
#description
|
|
72
|
+
>
|
|
73
|
+
{{ session.shell.description }}
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<template #default="modalSlotProps">
|
|
77
|
+
<OverlayBody
|
|
78
|
+
:render="session.definition.render"
|
|
79
|
+
:slot-props="{
|
|
80
|
+
props: session.props,
|
|
81
|
+
shell: session.shell,
|
|
82
|
+
sessionId: session.sessionId,
|
|
83
|
+
close: (value) => overlay.closeSync(session.sessionId, value),
|
|
84
|
+
patch: (nextProps) => overlay.patchSync(session.sessionId, { props: nextProps }),
|
|
85
|
+
isDesktop: modalSlotProps.isDesktop
|
|
86
|
+
}"
|
|
87
|
+
/>
|
|
88
|
+
</template>
|
|
89
|
+
</ShwfedModal>
|
|
90
|
+
</template>
|
|
91
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -24,6 +24,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
icon?: string | undefined;
|
|
25
25
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
26
26
|
hideTitle?: boolean | undefined;
|
|
27
|
+
modal?: Readonly<{
|
|
28
|
+
title?: readonly {
|
|
29
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
30
|
+
message: string;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
description?: readonly {
|
|
33
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
34
|
+
message: string;
|
|
35
|
+
}[] | undefined;
|
|
36
|
+
showCloseButton?: boolean | undefined;
|
|
37
|
+
breakpoint?: string | undefined;
|
|
38
|
+
dismissible?: boolean | undefined;
|
|
39
|
+
}> | undefined;
|
|
27
40
|
}> | Readonly<{
|
|
28
41
|
id: string;
|
|
29
42
|
title: readonly {
|
|
@@ -42,6 +55,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
42
55
|
}[] | undefined;
|
|
43
56
|
icon?: string | undefined;
|
|
44
57
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
58
|
+
modal?: Readonly<{
|
|
59
|
+
title?: readonly {
|
|
60
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
61
|
+
message: string;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
description?: readonly {
|
|
64
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
65
|
+
message: string;
|
|
66
|
+
}[] | undefined;
|
|
67
|
+
showCloseButton?: boolean | undefined;
|
|
68
|
+
breakpoint?: string | undefined;
|
|
69
|
+
dismissible?: boolean | undefined;
|
|
70
|
+
}> | undefined;
|
|
45
71
|
}>[];
|
|
46
72
|
icon?: string | undefined;
|
|
47
73
|
}>)[];
|
|
@@ -67,6 +93,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
67
93
|
icon?: string | undefined;
|
|
68
94
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
69
95
|
hideTitle?: boolean | undefined;
|
|
96
|
+
modal?: Readonly<{
|
|
97
|
+
title?: readonly {
|
|
98
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
99
|
+
message: string;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
description?: readonly {
|
|
102
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
103
|
+
message: string;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
showCloseButton?: boolean | undefined;
|
|
106
|
+
breakpoint?: string | undefined;
|
|
107
|
+
dismissible?: boolean | undefined;
|
|
108
|
+
}> | undefined;
|
|
70
109
|
}> | Readonly<{
|
|
71
110
|
id: string;
|
|
72
111
|
title: readonly {
|
|
@@ -85,6 +124,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
85
124
|
}[] | undefined;
|
|
86
125
|
icon?: string | undefined;
|
|
87
126
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
127
|
+
modal?: Readonly<{
|
|
128
|
+
title?: readonly {
|
|
129
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
130
|
+
message: string;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
description?: readonly {
|
|
133
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
134
|
+
message: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
showCloseButton?: boolean | undefined;
|
|
137
|
+
breakpoint?: string | undefined;
|
|
138
|
+
dismissible?: boolean | undefined;
|
|
139
|
+
}> | undefined;
|
|
88
140
|
}>[];
|
|
89
141
|
icon?: string | undefined;
|
|
90
142
|
}>)[];
|
|
@@ -24,6 +24,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
icon?: string | undefined;
|
|
25
25
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
26
26
|
hideTitle?: boolean | undefined;
|
|
27
|
+
modal?: Readonly<{
|
|
28
|
+
title?: readonly {
|
|
29
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
30
|
+
message: string;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
description?: readonly {
|
|
33
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
34
|
+
message: string;
|
|
35
|
+
}[] | undefined;
|
|
36
|
+
showCloseButton?: boolean | undefined;
|
|
37
|
+
breakpoint?: string | undefined;
|
|
38
|
+
dismissible?: boolean | undefined;
|
|
39
|
+
}> | undefined;
|
|
27
40
|
}> | Readonly<{
|
|
28
41
|
id: string;
|
|
29
42
|
title: readonly {
|
|
@@ -42,6 +55,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
42
55
|
}[] | undefined;
|
|
43
56
|
icon?: string | undefined;
|
|
44
57
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
58
|
+
modal?: Readonly<{
|
|
59
|
+
title?: readonly {
|
|
60
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
61
|
+
message: string;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
description?: readonly {
|
|
64
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
65
|
+
message: string;
|
|
66
|
+
}[] | undefined;
|
|
67
|
+
showCloseButton?: boolean | undefined;
|
|
68
|
+
breakpoint?: string | undefined;
|
|
69
|
+
dismissible?: boolean | undefined;
|
|
70
|
+
}> | undefined;
|
|
45
71
|
}>[];
|
|
46
72
|
icon?: string | undefined;
|
|
47
73
|
}>)[];
|
|
@@ -67,6 +93,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
67
93
|
icon?: string | undefined;
|
|
68
94
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
69
95
|
hideTitle?: boolean | undefined;
|
|
96
|
+
modal?: Readonly<{
|
|
97
|
+
title?: readonly {
|
|
98
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
99
|
+
message: string;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
description?: readonly {
|
|
102
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
103
|
+
message: string;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
showCloseButton?: boolean | undefined;
|
|
106
|
+
breakpoint?: string | undefined;
|
|
107
|
+
dismissible?: boolean | undefined;
|
|
108
|
+
}> | undefined;
|
|
70
109
|
}> | Readonly<{
|
|
71
110
|
id: string;
|
|
72
111
|
title: readonly {
|
|
@@ -85,6 +124,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
85
124
|
}[] | undefined;
|
|
86
125
|
icon?: string | undefined;
|
|
87
126
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
127
|
+
modal?: Readonly<{
|
|
128
|
+
title?: readonly {
|
|
129
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
130
|
+
message: string;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
description?: readonly {
|
|
133
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
134
|
+
message: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
showCloseButton?: boolean | undefined;
|
|
137
|
+
breakpoint?: string | undefined;
|
|
138
|
+
dismissible?: boolean | undefined;
|
|
139
|
+
}> | undefined;
|
|
88
140
|
}>[];
|
|
89
141
|
icon?: string | undefined;
|
|
90
142
|
}>)[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import { type ButtonConfig } from './schema.js';
|
|
3
|
-
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './schema.js';
|
|
4
|
-
export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './schema.js';
|
|
3
|
+
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC } from './schema.js';
|
|
4
|
+
export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal } from './schema.js';
|
|
5
5
|
declare const _default: typeof __VLS_export;
|
|
6
6
|
export default _default;
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<{
|
|
@@ -23,6 +23,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
23
23
|
icon?: string | undefined;
|
|
24
24
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
25
25
|
hideTitle?: boolean | undefined;
|
|
26
|
+
modal?: Readonly<{
|
|
27
|
+
title?: readonly {
|
|
28
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
29
|
+
message: string;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
description?: readonly {
|
|
32
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
33
|
+
message: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
showCloseButton?: boolean | undefined;
|
|
36
|
+
breakpoint?: string | undefined;
|
|
37
|
+
dismissible?: boolean | undefined;
|
|
38
|
+
}> | undefined;
|
|
26
39
|
}> | Readonly<{
|
|
27
40
|
id: string;
|
|
28
41
|
title: readonly {
|
|
@@ -41,6 +54,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
41
54
|
}[] | undefined;
|
|
42
55
|
icon?: string | undefined;
|
|
43
56
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
57
|
+
modal?: Readonly<{
|
|
58
|
+
title?: readonly {
|
|
59
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
60
|
+
message: string;
|
|
61
|
+
}[] | undefined;
|
|
62
|
+
description?: readonly {
|
|
63
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
64
|
+
message: string;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
showCloseButton?: boolean | undefined;
|
|
67
|
+
breakpoint?: string | undefined;
|
|
68
|
+
dismissible?: boolean | undefined;
|
|
69
|
+
}> | undefined;
|
|
44
70
|
}>[];
|
|
45
71
|
icon?: string | undefined;
|
|
46
72
|
}>)[];
|
|
@@ -67,6 +93,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
67
93
|
icon?: string | undefined;
|
|
68
94
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
69
95
|
hideTitle?: boolean | undefined;
|
|
96
|
+
modal?: Readonly<{
|
|
97
|
+
title?: readonly {
|
|
98
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
99
|
+
message: string;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
description?: readonly {
|
|
102
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
103
|
+
message: string;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
showCloseButton?: boolean | undefined;
|
|
106
|
+
breakpoint?: string | undefined;
|
|
107
|
+
dismissible?: boolean | undefined;
|
|
108
|
+
}> | undefined;
|
|
70
109
|
}> | Readonly<{
|
|
71
110
|
id: string;
|
|
72
111
|
title: readonly {
|
|
@@ -85,6 +124,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
85
124
|
}[] | undefined;
|
|
86
125
|
icon?: string | undefined;
|
|
87
126
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
127
|
+
modal?: Readonly<{
|
|
128
|
+
title?: readonly {
|
|
129
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
130
|
+
message: string;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
description?: readonly {
|
|
133
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
134
|
+
message: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
showCloseButton?: boolean | undefined;
|
|
137
|
+
breakpoint?: string | undefined;
|
|
138
|
+
dismissible?: boolean | undefined;
|
|
139
|
+
}> | undefined;
|
|
88
140
|
}>[];
|
|
89
141
|
icon?: string | undefined;
|
|
90
142
|
}>)[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useNuxtApp } from "#app";
|
|
3
|
-
import { useAttrs, computed, ref, watch } from "vue";
|
|
3
|
+
import { useAttrs, computed, onBeforeUnmount, ref, useSlots, watch } from "vue";
|
|
4
4
|
import { computedAsync } from "@vueuse/core";
|
|
5
5
|
import { Icon } from "@iconify/vue";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
import { useI18n } from "vue-i18n";
|
|
8
8
|
import { useCheating } from "#imports";
|
|
9
|
+
import { provideOverlay, useOverlay } from "../../../composables/useOverlay";
|
|
9
10
|
import { getLocalizedText, hasVisibleLocaleValue } from "../../../utils/coders";
|
|
10
11
|
import { cn } from "../../../utils/cn";
|
|
11
12
|
import ButtonConfiguratorDialog from "../button-configurator/ButtonConfiguratorDialog.vue";
|
|
@@ -28,11 +29,14 @@ const defaultConfig = {
|
|
|
28
29
|
};
|
|
29
30
|
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
30
31
|
const attrs = useAttrs();
|
|
32
|
+
const slots = useSlots();
|
|
31
33
|
const { locale, t } = useI18n();
|
|
32
34
|
const { $dsl } = useNuxtApp();
|
|
35
|
+
const overlay = useOverlay();
|
|
33
36
|
const isCheating = useCheating();
|
|
34
37
|
const isConfiguratorOpen = ref(false);
|
|
35
38
|
const pendingIds = ref([]);
|
|
39
|
+
const overlayOwnerId = crypto.randomUUID();
|
|
36
40
|
const currentConfig = computedAsync(
|
|
37
41
|
async () => ButtonConfigC.parse(normalizeButtonConfigInput(await props.config.pipe(Effect.runPromise)))
|
|
38
42
|
);
|
|
@@ -42,6 +46,43 @@ watch(currentConfig, (value) => {
|
|
|
42
46
|
displayConfig.value = value;
|
|
43
47
|
}
|
|
44
48
|
}, { immediate: true });
|
|
49
|
+
const modalDefinitions = computed(() => {
|
|
50
|
+
const nextDefinitions = [];
|
|
51
|
+
for (const group of displayConfig.value.groups) {
|
|
52
|
+
for (const item of group.items) {
|
|
53
|
+
if (isDropdownItem(item)) {
|
|
54
|
+
for (const child of item.items) {
|
|
55
|
+
const render2 = slots[child.id];
|
|
56
|
+
if (render2) {
|
|
57
|
+
nextDefinitions.push({
|
|
58
|
+
definitionId: child.id,
|
|
59
|
+
ownerId: overlayOwnerId,
|
|
60
|
+
render: render2,
|
|
61
|
+
shell: getModalShell(child.modal)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const render = slots[item.id];
|
|
68
|
+
if (render) {
|
|
69
|
+
nextDefinitions.push({
|
|
70
|
+
definitionId: item.id,
|
|
71
|
+
ownerId: overlayOwnerId,
|
|
72
|
+
render,
|
|
73
|
+
shell: getModalShell(item.modal)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return nextDefinitions;
|
|
79
|
+
});
|
|
80
|
+
watch(modalDefinitions, (definitions) => {
|
|
81
|
+
overlay.syncDefinitions(overlayOwnerId, definitions);
|
|
82
|
+
}, { immediate: true });
|
|
83
|
+
onBeforeUnmount(() => {
|
|
84
|
+
overlay.syncDefinitions(overlayOwnerId, []);
|
|
85
|
+
});
|
|
45
86
|
const actionIds = computed(() => displayConfig.value.groups.flatMap((group) => group.items.flatMap((item) => {
|
|
46
87
|
if ("items" in item) {
|
|
47
88
|
return item.items.map((child) => child.id);
|
|
@@ -92,6 +133,18 @@ function getDropdownLabel(dropdown) {
|
|
|
92
133
|
function getButtonTooltip(button) {
|
|
93
134
|
return getLocalizedText(button.tooltip, locale.value);
|
|
94
135
|
}
|
|
136
|
+
function getModalShell(modal) {
|
|
137
|
+
if (!modal) {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
title: getLocalizedText(modal.title, locale.value),
|
|
142
|
+
description: getLocalizedText(modal.description, locale.value),
|
|
143
|
+
showCloseButton: modal.showCloseButton,
|
|
144
|
+
breakpoint: modal.breakpoint,
|
|
145
|
+
dismissible: modal.dismissible
|
|
146
|
+
};
|
|
147
|
+
}
|
|
95
148
|
function getButtonEffect(buttonId) {
|
|
96
149
|
return Reflect.get(attrs, buttonId);
|
|
97
150
|
}
|
|
@@ -120,7 +173,7 @@ async function runButton(buttonId) {
|
|
|
120
173
|
}
|
|
121
174
|
pendingIds.value = [...pendingIds.value, buttonId];
|
|
122
175
|
try {
|
|
123
|
-
await Effect.runPromise(Effect.scoped(effect));
|
|
176
|
+
await Effect.runPromise(provideOverlay(Effect.scoped(effect), overlay));
|
|
124
177
|
} finally {
|
|
125
178
|
pendingIds.value = pendingIds.value.filter((id) => id !== buttonId);
|
|
126
179
|
}
|
|
@@ -146,7 +199,7 @@ function hasLeadingPrimaryGap(items, itemIndex) {
|
|
|
146
199
|
</script>
|
|
147
200
|
|
|
148
201
|
<script>
|
|
149
|
-
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from "./schema";
|
|
202
|
+
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC } from "./schema";
|
|
150
203
|
</script>
|
|
151
204
|
|
|
152
205
|
<template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import { type ButtonConfig } from './schema.js';
|
|
3
|
-
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './schema.js';
|
|
4
|
-
export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './schema.js';
|
|
3
|
+
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC } from './schema.js';
|
|
4
|
+
export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal } from './schema.js';
|
|
5
5
|
declare const _default: typeof __VLS_export;
|
|
6
6
|
export default _default;
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<{
|
|
@@ -23,6 +23,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
23
23
|
icon?: string | undefined;
|
|
24
24
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
25
25
|
hideTitle?: boolean | undefined;
|
|
26
|
+
modal?: Readonly<{
|
|
27
|
+
title?: readonly {
|
|
28
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
29
|
+
message: string;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
description?: readonly {
|
|
32
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
33
|
+
message: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
showCloseButton?: boolean | undefined;
|
|
36
|
+
breakpoint?: string | undefined;
|
|
37
|
+
dismissible?: boolean | undefined;
|
|
38
|
+
}> | undefined;
|
|
26
39
|
}> | Readonly<{
|
|
27
40
|
id: string;
|
|
28
41
|
title: readonly {
|
|
@@ -41,6 +54,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
41
54
|
}[] | undefined;
|
|
42
55
|
icon?: string | undefined;
|
|
43
56
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
57
|
+
modal?: Readonly<{
|
|
58
|
+
title?: readonly {
|
|
59
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
60
|
+
message: string;
|
|
61
|
+
}[] | undefined;
|
|
62
|
+
description?: readonly {
|
|
63
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
64
|
+
message: string;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
showCloseButton?: boolean | undefined;
|
|
67
|
+
breakpoint?: string | undefined;
|
|
68
|
+
dismissible?: boolean | undefined;
|
|
69
|
+
}> | undefined;
|
|
44
70
|
}>[];
|
|
45
71
|
icon?: string | undefined;
|
|
46
72
|
}>)[];
|
|
@@ -67,6 +93,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
67
93
|
icon?: string | undefined;
|
|
68
94
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
69
95
|
hideTitle?: boolean | undefined;
|
|
96
|
+
modal?: Readonly<{
|
|
97
|
+
title?: readonly {
|
|
98
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
99
|
+
message: string;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
description?: readonly {
|
|
102
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
103
|
+
message: string;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
showCloseButton?: boolean | undefined;
|
|
106
|
+
breakpoint?: string | undefined;
|
|
107
|
+
dismissible?: boolean | undefined;
|
|
108
|
+
}> | undefined;
|
|
70
109
|
}> | Readonly<{
|
|
71
110
|
id: string;
|
|
72
111
|
title: readonly {
|
|
@@ -85,6 +124,19 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
85
124
|
}[] | undefined;
|
|
86
125
|
icon?: string | undefined;
|
|
87
126
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
127
|
+
modal?: Readonly<{
|
|
128
|
+
title?: readonly {
|
|
129
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
130
|
+
message: string;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
description?: readonly {
|
|
133
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
134
|
+
message: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
showCloseButton?: boolean | undefined;
|
|
137
|
+
breakpoint?: string | undefined;
|
|
138
|
+
dismissible?: boolean | undefined;
|
|
139
|
+
}> | undefined;
|
|
88
140
|
}>[];
|
|
89
141
|
icon?: string | undefined;
|
|
90
142
|
}>)[];
|