@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
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@movk/nuxt",
3
3
  "type": "module",
4
- "version": "1.8.3",
5
- "packageManager": "pnpm@12.11.2",
6
- "description": "An engineering suite built on Nuxt UI: schema-driven AutoForm (Zod v4), a full-featured DataTable, standalone UI components and composables. Get the full capabilities — including API integration with auth & progress — in Nuxt 4, and use its UI, forms, tables and theming in plain Vue + Vite via the Vite plugin.",
4
+ "version": "2.0.0-beta.1",
5
+ "packageManager": "pnpm@12.23.0",
6
+ "description": "An application toolkit for Nuxt and Vue with schema-driven forms, configurable data tables, reusable components, and composables. Nuxt mode also includes API integration.",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "homepage": "https://nuxt.mhaibaraai.cn",
14
14
  "engines": {
15
- "node": "^20.19.0 || >=22.12.0"
15
+ "node": "^22.22.3 || ^24.15.0 || >=26.0.0"
16
16
  },
17
17
  "bugs": {
18
18
  "url": "https://github.com/mhaibaraai/movk-nuxt/issues"
@@ -21,6 +21,9 @@
21
21
  "nuxt",
22
22
  "nuxt-module",
23
23
  "nuxt4",
24
+ "nuxt-ui",
25
+ "vue",
26
+ "vite",
24
27
  "zod",
25
28
  "form",
26
29
  "auto-form",
@@ -109,7 +112,7 @@
109
112
  "vue-plugin.d.ts"
110
113
  ],
111
114
  "peerDependencies": {
112
- "@nuxt/ui": ">=4.6.0",
115
+ "@nuxt/ui": ">=4.13.0",
113
116
  "ai": "^6 || ^7",
114
117
  "zod": ">=4.3.6"
115
118
  },
@@ -134,54 +137,56 @@
134
137
  "typecheck": "vue-tsc --noEmit && nuxt typecheck playgrounds/play && nuxt typecheck docs && cd playgrounds/vue && vue-tsc --noEmit",
135
138
  "clean": "movk-clean",
136
139
  "test": "vitest",
137
- "test:vue": "vitest --project vue"
140
+ "test:pack": "node scripts/test-pack.mjs",
141
+ "test:coverage": "vitest run --coverage"
138
142
  },
139
143
  "dependencies": {
140
144
  "@internationalized/date": "^3.12.4",
141
145
  "@movk/core": "^1.5.0",
142
- "@nuxt/image": "^2.1.0",
143
- "@nuxt/ui": "^4.11.3",
146
+ "@nuxt/image": "^2.2.1",
147
+ "@nuxt/kit": "^4.7.0",
148
+ "@nuxt/ui": "^4.13.1",
144
149
  "@tanstack/vue-table": "^8.21.3",
145
- "@vueuse/core": "^15.0.0",
146
- "@vueuse/nuxt": "^15.0.0",
147
- "colortranslator": "^6.1.1",
150
+ "@vueuse/core": "^15.1.0",
151
+ "@vueuse/nuxt": "^15.1.0",
148
152
  "defu": "^6.1.7",
149
- "eventsource-parser": "^4.1.1",
150
- "magic-string": "^1.4.3",
151
- "maska": "^3.2.2",
153
+ "eventsource-parser": "^4.1.3",
154
+ "magic-string": "^1.4.5",
152
155
  "mlly": "^1.8.2",
153
- "nuxt-auth-utils": "^0.5.31",
154
- "nuxt-site-config": "^4.2.3",
156
+ "nuxt-auth-utils": "^0.6.2",
157
+ "nuxt-site-config": "^5.1.0",
155
158
  "pathe": "^2.0.3",
156
- "reka-ui": "2.10.5",
159
+ "reka-ui": "2.11.0",
157
160
  "scule": "^1.3.0",
158
- "tailwind-variants": "^3.3.1",
159
- "tailwindcss": "^4.3.3",
161
+ "tailwind-variants": "^4.0.2",
162
+ "tailwindcss": "^4.3.5",
160
163
  "tinyglobby": "^0.2.17",
161
- "unplugin": "^3.4.0",
162
- "zod": "^4.6.5"
164
+ "unplugin": "^3.7.0",
165
+ "zod": "^4.6.7"
163
166
  },
