@shwfed/nuxt 0.10.14 → 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.
Files changed (33) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/components/app.d.vue.ts +2 -1
  4. package/dist/runtime/components/app.vue.d.ts +2 -1
  5. package/dist/runtime/components/button.d.vue.ts +63 -4
  6. package/dist/runtime/components/button.vue +12 -2
  7. package/dist/runtime/components/button.vue.d.ts +63 -4
  8. package/dist/runtime/components/modal.d.vue.ts +3 -1
  9. package/dist/runtime/components/modal.vue +3 -1
  10. package/dist/runtime/components/modal.vue.d.ts +3 -1
  11. package/dist/runtime/components/ui/app/App.d.vue.ts +7 -5
  12. package/dist/runtime/components/ui/app/App.vue +23 -8
  13. package/dist/runtime/components/ui/app/App.vue.d.ts +7 -5
  14. package/dist/runtime/components/ui/app/OverlayHost.d.vue.ts +3 -0
  15. package/dist/runtime/components/ui/app/OverlayHost.vue +91 -0
  16. package/dist/runtime/components/ui/app/OverlayHost.vue.d.ts +3 -0
  17. package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.d.vue.ts +52 -0
  18. package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue.d.ts +52 -0
  19. package/dist/runtime/components/ui/buttons/Buttons.d.vue.ts +54 -2
  20. package/dist/runtime/components/ui/buttons/Buttons.vue +56 -3
  21. package/dist/runtime/components/ui/buttons/Buttons.vue.d.ts +54 -2
  22. package/dist/runtime/components/ui/buttons/schema.d.ts +307 -0
  23. package/dist/runtime/components/ui/buttons/schema.js +11 -2
  24. package/dist/runtime/components/ui/drawer/Drawer.d.vue.ts +4 -4
  25. package/dist/runtime/components/ui/drawer/Drawer.vue.d.ts +4 -4
  26. package/dist/runtime/composables/useOverlay.d.ts +86 -0
  27. package/dist/runtime/composables/useOverlay.js +201 -0
  28. package/dist/runtime/layouts/default.d.vue.ts +2 -1
  29. package/dist/runtime/layouts/default.vue.d.ts +2 -1
  30. package/dist/runtime/plugins/overlay/index.d.ts +6 -0
  31. package/dist/runtime/plugins/overlay/index.js +12 -0
  32. package/dist/runtime/plugins/toast/index.d.ts +2 -2
  33. package/package.json +1 -1
@@ -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
  }>)[];