@movk/nuxt 1.0.0 → 1.1.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 (32) hide show
  1. package/dist/module.d.mts +11 -3
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +56 -13
  4. package/dist/runtime/components/AutoForm.vue +1 -0
  5. package/dist/runtime/components/SlideVerify.d.vue.ts +107 -0
  6. package/dist/runtime/components/SlideVerify.vue +147 -0
  7. package/dist/runtime/components/SlideVerify.vue.d.ts +107 -0
  8. package/dist/runtime/components/StarRating.vue +1 -0
  9. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +1 -1
  10. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +3 -0
  11. package/dist/runtime/components/theme-picker/ThemePicker.vue +235 -0
  12. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +3 -0
  13. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +18 -0
  14. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +34 -0
  15. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +18 -0
  16. package/dist/runtime/composables/useApiFetch.js +1 -3
  17. package/dist/runtime/composables/useAutoForm.d.ts +81 -1425
  18. package/dist/runtime/composables/useAutoForm.js +3 -1
  19. package/dist/runtime/composables/useTheme.d.ts +21 -0
  20. package/dist/runtime/composables/useTheme.js +143 -0
  21. package/dist/runtime/composables/useUploadWithProgress.js +2 -2
  22. package/dist/runtime/internal/useAutoFormProvider.js +2 -2
  23. package/dist/runtime/plugins/api.factory.js +28 -30
  24. package/dist/runtime/plugins/theme.d.ts +2 -0
  25. package/dist/runtime/plugins/theme.js +89 -0
  26. package/dist/runtime/schemas/api.d.ts +336 -100
  27. package/dist/runtime/schemas/api.js +114 -98
  28. package/dist/runtime/style.css +1 -0
  29. package/dist/runtime/types/api.d.ts +108 -108
  30. package/dist/runtime/types/api.js +0 -8
  31. package/dist/runtime/utils/api-utils.d.ts +45 -30
  32. package/package.json +19 -19
@@ -1,64 +1,79 @@
1
1
  import type { FetchContext, FetchHooks } from 'ofetch';
2
- import type { ApiResponse, ApiError, ApiSuccessConfig, ApiToastConfig, RequestToastOptions, ResolvedEndpointConfig } from '../types/api.js';
2
+ import type { ApiResponse, ApiError, ApiResponseConfig, ApiToastConfig, RequestToastOptions, ResolvedEndpointConfig } from '../types/api.js';
3
3
  /**
4
- * 检查业务状态码是否成功
4
+ * 判断API响应是否业务成功
5
+ * @param response - API响应对象
6
+ * @param config - 响应配置(包含codeKey和successCodes)
7
+ * @returns 是否业务成功
5
8
  */
6
- export declare function isBusinessSuccess(response: ApiResponse, config?: Partial<ApiSuccessConfig>): boolean;
9
+ export declare function isBusinessSuccess(response: ApiResponse, config?: Partial<ApiResponseConfig>): boolean;
7
10
  /**
8
- * 从响应中提取消息
11
+ * 从API响应中提取消息内容
12
+ * @param response - API响应对象
13
+ * @param config - 响应配置(包含messageKey)
14
+ * @returns 消息字符串或undefined
9
15
  */
10
- export declare function extractMessage(response: ApiResponse, config?: Partial<ApiSuccessConfig>): string | undefined;
16
+ export declare function extractMessage(response: ApiResponse, config?: Partial<ApiResponseConfig>): string | undefined;
11
17
  /**
12
- * 从响应中提取数据
18
+ * 从API响应中提取业务数据
19
+ * @param response - API响应对象
20
+ * @param config - 响应配置(包含dataKey)
21
+ * @returns 业务数据
13
22
  */
14
- export declare function extractData<T>(response: ApiResponse<T>, config?: Partial<ApiSuccessConfig>): T;
23
+ export declare function extractData<T>(response: ApiResponse<T>, config?: Partial<ApiResponseConfig>): T;
15
24
  /**
16
- * 创建 API 业务错误
25
+ * 创建业务错误对象
26
+ * @param response - API响应对象
27
+ * @param message - 错误消息(可选)
28
+ * @returns 业务错误对象
17
29
  */
