@shwfed/nuxt 0.7.9 → 0.7.11

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 (108) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/app.d.vue.ts +7 -56
  3. package/dist/runtime/components/app.vue +17 -404
  4. package/dist/runtime/components/app.vue.d.ts +7 -56
  5. package/dist/runtime/components/fields.d.vue.ts +154 -132
  6. package/dist/runtime/components/fields.vue +30 -295
  7. package/dist/runtime/components/fields.vue.d.ts +154 -132
  8. package/dist/runtime/components/table.d.vue.ts +129 -59
  9. package/dist/runtime/components/table.vue +51 -617
  10. package/dist/runtime/components/table.vue.d.ts +129 -59
  11. package/dist/runtime/components/ui/app/App.d.vue.ts +86 -0
  12. package/dist/runtime/components/ui/app/App.vue +414 -0
  13. package/dist/runtime/components/ui/app/App.vue.d.ts +86 -0
  14. package/dist/runtime/components/ui/checkbox/Checkbox.vue +6 -2
  15. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
  16. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +30 -0
  17. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +87 -0
  18. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +30 -0
  19. package/dist/runtime/components/ui/expression-editor/index.d.ts +1 -0
  20. package/dist/runtime/components/ui/expression-editor/index.js +1 -0
  21. package/dist/runtime/components/ui/field/FieldContent.vue +1 -1
  22. package/dist/runtime/components/ui/field/FieldError.vue +2 -2
  23. package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
  24. package/dist/runtime/components/ui/fields/Fields.d.vue.ts +376 -0
  25. package/dist/runtime/components/ui/fields/Fields.vue +441 -0
  26. package/dist/runtime/components/ui/fields/Fields.vue.d.ts +376 -0
  27. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +163 -0
  28. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +363 -0
  29. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +163 -0
  30. package/dist/runtime/components/ui/icon-picker/IconPicker.d.vue.ts +15 -0
  31. package/dist/runtime/components/ui/icon-picker/IconPicker.vue +178 -0
  32. package/dist/runtime/components/ui/icon-picker/IconPicker.vue.d.ts +15 -0
  33. package/dist/runtime/components/ui/icon-picker/index.d.ts +1 -0
  34. package/dist/runtime/components/ui/icon-picker/index.js +1 -0
  35. package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
  36. package/dist/runtime/components/ui/input/Input.vue +2 -0
  37. package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
  38. package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +4 -1
  39. package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +8 -3
  40. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +8 -3
  41. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +8 -3
  42. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.d.vue.ts +8 -1
  43. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +11 -2
  44. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue.d.ts +8 -1
  45. package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
  46. package/dist/runtime/components/ui/input-group/InputGroupNumberField.d.vue.ts +5 -2
  47. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +10 -4
  48. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue.d.ts +5 -2
  49. package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
  50. package/dist/runtime/components/ui/input-group/index.js +1 -1
  51. package/dist/runtime/components/ui/locale/Locale.d.vue.ts +20 -0
  52. package/dist/runtime/components/ui/locale/Locale.vue +291 -0
  53. package/dist/runtime/components/ui/locale/Locale.vue.d.ts +20 -0
  54. package/dist/runtime/components/ui/locale/index.d.ts +1 -0
  55. package/dist/runtime/components/ui/locale/index.js +1 -0
  56. package/dist/runtime/components/ui/native-select/NativeSelect.d.vue.ts +2 -2
  57. package/dist/runtime/components/ui/native-select/NativeSelect.vue +1 -1
  58. package/dist/runtime/components/ui/native-select/NativeSelect.vue.d.ts +2 -2
  59. package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +1 -0
  60. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +4 -1
  61. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +1 -0
  62. package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +1 -1
  63. package/dist/runtime/components/ui/switch/Switch.vue +2 -2
  64. package/dist/runtime/components/ui/table/Table.d.vue.ts +147 -0
  65. package/dist/runtime/components/ui/table/Table.vue +952 -0
  66. package/dist/runtime/components/ui/table/Table.vue.d.ts +147 -0
  67. package/dist/runtime/components/ui/table/schema.d.ts +151 -0
  68. package/dist/runtime/components/ui/table/schema.js +142 -0
  69. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +128 -0
  70. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +2719 -0
  71. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +128 -0
  72. package/dist/runtime/components/ui/table-configurator/menu.d.ts +37 -0
  73. package/dist/runtime/components/ui/table-configurator/menu.js +227 -0
  74. package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +24 -0
  75. package/dist/runtime/components/ui/tabs/Tabs.vue +30 -0
  76. package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +24 -0
  77. package/dist/runtime/components/ui/tabs/TabsContent.d.vue.ts +18 -0
  78. package/dist/runtime/components/ui/tabs/TabsContent.vue +23 -0
  79. package/dist/runtime/components/ui/tabs/TabsContent.vue.d.ts +18 -0
  80. package/dist/runtime/components/ui/tabs/TabsList.d.vue.ts +18 -0
  81. package/dist/runtime/components/ui/tabs/TabsList.vue +25 -0
  82. package/dist/runtime/components/ui/tabs/TabsList.vue.d.ts +18 -0
  83. package/dist/runtime/components/ui/tabs/TabsTrigger.d.vue.ts +18 -0
  84. package/dist/runtime/components/ui/tabs/TabsTrigger.vue +27 -0
  85. package/dist/runtime/components/ui/tabs/TabsTrigger.vue.d.ts +18 -0
  86. package/dist/runtime/components/ui/tabs/index.d.ts +4 -0
  87. package/dist/runtime/components/ui/tabs/index.js +4 -0
  88. package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +1 -0
  89. package/dist/runtime/components/ui/textarea/Textarea.vue +4 -2
  90. package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +1 -0
  91. package/dist/runtime/components/ui/toggle/Toggle.d.vue.ts +34 -0
  92. package/dist/runtime/components/ui/toggle/Toggle.vue +32 -0
  93. package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +34 -0
  94. package/dist/runtime/components/ui/toggle/index.d.ts +7 -0
  95. package/dist/runtime/components/ui/toggle/index.js +22 -0
  96. package/dist/runtime/composables/useTableRenderers.d.ts +2 -1
  97. package/dist/runtime/composables/useTableRenderers.js +2 -1
  98. package/dist/runtime/plugins/toast/index.d.ts +2 -2
  99. package/dist/runtime/style.css +1 -1
  100. package/dist/runtime/table-renderers/builtins.js +328 -137
  101. package/dist/runtime/table-renderers/registry.d.ts +2 -1
  102. package/dist/runtime/table-renderers/registry.js +3 -0
  103. package/dist/runtime/utils/coders.d.ts +29 -2
  104. package/dist/runtime/utils/coders.js +40 -2
  105. package/package.json +8 -6
  106. /package/dist/runtime/components/{logo.d.vue.ts → ui/logo/Logo.d.vue.ts} +0 -0
  107. /package/dist/runtime/components/{logo.vue → ui/logo/Logo.vue} +0 -0
  108. /package/dist/runtime/components/{logo.vue.d.ts → ui/logo/Logo.vue.d.ts} +0 -0
