@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
@@ -0,0 +1,235 @@
1
+ <script setup>
2
+ import { useAppConfig, useColorMode } from "#imports";
3
+ import { useClipboard } from "@vueuse/core";
4
+ import { ref } from "vue";
5
+ import { useTheme } from "../../composables/useTheme";
6
+ import ThemePickerButton from "./ThemePickerButton.vue";
7
+ const appConfig = useAppConfig();
8
+ const colorMode = useColorMode();
9
+ const open = ref(false);
10
+ const { copy: copyCSS, copied: copiedCSS } = useClipboard();
11
+ const { copy: copyAppConfig, copied: copiedAppConfig } = useClipboard();
12
+ const {
13
+ neutralColors,
14
+ neutral,
15
+ primaryColors,
16
+ primary,
17
+ setBlackAsPrimary,
18
+ radiuses,
19
+ radius,
20
+ fonts,
21
+ font,
22
+ modes,
23
+ mode,
24
+ hasCSSChanges,
25
+ hasAppConfigChanges,
26
+ exportCSS,
27
+ exportAppConfig,
28
+ resetTheme
29
+ } = useTheme();
30
+ </script>
31
+
32
+ <template>
33
+ <UPopover
34
+ v-model:open="open"
35
+ :ui="{ content: 'w-72 px-6 py-4 flex flex-col gap-4 overflow-y-auto max-h-[calc(100vh-5rem)]' }"
36
+ >
37
+ <template #default>
38
+ <UButton
39
+ icon="i-lucide-swatch-book"
40
+ color="neutral"
41
+ :variant="open ? 'soft' : 'ghost'"
42
+ square
43
+ aria-label="Color picker"
44
+ :ui="{ leadingIcon: 'text-primary' }"
45
+ />
46
+ </template>
47
+
48
+ <template #content>
49
+ <fieldset>
50
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
51
+ Primary
52
+
53
+ <UButton
54
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#colors"
55
+ size="xs"
56
+ color="neutral"
57
+ variant="link"
58
+ target="_blank"
59
+ icon="i-lucide-circle-help"
60
+ class="p-0 -my-0.5"
61
+ :ui="{ leadingIcon: 'size-3' }"
62
+ />
63
+ </legend>
64
+
65
+ <div class="grid grid-cols-3 gap-1 -mx-2">
66
+ <ThemePickerButton label="Black" :selected="appConfig.theme.blackAsPrimary" @click="setBlackAsPrimary(true)">
67
+ <template #leading>
68
+ <span class="inline-block w-2 h-2 rounded-full bg-black dark:bg-white" />
69
+ </template>
70
+ </ThemePickerButton>
71
+
72
+ <ThemePickerButton
73
+ v-for="color in primaryColors"
74
+ :key="color"
75
+ :label="color"
76
+ :chip="color"
77
+ :selected="!appConfig.theme.blackAsPrimary && primary === color"
78
+ @click="primary = color"
79
+ />
80
+ </div>
81
+ </fieldset>
82
+
83
+ <fieldset>
84
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
85
+ Neutral
86
+
87
+ <UButton
88
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#text"
89
+ size="xs"
90
+ color="neutral"
91
+ variant="link"
92
+ target="_blank"
93
+ icon="i-lucide-circle-help"
94
+ class="p-0 -my-0.5"
95
+ :ui="{ leadingIcon: 'size-3' }"
96
+ />
97
+ </legend>
98
+
99
+ <div class="grid grid-cols-3 gap-1 -mx-2">
100
+ <ThemePickerButton
101
+ v-for="color in neutralColors"
102
+ :key="color"
103
+ :label="color"
104
+ :chip="color === 'neutral' ? 'old-neutral' : color"
105
+ :selected="neutral === color"
106
+ @click="neutral = color"
107
+ />
108
+ </div>
109
+ </fieldset>
110
+
111
+ <fieldset>
112
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
113
+ Radius
114
+
115
+ <UButton
116
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#radius"
117
+ size="xs"
118
+ color="neutral"
119
+ variant="link"
120
+ target="_blank"
121
+ icon="i-lucide-circle-help"
122
+ class="p-0 -my-0.5"
123
+ :ui="{ leadingIcon: 'size-3' }"
124
+ />
125
+ </legend>
126
+
127
+ <div class="grid grid-cols-5 gap-1 -mx-2">
128
+ <ThemePickerButton
129
+ v-for="r in radiuses"
130
+ :key="r"
131
+ :label="String(r)"
132
+ class="justify-center px-0"
133
+ :selected="radius === r"
134
+ @click="radius = r"
135
+ />
136
+ </div>
137
+ </fieldset>
138
+
139
+ <fieldset>
140
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
141
+ Font
142
+
143
+ <UButton
144
+ to="https://ui.nuxt.com/docs/getting-started/integrations/fonts"
145
+ size="xs"
146
+ color="neutral"
147
+ variant="link"
148
+ target="_blank"
149
+ icon="i-lucide-circle-help"
150
+ class="p-0 -my-0.5"
151
+ :ui="{ leadingIcon: 'size-3' }"
152
+ />
153
+ </legend>
154
+
155
+ <div class="-mx-2">
156
+ <USelect
157
+ v-model="font"
158
+ size="sm"
159
+ color="neutral"
160
+ icon="i-lucide-type"
161
+ :items="fonts"
162
+ class="w-full ring-default rounded-sm hover:bg-elevated/50 text-[11px] data-[state=open]:bg-elevated/50"
163
+ :ui="{ trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200' }"
164
+ />
165
+ </div>
166
+ </fieldset>
167
+
168
+ <fieldset>
169
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
170
+ Color Mode
171
+
172
+ <UButton
173
+ to="https://ui.nuxt.com/docs/getting-started/integrations/color-mode"
174
+ size="xs"
175
+ color="neutral"
176
+ variant="link"
177
+ target="_blank"
178
+ icon="i-lucide-circle-help"
179
+ class="p-0 -my-0.5"
180
+ :ui="{ leadingIcon: 'size-3' }"
181
+ />
182
+ </legend>
183
+
184
+ <div class="grid grid-cols-3 gap-1 -mx-2">
185
+ <ThemePickerButton
186
+ v-for="m in modes"
187
+ :key="m.label"
188
+ v-bind="m"
189
+ :selected="colorMode.preference === m.label"
190
+ @click="mode = m.label"
191
+ />
192
+ </div>
193
+ </fieldset>
194
+
195
+ <fieldset v-if="hasCSSChanges || hasAppConfigChanges">
196
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none">
197
+ Export
198
+ </legend>
199
+
200
+ <div class="flex items-center justify-between gap-1 -mx-2">
201
+ <UButton
202
+ v-if="hasCSSChanges"
203
+ color="neutral"
204
+ variant="soft"
205
+ size="sm"
206
+ label="main.css"
207
+ class="flex-1 text-[11px]"
208
+ :icon="copiedCSS ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
209
+ @click="copyCSS(exportCSS())"
210
+ />
211
+ <UButton
212
+ v-if="hasAppConfigChanges"
213
+ color="neutral"
214
+ variant="soft"
215
+ size="sm"
216
+ label="app.config.ts"
217
+ :icon="copiedAppConfig ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
218
+ class="flex-1 text-[11px]"
219
+ @click="copyAppConfig(exportAppConfig())"
220
+ />
221
+ <UTooltip text="Reset theme">
222
+ <UButton
223
+ color="neutral"
224
+ variant="outline"
225
+ size="sm"
226
+ icon="i-lucide-rotate-ccw"
227
+ class="ms-auto ring-default hover:bg-elevated/50"
228
+ @click="resetTheme"
229
+ />
230
+ </UTooltip>
231
+ </div>
232
+ </fieldset>
233
+ </template>
234
+ </UPopover>
235
+ </template>
@@ -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;
@@ -0,0 +1,18 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ icon?: string;
4
+ chip?: string;
5
+ selected?: boolean;
6
+ };
7
+ type __VLS_Slots = {
8
+ leading: () => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,34 @@
1
+ <script setup>
2
+ defineProps({
3
+ label: { type: String, required: true },
4
+ icon: { type: String, required: false },
5
+ chip: { type: String, required: false },
6
+ selected: { type: Boolean, required: false }
7
+ });
8
+ const slots = defineSlots();
9
+ </script>
10
+
11
+ <template>
12
+ <UButton
13
+ size="sm"
14
+ color="neutral"
15
+ variant="outline"
16
+ :icon="icon"
17
+ :label="label"
18
+ class="capitalize ring-default rounded-sm text-[11px]"
19
+ :class="selected ? 'bg-elevated' : 'hover:bg-elevated/50'"
20
+ >
21
+ <template v-if="chip || !!slots.leading" #leading>
22
+ <slot name="leading">
23
+ <span
24
+ class="inline-block size-2 rounded-full bg-(--color-light) dark:bg-(--color-dark)"
25
+
26
+ :style="{
27
+ '--color-light': `var(--color-${chip}-500)`,
28
+ '--color-dark': `var(--color-${chip}-400)`
29
+ }"
30
+ />
31
+ </slot>
32
+ </template>
33
+ </UButton>
34
+ </template>
@@ -0,0 +1,18 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ icon?: string;
4
+ chip?: string;
5
+ selected?: boolean;
6
+ };
7
+ type __VLS_Slots = {
8
+ leading: () => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -19,7 +19,7 @@ export function useApiFetch(url, options = {}) {
19
19
  const transformFn = createTransform({
20
20
  skipBusinessCheck,
21
21
  userTransform,
22
- successConfig: endpointConfig.success
22
+ successConfig: endpointConfig.response
23
23
  });
24
24
  const mergedHooks = mergeFetchHooks(builtinHooks, {
25
25
  onRequest: userOnRequest,
@@ -32,12 +32,10 @@ export function useApiFetch(url, options = {}) {
32
32
  ...fetchOptions,
33
33
  $fetch: apiInstance.$fetch,
34
34
  transform: transformFn,
35
- // 合并后的 hooks
36
35
  onRequest: mergedHooks.onRequest,
37
36
  onRequestError: mergedHooks.onRequestError,
38
37
  onResponse: mergedHooks.onResponse,
39
38
  onResponseError: mergedHooks.onResponseError,
40
- // 传递请求级配置给内置 hooks
41
39
  context
42
40
  });
43
41
  }