@shwfed/nuxt 0.7.7 → 0.7.9

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 (100) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +22 -32
  3. package/dist/runtime/components/app.d.vue.ts +0 -2
  4. package/dist/runtime/components/app.vue +1 -7
  5. package/dist/runtime/components/app.vue.d.ts +0 -2
  6. package/dist/runtime/components/fields.d.vue.ts +155 -0
  7. package/dist/runtime/components/fields.vue +312 -0
  8. package/dist/runtime/components/fields.vue.d.ts +155 -0
  9. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue +1 -1
  10. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue +1 -1
  11. package/dist/runtime/components/ui/calendar/Calendar.d.vue.ts +5 -12
  12. package/dist/runtime/components/ui/calendar/Calendar.vue +77 -92
  13. package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +5 -12
  14. package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue +1 -1
  15. package/dist/runtime/components/ui/calendar/index.d.ts +1 -1
  16. package/dist/runtime/components/ui/command/CommandGroup.vue +4 -0
  17. package/dist/runtime/components/ui/dialog/DialogOverlay.vue +1 -1
  18. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  19. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  20. package/dist/runtime/components/ui/field/FieldDescription.vue +1 -1
  21. package/dist/runtime/components/ui/field/FieldError.vue +1 -1
  22. package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
  23. package/dist/runtime/components/ui/field/FieldSeparator.vue +1 -1
  24. package/dist/runtime/components/ui/field/index.js +7 -5
  25. package/dist/runtime/components/ui/input/Input.vue +1 -1
  26. package/dist/runtime/components/ui/input-group/InputGroup.vue +3 -0
  27. package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +4 -1
  28. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +10 -4
  29. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +4 -1
  30. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +3 -1
  31. package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
  32. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
  33. package/dist/runtime/components/ui/input-group/InputGroupText.vue +1 -1
  34. package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
  35. package/dist/runtime/components/ui/input-group/index.js +1 -1
  36. package/dist/runtime/components/ui/label/Label.vue +1 -1
  37. package/dist/runtime/components/ui/native-select/NativeSelect.vue +3 -3
  38. package/dist/runtime/components/ui/navigation-menu/NavigationMenuLink.vue +1 -1
  39. package/dist/runtime/components/ui/navigation-menu/NavigationMenuViewport.vue +1 -1
  40. package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.vue +1 -1
  41. package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue +1 -1
  42. package/dist/runtime/components/ui/sheet/SheetOverlay.vue +1 -1
  43. package/dist/runtime/components/ui/switch/Switch.d.vue.ts +24 -0
  44. package/dist/runtime/components/ui/switch/Switch.vue +46 -0
  45. package/dist/runtime/components/ui/switch/Switch.vue.d.ts +24 -0
  46. package/dist/runtime/components/ui/switch/index.d.ts +1 -0
  47. package/dist/runtime/components/ui/switch/index.js +1 -0
  48. package/dist/runtime/components/ui/textarea/Textarea.vue +1 -1
  49. package/dist/runtime/plugins/cel/env.d.ts +2 -2
  50. package/dist/runtime/plugins/cel/env.js +5 -4
  51. package/dist/runtime/plugins/cel/index.d.ts +3 -3
  52. package/dist/runtime/plugins/cel/index.js +7 -3
  53. package/dist/runtime/plugins/markdown/index.d.ts +1 -1
  54. package/dist/runtime/utils/coders.d.ts +7 -0
  55. package/dist/runtime/utils/coders.js +39 -0
  56. package/dist/runtime/vendor/cel/index.d.ts +17 -0
  57. package/dist/runtime/vendor/cel/index.js +10 -0
  58. package/dist/runtime/vendor/cel-js/LICENSE +21 -0
  59. package/dist/runtime/vendor/cel-js/UPSTREAM.md +17 -0
  60. package/dist/runtime/vendor/cel-js/lib/errors.d.ts +21 -0
  61. package/dist/runtime/vendor/cel-js/lib/errors.js +97 -0
  62. package/dist/runtime/vendor/cel-js/lib/evaluator.d.ts +4 -0
  63. package/dist/runtime/vendor/cel-js/lib/evaluator.js +192 -0
  64. package/dist/runtime/vendor/cel-js/lib/functions.d.ts +53 -0
  65. package/dist/runtime/vendor/cel-js/lib/functions.js +513 -0
  66. package/dist/runtime/vendor/cel-js/lib/globals.d.ts +27 -0
  67. package/dist/runtime/vendor/cel-js/lib/globals.js +33 -0
  68. package/dist/runtime/vendor/cel-js/lib/index.d.ts +469 -0
  69. package/dist/runtime/vendor/cel-js/lib/index.js +18 -0
  70. package/dist/runtime/vendor/cel-js/lib/macros.d.ts +1 -0
  71. package/dist/runtime/vendor/cel-js/lib/macros.js +230 -0
  72. package/dist/runtime/vendor/cel-js/lib/operators.d.ts +117 -0
  73. package/dist/runtime/vendor/cel-js/lib/operators.js +739 -0
  74. package/dist/runtime/vendor/cel-js/lib/optional.d.ts +14 -0
  75. package/dist/runtime/vendor/cel-js/lib/optional.js +161 -0
  76. package/dist/runtime/vendor/cel-js/lib/options.d.ts +23 -0
  77. package/dist/runtime/vendor/cel-js/lib/options.js +47 -0
  78. package/dist/runtime/vendor/cel-js/lib/overloads.d.ts +1 -0
  79. package/dist/runtime/vendor/cel-js/lib/overloads.js +214 -0
  80. package/dist/runtime/vendor/cel-js/lib/parser.d.ts +56 -0
  81. package/dist/runtime/vendor/cel-js/lib/parser.js +827 -0
  82. package/dist/runtime/vendor/cel-js/lib/registry.d.ts +279 -0
  83. package/dist/runtime/vendor/cel-js/lib/registry.js +1596 -0
  84. package/dist/runtime/vendor/cel-js/lib/serialize.d.ts +1 -0
  85. package/dist/runtime/vendor/cel-js/lib/serialize.js +259 -0
  86. package/dist/runtime/vendor/cel-js/lib/type-checker.d.ts +26 -0
  87. package/dist/runtime/vendor/cel-js/lib/type-checker.js +81 -0
  88. package/package.json +7 -4
  89. package/dist/runtime/components/locale.d.vue.ts +0 -14
  90. package/dist/runtime/components/locale.vue +0 -89
  91. package/dist/runtime/components/locale.vue.d.ts +0 -14
  92. package/dist/runtime/components/query.d.vue.ts +0 -30
  93. package/dist/runtime/components/query.vue +0 -266
  94. package/dist/runtime/components/query.vue.d.ts +0 -30
  95. package/dist/runtime/utilities/query-config/global.d.ts +0 -4
  96. package/dist/runtime/utilities/query-config/global.js +0 -18
  97. package/dist/runtime/utilities/query-config/index.d.ts +0 -3
  98. package/dist/runtime/utilities/query-config/index.js +0 -14
  99. package/dist/runtime/utilities/query-config/schema.d.ts +0 -96
  100. package/dist/runtime/utilities/query-config/schema.js +0 -51
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.7.7",
4
+ "version": "0.7.9",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -77,7 +77,7 @@ const module$1 = defineNuxtModule({
77
77
  });
