@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.
- package/dist/module.d.mts +11 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +56 -13
- package/dist/runtime/components/AutoForm.vue +1 -0
- package/dist/runtime/components/SlideVerify.d.vue.ts +107 -0
- package/dist/runtime/components/SlideVerify.vue +147 -0
- package/dist/runtime/components/SlideVerify.vue.d.ts +107 -0
- package/dist/runtime/components/StarRating.vue +1 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +1 -1
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +3 -0
- package/dist/runtime/components/theme-picker/ThemePicker.vue +235 -0
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +3 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +18 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +34 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +18 -0
- package/dist/runtime/composables/useApiFetch.js +1 -3
- package/dist/runtime/composables/useAutoForm.d.ts +81 -1425
- package/dist/runtime/composables/useAutoForm.js +3 -1
- package/dist/runtime/composables/useTheme.d.ts +21 -0
- package/dist/runtime/composables/useTheme.js +143 -0
- package/dist/runtime/composables/useUploadWithProgress.js +2 -2
- package/dist/runtime/internal/useAutoFormProvider.js +2 -2
- package/dist/runtime/plugins/api.factory.js +28 -30
- package/dist/runtime/plugins/theme.d.ts +2 -0
- package/dist/runtime/plugins/theme.js +89 -0
- package/dist/runtime/schemas/api.d.ts +336 -100
- package/dist/runtime/schemas/api.js +114 -98
- package/dist/runtime/style.css +1 -0
- package/dist/runtime/types/api.d.ts +108 -108
- package/dist/runtime/types/api.js +0 -8
- package/dist/runtime/utils/api-utils.d.ts +45 -30
- package/package.json +19 -19
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import { ApiClient,
|
|
2
|
+
import { ApiClient, MovkApiPublicConfig, MovkApiPrivateConfig } from '../dist/runtime/types/index.js';
|
|
3
3
|
export * from '../dist/runtime/types/index.js';
|
|
4
4
|
|
|
5
5
|
declare const moduleOptionsSchema: any;
|
|
@@ -15,10 +15,18 @@ declare module 'nuxt/schema' {
|
|
|
15
15
|
interface NuxtOptions {
|
|
16
16
|
['movk']: ModuleOptions;
|
|
17
17
|
}
|
|
18
|
+
interface PublicRuntimeConfig {
|
|
19
|
+
movkApi: MovkApiPublicConfig;
|
|
20
|
+
}
|
|
18
21
|
interface RuntimeConfig {
|
|
22
|
+
movkApi: MovkApiPrivateConfig;
|
|
19
23
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
24
|
+
interface AppConfig {
|
|
25
|
+
theme: {
|
|
26
|
+
radius: number;
|
|
27
|
+
blackAsPrimary: boolean;
|
|
28
|
+
font: string;
|
|
29
|
+
};
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
32
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir,
|
|
2
|
-
import defu from 'defu';
|
|
1
|
+
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addServerHandler, addTypeTemplate } from '@nuxt/kit';
|
|
3
2
|
import { z } from 'zod/v4';
|
|
4
|
-
import {
|
|
3
|
+
import { movkApiFullConfigSchema, apiToastConfigSchema, apiAuthConfigSchema, apiResponseConfigSchema } from '../dist/runtime/schemas/api.js';
|
|
4
|
+
import defu from 'defu';
|
|
5
5
|
export * from '../dist/runtime/types/index.js';
|
|
6
6
|
|
|
7
7
|
const name = "@movk/nuxt";
|
|
8
|
-
const version = "1.
|
|
8
|
+
const version = "1.1.0";
|
|
9
|
+
|
|
10
|
+
function setupTheme(nuxt, resolve) {
|
|
11
|
+
nuxt.options.appConfig.theme = defu(nuxt.options.appConfig.theme || {}, {
|
|
12
|
+
radius: 0.25,
|
|
13
|
+
blackAsPrimary: false,
|
|
14
|
+
font: "Public Sans"
|
|
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
|
+
}
|
|
9
26
|
|
|
10
27
|
const moduleOptionsSchema = z.object({
|
|
11
28
|
/**
|
|
@@ -16,7 +33,7 @@ const moduleOptionsSchema = z.object({
|
|
|
16
33
|
/**
|
|
17
34
|
* API 模块配置
|
|
18
35
|
*/
|
|
19
|
-
api:
|
|
36
|
+
api: movkApiFullConfigSchema.optional()
|
|
20
37
|
});
|
|
21
38
|
const module$1 = defineNuxtModule({
|
|
22
39
|
meta: {
|
|
@@ -33,31 +50,57 @@ const module$1 = defineNuxtModule({
|
|
|
33
50
|
version: ">=2.0.0"
|
|
34
51
|
},
|
|
35
52
|
"@nuxt/ui": {
|
|
36
|
-
version: ">=4.
|
|
53
|
+
version: ">=4.3.0"
|
|
37
54
|
},
|
|
38
55
|
"@vueuse/nuxt": {
|
|
39
56
|
version: ">=14.1.0"
|
|
40
57
|
},
|
|
58
|
+
"nuxt-og-image": {
|
|
59
|
+
version: ">=5.1.13"
|
|
60
|
+
},
|
|
41
61
|
"nuxt-auth-utils": {
|
|
42
|
-
version: ">=0.5.
|
|
62
|
+
version: ">=0.5.26"
|
|
43
63
|
}
|
|
44
64
|
},
|
|
45
65
|
async setup(options, nuxt) {
|
|
46
66
|
const { resolve } = createResolver(import.meta.url);
|
|
47
|
-
nuxt
|
|
67
|
+
setupTheme(nuxt, resolve);
|
|
48
68
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
49
|
-
|
|
50
|
-
const apiConfig = movkApiModuleOptionsSchema.parse(options.api ?? {});
|
|
51
|
-
nuxt.options.runtimeConfig.public.movkApi = apiConfig;
|
|
69
|
+
const apiConfig = options.api || {};
|
|
52
70
|
addComponentsDir({
|
|
53
71
|
path: resolve("runtime/components"),
|
|
54
72
|
prefix: options.prefix,
|
|
55
73
|
pathPrefix: false,
|
|
56
|
-
ignore: ["auto-form-renderer/**"]
|
|
74
|
+
ignore: ["auto-form-renderer/**", "theme-picker/ThemePickerButton.vue"]
|
|
57
75
|
});
|
|
76
|
+
nuxt.options.css.push(resolve("runtime/style.css"));
|
|
58
77
|
addImportsDir(resolve("runtime/composables"));
|
|
59
78
|
addImportsDir(resolve("runtime/shared"));
|
|
60
|
-
if (apiConfig.enabled) {
|
|
79
|
+
if (apiConfig.enabled !== false) {
|
|
80
|
+
const publicEndpoints = {};
|
|
81
|
+
const privateEndpoints = {};
|
|
82
|
+
if (apiConfig.endpoints) {
|
|
83
|
+
for (const [endpointName, endpoint] of Object.entries(apiConfig.endpoints)) {
|
|
84
|
+
const { headers, ...publicConfig2 } = endpoint;
|
|
85
|
+
publicEndpoints[endpointName] = publicConfig2;
|
|
86
|
+
if (headers) {
|
|
87
|
+
privateEndpoints[endpointName] = { headers };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const publicConfig = {
|
|
92
|
+
defaultEndpoint: apiConfig.defaultEndpoint ?? "default",
|
|
93
|
+
debug: apiConfig.debug ?? false,
|
|
94
|
+
endpoints: Object.keys(publicEndpoints).length > 0 ? publicEndpoints : { default: { baseURL: "/api" } },
|
|
95
|
+
response: apiResponseConfigSchema.parse(apiConfig.response ?? {}),
|
|
96
|
+
auth: apiAuthConfigSchema.parse(apiConfig.auth ?? {}),
|
|
97
|
+
toast: apiToastConfigSchema.parse(apiConfig.toast ?? {})
|
|
98
|
+
};
|
|
99
|
+
const privateConfig = {
|
|
100
|
+
endpoints: Object.keys(privateEndpoints).length > 0 ? privateEndpoints : void 0
|
|
101
|
+
};
|
|
102
|
+
nuxt.options.runtimeConfig.movkApi = privateConfig;
|
|
103
|
+
nuxt.options.runtimeConfig.public.movkApi = publicConfig;
|
|
61
104
|
addPlugin({
|
|
62
105
|
src: resolve("runtime/plugins/api.factory"),
|
|
63
106
|
mode: "all"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
|
+
export interface SlideVerifyProps {
|
|
3
|
+
/**
|
|
4
|
+
* 滑块宽度
|
|
5
|
+
* @defaultValue 50
|
|
6
|
+
*/
|
|
7
|
+
sliderWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* 滑块高度
|
|
10
|
+
* @defaultValue 44
|
|
11
|
+
*/
|
|
12
|
+
height?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 待滑动时的提示文本
|
|
20
|
+
* @defaultValue '请向右滑动验证'
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 验证成功时的提示文本
|
|
25
|
+
* @defaultValue '验证成功'
|
|
26
|
+
*/
|
|
27
|
+
successText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 滑块图标
|
|
30
|
+
* @defaultValue 'i-lucide-chevrons-right'
|
|
31
|
+
*/
|
|
32
|
+
icon?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 验证成功时的图标
|
|
35
|
+
* @defaultValue 'i-lucide-check'
|
|
36
|
+
*/
|
|
37
|
+
successIcon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 完成验证所需的阈值百分比(0-1)
|
|
40
|
+
* @defaultValue 0.9
|
|
41
|
+
*/
|
|
42
|
+
threshold?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 自定义轨道样式
|
|
45
|
+
*/
|
|
46
|
+
trackClass?: ClassNameValue;
|
|
47
|
+
/**
|
|
48
|
+
* 自定义滑块样式
|
|
49
|
+
*/
|
|
50
|
+
sliderClass?: ClassNameValue;
|
|
51
|
+
/**
|
|
52
|
+
* 自定义文本样式
|
|
53
|
+
*/
|
|
54
|
+
textClass?: ClassNameValue;
|
|
55
|
+
/**
|
|
56
|
+
* 自定义根元素样式
|
|
57
|
+
*/
|
|
58
|
+
class?: ClassNameValue;
|
|
59
|
+
}
|
|
60
|
+
export interface SlideVerifyEmits {
|
|
61
|
+
success: [];
|
|
62
|
+
dragStart: [];
|
|
63
|
+
dragEnd: [success: boolean];
|
|
64
|
+
}
|
|
65
|
+
type __VLS_Props = SlideVerifyProps;
|
|
66
|
+
declare function reset(): void;
|
|
67
|
+
type __VLS_ModelProps = {
|
|
68
|
+
modelValue?: boolean;
|
|
69
|
+
};
|
|
70
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
71
|
+
declare var __VLS_22: {
|
|
72
|
+
verified: boolean;
|
|
73
|
+
progress: number;
|
|
74
|
+
};
|
|
75
|
+
type __VLS_Slots = {} & {
|
|
76
|
+
slider?: (props: typeof __VLS_22) => any;
|
|
77
|
+
};
|
|
78
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
79
|
+
reset: typeof reset;
|
|
80
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
81
|
+
"update:modelValue": (value: boolean) => any;
|
|
82
|
+
success: () => any;
|
|
83
|
+
dragStart: () => any;
|
|
84
|
+
dragEnd: (success: boolean) => any;
|
|
85
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
86
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
87
|
+
onSuccess?: (() => any) | undefined;
|
|
88
|
+
onDragStart?: (() => any) | undefined;
|
|
89
|
+
onDragEnd?: ((success: boolean) => any) | undefined;
|
|
90
|
+
}>, {
|
|
91
|
+
disabled: boolean;
|
|
92
|
+
icon: string;
|
|
93
|
+
text: string;
|
|
94
|
+
height: number;
|
|
95
|
+
sliderWidth: number;
|
|
96
|
+
successText: string;
|
|
97
|
+
successIcon: string;
|
|
98
|
+
threshold: number;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
100
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
101
|
+
declare const _default: typeof __VLS_export;
|
|
102
|
+
export default _default;
|
|
103
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
104
|
+
new (): {
|
|
105
|
+
$slots: S;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { UIcon } from "#components";
|
|
3
|
+
import { useElementSize } from "@vueuse/core";
|
|
4
|
+
import { Motion } from "motion-v";
|
|
5
|
+
import { computed, ref, useTemplateRef } from "vue";
|
|
6
|
+
defineOptions({ inheritAttrs: false });
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
sliderWidth: { type: Number, required: false, default: 50 },
|
|
9
|
+
height: { type: Number, required: false, default: 44 },
|
|
10
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
11
|
+
text: { type: String, required: false, default: "\u8BF7\u5411\u53F3\u6ED1\u52A8\u9A8C\u8BC1" },
|
|
12
|
+
successText: { type: String, required: false, default: "\u9A8C\u8BC1\u6210\u529F" },
|
|
13
|
+
icon: { type: String, required: false, default: "i-lucide-chevrons-right" },
|
|
14
|
+
successIcon: { type: String, required: false, default: "i-lucide-check" },
|
|
15
|
+
threshold: { type: Number, required: false, default: 0.9 },
|
|
16
|
+
trackClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
17
|
+
sliderClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
18
|
+
textClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
19
|
+
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true }
|
|
20
|
+
});
|
|
21
|
+
const emit = defineEmits(["success", "dragStart", "dragEnd"]);
|
|
22
|
+
const isVerified = defineModel({ type: Boolean, ...{ default: false } });
|
|
23
|
+
const trackRef = useTemplateRef("track");
|
|
24
|
+
const { width: trackWidth } = useElementSize(trackRef);
|
|
25
|
+
const isDragging = ref(false);
|
|
26
|
+
const dragX = ref(0);
|
|
27
|
+
const maxDragDistance = computed(
|
|
28
|
+
() => trackWidth.value ? Math.max(0, trackWidth.value - props.sliderWidth - 8) : 200
|
|
29
|
+
);
|
|
30
|
+
const progress = computed(
|
|
31
|
+
() => isVerified.value ? 1 : maxDragDistance.value ? Math.min(dragX.value / maxDragDistance.value, 1) : 0
|
|
32
|
+
);
|
|
33
|
+
const canInteract = computed(() => !props.disabled && !isVerified.value);
|
|
34
|
+
const springTransition = { type: "spring", stiffness: 400, damping: 30 };
|
|
35
|
+
function handleDragStart() {
|
|
36
|
+
if (!canInteract.value) return;
|
|
37
|
+
isDragging.value = true;
|
|
38
|
+
emit("dragStart");
|
|
39
|
+
}
|
|
40
|
+
function handleDrag(_event, info) {
|
|
41
|
+
if (!canInteract.value) return;
|
|
42
|
+
dragX.value = Math.max(0, Math.min(info.offset.x, maxDragDistance.value));
|
|
43
|
+
}
|
|
44
|
+
function handleDragEnd() {
|
|
45
|
+
if (!canInteract.value) return;
|
|
46
|
+
isDragging.value = false;
|
|
47
|
+
const success = progress.value >= props.threshold;
|
|
48
|
+
if (success) {
|
|
49
|
+
isVerified.value = true;
|
|
50
|
+
emit("success");
|
|
51
|
+
} else {
|
|
52
|
+
dragX.value = 0;
|
|
53
|
+
}
|
|
54
|
+
emit("dragEnd", success);
|
|
55
|
+
}
|
|
56
|
+
function reset() {
|
|
57
|
+
isVerified.value = false;
|
|
58
|
+
dragX.value = 0;
|
|
59
|
+
}
|
|
60
|
+
defineExpose({ reset });
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<div
|
|
65
|
+
:class="[
|
|
66
|
+
'relative select-none overflow-hidden rounded-lg border transition-colors duration-300',
|
|
67
|
+
props.class,
|
|
68
|
+
disabled ? 'opacity-50 cursor-not-allowed' : '',
|
|
69
|
+
isVerified ? 'bg-success border-transparent' : 'bg-elevated border-default'
|
|
70
|
+
]"
|
|
71
|
+
:style="{ height: `${height}px` }"
|
|
72
|
+
role="slider"
|
|
73
|
+
:aria-label="text"
|
|
74
|
+
:aria-valuenow="Math.round(progress * 100)"
|
|
75
|
+
aria-valuemin="0"
|
|
76
|
+
aria-valuemax="100"
|
|
77
|
+
:aria-disabled="disabled"
|
|
78
|
+
>
|
|
79
|
+
<div ref="track" class="absolute inset-0" :class="trackClass">
|
|
80
|
+
<Motion
|
|
81
|
+
v-if="!isVerified"
|
|
82
|
+
as="div"
|
|
83
|
+
class="absolute inset-y-0 left-0 bg-primary/20"
|
|
84
|
+
:animate="{ width: `${progress * 100}%`, opacity: 0.6 }"
|
|
85
|
+
:transition="springTransition"
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
class="absolute inset-0 flex items-center justify-center text-sm font-medium pointer-events-none"
|
|
90
|
+
:class="textClass"
|
|
91
|
+
>
|
|
92
|
+
<Motion
|
|
93
|
+
v-if="!isVerified"
|
|
94
|
+
as="span"
|
|
95
|
+
class="relative inline-block bg-size-[200%_100%] bg-clip-text text-transparent bg-no-repeat"
|
|
96
|
+
:style="{
|
|
97
|
+
backgroundImage: 'radial-gradient(circle at center, var(--color-gray-500), transparent), linear-gradient(var(--color-neutral-400), var(--color-neutral-400))',
|
|
98
|
+
opacity: 1 - progress * 0.5
|
|
99
|
+
}"
|
|
100
|
+
:animate="{ backgroundPosition: '-200% 50%, 0 0' }"
|
|
101
|
+
:initial="{ backgroundPosition: '200% 50%, 0 0' }"
|
|
102
|
+
:transition="{
|
|
103
|
+
repeat: Infinity,
|
|
104
|
+
duration: 2,
|
|
105
|
+
ease: 'linear'
|
|
106
|
+
}"
|
|
107
|
+
>
|
|
108
|
+
{{ text }}
|
|
109
|
+
</Motion>
|
|
110
|
+
<span v-else class="text-inverted font-medium">{{ successText }}</span>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<Motion
|
|
115
|
+
as="div"
|
|
116
|
+
class="absolute inset-1"
|
|
117
|
+
:style="{ width: `${sliderWidth}px` }"
|
|
118
|
+
:initial="{ x: 0 }"
|
|
119
|
+
:animate="{ x: isVerified ? maxDragDistance : isDragging ? dragX : 0 }"
|
|
120
|
+
:transition="isDragging ? { duration: 0 } : springTransition"
|
|
121
|
+
:while-hover="canInteract ? { scale: 1.02 } : void 0"
|
|
122
|
+
:while-tap="canInteract ? { scale: 0.98 } : void 0"
|
|
123
|
+
:drag="canInteract ? 'x' : false"
|
|
124
|
+
:drag-constraints="{ left: 0, right: maxDragDistance }"
|
|
125
|
+
:drag-elastic="0"
|
|
126
|
+
:drag-momentum="false"
|
|
127
|
+
@drag-start="handleDragStart"
|
|
128
|
+
@drag="handleDrag"
|
|
129
|
+
@drag-end="handleDragEnd"
|
|
130
|
+
>
|
|
131
|
+
<div
|
|
132
|
+
class="size-full flex items-center justify-center rounded-md shadow-sm transition-colors"
|
|
133
|
+
:class="[
|
|
134
|
+
sliderClass,
|
|
135
|
+
isVerified ? 'bg-white/90' : 'bg-default cursor-grab active:cursor-grabbing ring-1 ring-default'
|
|
136
|
+
]"
|
|
137
|
+
>
|
|
138
|
+
<slot name="slider" :verified="isVerified" :progress="progress">
|
|
139
|
+
<UIcon
|
|
140
|
+
:name="isVerified ? successIcon : icon"
|
|
141
|
+
:class="['size-5', isVerified ? 'text-success' : 'text-primary']"
|
|
142
|
+
/>
|
|
143
|
+
</slot>
|
|
144
|
+
</div>
|
|
145
|
+
</Motion>
|
|
146
|
+
</div>
|
|
147
|
+
</template>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
|
+
export interface SlideVerifyProps {
|
|
3
|
+
/**
|
|
4
|
+
* 滑块宽度
|
|
5
|
+
* @defaultValue 50
|
|
6
|
+
*/
|
|
7
|
+
sliderWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* 滑块高度
|
|
10
|
+
* @defaultValue 44
|
|
11
|
+
*/
|
|
12
|
+
height?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 待滑动时的提示文本
|
|
20
|
+
* @defaultValue '请向右滑动验证'
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 验证成功时的提示文本
|
|
25
|
+
* @defaultValue '验证成功'
|
|
26
|
+
*/
|
|
27
|
+
successText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 滑块图标
|
|
30
|
+
* @defaultValue 'i-lucide-chevrons-right'
|
|
31
|
+
*/
|
|
32
|
+
icon?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 验证成功时的图标
|
|
35
|
+
* @defaultValue 'i-lucide-check'
|
|
36
|
+
*/
|
|
37
|
+
successIcon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 完成验证所需的阈值百分比(0-1)
|
|
40
|
+
* @defaultValue 0.9
|
|
41
|
+
*/
|
|
42
|
+
threshold?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 自定义轨道样式
|
|
45
|
+
*/
|
|
46
|
+
trackClass?: ClassNameValue;
|
|
47
|
+
/**
|
|
48
|
+
* 自定义滑块样式
|
|
49
|
+
*/
|
|
50
|
+
sliderClass?: ClassNameValue;
|
|
51
|
+
/**
|
|
52
|
+
* 自定义文本样式
|
|
53
|
+
*/
|
|
54
|
+
textClass?: ClassNameValue;
|
|
55
|
+
/**
|
|
56
|
+
* 自定义根元素样式
|
|
57
|
+
*/
|
|
58
|
+
class?: ClassNameValue;
|
|
59
|
+
}
|
|
60
|
+
export interface SlideVerifyEmits {
|
|
61
|
+
success: [];
|
|
62
|
+
dragStart: [];
|
|
63
|
+
dragEnd: [success: boolean];
|
|
64
|
+
}
|
|
65
|
+
type __VLS_Props = SlideVerifyProps;
|
|
66
|
+
declare function reset(): void;
|
|
67
|
+
type __VLS_ModelProps = {
|
|
68
|
+
modelValue?: boolean;
|
|
69
|
+
};
|
|
70
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
71
|
+
declare var __VLS_22: {
|
|
72
|
+
verified: boolean;
|
|
73
|
+
progress: number;
|
|
74
|
+
};
|
|
75
|
+
type __VLS_Slots = {} & {
|
|
76
|
+
slider?: (props: typeof __VLS_22) => any;
|
|
77
|
+
};
|
|
78
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
79
|
+
reset: typeof reset;
|
|
80
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
81
|
+
"update:modelValue": (value: boolean) => any;
|
|
82
|
+
success: () => any;
|
|
83
|
+
dragStart: () => any;
|
|
84
|
+
dragEnd: (success: boolean) => any;
|
|
85
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
86
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
87
|
+
onSuccess?: (() => any) | undefined;
|
|
88
|
+
onDragStart?: (() => any) | undefined;
|
|
89
|
+
onDragEnd?: ((success: boolean) => any) | undefined;
|
|
90
|
+
}>, {
|
|
91
|
+
disabled: boolean;
|
|
92
|
+
icon: string;
|
|
93
|
+
text: string;
|
|
94
|
+
height: number;
|
|
95
|
+
sliderWidth: number;
|
|
96
|
+
successText: string;
|
|
97
|
+
successIcon: string;
|
|
98
|
+
threshold: number;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
100
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
101
|
+
declare const _default: typeof __VLS_export;
|
|
102
|
+
export default _default;
|
|
103
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
104
|
+
new (): {
|
|
105
|
+
$slots: S;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -31,6 +31,7 @@ const {
|
|
|
31
31
|
clearable: { type: Boolean, required: false }
|
|
32
32
|
});
|
|
33
33
|
const emit = defineEmits(["update:modelValue", "change", "hover"]);
|
|
34
|
+
defineOptions({ inheritAttrs: false });
|
|
34
35
|
const hoveredStar = ref(null);
|
|
35
36
|
const focusedIndex = ref(0);
|
|
36
37
|
const isInteractive = computed(() => !disabled && !readonly);
|
|
@@ -55,7 +55,7 @@ function updateFieldPaths(template, oldBasePath, newBasePath, hintSlotFactory) {
|
|
|
55
55
|
fieldSlots: isNested && !isObject ? {
|
|
56
56
|
...template.meta?.fieldSlots
|
|
57
57
|
} : {
|
|
58
|
-
hint: (
|
|
58
|
+
hint: (props) => hintSlotFactory(template, props.path, props.open, props.count),
|
|
59
59
|
...template.meta?.fieldSlots
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|