@shwfed/nuxt 0.10.4 → 0.10.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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.10.4",
4
+ "version": "0.10.6",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,6 +1,6 @@
1
1
  import { Effect } from 'effect';
2
2
  import type { ButtonConfigInput } from './ui/buttons/schema.js';
3
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from './ui/buttons/schema.js';
3
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './ui/buttons/schema.js';
4
4
  export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './ui/buttons/schema.js';
5
5
  declare const _default: typeof __VLS_export;
6
6
  export default _default;
@@ -16,6 +16,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
16
16
  locale: "zh" | "ja" | "en" | "ko";
17
17
  message: string;
18
18
  }[];
19
+ tooltip?: readonly {
20
+ locale: "zh" | "ja" | "en" | "ko";
21
+ message: string;
22
+ }[] | undefined;
19
23
  icon?: string | undefined;
20
24
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
21
25
  hideTitle?: boolean | undefined;
@@ -31,6 +35,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
31
35
  locale: "zh" | "ja" | "en" | "ko";
32
36
  message: string;
33
37
  }[];
38
+ tooltip?: readonly {
39
+ locale: "zh" | "ja" | "en" | "ko";
40
+ message: string;
41
+ }[] | undefined;
34
42
  icon?: string | undefined;
35
43
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
36
44
  }>[];
@@ -38,6 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
38
46
  }>)[];
39
47
  }>[];
40
48
  gap?: number | undefined;
49
+ style?: string | undefined;
41
50
  }>) => any;
42
51
  }, string, import("vue").PublicProps, Readonly<{
43
52
  config?: ButtonConfigInput | Effect.Effect<ButtonConfigInput | undefined>;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,5 +90,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -27,7 +27,7 @@ function handleConfigUpdate(config) {
27
27
  </script>
28
28
 
29
29
  <script>
30
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from "./ui/buttons/schema";
30
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from "./ui/buttons/schema";
31
31
  </script>
32
32
 
33
33
  <template>
@@ -1,6 +1,6 @@
1
1
  import { Effect } from 'effect';
2
2
  import type { ButtonConfigInput } from './ui/buttons/schema.js';
3
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from './ui/buttons/schema.js';
3
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './ui/buttons/schema.js';
4
4
  export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './ui/buttons/schema.js';
5
5
  declare const _default: typeof __VLS_export;
6
6
  export default _default;
@@ -16,6 +16,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
16
16
  locale: "zh" | "ja" | "en" | "ko";
17
17
  message: string;
18
18
  }[];
19
+ tooltip?: readonly {
20
+ locale: "zh" | "ja" | "en" | "ko";
21
+ message: string;
22
+ }[] | undefined;
19
23
  icon?: string | undefined;
20
24
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
21
25
  hideTitle?: boolean | undefined;
@@ -31,6 +35,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
31
35
  locale: "zh" | "ja" | "en" | "ko";
32
36
  message: string;
33
37
  }[];
38
+ tooltip?: readonly {
39
+ locale: "zh" | "ja" | "en" | "ko";
40
+ message: string;
41
+ }[] | undefined;
34
42
  icon?: string | undefined;
35
43
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
36
44
  }>[];
@@ -38,6 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
38
46
  }>)[];
39
47
  }>[];
40
48
  gap?: number | undefined;
49
+ style?: string | undefined;
41
50
  }>) => any;
42
51
  }, string, import("vue").PublicProps, Readonly<{
43
52
  config?: ButtonConfigInput | Effect.Effect<ButtonConfigInput | undefined>;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,5 +90,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,5 +1,6 @@
1
1
  import type { TableConfigInput } from './ui/table/schema.js';
2
2
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig, TableConfigInput } from './ui/table/schema.js';
3
+ export type { TableInstance } from './ui/table/Table.vue.js';
3
4
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './ui/table/schema.js';
4
5
  declare module '@tanstack/vue-table' {
5
6
  interface ColumnMeta<TData extends import('@tanstack/vue-table').RowData, TValue> {
@@ -1,5 +1,6 @@
1
1
  import type { TableConfigInput } from './ui/table/schema.js';
2
2
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig, TableConfigInput } from './ui/table/schema.js';
3
+ export type { TableInstance } from './ui/table/Table.vue.js';
3
4
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './ui/table/schema.js';
4
5
  declare module '@tanstack/vue-table' {
5
6
  interface ColumnMeta<TData extends import('@tanstack/vue-table').RowData, TValue> {
@@ -17,6 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
17
17
  locale: "zh" | "ja" | "en" | "ko";
18
18
  message: string;
19
19
  }[];
20
+ tooltip?: readonly {
21
+ locale: "zh" | "ja" | "en" | "ko";
22
+ message: string;
23
+ }[] | undefined;
20
24
  icon?: string | undefined;
21
25
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
22
26
  hideTitle?: boolean | undefined;
@@ -32,6 +36,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
32
36
  locale: "zh" | "ja" | "en" | "ko";
33
37
  message: string;
34
38
  }[];
39
+ tooltip?: readonly {
40
+ locale: "zh" | "ja" | "en" | "ko";
41
+ message: string;
42
+ }[] | undefined;
35
43
  icon?: string | undefined;
36
44
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
37
45
  }>[];
@@ -39,6 +47,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
39
47
  }>)[];
40
48
  }>[];
41
49
  gap?: number | undefined;
50
+ style?: string | undefined;
42
51
  }>) => any;
