@movk/nuxt 1.5.0 → 1.6.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/dist/module.d.mts +12 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/AutoForm.vue +1 -1
- package/dist/runtime/components/DataTable.vue +1 -1
- package/dist/runtime/components/PillGroup.vue +1 -1
- package/dist/runtime/components/SearchForm.vue +1 -1
- package/dist/runtime/components/SlideVerify.vue +1 -1
- package/dist/runtime/components/Tree.vue +1 -1
- package/dist/runtime/composables/useTheme.d.ts +1 -5
- package/dist/runtime/composables/useTheme.js +21 -23
- package/dist/runtime/domains/api/auth.js +9 -3
- package/dist/runtime/domains/api/endpoint-config.d.ts +1 -1
- package/dist/runtime/domains/api/endpoint-config.js +5 -1
- package/dist/runtime/domains/api/toast.d.ts +2 -0
- package/dist/runtime/domains/api/toast.js +7 -4
- package/dist/runtime/domains/auto-form/controls.d.ts +34 -9
- package/dist/runtime/domains/theme/theme-font.d.ts +29 -0
- package/dist/runtime/domains/theme/theme-font.js +29 -0
- package/dist/runtime/domains/theme/theme-radius.d.ts +7 -0
- package/dist/runtime/domains/theme/theme-radius.js +7 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/plugins/theme.js +14 -11
- package/dist/runtime/types/api/config.d.ts +13 -2
- package/dist/runtime/types/api/module.d.ts +1 -1
- package/dist/runtime/types/api/response.d.ts +5 -5
- package/dist/runtime/types/auto-form/zod-factory.d.ts +17 -3
- package/dist/runtime/utils/form-control.d.ts +14 -16
- package/dist/runtime/utils/theme-defaults.d.ts +1 -1
- package/dist/runtime/utils/theme-defaults.js +4 -2
- package/package.json +22 -22
package/dist/module.d.mts
CHANGED
|
@@ -49,8 +49,20 @@ interface ModuleOptions {
|
|
|
49
49
|
* @example 'tw'
|
|
50
50
|
*/
|
|
51
51
|
prefix?: StrictUiTheme['prefix'];
|
|
52
|
+
/**
|
|
53
|
+
* 默认字体,取值需与 `fonts` 中某一项的 `name` 一致。
|
|
54
|
+
* 缺省时不注入 `--font-sans`,字体由项目 CSS 的 `@theme` 决定
|
|
55
|
+
* @example 'Alibaba PuHuiTi'
|
|
56
|
+
*/
|
|
57
|
+
font?: string;
|
|
52
58
|
/** ThemePicker 字体可选项;提供时完整替换内置列表 */
|
|
53
59
|
fonts?: ThemeFontConfig[];
|
|
60
|
+
/**
|
|
61
|
+
* 默认圆角(单位 rem)。缺省时不注入 `--ui-radius`,
|
|
62
|
+
* 沿用 `@nuxt/ui` 的默认值或项目 CSS 的声明
|
|
63
|
+
* @example 0.5
|
|
64
|
+
*/
|
|
65
|
+
radius?: number;
|
|
54
66
|
/** ThemePicker 圆角可选项 */
|
|
55
67
|
radiuses?: number[];
|
|
56
68
|
/** ThemePicker neutral 颜色可选项 */
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"configKey": "movk",
|
|
5
5
|
"compatibility": {
|
|
6
6
|
"nuxt": ">=4.4.2"
|
|
7
7
|
},
|
|
8
8
|
"builder": {
|
|
9
|
-
"@nuxt/module-builder": "1.0.
|
|
9
|
+
"@nuxt/module-builder": "1.0.3",
|
|
10
10
|
"unbuild": "3.6.1"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -9,7 +9,7 @@ export * from '../dist/runtime/types/index.js';
|
|
|
9
9
|
import 'node:url';
|
|
10
10
|
|
|
11
11
|
const name = "@movk/nuxt";
|
|
12
|
-
const version = "1.
|
|
12
|
+
const version = "1.6.0";
|
|
13
13
|
|
|
14
14
|
function getDefaultApiConfig(apiConfig) {
|
|
15
15
|
const publicEndpoints = {};
|
|
@@ -132,7 +132,7 @@ const module$1 = defineNuxtModule({
|
|
|
132
132
|
nuxt.options.movk = options;
|
|
133
133
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
134
134
|
nuxt.options.css = nuxt.options.css || [];
|
|
135
|
-
nuxt.options.css.
|
|
135
|
+
nuxt.options.css.unshift(resolve("runtime/index.css"));
|
|
136
136
|
const movkUiDeps = UI_COMPONENTS.map((name2) => name2.slice(1));
|
|
137
137
|
const uiOptions = nuxt.options;
|
|
138
138
|
const ui = uiOptions.ui ??= {};
|
|
@@ -21,7 +21,7 @@ const props = defineProps({
|
|
|
21
21
|
globalMeta: { type: Object, required: false },
|
|
22
22
|
loadingAuto: { type: Boolean, required: false, default: true },
|
|
23
23
|
validateOn: { type: Array, required: false, default: () => [] },
|
|
24
|
-
class: { type: null, required: false },
|
|
24
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
25
25
|
ui: { type: Object, required: false }
|
|
26
26
|
});
|
|
27
27
|
const emits = defineEmits(["error"]);
|
|
@@ -61,7 +61,7 @@ const props = defineProps({
|
|
|
61
61
|
loadMore: { type: Function, required: false },
|
|
62
62
|
canLoadMore: { type: Boolean, required: false },
|
|
63
63
|
loadMoreDistance: { type: Number, required: false },
|
|
64
|
-
class: { type: null, required: false },
|
|
64
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
65
65
|
ui: { type: Object, required: false }
|
|
66
66
|
});
|
|
67
67
|
const paginationState = defineModel("pagination", { type: Object });
|
|
@@ -25,7 +25,7 @@ const props = defineProps({
|
|
|
25
25
|
min: { type: Number, required: false },
|
|
26
26
|
defaultValue: { type: null, required: false },
|
|
27
27
|
modelValue: { type: null, required: false },
|
|
28
|
-
class: { type: null, required: false },
|
|
28
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
29
29
|
ui: { type: Object, required: false }
|
|
30
30
|
});
|
|
31
31
|
const modelValue = defineModel({ type: null });
|
|
@@ -27,7 +27,7 @@ const props = defineProps({
|
|
|
27
27
|
globalMeta: { type: Object, required: false },
|
|
28
28
|
loadingAuto: { type: Boolean, required: false, default: true },
|
|
29
29
|
validateOn: { type: Array, required: false, default: () => [] },
|
|
30
|
-
class: { type: null, required: false },
|
|
30
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
31
31
|
ui: { type: Object, required: false }
|
|
32
32
|
});
|
|
33
33
|
const modelValue = defineModel({ type: Object, ...{ default: () => ({}) } });
|
|
@@ -16,7 +16,7 @@ const props = defineProps({
|
|
|
16
16
|
icon: { type: null, required: false, default: "i-lucide-chevrons-right" },
|
|
17
17
|
successIcon: { type: null, required: false, default: "i-lucide-check" },
|
|
18
18
|
threshold: { type: Number, required: false, default: 0.9 },
|
|
19
|
-
class: { type: null, required: false },
|
|
19
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
20
20
|
ui: { type: Object, required: false }
|
|
21
21
|
});
|
|
22
22
|
const emits = defineEmits(["success", "dragStart", "dragEnd"]);
|
|
@@ -39,7 +39,7 @@ const props = defineProps({
|
|
|
39
39
|
toolbar: { type: Boolean, required: false },
|
|
40
40
|
checkable: { type: Boolean, required: false },
|
|
41
41
|
ui: { type: Object, required: false },
|
|
42
|
-
class: { type: null, required: false }
|
|
42
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true }
|
|
43
43
|
});
|
|
44
44
|
const emit = defineEmits(["update:modelValue", "update:expanded", "update:search", "change"]);
|
|
45
45
|
defineSlots();
|
|
@@ -6,11 +6,7 @@ export declare function useTheme(): {
|
|
|
6
6
|
id: string;
|
|
7
7
|
tagPriority: number;
|
|
8
8
|
}[];
|
|
9
|
-
link: import("vue").ComputedRef<
|
|
10
|
-
rel: "stylesheet";
|
|
11
|
-
href: string;
|
|
12
|
-
id: string;
|
|
13
|
-
}[]>;
|
|
9
|
+
link: import("vue").ComputedRef<import("../domains/theme/theme-font").ThemeFontLink[]>;
|
|
14
10
|
neutralColors: string[];
|
|
15
11
|
neutral: import("vue").WritableComputedRef<string, string>;
|
|
16
12
|
primaryColors: string[];
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { useAppConfig, useColorMode, useSiteConfig } from "#imports";
|
|
2
2
|
import { resolveThemeIcons, themeIcons } from "../domains/theme/theme-icons.js";
|
|
3
|
+
import { resolveActiveFont, resolveFontLinks, resolveFontStyle } from "../domains/theme/theme-font.js";
|
|
4
|
+
import { resolveActiveRadius, resolveRadiusStyle } from "../domains/theme/theme-radius.js";
|
|
3
5
|
import { omit, kebabCase } from "@movk/core";
|
|
4
6
|
import { useLocalStorage } from "@vueuse/core";
|
|
5
7
|
import colors from "tailwindcss/colors";
|
|
6
8
|
import { computed } from "vue";
|
|
7
9
|
import { getDefaultConfig } from "../utils/theme-defaults.js";
|
|
10
|
+
const UI_DEFAULT_RADIUS = 0.25;
|
|
8
11
|
export function useTheme() {
|
|
9
12
|
const { movk, ui } = useAppConfig();
|
|
10
13
|
const colorMode = useColorMode();
|
|
11
14
|
const name = kebabCase(useSiteConfig().name);
|
|
12
15
|
const color = computed(() => colorMode.value === "dark" ? colors[ui.colors.neutral][900] : "white");
|
|
13
16
|
const defaultConfig = getDefaultConfig();
|
|
14
|
-
const _radius = useLocalStorage(`${name}-ui-radius`,
|
|
15
|
-
const _font = useLocalStorage(`${name}-ui-font`,
|
|
17
|
+
const _radius = useLocalStorage(`${name}-ui-radius`, null, { writeDefaults: false });
|
|
18
|
+
const _font = useLocalStorage(`${name}-ui-font`, "", { writeDefaults: false });
|
|
16
19
|
const _iconSet = useLocalStorage(`${name}-ui-icons`, movk?.icons ?? defaultConfig.icons);
|
|
17
20
|
const _blackAsPrimary = useLocalStorage(`${name}-ui-black-as-primary`, defaultConfig.blackAsPrimary);
|
|
18
21
|
const pickerFonts = movk?.picker?.fonts ?? [];
|
|
22
|
+
const configuredFont = movk?.font ?? defaultConfig.font;
|
|
23
|
+
const activeFont = computed(() => resolveActiveFont(_font.value, configuredFont));
|
|
24
|
+
const configuredRadius = movk?.radius ?? defaultConfig.radius;
|
|
25
|
+
const activeRadius = computed(() => resolveActiveRadius(_radius.value, configuredRadius));
|
|
19
26
|
const neutralColors = movk?.picker?.neutralColors ?? [];
|
|
20
27
|
const neutral = computed({
|
|
21
28
|
get() {
|
|
@@ -41,7 +48,7 @@ export function useTheme() {
|
|
|
41
48
|
const radiuses = movk?.picker?.radiuses ?? [];
|
|
42
49
|
const radius = computed({
|
|
43
50
|
get() {
|
|
44
|
-
return
|
|
51
|
+
return activeRadius.value ?? UI_DEFAULT_RADIUS;
|
|
45
52
|
},
|
|
46
53
|
set(option) {
|
|
47
54
|
_radius.value = option;
|
|
@@ -50,7 +57,7 @@ export function useTheme() {
|
|
|
50
57
|
const fonts = pickerFonts.map((f) => f.name);
|
|
51
58
|
const font = computed({
|
|
52
59
|
get() {
|
|
53
|
-
return
|
|
60
|
+
return activeFont.value;
|
|
54
61
|
},
|
|
55
62
|
set(option) {
|
|
56
63
|
_font.value = option;
|
|
@@ -87,26 +94,17 @@ export function useTheme() {
|
|
|
87
94
|
function setBlackAsPrimary(value) {
|
|
88
95
|
_blackAsPrimary.value = value;
|
|
89
96
|
}
|
|
90
|
-
const radiusStyle = computed(() =>
|
|
97
|
+
const radiusStyle = computed(() => resolveRadiusStyle(activeRadius.value));
|
|
91
98
|
const blackAsPrimaryStyle = computed(() => _blackAsPrimary.value ? `:root { --ui-primary: black; } .dark { --ui-primary: white; }` : ":root {}");
|
|
92
|
-
const fontStyle = computed(() =>
|
|
93
|
-
const link = computed(() =>
|
|
94
|
-
const fontName = _font.value;
|
|
95
|
-
const fontConfig = pickerFonts.find((f) => f.name === fontName);
|
|
96
|
-
const href = fontConfig?.href ?? `https://fonts.googleapis.com/css2?family=${encodeURIComponent(fontName)}:wght@400;500;600;700&display=swap`;
|
|
97
|
-
return [{
|
|
98
|
-
rel: "stylesheet",
|
|
99
|
-
href,
|
|
100
|
-
id: `font-${fontName.toLowerCase().replace(/\s+/g, "-")}`
|
|
101
|
-
}];
|
|
102
|
-
});
|
|
99
|
+
const fontStyle = computed(() => resolveFontStyle(activeFont.value));
|
|
100
|
+
const link = computed(() => resolveFontLinks(activeFont.value, pickerFonts));
|
|
103
101
|
const style = [
|
|
104
102
|
{ innerHTML: radiusStyle, id: `nuxt-ui-radius`, tagPriority: -2 },
|
|
105
103
|
{ innerHTML: blackAsPrimaryStyle, id: `nuxt-ui-black-as-primary`, tagPriority: -2 },
|
|
106
104
|
{ innerHTML: fontStyle, id: `nuxt-ui-font`, tagPriority: -2 }
|
|
107
105
|
];
|
|
108
106
|
const hasCSSChanges = computed(() => {
|
|
109
|
-
return
|
|
107
|
+
return activeRadius.value !== configuredRadius || _blackAsPrimary.value || activeFont.value !== configuredFont;
|
|
110
108
|
});
|
|
111
109
|
const hasConfigChanges = computed(() => {
|
|
112
110
|
return ui.colors.primary !== "blue" || ui.colors.neutral !== "slate" || _iconSet.value !== (movk?.icons ?? defaultConfig.icons);
|
|
@@ -116,12 +114,12 @@ export function useTheme() {
|
|
|
116
114
|
'@import "tailwindcss";',
|
|
117
115
|
'@import "@nuxt/ui";'
|
|
118
116
|
];
|
|
119
|
-
if (
|
|
120
|
-
lines.push("", "@theme {", ` --font-sans:
|
|
117
|
+
if (activeFont.value && activeFont.value !== configuredFont) {
|
|
118
|
+
lines.push("", "@theme {", ` --font-sans: ${JSON.stringify(activeFont.value)}, sans-serif;`, "}");
|
|
121
119
|
}
|
|
122
120
|
const rootLines = [];
|
|
123
|
-
if (
|
|
124
|
-
rootLines.push(` --ui-radius: ${
|
|
121
|
+
if (activeRadius.value !== void 0 && activeRadius.value !== configuredRadius) {
|
|
122
|
+
rootLines.push(` --ui-radius: ${activeRadius.value}rem;`);
|
|
125
123
|
}
|
|
126
124
|
if (_blackAsPrimary.value) {
|
|
127
125
|
rootLines.push(" --ui-primary: black;");
|
|
@@ -169,8 +167,8 @@ export function useTheme() {
|
|
|
169
167
|
window.localStorage.removeItem(`${name}-ui-primary`);
|
|
170
168
|
ui.colors.neutral = defaultNeutral;
|
|
171
169
|
window.localStorage.removeItem(`${name}-ui-neutral`);
|
|
172
|
-
_radius.value =
|
|
173
|
-
_font.value =
|
|
170
|
+
_radius.value = null;
|
|
171
|
+
_font.value = "";
|
|
174
172
|
_iconSet.value = defaultIcon;
|
|
175
173
|
ui.icons = resolveThemeIcons(defaultIcon, ui.icons);
|
|
176
174
|
_blackAsPrimary.value = movk?.blackAsPrimary ?? defaultConfig.blackAsPrimary;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getPath } from "@movk/core";
|
|
2
|
-
import { useNuxtApp, useUserSession } from "#imports";
|
|
2
|
+
import { useNuxtApp, useRuntimeConfig, useUserSession } from "#imports";
|
|
3
3
|
function getUserSession() {
|
|
4
4
|
try {
|
|
5
5
|
const nuxtApp = useNuxtApp();
|
|
@@ -14,6 +14,13 @@ function getTokenFromSession(tokenPath) {
|
|
|
14
14
|
const sessionData = userSession.session.value;
|
|
15
15
|
return getPath(sessionData, tokenPath) || null;
|
|
16
16
|
}
|
|
17
|
+
function getTokenFromPublicRuntimeConfig(tokenPath) {
|
|
18
|
+
try {
|
|
19
|
+
return getPath(useRuntimeConfig().public, tokenPath) || null;
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
function buildAuthHeaderValue(token, config) {
|
|
18
25
|
const tokenType = config.tokenType === "Custom" ? config.customTokenType || "" : config.tokenType || "Bearer";
|
|
19
26
|
return tokenType ? `${tokenType} ${token}` : token;
|
|
@@ -21,8 +28,7 @@ function buildAuthHeaderValue(token, config) {
|
|
|
21
28
|
export function getAuthHeaders(auth) {
|
|
22
29
|
const headers = {};
|
|
23
30
|
if (!auth.enabled) return headers;
|
|
24
|
-
const
|
|
25
|
-
const token = getTokenFromSession(tokenPath);
|
|
31
|
+
const token = auth.tokenSource === "public-runtime-config" ? getTokenFromPublicRuntimeConfig(auth.tokenPath || "apiToken") : getTokenFromSession(auth.sessionTokenPath || "token");
|
|
26
32
|
if (token) {
|
|
27
33
|
const headerName = auth.headerName || "Authorization";
|
|
28
34
|
headers[headerName] = buildAuthHeaderValue(token, auth);
|
|
@@ -5,7 +5,7 @@ import type { EndpointPrivateConfig, ResolvedEndpointConfig } from '../../types/
|
|
|
5
5
|
*
|
|
6
6
|
* @param publicConfig 模块公共配置
|
|
7
7
|
* @param endpoint 端点名称;未指定时使用 defaultEndpoint
|
|
8
|
-
* @param privateEndpoints
|
|
8
|
+
* @param privateEndpoints 服务端私有端点配置(含机密 headers),仅在服务端可用;与端点 publicHeaders 合并后生效
|
|
9
9
|
* @description 端点不存在时降级到 defaultEndpoint,并打印警告
|
|
10
10
|
*/
|
|
11
11
|
export declare function resolveEndpointConfig(publicConfig: MovkApiPublicConfig, endpoint?: string, privateEndpoints?: Record<string, EndpointPrivateConfig>): ResolvedEndpointConfig;
|
|
@@ -6,10 +6,14 @@ export function resolveEndpointConfig(publicConfig, endpoint, privateEndpoints)
|
|
|
6
6
|
console.warn(`[@movk/nuxt] Endpoint "${endpointName}" not found, using default`);
|
|
7
7
|
return resolveEndpointConfig(publicConfig, publicConfig.defaultEndpoint || "default", privateEndpoints);
|
|
8
8
|
}
|
|
9
|
+
const mergedHeaders = defu(
|
|
10
|
+
privateEndpoints?.[endpointName]?.headers,
|
|
11
|
+
endpointConfig.publicHeaders
|
|
12
|
+
);
|
|
9
13
|
return {
|
|
10
14
|
...endpointConfig,
|
|
11
15
|
baseURL: endpointConfig.baseURL || "",
|
|
12
|
-
headers:
|
|
16
|
+
headers: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : void 0,
|
|
13
17
|
auth: defu(endpointConfig.auth, publicConfig.auth),
|
|
14
18
|
toast: defu(endpointConfig.toast, publicConfig.toast),
|
|
15
19
|
response: defu(endpointConfig.response, publicConfig.response)
|
|
@@ -10,6 +10,8 @@ type ToastType = 'success' | 'error';
|
|
|
10
10
|
* @param requestOptions 单次请求覆盖配置;为 false 时整体禁用
|
|
11
11
|
* @param globalConfig 全局 Toast 配置(已合并端点级覆盖)
|
|
12
12
|
* @param responseConfig 用于从 ApiResponse 抽取 message 的字段映射;source 为字符串时可省略
|
|
13
|
+
* @description 开关优先级:请求级 show 显式声明 > 全局 typeConfig.show > 全局 enabled。
|
|
14
|
+
* 请求级 `show: true` 可在全局关闭时单次开启。
|
|
13
15
|
*/
|
|
14
16
|
export declare function showToast(type: ToastType, source: ApiResponse | string | undefined, requestOptions: RequestToastOptions | false | undefined, globalConfig: Partial<ApiToastConfig>, responseConfig?: Partial<ApiResponseConfig>): void;
|
|
15
17
|
export {};
|
|
@@ -28,16 +28,19 @@ function compact(obj) {
|
|
|
28
28
|
return out;
|
|
29
29
|
}
|
|
30
30
|
export function showToast(type, source, requestOptions, globalConfig, responseConfig) {
|
|
31
|
-
if (
|
|
31
|
+
if (requestOptions === false) return;
|
|
32
|
+
const requestTypeOptions = requestOptions?.[type];
|
|
33
|
+
if (requestTypeOptions === false) return;
|
|
32
34
|
const typeConfig = globalConfig[type];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const requestShow = requestTypeOptions?.show;
|
|
36
|
+
const globalShow = globalConfig.enabled !== false && typeConfig?.show !== false;
|
|
37
|
+
if (requestShow === false || requestShow === void 0 && !globalShow) return;
|
|
35
38
|
const message = pickMessage(type, source, requestOptions, responseConfig);
|
|
36
39
|
if (!message) return;
|
|
37
40
|
const toast = getToast();
|
|
38
41
|
if (!toast) return;
|
|
39
42
|
const { show: _show, ...typeConfigProps } = typeConfig ?? {};
|
|
40
|
-
const
|
|
43
|
+
const { show: _requestShow, ...requestTypeConfig } = requestTypeOptions ?? {};
|
|
41
44
|
toast.add(compact({
|
|
42
45
|
title: message,
|
|
43
46
|
...typeConfigProps,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IsComponent } from '@movk/core';
|
|
2
2
|
import type { AutoFormControl, _Unset } from '../../types/auto-form/controls';
|
|
3
|
-
import type { InputProps, InputSlots, TextareaProps, TextareaSlots } from '@nuxt/ui';
|
|
3
|
+
import type { CheckboxGroupProps, CheckboxGroupSlots, CheckboxProps, CheckboxSlots, FileUploadProps, FileUploadSlots, InputDateProps, InputDateSlots, InputMenuProps, InputMenuSlots, InputNumberProps, InputNumberSlots, InputProps, InputSlots, InputTagsProps, InputTagsSlots, InputTimeProps, InputTimeSlots, ListboxProps, ListboxSlots, PinInputProps, PinInputSlots, RadioGroupProps, RadioGroupSlots, SelectMenuProps, SelectMenuSlots, SelectProps, SelectSlots, SliderProps, SwitchProps, SwitchSlots, TextareaProps, TextareaSlots } from '@nuxt/ui';
|
|
4
4
|
import type { CalendarDateControlProps } from '../../types/components/date-picker';
|
|
5
|
-
import { UInput
|
|
5
|
+
import { UInput } from '#components';
|
|
6
6
|
export declare function defineControl<C extends IsComponent, P = _Unset, S = _Unset>(e: AutoFormControl<C, P, S>): AutoFormControl<C, P, S>;
|
|
7
7
|
declare const DEFAULT_CONTROL_COMPONENTS: {
|
|
8
8
|
readonly string: any;
|
|
@@ -474,8 +474,8 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
|
|
|
474
474
|
};
|
|
475
475
|
readonly slideVerify: {
|
|
476
476
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("../../types").SlideVerifyProps & {
|
|
477
|
-
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
478
|
-
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
477
|
+
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
|
|
478
|
+
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
|
|
479
479
|
} & {
|
|
480
480
|
modelValue?: boolean;
|
|
481
481
|
}> & Readonly<{
|
|
@@ -504,8 +504,8 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
|
|
|
504
504
|
M: {};
|
|
505
505
|
Defaults: {};
|
|
506
506
|
}, Readonly<import("../../types").SlideVerifyProps & {
|
|
507
|
-
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
508
|
-
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
507
|
+
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
|
|
508
|
+
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
|
|
509
509
|
} & {
|
|
510
510
|
modelValue?: boolean;
|
|
511
511
|
}> & Readonly<{
|
|
@@ -526,8 +526,8 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
|
|
|
526
526
|
__isTeleport?: never;
|
|
527
527
|
__isSuspense?: never;
|
|
528
528
|
} & import("vue").ComponentOptionsBase<Readonly<import("../../types").SlideVerifyProps & {
|
|
529
|
-
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
530
|
-
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("
|
|
529
|
+
size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
|
|
530
|
+
ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
|
|
531
531
|
} & {
|
|
532
532
|
modelValue?: boolean;
|
|
533
533
|
}> & Readonly<{
|
|
@@ -595,8 +595,33 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
|
|
|
595
595
|
};
|
|
596
596
|
};
|
|
597
597
|
type DefaultControlComponents = typeof DEFAULT_CONTROL_COMPONENTS;
|
|
598
|
+
/**
|
|
599
|
+
* Nuxt UI 控件的 `[props, slots]` 类型登记表。
|
|
600
|
+
*
|
|
601
|
+
* `#components` 在模块声明发射期无法解析,`U*` 组件类型会退化为 `any`,
|
|
602
|
+
* 使 `controlProps` / `controlSlots` 在消费端失去类型提示;此处显式登记以绕开组件推导。
|
|
603
|
+
*/
|
|
604
|
+
interface NuxtUIControlTypes {
|
|
605
|
+
string: [InputProps, InputSlots];
|
|
606
|
+
number: [InputNumberProps, InputNumberSlots];
|
|
607
|
+
boolean: [CheckboxProps, CheckboxSlots];
|
|
608
|
+
enum: [SelectProps, SelectSlots];
|
|
609
|
+
file: [FileUploadProps, FileUploadSlots];
|
|
610
|
+
inputDate: [InputDateProps, InputDateSlots];
|
|
611
|
+
inputTime: [InputTimeProps, InputTimeSlots];
|
|
612
|
+
textarea: [TextareaProps, TextareaSlots];
|
|
613
|
+
switch: [SwitchProps, SwitchSlots];
|
|
614
|
+
slider: [SliderProps, _Unset];
|
|
615
|
+
selectMenu: [SelectMenuProps, SelectMenuSlots];
|
|
616
|
+
inputMenu: [InputMenuProps, InputMenuSlots];
|
|
617
|
+
checkboxGroup: [CheckboxGroupProps, CheckboxGroupSlots];
|
|
618
|
+
radioGroup: [RadioGroupProps, RadioGroupSlots];
|
|
619
|
+
inputTags: [InputTagsProps, InputTagsSlots];
|
|
620
|
+
pinInput: [PinInputProps, PinInputSlots];
|
|
621
|
+
listbox: [ListboxProps, ListboxSlots];
|
|
622
|
+
}
|
|
598
623
|
type DefaultControlMap = {
|
|
599
|
-
readonly [K in keyof DefaultControlComponents]: K extends
|
|
624
|
+
readonly [K in keyof DefaultControlComponents]: K extends keyof NuxtUIControlTypes ? AutoFormControl<DefaultControlComponents[K], NuxtUIControlTypes[K][0], NuxtUIControlTypes[K][1]> : K extends 'calendarDate' ? AutoFormControl<DefaultControlComponents[K], CalendarDateControlProps> : AutoFormControl<DefaultControlComponents[K]>;
|
|
600
625
|
};
|
|
601
626
|
export declare const DEFAULT_CONTROLS: DefaultControlMap;
|
|
602
627
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ThemeFontOption {
|
|
2
|
+
name: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
}
|
|
5
|
+
export type ThemeFontLink = {
|
|
6
|
+
rel: 'stylesheet';
|
|
7
|
+
href: string;
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function googleFontsHref(name: string): string;
|
|
11
|
+
export declare function resolveFontId(name: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* 仅为已登记的字体解析样式表地址:缺省 href 的可选项视为 Google Fonts 托管,
|
|
14
|
+
* 未登记的字体不猜测来源,避免在无法访问 Google 的网络环境下发出必然失败的请求。
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveFontHref(name: string, fonts: ThemeFontOption[]): string | undefined;
|
|
17
|
+
export declare function resolveFontLinks(name: string | undefined, fonts: ThemeFontOption[]): ThemeFontLink[];
|
|
18
|
+
/**
|
|
19
|
+
* 未指定字体时输出空规则。该 style 无层级(unlayered),会压过使用者写在
|
|
20
|
+
* `@theme` 中的 `--font-sans`,因此只在字体被显式配置或用户主动切换时才声明。
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveFontStyle(name: string | undefined): string;
|
|
23
|
+
/**
|
|
24
|
+
* 合并用户选择与配置的默认字体。项目未配置 `theme.font` 时 localStorage 会存下空串,
|
|
25
|
+
* 之后再配置默认字体不应被这份历史残留屏蔽,故空串视同未选择。
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveActiveFont(stored: string | undefined, configured: string | undefined): string;
|
|
28
|
+
/** 预解析全部可选项地址,供预水合脚本查表,避免客户端重复猜测字体来源 */
|
|
29
|
+
export declare function resolveFontHrefMap(fonts: ThemeFontOption[]): Record<string, string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function googleFontsHref(name) {
|
|
2
|
+
return `https://fonts.googleapis.com/css2?family=${encodeURIComponent(name)}:wght@400;500;600;700&display=swap`;
|
|
3
|
+
}
|
|
4
|
+
export function resolveFontId(name) {
|
|
5
|
+
return `font-${name.toLowerCase().replace(/\s+/g, "-")}`;
|
|
6
|
+
}
|
|
7
|
+
export function resolveFontHref(name, fonts) {
|
|
8
|
+
const option = fonts.find((f) => f.name === name);
|
|
9
|
+
if (!option) return void 0;
|
|
10
|
+
return option.href ?? googleFontsHref(name);
|
|
11
|
+
}
|
|
12
|
+
export function resolveFontLinks(name, fonts) {
|
|
13
|
+
if (!name) return [];
|
|
14
|
+
const href = resolveFontHref(name, fonts);
|
|
15
|
+
if (!href) return [];
|
|
16
|
+
return [{ rel: "stylesheet", href, id: resolveFontId(name) }];
|
|
17
|
+
}
|
|
18
|
+
export function resolveFontStyle(name) {
|
|
19
|
+
if (!name) return ":root {}";
|
|
20
|
+
return `:root { --font-sans: ${JSON.stringify(name)}, sans-serif; }`;
|
|
21
|
+
}
|
|
22
|
+
export function resolveActiveFont(stored, configured) {
|
|
23
|
+
return stored || configured || "";
|
|
24
|
+
}
|
|
25
|
+
export function resolveFontHrefMap(fonts) {
|
|
26
|
+
return Object.fromEntries(
|
|
27
|
+
fonts.map((f) => [f.name, f.href ?? googleFontsHref(f.name)])
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** 合并用户选择与配置的默认圆角。0 是合法档位,仅 null/undefined 视为未选择 */
|
|
2
|
+
export declare function resolveActiveRadius(stored: number | null | undefined, configured: number | undefined): number | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* 缺省时输出空规则。该 style 无层级(unlayered),会压过项目 CSS 写在
|
|
5
|
+
* `@theme` 中的 `--ui-radius`,因此只在圆角被显式配置或用户主动切换时才声明。
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveRadiusStyle(radius: number | undefined): string;
|
package/dist/runtime/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss" theme(static);@import "@nuxt/ui";@import "#build/movk-ui.css";@source "./components";@
|
|
1
|
+
@import "tailwindcss" theme(static);@import "@nuxt/ui";@import "#build/movk-ui.css";@source "./components";@layer base{[role=button]:not(:disabled),button:not(:disabled){cursor:pointer}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { kebabCase } from "@movk/core";
|
|
2
2
|
import { defineNuxtPlugin, useAppConfig, useHead, useSiteConfig } from "#imports";
|
|
3
3
|
import { resolveThemeIcons } from "../domains/theme/theme-icons.js";
|
|
4
|
+
import { resolveFontHrefMap } from "../domains/theme/theme-font.js";
|
|
4
5
|
export default defineNuxtPlugin({
|
|
5
6
|
enforce: "post",
|
|
6
7
|
setup() {
|
|
@@ -17,11 +18,7 @@ export default defineNuxtPlugin({
|
|
|
17
18
|
}
|
|
18
19
|
if (import.meta.server) {
|
|
19
20
|
const pickerFonts = appConfig.movk?.picker?.fonts ?? [];
|
|
20
|
-
const
|
|
21
|
-
for (const f of pickerFonts) {
|
|
22
|
-
if (f.href) fontHrefMap[f.name] = f.href;
|
|
23
|
-
}
|
|
24
|
-
const fontHrefMapJson = JSON.stringify(fontHrefMap);
|
|
21
|
+
const fontHrefMapJson = JSON.stringify(resolveFontHrefMap(pickerFonts));
|
|
25
22
|
useHead({
|
|
26
23
|
script: [{
|
|
27
24
|
innerHTML: `
|
|
@@ -69,8 +66,8 @@ export default defineNuxtPlugin({
|
|
|
69
66
|
tagPriority: -1
|
|
70
67
|
}, {
|
|
71
68
|
innerHTML: `
|
|
72
|
-
var r = localStorage.getItem('${name}-ui-radius');
|
|
73
|
-
if (r) document.documentElement.style.setProperty('--ui-radius', r + 'rem');
|
|
69
|
+
var r = parseFloat(localStorage.getItem('${name}-ui-radius'));
|
|
70
|
+
if (isFinite(r)) document.documentElement.style.setProperty('--ui-radius', r + 'rem');
|
|
74
71
|
`.replace(/\s+/g, " "),
|
|
75
72
|
type: "text/javascript",
|
|
76
73
|
tagPriority: -1
|
|
@@ -83,16 +80,22 @@ export default defineNuxtPlugin({
|
|
|
83
80
|
`.replace(/\s+/g, " ")
|
|
84
81
|
}, {
|
|
85
82
|
innerHTML: [
|
|
86
|
-
`if (localStorage.getItem('${name}-ui-font')) {`,
|
|
87
83
|
`var font = localStorage.getItem('${name}-ui-font');`,
|
|
84
|
+
`if (font) {`,
|
|
88
85
|
`var fontEl = document.querySelector('style#nuxt-ui-font');`,
|
|
89
|
-
|
|
86
|
+
// textContent 而非 innerHTML:字体名来自 localStorage,避免被当作标记解析
|
|
87
|
+
`if (fontEl) { fontEl.textContent = ':root { --font-sans: ' + JSON.stringify(font) + ', sans-serif; }'; }`,
|
|
90
88
|
`var fontMap = ${fontHrefMapJson};`,
|
|
89
|
+
`var href = fontMap[font];`,
|
|
90
|
+
`var id = 'font-' + font.toLowerCase().replace(/\\s+/g, '-');`,
|
|
91
|
+
// 未登记的字体不猜测来源;已由 SSR 输出的 link 不重复插入
|
|
92
|
+
`if (href && !document.getElementById(id)) {`,
|
|
91
93
|
`var lnk = document.createElement('link');`,
|
|
92
94
|
`lnk.rel = 'stylesheet';`,
|
|
93
|
-
`lnk.href =
|
|
94
|
-
`lnk.id =
|
|
95
|
+
`lnk.href = href;`,
|
|
96
|
+
`lnk.id = id;`,
|
|
95
97
|
`document.head.appendChild(lnk);`,
|
|
98
|
+
`}`,
|
|
96
99
|
`}`
|
|
97
100
|
].join(" ")
|
|
98
101
|
}]
|
|
@@ -40,13 +40,19 @@ export interface ApiAuthConfig {
|
|
|
40
40
|
* 令牌来源类型
|
|
41
41
|
* @defaultValue 'session'
|
|
42
42
|
*/
|
|
43
|
-
tokenSource?: Suggest<'session'>;
|
|
43
|
+
tokenSource?: Suggest<'session' | 'public-runtime-config'>;
|
|
44
44
|
/**
|
|
45
45
|
* 令牌在会话对象中的路径(支持点号分隔的嵌套路径)
|
|
46
46
|
* @defaultValue 'token'
|
|
47
47
|
* @example 'token' | 'user.accessToken' | 'auth.credentials.token'
|
|
48
48
|
*/
|
|
49
49
|
sessionTokenPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* 令牌在 runtimeConfig.public 中的路径(支持点号分隔的嵌套路径),仅当 tokenSource 为 'public-runtime-config' 时生效
|
|
52
|
+
* @defaultValue 'apiToken'
|
|
53
|
+
* @example 'llmApiKey' | 'api.token'
|
|
54
|
+
*/
|
|
55
|
+
tokenPath?: string;
|
|
50
56
|
/**
|
|
51
57
|
* 令牌类型前缀
|
|
52
58
|
* @defaultValue 'Bearer'
|
|
@@ -73,7 +79,7 @@ export interface ApiAuthConfig {
|
|
|
73
79
|
clearSession?: boolean;
|
|
74
80
|
};
|
|
75
81
|
}
|
|
76
|
-
export interface ApiToast extends Toast {
|
|
82
|
+
export interface ApiToast extends Partial<Toast> {
|
|
77
83
|
/**
|
|
78
84
|
* 是否显示提示
|
|
79
85
|
* @defaultValue true
|
|
@@ -112,6 +118,11 @@ export interface ApiEndpointPublicConfig {
|
|
|
112
118
|
* 端点别名(用于标识)
|
|
113
119
|
*/
|
|
114
120
|
alias?: string;
|
|
121
|
+
/**
|
|
122
|
+
* 该端点的公开请求头,会进入 public runtimeConfig,服务端与客户端均注入
|
|
123
|
+
* @description 仅用于非机密固定头(如 API 版本、租户标识),机密请用 headers
|
|
124
|
+
*/
|
|
125
|
+
publicHeaders?: Record<string, string>;
|
|
115
126
|
/**
|
|
116
127
|
* 端点级别的认证配置(覆盖全局配置)
|
|
117
128
|
*/
|
|
@@ -89,6 +89,6 @@ export interface ResolvedEndpointConfig extends Omit<ApiEndpointPublicConfig, 'a
|
|
|
89
89
|
toast: ApiToastConfig;
|
|
90
90
|
/** 响应配置(已合并全局默认值,必然存在) */
|
|
91
91
|
response: ApiResponseConfig;
|
|
92
|
-
/**
|
|
92
|
+
/** 请求头(服务端私有 headers 与端点 publicHeaders 的合并结果,同名键私有优先) */
|
|
93
93
|
headers?: Record<string, string>;
|
|
94
94
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiToast } from './config';
|
|
2
2
|
declare module 'ofetch' {
|
|
3
3
|
interface FetchOptions {
|
|
4
4
|
context?: ApiFetchContext;
|
|
@@ -27,10 +27,10 @@ export interface ApiFetchContext {
|
|
|
27
27
|
* @description 用于单个请求的 Toast 配置,可覆盖全局配置
|
|
28
28
|
*/
|
|
29
29
|
export interface RequestToastOptions {
|
|
30
|
-
/** 成功提示配置,设置为 false
|
|
31
|
-
success?:
|
|
32
|
-
/** 错误提示配置,设置为 false
|
|
33
|
-
error?:
|
|
30
|
+
/** 成功提示配置,设置为 false 禁用成功提示;`show: true` 可覆盖全局关闭 */
|
|
31
|
+
success?: ApiToast | false;
|
|
32
|
+
/** 错误提示配置,设置为 false 禁用错误提示;`show: true` 可覆盖全局关闭 */
|
|
33
|
+
error?: ApiToast | false;
|
|
34
34
|
/** 自定义成功消息 */
|
|
35
35
|
successMessage?: string;
|
|
36
36
|
/** 自定义错误消息 */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
+
import type { VNodeProps } from 'vue';
|
|
2
3
|
import type { CalendarDate, Time } from '@internationalized/date';
|
|
3
4
|
import type { ComponentProps, ComponentSlots, IsAny, IsComponent, KnownKeys, OmitByKey, Prettify, ReactiveValue, UnionToIntersection, WidenLiteral } from '@movk/core';
|
|
4
5
|
import type { ValueFormat } from '../../composables/useDateFormatter';
|
|
@@ -20,16 +21,29 @@ type _HasLayoutMarker<S> = {
|
|
|
20
21
|
}[keyof S] extends never ? false : true;
|
|
21
22
|
type ExtractLayoutShape<S extends Record<string, any>> = _HasLayoutMarker<S> extends true ? LayoutRestShape<S> & LayoutFieldShape<S> : S;
|
|
22
23
|
type StrictComponentProps<C extends IsComponent> = {
|
|
23
|
-
[K in keyof ComponentProps<C> as {} extends Record<K, unknown> ? never : K]: ComponentProps<C>[K];
|
|
24
|
+
[K in keyof ComponentProps<C> as K extends keyof VNodeProps ? never : {} extends Record<K, unknown> ? never : K]: ComponentProps<C>[K];
|
|
25
|
+
};
|
|
26
|
+
/** 控件事件监听通道;回调由 enhanceEventProps 追加字段上下文作为末位参数 */
|
|
27
|
+
type ControlEventProps = {
|
|
28
|
+
[K in `on${string}`]?: (...args: any[]) => void;
|
|
24
29
|
};
|
|
25
30
|
type StrictComponentSlots<C extends IsComponent> = IsAny<ComponentSlots<C>> extends true ? {} : ComponentSlots<C>;
|
|
26
31
|
type ControlKey<TControls extends AutoFormControls> = Extract<KnownKeys<TControls>, string>;
|
|
27
32
|
type ControlEntryByKey<TControls extends AutoFormControls, K extends string> = K extends keyof TControls ? TControls[K] : never;
|
|
33
|
+
type _IsUnion<T, U = T> = T extends U ? ([U] extends [T] ? false : true) : never;
|
|
34
|
+
/**
|
|
35
|
+
* 单一字面量放宽、多成员联合保留。
|
|
36
|
+
*
|
|
37
|
+
* Nuxt UI 的 props 泛型默认值偏窄(`M extends boolean = false`、`VK = 'value'`),
|
|
38
|
+
* 不放宽会让 `multiple: true` 之类的合法取值报错;而 `size` / `color` / `orientation`
|
|
39
|
+
* 这类真实字面量联合必须原样保留,否则失去补全。
|
|
40
|
+
*/
|
|
41
|
+
type _WidenNarrow<T> = IsAny<T> extends true ? T : [NonNullable<T>] extends [never] ? unknown : _IsUnion<NonNullable<T>> extends true ? T : WidenLiteral<T>;
|
|
28
42
|
type _WidenForFactory<T> = {
|
|
29
|
-
[K in keyof T]+?:
|
|
43
|
+
[K in keyof T]+?: _WidenNarrow<T[K]>;
|
|
30
44
|
};
|
|
31
45
|
type _IsUnsetLike<P> = [P] extends [_Unset] ? true : IsAny<P> extends true ? true : [unknown] extends [P] ? true : [keyof P] extends [never] ? true : false;
|
|
32
|
-
type ResolveControlProps<C extends IsComponent, P> = _IsUnsetLike<P> extends true ? StrictComponentProps<C> : Prettify<_WidenForFactory<P> & {}
|
|
46
|
+
type ResolveControlProps<C extends IsComponent, P> = _IsUnsetLike<P> extends true ? StrictComponentProps<C> : Prettify<_WidenForFactory<P> & {}> & ControlEventProps;
|
|
33
47
|
type ExtractControlProps<T> = T extends AutoFormControl<infer C, infer P, any> ? ResolveControlProps<C, P> : T extends {
|
|
34
48
|
component: infer C extends IsComponent;
|
|
35
49
|
} ? StrictComponentProps<C> : {};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import { useFormField } from '@nuxt/ui/composables/useFormField';
|
|
3
|
+
import { useFieldGroup } from '@nuxt/ui/composables/useFieldGroup';
|
|
1
4
|
export declare function omitProps<T extends object, K extends keyof T>(props: T, keys: readonly K[]): Omit<T, K>;
|
|
2
|
-
export declare function useForwardedProps<T extends object, K extends keyof T>(props: T, keys: readonly K[]):
|
|
5
|
+
export declare function useForwardedProps<T extends object, K extends keyof T>(props: T, keys: readonly K[]): ComputedRef<Omit<T, K>>;
|
|
3
6
|
type SizeProps = {
|
|
4
7
|
size?: unknown;
|
|
5
8
|
};
|
|
6
9
|
export declare function useFormFieldBridge<S = unknown, T extends SizeProps = SizeProps>(props?: T): {
|
|
7
|
-
size:
|
|
10
|
+
size: ComputedRef<S | undefined>;
|
|
8
11
|
emitFormInput: () => void;
|
|
9
12
|
emitFormBlur: () => void;
|
|
10
13
|
emitFormChange: () => void;
|
|
@@ -15,19 +18,14 @@ type FieldControlProps = {
|
|
|
15
18
|
color?: unknown;
|
|
16
19
|
disabled?: boolean;
|
|
17
20
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
highlight: import("vue").ComputedRef<boolean | undefined>;
|
|
27
|
-
emitFormBlur: () => void;
|
|
28
|
-
emitFormInput: import("@vueuse/core").UseDebounceFnReturn<() => void>;
|
|
29
|
-
emitFormChange: () => void;
|
|
30
|
-
emitFormFocus: () => void;
|
|
31
|
-
ariaAttrs: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
21
|
+
type FieldSize<T extends FieldControlProps> = NonNullable<T['size']> | undefined;
|
|
22
|
+
type FieldColor<T extends FieldControlProps> = NonNullable<T['color']> | 'error' | undefined;
|
|
23
|
+
type FieldControl<T extends FieldControlProps> = Omit<ReturnType<typeof useFormField<T>>, 'size' | 'color' | 'disabled'> & {
|
|
24
|
+
size: ComputedRef<FieldSize<T>>;
|
|
25
|
+
disabled: ComputedRef<boolean>;
|
|
26
|
+
color: ComputedRef<FieldColor<T>>;
|
|
27
|
+
fieldGroupSize: ReturnType<typeof useFieldGroup<T>>['size'];
|
|
28
|
+
fieldGroupOrientation: ReturnType<typeof useFieldGroup<T>>['orientation'];
|
|
32
29
|
};
|
|
30
|
+
export declare function useFieldControl<T extends FieldControlProps>(props: T): FieldControl<T>;
|
|
33
31
|
export {};
|
|
@@ -13,9 +13,11 @@ export function getDefaultConfig(theme) {
|
|
|
13
13
|
const pickerNeutralColors = theme?.neutralColors ?? ["slate", "gray", "zinc", "neutral", "stone", "taupe", "mauve", "mist", "olive"];
|
|
14
14
|
return {
|
|
15
15
|
dir: "ltr",
|
|
16
|
-
radius
|
|
16
|
+
// 缺省不指定圆角:运行时不注入 --ui-radius,沿用 @nuxt/ui 默认值或项目 CSS
|
|
17
|
+
radius: theme?.radius,
|
|
17
18
|
blackAsPrimary: false,
|
|
18
|
-
font
|
|
19
|
+
// 缺省不指定字体:运行时不注入 --font-sans,交由项目 CSS 的 @theme 决定
|
|
20
|
+
font: theme?.font ?? "",
|
|
19
21
|
icons: "lucide",
|
|
20
22
|
prefix: theme?.prefix,
|
|
21
23
|
tv: {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@11.
|
|
4
|
+
"version": "1.6.0",
|
|
5
|
+
"packageManager": "pnpm@11.18.0",
|
|
6
6
|
"description": "An engineering suite built on Nuxt UI: schema-driven AutoForm (Zod v4), a full-featured DataTable, standalone UI components and composables. Get the full capabilities — including API integration with auth & progress — in Nuxt 4, and use its UI, forms, tables and theming in plain Vue + Vite via the Vite plugin.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -124,28 +124,28 @@
|
|
|
124
124
|
"test:vue": "vitest --project vue"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
|
-
"@iconify-json/lucide": "^1.2.
|
|
127
|
+
"@iconify-json/lucide": "^1.2.120",
|
|
128
128
|
"@iconify-json/ph": "^1.2.2",
|
|
129
|
-
"@iconify-json/tabler": "^1.2.
|
|
129
|
+
"@iconify-json/tabler": "^1.2.38",
|
|
130
130
|
"@internationalized/date": "^3.12.2",
|
|
131
|
-
"@movk/core": "^1.
|
|
132
|
-
"@nuxt/image": "^2.
|
|
131
|
+
"@movk/core": "^1.4.1",
|
|
132
|
+
"@nuxt/image": "^2.1.0",
|
|
133
133
|
"@nuxt/ui": "^4.10.0",
|
|
134
134
|
"@tanstack/vue-table": "^8.21.3",
|
|
135
|
-
"@vueuse/core": "^14.
|
|
136
|
-
"@vueuse/nuxt": "^14.
|
|
135
|
+
"@vueuse/core": "^14.4.0",
|
|
136
|
+
"@vueuse/nuxt": "^14.4.0",
|
|
137
137
|
"colortranslator": "^6.1.1",
|
|
138
138
|
"defu": "^6.1.7",
|
|
139
|
-
"magic-string": "^
|
|
139
|
+
"magic-string": "^1.1.0",
|
|
140
140
|
"maska": "^3.2.0",
|
|
141
141
|
"mlly": "^1.8.2",
|
|
142
142
|
"nuxt-auth-utils": "^0.5.29",
|
|
143
|
-
"nuxt-site-config": "^4.1.
|
|
143
|
+
"nuxt-site-config": "^4.1.2",
|
|
144
144
|
"pathe": "^2.0.3",
|
|
145
145
|
"reka-ui": "2.10.1",
|
|
146
146
|
"scule": "^1.3.0",
|
|
147
|
-
"tailwind-variants": "^3.
|
|
148
|
-
"tailwindcss": "^4.3.
|
|
147
|
+
"tailwind-variants": "^3.3.0",
|
|
148
|
+
"tailwindcss": "^4.3.3",
|
|
149
149
|
"tinyglobby": "^0.2.17",
|
|
150
150
|
"unifont": "^0.7.4",
|
|
151
151
|
"unplugin": "^3.3.0",
|
|
@@ -153,20 +153,20 @@
|
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
155
|
"@nuxt/eslint-config": "^1.16.0",
|
|
156
|
-
"@nuxt/kit": "^4.
|
|
157
|
-
"@nuxt/module-builder": "^1.0.
|
|
158
|
-
"@nuxt/schema": "^4.
|
|
159
|
-
"@release-it/conventional-changelog": "^
|
|
160
|
-
"eslint": "^10.
|
|
161
|
-
"happy-dom": "^20.
|
|
162
|
-
"nuxt": "^4.
|
|
163
|
-
"release-it": "^
|
|
156
|
+
"@nuxt/kit": "^4.5.1",
|
|
157
|
+
"@nuxt/module-builder": "^1.0.3",
|
|
158
|
+
"@nuxt/schema": "^4.5.1",
|
|
159
|
+
"@release-it/conventional-changelog": "^12.0.0",
|
|
160
|
+
"eslint": "^10.8.0",
|
|
161
|
+
"happy-dom": "^20.11.1",
|
|
162
|
+
"nuxt": "^4.5.1",
|
|
163
|
+
"release-it": "^21.0.0",
|
|
164
164
|
"typescript": "^6.0.3",
|
|
165
165
|
"unbuild": "^3.6.1",
|
|
166
166
|
"unplugin-auto-import": "^21.0.0",
|
|
167
167
|
"unplugin-vue-components": "^32.1.0",
|
|
168
168
|
"vitest": "^4.1.10",
|
|
169
|
-
"vue": "^3.5.
|
|
170
|
-
"vue-tsc": "^3.3.
|
|
169
|
+
"vue": "^3.5.40",
|
|
170
|
+
"vue-tsc": "^3.3.8"
|
|
171
171
|
}
|
|
172
172
|
}
|