@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.
- package/.nuxt/movk-ui.css +3 -0
- package/README.md +75 -104
- package/dist/module.d.mts +59 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +136 -56
- package/dist/runtime/components/AutoForm.d.vue.ts +10 -31
- package/dist/runtime/components/AutoForm.vue +114 -148
- package/dist/runtime/components/AutoForm.vue.d.ts +10 -31
- package/dist/runtime/components/ColorChooser.d.vue.ts +20 -17
- package/dist/runtime/components/ColorChooser.vue +305 -31
- package/dist/runtime/components/ColorChooser.vue.d.ts +20 -17
- 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 +15 -22
- package/dist/runtime/components/DatePicker.vue +173 -65
- package/dist/runtime/components/DatePicker.vue.d.ts +15 -22
- 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 +43 -0
- package/dist/runtime/components/SearchForm.vue +274 -0
- package/dist/runtime/components/SearchForm.vue.d.ts +43 -0
- package/dist/runtime/components/SlideVerify.d.vue.ts +13 -79
- package/dist/runtime/components/SlideVerify.vue +117 -90
- package/dist/runtime/components/SlideVerify.vue.d.ts +13 -79
- package/dist/runtime/components/StarRating.d.vue.ts +25 -82
- package/dist/runtime/components/StarRating.vue +128 -99
- package/dist/runtime/components/StarRating.vue.d.ts +25 -82
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +32 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +48 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +32 -0
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCharacterLimit.vue +27 -15
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithClear.d.vue.ts +11 -5
- package/dist/runtime/components/input/WithClear.vue +29 -10
- package/dist/runtime/components/input/WithClear.vue.d.ts +11 -5
- package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCopy.vue +28 -11
- package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +33 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue +75 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +33 -0
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue +27 -10
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +13 -7
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +37 -28
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +5 -6
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +5 -6
- package/dist/runtime/composables/index.d.ts +9 -8
- package/dist/runtime/composables/index.js +2 -1
- package/dist/runtime/composables/useApiFetch.d.ts +23 -15
- package/dist/runtime/composables/useApiFetch.js +21 -28
- package/dist/runtime/composables/useAutoForm.d.ts +14 -98
- package/dist/runtime/composables/useAutoForm.js +55 -161
- package/dist/runtime/composables/useClientApiFetch.d.ts +7 -7
- 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 +143 -42
- package/dist/runtime/composables/useLazyApiFetch.d.ts +19 -0
- package/dist/runtime/composables/useLazyApiFetch.js +4 -0
- package/dist/runtime/composables/useMessageBox.d.ts +6 -0
- package/dist/runtime/composables/useMessageBox.js +16 -0
- package/dist/runtime/composables/useTheme.d.ts +21 -8
- package/dist/runtime/composables/useTheme.js +109 -86
- package/dist/runtime/composables/useUploadWithProgress.d.ts +22 -28
- package/dist/runtime/composables/useUploadWithProgress.js +79 -68
- 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} +37 -48
- 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/domains/auto-form/components/Children.vue +50 -0
- 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/domains/auto-form/components/Layout.vue +89 -0
- 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/domains/auto-form/components/Nested.vue +47 -0
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
- package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -2
- package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -25
- package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
- package/dist/runtime/domains/auto-form/controls.js +73 -0
- package/dist/runtime/{utils/field-utils.d.ts → domains/auto-form/fields.d.ts} +7 -21
- package/dist/runtime/{utils/field-utils.js → domains/auto-form/fields.js} +19 -4
- package/dist/runtime/domains/auto-form/metadata.d.ts +22 -0
- package/dist/runtime/domains/auto-form/metadata.js +53 -0
- package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
- package/dist/runtime/{internal/useAutoFormProvider.js → domains/auto-form/provider.js} +6 -3
- package/dist/runtime/domains/auto-form/reactive.d.ts +12 -0
- package/dist/runtime/{utils/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
- package/dist/runtime/domains/auto-form/schema.d.ts +7 -0
- package/dist/runtime/{utils/schema-introspector.js → domains/auto-form/schema.js} +12 -10
- 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 +28 -171
- package/dist/runtime/plugins/theme.js +72 -70
- 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/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 +19 -17
- 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 +4 -0
- package/dist/runtime/utils/meta.js +14 -0
- 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 +82 -42
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +0 -125
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +0 -105
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -20
- package/dist/runtime/composables/useApiAuth.d.ts +0 -47
- package/dist/runtime/composables/useApiAuth.js +0 -66
- package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
- package/dist/runtime/schemas/api.d.ts +0 -590
- package/dist/runtime/schemas/api.js +0 -228
- package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
- package/dist/runtime/server/api/_movk/session.post.js +0 -18
- package/dist/runtime/style.css +0 -1
- package/dist/runtime/types/api.d.ts +0 -218
- package/dist/runtime/types/auth.d.ts +0 -34
- package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
- package/dist/runtime/types/auto-form.d.ts +0 -548
- package/dist/runtime/types/components.d.ts +0 -43
- package/dist/runtime/types/module.d.ts +0 -39
- package/dist/runtime/utils/api-utils.d.ts +0 -79
- package/dist/runtime/utils/api-utils.js +0 -127
- package/dist/runtime/utils/auto-form.d.ts +0 -3
- package/dist/runtime/utils/auto-form.js +0 -18
- package/dist/runtime/utils/reactive-utils.d.ts +0 -30
- package/dist/runtime/utils/schema-introspector.d.ts +0 -13
- /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-renderer.js → api/fetch.js} +0 -0
- /package/dist/runtime/types/{auto-form.js → api/index.js} +0 -0
- /package/dist/runtime/types/{module.js → api/module.js} +0 -0
- /package/dist/runtime/types/{components.js → api/response.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://nuxt.mhaibaraai.cn/)
|
|
2
2
|
|
|
3
|
-
>
|
|
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
|
创建一个简单的用户注册表单:
|
|
@@ -67,7 +99,7 @@ export default defineNuxtConfig({
|
|
|
67
99
|
```vue
|
|
68
100
|
<script setup lang="ts">
|
|
69
101
|
import type { FormSubmitEvent } from '@nuxt/ui'
|
|
70
|
-
import type { z } from 'zod
|
|
102
|
+
import type { z } from 'zod'
|
|
71
103
|
|
|
72
104
|
const { afz } = useAutoForm()
|
|
73
105
|
|
|
@@ -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
|
|
@@ -237,29 +240,6 @@ const { data } = await useApiFetch<User>('/users', {
|
|
|
237
240
|
const { data } = await useApiFetch('/users', { endpoint: 'v2' })
|
|
238
241
|
```
|
|
239
242
|
|
|
240
|
-
#### useApiAuth
|
|
241
|
-
|
|
242
|
-
与 nuxt-auth-utils 集成的认证管理:
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
const { login, clear, loggedIn, user } = useApiAuth()
|
|
246
|
-
|
|
247
|
-
// 登录
|
|
248
|
-
await login({
|
|
249
|
-
loginPath: '/auth/login',
|
|
250
|
-
credentials: { username: 'admin', password: '123456' },
|
|
251
|
-
userInfoPath: '/auth/me' // 可选,登录后获取用户信息
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
// 登出
|
|
255
|
-
await clear()
|
|
256
|
-
|
|
257
|
-
// 响应式状态
|
|
258
|
-
if (loggedIn.value) {
|
|
259
|
-
console.log('当前用户:', user.value)
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
243
|
#### useUploadWithProgress
|
|
264
244
|
|
|
265
245
|
带进度监控的文件上传:
|
|
@@ -292,11 +272,11 @@ await download('/api/export/report', {
|
|
|
292
272
|
|
|
293
273
|
Movk Nuxt 采用清晰的分层架构:
|
|
294
274
|
|
|
295
|
-
- **Core Systems** - AutoForm
|
|
296
|
-
- **API System** - useApiFetch、
|
|
297
|
-
- **Standalone Components** - DatePicker、StarRating、WithCopy 等独立 UI 组件
|
|
298
|
-
- **Composables** - useDateFormatter、useAutoForm 等通用组合式函数
|
|
299
|
-
- **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)
|
|
300
280
|
|
|
301
281
|
## ⚡ 技术栈
|
|
302
282
|
|
|
@@ -307,15 +287,6 @@ Movk Nuxt 采用清晰的分层架构:
|
|
|
307
287
|
- [VueUse](https://vueuse.org/) - Collection of Vue Composition Utilities
|
|
308
288
|
- [Vitest](https://vitest.dev/) - Next Generation Testing Framework
|
|
309
289
|
|
|
310
|
-
## 🗺️ 开发路线图
|
|
311
|
-
|
|
312
|
-
- ✅ **AutoForm** - Schema 驱动的表单系统(已发布)
|
|
313
|
-
- ✅ **API System** - API 请求封装和认证管理(已发布)
|
|
314
|
-
- useApiFetch、useClientApiFetch - API 请求
|
|
315
|
-
- useApiAuth - 认证管理
|
|
316
|
-
- useUploadWithProgress、useDownloadWithProgress - 进度监控
|
|
317
|
-
- ✅ **独立组件库** - DatePicker、StarRating、WithCopy 等组件(已发布)
|
|
318
|
-
|
|
319
290
|
## 📄 许可证
|
|
320
291
|
|
|
321
292
|
[MIT](./LICENSE) License © 2024-PRESENT [YiXuan](https://github.com/mhaibaraai)
|
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { MovkApiFullConfig } from '../dist/runtime/types/api/module.js';
|
|
3
|
+
import { ModuleOptions as ModuleOptions$1 } from '@nuxt/ui';
|
|
1
4
|
export * from '../dist/runtime/types/index.js';
|
|
2
5
|
|
|
3
|
-
|
|
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
|
+
}
|
|
60
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
4
61
|
|
|
5
62
|
export { _default as default };
|
|
63
|
+
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,97 +1,177 @@
|
|
|
1
|
-
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import defu, { defu as defu$1 } from 'defu';
|
|
3
|
+
import { a as addTemplates } from './shared/nuxt.DfBEyjld.mjs';
|
|
4
|
+
import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
|
|
5
|
+
import { kebabCase } from 'scule';
|
|
6
|
+
import { updateSiteConfig } from 'nuxt-site-config/kit';
|
|
7
|
+
import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
|
|
4
8
|
export * from '../dist/runtime/types/index.js';
|
|
9
|
+
import 'node:url';
|
|
5
10
|
|
|
6
11
|
const name = "@movk/nuxt";
|
|
7
|
-
const version = "1.
|
|
12
|
+
const version = "1.3.0";
|
|
8
13
|
|
|
9
|
-
function
|
|
10
|
-
nuxt.options.appConfig.theme = defu(nuxt.options.appConfig.theme || {}, {
|
|
11
|
-
radius: 0.25,
|
|
12
|
-
blackAsPrimary: false,
|
|
13
|
-
font: "Public Sans",
|
|
14
|
-
icons: "lucide"
|
|
15
|
-
});
|
|
16
|
-
nuxt.options.app.head.meta = nuxt.options.app.head.meta || [];
|
|
17
|
-
nuxt.options.app.head.meta.push(
|
|
18
|
-
{ charset: "utf-8" },
|
|
19
|
-
{ name: "viewport", content: "width=device-width, initial-scale=1" }
|
|
20
|
-
);
|
|
21
|
-
addPlugin({
|
|
22
|
-
src: resolve("runtime/plugins/theme"),
|
|
23
|
-
mode: "all"
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const DEFAULT_ENDPOINT = { default: { baseURL: "/api" } };
|
|
28
|
-
function splitEndpointConfigs(endpoints) {
|
|
14
|
+
function getDefaultApiConfig(apiConfig) {
|
|
29
15
|
const publicEndpoints = {};
|
|
30
16
|
const privateEndpoints = {};
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
privateEndpoints[name2] = { headers };
|
|
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 };
|
|
36
21
|
}
|
|
37
22
|
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
function buildApiRuntimeConfig(apiConfig) {
|
|
41
|
-
const { publicEndpoints, privateEndpoints } = splitEndpointConfigs(apiConfig.endpoints);
|
|
42
|
-
const hasEndpoints = Object.keys(publicEndpoints).length > 0;
|
|
23
|
+
const endpoints = { default: { baseURL: "/api" }, ...publicEndpoints };
|
|
43
24
|
const publicConfig = {
|
|
44
|
-
defaultEndpoint: apiConfig
|
|
45
|
-
debug: apiConfig
|
|
46
|
-
endpoints
|
|
47
|
-
response:
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
)
|
|
50
68
|
};
|
|
51
69
|
const privateConfig = {
|
|
52
70
|
endpoints: Object.keys(privateEndpoints).length > 0 ? privateEndpoints : void 0
|
|
53
71
|
};
|
|
54
72
|
return { publicConfig, privateConfig };
|
|
55
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;
|
|
83
|
+
nuxt.options.app.head.meta = nuxt.options.app.head.meta || [];
|
|
84
|
+
nuxt.options.app.head.meta.push(
|
|
85
|
+
{ charset: "utf-8" },
|
|
86
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" }
|
|
87
|
+
);
|
|
88
|
+
nuxt.options.app.head.htmlAttrs = defu(nuxt.options.app.head.htmlAttrs || {}, {
|
|
89
|
+
dir: "ltr"
|
|
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
|
+
);
|
|
109
|
+
addPlugin({
|
|
110
|
+
src: resolve("runtime/plugins/theme"),
|
|
111
|
+
mode: "all"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
56
115
|
const module$1 = defineNuxtModule({
|
|
57
116
|
meta: {
|
|
58
117
|
name,
|
|
59
118
|
version,
|
|
60
119
|
configKey: "movk",
|
|
61
|
-
compatibility: { nuxt: ">=4.2
|
|
120
|
+
compatibility: { nuxt: ">=4.4.2" }
|
|
62
121
|
},
|
|
63
|
-
defaults:
|
|
122
|
+
defaults: defaultOptions,
|
|
64
123
|
moduleDependencies: {
|
|
65
124
|
"@nuxt/image": { version: ">=2.0.0" },
|
|
66
|
-
"@nuxt/ui": { version: ">=4.
|
|
67
|
-
"@vueuse/nuxt": { version: ">=14.1
|
|
68
|
-
"nuxt-
|
|
69
|
-
"nuxt-
|
|
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" }
|
|
70
129
|
},
|
|
71
|
-
setup(options, nuxt) {
|
|
130
|
+
async setup(options, nuxt) {
|
|
72
131
|
const { resolve } = createResolver(import.meta.url);
|
|
73
|
-
|
|
132
|
+
nuxt.options.movk = options;
|
|
74
133
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
75
|
-
nuxt.options.css.
|
|
134
|
+
nuxt.options.css = nuxt.options.css || [];
|
|
135
|
+
nuxt.options.css.push(resolve("runtime/index.css"));
|
|
136
|
+
const componentIgnore = [];
|
|
137
|
+
if (options.theme?.enabled === false) {
|
|
138
|
+
componentIgnore.push("theme-picker/**");
|
|
139
|
+
}
|
|
76
140
|
addComponentsDir({
|
|
77
141
|
path: resolve("runtime/components"),
|
|
78
142
|
prefix: options.prefix,
|
|
79
143
|
pathPrefix: false,
|
|
80
|
-
ignore:
|
|
144
|
+
ignore: componentIgnore
|
|
81
145
|
});
|
|
82
146
|
addImportsDir(resolve("runtime/composables"));
|
|
83
147
|
const apiConfig = options.api ?? {};
|
|
84
148
|
if (apiConfig.enabled !== false) {
|
|
85
|
-
const { publicConfig, privateConfig } =
|
|
149
|
+
const { publicConfig, privateConfig } = getDefaultApiConfig(apiConfig);
|
|
86
150
|
nuxt.options.runtimeConfig.movkApi = privateConfig;
|
|
87
151
|
nuxt.options.runtimeConfig.public.movkApi = publicConfig;
|
|
88
152
|
addPlugin({ src: resolve("runtime/plugins/api.factory"), mode: "all" });
|
|
89
|
-
addServerHandler({
|
|
90
|
-
route: "/api/_movk/session",
|
|
91
|
-
method: "post",
|
|
92
|
-
handler: resolve("runtime/server/api/_movk/session.post")
|
|
93
|
-
});
|
|
94
153
|
}
|
|
154
|
+
const meta = await getPackageJsonMetadata(nuxt.options.rootDir);
|
|
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") });
|
|
174
|
+
});
|
|
95
175
|
}
|
|
96
176
|
});
|
|
97
177
|
|
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
import type {
|
|
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>;
|
|
1
|
+
import type { ComponentConfig, InferInput } from '@nuxt/ui';
|
|
2
|
+
import type { z } from 'zod';
|
|
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
|
-
|
|
31
|
-
|
|
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;
|
|
32
11
|
}> & (typeof globalThis extends {
|
|
33
12
|
__VLS_PROPS_FALLBACK: infer P;
|
|
34
13
|
} ? P : {});
|
|
@@ -39,7 +18,7 @@ declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N
|
|
|
39
18
|
}>) => void;
|
|
40
19
|
attrs: any;
|
|
41
20
|
slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
|
|
42
|
-
emit: (
|
|
21
|
+
emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
|
|
43
22
|
}>) => import("vue").VNode & {
|
|
44
23
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
45
24
|
};
|