18
30
  export declare function createApiError(response: ApiResponse, message?: string): ApiError;
19
31
  /**
20
- * 从请求选项中提取 Toast 消息
32
+ * 提取Toast消息内容
33
+ * @param toast - Toast配置选项
34
+ * @param type - 消息类型
35
+ * @param fallback - 默认消息
36
+ * @returns 最终显示的消息内容
21
37
  */
22
38
  export declare function extractToastMessage(toast: RequestToastOptions | false | undefined, type: 'success' | 'error', fallback: string): string;
23
39
  /**
24
- * 显示 Toast 提示
40
+ * 显示Toast提示
41
+ * @param type - 提示类型
42
+ * @param message - 提示消息
43
+ * @param requestOptions - 请求级别的Toast配置
44
+ * @param globalConfig - 全局Toast配置
25
45
  */
26
46
  export declare function showToast(type: 'success' | 'error', message: string | undefined, requestOptions: RequestToastOptions | false | undefined, globalConfig: Partial<ApiToastConfig>): void;
27
47
  interface CreateTransformOptions<ResT, DataT = ResT> {
28
48
  skipBusinessCheck: boolean;
29
49
  userTransform?: (data: ResT) => DataT;
30
- successConfig: Partial<ApiSuccessConfig>;
50
+ successConfig: Partial<ApiResponseConfig>;
31
51
  }
32
52
  /**
33
- * 创建 useFetch transform 函数
34
- *
35
- * 处理流程:
36
- * 1. 业务状态码检查 → 失败时抛出 ApiError
37
- * 2. 解包数据(提取 response.data)
38
- * 3. 用户自定义 transform(接收解包后的数据)
53
+ * 创建响应转换函数
54
+ * @description 用于 useFetch 的 transform 选项,处理业务状态码检查和数据提取
55
+ * @param options - 转换选项(包含skipBusinessCheck、userTransform、successConfig)
56
+ * @returns 响应转换函数
39
57
  */
40
58
  export declare function createTransform<ResT, DataT = ResT>(options: CreateTransformOptions<ResT, DataT>): (response: ApiResponse<ResT>) => DataT;
41
59
  type HookFunction = (context: FetchContext) => void | Promise<void>;
42
60
  /**
43
- * 合并多个 hook 函数,确保所有 hooks 都会执行
61
+ * 合并多个钩子函数为一个
62
+ * @param hooks - 钩子函数数组
63
+ * @returns 合并后的钩子函数
44
64
  */
45
65
  export declare function mergeHooks(...hooks: (HookFunction | undefined)[]): HookFunction;
46
66
  /**
47
- * 合并 FetchHooks 对象,每个 hook 类型单独合并
67
+ * 合并内置钩子和用户钩子
68
+ * @param builtinHooks - 内置钩子集合
69
+ * @param userHooks - 用户自定义钩子集合
70
+ * @returns 合并后的完整钩子集合
48
71
  */
49
72
  export declare function mergeFetchHooks(builtinHooks: Partial<FetchHooks>, userHooks: Partial<FetchHooks>): FetchHooks;
50
73
  /**
51
- * 获取认证 Headers
52
- *
53
- * 根据端点配置获取认证相关的 headers(如 Authorization)
54
- * 用于原生 fetch/XHR 请求(如带进度的上传下载)
55
- *
56
- * @example
57
- * ```ts
58
- * const config = $api.getConfig()
59
- * const authHeaders = getAuthHeaders(config)
60
- * fetch(url, { headers: { ...headers, ...authHeaders } })
61
- * ```
74
+ * 获取认证请求头
75
+ * @param config - 已解析的端点配置
76
+ * @returns 认证请求头对象
62
77
  */
63
78
  export declare function getAuthHeaders(config: ResolvedEndpointConfig): Record<string, string>;
64
79
  export {};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@movk/nuxt",