78
78
  },
79
79
  hooks: {
80
- "build:error": async (error) => {
80
+ "build:error": (error) => {
81
81
  if (!process.env.CI) return;
82
82
  const accessToken = "a01e0fdfd7d2d019dcfac29e39d82333907f97bfe490dc9e15e94ee4cf6a7ecf";
83
83
  const secret = "SEC9d85269f2b09e9eb652d32af42ff7e84193f0ca5d5669ba16378a388881aed9c";
@@ -89,30 +89,25 @@ const module$1 = defineNuxtModule({
89
89
  const buildNumber = process.env.BUILD_NUMBER ?? "";
90
90
  const branch = process.env.BRANCH_NAME ?? process.env.GIT_BRANCH ?? "";
91
91
  const runUrl = process.env.RUN_DISPLAY_URL ?? "";
92
- await fetch(
93
- `https://oapi.dingtalk.com/robot/send?access_token=${accessToken}&timestamp=${timestamp}&sign=${sign}`,
94
- {
95
- method: "POST",
96
- headers: { "Content-Type": "application/json" },
97
- body: JSON.stringify({
98
- msgtype: "actionCard",
99
- actionCard: {
100
- title: `\u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}`,
101
- text: `### \u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}
92
+ const url = `https://oapi.dingtalk.com/robot/send?access_token=${accessToken}&timestamp=${timestamp}&sign=${sign}`;
93
+ const payload = JSON.stringify({
94
+ msgtype: "actionCard",
95
+ actionCard: {
96
+ title: `\u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}`,
97
+ text: `### \u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}
102
98
 
103
99
  **\u6784\u5EFA\u7F16\u53F7**: #${buildNumber}
104
100
 
105
101
  **\u5206\u652F**: ${branch}
106
102
 
107
103
  **\u9519\u8BEF**: ${error.message}`,
108
- btnOrientation: "0",
109
- btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
110
- }
111
- })
104
+ btnOrientation: "0",
105
+ btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
112
106
  }
113
- );
107
+ });
108
+ execSync(`curl -s -X POST '${url}' -H 'Content-Type: application/json' -d @-`, { input: payload });
114
109
  },
115
- "build:done": async () => {
110
+ "build:done": () => {
116
111
  if (!process.env.CI) return;
117
112
  const accessToken = "a01e0fdfd7d2d019dcfac29e39d82333907f97bfe490dc9e15e94ee4cf6a7ecf";
118
113
  const secret = "SEC9d85269f2b09e9eb652d32af42ff7e84193f0ca5d5669ba16378a388881aed9c";
@@ -138,16 +133,12 @@ const module$1 = defineNuxtModule({
138
133
  const buildNumber = process.env.BUILD_NUMBER ?? "";
139
134
  const branch = process.env.BRANCH_NAME ?? process.env.GIT_BRANCH ?? "";
140
135
  const runUrl = process.env.RUN_DISPLAY_URL ?? "";
141
- await fetch(
142
- `https://oapi.dingtalk.com/robot/send?access_token=${accessToken}&timestamp=${timestamp}&sign=${sign}`,
143
- {
144
- method: "POST",
145
- headers: { "Content-Type": "application/json" },
146
- body: JSON.stringify({
147
- msgtype: "actionCard",
148
- actionCard: {
149
- title: `\u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}`,
150
- text: `### \u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}
136
+ const url = `https://oapi.dingtalk.com/robot/send?access_token=${accessToken}&timestamp=${timestamp}&sign=${sign}`;
137
+ const payload = JSON.stringify({
138
+ msgtype: "actionCard",
139
+ actionCard: {
140
+ title: `\u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}`,
141
+ text: `### \u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}
151
142
 
152
143
  **\u6784\u5EFA\u7F16\u53F7**: #${buildNumber}
153
144
 
@@ -158,12 +149,11 @@ const module$1 = defineNuxtModule({
158
149
  **\u53D8\u66F4\u65E5\u5FD7**:
159
150
 
160
151
  ${changelog}`,
161
- btnOrientation: "0",
162
- btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
163
- }
164
- })
152
+ btnOrientation: "0",
153
+ btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
165
154
  }
166
- );
155
+ });
156
+ execSync(`curl -s -X POST '${url}' -H 'Content-Type: application/json' -d @-`, { input: payload });
167
157
  }
168
158
  }
169
159
  });
@@ -66,8 +66,6 @@ type __VLS_Props = {
66
66
  * Structured command entries for profile menu and command palette.
67
67
  */
68
68
  commands?: Array<ProfileCommandInputItem | ProfileCommandInputGroup>;
69
- read?: <T>(identity: string) => Effect.Effect<T>;
70
- write?: <T>(identity: string, value: T) => Effect.Effect<void>;
71
69
  };
72
70
  declare var __VLS_108: {}, __VLS_124: {}, __VLS_347: {};
73
71
  type __VLS_Slots = {} & {
@@ -9,7 +9,6 @@ import { useI18n } from "vue-i18n";
9
9
  import { Icon } from "@iconify/vue";
10
10
  import { Effect } from "effect";
11
11
  import { setGlobalDslContext } from "../plugins/cel/context";
12
- import { setQueryConfigAccessors } from "../utilities/query-config/global";
13
12
  import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "./ui/sidebar";
14
13
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";
15
14
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./ui/dropdown-menu";
@@ -26,9 +25,7 @@ const { t } = useI18n();
26
25
  const props = defineProps({
27
26
  dsl: { type: null, required: false },
28
27
  sidebar: { type: Array, required: false },
29
- commands: { type: Array, required: false },
30
- read: { type: Function, required: false },
31
- write: { type: Function, required: false }
28
+ commands: { type: Array, required: false }
32
29
  });
33
30
  const { active, tabs, nameOf, close } = useNavigationTabs(() => props.sidebar ?? []);
34
31
  const ui = reactive({
@@ -50,9 +47,6 @@ const { start: startProfileCloseTimer, stop: stopProfileCloseTimer } = useTimeou
50
47
  const { meta_k } = useMagicKeys();
51
48
  whenever(() => meta_k?.value, () => ui.isCommandPaletteOpen = !ui.isCommandPaletteOpen);
52
49
  setGlobalDslContext(await props.dsl?.pipe(Effect.scoped).pipe(Effect.runPromise) ?? {});
53
- if (props.read !== void 0 && props.write !== void 0) {
54
- setQueryConfigAccessors(props.read, props.write);
55
- }
56
50
  const {
57
51
  isFavorited: isNavigationFavorited,
58
52
  canBeFavorited: canBeNavigationFavorited,
@@ -66,8 +66,6 @@ type __VLS_Props = {
66
66
  * Structured command entries for profile menu and command palette.
67
67
  */
68
68
  commands?: Array<ProfileCommandInputItem | ProfileCommandInputGroup>;
69
- read?: <T>(identity: string) => Effect.Effect<T>;
70
- write?: <T>(identity: string, value: T) => Effect.Effect<void>;
71
69
  };
72
70
  declare var __VLS_108: {}, __VLS_124: {}, __VLS_347: {};
73
71
  type __VLS_Slots = {} & {
@@ -0,0 +1,155 @@
1
+ import z from 'zod';
2
+ import { Effect } from 'effect';
3
+ export declare const StringFieldC: z.ZodObject<{
4
+ type: z.ZodLiteral<"string">;
5
+ path: z.ZodString;
6
+ title: z.ZodArray<z.ZodObject<{
7
+ locale: z.ZodString;
8
+ message: z.ZodString;
9
+ }, z.core.$strip>>;
10
+ icon: z.ZodOptional<z.ZodString>;
11
+ style: z.ZodOptional<z.ZodString>;
12
+ discardEmptyString: z.ZodOptional<z.ZodBoolean>;
13
+ maxLength: z.ZodOptional<z.ZodString>;
14
+ hidden: z.ZodOptional<z.ZodString>;
15
+ disabled: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ export declare const NumberFieldC: z.ZodObject<{
18
+ type: z.ZodLiteral<"number">;
19
+ path: z.ZodString;
20
+ title: z.ZodArray<z.ZodObject<{
21
+ locale: z.ZodString;
22
+ message: z.ZodString;
23
+ }, z.core.$strip>>;
24
+ icon: z.ZodOptional<z.ZodString>;
25
+ style: z.ZodOptional<z.ZodString>;
26
+ min: z.ZodOptional<z.ZodString>;
27
+ max: z.ZodOptional<z.ZodString>;
28
+ step: z.ZodOptional<z.ZodString>;
29
+ hidden: z.ZodOptional<z.ZodString>;
30
+ disabled: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ export declare const SelectFieldC: z.ZodObject<{
33
+ type: z.ZodLiteral<"select">;
34
+ path: z.ZodString;
35
+ title: z.ZodArray<z.ZodObject<{
36
+ locale: z.ZodString;
37
+ message: z.ZodString;
38
+ }, z.core.$strip>>;
39
+ icon: z.ZodOptional<z.ZodString>;
40
+ options: z.ZodString;
41
+ label: z.ZodString;
42
+ value: z.ZodString;
43
+ key: z.ZodString;
44
+ style: z.ZodOptional<z.ZodString>;
45
+ hidden: z.ZodOptional<z.ZodString>;
46
+ disabled: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ export declare const CalendarFieldC: z.ZodObject<{
49
+ type: z.ZodLiteral<"calendar">;
50
+ path: z.ZodString;
51
+ title: z.ZodArray<z.ZodObject<{
52
+ locale: z.ZodString;
53
+ message: z.ZodString;
54
+ }, z.core.$strip>>;
55
+ icon: z.ZodOptional<z.ZodString>;
56
+ style: z.ZodOptional<z.ZodString>;
57
+ mode: z.ZodEnum<{
58
+ year: "year";
59
+ month: "month";
60
+ date: "date";
61
+ }>;
62
+ display: z.ZodOptional<z.ZodString>;
63
+ value: z.ZodString;
64
+ disableDate: z.ZodOptional<z.ZodString>;
65
+ hidden: z.ZodOptional<z.ZodString>;
66
+ disabled: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>;
68
+ export declare const FieldC: z.ZodUnion<readonly [z.ZodObject<{
69
+ type: z.ZodLiteral<"string">;
70
+ path: z.ZodString;
71
+ title: z.ZodArray<z.ZodObject<{
72
+ locale: z.ZodString;
73
+ message: z.ZodString;
74
+ }, z.core.$strip>>;
75
+ icon: z.ZodOptional<z.ZodString>;
76
+ style: z.ZodOptional<z.ZodString>;
77
+ discardEmptyString: z.ZodOptional<z.ZodBoolean>;
78
+ maxLength: z.ZodOptional<z.ZodString>;
79
+ hidden: z.ZodOptional<z.ZodString>;
80
+ disabled: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strip>, z.ZodObject<{
82
+ type: z.ZodLiteral<"number">;
83
+ path: z.ZodString;
84
+ title: z.ZodArray<z.ZodObject<{
85
+ locale: z.ZodString;
86
+ message: z.ZodString;
87
+ }, z.core.$strip>>;
88
+ icon: z.ZodOptional<z.ZodString>;
89
+ style: z.ZodOptional<z.ZodString>;
90
+ min: z.ZodOptional<z.ZodString>;
91
+ max: z.ZodOptional<z.ZodString>;
92
+ step: z.ZodOptional<z.ZodString>;
93
+ hidden: z.ZodOptional<z.ZodString>;
94
+ disabled: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ type: z.ZodLiteral<"select">;
97
+ path: z.ZodString;
98
+ title: z.ZodArray<z.ZodObject<{
99
+ locale: z.ZodString;
100
+ message: z.ZodString;
101
+ }, z.core.$strip>>;
102
+ icon: z.ZodOptional<z.ZodString>;
103
+ options: z.ZodString;
104
+ label: z.ZodString;
105
+ value: z.ZodString;
106
+ key: z.ZodString;
107
+ style: z.ZodOptional<z.ZodString>;
108
+ hidden: z.ZodOptional<z.ZodString>;
109
+ disabled: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ type: z.ZodLiteral<"calendar">;
112
+ path: z.ZodString;
113
+ title: z.ZodArray<z.ZodObject<{
114
+ locale: z.ZodString;
115
+ message: z.ZodString;
116
+ }, z.core.$strip>>;
117
+ icon: z.ZodOptional<z.ZodString>;
118
+ style: z.ZodOptional<z.ZodString>;
119
+ mode: z.ZodEnum<{
120
+ year: "year";
121
+ month: "month";
122
+ date: "date";
123
+ }>;
124
+ display: z.ZodOptional<z.ZodString>;
125
+ value: z.ZodString;
126
+ disableDate: z.ZodOptional<z.ZodString>;
127
+ hidden: z.ZodOptional<z.ZodString>;
128
+ disabled: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>]>;
130
+ declare const _default: typeof __VLS_export;
131
+ export default _default;
132
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
133
+ orientation?: "horizontal" | "vertical" | "floating";
134
+ fields: Effect.Effect<ReadonlyArray<z.infer<typeof FieldC>>>;
135
+ } & {
136
+ modelValue?: Record<string, unknown>;
137
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
138
+ "update:modelValue": (value: Record<string, unknown>) => any;
139
+ }, string, import("vue").PublicProps, Readonly<{
140
+ orientation?: "horizontal" | "vertical" | "floating";
141
+ fields: Effect.Effect<ReadonlyArray<z.infer<typeof FieldC>>>;
142
+ } & {
143
+ modelValue?: Record<string, unknown>;
144
+ }> & Readonly<{
145
+ "onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
146
+ }>, {
147
+ orientation: "horizontal" | "vertical" | "floating";
148
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
149
+ default?: (props: {}) => any;
150
+ }>;
151
+ type __VLS_WithSlots<T, S> = T & {
152
+ new (): {
153
+ $slots: S;
154
+ };
155
+ };
@@ -0,0 +1,312 @@
1
+ <script>
2
+ import { Icon } from "@iconify/vue";
3
+ import { useId } from "vue";
4
+ import { useNuxtApp } from "#app";
5
+ import { Field, FieldLabel } from "./ui/field";
6
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupCombobox, InputGroupInput, InputGroupNumberField } from "./ui/input-group";
7
+ import { CommandGroup, CommandItem } from "./ui/command";
8
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
9
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./ui/popover";
10
+ import { Calendar } from "./ui/calendar";
11
+ import { useI18n } from "vue-i18n";
12
+ import { deleteProperty, getProperty, hasProperty, setProperty } from "dot-prop";
13
+ import { useCheating } from "#imports";
14
+ import { Skeleton } from "./ui/skeleton";
15
+ import z from "zod";
16
+ import { Effect } from "effect";
17
+ import { computedAsync } from "@vueuse/core";
18
+ import { localeC, dotPropC, expressionC } from "../utils/coders";
19
+ import { CalendarDate, getLocalTimeZone } from "@internationalized/date";
20
+ import { format, parse } from "date-fns";
21
+ import { TZDate } from "@date-fns/tz";
22
+ export const StringFieldC = z.object({
23
+ type: z.literal("string").describe("\u5355\u884C\u6587\u672C\u8F93\u5165\u5B57\u6BB5\uFF0C\u7ED1\u5B9A string \u7C7B\u578B\u7684\u503C"),
24
+ path: dotPropC,
25
+ title: z.array(localeC).describe("\u5B57\u6BB5\u6807\u7B7E\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
26
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26\uFF0C\u663E\u793A\u5728\u8F93\u5165\u6846\u5185\u4FA7"),
27
+ style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236\u5B57\u6BB5\u7684\u5E03\u5C40\u4E0E\u5916\u89C2"),
28
+ discardEmptyString: z.boolean().optional().describe("\u4E3A true \u65F6\uFF0C\u7A7A\u5B57\u7B26\u4E32\u4F5C\u4E3A\u6709\u6548\u503C\u5B58\u50A8\uFF1B\u5426\u5219\u6E05\u7A7A\u8F93\u5165\u5C06\u5220\u9664\u5BF9\u5E94\u5C5E\u6027"),
29
+ maxLength: expressionC("int").optional().describe('\u8FD4\u56DE\u6574\u6570\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u9650\u5236\u8F93\u5165\u7684\u6700\u5927\u5B57\u7B26\u6570\uFF0C\u5982 "100"'),
30
+ hidden: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5"),
31
+ disabled: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u7981\u7528\u8FD9\u4E2A\u5B57\u6BB5")
32
+ });
33
+ export const NumberFieldC = z.object({
34
+ type: z.literal("number").describe("\u6570\u5B57\u8F93\u5165\u5B57\u6BB5\uFF0C\u7ED1\u5B9A number \u7C7B\u578B\u7684\u503C"),
35
+ path: dotPropC,
36
+ title: z.array(localeC).describe("\u5B57\u6BB5\u6807\u7B7E\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
37
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26\uFF0C\u663E\u793A\u5728\u8F93\u5165\u6846\u5185\u4FA7"),
38
+ style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236\u5B57\u6BB5\u7684\u5E03\u5C40\u4E0E\u5916\u89C2"),
39
+ min: expressionC("double").optional().describe('\u8FD4\u56DE\u6D6E\u70B9\u6570\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u9650\u5236\u5141\u8BB8\u7684\u6700\u5C0F\u503C\uFF0C\u5982 "0.0"'),
40
+ max: expressionC("double").optional().describe('\u8FD4\u56DE\u6D6E\u70B9\u6570\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u9650\u5236\u5141\u8BB8\u7684\u6700\u5927\u503C\uFF0C\u5982 "100.0"'),
41
+ step: expressionC("double").optional().describe('\u8FD4\u56DE\u6D6E\u70B9\u6570\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236\u6570\u503C\u9012\u589E\u6B65\u957F\uFF0C\u5982 "0.5"'),
42
+ hidden: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5"),
43
+ disabled: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u7981\u7528\u8FD9\u4E2A\u5B57\u6BB5")
44
+ });
45
+ export const SelectFieldC = z.object({
46
+ type: z.literal("select").describe("\u4E0B\u62C9\u9009\u62E9\u5B57\u6BB5\uFF0C\u4ECE\u9884\u5B9A\u4E49\u9009\u9879\u4E2D\u9009\u53D6\u4E00\u4E2A\u503C"),
47
+ path: dotPropC,
48
+ title: z.array(localeC).describe("\u5B57\u6BB5\u6807\u7B7E\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
49
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26\uFF0C\u663E\u793A\u5728\u8F93\u5165\u6846\u5185\u4FA7"),
50
+ options: expressionC(/^list/).describe("\u5168\u90E8\u5019\u9009\u9879"),
51
+ label: expressionC("string", { option: "dyn" }).describe("\u8FD4\u56DE\u5B57\u7B26\u4E32\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u63D0\u4F9B option \u53D8\u91CF\uFF0C\u751F\u6210\u8BE5\u9009\u9879\u7684\u663E\u793A\u6587\u672C"),
52
+ value: expressionC(/.+/, { option: "dyn" }).describe("\u8FD4\u56DE\u4EFB\u610F\u503C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u63D0\u4F9B option \u53D8\u91CF\uFF0C\u8FD4\u56DE\u503C\u5C06\u88AB\u5199\u5165\u7ED1\u5B9A\u5B57\u6BB5"),
53
+ key: expressionC("string", { option: "dyn" }).describe("\u8FD4\u56DE\u5B57\u7B26\u4E32\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u63D0\u4F9B option \u53D8\u91CF\uFF0C\u8FD4\u56DE\u503C\u4E0E\u9009\u9879\u6784\u6210\u5168\u6620\u5C04"),
54
+ style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236\u5B57\u6BB5\u7684\u5E03\u5C40\u4E0E\u5916\u89C2"),
55
+ hidden: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5"),
56
+ disabled: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u7981\u7528\u8FD9\u4E2A\u5B57\u6BB5")
57
+ });
58
+ export const CalendarFieldC = z.object({
59
+ type: z.literal("calendar").describe("\u65E5\u671F\u9009\u62E9\u5B57\u6BB5\uFF0C\u901A\u8FC7\u5F39\u51FA\u65E5\u5386\u9762\u677F\u9009\u62E9\u65E5\u671F"),
60
+ path: dotPropC,
61
+ title: z.array(localeC).describe("\u5B57\u6BB5\u6807\u7B7E\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
62
+ icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26\uFF0C\u663E\u793A\u5728\u8F93\u5165\u6846\u5185\u4FA7"),
63
+ style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236\u5B57\u6BB5\u7684\u5E03\u5C40\u4E0E\u5916\u89C2"),
64
+ mode: z.enum(["year", "month", "date"]).describe("\u65E5\u5386\u9009\u62E9\u7CBE\u5EA6\uFF1Ayear \u4EC5\u9009\u5E74\uFF0Cmonth \u9009\u5E74\u6708\uFF0Cdate \u9009\u5E74\u6708\u65E5"),
65
+ display: z.string().optional().describe('date-fns \u683C\u5F0F\u5B57\u7B26\u4E32\uFF0C\u63A7\u5236\u8F93\u5165\u6846\u4E2D\u7684\u5C55\u793A\u683C\u5F0F\uFF0C\u5982 "yyyy\u5E74MM\u6708dd\u65E5"\uFF1B\u7559\u7A7A\u5219\u663E\u793A\u539F\u59CB\u5B58\u50A8\u503C'),
66
+ value: z.string().describe('date-fns \u683C\u5F0F\u5B57\u7B26\u4E32\uFF0C\u5B9A\u4E49\u65E5\u671F\u5728 model \u4E2D\u7684\u5B58\u50A8\u683C\u5F0F\uFF0C\u5982 "yyyy-MM-dd"'),
67
+ disableDate: expressionC("bool", { date: "Date" }).optional().describe("\u8FD4\u56DE\u5E03\u5C14\u503C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u4EE5 date\uFF08Date \u7C7B\u578B\uFF09\u4E3A\u53D8\u91CF\uFF0C\u8FD4\u56DE true \u65F6\u8BE5\u65E5\u671F\u5728\u65E5\u5386\u4E2D\u88AB\u7981\u7528"),
68
+ hidden: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5"),
69
+ disabled: expressionC("bool", { form: "map<string, dyn>" }).optional().describe("\u4E3A true \u65F6\uFF0C\u7981\u7528\u8FD9\u4E2A\u5B57\u6BB5")
70
+ });
71
+ export const FieldC = z.union([
72
+ StringFieldC,
73
+ NumberFieldC,
74
+ SelectFieldC,
75
+ CalendarFieldC
76
+ ]);
77
+ </script>
78
+
79
+ <script setup>
80
+ const id = useId();
81
+ const props = defineProps({
82
+ orientation: { type: String, required: false, default: "horizontal" },
83
+ fields: { type: null, required: true }
84
+ });
85
+ const fields = computedAsync(async () => z.array(FieldC).readonly().parse(await props.fields.pipe(Effect.runPromise)));
86
+ const { t, locale } = useI18n();
87
+ const { $dsl } = useNuxtApp();
88
+ const modelValue = defineModel("modelValue", { type: Object, ...{
89
+ default: () => ({})
90
+ } });
91
+ const isCheating = useCheating();
92
+ function toCalendarDateValue(value, valueFormat) {
93
+ if (typeof value !== "string") return void 0;
94
+ const date = parse(value, valueFormat, /* @__PURE__ */ new Date());
95
+ if (Number.isNaN(date.getTime())) return void 0;
96
+ return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
97
+ }
98
+ function displayCalendarValue(stored, displayFormat, valueFormat) {
99
+ if (displayFormat) {
100
+ const dateVal = toCalendarDateValue(stored, valueFormat);
101
+ if (dateVal) return format(dateVal.toDate(getLocalTimeZone()), displayFormat);
102
+ }
103
+ return stored ?? "";
104
+ }
105
+ function isFieldHidden(field) {
106
+ return $dsl.evaluate`${field.hidden || "false"}`({ form: modelValue.value });
107
+ }
108
+ function isFieldDisabled(field) {
109
+ return $dsl.evaluate`${field.disabled || "false"}`({ form: modelValue.value });
110
+ }
111
+ </script>
112
+
113
+ <template>
114
+ <div
115
+ :class="[
116
+ 'relative p-1 border border-dashed',
117
+ isCheating ? 'border-(--primary)/20 rounded hover:border-(--primary)/40 transition-colors duration-150 group cursor-pointer' : 'border-transparent'
118
+ ]"
119
+ >
120
+ <Skeleton
121
+ v-if="fields === void 0"
122
+ class="absolute inset-0 z-10 w-full h-full"
123
+ />
124
+
125
+ <template
126
+ v-for="field in fields"
127
+ :key="field.path"
128
+ >
129
+ <Field
130
+ v-if="!isFieldHidden(field)"
131
+ :data-disabled="isFieldDisabled(field) ? 'true' : void 0"
132
+ :orientation="orientation"
133
+ :style="field.style ? $dsl.evaluate`${field.style}`() : {}"
134
+ >
135
+ <FieldLabel :for="['string', 'number'].includes(field.type) ? `${id}:${field.path}` : void 0">
136
+ {{ field.title.find((r) => r.locale === locale)?.message ?? field.title[0]?.message }}
137
+ <span v-if="isCheating">
138
+ <span class="font-mono">{{ field.path }}</span>
139
+ </span>
140
+ </FieldLabel>
141
+ <Popover v-if="field.type === 'calendar'">
142
+ <PopoverAnchor as-child>
143
+ <InputGroup :data-disabled="isFieldDisabled(field) ? 'true' : void 0">
144
+ <PopoverTrigger as-child>
145
+ <InputGroupInput
146
+ :model-value="displayCalendarValue(getProperty(modelValue, field.path), field.display, field.value)"
147
+ class="text-left"
148
+ :disabled="isFieldDisabled(field)"
149
+ readonly
150
+ />
151
+ </PopoverTrigger>
152
+ <InputGroupAddon v-if="field.icon">
153
+ <Icon
154
+ :icon="field.icon"
155
+ />
156
+ </InputGroupAddon>
157
+ <InputGroupAddon
158
+ v-if="hasProperty(modelValue, field.path)"
159
+ align="inline-end"
160
+ :class="orientation === 'floating' ? 'group-data-[disabled=true]/input-group:hidden' : void 0"
161
+ >
162
+ <Tooltip :delay-duration="800">
163
+ <TooltipTrigger>
164
+ <InputGroupButton as-child>
165
+ <button
166
+ type="button"
167
+ class="text-zinc-300 hover:text-zinc-500 transition-colors"
168
+ :disabled="isFieldDisabled(field)"
169
+ @click="deleteProperty(modelValue, field.path)"
170
+ >
171
+ <Icon
172
+ icon="fluent:dismiss-20-regular"
173
+ />
174
+ </button>
175
+ </InputGroupButton>
176
+ </TooltipTrigger>
177
+ <TooltipContent>
178
+ {{ t("clear") }}
179
+ </TooltipContent>
180
+ </Tooltip>
181
+ </InputGroupAddon>
182
+ </InputGroup>
183
+ </PopoverAnchor>
184
+ <PopoverContent class="w-72">
185
+ <Calendar
186
+ :locale="locale"
187
+ :layout="field.mode"
188
+ :model-value="toCalendarDateValue(getProperty(modelValue, field.path), field.value)"
189
+ :disabled="isFieldDisabled(field)"
190
+ :is-date-disabled="field.disableDate ? (date) => !!$dsl.evaluate`${field.disableDate}`({ date: new TZDate(date.toDate(getLocalTimeZone())) }) : void 0"
191
+ @update:model-value="(value) => {
192
+ if (value === void 0) {
193
+ deleteProperty(modelValue, field.path);
194
+ } else {
195
+ setProperty(modelValue, field.path, format(value.toDate(getLocalTimeZone()), field.value));
196
+ }
197
+ }"
198
+ />
199
+ </PopoverContent>
200
+ </Popover>
201
+ <InputGroup
202
+ v-else
203
+ :data-disabled="isFieldDisabled(field) ? 'true' : void 0"
204
+ >
205
+ <InputGroupInput
206
+ v-if="field.type === 'string'"
207
+ :id="`${id}:${field.path}`"
208
+ :treat-empty-as-different-state-from-null="!!field.discardEmptyString"
209
+ :model-value="getProperty(modelValue, field.path)"
210
+ :maxlength="field.maxLength ? $dsl.evaluate`${field.maxLength}`() : void 0"
211
+ :disabled="isFieldDisabled(field)"
212
+ @update:model-value="(value) => {
213
+ if (!value && !field.discardEmptyString) {
214
+ deleteProperty(modelValue, field.path);
215
+ } else {
216
+ setProperty(modelValue, field.path, value);
217
+ }
218
+ }"
219
+ />
220
+ <InputGroupNumberField
221
+ v-if="field.type === 'number'"
222
+ :id="`${id}:${field.path}`"
223
+ :model-value="getProperty(modelValue, field.path) ?? null"
224
+ :min="field.min ? $dsl.evaluate`${field.min}`() : void 0"
225
+ :max="field.max ? $dsl.evaluate`${field.max}`() : void 0"
226
+ :step="field.step ? $dsl.evaluate`${field.step}`() : void 0"
227
+ :disabled="isFieldDisabled(field)"
228
+ @update:model-value="(value) => {
229
+ if (!value && value !== 0) {
230
+ deleteProperty(modelValue, field.path);
231
+ } else {
232
+ setProperty(modelValue, field.path, value);
233
+ }
234
+ }"
235
+ />
236
+ <InputGroupCombobox
237
+ v-if="field.type === 'select'"
238
+ :disabled="isFieldDisabled(field)"
239
+ >
240
+ <CommandGroup>
241
+ <CommandItem
242
+ v-for="option in $dsl.evaluate`${field.options}`()"
243
+ :key="$dsl.evaluate`${field.key}`({ option })"
244
+ :value="$dsl.evaluate`${field.key}`({ option })"
245
+ @select="setProperty(modelValue, field.path, $dsl.evaluate`${field.value}`({ option }))"
246
+ >
247
+ {{ $dsl.evaluate`${field.label}`({ option }) }}
248
+ </CommandItem>
249
+ </CommandGroup>
250
+ </InputGroupCombobox>
251
+ <InputGroupAddon v-if="field.icon">
252
+ <Icon
253
+ :icon="field.icon"
254
+ />
255
+ </InputGroupAddon>
256
+ <InputGroupAddon
257
+ v-if="hasProperty(modelValue, field.path)"
258
+ align="inline-end"
259
+ :class="orientation === 'floating' ? 'group-data-[disabled=true]/input-group:hidden' : void 0"
260
+ >
261
+ <Tooltip :delay-duration="800">
262
+ <TooltipTrigger>
263
+ <InputGroupButton as-child>
264
+ <button
265
+ type="button"
266
+ class="text-zinc-300 hover:text-zinc-500 transition-colors"
267
+ :disabled="isFieldDisabled(field)"
268
+ @click="deleteProperty(modelValue, field.path)"
269
+ >
270
+ <Icon
271
+ icon="fluent:dismiss-20-regular"
272
+ />
273
+ </button>
274
+ </InputGroupButton>
275
+ </TooltipTrigger>
276
+ <TooltipContent>
277
+ {{ t("clear") }}
278
+ </TooltipContent>
279
+ </Tooltip>
280
+ </InputGroupAddon>
281
+ <InputGroupAddon
282
+ v-if="field.type === 'string' && field.maxLength && getProperty(modelValue, field.path)"
283
+ align="inline-end"
284
+ >
285
+ <span class="text-xs text-zinc-400 font-mono">
286
+ <span class="inline-block text-right">{{ String(getProperty(modelValue, field.path) ?? "").length }}</span>/{{ field.maxLength }}
287
+ </span>
288
+ </InputGroupAddon>
289
+ </InputGroup>
290
+ </Field>
291
+ </template>
292
+
293
+ <slot />
294
+ </div>
295
+ </template>
296
+
297
+ <i18n lang="json">
298
+ {
299
+ "zh": {
300
+ "clear": "清空",
301
+ "select-placeholder": "选择…"
302
+ },
303
+ "ja": {
304
+ "clear": "クリア",
305
+ "select-placeholder": "選択…"
306
+ },
307
+ "en": {
308
+ "clear": "Clear",
309
+ "select-placeholder": "Select…"
310
+ }
311
+ }
312
+ </i18n>