@movk/nuxt 1.1.2 → 1.3.0

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 (301) hide show
  1. package/.nuxt/movk-ui.css +3 -0
  2. package/README.md +75 -104
  3. package/dist/module.d.mts +59 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +136 -56
  6. package/dist/runtime/components/AutoForm.d.vue.ts +10 -31
  7. package/dist/runtime/components/AutoForm.vue +114 -148
  8. package/dist/runtime/components/AutoForm.vue.d.ts +10 -31
  9. package/dist/runtime/components/ColorChooser.d.vue.ts +20 -17
  10. package/dist/runtime/components/ColorChooser.vue +305 -31
  11. package/dist/runtime/components/ColorChooser.vue.d.ts +20 -17
  12. package/dist/runtime/components/DataTable.d.vue.ts +57 -0
  13. package/dist/runtime/components/DataTable.vue +584 -0
  14. package/dist/runtime/components/DataTable.vue.d.ts +57 -0
  15. package/dist/runtime/components/DatePicker.d.vue.ts +15 -22
  16. package/dist/runtime/components/DatePicker.vue +173 -65
  17. package/dist/runtime/components/DatePicker.vue.d.ts +15 -22
  18. package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
  19. package/dist/runtime/components/MessageBox.vue +113 -0
  20. package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
  21. package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
  22. package/dist/runtime/components/PillGroup.vue +291 -0
  23. package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
  24. package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
  25. package/dist/runtime/components/Popconfirm.vue +143 -0
  26. package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
  27. package/dist/runtime/components/SearchForm.d.vue.ts +43 -0
  28. package/dist/runtime/components/SearchForm.vue +274 -0
  29. package/dist/runtime/components/SearchForm.vue.d.ts +43 -0
  30. package/dist/runtime/components/SlideVerify.d.vue.ts +13 -79
  31. package/dist/runtime/components/SlideVerify.vue +117 -90
  32. package/dist/runtime/components/SlideVerify.vue.d.ts +13 -79
  33. package/dist/runtime/components/StarRating.d.vue.ts +25 -82
  34. package/dist/runtime/components/StarRating.vue +128 -99
  35. package/dist/runtime/components/StarRating.vue.d.ts +25 -82
  36. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +32 -0
  37. package/dist/runtime/components/input/AsPhoneNumberInput.vue +48 -0
  38. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +32 -0
  39. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +13 -7
  40. package/dist/runtime/components/input/WithCharacterLimit.vue +27 -15
  41. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +13 -7
  42. package/dist/runtime/components/input/WithClear.d.vue.ts +11 -5
  43. package/dist/runtime/components/input/WithClear.vue +29 -10
  44. package/dist/runtime/components/input/WithClear.vue.d.ts +11 -5
  45. package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -7
  46. package/dist/runtime/components/input/WithCopy.vue +28 -11
  47. package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -7
  48. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +33 -0
  49. package/dist/runtime/components/input/WithFloatingLabel.vue +75 -0
  50. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +33 -0
  51. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +13 -7
  52. package/dist/runtime/components/input/WithPasswordToggle.vue +27 -10
  53. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +13 -7
  54. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
  55. package/dist/runtime/components/theme-picker/ThemePicker.vue +37 -28
  56. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
  57. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +5 -6
  58. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
  59. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +5 -6
  60. package/dist/runtime/composables/index.d.ts +9 -8
  61. package/dist/runtime/composables/index.js +2 -1
  62. package/dist/runtime/composables/useApiFetch.d.ts +23 -15
  63. package/dist/runtime/composables/useApiFetch.js +21 -28
  64. package/dist/runtime/composables/useAutoForm.d.ts +14 -98
  65. package/dist/runtime/composables/useAutoForm.js +55 -161
  66. package/dist/runtime/composables/useClientApiFetch.d.ts +7 -7
  67. package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
  68. package/dist/runtime/composables/useDateFormatter.js +89 -30
  69. package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
  70. package/dist/runtime/composables/useDownloadWithProgress.js +143 -42
  71. package/dist/runtime/composables/useLazyApiFetch.d.ts +19 -0
  72. package/dist/runtime/composables/useLazyApiFetch.js +4 -0
  73. package/dist/runtime/composables/useMessageBox.d.ts +6 -0
  74. package/dist/runtime/composables/useMessageBox.js +16 -0
  75. package/dist/runtime/composables/useTheme.d.ts +21 -8
  76. package/dist/runtime/composables/useTheme.js +109 -86
  77. package/dist/runtime/composables/useUploadWithProgress.d.ts +22 -28
  78. package/dist/runtime/composables/useUploadWithProgress.js +79 -68
  79. package/dist/runtime/domains/api/auth.d.ts +2 -0
  80. package/dist/runtime/domains/api/auth.js +31 -0
  81. package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
  82. package/dist/runtime/domains/api/endpoint-config.js +17 -0
  83. package/dist/runtime/domains/api/errors.d.ts +2 -0
  84. package/dist/runtime/domains/api/errors.js +10 -0
  85. package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
  86. package/dist/runtime/domains/api/fetch-key.js +23 -0
  87. package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
  88. package/dist/runtime/domains/api/interceptors/error.js +49 -0
  89. package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
  90. package/dist/runtime/domains/api/interceptors/request.js +46 -0
  91. package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
  92. package/dist/runtime/domains/api/interceptors/response.js +27 -0
  93. package/dist/runtime/domains/api/response.d.ts +4 -0
  94. package/dist/runtime/domains/api/response.js +14 -0
  95. package/dist/runtime/domains/api/toast.d.ts +15 -0
  96. package/dist/runtime/domains/api/toast.js +46 -0
  97. package/dist/runtime/domains/api/transfer.d.ts +69 -0
  98. package/dist/runtime/domains/api/transfer.js +81 -0
  99. package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
  100. package/dist/runtime/domains/auto-form/actions.js +4 -0
  101. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
  102. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +37 -48
  103. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
  104. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
  105. package/dist/runtime/domains/auto-form/components/Children.vue +50 -0
  106. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
  107. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
  108. package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
  109. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
  110. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
  111. package/dist/runtime/domains/auto-form/components/Layout.vue +89 -0
  112. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
  113. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
  114. package/dist/runtime/domains/auto-form/components/Nested.vue +47 -0
  115. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
  116. package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -2
  117. package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -25
  118. package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
  119. package/dist/runtime/domains/auto-form/controls.js +73 -0
  120. package/dist/runtime/{utils/field-utils.d.ts → domains/auto-form/fields.d.ts} +7 -21
  121. package/dist/runtime/{utils/field-utils.js → domains/auto-form/fields.js} +19 -4
  122. package/dist/runtime/domains/auto-form/metadata.d.ts +22 -0
  123. package/dist/runtime/domains/auto-form/metadata.js +53 -0
  124. package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
  125. package/dist/runtime/{internal/useAutoFormProvider.js → domains/auto-form/provider.js} +6 -3
  126. package/dist/runtime/domains/auto-form/reactive.d.ts +12 -0
  127. package/dist/runtime/{utils/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
  128. package/dist/runtime/domains/auto-form/schema.d.ts +7 -0
  129. package/dist/runtime/{utils/schema-introspector.js → domains/auto-form/schema.js} +12 -10
  130. package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
  131. package/dist/runtime/domains/data-table/columns/constants.js +19 -0
  132. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
  133. package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
  134. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
  135. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
  136. package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
  137. package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
  138. package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
  139. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
  140. package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
  141. package/dist/runtime/domains/data-table/columns/style.js +67 -0
  142. package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
  143. package/dist/runtime/domains/data-table/columns/utils.js +16 -0
  144. package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
  145. package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
  146. package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
  147. package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
  148. package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
  149. package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
  150. package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
  151. package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
  152. package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
  153. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
  154. package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
  155. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
  156. package/dist/runtime/domains/data-table/indent.d.ts +8 -0
  157. package/dist/runtime/domains/data-table/indent.js +19 -0
  158. package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
  159. package/dist/runtime/domains/data-table/tree-selection.js +76 -0
  160. package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
  161. package/dist/runtime/index.css +1 -0
  162. package/dist/runtime/plugins/api.factory.js +28 -171
  163. package/dist/runtime/plugins/theme.js +72 -70
  164. package/dist/runtime/types/api/config.d.ts +127 -0
  165. package/dist/runtime/types/api/fetch.d.ts +50 -0
  166. package/dist/runtime/types/api/index.d.ts +5 -0
  167. package/dist/runtime/types/api/module.d.ts +94 -0
  168. package/dist/runtime/types/api/response.d.ts +62 -0
  169. package/dist/runtime/types/api/transfer.d.ts +32 -0
  170. package/dist/runtime/types/api/transfer.js +0 -0
  171. package/dist/runtime/types/app.config.d.ts +6 -0
  172. package/dist/runtime/types/auto-form/base.d.ts +26 -0
  173. package/dist/runtime/types/auto-form/base.js +0 -0
  174. package/dist/runtime/types/auto-form/component.d.ts +28 -0
  175. package/dist/runtime/types/auto-form/component.js +0 -0
  176. package/dist/runtime/types/auto-form/controls.d.ts +45 -0
  177. package/dist/runtime/types/auto-form/controls.js +0 -0
  178. package/dist/runtime/types/auto-form/fields.d.ts +68 -0
  179. package/dist/runtime/types/auto-form/fields.js +0 -0
  180. package/dist/runtime/types/auto-form/index.d.ts +7 -0
  181. package/dist/runtime/types/auto-form/index.js +0 -0
  182. package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
  183. package/dist/runtime/types/auto-form/search-form.js +0 -0
  184. package/dist/runtime/types/auto-form/slots.d.ts +85 -0
  185. package/dist/runtime/types/auto-form/slots.js +0 -0
  186. package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
  187. package/dist/runtime/types/auto-form/zod-factory.js +0 -0
  188. package/dist/runtime/types/components/color-chooser.d.ts +109 -0
  189. package/dist/runtime/types/components/color-chooser.js +0 -0
  190. package/dist/runtime/types/components/date-picker.d.ts +41 -0
  191. package/dist/runtime/types/components/date-picker.js +0 -0
  192. package/dist/runtime/types/components/index.d.ts +8 -0
  193. package/dist/runtime/types/components/index.js +0 -0
  194. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
  195. package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
  196. package/dist/runtime/types/components/input/index.d.ts +6 -0
  197. package/dist/runtime/types/components/input/index.js +0 -0
  198. package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
  199. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  200. package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
  201. package/dist/runtime/types/components/input/with-clear.js +0 -0
  202. package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
  203. package/dist/runtime/types/components/input/with-copy.js +0 -0
  204. package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
  205. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  206. package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
  207. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  208. package/dist/runtime/types/components/message-box.d.ts +69 -0
  209. package/dist/runtime/types/components/message-box.js +0 -0
  210. package/dist/runtime/types/components/pill-group.d.ts +103 -0
  211. package/dist/runtime/types/components/pill-group.js +0 -0
  212. package/dist/runtime/types/components/popconfirm.d.ts +74 -0
  213. package/dist/runtime/types/components/popconfirm.js +0 -0
  214. package/dist/runtime/types/components/slide-verify.d.ts +54 -0
  215. package/dist/runtime/types/components/slide-verify.js +0 -0
  216. package/dist/runtime/types/components/star-rating.d.ts +55 -0
  217. package/dist/runtime/types/components/star-rating.js +0 -0
  218. package/dist/runtime/types/data-table/columns.d.ts +236 -0
  219. package/dist/runtime/types/data-table/columns.js +6 -0
  220. package/dist/runtime/types/data-table/component.d.ts +190 -0
  221. package/dist/runtime/types/data-table/component.js +0 -0
  222. package/dist/runtime/types/data-table/contexts.d.ts +44 -0
  223. package/dist/runtime/types/data-table/contexts.js +0 -0
  224. package/dist/runtime/types/data-table/index.d.ts +6 -0
  225. package/dist/runtime/types/data-table/index.js +1 -0
  226. package/dist/runtime/types/data-table/pagination.d.ts +87 -0
  227. package/dist/runtime/types/data-table/pagination.js +0 -0
  228. package/dist/runtime/types/index.d.ts +6 -5
  229. package/dist/runtime/types/index.js +5 -5
  230. package/dist/runtime/types/shared.d.ts +5 -0
  231. package/dist/runtime/types/shared.js +0 -0
  232. package/dist/runtime/types/zod.d.ts +19 -17
  233. package/dist/runtime/utils/extend-theme.d.ts +19 -0
  234. package/dist/runtime/utils/extend-theme.js +44 -0
  235. package/dist/runtime/utils/form-control.d.ts +33 -0
  236. package/dist/runtime/utils/form-control.js +54 -0
  237. package/dist/runtime/utils/meta.d.ts +4 -0
  238. package/dist/runtime/utils/meta.js +14 -0
  239. package/dist/runtime/utils/theme-defaults.d.ts +27 -0
  240. package/dist/runtime/utils/theme-defaults.js +28 -0
  241. package/dist/runtime/utils/tv.d.ts +1 -0
  242. package/dist/runtime/utils/tv.js +4 -0
  243. package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
  244. package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
  245. package/dist/runtime/vue/plugins/theme.d.ts +6 -0
  246. package/dist/runtime/vue/plugins/theme.js +14 -0
  247. package/dist/runtime/vue/stubs/base.d.ts +2 -0
  248. package/dist/runtime/vue/stubs/base.js +2 -0
  249. package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
  250. package/dist/runtime/vue/stubs/inertia.js +2 -0
  251. package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
  252. package/dist/runtime/vue/stubs/movk-extra.js +2 -0
  253. package/dist/runtime/vue/stubs/none.d.ts +2 -0
  254. package/dist/runtime/vue/stubs/none.js +2 -0
  255. package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
  256. package/dist/runtime/vue/stubs/vue-router.js +2 -0
  257. package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
  258. package/dist/types.d.mts +2 -6
  259. package/dist/unplugin.d.mts +28 -0
  260. package/dist/unplugin.mjs +292 -0
  261. package/dist/vite.d.mts +12 -0
  262. package/dist/vite.mjs +20 -0
  263. package/package.json +82 -42
  264. package/vue-plugin.d.ts +5 -0
  265. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -20
  266. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -20
  267. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -20
  268. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
  269. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -20
  270. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -20
  271. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +0 -125
  272. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -20
  273. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -20
  274. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +0 -105
  275. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -20
  276. package/dist/runtime/composables/useApiAuth.d.ts +0 -47
  277. package/dist/runtime/composables/useApiAuth.js +0 -66
  278. package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
  279. package/dist/runtime/schemas/api.d.ts +0 -590
  280. package/dist/runtime/schemas/api.js +0 -228
  281. package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
  282. package/dist/runtime/server/api/_movk/session.post.js +0 -18
  283. package/dist/runtime/style.css +0 -1
  284. package/dist/runtime/types/api.d.ts +0 -218
  285. package/dist/runtime/types/auth.d.ts +0 -34
  286. package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
  287. package/dist/runtime/types/auto-form.d.ts +0 -548
  288. package/dist/runtime/types/components.d.ts +0 -43
  289. package/dist/runtime/types/module.d.ts +0 -39
  290. package/dist/runtime/utils/api-utils.d.ts +0 -79
  291. package/dist/runtime/utils/api-utils.js +0 -127
  292. package/dist/runtime/utils/auto-form.d.ts +0 -3
  293. package/dist/runtime/utils/auto-form.js +0 -18
  294. package/dist/runtime/utils/reactive-utils.d.ts +0 -30
  295. package/dist/runtime/utils/schema-introspector.d.ts +0 -13
  296. /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
  297. /package/dist/runtime/types/{api.js → api/config.js} +0 -0
  298. /package/dist/runtime/types/{auto-form-renderer.js → api/fetch.js} +0 -0
  299. /package/dist/runtime/types/{auto-form.js → api/index.js} +0 -0
  300. /package/dist/runtime/types/{module.js → api/module.js} +0 -0
  301. /package/dist/runtime/types/{components.js → api/response.js} +0 -0
@@ -1,42 +1,135 @@
1
- import { ref, useNuxtApp } from "#imports";
2
- import { extractFilename, triggerDownload } from "@movk/core";
3
- import { showToast, extractToastMessage, getAuthHeaders } from "../utils/api-utils.js";
1
+ import { ref, useNuxtApp, useRuntimeConfig } from "#imports";
2
+ import { triggerDownload } from "@movk/core";
3
+ import {
4
+ buildFetchContext,
5
+ finalizeTransfer,
6
+ prepareTransfer,
7
+ resolveFilename,
8
+ tryParseJsonResponse
9
+ } from "../domains/api/transfer.js";
4
10
  export function useDownloadWithProgress() {
5
- const { $api } = useNuxtApp();
11
+ const publicConfig = useRuntimeConfig().public.movkApi;
12
+ const nuxtApp = useNuxtApp();
6
13
  const progress = ref(0);
7
- const downloading = ref(false);
14
+ const status = ref("idle");
15
+ const data = ref(null);
8
16
  const error = ref(null);
9
- let abortController = null;
17
+ let controller = null;
10
18
  const abort = () => {
11
- abortController?.abort();
12
- abortController = null;
13
- downloading.value = false;
19
+ controller?.abort();
20
+ controller = null;
21
+ status.value = "aborted";
14
22
  progress.value = 0;
15
23
  };
16
24
  const download = async (url, options = {}) => {
17
- const { filename, headers = {}, toast, endpoint, onSuccess, onError } = options;
18
- const apiInstance = endpoint ? $api.use(endpoint) : $api;
19
- const config = apiInstance.getConfig();
20
- const fullUrl = `${config.baseURL || ""}${url}`;
25
+ const {
26
+ method = "GET",
27
+ body,
28
+ filename,
29
+ headers: userHeaders,
30
+ toast,
31
+ endpoint,
32
+ skipBusinessCheck,
33
+ onSuccess,
34
+ onError
35
+ } = options;
36
+ const urlStr = typeof url === "string" ? url : url.url;
37
+ const { fullUrl, headers, config } = prepareTransfer(publicConfig, urlStr, {
38
+ endpoint,
39
+ headers: userHeaders,
40
+ toast,
41
+ skipBusinessCheck
42
+ });
21
43
  progress.value = 0;
22
- downloading.value = true;
44
+ status.value = "pending";
45
+ data.value = null;
23
46
  error.value = null;
24
- abortController = new AbortController();
47
+ controller = new AbortController();
48
+ const fetchInit = {
49
+ method,
50
+ headers,
51
+ signal: controller.signal
52
+ };
53
+ if (method && method !== "GET" && body !== void 0 && body !== null) {
54
+ const isBodyInit = typeof body === "string" || body instanceof Blob || body instanceof FormData || body instanceof URLSearchParams || body instanceof ArrayBuffer || body instanceof ReadableStream || ArrayBuffer.isView(body);
55
+ if (isBodyInit) {
56
+ fetchInit.body = body;
57
+ } else {
58
+ fetchInit.body = JSON.stringify(body);
59
+ if (!("content-type" in headers) && !("Content-Type" in headers)) {
60
+ fetchInit.headers["Content-Type"] = "application/json";
61
+ }
62
+ }
63
+ }
25
64
  try {
26
- const authHeaders = getAuthHeaders(config);
27
- const response = await fetch(fullUrl, {
28
- method: "GET",
29
- headers: { ...headers, ...authHeaders },
30
- signal: abortController.signal
65
+ const response = await fetch(fullUrl, fetchInit);
66
+ const fetchContext = buildFetchContext(fullUrl, { context: { toast, skipBusinessCheck } }, {
67
+ status: response.status,
68
+ headers: response.headers
31
69
  });
70
+ const contentType = response.headers.get("content-type") || "";
71
+ const isJson = contentType.toLowerCase().includes("application/json");
32
72
  if (!response.ok) {
33
- throw new Error(`\u4E0B\u8F7D\u5931\u8D25: ${response.status} ${response.statusText}`);
73
+ if (isJson) {
74
+ const text = await response.text();
75
+ const raw = tryParseJsonResponse(response.headers, text);
76
+ const result3 = await finalizeTransfer(nuxtApp, {
77
+ raw,
78
+ fallback: { isSuccess: false, data: null, message: `HTTP ${response.status}` },
79
+ config,
80
+ publicConfig,
81
+ requestToast: toast,
82
+ skipBusinessCheck,
83
+ fetchContext
84
+ });
85
+ status.value = "error";
86
+ error.value = result3.error;
87
+ onError?.(result3.error);
88
+ return result3;
89
+ }
90
+ const result2 = await finalizeTransfer(nuxtApp, {
91
+ raw: null,
92
+ fallback: { isSuccess: false, data: null, message: `HTTP ${response.status} ${response.statusText}` },
93
+ config,
94
+ publicConfig,
95
+ requestToast: toast,
96
+ fetchContext
97
+ });
98
+ status.value = "error";
99
+ error.value = result2.error;
100
+ onError?.(result2.error);
101
+ return result2;
102
+ }
103
+ if (isJson) {
104
+ const text = await response.text();
105
+ const raw = tryParseJsonResponse(response.headers, text);
106
+ const result2 = await finalizeTransfer(nuxtApp, {
107
+ raw,
108
+ fallback: { isSuccess: false, data: null, message: "\u54CD\u5E94\u89E3\u6790\u5931\u8D25" },
109
+ config,
110
+ publicConfig,
111
+ requestToast: toast,
112
+ skipBusinessCheck,
113
+ fetchContext
114
+ });
115
+ if (result2.error) {
116
+ status.value = "error";
117
+ error.value = result2.error;
118
+ onError?.(result2.error);
119
+ } else {
120
+ status.value = "success";
121
+ data.value = result2.data;
122
+ progress.value = 100;
123
+ }
124
+ controller = null;
125
+ return result2;
34
126
  }
35
127
  const contentLength = response.headers.get("content-length");
36
128
  const total = contentLength ? Number.parseInt(contentLength, 10) : 0;
37
- const finalFilename = filename || extractFilename(response.headers, url.split("/").pop() || "download");
129
+ const finalFilename = resolveFilename(response.headers, urlStr, filename);
38
130
  const reader = response.body?.getReader();
39
131
  if (!reader) throw new Error("\u65E0\u6CD5\u8BFB\u53D6\u54CD\u5E94\u6D41");
132
+ if (total <= 0) progress.value = null;
40
133
  const chunks = [];
41
134
  let received = 0;
42
135
  while (true) {
@@ -46,35 +139,43 @@ export function useDownloadWithProgress() {
46
139
  received += value.length;
47
140
  if (total > 0) progress.value = Math.round(received / total * 100);
48
141
  }
49
- triggerDownload(new Blob(chunks), finalFilename);
50
- downloading.value = false;
51
- abortController = null;
142
+ const blob = new Blob(chunks);
143
+ triggerDownload(blob, finalFilename);
144
+ const result = await finalizeTransfer(nuxtApp, {
145
+ raw: null,
146
+ fallback: { isSuccess: true, data: blob, message: `\u4E0B\u8F7D\u6210\u529F: ${finalFilename}` },
147
+ config,
148
+ publicConfig,
149
+ requestToast: toast,
150
+ fetchContext
151
+ });
152
+ status.value = "success";
153
+ data.value = result.data;
52
154
  progress.value = 100;
53
- if (import.meta.client && toast !== false) {
54
- const message = extractToastMessage(toast, "success", `\u4E0B\u8F7D\u6210\u529F: ${finalFilename}`);
55
- showToast("success", message, toast, config.toast);
56
- }
155
+ controller = null;
57
156
  onSuccess?.(finalFilename);
58
- return { success: true, error: null };
157
+ return result;
59
158
  } catch (err) {
60
- downloading.value = false;
61
- abortController = null;
159
+ controller = null;
160
+ const isAborted = err instanceof DOMException && err.name === "AbortError";
161
+ if (isAborted) {
162
+ status.value = "aborted";
163
+ return { data: null, error: null, aborted: true };
164
+ }
62
165
  const downloadError = err instanceof Error ? err : new Error("\u4E0B\u8F7D\u5931\u8D25");
166
+ status.value = "error";
63
167
  error.value = downloadError;
64
- const isAborted = downloadError.name === "AbortError";
65
- if (import.meta.client && !isAborted && toast !== false) {
66
- const message = extractToastMessage(toast, "error", downloadError.message || "\u4E0B\u8F7D\u5931\u8D25");
67
- showToast("error", message, toast, config.toast);
68
- }
69
- if (!isAborted) onError?.(downloadError);
70
- return { success: false, error: downloadError };
168
+ onError?.(downloadError);
169
+ return { data: null, error: downloadError, aborted: false };
71
170
  }
72
171
  };
73
172
  return {
74
- /** 下载进度 (0-100) */
173
+ /** 下载进度 0-100;后端未返回 content-length 时为 null(不确定) */
75
174
  progress,
76
- /** 是否正在下载 */
77
- downloading,
175
+ /** 传输状态 */
176
+ status,
177
+ /** 业务数据(默认 Blob;JSON 响应时为解包后的业务数据) */
178
+ data,
78
179
  /** 错误信息 */
79
180
  error,
80
181
  /** 执行下载 */
@@ -0,0 +1,19 @@
1
+ import type { NitroFetchRequest } from 'nitropack/types';
2
+ import type { UseApiFetchOptions, UseApiFetchReturn } from '../types/api';
3
+ /**
4
+ * 懒加载版 useApiFetch
5
+ *
6
+ * 等价于 `useApiFetch(url, { lazy: true, ...options })`
7
+ * 不阻塞客户端导航,页面立即显示,数据在后台加载
8
+ *
9
+ * @typeParam T - 业务数据类型(已由 $api 自动解包)
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const { data, status } = useLazyApiFetch<Post[]>('/posts')
14
+ *
15
+ * // 需要手动处理 loading 状态
16
+ * // <div v-if="status === 'pending'">Loading...</div>
17
+ * ```
18
+ */
19
+ export declare function useLazyApiFetch<T = unknown, DataT = T>(url: NitroFetchRequest | (() => NitroFetchRequest), options?: UseApiFetchOptions<T, DataT>): UseApiFetchReturn<DataT>;
@@ -0,0 +1,4 @@
1
+ import { useApiFetch } from "./useApiFetch.js";
2
+ export function useLazyApiFetch(url, options = {}) {
3
+ return useApiFetch(url, { ...options, lazy: true });
4
+ }
@@ -0,0 +1,6 @@
1
+ import type { MessageBoxProps } from '../types/components/message-box';
2
+ import type { OmitByKey } from '@movk/core';
3
+ export declare function useMessageBox(): {
4
+ alert: (options: OmitByKey<MessageBoxProps, "mode">) => Promise<void>;
5
+ confirm: (options: OmitByKey<MessageBoxProps, "mode">) => Promise<boolean>;
6
+ };
@@ -0,0 +1,16 @@
1
+ import { useOverlay } from "#imports";
2
+ import { LazyMMessageBox } from "#components";
3
+ export function useMessageBox() {
4
+ const overlay = useOverlay();
5
+ function createInstance() {
6
+ return overlay.create(LazyMMessageBox, { destroyOnClose: true });
7
+ }
8
+ async function alert(options) {
9
+ await createInstance().open({ ...options, mode: "alert" });
10
+ }
11
+ async function confirm(options) {
12
+ const result = await createInstance().open({ ...options, mode: "confirm" });
13
+ return result ?? false;
14
+ }
15
+ return { alert, confirm };
16
+ }
@@ -1,12 +1,24 @@
1
1
  export declare function useTheme(): {
2
- neutralColors: readonly ["slate", "gray", "zinc", "neutral", "stone"];
2
+ color: import("vue").ComputedRef<any>;
3
+ style: {
4
+ innerHTML: import("vue").ComputedRef<string>;
5
+ id: string;
6
+ tagPriority: number;
7
+ }[];
8
+ link: import("vue").ComputedRef<{
9
+ rel: "stylesheet";
10
+ href: any;
11
+ id: string;
12
+ }[]>;
13
+ neutralColors: any;
3
14
  neutral: import("vue").WritableComputedRef<any, any>;
4
15
  primaryColors: string[];
5
16
  primary: import("vue").WritableComputedRef<any, any>;
17
+ blackAsPrimary: import("vue").ComputedRef<boolean>;
6
18
  setBlackAsPrimary: (value: boolean) => void;
7
- radiuses: number[];
19
+ radiuses: any;
8
20
  radius: import("vue").WritableComputedRef<any, any>;
9
- fonts: string[];
21
+ fonts: any;
10
22
  font: import("vue").WritableComputedRef<any, any>;
11
23
  icon: import("vue").WritableComputedRef<any, any>;
12
24
  icons: {
@@ -14,14 +26,15 @@ export declare function useTheme(): {
14
26
  icon: string;
15
27
  value: string;
16
28
  }[];
17
- modes: {
29
+ modes: import("vue").ComputedRef<{
18
30
  label: string;
19
31
  icon: any;
20
- }[];
32
+ }[]>;
21
33
  mode: import("vue").WritableComputedRef<any, any>;
22
- hasCSSChanges: import("vue").ComputedRef<any>;
23
- hasAppConfigChanges: import("vue").ComputedRef<boolean>;
34
+ hasCSSChanges: import("vue").ComputedRef<boolean>;
35
+ hasConfigChanges: import("vue").ComputedRef<boolean>;
36
+ configLabel: string;
24
37
  exportCSS: () => string;
25
- exportAppConfig: () => string;
38
+ exportConfig: () => string;
26
39
  resetTheme: () => void;
27
40
  };
@@ -1,86 +1,80 @@
1
1
  import { useAppConfig, useColorMode, useSiteConfig } from "#imports";
2
- import { omit } from "@movk/core";
2
+ import { themeIcons } from "../domains/theme/theme-icons.js";
3
+ import { omit, kebabCase } from "@movk/core";
4
+ import { useLocalStorage } from "@vueuse/core";
3
5
  import colors from "tailwindcss/colors";
4
6
  import { computed } from "vue";
5
- import { themeIcons } from "../utils/theme.js";
7
+ import { getDefaultConfig } from "../utils/theme-defaults.js";
6
8
  export function useTheme() {
7
- const appConfig = useAppConfig();
9
+ const { movk, ui } = useAppConfig();
8
10
  const colorMode = useColorMode();
9
- const site = useSiteConfig();
10
- const neutralColors = ["slate", "gray", "zinc", "neutral", "stone"];
11
+ const name = kebabCase(useSiteConfig().name);
12
+ const color = computed(() => colorMode.value === "dark" ? colors[ui.colors.neutral][900] : "white");
13
+ const defaultConfig = getDefaultConfig();
14
+ const _radius = useLocalStorage(`${name}-ui-radius`, movk?.radius ?? defaultConfig.radius);
15
+ const _font = useLocalStorage(`${name}-ui-font`, movk?.font ?? defaultConfig.font);
16
+ const _iconSet = useLocalStorage(`${name}-ui-icons`, movk?.icons ?? defaultConfig.icons);
17
+ const _blackAsPrimary = useLocalStorage(`${name}-ui-black-as-primary`, defaultConfig.blackAsPrimary);
18
+ const pickerFonts = movk?.picker?.fonts ?? [];
19
+ const neutralColors = movk?.picker?.neutralColors ?? [];
11
20
  const neutral = computed({
12
21
  get() {
13
- return appConfig.ui.colors.neutral;
22
+ return ui.colors.neutral;
14
23
  },
15
24
  set(option) {
16
- appConfig.ui.colors.neutral = option;
17
- window.localStorage.setItem(`${site.name}-ui-neutral`, appConfig.ui.colors.neutral);
25
+ ui.colors.neutral = option;
26
+ window.localStorage.setItem(`${name}-ui-neutral`, ui.colors.neutral);
18
27
  }
19
28
  });
20
29
  const colorsToOmit = ["inherit", "current", "transparent", "black", "white", ...neutralColors];
21
- const primaryColors = Object.keys(omit(colors, [...colorsToOmit]));
30
+ const primaryColors = Object.keys(omit(colors, colorsToOmit));
22
31
  const primary = computed({
23
32
  get() {
24
- return appConfig.ui.colors.primary;
33
+ return ui.colors.primary;
25
34
  },
26
35
  set(option) {
27
- appConfig.ui.colors.primary = option;
28
- window.localStorage.setItem(`${site.name}-ui-primary`, appConfig.ui.colors.primary);
36
+ ui.colors.primary = option;
37
+ window.localStorage.setItem(`${name}-ui-primary`, ui.colors.primary);
29
38
  setBlackAsPrimary(false);
30
39
  }
31
40
  });
32
- const radiuses = [0, 0.125, 0.25, 0.375, 0.5];
41
+ const radiuses = movk?.picker?.radiuses ?? [];
33
42
  const radius = computed({
34
43
  get() {
35
- return appConfig.theme.radius;
44
+ return _radius.value;
36
45
  },
37
46
  set(option) {
38
- appConfig.theme.radius = option;
39
- window.localStorage.setItem(`${site.name}-ui-radius`, String(appConfig.theme.radius));
47
+ _radius.value = option;
40
48
  }
41
49
  });
42
- const fonts = ["Public Sans", "DM Sans", "Geist", "Inter", "Poppins", "Outfit", "Raleway"];
50
+ const fonts = pickerFonts.map((f) => f.name);
43
51
  const font = computed({
44
52
  get() {
45
- return appConfig.theme.font;
53
+ return _font.value;
46
54
  },
47
55
  set(option) {
48
- appConfig.theme.font = option;
49
- if (appConfig.theme.font) {
50
- window.localStorage.setItem(`${site.name}-ui-font`, appConfig.theme.font);
51
- }
56
+ _font.value = option;
52
57
  }
53
58
  });
54
- const icons = [{
55
- label: "Lucide",
56
- icon: "i-lucide-feather",
57
- value: "lucide"
58
- }, {
59
- label: "Phosphor",
60
- icon: "i-ph-phosphor-logo",
61
- value: "phosphor"
62
- }, {
63
- label: "Tabler",
64
- icon: "i-tabler-brand-tabler",
65
- value: "tabler"
66
- }];
59
+ const icons = [
60
+ { label: "Lucide", icon: "i-lucide-feather", value: "lucide" },
61
+ { label: "Phosphor", icon: "i-ph-phosphor-logo", value: "phosphor" },
62
+ { label: "Tabler", icon: "i-tabler-brand-tabler", value: "tabler" }
63
+ ];
67
64
  const icon = computed({
68
65
  get() {
69
- return appConfig.theme.icons;
66
+ return _iconSet.value;
70
67
  },
71
68
  set(option) {
72
- appConfig.theme.icons = option;
73
- appConfig.ui.icons = themeIcons[option];
74
- if (appConfig.theme.icons) {
75
- window.localStorage.setItem(`${site.name}-ui-icons`, appConfig.theme.icons);
76
- }
69
+ _iconSet.value = option;
70
+ ui.icons = themeIcons[option];
77
71
  }
78
72
  });
79
- const modes = [
80
- { label: "light", icon: appConfig.ui.icons.light },
81
- { label: "dark", icon: appConfig.ui.icons.dark },
82
- { label: "system", icon: appConfig.ui.icons.system }
83
- ];
73
+ const modes = computed(() => [
74
+ { label: "light", icon: ui.icons.light },
75
+ { label: "dark", icon: ui.icons.dark },
76
+ { label: "system", icon: ui.icons.system }
77
+ ]);
84
78
  const mode = computed({
85
79
  get() {
86
80
  return colorMode.value;
@@ -89,79 +83,107 @@ export function useTheme() {
89
83
  colorMode.preference = option;
90
84
  }
91
85
  });
86
+ const blackAsPrimary = computed(() => _blackAsPrimary.value);
92
87
  function setBlackAsPrimary(value) {
93
- appConfig.theme.blackAsPrimary = value;
94
- window.localStorage.setItem(`${site.name}-ui-black-as-primary`, String(value));
88
+ _blackAsPrimary.value = value;
95
89
  }
90
+ const radiusStyle = computed(() => `:root { --ui-radius: ${_radius.value}rem; }`);
91
+ const blackAsPrimaryStyle = computed(() => _blackAsPrimary.value ? `:root { --ui-primary: black; } .dark { --ui-primary: white; }` : ":root {}");
92
+ const fontStyle = computed(() => `:root { --font-sans: '${_font.value}', sans-serif; }`);
93
+ const link = computed(() => {
94
+ const fontName = _font.value;
95
+ const fontConfig = pickerFonts.find((f) => f.name === fontName);
96
+ const href = fontConfig?.href ?? `https://fonts.googleapis.com/css2?family=${encodeURIComponent(fontName)}:wght@400;500;600;700&display=swap`;
97
+ return [{
98
+ rel: "stylesheet",
99
+ href,
100
+ id: `font-${fontName.toLowerCase().replace(/\s+/g, "-")}`
101
+ }];
102
+ });
103
+ const style = [
104
+ { innerHTML: radiusStyle, id: `nuxt-ui-radius`, tagPriority: -2 },
105
+ { innerHTML: blackAsPrimaryStyle, id: `nuxt-ui-black-as-primary`, tagPriority: -2 },
106
+ { innerHTML: fontStyle, id: `nuxt-ui-font`, tagPriority: -2 }
107
+ ];
96
108
  const hasCSSChanges = computed(() => {
97
- return appConfig.theme.radius !== 0.25 || appConfig.theme.blackAsPrimary || appConfig.theme.font !== "Public Sans" || appConfig.theme.icons !== "lucide";
109
+ return _radius.value !== (movk?.radius ?? defaultConfig.radius) || _blackAsPrimary.value || _font.value !== (movk?.font ?? defaultConfig.font);
98
110
  });
99
- const hasAppConfigChanges = computed(() => {
100
- return appConfig.ui.colors.primary !== "green" || appConfig.ui.colors.neutral !== "slate";
111
+ const hasConfigChanges = computed(() => {
112
+ return ui.colors.primary !== "blue" || ui.colors.neutral !== "slate" || _iconSet.value !== (movk?.icons ?? defaultConfig.icons);
101
113
  });
102
114
  function exportCSS() {
103
115
  const lines = [
104
116
  '@import "tailwindcss";',
105
117
  '@import "@nuxt/ui";'
106
118
  ];
107
- if (appConfig.theme.font !== "Public Sans") {
108
- lines.push("", "@theme {", ` --font-sans: '${appConfig.theme.font}', sans-serif;`, "}");
119
+ if (_font.value !== defaultConfig.font) {
120
+ lines.push("", "@theme {", ` --font-sans: '${_font.value}', sans-serif;`, "}");
109
121
  }
110
122
  const rootLines = [];
111
- if (appConfig.theme.radius !== 0.25) {
112
- rootLines.push(` --ui-radius: ${appConfig.theme.radius}rem;`);
123
+ if (_radius.value !== defaultConfig.radius) {
124
+ rootLines.push(` --ui-radius: ${_radius.value}rem;`);
113
125
  }
114
- if (appConfig.theme.blackAsPrimary) {
126
+ if (_blackAsPrimary.value) {
115
127
  rootLines.push(" --ui-primary: black;");
116
128
  }
117
129
  if (rootLines.length) {
118
130
  lines.push("", ":root {", ...rootLines, "}");
119
131
  }
120
- if (appConfig.theme.blackAsPrimary) {
121
- lines.push("", ".dark {", " --ui-primary: white;", "}");
132
+ const darkLines = [];
133
+ if (_blackAsPrimary.value) {
134
+ darkLines.push(" --ui-primary: white;");
135
+ }
136
+ if (darkLines.length) {
137
+ lines.push("", ".dark {", ...darkLines, "}");
122
138
  }
123
139
  return lines.join("\n");
124
140
  }
125
- function exportAppConfig() {
141
+ function exportConfig() {
126
142
  const config = {};
127
- if (appConfig.ui.colors.primary !== "green" || appConfig.ui.colors.neutral !== "slate") {
128
- config.ui = { colors: {} };
129
- if (appConfig.ui.colors.primary !== "green") {
130
- config.ui.colors.primary = appConfig.ui.colors.primary;
131
- }
132
- if (appConfig.ui.colors.neutral !== "slate") {
133
- config.ui.colors.neutral = appConfig.ui.colors.neutral;
134
- }
143
+ const defaultColors = {
144
+ primary: "blue",
145
+ neutral: "slate",
146
+ secondary: "blue",
147
+ success: "green",
148
+ info: "blue",
149
+ warning: "yellow",
150
+ error: "red"
151
+ };
152
+ const colorEntries = Object.entries(defaultColors).filter(([key, def]) => ui.colors[key] !== def);
153
+ if (colorEntries.length) {
154
+ config.ui = { colors: Object.fromEntries(colorEntries.map(([key]) => [key, ui.colors[key]])) };
135
155
  }
136
- if (appConfig.theme.icons !== "lucide") {
137
- const iconSet = appConfig.theme.icons;
138
- const icons2 = themeIcons[iconSet];
156
+ if (_iconSet.value !== defaultConfig.icons) {
157
+ const iconMapping = themeIcons[_iconSet.value];
139
158
  config.ui = config.ui || {};
140
- config.ui.icons = icons2;
159
+ config.ui.icons = iconMapping;
141
160
  }
142
161
  const configString = JSON.stringify(config, null, 2).replace(/"([^"]+)":/g, "$1:").replace(/"/g, "'");
143
162
  return `export default defineAppConfig(${configString})`;
144
163
  }
145
164
  function resetTheme() {
146
- appConfig.ui.colors.primary = "green";
147
- window.localStorage.removeItem(`${site.name}-ui-primary`);
148
- appConfig.ui.colors.neutral = "slate";
149
- window.localStorage.removeItem(`${site.name}-ui-neutral`);
150
- appConfig.theme.radius = 0.25;
151
- window.localStorage.removeItem(`${site.name}-ui-radius`);
152
- appConfig.theme.font = "Public Sans";
153
- window.localStorage.removeItem(`${site.name}-ui-font`);
154
- appConfig.theme.icons = "lucide";
155
- appConfig.ui.icons = themeIcons.lucide;
156
- window.localStorage.removeItem(`${site.name}-ui-icons`);
157
- appConfig.theme.blackAsPrimary = false;
158
- window.localStorage.removeItem(`${site.name}-ui-black-as-primary`);
165
+ const defaultPrimary = "blue";
166
+ const defaultNeutral = "slate";
167
+ const defaultIcon = movk?.icons ?? defaultConfig.icons;
168
+ ui.colors.primary = defaultPrimary;
169
+ window.localStorage.removeItem(`${name}-ui-primary`);
170
+ ui.colors.neutral = defaultNeutral;
171
+ window.localStorage.removeItem(`${name}-ui-neutral`);
172
+ _radius.value = movk?.radius ?? defaultConfig.radius;
173
+ _font.value = movk?.font ?? defaultConfig.font;
174
+ _iconSet.value = defaultIcon;
175
+ ui.icons = themeIcons[defaultIcon];
176
+ _blackAsPrimary.value = movk?.blackAsPrimary ?? defaultConfig.blackAsPrimary;
159
177
  }
160
178
  return {
179
+ color,
180
+ style,
181
+ link,
161
182
  neutralColors,
162
183
  neutral,
163
184
  primaryColors,
164
185
  primary,
186
+ blackAsPrimary,
165
187
  setBlackAsPrimary,
166
188
  radiuses,
167
189
  radius,
@@ -172,9 +194,10 @@ export function useTheme() {
172
194
  modes,
173
195
  mode,
174
196
  hasCSSChanges,
175
- hasAppConfigChanges,
197
+ hasConfigChanges,
198
+ configLabel: "app.config.ts",
176
199
  exportCSS,
177
- exportAppConfig,
200
+ exportConfig,
178
201
  resetTheme
179
202
  };
180
203
  }