@movk/nuxt 1.8.3 → 2.0.0-beta.1

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 (274) hide show
  1. package/README.en.md +16 -6
  2. package/README.md +16 -6
  3. package/dist/module.d.mts +6 -0
  4. package/dist/module.json +3 -3
  5. package/dist/module.mjs +15 -22
  6. package/dist/runtime/components/AutoForm.d.vue.ts +15 -1
  7. package/dist/runtime/components/AutoForm.vue +48 -50
  8. package/dist/runtime/components/AutoForm.vue.d.ts +15 -1
  9. package/dist/runtime/components/DataTable.d.vue.ts +4 -2
  10. package/dist/runtime/components/DataTable.vue +166 -174
  11. package/dist/runtime/components/DataTable.vue.d.ts +4 -2
  12. package/dist/runtime/components/DatePicker.d.vue.ts +6 -5
  13. package/dist/runtime/components/DatePicker.vue +96 -43
  14. package/dist/runtime/components/DatePicker.vue.d.ts +6 -5
  15. package/dist/runtime/components/MessageBox.d.vue.ts +1 -5
  16. package/dist/runtime/components/MessageBox.vue +9 -7
  17. package/dist/runtime/components/MessageBox.vue.d.ts +1 -5
  18. package/dist/runtime/components/SearchForm.d.vue.ts +12 -4
  19. package/dist/runtime/components/SearchForm.vue +130 -120
  20. package/dist/runtime/components/SearchForm.vue.d.ts +12 -4
  21. package/dist/runtime/components/Tree.d.vue.ts +3 -1
  22. package/dist/runtime/components/Tree.vue +102 -140
  23. package/dist/runtime/components/Tree.vue.d.ts +3 -1
  24. package/dist/runtime/components/theme-picker/ThemePicker.vue +5 -3
  25. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +15 -6
  26. package/dist/runtime/composables/index.d.ts +1 -0
  27. package/dist/runtime/composables/index.js +1 -0
  28. package/dist/runtime/composables/useApiFetch.d.ts +7 -7
  29. package/dist/runtime/composables/useApiFetch.js +5 -23
  30. package/dist/runtime/composables/useAutoForm.js +2 -2
  31. package/dist/runtime/composables/useClientApiFetch.d.ts +5 -5
  32. package/dist/runtime/composables/useDateFormatter.d.ts +32 -34
  33. package/dist/runtime/composables/useDateFormatter.js +75 -232
  34. package/dist/runtime/composables/useDownloadWithProgress.d.ts +11 -8
  35. package/dist/runtime/composables/useDownloadWithProgress.js +49 -132
  36. package/dist/runtime/composables/useMessageBox.js +3 -2
  37. package/dist/runtime/composables/useMovkLocale.d.ts +16 -0
  38. package/dist/runtime/composables/useMovkLocale.js +20 -0
  39. package/dist/runtime/composables/useTheme.js +8 -18
  40. package/dist/runtime/composables/useUploadWithProgress.d.ts +9 -6
  41. package/dist/runtime/composables/useUploadWithProgress.js +50 -84
  42. package/dist/runtime/domains/ai/chat-transport.js +1 -0
  43. package/dist/runtime/domains/api/adapters/xhr.d.ts +17 -0
  44. package/dist/runtime/domains/api/adapters/xhr.js +55 -0
  45. package/dist/runtime/domains/api/auth.d.ts +4 -1
  46. package/dist/runtime/domains/api/auth.js +6 -7
  47. package/dist/runtime/domains/api/client.d.ts +13 -0
  48. package/dist/runtime/domains/api/client.js +35 -0
  49. package/dist/runtime/domains/api/download.d.ts +10 -0
  50. package/dist/runtime/domains/api/download.js +28 -0
  51. package/dist/runtime/domains/api/errors.d.ts +20 -2
  52. package/dist/runtime/domains/api/errors.js +61 -8
  53. package/dist/runtime/domains/api/fetch-key.d.ts +2 -2
  54. package/dist/runtime/domains/api/fetch-key.js +4 -4
  55. package/dist/runtime/domains/api/interceptors/request.d.ts +2 -6
  56. package/dist/runtime/domains/api/interceptors/request.js +3 -2
  57. package/dist/runtime/domains/api/interceptors/response.d.ts +8 -14
  58. package/dist/runtime/domains/api/interceptors/response.js +34 -25
  59. package/dist/runtime/domains/api/report.d.ts +25 -0
  60. package/dist/runtime/domains/api/report.js +51 -0
  61. package/dist/runtime/domains/api/response.d.ts +29 -4
  62. package/dist/runtime/domains/api/response.js +27 -6
  63. package/dist/runtime/domains/api/session.d.ts +1 -1
  64. package/dist/runtime/domains/api/session.js +1 -1
  65. package/dist/runtime/domains/api/stream.d.ts +2 -1
  66. package/dist/runtime/domains/api/stream.js +2 -1
  67. package/dist/runtime/domains/api/toast.d.ts +6 -3
  68. package/dist/runtime/domains/api/toast.js +7 -7
  69. package/dist/runtime/domains/auto-form/actions.d.ts +2 -1
  70. package/dist/runtime/domains/auto-form/actions.js +6 -4
  71. package/dist/runtime/domains/auto-form/array-ops.d.ts +3 -0
  72. package/dist/runtime/domains/auto-form/array-ops.js +9 -0
  73. package/dist/runtime/domains/auto-form/async-items.d.ts +10 -0
  74. package/dist/runtime/domains/auto-form/async-items.js +42 -0
  75. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +0 -4
  76. package/dist/runtime/domains/auto-form/components/Array.vue +81 -73
  77. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +0 -4
  78. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +0 -2
  79. package/dist/runtime/domains/auto-form/components/Children.vue +0 -5
  80. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +0 -2
  81. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +0 -2
  82. package/dist/runtime/domains/auto-form/components/Field.vue +9 -2
  83. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +0 -2
  84. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +0 -2
  85. package/dist/runtime/domains/auto-form/components/Layout.vue +3 -6
  86. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +0 -2
  87. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +0 -2
  88. package/dist/runtime/domains/auto-form/components/Nested.vue +5 -9
  89. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +0 -2
  90. package/dist/runtime/domains/auto-form/controls.d.ts +5 -572
  91. package/dist/runtime/domains/auto-form/controls.js +7 -20
  92. package/dist/runtime/domains/auto-form/fields.d.ts +21 -4
  93. package/dist/runtime/domains/auto-form/fields.js +52 -40
  94. package/dist/runtime/domains/auto-form/provider.d.ts +15 -6
  95. package/dist/runtime/domains/auto-form/provider.js +24 -10
  96. package/dist/runtime/domains/auto-form/schema.d.ts +9 -4
  97. package/dist/runtime/domains/auto-form/schema.js +91 -50
  98. package/dist/runtime/domains/auto-form/search-query.d.ts +10 -0
  99. package/dist/runtime/domains/auto-form/search-query.js +57 -0
  100. package/dist/runtime/domains/auto-form/useAutoFormCore.d.ts +62 -0
  101. package/dist/runtime/domains/auto-form/useAutoFormCore.js +108 -0
  102. package/dist/runtime/domains/auto-form/useSearchQuerySync.d.ts +11 -0
  103. package/dist/runtime/domains/auto-form/useSearchQuerySync.js +64 -0
  104. package/dist/runtime/domains/data-table/columns/constants.d.ts +2 -0
  105. package/dist/runtime/domains/data-table/columns/constants.js +1 -1
  106. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +2 -1
  107. package/dist/runtime/domains/data-table/columns/resolve-columns.js +3 -2
  108. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +7 -2
  109. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +10 -5
  110. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +14 -8
  111. package/dist/runtime/domains/data-table/components/ColumnSettings.d.vue.ts +20 -0
  112. package/dist/runtime/domains/data-table/components/ColumnSettings.vue +63 -0
  113. package/dist/runtime/domains/data-table/components/ColumnSettings.vue.d.ts +20 -0
  114. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +2 -8
  115. package/dist/runtime/domains/data-table/components/Pagination.vue +34 -36
  116. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +2 -8
  117. package/dist/runtime/domains/data-table/export.d.ts +23 -0
  118. package/dist/runtime/domains/data-table/export.js +43 -0
  119. package/dist/runtime/domains/data-table/load-more.d.ts +8 -0
  120. package/dist/runtime/domains/data-table/load-more.js +14 -0
  121. package/dist/runtime/domains/data-table/pagination.d.ts +29 -0
  122. package/dist/runtime/domains/data-table/pagination.js +42 -0
  123. package/dist/runtime/domains/data-table/persist.d.ts +12 -0
  124. package/dist/runtime/domains/data-table/persist.js +41 -0
  125. package/dist/runtime/domains/data-table/state/keys.d.ts +11 -0
  126. package/dist/runtime/domains/data-table/state/keys.js +44 -0
  127. package/dist/runtime/domains/data-table/state/models.d.ts +5 -0
  128. package/dist/runtime/domains/data-table/state/models.js +38 -0
  129. package/dist/runtime/domains/data-table/tree-layout.d.ts +13 -0
  130. package/dist/runtime/domains/data-table/tree-layout.js +30 -0
  131. package/dist/runtime/domains/theme/theme-color.d.ts +3 -0
  132. package/dist/runtime/domains/theme/theme-color.js +16 -0
  133. package/dist/runtime/domains/theme/theme-fouc.d.ts +5 -0
  134. package/dist/runtime/domains/theme/theme-fouc.js +43 -0
  135. package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +7 -5
  136. package/dist/runtime/domains/tree/components/TreeToolbar.vue +6 -4
  137. package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +7 -5
  138. package/dist/runtime/domains/tree/tree-disabled.d.ts +5 -0
  139. package/dist/runtime/domains/tree/tree-disabled.js +15 -0
  140. package/dist/runtime/domains/tree/tree-lazy.d.ts +8 -0
  141. package/dist/runtime/domains/tree/tree-lazy.js +19 -1
  142. package/dist/runtime/domains/tree/tree-search.d.ts +3 -1
  143. package/dist/runtime/domains/tree/tree-search.js +4 -0
  144. package/dist/runtime/domains/tree/useTreeLazy.d.ts +22 -0
  145. package/dist/runtime/domains/tree/useTreeLazy.js +57 -0
  146. package/dist/runtime/domains/tree/useTreeSearch.d.ts +27 -0
  147. package/dist/runtime/domains/tree/useTreeSearch.js +59 -0
  148. package/dist/runtime/domains/tree/useTreeSelection.d.ts +31 -0
  149. package/dist/runtime/domains/tree/useTreeSelection.js +89 -0
  150. package/dist/runtime/domains/zod/apply.d.ts +23 -0
  151. package/dist/runtime/domains/zod/apply.js +26 -0
  152. package/dist/runtime/domains/zod/error-map.d.ts +13 -0
  153. package/dist/runtime/domains/zod/error-map.js +19 -0
  154. package/dist/runtime/domains/zod/locale-map.d.ts +5 -0
  155. package/dist/runtime/domains/zod/locale-map.js +17 -0
  156. package/dist/runtime/domains/zod/sync.d.ts +12 -0
  157. package/dist/runtime/domains/zod/sync.js +30 -0
  158. package/dist/runtime/locale/en.d.ts +74 -0
  159. package/dist/runtime/locale/en.js +73 -0
  160. package/dist/runtime/locale/index.d.ts +8 -0
  161. package/dist/runtime/locale/index.js +15 -0
  162. package/dist/runtime/locale/zh_cn.d.ts +74 -0
  163. package/dist/runtime/locale/zh_cn.js +73 -0
  164. package/dist/runtime/plugins/api.factory.js +5 -22
  165. package/dist/runtime/plugins/theme.js +4 -42
  166. package/dist/runtime/plugins/zod.d.ts +2 -0
  167. package/dist/runtime/plugins/zod.js +16 -0
  168. package/dist/runtime/types/api/config.d.ts +12 -0
  169. package/dist/runtime/types/api/fetch.d.ts +3 -16
  170. package/dist/runtime/types/api/index.d.ts +1 -1
  171. package/dist/runtime/types/api/response.d.ts +33 -19
  172. package/dist/runtime/types/api/stream.d.ts +2 -3
  173. package/dist/runtime/types/api/transfer.d.ts +3 -7
  174. package/dist/runtime/types/auto-form/base.d.ts +9 -1
  175. package/dist/runtime/types/auto-form/component.d.ts +31 -3
  176. package/dist/runtime/types/auto-form/fields.d.ts +15 -1
  177. package/dist/runtime/types/auto-form/index.d.ts +3 -3
  178. package/dist/runtime/types/auto-form/search-form.d.ts +26 -12
  179. package/dist/runtime/types/auto-form/zod-factory.d.ts +2 -2
  180. package/dist/runtime/types/components/date-picker.d.ts +14 -3
  181. package/dist/runtime/types/components/index.d.ts +1 -6
  182. package/dist/runtime/types/components/message-box.d.ts +5 -18
  183. package/dist/runtime/types/components/tree.d.ts +17 -14
  184. package/dist/runtime/types/data-table/columns.d.ts +6 -14
  185. package/dist/runtime/types/data-table/component.d.ts +42 -1
  186. package/dist/runtime/types/data-table/index.d.ts +1 -1
  187. package/dist/runtime/types/data-table/pagination.d.ts +7 -8
  188. package/dist/runtime/types/index.d.ts +2 -0
  189. package/dist/runtime/types/locale.d.ts +82 -0
  190. package/dist/runtime/types/shared.d.ts +13 -0
  191. package/dist/runtime/types/zod-config.d.ts +38 -0
  192. package/dist/runtime/types/zod.d.ts +9 -1
  193. package/dist/runtime/utils/date/convert.d.ts +29 -0
  194. package/dist/runtime/utils/date/convert.js +93 -0
  195. package/dist/runtime/utils/date/guards.d.ts +10 -0
  196. package/dist/runtime/utils/date/guards.js +18 -0
  197. package/dist/runtime/utils/extend-theme.js +2 -1
  198. package/dist/runtime/utils/form-control.d.ts +0 -12
  199. package/dist/runtime/utils/form-control.js +3 -39
  200. package/dist/runtime/utils/interpolate.d.ts +2 -0
  201. package/dist/runtime/utils/interpolate.js +4 -0
  202. package/dist/runtime/utils/theme-defaults.d.ts +10 -0
  203. package/dist/runtime/utils/theme-defaults.js +9 -0
  204. package/dist/runtime/utils/tree-selection.d.ts +2 -15
  205. package/dist/runtime/utils/tv.d.ts +1 -1
  206. package/dist/runtime/vue/plugins/zod.d.ts +7 -0
  207. package/dist/runtime/vue/plugins/zod.js +12 -0
  208. package/dist/shared/{nuxt.DfVF6ZZv.mjs → nuxt.CbmfnBRt.mjs} +82 -236
  209. package/dist/unplugin.d.mts +3 -2
  210. package/dist/unplugin.mjs +22 -22
  211. package/dist/vite.d.mts +1 -0
  212. package/dist/vite.mjs +2 -1
  213. package/package.json +39 -34
  214. package/vue-plugin.d.ts +7 -1
  215. package/dist/runtime/components/ColorChooser.d.vue.ts +0 -36
  216. package/dist/runtime/components/ColorChooser.vue +0 -328
  217. package/dist/runtime/components/ColorChooser.vue.d.ts +0 -36
  218. package/dist/runtime/components/PillGroup.d.vue.ts +0 -33
  219. package/dist/runtime/components/PillGroup.vue +0 -291
  220. package/dist/runtime/components/PillGroup.vue.d.ts +0 -33
  221. package/dist/runtime/components/Popconfirm.d.vue.ts +0 -30
  222. package/dist/runtime/components/Popconfirm.vue +0 -143
  223. package/dist/runtime/components/Popconfirm.vue.d.ts +0 -30
  224. package/dist/runtime/components/SlideVerify.d.vue.ts +0 -41
  225. package/dist/runtime/components/SlideVerify.vue +0 -174
  226. package/dist/runtime/components/SlideVerify.vue.d.ts +0 -41
  227. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +0 -32
  228. package/dist/runtime/components/input/AsPhoneNumberInput.vue +0 -48
  229. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +0 -32
  230. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +0 -32
  231. package/dist/runtime/components/input/WithCharacterLimit.vue +0 -54
  232. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +0 -32
  233. package/dist/runtime/components/input/WithClear.d.vue.ts +0 -33
  234. package/dist/runtime/components/input/WithClear.vue +0 -60
  235. package/dist/runtime/components/input/WithClear.vue.d.ts +0 -33
  236. package/dist/runtime/components/input/WithCopy.d.vue.ts +0 -33
  237. package/dist/runtime/components/input/WithCopy.vue +0 -66
  238. package/dist/runtime/components/input/WithCopy.vue.d.ts +0 -33
  239. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +0 -33
  240. package/dist/runtime/components/input/WithFloatingLabel.vue +0 -75
  241. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +0 -33
  242. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +0 -32
  243. package/dist/runtime/components/input/WithPasswordToggle.vue +0 -61
  244. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +0 -32
  245. package/dist/runtime/domains/api/interceptors/compose.d.ts +0 -24
  246. package/dist/runtime/domains/api/interceptors/compose.js +0 -18
  247. package/dist/runtime/domains/api/interceptors/error.d.ts +0 -13
  248. package/dist/runtime/domains/api/interceptors/error.js +0 -26
  249. package/dist/runtime/domains/api/interceptors/unauthorized.d.ts +0 -12
  250. package/dist/runtime/domains/api/interceptors/unauthorized.js +0 -34
  251. package/dist/runtime/domains/api/transfer.d.ts +0 -69
  252. package/dist/runtime/domains/api/transfer.js +0 -87
  253. package/dist/runtime/types/components/color-chooser.d.ts +0 -109
  254. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +0 -17
  255. package/dist/runtime/types/components/input/index.d.ts +0 -6
  256. package/dist/runtime/types/components/input/index.js +0 -0
  257. package/dist/runtime/types/components/input/with-character-limit.d.ts +0 -11
  258. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  259. package/dist/runtime/types/components/input/with-clear.d.ts +0 -10
  260. package/dist/runtime/types/components/input/with-clear.js +0 -0
  261. package/dist/runtime/types/components/input/with-copy.d.ts +0 -11
  262. package/dist/runtime/types/components/input/with-copy.js +0 -0
  263. package/dist/runtime/types/components/input/with-floating-label.d.ts +0 -12
  264. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  265. package/dist/runtime/types/components/input/with-password-toggle.d.ts +0 -7
  266. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  267. package/dist/runtime/types/components/pill-group.d.ts +0 -103
  268. package/dist/runtime/types/components/pill-group.js +0 -0
  269. package/dist/runtime/types/components/popconfirm.d.ts +0 -74
  270. package/dist/runtime/types/components/popconfirm.js +0 -0
  271. package/dist/runtime/types/components/slide-verify.d.ts +0 -54
  272. package/dist/runtime/types/components/slide-verify.js +0 -0
  273. /package/dist/runtime/types/{components/color-chooser.js → locale.js} +0 -0
  274. /package/dist/runtime/types/{components/input/as-phone-number-input.js → zod-config.js} +0 -0