43
52
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
44
53
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,6 +90,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
78
96
  declare const _default: typeof __VLS_export;
@@ -5,13 +5,14 @@ import { computed, nextTick, ref, watch } from "vue";
5
5
  import { useI18n } from "vue-i18n";
6
6
  import { cn } from "../../../utils/cn";
7
7
  import { Button } from "../button";
8
- import { ButtonConfigC } from "../buttons/schema";
8
+ import { ButtonConfigC, ButtonsStyleC } from "../buttons/schema";
9
9
  import { Checkbox } from "../checkbox";
10
10
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../dialog";
11
11
  import { IconPicker } from "../icon-picker";
12
12
  import { Input } from "../input";
13
13
  import Locale from "../locale/Locale.vue";
14
14
  import { NativeSelect, NativeSelectOption } from "../native-select";
15
+ import { Textarea } from "../textarea";
15
16
  import {
16
17
  buildButtonConfiguratorTree,
17
18
  createButtonConfiguratorButtonNode,
@@ -40,10 +41,12 @@ const open = defineModel("open", { type: Boolean, ...{
40
41
  const { t } = useI18n();
41
42
  const search = ref("");
42
43
  const draftGap = ref(props.config.gap ?? 12);
44
+ const draftStyle = ref(props.config.style);
43
45
  const selectedItemId = ref("general");
44
46
  const draftTree = ref(buildButtonConfiguratorTree(props.config.groups));
45
47
  const sortableListRef = ref(null);
46
48
  const sortableItemIds = ref([]);
49
+ const validationErrors = ref({});
47
50
  const sortable = useSortable(sortableListRef, sortableItemIds);
48
51
  function handleSortableUpdate(event) {
49
52
  if (event.oldIndex === void 0 || event.newIndex === void 0 || event.oldIndex === event.newIndex) {
@@ -212,6 +215,22 @@ function getZhText(value) {
212
215
  const message = zhValue.message.trim();
213
216
  return message.length > 0 ? message : void 0;
214
217
  }
218
+ function normalizeOptionalString(value) {
219
+ const normalized = value.trim();
220
+ return normalized.length > 0 ? normalized : void 0;
221
+ }
222
+ function getGeneralErrorKey(field) {
223
+ return `general.${field}`;
224
+ }
225
+ function clearError(key) {
226
+ const nextErrors = {};
227
+ for (const [errorKey, errorValue] of Object.entries(validationErrors.value)) {
228
+ if (errorKey !== key) {
229
+ Reflect.set(nextErrors, errorKey, errorValue);
230
+ }
231
+ }
232
+ validationErrors.value = nextErrors;
233
+ }
215
234
  function isCopyableNode(node) {
216
235
  if (!node) {
217
236
  return false;
@@ -226,7 +245,9 @@ function getNodeLabel(item) {
226
245
  }
227
246
  function applyDraftConfig(config) {
228
247
  draftGap.value = config.gap ?? 12;
248
+ draftStyle.value = config.style;
229
249
  draftTree.value = buildButtonConfiguratorTree(config.groups);
250
+ validationErrors.value = {};
230
251
  selectedItemId.value = "general";
231
252
  sortableItemIds.value = draftTree.value.rootItemIds.slice();
232
253
  }
@@ -267,6 +288,10 @@ function updateGap(value) {
267
288
  draftGap.value = parsed;
268
289
  }
269
290
  }
291
+ function updateDraftStyle(value) {
292
+ clearError(getGeneralErrorKey("style"));
293
+ draftStyle.value = normalizeOptionalString(String(value));
294
+ }
270
295
  function updateSelectedTitle(value) {
271
296
  const node = selectedNode.value;
272
297
  if (!node) {
@@ -282,6 +307,21 @@ function updateSelectedTitle(value) {
282
307
  };
283
308
  });
284
309
  }
310
+ function updateSelectedTooltip(value) {
311
+ const node = selectedNode.value;
312
+ if (!node || node.item.type !== "button") {
313
+ return;
314
+ }
315
+ draftTree.value = updateButtonConfiguratorNode(draftTree.value, node.itemId, (item) => {
316
+ if (item.type !== "button") {
317
+ return item;
318
+ }
319
+ return {
320
+ ...item,
321
+ tooltip: value
322
+ };
323
+ });
324
+ }
285
325
  function updateSelectedIcon(value) {
286
326
  const node = selectedNode.value;
287
327
  if (!node) {
@@ -303,6 +343,9 @@ function updateSelectedIcon(value) {
303
343
  if (item.hideTitle) {
304
344
  nextItem2.hideTitle = item.hideTitle;
305
345
  }
346
+ if (item.tooltip) {
347
+ nextItem2.tooltip = item.tooltip;
348
+ }
306
349
  if (value) {
307
350
  nextItem2.icon = value;
308
351
  }
@@ -348,6 +391,7 @@ function updateSelectedHideTitle(value) {
348
391
  type: "button",
349
392
  id: item.id,
350
393
  title: item.title,
394
+ tooltip: item.tooltip,
351
395
  icon: item.icon,
352
396
  variant: item.variant
353
397
  };
@@ -407,8 +451,18 @@ async function copySelectedId() {
407
451
  }
408
452
  }
409
453
  function confirmChanges() {
454
+ const generalStyleResult = ButtonsStyleC.safeParse(draftStyle.value);
455
+ if (!generalStyleResult.success) {
456
+ validationErrors.value = {
457
+ ...validationErrors.value,
458
+ [getGeneralErrorKey("style")]: generalStyleResult.error.issues[0]?.message ?? t("general-style-invalid")
459
+ };
460
+ selectedItemId.value = "general";
461
+ return;
462
+ }
410
463
  const result = ButtonConfigC.safeParse({
411
464
  gap: draftGap.value,
465
+ style: generalStyleResult.data,
412
466
  groups: materializeButtonConfiguratorTree(draftTree.value)
413
467
  });
414
468
  if (!result.success) {
@@ -581,6 +635,28 @@ function confirmChanges() {
581
635
  @update:model-value="updateGap"
582
636
  />
583
637
  </label>
638
+
639
+ <label
640
+ data-slot="button-configurator-general-style-section"
641
+ class="flex flex-col gap-2"
642
+ >
643
+ <span class="text-xs font-medium text-zinc-500">{{ t("general-style") }}</span>
644
+ <Textarea
645
+ data-slot="button-configurator-general-style-input"
646
+ :model-value="draftStyle ?? ''"
647
+ :aria-invalid="validationErrors[getGeneralErrorKey('style')] ? 'true' : void 0"
648
+ :placeholder="t('general-style-placeholder')"
649
+ class="min-h-20 font-mono text-sm"
650
+ @update:model-value="updateDraftStyle"
651
+ />
652
+ <p
653
+ v-if="validationErrors[getGeneralErrorKey('style')]"
654
+ data-slot="button-configurator-general-style-error"
655
+ class="text-xs text-red-500"
656
+ >
657
+ {{ validationErrors[getGeneralErrorKey("style")] }}
658
+ </p>
659
+ </label>
584
660
  </section>
585
661
 
586
662
  <section
@@ -623,6 +699,15 @@ function confirmChanges() {
623
699
  />
624
700
  </label>
625
701
 
702
+ <label class="flex flex-col gap-2">
703
+ <span class="text-xs font-medium text-zinc-500">{{ t("tooltip") }}</span>
704
+ <Locale
705
+ data-slot="button-configurator-button-tooltip"
706
+ :model-value="selectedButton.tooltip"
707
+ @update:model-value="updateSelectedTooltip"
708
+ />
709
+ </label>
710
+
626
711
  <label class="flex flex-col gap-2">
627
712
  <span class="text-xs font-medium text-zinc-500">{{ t("button-variant") }}</span>
628
713
  <NativeSelect
@@ -839,7 +924,11 @@ function confirmChanges() {
839
924
  "add-button": "新增按钮",
840
925
  "add-dropdown": "新增下拉按钮",
841
926
  "group-gap": "按钮组间距",
927
+ "general-style": "通用样式表达式",
928
+ "general-style-placeholder": "例如返回一个 style map,例如 display: flex",
929
+ "general-style-invalid": "样式表达式无效",
842
930
  "button-title": "按钮名称",
931
+ "tooltip": "提示",
843
932
  "button-icon": "按钮图标",
844
933
  "button-variant": "按钮变体",
845
934
  "button-variant-default": "默认",
@@ -877,7 +966,11 @@ function confirmChanges() {
877
966
  "add-button": "Add button",
878
967
  "add-dropdown": "Add dropdown",
879
968
  "group-gap": "Group gap",
969
+ "general-style": "Shared style expression",
970
+ "general-style-placeholder": "Return a style map, for example display: flex",
971
+ "general-style-invalid": "The style expression is invalid",
880
972
  "button-title": "Button title",
973
+ "tooltip": "Tooltip",
881
974
  "button-icon": "Button icon",
882
975
  "button-variant": "Button variant",
883
976
  "button-variant-default": "Default",
@@ -915,7 +1008,11 @@ function confirmChanges() {
915
1008
  "add-button": "ボタンを追加",
916
1009
  "add-dropdown": "ドロップダウンを追加",
917
1010
  "group-gap": "グループ間隔",
1011
+ "general-style": "共通スタイル式",
1012
+ "general-style-placeholder": "例: style map を返す式。例: display: flex",
1013
+ "general-style-invalid": "スタイル式が無効です",
918
1014
  "button-title": "ボタン名",
1015
+ "tooltip": "ツールチップ",
919
1016
  "button-icon": "ボタンアイコン",
920
1017
  "button-variant": "ボタンバリアント",
921
1018
  "button-variant-default": "デフォルト",
@@ -953,7 +1050,11 @@ function confirmChanges() {
953
1050
  "add-button": "버튼 추가",
954
1051
  "add-dropdown": "드롭다운 추가",
955
1052
  "group-gap": "그룹 간격",
1053
+ "general-style": "공통 스타일 식",
1054
+ "general-style-placeholder": "예: style map 을 반환하는 식. 예: display: flex",
1055
+ "general-style-invalid": "스타일 식이 올바르지 않습니다",
956
1056
  "button-title": "버튼 이름",
1057
+ "tooltip": "툴팁",
957
1058
  "button-icon": "버튼 아이콘",
958
1059
  "button-variant": "버튼 변형",
959
1060
  "button-variant-default": "기본값",
@@ -17,6 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
17
17
  locale: "zh" | "ja" | "en" | "ko";
18
18
  message: string;
19
19
  }[];
20
+ tooltip?: readonly {
21
+ locale: "zh" | "ja" | "en" | "ko";
22
+ message: string;
23
+ }[] | undefined;
20
24
  icon?: string | undefined;
21
25
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
22
26
  hideTitle?: boolean | undefined;
@@ -32,6 +36,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
32
36
  locale: "zh" | "ja" | "en" | "ko";
33
37
  message: string;
34
38
  }[];
39
+ tooltip?: readonly {
40
+ locale: "zh" | "ja" | "en" | "ko";
41
+ message: string;
42
+ }[] | undefined;
35
43
  icon?: string | undefined;
36
44
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
37
45
  }>[];
@@ -39,6 +47,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
39
47
  }>)[];
40
48
  }>[];
41
49
  gap?: number | undefined;
50
+ style?: string | undefined;
42
51
  }>) => any;
43
52
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
44
53
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,6 +90,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
78
96
  declare const _default: typeof __VLS_export;
@@ -7,6 +7,7 @@ export type ButtonConfiguratorDraftNodeData = Readonly<{
7
7
  type: 'button';
8
8
  id: string;
9
9
  title: LocaleValue;
10
+ tooltip?: LocaleValue;
10
11
  icon?: string;
11
12
  variant?: ButtonAction['variant'];
12
13
  hideTitle?: boolean;
@@ -41,6 +41,9 @@ function stripButton(button) {
41
41
  id: button.id,
42
42
  title: button.title
43
43
  };
44
+ if (button.tooltip) {
45
+ nextItem.tooltip = button.tooltip;
46
+ }
44
47
  if (button.icon) {
45
48
  nextItem.icon = button.icon;
46
49
  }
@@ -86,7 +89,8 @@ export function createButtonConfiguratorButtonNode(button, createItemId) {
86
89
  item: button ? stripButton(button) : {
87
90
  type: "button",
88
91
  id: crypto.randomUUID(),
89
- title: [{ locale: "zh", message: "" }]
92
+ title: [{ locale: "zh", message: "" }],
93
+ tooltip: [{ locale: "zh", message: "" }]
90
94
  }
91
95
  };
92
96
  }
@@ -305,6 +309,9 @@ export function materializeButtonConfiguratorTree(tree) {
305
309
  if (node.item.variant === "default" || node.item.variant === "primary" || node.item.variant === "destructive" || node.item.variant === "ghost") {
306
310
  nextButton.variant = node.item.variant;
307
311
  }
312
+ if (node.item.tooltip) {
313
+ nextButton.tooltip = node.item.tooltip;
314
+ }
308
315
  const parentNode = node.parentItemId ? getButtonConfiguratorNode(tree, node.parentItemId) : void 0;
309
316
  if (parentNode?.item.type === "group" && node.item.hideTitle) {
310
317
  nextButton.hideTitle = node.item.hideTitle;
@@ -324,6 +331,7 @@ export function materializeButtonConfiguratorTree(tree) {
324
331
  return button ? [{
325
332
  id: button.id,
326
333
  title: button.title,
334
+ tooltip: button.tooltip,
327
335
  icon: button.icon,
328
336
  variant: button.variant
329
337
  }] : [];
@@ -1,6 +1,6 @@
1
1
  import { Effect } from 'effect';
2
2
  import { type ButtonConfig } from './schema.js';
3
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from './schema.js';
3
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './schema.js';
4
4
  export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './schema.js';
5
5
  declare const _default: typeof __VLS_export;
6
6
  export default _default;
@@ -16,6 +16,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
16
16
  locale: "zh" | "ja" | "en" | "ko";
17
17
  message: string;
18
18
  }[];
19
+ tooltip?: readonly {
20
+ locale: "zh" | "ja" | "en" | "ko";
21
+ message: string;
22
+ }[] | undefined;
19
23
  icon?: string | undefined;
20
24
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
21
25
  hideTitle?: boolean | undefined;
@@ -31,6 +35,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
31
35
  locale: "zh" | "ja" | "en" | "ko";
32
36
  message: string;
33
37
  }[];
38
+ tooltip?: readonly {
39
+ locale: "zh" | "ja" | "en" | "ko";
40
+ message: string;
41
+ }[] | undefined;
34
42
  icon?: string | undefined;
35
43
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
36
44
  }>[];
@@ -38,6 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
38
46
  }>)[];
39
47
  }>[];
40
48
  gap?: number | undefined;
49
+ style?: string | undefined;
41
50
  }>) => any;
42
51
  }, string, import("vue").PublicProps, Readonly<{
43
52
  config: Effect.Effect<ButtonConfig | import("./schema.js").ButtonConfigInput | undefined>;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,5 +90,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,17 +1,19 @@
1
1
  <script setup>
2
+ import { useNuxtApp } from "#app";
2
3
  import { useAttrs, computed, ref, watch } from "vue";
3
4
  import { computedAsync } from "@vueuse/core";
4
5
  import { Icon } from "@iconify/vue";
5
6
  import { Effect } from "effect";
6
7
  import { useI18n } from "vue-i18n";
7
8
  import { useCheating } from "#imports";
8
- import { getLocalizedText } from "../../../utils/coders";
9
+ import { getLocalizedText, hasVisibleLocaleValue } from "../../../utils/coders";
9
10
  import { cn } from "../../../utils/cn";
10
11
  import ButtonConfiguratorDialog from "../button-configurator/ButtonConfiguratorDialog.vue";
11
12
  import { Button } from "../button";
12
13
  import { ButtonGroup } from "../button-group";
13
14
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu";
14
15
  import { Skeleton } from "../skeleton";
16
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip";
15
17
  import { ButtonConfigC, normalizeButtonConfigInput } from "./schema";
16
18
  defineOptions({
17
19
  inheritAttrs: false
@@ -27,6 +29,7 @@ const defaultConfig = {
27
29
  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
30
  const attrs = useAttrs();
29
31
  const { locale, t } = useI18n();
32
+ const { $dsl } = useNuxtApp();
30
33
  const isCheating = useCheating();
31
34
  const isConfiguratorOpen = ref(false);
32
35
  const pendingIds = ref([]);
@@ -60,8 +63,25 @@ const rootClass = computed(() => {
60
63
  const classValue = Reflect.get(attrs, "class");
61
64
  return typeof classValue === "string" ? classValue : void 0;
62
65
  });
66
+ function getConfigStyle(config) {
67
+ const style = {};
68
+ if (!config.style) {
69
+ return style;
70
+ }
71
+ const styleMap = $dsl.evaluate`${config.style}`();
72
+ if (!styleMap || typeof styleMap !== "object" || Array.isArray(styleMap)) {
73
+ return style;
74
+ }
75
+ for (const [key, value] of Object.entries(styleMap)) {
76
+ if (typeof value === "string" || typeof value === "number") {
77
+ Reflect.set(style, key, value);
78
+ }
79
+ }
80
+ return style;
81
+ }
63
82
  const rootStyle = computed(() => ({
64
- gap: `calc(${displayConfig.value.gap ?? defaultConfig.gap ?? 12} * 0.25rem)`
83
+ gap: `calc(${displayConfig.value.gap ?? defaultConfig.gap ?? 12} * 0.25rem)`,
84
+ ...getConfigStyle(displayConfig.value)
65
85
  }));
66
86
  function getButtonLabel(button) {
67
87
  return getLocalizedText(button.title, locale.value) ?? t("untitled-button");
@@ -69,6 +89,9 @@ function getButtonLabel(button) {
69
89
  function getDropdownLabel(dropdown) {
70
90
  return getLocalizedText(dropdown.title, locale.value) ?? t("untitled-dropdown");
71
91
  }
92
+ function getButtonTooltip(button) {
93
+ return getLocalizedText(button.tooltip, locale.value);
94
+ }
72
95
  function getButtonEffect(buttonId) {
73
96
  return Reflect.get(attrs, buttonId);
74
97
  }
@@ -84,6 +107,9 @@ function isButtonDisabled(buttonId) {
84
107
  function isDropdownPending(dropdown) {
85
108
  return dropdown.items.some((item) => isPending(item.id));
86
109
  }
110
+ function hasButtonTooltip(button) {
111
+ return hasVisibleLocaleValue(button.tooltip);
112
+ }
87
113
  async function runButton(buttonId) {
88
114
  if (isPending(buttonId)) {
89
115
  return;
@@ -109,7 +135,7 @@ function isDropdownItem(item) {
109
135
  </script>
110
136
 
111
137
  <script>
112
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from "./schema";
138
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from "./schema";
113
139
  </script>
114
140
 
115
141
  <template>
@@ -155,7 +181,7 @@ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, Butt
155
181
  :key="item.id"
156
182
  >
157
183
  <Button
158
- v-if="!isDropdownItem(item)"
184
+ v-if="!isDropdownItem(item) && !hasButtonTooltip(item)"
159
185
  data-slot="buttons-item"
160
186
  :variant="item.variant"
161
187
  :disabled="isButtonDisabled(item.id)"
@@ -173,6 +199,38 @@ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, Butt
173
199
  <span v-if="!item.hideTitle">{{ getButtonLabel(item) }}</span>
174
200
  </Button>
175
201
 
202
+ <Tooltip
203
+ v-else-if="!isDropdownItem(item)"
204
+ :delay-duration="180"
205
+ >
206
+ <TooltipTrigger as-child>
207
+ <Button
208
+ data-slot="buttons-item"
209
+ :variant="item.variant"
210
+ :disabled="isButtonDisabled(item.id)"
211
+ :title="item.hideTitle ? getButtonLabel(item) : void 0"
212
+ @click="void runButton(item.id)"
213
+ >
214
+ <Icon
215
+ v-if="isPending(item.id)"
216
+ icon="line-md:loading-twotone-loop"
217
+ />
218
+ <Icon
219
+ v-else-if="item.icon"
220
+ :icon="item.icon"
221
+ />
222
+ <span v-if="!item.hideTitle">{{ getButtonLabel(item) }}</span>
223
+ </Button>
224
+ </TooltipTrigger>
225
+ <TooltipContent
226
+ data-slot="buttons-tooltip-content"
227
+ align="center"
228
+ side="top"
229
+ >
230
+ {{ getButtonTooltip(item) }}
231
+ </TooltipContent>
232
+ </Tooltip>
233
+
176
234
  <DropdownMenu v-else>
177
235
  <DropdownMenuTrigger as-child>
178
236
  <Button
@@ -192,23 +250,57 @@ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, Butt
192
250
  </DropdownMenuTrigger>
193
251
 
194
252
  <DropdownMenuContent align="start">
195
- <DropdownMenuItem
253
+ <template
196
254
  v-for="child in item.items"
197
255
  :key="child.id"
198
- data-slot="buttons-dropdown-item"
199
- :disabled="isButtonDisabled(child.id)"
200
- @select="void runButton(child.id)"
201
256
  >
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>
257
+ <DropdownMenuItem
258
+ v-if="!hasButtonTooltip(child)"
259
+ data-slot="buttons-dropdown-item"
260
+ :disabled="isButtonDisabled(child.id)"
261
+ @select="void runButton(child.id)"
262
+ >
263
+ <Icon
264
+ v-if="isPending(child.id)"
265
+ icon="line-md:loading-twotone-loop"
266
+ />
267
+ <Icon
268
+ v-else-if="child.icon"
269
+ :icon="child.icon"
270
+ />
271
+ <span>{{ getButtonLabel(child) }}</span>
272
+ </DropdownMenuItem>
273
+
274
+ <Tooltip
275
+ v-else
276
+ :delay-duration="180"
277
+ >
278
+ <TooltipTrigger as-child>
279
+ <DropdownMenuItem
280
+ data-slot="buttons-dropdown-item"
281
+ :disabled="isButtonDisabled(child.id)"
282
+ @select="void runButton(child.id)"
283
+ >
284
+ <Icon
285
+ v-if="isPending(child.id)"
286
+ icon="line-md:loading-twotone-loop"
287
+ />
288
+ <Icon
289
+ v-else-if="child.icon"
290
+ :icon="child.icon"
291
+ />
292
+ <span>{{ getButtonLabel(child) }}</span>
293
+ </DropdownMenuItem>
294
+ </TooltipTrigger>
295
+ <TooltipContent
296
+ data-slot="buttons-tooltip-content"
297
+ align="center"
298
+ side="top"
299
+ >
300
+ {{ getButtonTooltip(child) }}
301
+ </TooltipContent>
302
+ </Tooltip>
303
+ </template>
212
304
  </DropdownMenuContent>
213
305
  </DropdownMenu>
214
306
  </template>
@@ -1,6 +1,6 @@
1
1
  import { Effect } from 'effect';
2
2
  import { type ButtonConfig } from './schema.js';
3
- export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC } from './schema.js';
3
+ export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonsStyleC } from './schema.js';
4
4
  export type { ButtonAction, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonGroup, ButtonGroupItem } from './schema.js';
5
5
  declare const _default: typeof __VLS_export;
6
6
  export default _default;
@@ -16,6 +16,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
16
16
  locale: "zh" | "ja" | "en" | "ko";
17
17
  message: string;
18
18
  }[];
19
+ tooltip?: readonly {
20
+ locale: "zh" | "ja" | "en" | "ko";
21
+ message: string;
22
+ }[] | undefined;
19
23
  icon?: string | undefined;
20
24
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
21
25
  hideTitle?: boolean | undefined;
@@ -31,6 +35,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
31
35
  locale: "zh" | "ja" | "en" | "ko";
32
36
  message: string;
33
37
  }[];
38
+ tooltip?: readonly {
39
+ locale: "zh" | "ja" | "en" | "ko";
40
+ message: string;
41
+ }[] | undefined;
34
42
  icon?: string | undefined;
35
43
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
36
44
  }>[];
@@ -38,6 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
38
46
  }>)[];
39
47
  }>[];
40
48
  gap?: number | undefined;
49
+ style?: string | undefined;
41
50
  }>) => any;
42
51
  }, string, import("vue").PublicProps, Readonly<{
43
52
  config: Effect.Effect<ButtonConfig | import("./schema.js").ButtonConfigInput | undefined>;
@@ -51,6 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
51
60
  locale: "zh" | "ja" | "en" | "ko";
52
61
  message: string;
53
62
  }[];
63
+ tooltip?: readonly {
64
+ locale: "zh" | "ja" | "en" | "ko";
65
+ message: string;
66
+ }[] | undefined;
54
67
  icon?: string | undefined;
55
68
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
56
69
  hideTitle?: boolean | undefined;
@@ -66,6 +79,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
66
79
  locale: "zh" | "ja" | "en" | "ko";
67
80
  message: string;
68
81
  }[];