3
3
  "type": "module",
4
- "version": "1.0.0",
5
- "packageManager": "pnpm@10.26.1",
4
+ "version": "1.1.0",
5
+ "packageManager": "pnpm@10.28.0",
6
6
  "description": "Modular engineering suite for Nuxt 4 with schema-driven forms, API integration, UI components and composables",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
8
8
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "homepage": "https://nuxt.mhaibaraai.cn",
14
14
  "engines": {
15
- "node": "^20.x || ^22.x"
15
+ "node": "^22.x || ^24.x"
16
16
  },
17
17
  "bugs": {
18
18
  "url": "https://github.com/mhaibaraai/movk-nuxt/issues"
@@ -46,8 +46,8 @@
46
46
  "dist"
47
47
  ],
48
48
  "peerDependencies": {
49
- "@nuxt/ui": ">=4.2.1",
50
- "zod": ">=4.1.13"
49
+ "@nuxt/ui": ">=4.3.0",
50
+ "zod": ">=4.3.5"
51
51
  },
52
52
  "scripts": {
53
53
  "prepack": "pnpm build",
@@ -60,23 +60,25 @@
60
60
  "release": "release-it && npm publish",
61
61
  "lint": "eslint .",
62
62
  "lint:fix": "eslint . --fix",
63
- "typecheck": "vue-tsc --noEmit && nuxt typecheck playground",
64
- "clean": "tsx scripts/rm.ts",
63
+ "typecheck": "vue-tsc --noEmit && nuxt typecheck playground && nuxt typecheck docs",
64
+ "clean": "movk-clean",
65
65
  "test": "vitest"
66
66
  },
67
67
  "dependencies": {
68
- "@iconify-json/lucide": "^1.2.82",
68
+ "@iconify-json/lucide": "^1.2.86",
69
69
  "@internationalized/date": "^3.10.1",
70
- "@movk/core": "^1.0.2",
70
+ "@movk/core": "^1.1.0",
71
71
  "@nuxt/image": "^2.0.0",
72
72
  "@nuxt/ui": "^4.3.0",
73
73
  "@vueuse/core": "^14.1.0",
74
74
  "@vueuse/nuxt": "^14.1.0",
75
75
  "defu": "^6.1.4",
76
- "nuxt-auth-utils": "^0.5.26",
77
- "tailwindcss": "^4.1.18",
76
+ "motion-v": "^1.9.0",
77
+ "nuxt-auth-utils": "^0.5.27",
78
+ "nuxt-og-image": "^5.1.13",
78
79
  "scule": "^1.3.0",
79
- "zod": "^4.2.1"
80
+ "tailwindcss": "^4.1.18",
81
+ "zod": "^4.3.5"
80
82
  },
81
83
  "devDependencies": {
82
84
  "@nuxt/devtools": "^3.1.1",
@@ -84,17 +86,15 @@
84
86
  "@nuxt/kit": "^4.2.2",
85
87
  "@nuxt/module-builder": "^1.0.2",
86
88
  "@nuxt/schema": "^4.2.2",
87
- "@nuxt/test-utils": "^3.21.0",
89
+ "@nuxt/test-utils": "^3.23.0",
88
90
  "@release-it/bumper": "^7.0.5",
89
91
  "@release-it/conventional-changelog": "^10.0.4",
90
- "@vitest/coverage-v8": "^4.0.16",
91
- "jsdom": "^27.3.0",
92
+ "@vitest/coverage-v8": "^4.0.17",
92
93
  "eslint": "9.39.2",
93
- "fast-glob": "^3.3.3",
94
+ "jsdom": "^27.4.0",
94
95
  "nuxt": "^4.2.2",
95
- "tsx": "^4.21.0",
96
96
  "typescript": "^5.9.3",
97
- "vitest": "^4.0.16",
98
- "vue-tsc": "^3.2.1"
97
+ "vitest": "^4.0.17",
98
+ "vue-tsc": "^3.2.2"
99
99
  }
100
100
  }