@@ -1,73 +1,13 @@
1
1
  import 'node:url';
2
2
  import { kebabCase } from 'scule';
3
- import { addTypeTemplate, addTemplate, hasNuxtModule, getLayerDirectories } from '@nuxt/kit';
3
+ import { addTypeTemplate, addTemplate, hasNuxtModule, useLogger, getLayerDirectories } from '@nuxt/kit';
4
4
  import { resolveFontSource, resolveFontFamily } from '../../dist/runtime/domains/theme/theme-font.js';
5
+ import { resolveZodLocale } from '../../dist/runtime/domains/zod/locale-map.js';
5
6
  import { readFileSync } from 'node:fs';
6
7
  import { createRequire } from 'node:module';
7
8
  import { join } from 'pathe';
8
9
  import { globSync } from 'tinyglobby';
9
10
 
10
- const popconfirm = () => ({
11
- slots: {
12
- content: "px-4 py-3 flex flex-col gap-2",
13
- arrow: "",
14
- header: "flex flex-col gap-1.5",
15
- title: "flex gap-2 items-center text-sm text-highlighted font-semibold",
16
- description: "text-muted text-xs",
17
- body: "",
18
- footer: "mt-1 flex items-center justify-end gap-1.5",
19
- icon: "size-4 shrink-0"
20
- },
21
- variants: {
22
- type: {
23
- primary: { icon: "text-primary" },
24
- info: { icon: "text-info" },
25
- success: { icon: "text-success" },
26
- warning: { icon: "text-warning" },
27
- error: { icon: "text-error" },
28
- neutral: { icon: "text-muted" }
29
- }
30
- }
31
- });
32
-
33
- const colorChooser = () => ({
34
- slots: {
35
- body: "p-2 flex flex-col gap-2 min-w-[14rem]",
36
- header: "flex items-center justify-between gap-2",
37
- section: "flex flex-col gap-1.5",
38
- swatches: "grid grid-cols-8 gap-1",
39
- swatch: "rounded ring-1 ring-default cursor-pointer transition hover:scale-110 hover:ring-2 hover:ring-primary aria-selected:ring-2 aria-selected:ring-primary",
40
- actions: "mt-1 flex items-center justify-between gap-1.5 border-t border-default pt-2",
41
- actionsValue: "text-xs text-muted tabular-nums truncate",
42
- actionsButtons: "flex items-center gap-1",
43
- triggerChipWrapper: "",
44
- triggerChip: "rounded-full ring-1 ring-default shrink-0 transition",
45
- triggerLabel: "tabular-nums truncate",
46
- triggerIcon: "text-muted shrink-0"
47
- },
48
- variants: {
49
- size: {
50
- xs: { triggerChip: "size-2.5", swatch: "size-4", triggerIcon: "size-3" },
51
- sm: { triggerChip: "size-3", swatch: "size-4", triggerIcon: "size-3.5" },
52
- md: { triggerChip: "size-3.5", swatch: "size-5", triggerIcon: "size-4" },
53
- lg: { triggerChip: "size-4", swatch: "size-5", triggerIcon: "size-4" },
54
- xl: { triggerChip: "size-5", swatch: "size-6", triggerIcon: "size-5" }
55
- },
56
- trigger: {
57
- button: {},
58
- chip: {},
59
- input: {}
60
- },
61
- disabled: {
62
- true: { body: "opacity-60 pointer-events-none" }
63
- }
64
- },
65
- defaultVariants: {
66
- size: "md",
67
- trigger: "button"
68
- }
69
- });
70
-
71
11
  const datePicker = () => ({
72
12
  slots: {
73
13
  wrapper: "flex",
@@ -99,86 +39,6 @@ const dataTablePagination = () => ({
99
39
  }
100
40
  });
101
41
 
102
- const asPhoneNumberInput = () => ({
103
- slots: {
104
- base: "",
105
- leading: "",
106
- dialCode: ""
107
- },
108
- variants: {
109
- dialCode: {
110
- true: {
111
- base: "ps-(--dial-code-length)",
112
- leading: "pointer-events-none text-muted"
113
- }
114
- }
115
- }
116
- });
117
-
118
- const withClear = () => ({
119
- slots: {
120
- trailing: "pe-1"
121
- }
122
- });
123
-
124
- const withCopy = () => ({
125
- slots: {
126
- trailing: "pe-1"
127
- }
128
- });
129
-
130
- const withFloatingLabel = () => ({
131
- slots: {
132
- base: "peer",
133
- trailing: "pe-1",
134
- label: [
135
- "pointer-events-none absolute -top-2.5 px-1.5 transition-all",
136
- "text-highlighted text-xs font-medium",
137
- "peer-focus:-top-2.5 peer-focus:text-highlighted peer-focus:text-xs peer-focus:font-medium",
138
- "peer-placeholder-shown:text-dimmed peer-placeholder-shown:font-normal",
139
- "peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:translate-y-0"
140
- ].join(" "),
141
- labelText: "inline-flex bg-default px-1"
142
- },
143
- variants: {
144
- size: {
145
- xs: { label: "peer-placeholder-shown:text-xs" },
146
- sm: { label: "peer-placeholder-shown:text-xs" },
147
- md: { label: "peer-placeholder-shown:text-sm" },
148
- lg: { label: "peer-placeholder-shown:text-sm" },
149
- xl: { label: "peer-placeholder-shown:text-base" }
150
- },
151
- hasLeading: {
152
- true: {},
153
- false: { label: "left-0" }
154
- }
155
- },
156
- compoundVariants: [
157
- { size: "xs", hasLeading: true, class: { label: "left-5" } },
158
- { size: "sm", hasLeading: true, class: { label: "left-6" } },
159
- { size: "md", hasLeading: true, class: { label: "left-7" } },
160
- { size: "lg", hasLeading: true, class: { label: "left-8" } },
161
- { size: "xl", hasLeading: true, class: { label: "left-9" } }
162
- ],
163
- defaultVariants: {
164
- size: "md",
165
- hasLeading: false
166
- }
167
- });
168
-
169
- const withPasswordToggle = () => ({
170
- slots: {
171
- trailing: "pe-1"
172
- }
173
- });
174
-
175
- const withCharacterLimit = () => ({
176
- slots: {
177
- trailing: "pointer-events-none",
178
- counter: "text-xs text-muted tabular-nums"
179
- }
180
- });
181
-
182
42
  const messageBox = () => ({
183
43
  slots: {
184
44
  title: "flex gap-2 items-center",
@@ -216,6 +76,9 @@ const BS = "var(--m-dt-border-style,solid)";
216
76
  const dataTable = () => ({
217
77
  slots: {
218
78
  wrapper: "flex flex-col min-h-0 relative",
79
+ toolbar: "flex items-center justify-end gap-2 pb-2",
80
+ skeleton: "flex flex-col gap-2 py-1",
81
+ skeletonRow: "h-4 w-full",
219
82
  base: "border-separate border-spacing-0",
220
83
  tbody: "divide-y-0",
221
84
  th: [
@@ -304,52 +167,6 @@ const themePicker = () => ({
304
167
  }
305
168
  });
306
169
 
307
- const slideVerify = () => ({
308
- slots: {
309
- root: "w-full relative flex items-center select-none overflow-hidden rounded-md border transition-colors duration-300",
310
- track: "absolute inset-0",
311
- fill: "absolute inset-y-0 left-0 bg-primary/20 opacity-60",
312
- text: "absolute inset-0 flex items-center justify-center font-medium pointer-events-none",
313
- slider: "relative z-10 flex shrink-0 touch-none items-center justify-center rounded-md shadow-sm transition-colors",
314
- icon: "shrink-0"
315
- },
316
- variants: {
317
- size: {
318
- xs: { root: "p-1", text: "text-xs", slider: "px-2 py-1", icon: "size-4" },
319
- sm: { root: "p-1.5", text: "text-xs", slider: "px-2.5 py-1.5", icon: "size-4" },
320
- md: { root: "p-1.5", text: "text-sm", slider: "px-2.5 py-1.5", icon: "size-5" },
321
- lg: { root: "p-2", text: "text-sm", slider: "px-3 py-2", icon: "size-5" },
322
- xl: { root: "p-2", text: "text-base", slider: "px-3 py-2", icon: "size-6" }
323
- },
324
- disabled: {
325
- true: { root: "opacity-50 cursor-not-allowed" }
326
- },
327
- verified: {
328
- true: {
329
- root: "bg-success border-transparent",
330
- slider: "bg-white/90",
331
- icon: "text-success"
332
- },
333
- false: {
334
- root: "bg-elevated border-default",
335
- slider: "bg-default cursor-grab active:cursor-grabbing ring-1 ring-default",
336
- icon: "text-primary"
337
- }
338
- },
339
- fieldGroup: {
340
- horizontal: {
341
- root: "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]"
342
- },
343
- vertical: {
344
- root: "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"
345
- }
346
- }
347
- },
348
- defaultVariants: {
349
- size: "md"
350
- }
351
- });
352
-
353
170
  const searchForm = () => ({
354
171
  slots: {
355
172
  root: "group/search",
@@ -377,37 +194,6 @@ const autoForm = () => ({
377
194
  }
378
195
  });
379
196
 
380
- const pillGroup = () => ({
381
- slots: {
382
- root: "flex items-center gap-2",
383
- list: "relative flex group rounded-lg gap-1",
384
- item: "inline-flex items-center gap-1.5",
385
- leading: "inline-flex items-center shrink-0",
386
- leadingIcon: "shrink-0",
387
- trailing: "inline-flex items-center shrink-0",
388
- trailingIcon: "shrink-0",
389
- itemWrapper: "flex flex-col items-start min-w-0 gap-0.5",
390
- itemLabel: "truncate",
391
- itemDescription: "truncate text-xs"
392
- },
393
- variants: {
394
- orientation: {
395
- horizontal: { root: "flex-col", list: "w-full" },
396
- vertical: { list: "flex-col" }
397
- },
398
- fieldGroup: {
399
- horizontal: {
400
- root: "rounded-md overflow-hidden not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-within:z-[1]",
401
- list: "rounded-md"
402
- },
403
- vertical: {
404
- root: "rounded-md overflow-hidden not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-within:z-[1]",
405
- list: "rounded-md"
406
- }
407
- }
408
- }
409
- });
410
-
411
197
  const tree = () => ({
412
198
  slots: {
413
199
  container: "flex flex-col gap-2 min-h-0",
@@ -424,24 +210,14 @@ const tree = () => ({
424
210
 
425
211
  const theme = {
426
212
  __proto__: null,
427
- asPhoneNumberInput: asPhoneNumberInput,
428
213
  autoForm: autoForm,
429
- colorChooser: colorChooser,
430
214
  dataTable: dataTable,
431
215
  dataTablePagination: dataTablePagination,
432
216
  datePicker: datePicker,
433
217
  messageBox: messageBox,
434
- pillGroup: pillGroup,
435
- popconfirm: popconfirm,
436
218
  searchForm: searchForm,
437
- slideVerify: slideVerify,
438
219
  themePicker: themePicker,
439
- tree: tree,
440
- withCharacterLimit: withCharacterLimit,
441
- withClear: withClear,
442
- withCopy: withCopy,
443
- withFloatingLabel: withFloatingLabel,
444
- withPasswordToggle: withPasswordToggle
220
+ tree: tree
445
221
  };
446
222
 
447
223
  function prefixClasses(classString, prefix) {
@@ -493,7 +269,51 @@ function applyDefaultVariants(result, defaultVariants) {
493
269
  return result;
494
270
  }
495
271
 
496
- function getTemplates(options, nuxt) {
272
+ function resolveRequiredInputs(required) {
273
+ if (required === false) return false;
274
+ if (typeof required === "object") return required.inputs ?? [void 0];
275
+ return [void 0];
276
+ }
277
+ function resolveZodOptions(zod, available) {
278
+ const fallback = zod.fallback ?? "en";
279
+ const localeMap = zod.localeMap ?? {};
280
+ const codes = zod.locale === "auto" ? [...zod.locales ?? [], fallback] : [zod.locale, fallback];
281
+ const resolved = codes.map((code) => ({ code, name: resolveZodLocale(code, available, localeMap) }));
282
+ return {
283
+ options: {
284
+ locale: zod.locale,
285
+ fallback,
286
+ localeMap,
287
+ requiredInputs: resolveRequiredInputs(zod.required),
288
+ label: zod.label ?? true,
289
+ jitless: zod.jitless ?? false
290
+ },
291
+ imports: [...new Set(resolved.map((item) => item.name).filter((name) => !!name))],
292
+ unresolved: resolved.filter((item) => !item.name).map((item) => item.code)
293
+ };
294
+ }
295
+ function serializeOptions(options) {
296
+ const { requiredInputs, ...rest } = options;
297
+ const inputs = requiredInputs === false ? "false" : `[${requiredInputs.map((value) => value === void 0 ? "undefined" : JSON.stringify(value)).join(", ")}]`;
298
+ return JSON.stringify(rest, null, 2).replace(/\n\}$/, `,
299
+ "requiredInputs": ${inputs}
300
+ }`);
301
+ }
302
+ function generateZodTemplate(setup) {
303
+ if (!setup) {
304
+ return "export const zodLocales = {}\nexport const zodOptions = undefined\n";
305
+ }
306
+ const names = setup.imports.join(", ");
307
+ return [
308
+ `import { ${names} } from 'zod/locales'`,
309
+ "",
310
+ `export const zodLocales = { ${names} }`,
311
+ `export const zodOptions = ${serializeOptions(setup.options)}`,
312
+ ""
313
+ ].join("\n");
314
+ }
315
+
316
+ function getTemplates(options, nuxt, supportsSearchQuery = true) {
497
317
  const templates = [];
498
318
  function writeThemeTemplate(theme2, path) {
499
319
  for (const component in theme2) {
@@ -574,7 +394,7 @@ function getTemplates(options, nuxt) {
574
394
  return `import * as movkUi from '#build/movk-ui'
575
395
  import type { TVConfig, Direction } from '@nuxt/ui'
576
396
  import type { defaultConfig } from 'tailwind-variants'
577
- import type { MovkApiPublicConfig, ApiInstance, ModuleOptions } from '@movk/nuxt'
397
+ import type { MovkApiPublicConfig, ApiError, ApiInstance, ModuleOptions, MovkZodRuntimeConfig } from '@movk/nuxt'
578
398
  import type { HookResult } from '@nuxt/schema'
579
399
  import type { FetchContext } from 'ofetch'
580
400
 
@@ -602,8 +422,9 @@ declare module 'nuxt/app' {
602
422
  interface RuntimeNuxtHooks {
603
423
  'movk:api:request': (context: FetchContext) => HookResult
604
424
  'movk:api:response': (context: FetchContext) => HookResult
605
- 'movk:api:error': (context: FetchContext) => HookResult
425
+ 'movk:api:error': (context: FetchContext, error: ApiError) => HookResult
606
426
  'movk:api:unauthorized': (context: FetchContext, result: { handled: boolean }) => HookResult
427
+ 'movk:zod:config': (config: MovkZodRuntimeConfig) => HookResult
607
428
  }
608
429
  }
609
430
 
@@ -653,6 +474,25 @@ export const useUserSession: (() => unknown) | undefined = _useUserSession
653
474
  ` : `export const useUserSession: (() => unknown) | undefined = undefined
654
475
  `
655
476
  });
477
+ templates.push({
478
+ filename: "movk-router.ts",
479
+ write: true,
480
+ getContents: () => `export const supportsSearchQuery = ${supportsSearchQuery}
481
+ `
482
+ });
483
+ templates.push({
484
+ filename: "movk-zod.ts",
485
+ write: true,
486
+ getContents: async () => {
487
+ if (!options.zod) return generateZodTemplate(void 0);
488
+ const available = Object.keys(await import('zod/locales'));
489
+ const setup = resolveZodOptions(options.zod, available);
490
+ if (setup.unresolved.length) {
491
+ useLogger("movk").warn(`No zod locale matches: ${setup.unresolved.join(", ")}. Falling back to "${setup.options.fallback}".`);
492
+ }
493
+ return generateZodTemplate(setup);
494
+ }
495
+ });
656
496
  templates.push({
657
497
  filename: "types/movk-api-endpoints.d.ts",
658
498
  getContents: () => {
@@ -763,7 +603,6 @@ const UI_COMPONENTS = [
763
603
  "USelect",
764
604
  "UPopover",
765
605
  "UCalendar",
766
- "UColorPicker",
767
606
  "UTable",
768
607
  "UFormField",
769
608
  "UTooltip",
@@ -781,7 +620,14 @@ const UI_COMPONENTS = [
781
620
  "UInputDate",
782
621
  "UInputTime",
783
622
  "UListbox",
784
- "UTree"
623
+ "UTree",
624
+ "USkeleton",
625
+ "UToggle",
626
+ "UToggleGroup"
785
627
  ];
628
+ function includeMovkUiComponents(detection) {
629
+ const components = UI_COMPONENTS.map((name) => name.slice(1));
630
+ return detection === true ? components : [.../* @__PURE__ */ new Set([...detection, ...components])];
631
+ }
786
632
 
787
- export { UI_COMPONENTS as U, addTemplates as a, formatMissingCollections as f, getTemplates as g, resolveMovkIcons as r };
633
+ export { UI_COMPONENTS as U, addTemplates as a, formatMissingCollections as f, getTemplates as g, includeMovkUiComponents as i, resolveMovkIcons as r };
@@ -2,15 +2,16 @@ import * as unplugin from 'unplugin';
2
2
  import { NuxtUIOptions } from '@nuxt/ui/unplugin';
3
3
  import { ModuleOptions } from './module.mjs';
4
4
  import '../dist/runtime/types/api/module.js';
5
+ import '../dist/runtime/types/zod-config.js';
5
6
  import '../dist/runtime/domains/theme/theme-font.js';
6
7
  import '@nuxt/ui';
7
8
  import 'nuxt/schema';
8
9
  import '../dist/runtime/types/index.js';
9
10
 
10
11
  /** movk 组件层从 `#components` 具名导入的 @nuxt/ui 组件(去 U 前缀映射到 @nuxt/ui/components/<Name>.vue) */
11
- declare const UI_COMPONENTS: readonly ["UAccordion", "UButton", "UBadge", "UCheckbox", "UCollapsible", "UForm", "UDropdownMenu", "UIcon", "UInput", "UModal", "UPagination", "USelect", "UPopover", "UCalendar", "UColorPicker", "UTable", "UFormField", "UTooltip", "UInputNumber", "USwitch", "UTextarea", "USlider", "UPinInput", "UInputTags", "UFileUpload", "USelectMenu", "UInputMenu", "UCheckboxGroup", "URadioGroup", "UInputDate", "UInputTime", "UListbox", "UTree"];
12
+ declare const UI_COMPONENTS: readonly ["UAccordion", "UButton", "UBadge", "UCheckbox", "UCollapsible", "UForm", "UDropdownMenu", "UIcon", "UInput", "UModal", "UPagination", "USelect", "UPopover", "UCalendar", "UTable", "UFormField", "UTooltip", "UInputNumber", "USwitch", "UTextarea", "USlider", "UPinInput", "UInputTags", "UFileUpload", "USelectMenu", "UInputMenu", "UCheckboxGroup", "URadioGroup", "UInputDate", "UInputTime", "UListbox", "UTree", "USkeleton", "UToggle", "UToggleGroup"];
12
13
 
13
- interface MovkUIOptions extends Pick<ModuleOptions, 'prefix' | 'theme' | 'icon'> {
14
+ interface MovkUIOptions extends Pick<ModuleOptions, 'prefix' | 'theme' | 'icon' | 'zod'> {
14
15
  /** 站点信息,注入 app.config.movkSite;name 作为主题 localStorage key 前缀 */
15
16
  site?: {
16
17
  url?: string;
package/dist/unplugin.mjs CHANGED
@@ -8,12 +8,13 @@ import MagicString from 'magic-string';
8
8
  import { resolvePathSync } from 'mlly';
9
9
  import fs from 'node:fs';
10
10
  import path from 'node:path';
11
- import { U as UI_COMPONENTS, g as getTemplates, r as resolveMovkIcons, f as formatMissingCollections } from './shared/nuxt.DfVF6ZZv.mjs';
11
+ import { U as UI_COMPONENTS, g as getTemplates, i as includeMovkUiComponents, r as resolveMovkIcons, f as formatMissingCollections } from './shared/nuxt.CbmfnBRt.mjs';
12
12
  import { kebabCase } from 'scule';
13
- import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
13
+ import { getDefaultConfig, UI_COLOR_DEFAULTS } from '../dist/runtime/utils/theme-defaults.js';
14
14
  import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
15
15
  import { resolveFontSource, resolveFontLinks, resolveFontWarning } from '../dist/runtime/domains/theme/theme-font.js';
16
16
  import '@nuxt/kit';
17
+ import '../dist/runtime/domains/zod/locale-map.js';
17
18
  import 'node:module';
18
19
 
19
20
  function resolveRouterMode(options) {
@@ -46,10 +47,6 @@ function MovkEnvironmentPlugin(options) {
46
47
  extensions: [".ts", ".mjs", ".js"],
47
48
  url: import.meta.url
48
49
  });
49
- const messageBoxPath = resolvePathSync("../runtime/components/MessageBox", {
50
- extensions: [".vue"],
51
- url: import.meta.url
52
- });
53
50
  const uiOverrides = buildUiOverrideMap(routerMode);
54
51
  return {
55
52
  name: "movk:environment",
@@ -73,11 +70,7 @@ function MovkEnvironmentPlugin(options) {
73
70
  const from = name === "UIcon" && iconOverride ? iconOverride : `@nuxt/ui/components/${name.slice(1)}.vue`;
74
71
  return `export { default as ${name} } from ${JSON.stringify(from)}`;
75
72
  });
76
- return [
77
- `import LazyMMessageBoxComponent from ${JSON.stringify(messageBoxPath)}`,
78
- ...reExports,
79
- `export const LazyMMessageBox = LazyMMessageBoxComponent`
80
- ].join("\n");
73
+ return reExports.join("\n");
81
74
  },
82
75
  transformInclude(id) {
83
76
  return normalize(id).includes(runtimeDir);
@@ -95,7 +88,8 @@ function MovkEnvironmentPlugin(options) {
95
88
  }
96
89
 
97
90
  function MovkTemplatePlugin(options) {
98
- const templates = getTemplates(options).filter((t) => t.write && t.filename);
91
+ const supportsSearchQuery = options.ui?.router !== false && options.ui?.router !== "inertia";
92
+ const templates = getTemplates(options, void 0, supportsSearchQuery).filter((t) => t.write && t.filename);
99
93
  const templateKeys = new Set(templates.map((t) => `#build/${t.filename}`));
100
94
  async function writeTemplates(root) {
101
95
  const map = {};
@@ -132,15 +126,6 @@ function MovkTemplatePlugin(options) {
132
126
  };
133
127
  }
134
128
 
135
- const UI_COLOR_DEFAULTS = {
136
- primary: "blue",
137
- secondary: "blue",
138
- success: "green",
139
- info: "blue",
140
- warning: "yellow",
141
- error: "red",
142
- neutral: "slate"
143
- };
144
129
  function MovkAppConfigPlugin(options) {
145
130
  const defuPath = resolvePathSync("defu", { url: import.meta.url });
146
131
  const movkDefault = JSON.stringify(getDefaultConfig(options.theme));
@@ -180,7 +165,12 @@ function MovkPluginsPlugin(options) {
180
165
  extensions: [".ts", ".mjs", ".js"],
181
166
  url: import.meta.url
182
167
  });
168
+ const zodPath = resolvePathSync("../runtime/vue/plugins/zod", {
169
+ extensions: [".ts", ".mjs", ".js"],
170
+ url: import.meta.url
171
+ });
183
172
  const themeEnabled = options.theme?.enabled !== false;
173
+ const zodEnabled = !!options.zod;
184
174
  return {
185
175
  name: "movk:plugins",
186
176
  enforce: "pre",
@@ -193,10 +183,12 @@ function MovkPluginsPlugin(options) {
193
183
  return [
194
184
  `import nuxtUIPlugin from '@nuxt/ui/vue-plugin'`,
195
185
  themeEnabled ? `import movkThemePlugin from ${JSON.stringify(themePath)}` : "",
186
+ zodEnabled ? `import movkZodPlugin from ${JSON.stringify(zodPath)}` : "",
196
187
  `export default {`,
197
188
  ` install(app, pluginOptions = {}) {`,
198
189
  ` app.use(nuxtUIPlugin, pluginOptions)`,
199
190
  themeEnabled ? ` app.use(movkThemePlugin)` : "",
191
+ zodEnabled ? ` app.use(movkZodPlugin, pluginOptions.zod)` : "",
200
192
  ` }`,
201
193
  `}`
202
194
  ].filter(Boolean).join("\n");
@@ -280,7 +272,8 @@ const MOVK_COMPOSABLES = {
280
272
  useAutoForm: ["useAutoForm", "defineControl", "DEFAULT_CONTROLS", "getAutoFormMetadata"],
281
273
  useTheme: ["useTheme"],
282
274
  useDateFormatter: ["useDateFormatter", "CalendarDate"],
283
- useMessageBox: ["useMessageBox"]
275
+ useMessageBox: ["useMessageBox"],
276
+ useMovkLocale: ["useMovkLocale", "extendMovkLocale"]
284
277
  };
285
278
  function resolveMovkClientBundleIcons(options) {
286
279
  if (options.icon?.clientBundle === false) return [];
@@ -332,6 +325,13 @@ const MovkPlugin = createUnplugin((_options = {}, meta) => {
332
325
  },
333
326
  ui
334
327
  );
328
+ const detection = uiOptions.experimental?.componentDetection;
329
+ if (detection) {
330
+ uiOptions.experimental = {
331
+ ...uiOptions.experimental,
332
+ componentDetection: includeMovkUiComponents(detection)
333
+ };
334
+ }
335
335
  const uiPlugins = NuxtUIPlugin.raw(uiOptions, meta);
336
336
  return [
337
337
  MovkEnvironmentPlugin(options),
package/dist/vite.d.mts CHANGED
@@ -3,6 +3,7 @@ import { MovkUIOptions } from './unplugin.mjs';
3
3
  import '@nuxt/ui/unplugin';
4
4
  import './module.mjs';
5
5
  import '../dist/runtime/types/api/module.js';
6
+ import '../dist/runtime/types/zod-config.js';
6
7
  import '../dist/runtime/domains/theme/theme-font.js';
7
8
  import '@nuxt/ui';
8
9
  import 'nuxt/schema';
package/dist/vite.mjs CHANGED
@@ -9,10 +9,11 @@ import 'magic-string';
9
9
  import 'mlly';
10
10
  import 'node:fs';
11
11
  import 'node:path';
12
- import './shared/nuxt.DfVF6ZZv.mjs';
12
+ import './shared/nuxt.CbmfnBRt.mjs';
13
13
  import 'scule';
14
14
  import '@nuxt/kit';
15
15
  import '../dist/runtime/domains/theme/theme-font.js';
16
+ import '../dist/runtime/domains/zod/locale-map.js';
16
17
  import 'node:module';
17
18
  import '../dist/runtime/utils/theme-defaults.js';
18
19
  import '../dist/runtime/utils/meta.js';