82
+ tooltip?: readonly {
83
+ locale: "zh" | "ja" | "en" | "ko";
84
+ message: string;
85
+ }[] | undefined;
69
86
  icon?: string | undefined;
70
87
  variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
71
88
  }>[];
@@ -73,5 +90,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
73
90
  }>)[];
74
91
  }>[];
75
92
  gap?: number | undefined;
93
+ style?: string | undefined;
76
94
  }>) => any) | undefined;
77
95
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
2
  import type { ButtonVariants } from '../button/index.js';
3
+ export declare const ButtonsStyleC: z.ZodOptional<z.ZodString>;
3
4
  export declare const ButtonActionC: z.ZodReadonly<z.ZodObject<{
4
5
  id: z.ZodUUID;
5
6
  title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -11,6 +12,15 @@ export declare const ButtonActionC: z.ZodReadonly<z.ZodObject<{
11
12
  }>;
12
13
  message: z.ZodString;
13
14
  }, z.core.$strip>>>;
15
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
16
+ locale: z.ZodEnum<{
17
+ zh: "zh";
18
+ ja: "ja";
19
+ en: "en";
20
+ ko: "ko";
21
+ }>;
22
+ message: z.ZodString;
23
+ }, z.core.$strip>>>>;
14
24
  icon: z.ZodOptional<z.ZodString>;