164
167
  "devDependencies": {
165
- "@iconify-json/lucide": "^1.2.142",
168
+ "@iconify-json/lucide": "^1.2.159",
166
169
  "@iconify-json/ph": "^1.2.2",
167
- "@iconify-json/tabler": "^1.2.42",
170
+ "@iconify-json/tabler": "^1.2.47",
168
171
  "@nuxt/eslint-config": "^1.17.0",
169
- "@nuxt/kit": "^4.6.1",
170
- "@nuxt/module-builder": "^1.0.3",
171
- "@nuxt/schema": "^4.6.1",
172
+ "@nuxt/module-builder": "^1.0.4",
173
+ "@nuxt/schema": "^4.7.0",
174
+ "@nuxt/test-utils": "^4.4.0",
172
175
  "@release-it/conventional-changelog": "^12.0.2",
173
- "ai": "^7.0.137",
174
- "eslint": "^10.12.0",
175
- "happy-dom": "^20.14.6",
176
- "nuxt": "^4.6.1",
176
+ "@vitest/coverage-v8": "5.1.2",
177
+ "@vue/test-utils": "^2.6.0",
178
+ "ai": "^7.0.182",
179
+ "eslint": "^10.15.0",
180
+ "happy-dom": "^21.0.4",
181
+ "nuxt": "^4.7.0",
177
182
  "ofetch": "^1.5.1",
178
- "release-it": "^21.1.1",
183
+ "release-it": "^21.1.3",
179
184
  "typescript": "^6.0.3",
180
185
  "unbuild": "^3.6.1",
181
186
  "unplugin-auto-import": "^21.1.0",
182
187
  "unplugin-vue-components": "^32.1.0",
183
- "vitest": "^5.0.3",
184
- "vue": "^3.5.43",
185
- "vue-tsc": "^3.3.13"
188
+ "vitest": "5.1.2",
189
+ "vue": "^3.5.46",
190
+ "vue-tsc": "3.3.14"
186
191
  }
187
192
  }
package/vue-plugin.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import type { Plugin } from 'vue'
2
+ import type { MovkZodRuntimeConfig } from '@movk/nuxt'
2
3
 
3
- declare const plugin: Plugin
4
+ interface MovkVuePluginOptions extends Record<string, unknown> {
5
+ /** 仅在 Vite 插件开启 `zod` 时生效 */
6
+ zod?: MovkZodRuntimeConfig
7
+ }
8
+
9
+ declare const plugin: Plugin<[options?: MovkVuePluginOptions]>
4
10
 
5
11
  export default plugin
