@shwfed/nuxt 0.10.3 → 0.10.4

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 (23) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/button.d.vue.ts +77 -0
  3. package/dist/runtime/components/button.vue +39 -0
  4. package/dist/runtime/components/button.vue.d.ts +77 -0
  5. package/dist/runtime/components/fields.d.vue.ts +2 -2
  6. package/dist/runtime/components/fields.vue.d.ts +2 -2
  7. package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.d.vue.ts +79 -0
  8. package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue +977 -0
  9. package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue.d.ts +79 -0
  10. package/dist/runtime/components/ui/button-configurator/menu.d.ts +47 -0
  11. package/dist/runtime/components/ui/button-configurator/menu.js +373 -0
  12. package/dist/runtime/components/ui/buttons/Buttons.d.vue.ts +77 -0
  13. package/dist/runtime/components/ui/buttons/Buttons.vue +238 -0
  14. package/dist/runtime/components/ui/buttons/Buttons.vue.d.ts +77 -0
  15. package/dist/runtime/components/ui/buttons/schema.d.ts +281 -0
  16. package/dist/runtime/components/ui/buttons/schema.js +50 -0
  17. package/dist/runtime/components/ui/fields/Fields.d.vue.ts +4 -4
  18. package/dist/runtime/components/ui/fields/Fields.vue.d.ts +4 -4
  19. package/dist/runtime/components/ui/fields/schema.d.ts +3 -3
  20. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +2 -2
  21. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +2 -2
  22. package/dist/runtime/components/ui/table/Table.vue +10 -9
  23. package/package.json +1 -1