15
25
  variant: z.ZodOptional<z.ZodEnum<{
16
26
  default: "default";
@@ -43,6 +53,15 @@ export declare const ButtonDropdownC: z.ZodReadonly<z.ZodObject<{
43
53
  }>;
44
54
  message: z.ZodString;
45
55
  }, z.core.$strip>>>;
56
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
57
+ locale: z.ZodEnum<{
58
+ zh: "zh";
59
+ ja: "ja";
60
+ en: "en";
61
+ ko: "ko";
62
+ }>;
63
+ message: z.ZodString;
64
+ }, z.core.$strip>>>>;
46
65
  icon: z.ZodOptional<z.ZodString>;
47
66
  variant: z.ZodOptional<z.ZodEnum<{
48
67
  default: "default";
@@ -63,6 +82,15 @@ export declare const ButtonGroupItemC: z.ZodUnion<readonly [z.ZodReadonly<z.ZodO
63
82
  }>;
64
83
  message: z.ZodString;
65
84
  }, z.core.$strip>>>;
85
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
86
+ locale: z.ZodEnum<{
87
+ zh: "zh";
88
+ ja: "ja";
89
+ en: "en";
90
+ ko: "ko";
91
+ }>;
92
+ message: z.ZodString;
93
+ }, z.core.$strip>>>>;
66
94
  icon: z.ZodOptional<z.ZodString>;