@@ -1,7 +1,34 @@
1
1
  import z from 'zod';
2
- export declare const localeC: z.ZodObject<{
3
- locale: z.ZodString;
2
+ declare const localeCodeC: z.ZodEnum<{
3
+ zh: "zh";
4
+ ja: "ja";
5
+ en: "en";
6
+ ko: "ko";
7
+ }>;
8
+ export declare const supportedLocales: ("zh" | "ja" | "en" | "ko")[];
9
+ export declare const localeItemC: z.ZodObject<{
10
+ locale: z.ZodEnum<{
11
+ zh: "zh";
12
+ ja: "ja";
13
+ en: "en";
14
+ ko: "ko";
15
+ }>;
4
16
  message: z.ZodString;
5
17
  }, z.core.$strip>;
18
+ export declare const localeC: z.ZodReadonly<z.ZodArray<z.ZodObject<{
19
+ locale: z.ZodEnum<{
20
+ zh: "zh";
21
+ ja: "ja";
22
+ en: "en";
23
+ ko: "ko";
24
+ }>;
25
+ message: z.ZodString;
26
+ }, z.core.$strip>>>;
27
+ export type LocaleItem = z.infer<typeof localeItemC>;
28
+ export type LocaleCode = z.infer<typeof localeCodeC>;
29
+ export type LocaleValue = z.infer<typeof localeC>;
30
+ export declare function hasVisibleLocaleValue(value: LocaleValue | undefined): boolean;
31
+ export declare function getLocalizedText(messages: LocaleValue | undefined, locale: string): string | undefined;
6
32
  export declare const dotPropC: z.ZodString;
7
33
  export declare const expressionC: (tt: ReadonlyArray<RegExp | string> | string | RegExp, vars?: Record<string, string>) => z.ZodString;
34
+ export {};
@@ -2,10 +2,48 @@ import z from "zod";
2
2
  import { parsePath } from "dot-prop";
3
3
  import { md } from "../plugins/markdown/md.js";
4
4
  import { createEnvironment } from "../plugins/cel/env.js";
5
- export const localeC = z.object({
6
- locale: z.string().regex(/^[a-z]{2}$/).describe("ISO 639-1 \u53CC\u5B57\u7B26\u8BED\u8A00\u7801"),
5
+ const localeCodeC = z.enum(["zh", "ja", "en", "ko"]);
6
+ export const supportedLocales = localeCodeC.options;
7
+ export const localeItemC = z.object({
8
+ locale: localeCodeC.describe("\u652F\u6301\u7684\u8BED\u8A00\u7801\uFF0C\u4EC5\u9650 zh\u3001ja\u3001en\u3001ko"),
7
9
  message: z.string().describe("\u9488\u5BF9\u8BE5\u8BED\u8A00\u7684 UI \u6587\u672C")
8
10
  }).describe("\u9488\u5BF9\u67D0\u4E2A\u8BED\u8A00\u7684\u672C\u5730\u5316\u5185\u5BB9");
11
+ export const localeC = z.array(localeItemC).readonly().superRefine((value, ctx) => {
12
+ const seen = /* @__PURE__ */ new Set();
13
+ let zhCount = 0;
14
+ for (const [index, item] of value.entries()) {
15
+ if (seen.has(item.locale)) {
16
+ ctx.addIssue({
17
+ code: "custom",
18
+ message: "\u8BED\u8A00\u7801\u4E0D\u80FD\u91CD\u590D",
19
+ path: [index, "locale"]
20
+ });
21
+ }
22
+ seen.add(item.locale);
23
+ if (item.locale === "zh") {
24
+ zhCount++;
25
+ }
26
+ }
27
+ if (zhCount !== 1) {
28
+ ctx.addIssue({
29
+ code: "custom",
30
+ message: "\u5FC5\u987B\u4E14\u53EA\u80FD\u5305\u542B\u4E00\u4E2A zh \u8BED\u8A00"
31
+ });
32
+ }
33
+ }).describe("\u672C\u5730\u5316\u5185\u5BB9\u5217\u8868\uFF0C\u5FC5\u987B\u5305\u542B\u4E14\u53EA\u80FD\u5305\u542B\u4E00\u4E2A zh \u8BED\u8A00");
34
+ export function hasVisibleLocaleValue(value) {
35
+ return value?.some((item) => item.message.trim().length > 0) ?? false;
36
+ }
37
+ export function getLocalizedText(messages, locale) {
38
+ if (!messages) {
39
+ return void 0;
40
+ }
41
+ const localizedMessage = messages.find((message) => message.locale === locale && message.message.trim().length > 0);
42
+ if (localizedMessage) {
43
+ return localizedMessage.message;
44
+ }
45
+ return messages.find((message) => message.message.trim().length > 0)?.message;
46
+ }
9
47
  export const dotPropC = z.string().refine(
10
48
  (val) => {
11
49
  if (val.length === 0) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,6 +12,7 @@
12
12
  "./*": "./dist/*"
13
13
  },
14
14
  "main": "./dist/module.mjs",
15
+ "types": "./dist/types.d.mts",
15
16
  "typesVersions": {
16
17
  "*": {
17
18
  ".": [
@@ -32,6 +33,8 @@
32
33
  "release:major": "npm run lint && npm run test && npm run prepack && changelogen --major --release --push && npm publish",
33
34
  "lint": "eslint .",
34
35
  "test": "vitest run",
36
+ "test:e2e": "playwright test",
37
+ "test:e2e:ui": "playwright test --ui",
35
38
  "test:watch": "vitest watch",
36
39
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
37
40
  },
@@ -40,6 +43,7 @@
40
43
  "@fontsource-variable/noto-sans": "^5.2.10",
41
44
  "@fontsource-variable/noto-sans-jp": "^5.2.10",
42
45
  "@fontsource-variable/noto-sans-sc": "^5.2.10",
46
+ "@iconify-json/fluent": "^1.2.40",
43
47
  "@iconify/vue": "^5.0.0",
44
48
  "@intlify/unplugin-vue-i18n": "^11.0.3",
45
49
  "@nuxt/fonts": "^0.14.0",
@@ -76,14 +80,17 @@
76
80
  "@nuxt/module-builder": "^1.0.2",
77
81
  "@nuxt/schema": "^4.3.0",
78
82
  "@nuxt/test-utils": "^3.23.0",
83
+ "@playwright/test": "^1.58.2",
79
84
  "@types/markdown-it": "^14.1.2",
80
85
  "@types/node": "latest",
81
86
  "@vue/test-utils": "^2.4.6",
82
87
  "@vueuse/nuxt": "^14.2.1",
83
88
  "changelogen": "^0.6.2",
84
89
  "eslint": "^9.39.2",
90
+ "jsdom": "^28.1.0",
85
91
  "lint-staged": "^16.2.7",
86
92
  "nuxt": "^4.3.0",
93
+ "playwright-core": "^1.58.2",
87
94
  "simple-git-hooks": "^2.13.1",
88
95
  "typescript": "~5.9.3",
89
96
  "vitest": "^4.0.18",
@@ -97,10 +104,5 @@
97
104
  "simple-git-hooks": {
98
105
  "pre-commit": "bunx lint-staged",
99
106
  "commit-msg": "bunx commitlint --edit \"$1\""
100
- },
101
- "lint-staged": {
102
- "*.{js,jsx,ts,tsx,vue}": [
103
- "eslint --fix"
104
- ]
105
107
  }
106
108
  }