@movk/nuxt 1.2.0 → 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.
- package/.nuxt/movk-ui.css +3 -0
- package/README.md +74 -79
- package/dist/module.d.mts +57 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +120 -126
- package/dist/runtime/components/AutoForm.d.vue.ts +10 -30
- package/dist/runtime/components/AutoForm.vue +114 -125
- package/dist/runtime/components/AutoForm.vue.d.ts +10 -30
- package/dist/runtime/components/ColorChooser.d.vue.ts +21 -22
- package/dist/runtime/components/ColorChooser.vue +304 -27
- package/dist/runtime/components/ColorChooser.vue.d.ts +21 -22
- package/dist/runtime/components/DataTable.d.vue.ts +57 -0
- package/dist/runtime/components/DataTable.vue +584 -0
- package/dist/runtime/components/DataTable.vue.d.ts +57 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +20 -33
- package/dist/runtime/components/DatePicker.vue +173 -65
- package/dist/runtime/components/DatePicker.vue.d.ts +20 -33
- package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
- package/dist/runtime/components/MessageBox.vue +113 -0
- package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
- package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
- package/dist/runtime/components/PillGroup.vue +291 -0
- package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
- package/dist/runtime/components/Popconfirm.vue +143 -0
- package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
- package/dist/runtime/components/SearchForm.d.vue.ts +21 -149
- package/dist/runtime/components/SearchForm.vue +211 -153
- package/dist/runtime/components/SearchForm.vue.d.ts +21 -149
- package/dist/runtime/components/SlideVerify.d.vue.ts +31 -70
- package/dist/runtime/components/SlideVerify.vue +117 -90
- package/dist/runtime/components/SlideVerify.vue.d.ts +31 -70
- package/dist/runtime/components/StarRating.d.vue.ts +38 -87
- package/dist/runtime/components/StarRating.vue +118 -74
- package/dist/runtime/components/StarRating.vue.d.ts +38 -87
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +11 -15
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +22 -9
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +11 -15
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -13
- package/dist/runtime/components/input/WithCharacterLimit.vue +23 -11
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -13
- package/dist/runtime/components/input/WithClear.d.vue.ts +13 -11
- package/dist/runtime/components/input/WithClear.vue +27 -8
- package/dist/runtime/components/input/WithClear.vue.d.ts +13 -11
- package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -13
- package/dist/runtime/components/input/WithCopy.vue +25 -8
- package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -13
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +13 -16
- package/dist/runtime/components/input/WithFloatingLabel.vue +35 -27
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +13 -16
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue +24 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -7
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +27 -12
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +9 -4
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +9 -4
- package/dist/runtime/composables/index.d.ts +9 -8
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useApiFetch.d.ts +10 -5
- package/dist/runtime/composables/useApiFetch.js +20 -2
- package/dist/runtime/composables/useAutoForm.d.ts +4 -4
- package/dist/runtime/composables/useAutoForm.js +23 -9
- package/dist/runtime/composables/useClientApiFetch.d.ts +3 -2
- package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
- package/dist/runtime/composables/useDateFormatter.js +89 -30
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
- package/dist/runtime/composables/useDownloadWithProgress.js +142 -40
- package/dist/runtime/composables/useLazyApiFetch.d.ts +3 -2
- package/dist/runtime/composables/useMessageBox.d.ts +6 -0
- package/dist/runtime/composables/useMessageBox.js +16 -0
- package/dist/runtime/composables/useTheme.d.ts +26 -16
- package/dist/runtime/composables/useTheme.js +98 -71
- package/dist/runtime/composables/useUploadWithProgress.d.ts +23 -29
- package/dist/runtime/composables/useUploadWithProgress.js +78 -67
- package/dist/runtime/domains/api/auth.d.ts +2 -0
- package/dist/runtime/domains/api/auth.js +31 -0
- package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
- package/dist/runtime/domains/api/endpoint-config.js +17 -0
- package/dist/runtime/domains/api/errors.d.ts +2 -0
- package/dist/runtime/domains/api/errors.js +10 -0
- package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
- package/dist/runtime/domains/api/fetch-key.js +23 -0
- package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
- package/dist/runtime/domains/api/interceptors/error.js +49 -0
- package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
- package/dist/runtime/domains/api/interceptors/request.js +46 -0
- package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
- package/dist/runtime/domains/api/interceptors/response.js +27 -0
- package/dist/runtime/domains/api/response.d.ts +4 -0
- package/dist/runtime/domains/api/response.js +14 -0
- package/dist/runtime/domains/api/toast.d.ts +15 -0
- package/dist/runtime/domains/api/toast.js +46 -0
- package/dist/runtime/domains/api/transfer.d.ts +69 -0
- package/dist/runtime/domains/api/transfer.js +81 -0
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
- package/dist/runtime/domains/auto-form/actions.js +4 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +25 -29
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererChildren.vue → domains/auto-form/components/Children.vue} +18 -18
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererLayout.vue → domains/auto-form/components/Layout.vue} +24 -25
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererNested.vue → domains/auto-form/components/Nested.vue} +17 -21
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
- package/dist/runtime/{auto-form → domains/auto-form}/controls.js +27 -24
- package/dist/runtime/{auto-form/field-utils.d.ts → domains/auto-form/fields.d.ts} +3 -1
- package/dist/runtime/{auto-form/field-utils.js → domains/auto-form/fields.js} +18 -2
- package/dist/runtime/{auto-form → domains/auto-form}/metadata.js +1 -1
- package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
- package/dist/runtime/{auto-form → domains/auto-form}/provider.js +6 -3
- package/dist/runtime/{auto-form/reactive-utils.d.ts → domains/auto-form/reactive.d.ts} +5 -5
- package/dist/runtime/{auto-form/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
- package/dist/runtime/{auto-form/schema-introspector.d.ts → domains/auto-form/schema.d.ts} +2 -2
- package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +1 -1
- package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
- package/dist/runtime/domains/data-table/columns/constants.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
- package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
- package/dist/runtime/domains/data-table/columns/style.js +67 -0
- package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
- package/dist/runtime/domains/data-table/columns/utils.js +16 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
- package/dist/runtime/domains/data-table/indent.d.ts +8 -0
- package/dist/runtime/domains/data-table/indent.js +19 -0
- package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
- package/dist/runtime/domains/data-table/tree-selection.js +76 -0
- package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/api.factory.js +17 -117
- package/dist/runtime/plugins/theme.js +49 -27
- package/dist/runtime/types/api/config.d.ts +127 -0
- package/dist/runtime/types/api/fetch.d.ts +50 -0
- package/dist/runtime/types/api/index.d.ts +5 -0
- package/dist/runtime/types/api/module.d.ts +94 -0
- package/dist/runtime/types/api/response.d.ts +62 -0
- package/dist/runtime/types/api/response.js +0 -0
- package/dist/runtime/types/api/transfer.d.ts +32 -0
- package/dist/runtime/types/api/transfer.js +0 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/auto-form/base.d.ts +26 -0
- package/dist/runtime/types/auto-form/base.js +0 -0
- package/dist/runtime/types/auto-form/component.d.ts +28 -0
- package/dist/runtime/types/auto-form/component.js +0 -0
- package/dist/runtime/types/auto-form/controls.d.ts +45 -0
- package/dist/runtime/types/auto-form/controls.js +0 -0
- package/dist/runtime/types/auto-form/fields.d.ts +68 -0
- package/dist/runtime/types/auto-form/fields.js +0 -0
- package/dist/runtime/types/auto-form/index.d.ts +7 -0
- package/dist/runtime/types/auto-form/index.js +0 -0
- package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
- package/dist/runtime/types/auto-form/search-form.js +0 -0
- package/dist/runtime/types/auto-form/slots.d.ts +85 -0
- package/dist/runtime/types/auto-form/slots.js +0 -0
- package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
- package/dist/runtime/types/auto-form/zod-factory.js +0 -0
- package/dist/runtime/types/components/color-chooser.d.ts +109 -0
- package/dist/runtime/types/components/color-chooser.js +0 -0
- package/dist/runtime/types/components/date-picker.d.ts +41 -0
- package/dist/runtime/types/components/date-picker.js +0 -0
- package/dist/runtime/types/components/index.d.ts +8 -0
- package/dist/runtime/types/components/index.js +0 -0
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
- package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
- package/dist/runtime/types/components/input/index.d.ts +6 -0
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/message-box.d.ts +69 -0
- package/dist/runtime/types/components/message-box.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +103 -0
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +74 -0
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +54 -0
- package/dist/runtime/types/components/slide-verify.js +0 -0
- package/dist/runtime/types/components/star-rating.d.ts +55 -0
- package/dist/runtime/types/components/star-rating.js +0 -0
- package/dist/runtime/types/data-table/columns.d.ts +236 -0
- package/dist/runtime/types/data-table/columns.js +6 -0
- package/dist/runtime/types/data-table/component.d.ts +190 -0
- package/dist/runtime/types/data-table/component.js +0 -0
- package/dist/runtime/types/data-table/contexts.d.ts +44 -0
- package/dist/runtime/types/data-table/contexts.js +0 -0
- package/dist/runtime/types/data-table/index.d.ts +6 -0
- package/dist/runtime/types/data-table/index.js +1 -0
- package/dist/runtime/types/data-table/pagination.d.ts +87 -0
- package/dist/runtime/types/data-table/pagination.js +0 -0
- package/dist/runtime/types/index.d.ts +6 -5
- package/dist/runtime/types/index.js +5 -5
- package/dist/runtime/types/shared.d.ts +5 -0
- package/dist/runtime/types/shared.js +0 -0
- package/dist/runtime/types/zod.d.ts +11 -10
- package/dist/runtime/utils/extend-theme.d.ts +19 -0
- package/dist/runtime/utils/extend-theme.js +44 -0
- package/dist/runtime/utils/form-control.d.ts +33 -0
- package/dist/runtime/utils/form-control.js +54 -0
- package/dist/runtime/utils/meta.d.ts +2 -5
- package/dist/runtime/utils/meta.js +1 -3
- package/dist/runtime/utils/theme-defaults.d.ts +27 -0
- package/dist/runtime/utils/theme-defaults.js +28 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
- package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
- package/dist/runtime/vue/plugins/theme.d.ts +6 -0
- package/dist/runtime/vue/plugins/theme.js +14 -0
- package/dist/runtime/vue/stubs/base.d.ts +2 -0
- package/dist/runtime/vue/stubs/base.js +2 -0
- package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
- package/dist/runtime/vue/stubs/inertia.js +2 -0
- package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
- package/dist/runtime/vue/stubs/movk-extra.js +2 -0
- package/dist/runtime/vue/stubs/none.d.ts +2 -0
- package/dist/runtime/vue/stubs/none.js +2 -0
- package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
- package/dist/runtime/vue/stubs/vue-router.js +2 -0
- package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
- package/dist/types.d.mts +2 -6
- package/dist/unplugin.d.mts +28 -0
- package/dist/unplugin.mjs +292 -0
- package/dist/vite.d.mts +12 -0
- package/dist/vite.mjs +20 -0
- package/package.json +75 -36
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/auto-form/controls.d.ts +0 -221
- package/dist/runtime/auto-form/provider.d.ts +0 -27
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -28
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -28
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -26
- package/dist/runtime/constants/api-defaults.d.ts +0 -9
- package/dist/runtime/constants/api-defaults.js +0 -32
- package/dist/runtime/constants/grid-cols.d.ts +0 -7
- package/dist/runtime/constants/grid-cols.js +0 -44
- package/dist/runtime/style.css +0 -1
- package/dist/runtime/types/api.d.ts +0 -349
- package/dist/runtime/types/auto-form.d.ts +0 -259
- package/dist/runtime/types/module.d.ts +0 -96
- package/dist/runtime/types/theme.d.ts +0 -2
- package/dist/runtime/utils/api-utils.d.ts +0 -58
- package/dist/runtime/utils/api-utils.js +0 -98
- /package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -0
- /package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -0
- /package/dist/runtime/{auto-form → domains/auto-form}/metadata.d.ts +0 -0
- /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
- /package/dist/runtime/types/{api.js → api/config.js} +0 -0
- /package/dist/runtime/types/{auto-form.js → api/fetch.js} +0 -0
- /package/dist/runtime/types/{module.js → api/index.js} +0 -0
- /package/dist/runtime/types/{theme.js → api/module.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://nuxt.mhaibaraai.cn/)
|
|
2
2
|
|
|
3
|
-
> Nuxt
|
|
3
|
+
> 构建在 Nuxt UI 之上的 UI 工程套件 —— Schema 驱动的 AutoForm(Zod v4)、功能完备的 DataTable、独立组件与 Composables。在 Nuxt 4 中获得含认证与进度追踪的 API 集成在内的完整能力;其 UI、表单、表格与主题亦可经 Vite 插件直接用于纯 Vue + Vite 项目(API 集成域仅 Nuxt)。
|
|
4
4
|
|
|
5
5
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink)
|
|
6
6
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink?ide=vscode)
|
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
|
|
17
17
|
## ✨ 特性
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
19
|
+
Movk Nuxt 是构建在 Nuxt UI 之上的 UI 工程套件,提供两种使用方式:在 **Nuxt 4** 中享受含 API 集成的完整能力,或经 **Vite 插件**在纯 **Vue + Vite** 项目中使用其 UI 层。各能力的可用框架如下:
|
|
20
|
+
|
|
21
|
+
- **AutoForm — Schema 驱动表单**(✅ Nuxt | ✅ Vue + Vite)- 基于 Zod v4 的「定义即渲染」,一份 Schema 同时声明数据结构、验证规则和 UI 配置,自动生成完整表单界面。
|
|
22
|
+
- **DataTable — 数据表格**(✅ Nuxt | ✅ Vue + Vite)- 基于 TanStack Table 封装,覆盖数据列、特殊列(选择/索引/展开/操作)、树形数据、行交互、外观定制、分页与加载更多。
|
|
23
|
+
- **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、StarRating、PillGroup、SearchForm、WithCopy、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
|
|
24
|
+
- **主题与 Composables**(✅ Nuxt | ✅ Vue + Vite)- useTheme(主题读写与导出)、useMessageBox(命令式弹窗)、useDateFormatter(国际化日期)等非服务端组合式函数。
|
|
25
|
+
- **API 集成系统**(✅ Nuxt | ❌ Vue + Vite)- useApiFetch / useLazyApiFetch / useClientApiFetch 三件套 + useUploadWithProgress / useDownloadWithProgress,提供多端点、自动认证、业务状态码检查、数据解包、Toast 提示和进度监控;**依赖 Nuxt 服务端运行时,仅 Nuxt 模式可用**。
|
|
26
|
+
- **类型安全** - 完整的 TypeScript 类型推断,从 Schema 到表单数据,组件 prop 回调与事件处理类型可索引访问派生。
|
|
27
|
+
- **AI 友好** - 内置 MCP Server 与 llms.txt,组件、composable、文档可被 AI 智能体检索。
|
|
26
28
|
|
|
27
29
|
## 🚀 快速开始
|
|
28
30
|
|
|
@@ -39,27 +41,57 @@ yarn add @movk/nuxt @nuxt/ui zod
|
|
|
39
41
|
npm install @movk/nuxt @nuxt/ui zod
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
###
|
|
44
|
+
### Nuxt
|
|
43
45
|
|
|
44
46
|
在 `nuxt.config.ts` 中注册模块:
|
|
45
47
|
|
|
46
48
|
```ts
|
|
47
49
|
export default defineNuxtConfig({
|
|
48
|
-
modules: ['@movk/nuxt']
|
|
50
|
+
modules: ['@movk/nuxt'],
|
|
51
|
+
movk: {
|
|
52
|
+
prefix: 'M' // 组件前缀,默认为 'M'
|
|
53
|
+
}
|
|
49
54
|
})
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
### Vue / Vite
|
|
58
|
+
|
|
59
|
+
在纯 Vue + Vite 项目中,经 Vite 插件 + Vue 插件使用 UI 层(组件、主题、AutoForm、DataTable、非服务端 Composables)。**API 集成域在此模式下不可用。**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm add @movk/nuxt @nuxt/ui zod tailwindcss vue-router
|
|
63
|
+
```
|
|
53
64
|
|
|
54
65
|
```ts
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
// vite.config.ts
|
|
67
|
+
import { defineConfig } from 'vite'
|
|
68
|
+
import vue from '@vitejs/plugin-vue'
|
|
69
|
+
import movk from '@movk/nuxt/vite'
|
|
70
|
+
|
|
71
|
+
export default defineConfig({
|
|
72
|
+
plugins: [vue(), movk()]
|
|
60
73
|
})
|
|
61
74
|
```
|
|
62
75
|
|
|
76
|
+
```ts
|
|
77
|
+
// src/main.ts
|
|
78
|
+
import './assets/css/main.css'
|
|
79
|
+
import { createApp } from 'vue'
|
|
80
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
81
|
+
import movk from '@movk/nuxt/vue-plugin'
|
|
82
|
+
import App from './App.vue'
|
|
83
|
+
|
|
84
|
+
const router = createRouter({ routes: [], history: createWebHistory() })
|
|
85
|
+
createApp(App).use(router).use(movk).mount('#app')
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
/* src/assets/css/main.css —— 已串联 Tailwind CSS + Nuxt UI + Movk 主题 */
|
|
90
|
+
@import "@movk/nuxt";
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
根组件用 `<UApp>` 包裹(Toast / Tooltip / useMessageBox 必需)。详见[在线文档 · Vue / Vite](https://nuxt.mhaibaraai.cn/docs/getting-started/vue)。
|
|
94
|
+
|
|
63
95
|
### 基础示例
|
|
64
96
|
|
|
65
97
|
创建一个简单的用户注册表单:
|
|
@@ -97,6 +129,27 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
|
|
|
97
129
|
|
|
98
130
|
## 📦 核心功能
|
|
99
131
|
|
|
132
|
+
### 独立组件
|
|
133
|
+
|
|
134
|
+
可直接使用的高质量 UI 组件,涵盖输入增强、表单、反馈与高级交互四类。
|
|
135
|
+
|
|
136
|
+
### DataTable - 功能完备的数据表格
|
|
137
|
+
|
|
138
|
+
基于 TanStack Table 封装的 `MDataTable`,以声明式列配置驱动:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import type { DataTableColumn } from '@movk/nuxt'
|
|
142
|
+
|
|
143
|
+
const columns: DataTableColumn<Person>[] = [
|
|
144
|
+
{ type: 'selection' }, // 特殊列:行选择
|
|
145
|
+
{ accessorKey: 'name', header: '姓名', sortable: true, pinable: true },
|
|
146
|
+
{ accessorKey: 'salary', header: '薪资', sortable: true, truncate: true },
|
|
147
|
+
{ type: 'actions', actions: row => [{ label: '编辑', onClick: () => edit(row) }] }
|
|
148
|
+
]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
支持数据列(排序/列固定/列宽拖拽/截断+Tooltip/可见性)、特殊列(选择/索引/展开/操作/分组)、树形数据与级联选择、行交互(点击/展开/右键菜单)、外观定制、客户端/服务端分页与加载更多。
|
|
152
|
+
|
|
100
153
|
### AutoForm - Schema 驱动的表单系统
|
|
101
154
|
|
|
102
155
|
基于 Zod Schema 的"定义即渲染"表单解决方案:
|
|
@@ -127,56 +180,6 @@ const schema = afz.object({
|
|
|
127
180
|
})
|
|
128
181
|
```
|
|
129
182
|
|
|
130
|
-
**支持的控件类型**:
|
|
131
|
-
- 基础输入: `UInput`、`UInputNumber`、`UCheckbox`、`USwitch`
|
|
132
|
-
- 选择器: `USelect`、`USelectMenu`、`URadioGroup`、`UCheckboxGroup`
|
|
133
|
-
- 高级输入: `UTextarea`、`USlider`、`UPinInput`、`UInputTags`
|
|
134
|
-
- 自定义组件: `DatePicker`、`ColorChooser`、`StarRating`
|
|
135
|
-
- 文件上传: `UFileUpload`
|
|
136
|
-
- 增强输入: `WithCopy`、`WithClear`、`WithPasswordToggle`、`WithCharacterLimit`
|
|
137
|
-
|
|
138
|
-
### 独立组件
|
|
139
|
-
|
|
140
|
-
无需依赖 AutoForm,可直接使用的高质量 UI 组件:
|
|
141
|
-
|
|
142
|
-
#### 日期选择器
|
|
143
|
-
|
|
144
|
-
```vue
|
|
145
|
-
<template>
|
|
146
|
-
<MDatePicker v-model="selectedDate" label-format="iso" />
|
|
147
|
-
</template>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### 输入增强组件
|
|
151
|
-
|
|
152
|
-
```vue
|
|
153
|
-
<template>
|
|
154
|
-
<!-- 带复制功能 -->
|
|
155
|
-
<MWithCopy v-model="apiKey" />
|
|
156
|
-
|
|
157
|
-
<!-- 带清除按钮 -->
|
|
158
|
-
<MWithClear v-model="searchText" />
|
|
159
|
-
|
|
160
|
-
<!-- 密码显隐切换 -->
|
|
161
|
-
<MWithPasswordToggle v-model="password" />
|
|
162
|
-
|
|
163
|
-
<!-- 字符数限制 -->
|
|
164
|
-
<MWithCharacterLimit v-model="bio" :max-length="200" />
|
|
165
|
-
</template>
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### 交互组件
|
|
169
|
-
|
|
170
|
-
```vue
|
|
171
|
-
<template>
|
|
172
|
-
<!-- 星级评分 -->
|
|
173
|
-
<MStarRating v-model="rating" :max="5" />
|
|
174
|
-
|
|
175
|
-
<!-- 颜色选择器 -->
|
|
176
|
-
<MColorChooser v-model="color" />
|
|
177
|
-
</template>
|
|
178
|
-
```
|
|
179
|
-
|
|
180
183
|
### Composables
|
|
181
184
|
|
|
182
185
|
#### useDateFormatter
|
|
@@ -269,11 +272,11 @@ await download('/api/export/report', {
|
|
|
269
272
|
|
|
270
273
|
Movk Nuxt 采用清晰的分层架构:
|
|
271
274
|
|
|
272
|
-
- **Core Systems** - AutoForm
|
|
273
|
-
- **API System** - useApiFetch、useUploadWithProgress、useDownloadWithProgress,提供完整的 API 请求方案
|
|
274
|
-
- **Standalone Components** - DatePicker、StarRating、WithCopy 等独立 UI 组件
|
|
275
|
-
- **Composables** - useDateFormatter、useAutoForm 等通用组合式函数
|
|
276
|
-
- **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)
|
|
275
|
+
- **Core Systems** - AutoForm(Schema 驱动表单)、DataTable(数据表格)
|
|
276
|
+
- **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch、useUploadWithProgress、useDownloadWithProgress,提供完整的 API 请求方案
|
|
277
|
+
- **Standalone Components** - DatePicker、StarRating、PillGroup、SearchForm、WithCopy、ThemePicker 等独立 UI 组件
|
|
278
|
+
- **Composables** - useDateFormatter、useTheme、useMessageBox、useAutoForm 等通用组合式函数
|
|
279
|
+
- **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)、[TanStack Table](https://tanstack.com/table)
|
|
277
280
|
|
|
278
281
|
## ⚡ 技术栈
|
|
279
282
|
|
|
@@ -284,14 +287,6 @@ Movk Nuxt 采用清晰的分层架构:
|
|
|
284
287
|
- [VueUse](https://vueuse.org/) - Collection of Vue Composition Utilities
|
|
285
288
|
- [Vitest](https://vitest.dev/) - Next Generation Testing Framework
|
|
286
289
|
|
|
287
|
-
## 🗺️ 开发路线图
|
|
288
|
-
|
|
289
|
-
- ✅ **AutoForm** - Schema 驱动的表单系统(已发布)
|
|
290
|
-
- ✅ **API System** - API 请求封装(已发布)
|
|
291
|
-
- useApiFetch、useClientApiFetch - API 请求
|
|
292
|
-
- useUploadWithProgress、useDownloadWithProgress - 进度监控
|
|
293
|
-
- ✅ **独立组件库** - DatePicker、StarRating、WithCopy 等组件(已发布)
|
|
294
|
-
|
|
295
290
|
## 📄 许可证
|
|
296
291
|
|
|
297
292
|
[MIT](./LICENSE) License © 2024-PRESENT [YiXuan](https://github.com/mhaibaraai)
|
package/dist/module.d.mts
CHANGED
|
@@ -1,7 +1,63 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { MovkApiFullConfig } from '../dist/runtime/types/api/module.js';
|
|
3
|
+
import { ModuleOptions as ModuleOptions$1 } from '@nuxt/ui';
|
|
3
4
|
export * from '../dist/runtime/types/index.js';
|
|
4
5
|
|
|
6
|
+
interface ThemeFontConfig {
|
|
7
|
+
/** 字体名称 */
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* 字体 CSS 文件的完整 URL;未提供时运行时回退到 Google Fonts URL
|
|
11
|
+
* @example 'https://cdn.mhaibaraai.cn/fonts/alibaba-puhuiti.css'
|
|
12
|
+
*/
|
|
13
|
+
href?: string;
|
|
14
|
+
}
|
|
15
|
+
type StrictUiTheme = {
|
|
16
|
+
[K in keyof NonNullable<ModuleOptions$1['theme']>]?: Exclude<NonNullable<ModuleOptions$1['theme']>[K], null>;
|
|
17
|
+
};
|
|
18
|
+
interface ModuleOptions {
|
|
19
|
+
/**
|
|
20
|
+
* 组件前缀
|
|
21
|
+
* @defaultValue 'M'
|
|
22
|
+
*/
|
|
23
|
+
prefix?: string;
|
|
24
|
+
/** API 模块配置 */
|
|
25
|
+
api?: MovkApiFullConfig;
|
|
26
|
+
/** 主题模块配置 */
|
|
27
|
+
theme?: {
|
|
28
|
+
/**
|
|
29
|
+
* 是否启用主题模块(appConfig 默认值、theme plugin、ThemePicker 组件)
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Define the color aliases available for components
|
|
35
|
+
* @defaultValue `['primary', 'secondary', 'success', 'info', 'warning', 'error']`
|
|
36
|
+
* @see https://ui.nuxt.com/docs/getting-started/installation/nuxt#themecolors
|
|
37
|
+
*/
|
|
38
|
+
colors?: StrictUiTheme['colors'];
|
|
39
|
+
/**
|
|
40
|
+
* The default variants to use for components
|
|
41
|
+
* @defaultValue 'nuxt.options.ui.theme.defaultVariants'
|
|
42
|
+
* @see https://ui.nuxt.com/docs/getting-started/installation/nuxt#themedefaultvariants
|
|
43
|
+
*/
|
|
44
|
+
defaultVariants?: StrictUiTheme['defaultVariants'];
|
|
45
|
+
/**
|
|
46
|
+
* Prefix for Tailwind CSS utility classes
|
|
47
|
+
* @defaultValue 'nuxt.options.ui.theme.prefix'
|
|
48
|
+
* @see https://ui.nuxt.com/docs/getting-started/installation/nuxt#themeprefix
|
|
49
|
+
* @example 'tw'
|
|
50
|
+
*/
|
|
51
|
+
prefix?: StrictUiTheme['prefix'];
|
|
52
|
+
/** ThemePicker 字体可选项;提供时完整替换内置列表 */
|
|
53
|
+
fonts?: ThemeFontConfig[];
|
|
54
|
+
/** ThemePicker 圆角可选项 */
|
|
55
|
+
radiuses?: number[];
|
|
56
|
+
/** ThemePicker neutral 颜色可选项 */
|
|
57
|
+
neutralColors?: string[];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
5
60
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
6
61
|
|
|
7
62
|
export { _default as default };
|
|
63
|
+
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,125 +1,117 @@
|
|
|
1
1
|
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
import defu, { defu as defu$1 } from 'defu';
|
|
3
|
-
import {
|
|
3
|
+
import { a as addTemplates } from './shared/nuxt.DfBEyjld.mjs';
|
|
4
4
|
import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
|
|
5
|
-
import {
|
|
5
|
+
import { kebabCase } from 'scule';
|
|
6
|
+
import { updateSiteConfig } from 'nuxt-site-config/kit';
|
|
7
|
+
import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
|
|
6
8
|
export * from '../dist/runtime/types/index.js';
|
|
9
|
+
import 'node:url';
|
|
7
10
|
|
|
8
11
|
const name = "@movk/nuxt";
|
|
9
|
-
const version = "1.
|
|
12
|
+
const version = "1.3.0";
|
|
10
13
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, {
|
|
20
|
-
colors: {
|
|
21
|
-
primary: "sky",
|
|
22
|
-
secondary: "blue",
|
|
23
|
-
success: "green",
|
|
24
|
-
info: "blue",
|
|
25
|
-
warning: "yellow",
|
|
26
|
-
error: "red",
|
|
27
|
-
neutral: "slate"
|
|
14
|
+
function getDefaultApiConfig(apiConfig) {
|
|
15
|
+
const publicEndpoints = {};
|
|
16
|
+
const privateEndpoints = {};
|
|
17
|
+
if (apiConfig?.endpoints) {
|
|
18
|
+
for (const [key, { headers, ...rest }] of Object.entries(apiConfig.endpoints)) {
|
|
19
|
+
publicEndpoints[key] = rest;
|
|
20
|
+
if (headers) privateEndpoints[key] = { headers };
|
|
28
21
|
}
|
|
29
|
-
}
|
|
22
|
+
}
|
|
23
|
+
const endpoints = { default: { baseURL: "/api" }, ...publicEndpoints };
|
|
24
|
+
const publicConfig = {
|
|
25
|
+
defaultEndpoint: apiConfig?.defaultEndpoint ?? "default",
|
|
26
|
+
debug: apiConfig?.debug ?? false,
|
|
27
|
+
endpoints,
|
|
28
|
+
response: defu(
|
|
29
|
+
apiConfig?.response,
|
|
30
|
+
{
|
|
31
|
+
successCodes: [200, 0, "200", "0"],
|
|
32
|
+
codeKey: "code",
|
|
33
|
+
messageKey: "message",
|
|
34
|
+
dataKey: "data"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
auth: defu(
|
|
38
|
+
apiConfig?.auth,
|
|
39
|
+
{
|
|
40
|
+
enabled: false,
|
|
41
|
+
tokenSource: "session",
|
|
42
|
+
sessionTokenPath: "token",
|
|
43
|
+
tokenType: "Bearer",
|
|
44
|
+
headerName: "Authorization",
|
|
45
|
+
unauthorized: {
|
|
46
|
+
redirect: true,
|
|
47
|
+
clearSession: true,
|
|
48
|
+
loginPath: "/login"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
toast: defu(
|
|
53
|
+
apiConfig?.toast,
|
|
54
|
+
{
|
|
55
|
+
enabled: true,
|
|
56
|
+
success: {
|
|
57
|
+
show: true,
|
|
58
|
+
color: "success",
|
|
59
|
+
icon: "i-lucide-circle-check"
|
|
60
|
+
},
|
|
61
|
+
error: {
|
|
62
|
+
show: true,
|
|
63
|
+
color: "error",
|
|
64
|
+
icon: "i-lucide-circle-x"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
};
|
|
69
|
+
const privateConfig = {
|
|
70
|
+
endpoints: Object.keys(privateEndpoints).length > 0 ? privateEndpoints : void 0
|
|
71
|
+
};
|
|
72
|
+
return { publicConfig, privateConfig };
|
|
73
|
+
}
|
|
74
|
+
const defaultOptions = {
|
|
75
|
+
prefix: "M",
|
|
76
|
+
theme: {
|
|
77
|
+
enabled: true
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
function addTheme(nuxt, resolve, theme) {
|
|
82
|
+
if (theme?.enabled === false) return;
|
|
30
83
|
nuxt.options.app.head.meta = nuxt.options.app.head.meta || [];
|
|
31
84
|
nuxt.options.app.head.meta.push(
|
|
32
85
|
{ charset: "utf-8" },
|
|
33
86
|
{ name: "viewport", content: "width=device-width, initial-scale=1" }
|
|
34
87
|
);
|
|
35
88
|
nuxt.options.app.head.htmlAttrs = defu(nuxt.options.app.head.htmlAttrs || {}, {
|
|
36
|
-
lang: "zh-CN",
|
|
37
89
|
dir: "ltr"
|
|
38
90
|
});
|
|
91
|
+
nuxt.options.appConfig.movk = defu(
|
|
92
|
+
nuxt.options.appConfig.movk || {},
|
|
93
|
+
getDefaultConfig(theme)
|
|
94
|
+
);
|
|
95
|
+
nuxt.options.appConfig.ui = defu(
|
|
96
|
+
{
|
|
97
|
+
colors: {
|
|
98
|
+
primary: "blue",
|
|
99
|
+
secondary: "blue",
|
|
100
|
+
success: "green",
|
|
101
|
+
info: "blue",
|
|
102
|
+
warning: "yellow",
|
|
103
|
+
error: "red",
|
|
104
|
+
neutral: "slate"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
nuxt.options.appConfig.ui || {}
|
|
108
|
+
);
|
|
39
109
|
addPlugin({
|
|
40
110
|
src: resolve("runtime/plugins/theme"),
|
|
41
111
|
mode: "all"
|
|
42
112
|
});
|
|
43
113
|
}
|
|
44
114
|
|
|
45
|
-
const WEIGHT_MAP = {
|
|
46
|
-
100: "Thin",
|
|
47
|
-
300: "Light",
|
|
48
|
-
400: "Regular",
|
|
49
|
-
500: "Medium",
|
|
50
|
-
600: "SemiBold",
|
|
51
|
-
700: "Bold",
|
|
52
|
-
800: "ExtraBold",
|
|
53
|
-
900: "Heavy",
|
|
54
|
-
950: "Black"
|
|
55
|
-
};
|
|
56
|
-
const FONT_FAMILY = "Alibaba PuHuiTi";
|
|
57
|
-
function createAlibabaPuHuiTiProvider(cdnBase) {
|
|
58
|
-
return defineFontProvider("alibaba-puhuiti", () => ({
|
|
59
|
-
async resolveFont(fontFamily, options) {
|
|
60
|
-
if (fontFamily !== FONT_FAMILY) return void 0;
|
|
61
|
-
const weights = options.weights?.length ? options.weights.filter((w) => WEIGHT_MAP[w]) : Object.keys(WEIGHT_MAP);
|
|
62
|
-
const fonts = weights.map((weight) => ({
|
|
63
|
-
src: [{ url: `${cdnBase}/AlibabaPuHuiTi-${WEIGHT_MAP[weight]}.woff2`, format: "woff2" }],
|
|
64
|
-
weight,
|
|
65
|
-
style: "normal"
|
|
66
|
-
}));
|
|
67
|
-
return { fonts };
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const FONT_PROVIDERS = [
|
|
73
|
-
{
|
|
74
|
-
key: "alibabaPuhuiti",
|
|
75
|
-
providerKey: "alibaba-puhuiti",
|
|
76
|
-
create: createAlibabaPuHuiTiProvider
|
|
77
|
-
}
|
|
78
|
-
];
|
|
79
|
-
const BUNNY_FONT_NAMES = ["Public Sans", "DM Sans", "Geist", "Inter", "Poppins", "Outfit", "Raleway"];
|
|
80
|
-
function setupFonts(options, nuxt) {
|
|
81
|
-
if (options.fonts?.enabled === false) return;
|
|
82
|
-
const nuxtOpts = nuxt.options;
|
|
83
|
-
nuxtOpts.fonts = nuxtOpts.fonts || {};
|
|
84
|
-
nuxtOpts.fonts.families = nuxtOpts.fonts.families || [];
|
|
85
|
-
const existingNames = new Set(nuxtOpts.fonts.families.map((f) => f.name));
|
|
86
|
-
for (const name of BUNNY_FONT_NAMES) {
|
|
87
|
-
if (!existingNames.has(name)) {
|
|
88
|
-
nuxtOpts.fonts.families.push({ name, provider: "bunny" });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const active = FONT_PROVIDERS.filter((fp) => options.fonts?.[fp.key]?.cdn);
|
|
92
|
-
if (!active.length) return;
|
|
93
|
-
nuxt.hook("fonts:providers", (providers) => {
|
|
94
|
-
for (const fp of active) {
|
|
95
|
-
providers[fp.providerKey] = fp.create(options.fonts[fp.key].cdn);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function buildApiRuntimeConfig(apiConfig) {
|
|
101
|
-
const publicEndpoints = {};
|
|
102
|
-
const privateEndpoints = {};
|
|
103
|
-
if (apiConfig.endpoints) {
|
|
104
|
-
for (const [key, { headers, ...rest }] of Object.entries(apiConfig.endpoints)) {
|
|
105
|
-
publicEndpoints[key] = rest;
|
|
106
|
-
if (headers) privateEndpoints[key] = { headers };
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const hasEndpoints = Object.keys(publicEndpoints).length > 0;
|
|
110
|
-
const publicConfig = {
|
|
111
|
-
defaultEndpoint: apiConfig.defaultEndpoint ?? "default",
|
|
112
|
-
debug: apiConfig.debug ?? false,
|
|
113
|
-
endpoints: hasEndpoints ? publicEndpoints : DEFAULT_ENDPOINT,
|
|
114
|
-
response: defu$1(apiConfig.response, DEFAULT_RESPONSE_CONFIG),
|
|
115
|
-
auth: defu$1(apiConfig.auth, DEFAULT_AUTH_CONFIG),
|
|
116
|
-
toast: defu$1(apiConfig.toast, DEFAULT_TOAST_CONFIG)
|
|
117
|
-
};
|
|
118
|
-
const privateConfig = {
|
|
119
|
-
endpoints: Object.keys(privateEndpoints).length > 0 ? privateEndpoints : void 0
|
|
120
|
-
};
|
|
121
|
-
return { publicConfig, privateConfig };
|
|
122
|
-
}
|
|
123
115
|
const module$1 = defineNuxtModule({
|
|
124
116
|
meta: {
|
|
125
117
|
name,
|
|
@@ -127,36 +119,21 @@ const module$1 = defineNuxtModule({
|
|
|
127
119
|
configKey: "movk",
|
|
128
120
|
compatibility: { nuxt: ">=4.4.2" }
|
|
129
121
|
},
|
|
130
|
-
defaults:
|
|
131
|
-
prefix: "M",
|
|
132
|
-
theme: {
|
|
133
|
-
enabled: true
|
|
134
|
-
},
|
|
135
|
-
fonts: {
|
|
136
|
-
enabled: true,
|
|
137
|
-
alibabaPuhuiti: {
|
|
138
|
-
cdn: "https://cdn.mhaibaraai.cn/fonts"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
122
|
+
defaults: defaultOptions,
|
|
142
123
|
moduleDependencies: {
|
|
143
|
-
"@vueuse/nuxt": { version: ">=14.2.1" },
|
|
144
124
|
"@nuxt/image": { version: ">=2.0.0" },
|
|
145
|
-
"@nuxt/ui": { version: ">=4.6.0" },
|
|
146
|
-
"nuxt
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
"nuxt-auth-utils": { version: ">=0.5.29" }
|
|
125
|
+
"@nuxt/ui": { version: ">=4.6.0", defaults: { fonts: false } },
|
|
126
|
+
"@vueuse/nuxt": { version: ">=14.2.1" },
|
|
127
|
+
"nuxt-auth-utils": { version: ">=0.5.29" },
|
|
128
|
+
"nuxt-site-config": { version: ">=4.0.8" }
|
|
151
129
|
},
|
|
152
130
|
async setup(options, nuxt) {
|
|
153
131
|
const { resolve } = createResolver(import.meta.url);
|
|
154
|
-
|
|
155
|
-
setupFonts(options, nuxt);
|
|
132
|
+
nuxt.options.movk = options;
|
|
156
133
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
157
134
|
nuxt.options.css = nuxt.options.css || [];
|
|
158
|
-
nuxt.options.css.push(resolve("runtime/
|
|
159
|
-
const componentIgnore = [
|
|
135
|
+
nuxt.options.css.push(resolve("runtime/index.css"));
|
|
136
|
+
const componentIgnore = [];
|
|
160
137
|
if (options.theme?.enabled === false) {
|
|
161
138
|
componentIgnore.push("theme-picker/**");
|
|
162
139
|
}
|
|
@@ -169,14 +146,31 @@ const module$1 = defineNuxtModule({
|
|
|
169
146
|
addImportsDir(resolve("runtime/composables"));
|
|
170
147
|
const apiConfig = options.api ?? {};
|
|
171
148
|
if (apiConfig.enabled !== false) {
|
|
172
|
-
const { publicConfig, privateConfig } =
|
|
149
|
+
const { publicConfig, privateConfig } = getDefaultApiConfig(apiConfig);
|
|
173
150
|
nuxt.options.runtimeConfig.movkApi = privateConfig;
|
|
174
151
|
nuxt.options.runtimeConfig.public.movkApi = publicConfig;
|
|
175
152
|
addPlugin({ src: resolve("runtime/plugins/api.factory"), mode: "all" });
|
|
176
153
|
}
|
|
177
154
|
const meta = await getPackageJsonMetadata(nuxt.options.rootDir);
|
|
178
|
-
nuxt.
|
|
179
|
-
|
|
155
|
+
nuxt.hook("modules:done", async () => {
|
|
156
|
+
const site = defu$1(nuxt.options.site, {
|
|
157
|
+
name: kebabCase(meta.name || "") || "movk",
|
|
158
|
+
description: meta.description,
|
|
159
|
+
debug: false
|
|
160
|
+
});
|
|
161
|
+
updateSiteConfig(site);
|
|
162
|
+
const uiTheme = nuxt.options.ui?.theme;
|
|
163
|
+
const themeDefaults = {
|
|
164
|
+
prefix: uiTheme?.prefix ?? void 0,
|
|
165
|
+
colors: uiTheme?.colors ?? void 0,
|
|
166
|
+
defaultVariants: uiTheme?.defaultVariants ?? void 0
|
|
167
|
+
};
|
|
168
|
+
options.theme = defu$1(options.theme || {}, themeDefaults);
|
|
169
|
+
addTheme(nuxt, resolve, options.theme);
|
|
170
|
+
await addTemplates(options, nuxt);
|
|
171
|
+
});
|
|
172
|
+
nuxt.hook("prepare:types", ({ references }) => {
|
|
173
|
+
references.push({ path: resolve("./runtime/types/app.config.d.ts") });
|
|
180
174
|
});
|
|
181
175
|
}
|
|
182
176
|
});
|
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentConfig, InferInput } from '@nuxt/ui';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 是否显示默认提交按钮
|
|
8
|
-
* @defaultValue true
|
|
9
|
-
*/
|
|
10
|
-
submitButton?: boolean;
|
|
11
|
-
/** 提交按钮属性 */
|
|
12
|
-
submitButtonProps?: ButtonProps;
|
|
13
|
-
/** 自定义控件映射 */
|
|
14
|
-
controls?: AutoFormControls;
|
|
15
|
-
/** 全局字段元数据配置 */
|
|
16
|
-
globalMeta?: ZodAutoFormFieldMeta;
|
|
17
|
-
/** 数组字段添加按钮属性 */
|
|
18
|
-
addButtonProps?: ButtonProps;
|
|
19
|
-
loadingAuto?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface AutoFormEmits<S extends z.ZodObject, T extends boolean = true> extends FormEmits<S, T> {
|
|
22
|
-
}
|
|
23
|
-
export type AutoFormSlots<T extends object> = {
|
|
24
|
-
header: (props: AutoFormSlotProps<T>) => any;
|
|
25
|
-
footer: (props: AutoFormSlotProps<T>) => any;
|
|
26
|
-
submit: (props: AutoFormSlotProps<T>) => any;
|
|
27
|
-
} & DynamicFormSlots<T>;
|
|
3
|
+
import type { AutoFormProps, AutoFormSlots } from '../types/auto-form/component';
|
|
4
|
+
import theme from '#build/movk-ui/auto-form';
|
|
5
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
28
6
|
declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N 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<{
|
|
29
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormProps<S, T, N> & {
|
|
30
|
-
|
|
7
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
|
|
8
|
+
ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
|
|
9
|
+
}) & {
|
|
10
|
+
onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
31
11
|
}> & (typeof globalThis extends {
|
|
32
12
|
__VLS_PROPS_FALLBACK: infer P;
|
|
33
13
|
} ? P : {});
|
|
34
14
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
35
|
-
formRef: any
|
|
15
|
+
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
36
16
|
reset: () => void;
|
|
37
17
|
clear: () => void;
|
|
38
18
|
}>) => void;
|
|
39
19
|
attrs: any;
|
|
40
20
|
slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
|
|
41
|
-
emit:
|
|
21
|
+
emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
|
|
42
22
|
}>) => import("vue").VNode & {
|
|
43
23
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
44
24
|
};
|