67
95
  variant: z.ZodOptional<z.ZodEnum<{
68
96
  default: "default";
@@ -94,6 +122,15 @@ export declare const ButtonGroupItemC: z.ZodUnion<readonly [z.ZodReadonly<z.ZodO
94
122
  }>;
95
123
  message: z.ZodString;
96
124
  }, z.core.$strip>>>;
125
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
126
+ locale: z.ZodEnum<{
127
+ zh: "zh";
128
+ ja: "ja";
129
+ en: "en";
130
+ ko: "ko";
131
+ }>;
132
+ message: z.ZodString;
133
+ }, z.core.$strip>>>>;
97
134
  icon: z.ZodOptional<z.ZodString>;
98
135
  variant: z.ZodOptional<z.ZodEnum<{
99
136
  default: "default";
@@ -116,6 +153,15 @@ export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
116
153
  }>;
117
154
  message: z.ZodString;
118
155
  }, z.core.$strip>>>;
156
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
157
+ locale: z.ZodEnum<{
158
+ zh: "zh";
159
+ ja: "ja";
160
+ en: "en";
161
+ ko: "ko";
162
+ }>;
163
+ message: z.ZodString;
164
+ }, z.core.$strip>>>>;
119
165
  icon: z.ZodOptional<z.ZodString>;