@@ -1,36 +0,0 @@
1
- import type { ComponentConfig } from '@nuxt/ui';
2
- import type { AppConfig } from 'nuxt/schema';
3
- import theme from '#build/movk-ui/color-chooser';
4
- import popoverTheme from '#build/ui/popover';
5
- import type { ColorChooserProps, ColorChooserSlots, ColorFormat } from '../types/components/color-chooser';
6
- declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<M> & {
8
- size?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["size"];
9
- trigger?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["trigger"];
10
- ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["slots"];
11
- } & {
12
- modelValue?: string;
13
- }) & {
14
- onClear?: (() => any) | undefined;
15
- onChange?: ((value: string | undefined) => any) | undefined;
16
- onCopy?: ((value: string) => any) | undefined;
17
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
18
- "onUpdate:open"?: ((open: boolean) => any) | undefined;
19
- "onFormat-change"?: ((format: ColorFormat) => any) | undefined;
20
- }> & (typeof globalThis extends {
21
- __VLS_PROPS_FALLBACK: infer P;
22
- } ? P : {});
23
- expose: (exposed: {}) => void;
24
- attrs: any;
25
- slots: ColorChooserSlots;
26
- emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
27
- }>) => import("vue").VNode & {
28
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
29
- };
30
- declare const _default: typeof __VLS_export;
31
- export default _default;
32
- type __VLS_PrettifyLocal<T> = (T extends any ? {
33
- [K in keyof T]: T[K];
34
- } : {
35
- [K in keyof T as K]: T[K];
36
- }) & {};
@@ -1,328 +0,0 @@
1
- <script setup>
2
- import { computed, ref, useAttrs, watch } from "vue";
3
- import { useClipboard } from "@vueuse/core";
4
- import { ColorTranslator } from "colortranslator";
5
- import { UPopover, UButton, UColorPicker, UIcon, UInput } from "#components";
6
- import { useAppConfig } from "#imports";
7
- import { useExtendedTv } from "../utils/extend-theme";
8
- import { useFieldControl } from "../utils/form-control";
9
- import theme from "#build/movk-ui/color-chooser";
10
- import popoverTheme from "#build/ui/popover";
11
- import PillGroup from "./PillGroup.vue";
12
- const props = defineProps({
13
- id: { type: String, required: false },
14
- name: { type: String, required: false },
15
- format: { type: String, required: false, default: "hex" },
16
- formats: { type: Array, required: false, default: () => ["hex"] },
17
- swatches: { type: Array, required: false },
18
- closeOnSwatch: { type: Boolean, required: false, default: true },
19
- clearable: { type: Boolean, required: false },
20
- copyable: { type: Boolean, required: false },
21
- trigger: { type: String, required: false, default: "button" },
22
- label: { type: String, required: false },
23
- placeholder: { type: String, required: false, default: "\u9009\u62E9\u989C\u8272" },
24
- size: { type: void 0, required: false },
25
- color: { type: null, required: false, default: "neutral" },
26
- variant: { type: null, required: false, default: "subtle" },
27
- disabled: { type: Boolean, required: false },
28
- highlight: { type: Boolean, required: false },
29
- icon: { type: null, required: false, default: "i-lucide-palette" },
30
- colorPickerProps: { type: Object, required: false },
31
- ui: { type: Object, required: false }
32
- });
33
- const modelValue = defineModel({ type: String });
34
- const emits = defineEmits(["update:modelValue", "update:open", "change", "clear", "copy", "format-change"]);
35
- const slots = defineSlots();
36
- defineOptions({ inheritAttrs: false });
37
- const attrs = useAttrs();
38
- const appConfig = useAppConfig();
39
- const {
40
- id,
41
- name,
42
- size: effectiveSize,
43
- color: effectiveColor,
44
- highlight,
45
- disabled: effectiveDisabled,
46
- ariaAttrs,
47
- emitFormBlur,
48
- emitFormChange,
49
- emitFormFocus,
50
- emitFormInput
51
- } = useFieldControl(props);
52
- const FORMAT_KEY = {
53
- hex: "HEX",
54
- rgb: "RGB",
55
- hsl: "HSL",
56
- cmyk: "CMYK",
57
- lab: "CIELab"
58
- };
59
- function convertColor(value, fmt) {
60
- if (!value) return value;
61
- try {
62
- const key = FORMAT_KEY[fmt];
63
- if (!key) return value;
64
- return new ColorTranslator(value)[key];
65
- } catch {
66
- return value;
67
- }
68
- }
69
- const openState = ref(false);
70
- const currentFormat = ref(props.formats?.[0] ?? props.format ?? "hex");
71
- const inputDraft = ref(modelValue.value ?? "");
72
- watch(modelValue, (val) => {
73
- inputDraft.value = val ?? "";
74
- });
75
- watch(() => props.format, (val) => {
76
- if (val) currentFormat.value = val;
77
- });
78
- const showFormatTabs = computed(() => (props.formats?.length ?? 0) >= 2);
79
- const formatItems = computed(
80
- () => (props.formats ?? []).map((f) => ({ label: f.toUpperCase(), value: f }))
81
- );
82
- const swatchRows = computed(() => {
83
- const sw = props.swatches;
84
- if (!sw || sw.length === 0) return [];
85
- return Array.isArray(sw[0]) ? sw : [sw];
86
- });
87
- const hasSwatches = computed(() => swatchRows.value.length > 0);
88
- const { baseUi, extraUi } = useExtendedTv(
89
- popoverTheme,
90
- theme,
91
- () => appConfig.movk?.colorChooser,
92
- () => ({
93
- ui: props.ui,
94
- variants: {
95
- size: effectiveSize.value,
96
- trigger: props.trigger,
97
- disabled: effectiveDisabled.value
98
- }
99
- })
100
- );
101
- const triggerButtonAttrs = computed(() => ({
102
- color: effectiveColor.value,
103
- variant: props.variant,
104
- size: effectiveSize.value,
105
- disabled: effectiveDisabled.value,
106
- square: props.trigger === "chip"
107
- }));
108
- const triggerLabel = computed(() => props.label ?? modelValue.value ?? props.placeholder);
109
- const colorPickerAttrs = computed(() => ({
110
- ...props.colorPickerProps ?? {},
111
- format: currentFormat.value,
112
- disabled: effectiveDisabled.value
113
- }));
114
- const { copy, isSupported: clipboardSupported } = useClipboard();
115
- function selectFormat(fmt) {
116
- if (fmt === currentFormat.value) return;
117
- currentFormat.value = fmt;
118
- const converted = convertColor(modelValue.value, fmt);
119
- if (converted !== modelValue.value) {
120
- commitValue(converted);
121
- }
122
- emits("format-change", fmt);
123
- }
124
- function selectSwatch(c) {
125
- commitValue(c);
126
- if (props.closeOnSwatch) openState.value = false;
127
- }
128
- function handleCopy() {
129
- const v = modelValue.value;
130
- if (!v) return;
131
- if (clipboardSupported.value) copy(v);
132
- emits("copy", v);
133
- }
134
- function handleClear() {
135
- commitValue(void 0);
136
- emits("clear");
137
- }
138
- function handlePickerUpdate(v) {
139
- commitValue(v);
140
- }
141
- function handleInputBlur() {
142
- emitFormBlur();
143
- const v = inputDraft.value.trim();
144
- if (!v) {
145
- commitValue(void 0);
146
- return;
147
- }
148
- const normalized = convertColor(v, currentFormat.value);
149
- const hexInvalid = currentFormat.value === "hex" && !/^#?(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(v);
150
- if (!normalized || normalized === v && hexInvalid) {
151
- inputDraft.value = modelValue.value ?? "";
152
- return;
153
- }
154
- commitValue(normalized);
155
- }
156
- function handleOpenUpdate(val) {
157
- if (val && effectiveDisabled.value) return;
158
- openState.value = val;
159
- emits("update:open", val);
160
- }
161
- function toggleOpen() {
162
- if (effectiveDisabled.value) return;
163
- handleOpenUpdate(!openState.value);
164
- }
165
- function handleInputFocus() {
166
- emitFormFocus();
167
- if (effectiveDisabled.value) return;
168
- if (!openState.value) handleOpenUpdate(true);
169
- }
170
- function commitValue(value) {
171
- modelValue.value = value;
172
- emits("change", value);
173
- emitFormInput();
174
- emitFormChange();
175
- }
176
- </script>
177
-
178
- <template>
179
- <UPopover v-bind="attrs" :open="openState" :ui="baseUi" @update:open="handleOpenUpdate">
180
- <template v-if="props.trigger !== 'input'" #default="{ open }">
181
- <slot :open="open" :value="modelValue">
182
- <UButton
183
- v-if="props.trigger === 'chip'"
184
- :id="id"
185
- :name="name"
186
- v-bind="{ ...triggerButtonAttrs, ...ariaAttrs }"
187
- :aria-label="modelValue || props.placeholder"
188
- @blur="emitFormBlur"
189
- @focus="emitFormFocus"
190
- >
191
- <span :class="extraUi.triggerChip" :style="{ backgroundColor: modelValue || 'transparent' }">
192
- <UIcon v-if="!modelValue" :name="props.icon" :class="extraUi.triggerIcon" />
193
- </span>
194
- </UButton>
195
-
196
- <UButton
197
- v-else
198
- :id="id"
199
- :name="name"
200
- v-bind="{ ...triggerButtonAttrs, ...ariaAttrs }"
201
- @blur="emitFormBlur"
202
- @focus="emitFormFocus"
203
- >
204
- <template #leading>
205
- <slot name="leading" :value="modelValue">
206
- <span v-if="modelValue" :class="extraUi.triggerChip" :style="{ backgroundColor: modelValue }" />
207
- <UIcon v-else :name="props.icon" />
208
- </slot>
209
- </template>
210
- <span :class="extraUi.triggerLabel">{{ triggerLabel }}</span>
211
- <template v-if="!!slots.trailing" #trailing>
212
- <slot name="trailing" :value="modelValue" />
213
- </template>
214
- </UButton>
215
- </slot>
216
- </template>
217
-
218
- <template v-if="props.trigger === 'input'" #anchor>
219
- <UInput
220
- :id="id"
221
- v-model="inputDraft"
222
- :name="name"
223
- :size="effectiveSize"
224
- :color="effectiveColor"
225
- :highlight="highlight"
226
- :placeholder="props.placeholder"
227
- :disabled="effectiveDisabled"
228
- v-bind="ariaAttrs"
229
- @blur="handleInputBlur"
230
- @focus="handleInputFocus"
231
- @keydown.enter="$event.target.blur()"
232
- >
233
- <template #leading>
234
- <slot name="leading" :value="modelValue">
235
- <button
236
- type="button"
237
- :disabled="effectiveDisabled"
238
- :aria-label="modelValue || props.placeholder"
239
- class="inline-flex items-center justify-center cursor-pointer focus:outline-none disabled:cursor-not-allowed"
240
- @mousedown.prevent
241
- @click="toggleOpen"
242
- >
243
- <span
244
- v-if="modelValue"
245
- :class="extraUi.triggerChip"
246
- :style="{ backgroundColor: modelValue }"
247
- />
248
- <UIcon
249
- v-else
250
- :name="props.icon"
251
- :class="extraUi.triggerIcon"
252
- />
253
- </button>
254
- </slot>
255
- </template>
256
- <template v-if="!!slots.trailing" #trailing>
257
- <slot name="trailing" :value="modelValue" />
258
- </template>
259
- </UInput>
260
- </template>
261
-
262
- <template #content>
263
- <div :class="extraUi.body">
264
- <div v-if="showFormatTabs" :class="extraUi.header">
265
- <PillGroup
266
- :model-value="currentFormat"
267
- :items="formatItems"
268
- value-key="value"
269
- size="xs"
270
- color="neutral"
271
- @update:model-value="(v) => selectFormat(v)"
272
- />
273
- </div>
274
-
275
- <UColorPicker
276
- :model-value="modelValue ?? '#000000'"
277
- v-bind="colorPickerAttrs"
278
- @update:model-value="handlePickerUpdate"
279
- />
280
-
281
- <div v-if="hasSwatches || !!slots.swatches" :class="extraUi.section">
282
- <slot name="swatches" :swatches="swatchRows" :select="selectSwatch">
283
- <div v-for="(row, idx) in swatchRows" :key="idx" :class="extraUi.swatches">
284
- <button
285
- v-for="c in row"
286
- :key="c"
287
- type="button"
288
- :aria-selected="modelValue === c"
289
- :aria-label="c"
290
- :class="extraUi.swatch"
291
- :style="{ backgroundColor: c }"
292
- @click="selectSwatch(c)"
293
- />
294
- </div>
295
- </slot>
296
- </div>
297
-
298
- <div v-if="props.copyable || props.clearable || !!slots.actions" :class="extraUi.actions">
299
- <slot name="actions" :value="modelValue" :copy="handleCopy" :clear="handleClear">
300
- <span :class="extraUi.actionsValue">
301
- {{ modelValue || "\u2014" }}
302
- </span>
303
- <div :class="extraUi.actionsButtons">
304
- <UButton
305
- v-if="props.copyable"
306
- icon="i-lucide-copy"
307
- size="xs"
308
- color="neutral"
309
- variant="ghost"
310
- :disabled="!modelValue"
311
- @click="handleCopy"
312
- />
313
- <UButton
314
- v-if="props.clearable"
315
- icon="i-lucide-x"
316
- size="xs"
317
- color="neutral"
318
- variant="ghost"
319
- :disabled="!modelValue"
320
- @click="handleClear"
321
- />
322
- </div>
323
- </slot>
324
- </div>
325
- </div>
326
- </template>
327
- </UPopover>
328
- </template>
@@ -1,36 +0,0 @@
1
- import type { ComponentConfig } from '@nuxt/ui';
2
- import type { AppConfig } from 'nuxt/schema';
3
- import theme from '#build/movk-ui/color-chooser';
4
- import popoverTheme from '#build/ui/popover';
5
- import type { ColorChooserProps, ColorChooserSlots, ColorFormat } from '../types/components/color-chooser';
6
- declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<M> & {
8
- size?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["size"];
9
- trigger?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["trigger"];
10
- ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["slots"];
11
- } & {
12
- modelValue?: string;
13
- }) & {
14
- onClear?: (() => any) | undefined;
15
- onChange?: ((value: string | undefined) => any) | undefined;
16
- onCopy?: ((value: string) => any) | undefined;
17
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
18
- "onUpdate:open"?: ((open: boolean) => any) | undefined;
19
- "onFormat-change"?: ((format: ColorFormat) => any) | undefined;
20
- }> & (typeof globalThis extends {
21
- __VLS_PROPS_FALLBACK: infer P;
22
- } ? P : {});
23
- expose: (exposed: {}) => void;
24
- attrs: any;
25
- slots: ColorChooserSlots;
26
- emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
27
- }>) => import("vue").VNode & {
28
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
29
- };
30
- declare const _default: typeof __VLS_export;
31
- export default _default;
32
- type __VLS_PrettifyLocal<T> = (T extends any ? {
33
- [K in keyof T]: T[K];
34
- } : {
35
- [K in keyof T as K]: T[K];
36
- }) & {};
@@ -1,33 +0,0 @@
1
- import type { GetItemKeys, GetModelValue } from '@nuxt/ui';
2
- import type { PillGroupProps, PillGroupSlots, PillItem } from '../types/components/pill-group';
3
- declare const __VLS_export: <T extends PillItem, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(PillGroupProps<T, VK, M> & {
5
- orientation?: string | number | symbol;
6
- ui?: {
7
- [x: string]: import("@nuxt/ui").SlotClass;
8
- };
9
- } & {
10
- modelValue?: GetModelValue<T, VK, M>;
11
- }) & {
12
- onBlur?: ((event: FocusEvent) => any) | undefined;
13
- onChange?: ((value: GetModelValue<T, VK, M, undefined>) => any) | undefined;
14
- onFocus?: ((event: FocusEvent) => any) | undefined;
15
- onSelect?: ((payload: import("../types").PillSelectPayload<T>) => any) | undefined;
16
- "onUpdate:modelValue"?: ((value: GetModelValue<T, VK, M, undefined> | undefined) => any) | undefined;
17
- }> & (typeof globalThis extends {
18
- __VLS_PROPS_FALLBACK: infer P;
19
- } ? P : {});
20
- expose: (exposed: {}) => void;
21
- attrs: any;
22
- slots: PillGroupSlots<T, VK, M>;
23
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", value: GetModelValue<T, VK, M, undefined>) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "select", payload: import("../types").PillSelectPayload<T>) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M, undefined>) => void)) & ((event: "update:modelValue", value: GetModelValue<T, VK, M> | undefined) => void);
24
- }>) => import("vue").VNode & {
25
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
26
- };
27
- declare const _default: typeof __VLS_export;
28
- export default _default;
29
- type __VLS_PrettifyLocal<T> = (T extends any ? {
30
- [K in keyof T]: T[K];
31
- } : {
32
- [K in keyof T as K]: T[K];
33
- }) & {};