@@ -0,0 +1,238 @@
1
+ <script setup>
2
+ import { useAttrs, computed, ref, watch } from "vue";
3
+ import { computedAsync } from "@vueuse/core";
4
+ import { Icon } from "@iconify/vue";
5
+ import { Effect } from "effect";
6
+ import { useI18n } from "vue-i18n";
7
+ import { useCheating } from "#imports";
8
+ import { getLocalizedText } from "../../../utils/coders";
9
+ import { cn } from "../../../utils/cn";
10
+ import ButtonConfiguratorDialog from "../button-configurator/ButtonConfiguratorDialog.vue";
11
+ import { Button } from "../button";
12
+ import { ButtonGroup } from "../button-group";
13
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu";
14
+ import { Skeleton } from "../skeleton";
15
+ import { ButtonConfigC, normalizeButtonConfigInput } from "./schema";
16
+ defineOptions({
17
+ inheritAttrs: false
18
+ });
19
+ const props = defineProps({
20
+ config: { type: null, required: true }
21
+ });
22
+ const emit = defineEmits(["update:config"]);
23
+ const defaultConfig = {
24
+ gap: 12,
25
+ groups: []
26
+ };
27
+ 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;
28
+ const attrs = useAttrs();
29
+ const { locale, t } = useI18n();
30
+ const isCheating = useCheating();
31
+ const isConfiguratorOpen = ref(false);
32
+ const pendingIds = ref([]);
33
+ const currentConfig = computedAsync(
34
+ async () => ButtonConfigC.parse(normalizeButtonConfigInput(await props.config.pipe(Effect.runPromise)))
35
+ );
36
+ const displayConfig = ref(defaultConfig);
37
+ watch(currentConfig, (value) => {
38
+ if (value) {
39
+ displayConfig.value = value;
40
+ }
41
+ }, { immediate: true });
42
+ const actionIds = computed(() => displayConfig.value.groups.flatMap((group) => group.items.flatMap((item) => {
43
+ if ("items" in item) {
44
+ return item.items.map((child) => child.id);
45
+ }
46
+ return [item.id];
47
+ })));
48
+ const rootAttrs = computed(() => {
49
+ const ignoredKeys = new Set(actionIds.value);
50
+ const nextAttrs = {};
51
+ for (const [key, value] of Object.entries(attrs)) {
52
+ if (ignoredKeys.has(key) || key === "class" || uuidPattern.test(key)) {
53
+ continue;
54
+ }
55
+ Reflect.set(nextAttrs, key, value);
56
+ }
57
+ return nextAttrs;
58
+ });
59
+ const rootClass = computed(() => {
60
+ const classValue = Reflect.get(attrs, "class");
61
+ return typeof classValue === "string" ? classValue : void 0;
62
+ });
63
+ const rootStyle = computed(() => ({
64
+ gap: `calc(${displayConfig.value.gap ?? defaultConfig.gap ?? 12} * 0.25rem)`
65
+ }));
66
+ function getButtonLabel(button) {
67
+ return getLocalizedText(button.title, locale.value) ?? t("untitled-button");
68
+ }
69
+ function getDropdownLabel(dropdown) {
70
+ return getLocalizedText(dropdown.title, locale.value) ?? t("untitled-dropdown");
71
+ }
72
+ function getButtonEffect(buttonId) {
73
+ return Reflect.get(attrs, buttonId);
74
+ }
75
+ function isEffectValue(value) {
76
+ return typeof value === "object" && value !== null && "_op" in value;
77
+ }
78
+ function isPending(buttonId) {
79
+ return pendingIds.value.includes(buttonId);
80
+ }
81
+ function isButtonDisabled(buttonId) {
82
+ return isPending(buttonId) || !isEffectValue(getButtonEffect(buttonId));
83
+ }
84
+ function isDropdownPending(dropdown) {
85
+ return dropdown.items.some((item) => isPending(item.id));
86
+ }
87
+ async function runButton(buttonId) {
88
+ if (isPending(buttonId)) {
89
+ return;
90
+ }
91
+ const effect = getButtonEffect(buttonId);
92
+ if (!isEffectValue(effect)) {
93
+ return;
94
+ }
95
+ pendingIds.value = [...pendingIds.value, buttonId];
96
+ try {
97
+ await Effect.runPromise(Effect.scoped(effect));
98
+ } finally {
99
+ pendingIds.value = pendingIds.value.filter((id) => id !== buttonId);
100
+ }
101
+ }
102
+ function handleConfiguratorConfirm(nextConfig) {
103
+ displayConfig.value = nextConfig;
104
+ emit("update:config", nextConfig);
105
+ }
106
+ function isDropdownItem(item) {
107
+ return "items" in item;
108
+ }
109
+ </script>
110
+
111
+ <script>
112
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from "./schema";
113
+ </script>
114
+
115
+ <template>
116
+ <div
117
+ v-bind="rootAttrs"
118
+ data-slot="buttons"
119
+ :class="cn('relative flex flex-wrap items-start', rootClass)"
120
+ :style="rootStyle"
121
+ >
122
+ <Button
123
+ v-if="isCheating"
124
+ data-slot="buttons-configurator-trigger"
125
+ variant="ghost"
126
+ size="sm"
127
+ type="button"
128
+ class="absolute right-0 top-0 z-20 bg-white/90 shadow-xs backdrop-blur-sm hover:bg-white"
129
+ @click="isConfiguratorOpen = true"
130
+ >
131
+ <Icon icon="fluent:settings-20-regular" />
132
+ </Button>
133
+
134
+ <ButtonConfiguratorDialog
135
+ v-if="currentConfig"
136
+ v-model:open="isConfiguratorOpen"
137
+ :config="displayConfig"
138
+ @confirm="handleConfiguratorConfirm"
139
+ />
140
+
141
+ <Skeleton
142
+ v-if="currentConfig === void 0"
143
+ data-slot="buttons-skeleton"
144
+ class="absolute inset-0 z-10 h-full w-full"
145
+ />
146
+
147
+ <ButtonGroup
148
+ v-for="group in displayConfig.groups"
149
+ :key="group.id"
150
+ data-slot="buttons-group"
151
+ orientation="horizontal"
152
+ >
153
+ <template
154
+ v-for="item in group.items"
155
+ :key="item.id"
156
+ >
157
+ <Button
158
+ v-if="!isDropdownItem(item)"
159
+ data-slot="buttons-item"
160
+ :variant="item.variant"
161
+ :disabled="isButtonDisabled(item.id)"
162
+ :title="item.hideTitle ? getButtonLabel(item) : void 0"
163
+ @click="void runButton(item.id)"
164
+ >
165
+ <Icon
166
+ v-if="isPending(item.id)"
167
+ icon="line-md:loading-twotone-loop"
168
+ />
169
+ <Icon
170
+ v-else-if="item.icon"
171
+ :icon="item.icon"
172
+ />
173
+ <span v-if="!item.hideTitle">{{ getButtonLabel(item) }}</span>
174
+ </Button>
175
+
176
+ <DropdownMenu v-else>
177
+ <DropdownMenuTrigger as-child>
178
+ <Button
179
+ data-slot="buttons-dropdown-trigger"
180
+ :disabled="isDropdownPending(item)"
181
+ >
182
+ <Icon
183
+ v-if="isDropdownPending(item)"
184
+ icon="line-md:loading-twotone-loop"
185
+ />
186
+ <Icon
187
+ v-else-if="item.icon"
188
+ :icon="item.icon"
189
+ />
190
+ <span>{{ getDropdownLabel(item) }}</span>
191
+ </Button>
192
+ </DropdownMenuTrigger>
193
+
194
+ <DropdownMenuContent align="start">
195
+ <DropdownMenuItem
196
+ v-for="child in item.items"
197
+ :key="child.id"
198
+ data-slot="buttons-dropdown-item"
199
+ :disabled="isButtonDisabled(child.id)"
200
+ @select="void runButton(child.id)"
201
+ >
202
+ <Icon
203
+ v-if="isPending(child.id)"
204
+ icon="line-md:loading-twotone-loop"
205
+ />
206
+ <Icon
207
+ v-else-if="child.icon"
208
+ :icon="child.icon"
209
+ />
210
+ <span>{{ getButtonLabel(child) }}</span>
211
+ </DropdownMenuItem>
212
+ </DropdownMenuContent>
213
+ </DropdownMenu>
214
+ </template>
215
+ </ButtonGroup>
216
+ </div>
217
+ </template>
218
+
219
+ <i18n lang="json">
220
+ {
221
+ "zh": {
222
+ "untitled-button": "未命名按钮",
223
+ "untitled-dropdown": "未命名下拉按钮"
224
+ },
225
+ "en": {
226
+ "untitled-button": "Untitled button",
227
+ "untitled-dropdown": "Untitled dropdown"
228
+ },
229
+ "ja": {
230
+ "untitled-button": "未命名ボタン",
231
+ "untitled-dropdown": "未命名ドロップダウン"
232
+ },
233
+ "ko": {
234
+ "untitled-button": "이름 없는 버튼",
235
+ "untitled-dropdown": "이름 없는 드롭다운"
236
+ }
237
+ }
238
+ </i18n>
@@ -0,0 +1,77 @@
1
+ import { Effect } from 'effect';
2
+ import { type ButtonConfig } from './schema.js';
3
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from './schema.js';
4
+ export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './schema.js';
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ declare const __VLS_export: import("vue").DefineComponent<{
8
+ config: Effect.Effect<ButtonConfig | import("./schema.js").ButtonConfigInput | undefined>;
9
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:config": (args_0: Readonly<{
11
+ groups: readonly Readonly<{
12
+ id: string;
13
+ items: readonly (Readonly<{
14
+ id: string;
15
+ title: readonly {
16
+ locale: "zh" | "ja" | "en" | "ko";
17
+ message: string;
18
+ }[];
19
+ icon?: string | undefined;
20
+ variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
21
+ hideTitle?: boolean | undefined;
22
+ }> | Readonly<{
23
+ id: string;
24
+ title: readonly {
25
+ locale: "zh" | "ja" | "en" | "ko";
26
+ message: string;
27
+ }[];
28
+ items: readonly Readonly<{
29
+ id: string;
30
+ title: readonly {
31
+ locale: "zh" | "ja" | "en" | "ko";
32
+ message: string;
33
+ }[];
34
+ icon?: string | undefined;
35
+ variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
36
+ }>[];
37
+ icon?: string | undefined;
38
+ }>)[];
39
+ }>[];
40
+ gap?: number | undefined;
41
+ }>) => any;
42
+ }, string, import("vue").PublicProps, Readonly<{
43
+ config: Effect.Effect<ButtonConfig | import("./schema.js").ButtonConfigInput | undefined>;
44
+ }> & Readonly<{
45
+ "onUpdate:config"?: ((args_0: Readonly<{
46
+ groups: readonly Readonly<{
47
+ id: string;
48
+ items: readonly (Readonly<{
49
+ id: string;
50
+ title: readonly {
51
+ locale: "zh" | "ja" | "en" | "ko";
52
+ message: string;
53
+ }[];
54
+ icon?: string | undefined;
55
+ variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
+ hideTitle?: boolean | undefined;
57
+ }> | Readonly<{
58
+ id: string;
59
+ title: readonly {
60
+ locale: "zh" | "ja" | "en" | "ko";
61
+ message: string;
62
+ }[];
63
+ items: readonly Readonly<{
64
+ id: string;
65
+ title: readonly {
66
+ locale: "zh" | "ja" | "en" | "ko";
67
+ message: string;
68
+ }[];
69
+ icon?: string | undefined;
70
+ variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
+ }>[];
72
+ icon?: string | undefined;
73
+ }>)[];
74
+ }>[];
75
+ gap?: number | undefined;
76
+ }>) => any) | undefined;
77
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,281 @@
1
+ import z from 'zod';
2
+ import type { ButtonVariants } from '../button/index.js';
3
+ export declare const ButtonActionC: z.ZodReadonly<z.ZodObject<{
4
+ id: z.ZodUUID;
5
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
6
+ locale: z.ZodEnum<{
7
+ zh: "zh";
8
+ ja: "ja";
9
+ en: "en";
10
+ ko: "ko";
11
+ }>;
12
+ message: z.ZodString;
13
+ }, z.core.$strip>>>;
14
+ icon: z.ZodOptional<z.ZodString>;
15
+ variant: z.ZodOptional<z.ZodEnum<{
16
+ default: "default";
17
+ destructive: "destructive";
18
+ primary: "primary";
19
+ ghost: "ghost";
20
+ }>>;
21
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
22
+ }, z.core.$strict>>;
23
+ export declare const ButtonDropdownC: z.ZodReadonly<z.ZodObject<{
24
+ id: z.ZodUUID;
25
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
26
+ locale: z.ZodEnum<{
27
+ zh: "zh";
28
+ ja: "ja";
29
+ en: "en";
30
+ ko: "ko";
31
+ }>;
32
+ message: z.ZodString;
33
+ }, z.core.$strip>>>;
34
+ icon: z.ZodOptional<z.ZodString>;
35
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
36
+ id: z.ZodUUID;
37
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
38
+ locale: z.ZodEnum<{
39
+ zh: "zh";
40
+ ja: "ja";
41
+ en: "en";
42
+ ko: "ko";
43
+ }>;
44
+ message: z.ZodString;
45
+ }, z.core.$strip>>>;
46
+ icon: z.ZodOptional<z.ZodString>;
47
+ variant: z.ZodOptional<z.ZodEnum<{
48
+ default: "default";
49
+ destructive: "destructive";
50
+ primary: "primary";
51
+ ghost: "ghost";
52
+ }>>;
53
+ }, z.core.$strict>>>>;
54
+ }, z.core.$strict>>;
55
+ export declare const ButtonGroupItemC: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
56
+ id: z.ZodUUID;
57
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
58
+ locale: z.ZodEnum<{
59
+ zh: "zh";
60
+ ja: "ja";
61
+ en: "en";
62
+ ko: "ko";
63
+ }>;
64
+ message: z.ZodString;
65
+ }, z.core.$strip>>>;
66
+ icon: z.ZodOptional<z.ZodString>;
67
+ variant: z.ZodOptional<z.ZodEnum<{
68
+ default: "default";
69
+ destructive: "destructive";
70
+ primary: "primary";
71
+ ghost: "ghost";
72
+ }>>;
73
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
74
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
75
+ id: z.ZodUUID;
76
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
77
+ locale: z.ZodEnum<{
78
+ zh: "zh";
79
+ ja: "ja";
80
+ en: "en";
81
+ ko: "ko";
82
+ }>;
83
+ message: z.ZodString;
84
+ }, z.core.$strip>>>;
85
+ icon: z.ZodOptional<z.ZodString>;
86
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
87
+ id: z.ZodUUID;
88
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
89
+ locale: z.ZodEnum<{
90
+ zh: "zh";
91
+ ja: "ja";
92
+ en: "en";
93
+ ko: "ko";
94
+ }>;
95
+ message: z.ZodString;
96
+ }, z.core.$strip>>>;
97
+ icon: z.ZodOptional<z.ZodString>;
98
+ variant: z.ZodOptional<z.ZodEnum<{
99
+ default: "default";
100
+ destructive: "destructive";
101
+ primary: "primary";
102
+ ghost: "ghost";
103
+ }>>;
104
+ }, z.core.$strict>>>>;
105
+ }, z.core.$strict>>]>;
106
+ export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
107
+ id: z.ZodUUID;
108
+ items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
109
+ id: z.ZodUUID;
110
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
111
+ locale: z.ZodEnum<{
112
+ zh: "zh";
113
+ ja: "ja";
114
+ en: "en";
115
+ ko: "ko";
116
+ }>;
117
+ message: z.ZodString;
118
+ }, z.core.$strip>>>;
119
+ icon: z.ZodOptional<z.ZodString>;
120
+ variant: z.ZodOptional<z.ZodEnum<{
121
+ default: "default";
122
+ destructive: "destructive";
123
+ primary: "primary";
124
+ ghost: "ghost";
125
+ }>>;
126
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
127
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
128
+ id: z.ZodUUID;
129
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
130
+ locale: z.ZodEnum<{
131
+ zh: "zh";
132
+ ja: "ja";
133
+ en: "en";
134
+ ko: "ko";
135
+ }>;
136
+ message: z.ZodString;
137
+ }, z.core.$strip>>>;
138
+ icon: z.ZodOptional<z.ZodString>;
139
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
140
+ id: z.ZodUUID;
141
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
142
+ locale: z.ZodEnum<{
143
+ zh: "zh";
144
+ ja: "ja";
145
+ en: "en";
146
+ ko: "ko";
147
+ }>;
148
+ message: z.ZodString;
149
+ }, z.core.$strip>>>;
150
+ icon: z.ZodOptional<z.ZodString>;
151
+ variant: z.ZodOptional<z.ZodEnum<{
152
+ default: "default";
153
+ destructive: "destructive";
154
+ primary: "primary";
155
+ ghost: "ghost";
156
+ }>>;
157
+ }, z.core.$strict>>>>;
158
+ }, z.core.$strict>>]>>>;
159
+ }, z.core.$strict>>;
160
+ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
161
+ gap: z.ZodOptional<z.ZodNumber>;
162
+ groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
163
+ id: z.ZodUUID;
164
+ items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
165
+ id: z.ZodUUID;
166
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
167
+ locale: z.ZodEnum<{
168
+ zh: "zh";
169
+ ja: "ja";
170
+ en: "en";
171
+ ko: "ko";
172
+ }>;
173
+ message: z.ZodString;
174
+ }, z.core.$strip>>>;
175
+ icon: z.ZodOptional<z.ZodString>;
176
+ variant: z.ZodOptional<z.ZodEnum<{
177
+ default: "default";
178
+ destructive: "destructive";
179
+ primary: "primary";
180
+ ghost: "ghost";
181
+ }>>;
182
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
183
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
184
+ id: z.ZodUUID;
185
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
186
+ locale: z.ZodEnum<{
187
+ zh: "zh";
188
+ ja: "ja";
189
+ en: "en";
190
+ ko: "ko";
191
+ }>;
192
+ message: z.ZodString;
193
+ }, z.core.$strip>>>;
194
+ icon: z.ZodOptional<z.ZodString>;
195
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
196
+ id: z.ZodUUID;
197
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
198
+ locale: z.ZodEnum<{
199
+ zh: "zh";
200
+ ja: "ja";
201
+ en: "en";
202
+ ko: "ko";
203
+ }>;
204
+ message: z.ZodString;
205
+ }, z.core.$strip>>>;
206
+ icon: z.ZodOptional<z.ZodString>;
207
+ variant: z.ZodOptional<z.ZodEnum<{
208
+ default: "default";
209
+ destructive: "destructive";
210
+ primary: "primary";
211
+ ghost: "ghost";
212
+ }>>;
213
+ }, z.core.$strict>>>>;
214
+ }, z.core.$strict>>]>>>;
215
+ }, z.core.$strict>>>>;
216
+ }, z.core.$strict>>;
217
+ export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
218
+ gap: z.ZodOptional<z.ZodNumber>;
219
+ groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
220
+ id: z.ZodUUID;
221
+ items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
222
+ id: z.ZodUUID;
223
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
224
+ locale: z.ZodEnum<{
225
+ zh: "zh";
226
+ ja: "ja";
227
+ en: "en";
228
+ ko: "ko";
229
+ }>;
230
+ message: z.ZodString;
231
+ }, z.core.$strip>>>;
232
+ icon: z.ZodOptional<z.ZodString>;
233
+ variant: z.ZodOptional<z.ZodEnum<{
234
+ default: "default";
235
+ destructive: "destructive";
236
+ primary: "primary";
237
+ ghost: "ghost";
238
+ }>>;
239
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
240
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
241
+ id: z.ZodUUID;
242
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
243
+ locale: z.ZodEnum<{
244
+ zh: "zh";
245
+ ja: "ja";
246
+ en: "en";
247
+ ko: "ko";
248
+ }>;
249
+ message: z.ZodString;
250
+ }, z.core.$strip>>>;
251
+ icon: z.ZodOptional<z.ZodString>;
252
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
253
+ id: z.ZodUUID;
254
+ title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
255
+ locale: z.ZodEnum<{
256
+ zh: "zh";
257
+ ja: "ja";
258
+ en: "en";
259
+ ko: "ko";
260
+ }>;
261
+ message: z.ZodString;
262
+ }, z.core.$strip>>>;
263
+ icon: z.ZodOptional<z.ZodString>;
264
+ variant: z.ZodOptional<z.ZodEnum<{
265
+ default: "default";
266
+ destructive: "destructive";
267
+ primary: "primary";
268
+ ghost: "ghost";
269
+ }>>;
270
+ }, z.core.$strict>>>>;
271
+ }, z.core.$strict>>]>>>;
272
+ }, z.core.$strict>>>>;
273
+ }, z.core.$strict>>;
274
+ export type ButtonAction = z.infer<typeof ButtonActionC>;
275
+ export type ButtonDropdown = z.infer<typeof ButtonDropdownC>;
276
+ export type ButtonGroupItem = z.infer<typeof ButtonGroupItemC>;
277
+ export type ButtonGroup = z.infer<typeof ButtonGroupC>;
278
+ export type ButtonConfig = z.infer<typeof ButtonConfigC>;
279
+ export type ButtonConfigInput = z.infer<typeof ButtonConfigInputC>;
280
+ export declare function normalizeButtonConfigInput(value: unknown): unknown;
281
+ export type ButtonVariant = ButtonVariants['variant'];
@@ -0,0 +1,50 @@
1
+ import z from "zod";
2
+ import { localeC } from "../../../utils/coders.js";
3
+ const buttonIdC = z.uuid().describe("\u6309\u94AE\u552F\u4E00\u6807\u8BC6\uFF0C\u5FC5\u987B\u662F UUID");
4
+ const buttonGroupIdC = z.uuid().describe("\u6309\u94AE\u7EC4\u552F\u4E00\u6807\u8BC6\uFF0C\u5FC5\u987B\u662F UUID");
5
+ const buttonVariantC = z.enum(["default", "primary", "destructive", "ghost"]).optional().describe("\u6309\u94AE\u53D8\u4F53");
6
+ export const ButtonActionC = z.strictObject({
7
+ id: buttonIdC,
8
+ title: localeC.describe("\u6309\u94AE\u540D\u79F0\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
9
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
10
+ variant: buttonVariantC,
11
+ hideTitle: z.boolean().optional().describe("\u4EC5\u5BF9\u975E\u4E0B\u62C9\u6309\u94AE\u751F\u6548\uFF1B\u4E3A true \u65F6\u9690\u85CF\u6309\u94AE\u6587\u5B57\uFF0C\u4EC5\u663E\u793A\u56FE\u6807")
12
+ }).readonly();
13
+ const DropdownButtonActionC = z.strictObject({
14
+ id: buttonIdC,
15
+ title: localeC.describe("\u4E0B\u62C9\u9879\u6309\u94AE\u540D\u79F0\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
16
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
17
+ variant: buttonVariantC
18
+ }).readonly();
19
+ export const ButtonDropdownC = z.strictObject({
20
+ id: buttonIdC,
21
+ title: localeC.describe("\u4E0B\u62C9\u6309\u94AE\u540D\u79F0\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
22
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
23
+ items: z.array(DropdownButtonActionC).readonly().describe("\u4E0B\u62C9\u6309\u94AE\u5185\u7684\u6309\u94AE\u5217\u8868")
24
+ }).readonly();
25
+ export const ButtonGroupItemC = z.union([ButtonActionC, ButtonDropdownC]);
26
+ export const ButtonGroupC = z.strictObject({
27
+ id: buttonGroupIdC,
28
+ items: z.array(ButtonGroupItemC).readonly().describe("\u6309\u94AE\u7EC4\u5185\u7684\u6309\u94AE\u4E0E\u4E0B\u62C9\u6309\u94AE")
29
+ }).readonly();
30
+ export const ButtonConfigC = z.strictObject({
31
+ gap: z.number().finite().min(0).optional().describe("\u6309\u94AE\u7EC4\u4E4B\u95F4\u7684\u95F4\u8DDD\uFF0C\u5355\u4F4D\u4E3A\u50CF\u7D20"),
32
+ groups: z.array(ButtonGroupC).readonly().describe("\u6839\u7EA7\u6309\u94AE\u7EC4\u5217\u8868")
33
+ }).readonly();
34
+ export const ButtonConfigInputC = ButtonConfigC;
35
+ export function normalizeButtonConfigInput(value) {
36
+ if (typeof value !== "object" || value === null) {
37
+ return {
38
+ groups: []
39
+ };
40
+ }
41
+ const groups = Reflect.get(value, "groups");
42
+ const gap = Reflect.get(value, "gap");
43
+ const nextConfig = {
44
+ groups: Array.isArray(groups) ? groups : []
45
+ };
46
+ if (typeof gap === "number" && Number.isFinite(gap) && gap >= 0) {
47
+ nextConfig.gap = gap;
48
+ }
49
+ return nextConfig;
50
+ }
@@ -93,7 +93,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
93
93
  locale: "zh" | "ja" | "en" | "ko";
94
94
  message: string;
95
95
  }[];
96
- mode: "date" | "month" | "year";
96
+ mode: "month" | "year" | "date";
97
97
  value: string;
98
98
  required?: boolean | undefined;
99
99
  icon?: string | undefined;
@@ -210,7 +210,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
210
210
  locale: "zh" | "ja" | "en" | "ko";
211
211
  message: string;
212
212
  }[];
213
- mode: "date" | "month" | "year";
213
+ mode: "month" | "year" | "date";
214
214
  value: string;
215
215
  required?: boolean | undefined;
216
216
  icon?: string | undefined;
@@ -324,7 +324,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
324
324
  locale: "zh" | "ja" | "en" | "ko";
325
325
  message: string;
326
326
  }[];
327
- mode: "date" | "month" | "year";
327
+ mode: "month" | "year" | "date";
328
328
  value: string;
329
329
  required?: boolean | undefined;
330
330
  icon?: string | undefined;
@@ -441,7 +441,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
441
441
  locale: "zh" | "ja" | "en" | "ko";
442
442
  message: string;
443
443
  }[];
444
- mode: "date" | "month" | "year";
444
+ mode: "month" | "year" | "date";
445
445
  value: string;
446
446
  required?: boolean | undefined;
447
447
  icon?: string | undefined;