120
166
  variant: z.ZodOptional<z.ZodEnum<{
121
167
  default: "default";
@@ -147,6 +193,15 @@ export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
147
193
  }>;
148
194
  message: z.ZodString;
149
195
  }, z.core.$strip>>>;
196
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
197
+ locale: z.ZodEnum<{
198
+ zh: "zh";
199
+ ja: "ja";
200
+ en: "en";
201
+ ko: "ko";
202
+ }>;
203
+ message: z.ZodString;
204
+ }, z.core.$strip>>>>;
150
205
  icon: z.ZodOptional<z.ZodString>;
151
206
  variant: z.ZodOptional<z.ZodEnum<{
152
207
  default: "default";
@@ -159,6 +214,7 @@ export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
159
214
  }, z.core.$strict>>;
160
215
  export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
161
216
  gap: z.ZodOptional<z.ZodNumber>;
217
+ style: z.ZodOptional<z.ZodString>;
162
218
  groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
163
219
  id: z.ZodUUID;
164
220
  items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
@@ -172,6 +228,15 @@ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
172
228
  }>;
173
229
  message: z.ZodString;
174
230
  }, z.core.$strip>>>;
231
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
232
+ locale: z.ZodEnum<{
233
+ zh: "zh";
234
+ ja: "ja";
235
+ en: "en";
236
+ ko: "ko";
237
+ }>;
238
+ message: z.ZodString;
239
+ }, z.core.$strip>>>>;
175
240
  icon: z.ZodOptional<z.ZodString>;
176
241
  variant: z.ZodOptional<z.ZodEnum<{
177
242
  default: "default";
@@ -203,6 +268,15 @@ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
203
268
  }>;
204
269
  message: z.ZodString;
205
270
  }, z.core.$strip>>>;
271
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
272
+ locale: z.ZodEnum<{
273
+ zh: "zh";
274
+ ja: "ja";
275
+ en: "en";
276
+ ko: "ko";
277
+ }>;
278
+ message: z.ZodString;
279
+ }, z.core.$strip>>>>;
206
280
  icon: z.ZodOptional<z.ZodString>;
207
281
  variant: z.ZodOptional<z.ZodEnum<{
208
282
  default: "default";
@@ -216,6 +290,7 @@ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
216
290
  }, z.core.$strict>>;
217
291
  export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
218
292
  gap: z.ZodOptional<z.ZodNumber>;
293
+ style: z.ZodOptional<z.ZodString>;
219
294
  groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
220
295
  id: z.ZodUUID;
221
296
  items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
@@ -229,6 +304,15 @@ export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
229
304
  }>;
230
305
  message: z.ZodString;
231
306
  }, z.core.$strip>>>;
307
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
308
+ locale: z.ZodEnum<{
309
+ zh: "zh";
310
+ ja: "ja";
311
+ en: "en";
312
+ ko: "ko";
313
+ }>;
314
+ message: z.ZodString;
315
+ }, z.core.$strip>>>>;
232
316
  icon: z.ZodOptional<z.ZodString>;
233
317
  variant: z.ZodOptional<z.ZodEnum<{
234
318
  default: "default";
@@ -260,6 +344,15 @@ export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
260
344
  }>;
261
345
  message: z.ZodString;
262
346
  }, z.core.$strip>>>;
347
+ tooltip: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
348
+ locale: z.ZodEnum<{
349
+ zh: "zh";
350
+ ja: "ja";
351
+ en: "en";
352
+ ko: "ko";
353
+ }>;
354
+ message: z.ZodString;
355
+ }, z.core.$strip>>>>;
263
356
  icon: z.ZodOptional<z.ZodString>;
264
357
  variant: z.ZodOptional<z.ZodEnum<{
265
358
  default: "default";
@@ -1,11 +1,13 @@
1
1
  import z from "zod";
2
- import { localeC } from "../../../utils/coders.js";
2
+ import { expressionC, localeC } from "../../../utils/coders.js";
3
3
  const buttonIdC = z.uuid().describe("\u6309\u94AE\u552F\u4E00\u6807\u8BC6\uFF0C\u5FC5\u987B\u662F UUID");
4
4
  const buttonGroupIdC = z.uuid().describe("\u6309\u94AE\u7EC4\u552F\u4E00\u6807\u8BC6\uFF0C\u5FC5\u987B\u662F UUID");
5
5
  const buttonVariantC = z.enum(["default", "primary", "destructive", "ghost"]).optional().describe("\u6309\u94AE\u53D8\u4F53");
6
+ export const ButtonsStyleC = expressionC(/^map/).optional().describe("\u8FD4\u56DE\u6309\u94AE\u5BB9\u5668\u6837\u5F0F\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F");
6
7
  export const ButtonActionC = z.strictObject({
7
8
  id: buttonIdC,
8
9
  title: localeC.describe("\u6309\u94AE\u540D\u79F0\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
10
+ tooltip: localeC.optional().describe("\u6309\u94AE\u63D0\u793A\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
9
11
  icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
10
12
  variant: buttonVariantC,
11
13
  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")
@@ -13,6 +15,7 @@ export const ButtonActionC = z.strictObject({
13
15
  const DropdownButtonActionC = z.strictObject({
14
16
  id: buttonIdC,
15
17
  title: localeC.describe("\u4E0B\u62C9\u9879\u6309\u94AE\u540D\u79F0\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
18
+ tooltip: localeC.optional().describe("\u4E0B\u62C9\u9879\u6309\u94AE\u63D0\u793A\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
16
19
  icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
17
20
  variant: buttonVariantC
18
21
  }).readonly();
@@ -28,7 +31,8 @@ export const ButtonGroupC = z.strictObject({
28
31
  items: z.array(ButtonGroupItemC).readonly().describe("\u6309\u94AE\u7EC4\u5185\u7684\u6309\u94AE\u4E0E\u4E0B\u62C9\u6309\u94AE")
29
32
  }).readonly();
30
33
  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"),
34
+ gap: z.number().finite().min(0).optional().describe("\u6309\u94AE\u7EC4\u4E4B\u95F4\u7684\u95F4\u8DDD\u500D\u7387\uFF0C\u8FD0\u884C\u65F6\u6309 0.25rem \u6B65\u8FDB\u6362\u7B97"),
35
+ style: ButtonsStyleC,
32
36
  groups: z.array(ButtonGroupC).readonly().describe("\u6839\u7EA7\u6309\u94AE\u7EC4\u5217\u8868")
33
37
  }).readonly();
34
38
  export const ButtonConfigInputC = ButtonConfigC;
@@ -40,11 +44,15 @@ export function normalizeButtonConfigInput(value) {
40
44
  }
41
45
  const groups = Reflect.get(value, "groups");
42
46
  const gap = Reflect.get(value, "gap");
47
+ const style = Reflect.get(value, "style");
43
48
  const nextConfig = {
44
49
  groups: Array.isArray(groups) ? groups : []
45
50
  };
46
51
  if (typeof gap === "number" && Number.isFinite(gap) && gap >= 0) {
47
52
  nextConfig.gap = gap;
48
53
  }
54
+ if (typeof style === "string") {
55
+ nextConfig.style = style;
56
+ }
49
57
  return nextConfig;
50
58
  }
@@ -3,6 +3,7 @@ import { Effect } from 'effect';
3
3
  import { type TableConfigInput } from './schema.js';
4
4
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
5
5
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './schema.js';
6
+ export type TableInstance = import('@tanstack/table-core').Table<unknown>;
6
7
  declare module '@tanstack/vue-table' {
7
8
  interface ColumnMeta<TData extends import('@tanstack/vue-table').RowData, TValue> {
8
9
  tooltip?: string;
@@ -509,7 +509,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
509
509
 
510
510
  <template>
511
511
  <div
512
- class="relative flex-1 flex flex-col"
512
+ class="relative flex-1 flex flex-col overflow-hidden"
513
513
  >
514
514
  <Button
515
515
  v-if="isCheating"
@@ -3,6 +3,7 @@ import { Effect } from 'effect';
3
3
  import { type TableConfigInput } from './schema.js';
4
4
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
5
5
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './schema.js';
6
+ export type TableInstance = import('@tanstack/table-core').Table<unknown>;
6
7
  declare module '@tanstack/vue-table' {
7
8
  interface ColumnMeta<TData extends import('@tanstack/vue-table').RowData, TValue> {
8
9
  tooltip?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",