@movk/nuxt 1.0.0 → 1.1.1

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 (35) hide show
  1. package/README.md +3 -0
  2. package/dist/module.d.mts +12 -3
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +57 -13
  5. package/dist/runtime/components/AutoForm.vue +1 -0
  6. package/dist/runtime/components/SlideVerify.d.vue.ts +107 -0
  7. package/dist/runtime/components/SlideVerify.vue +147 -0
  8. package/dist/runtime/components/SlideVerify.vue.d.ts +107 -0
  9. package/dist/runtime/components/StarRating.vue +1 -0
  10. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +1 -1
  11. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +3 -0
  12. package/dist/runtime/components/theme-picker/ThemePicker.vue +266 -0
  13. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +3 -0
  14. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +18 -0
  15. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +34 -0
  16. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +18 -0
  17. package/dist/runtime/composables/useApiFetch.js +1 -3
  18. package/dist/runtime/composables/useAutoForm.d.ts +81 -1425
  19. package/dist/runtime/composables/useAutoForm.js +3 -1
  20. package/dist/runtime/composables/useTheme.d.ts +27 -0
  21. package/dist/runtime/composables/useTheme.js +180 -0
  22. package/dist/runtime/composables/useUploadWithProgress.js +2 -2
  23. package/dist/runtime/internal/useAutoFormProvider.js +2 -2
  24. package/dist/runtime/plugins/api.factory.js +28 -30
  25. package/dist/runtime/plugins/theme.d.ts +2 -0
  26. package/dist/runtime/plugins/theme.js +100 -0
  27. package/dist/runtime/schemas/api.d.ts +336 -100
  28. package/dist/runtime/schemas/api.js +114 -98
  29. package/dist/runtime/style.css +1 -0
  30. package/dist/runtime/types/api.d.ts +108 -108
  31. package/dist/runtime/types/api.js +0 -8
  32. package/dist/runtime/utils/api-utils.d.ts +45 -30
  33. package/dist/runtime/utils/theme.d.ts +135 -0
  34. package/dist/runtime/utils/theme.js +134 -0
  35. package/package.json +21 -19
@@ -0,0 +1,266 @@
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
+ icon,
23
+ icons,
24
+ modes,
25
+ mode,
26
+ hasCSSChanges,
27
+ hasAppConfigChanges,
28
+ exportCSS,
29
+ exportAppConfig,
30
+ resetTheme
31
+ } = useTheme();
32
+ </script>
33
+
34
+ <template>
35
+ <UPopover
36
+ v-model:open="open"
37
+ :ui="{ content: 'w-72 px-6 py-4 flex flex-col gap-4 overflow-y-auto max-h-[calc(100vh-5rem)]' }"
38
+ >
39
+ <template #default>
40
+ <UButton
41
+ icon="i-lucide-swatch-book"
42
+ color="neutral"
43
+ :variant="open ? 'soft' : 'ghost'"
44
+ square
45
+ aria-label="Color picker"
46
+ :ui="{ leadingIcon: 'text-primary' }"
47
+ />
48
+ </template>
49
+
50
+ <template #content>
51
+ <fieldset>
52
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
53
+ Primary
54
+
55
+ <UButton
56
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#colors"
57
+ size="xs"
58
+ color="neutral"
59
+ variant="link"
60
+ target="_blank"
61
+ icon="i-lucide-circle-help"
62
+ class="p-0 -my-0.5"
63
+ :ui="{ leadingIcon: 'size-3' }"
64
+ />
65
+ </legend>
66
+
67
+ <div class="grid grid-cols-3 gap-1 -mx-2">
68
+ <ThemePickerButton label="Black" :selected="appConfig.theme.blackAsPrimary" @click="setBlackAsPrimary(true)">
69
+ <template #leading>
70
+ <span class="inline-block w-2 h-2 rounded-full bg-black dark:bg-white" />
71
+ </template>
72
+ </ThemePickerButton>
73
+
74
+ <ThemePickerButton
75
+ v-for="color in primaryColors"
76
+ :key="color"
77
+ :label="color"
78
+ :chip="color"
79
+ :selected="!appConfig.theme.blackAsPrimary && primary === color"
80
+ @click="primary = color"
81
+ />
82
+ </div>
83
+ </fieldset>
84
+
85
+ <fieldset>
86
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
87
+ Neutral
88
+
89
+ <UButton
90
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#text"
91
+ size="xs"
92
+ color="neutral"
93
+ variant="link"
94
+ target="_blank"
95
+ icon="i-lucide-circle-help"
96
+ class="p-0 -my-0.5"
97
+ :ui="{ leadingIcon: 'size-3' }"
98
+ />
99
+ </legend>
100
+
101
+ <div class="grid grid-cols-3 gap-1 -mx-2">
102
+ <ThemePickerButton
103
+ v-for="color in neutralColors"
104
+ :key="color"
105
+ :label="color"
106
+ :chip="color === 'neutral' ? 'old-neutral' : color"
107
+ :selected="neutral === color"
108
+ @click="neutral = color"
109
+ />
110
+ </div>
111
+ </fieldset>
112
+
113
+ <fieldset>
114
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
115
+ Radius
116
+
117
+ <UButton
118
+ to="https://ui.nuxt.com/docs/getting-started/theme/css-variables#radius"
119
+ size="xs"
120
+ color="neutral"
121
+ variant="link"
122
+ target="_blank"
123
+ icon="i-lucide-circle-help"
124
+ class="p-0 -my-0.5"
125
+ :ui="{ leadingIcon: 'size-3' }"
126
+ />
127
+ </legend>
128
+
129
+ <div class="grid grid-cols-5 gap-1 -mx-2">
130
+ <ThemePickerButton
131
+ v-for="r in radiuses"
132
+ :key="r"
133
+ :label="String(r)"
134
+ class="justify-center px-0"
135
+ :selected="radius === r"
136
+ @click="radius = r"
137
+ />
138
+ </div>
139
+ </fieldset>
140
+
141
+ <fieldset>
142
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
143
+ Font
144
+
145
+ <UButton
146
+ to="https://ui.nuxt.com/docs/getting-started/integrations/fonts"
147
+ size="xs"
148
+ color="neutral"
149
+ variant="link"
150
+ target="_blank"
151
+ icon="i-lucide-circle-help"
152
+ class="p-0 -my-0.5"
153
+ :ui="{ leadingIcon: 'size-3' }"
154
+ />
155
+ </legend>
156
+
157
+ <div class="-mx-2">
158
+ <USelect
159
+ v-model="font"
160
+ size="sm"
161
+ color="neutral"
162
+ icon="i-lucide-type"
163
+ :items="fonts"
164
+ class="w-full ring-default rounded-sm hover:bg-elevated/50 text-[11px] data-[state=open]:bg-elevated/50"
165
+ :ui="{ trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200' }"
166
+ />
167
+ </div>
168
+ </fieldset>
169
+
170
+ <fieldset>
171
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
172
+ Icons
173
+
174
+ <UButton
175
+ to="https://ui.nuxt.com/docs/getting-started/integrations/icons"
176
+ size="xs"
177
+ color="neutral"
178
+ variant="link"
179
+ target="_blank"
180
+ icon="i-lucide-circle-help"
181
+ class="p-0 -my-0.5"
182
+ :ui="{ leadingIcon: 'size-3' }"
183
+ />
184
+ </legend>
185
+
186
+ <div class="-mx-2">
187
+ <USelect
188
+ v-model="icon"
189
+ size="sm"
190
+ color="neutral"
191
+ :icon="icons.find((i) => i.value === icon)?.icon"
192
+ :items="icons"
193
+ class="w-full ring-default rounded-sm hover:bg-elevated/50 capitalize text-[11px] data-[state=open]:bg-elevated/50"
194
+ :ui="{ item: 'capitalize text-[11px]', trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200' }"
195
+ />
196
+ </div>
197
+ </fieldset>
198
+
199
+ <fieldset>
200
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none flex items-center gap-1">
201
+ Color Mode
202
+
203
+ <UButton
204
+ to="https://ui.nuxt.com/docs/getting-started/integrations/color-mode"
205
+ size="xs"
206
+ color="neutral"
207
+ variant="link"
208
+ target="_blank"
209
+ icon="i-lucide-circle-help"
210
+ class="p-0 -my-0.5"
211
+ :ui="{ leadingIcon: 'size-3' }"
212
+ />
213
+ </legend>
214
+
215
+ <div class="grid grid-cols-3 gap-1 -mx-2">
216
+ <ThemePickerButton
217
+ v-for="m in modes"
218
+ :key="m.label"
219
+ v-bind="m"
220
+ :selected="colorMode.preference === m.label"
221
+ @click="mode = m.label"
222
+ />
223
+ </div>
224
+ </fieldset>
225
+
226
+ <fieldset v-if="hasCSSChanges || hasAppConfigChanges">
227
+ <legend class="text-[11px] leading-none font-semibold mb-2 select-none">
228
+ Export
229
+ </legend>
230
+
231
+ <div class="flex items-center justify-between gap-1 -mx-2">
232
+ <UButton
233
+ v-if="hasCSSChanges"
234
+ color="neutral"
235
+ variant="soft"
236
+ size="sm"
237
+ label="main.css"
238
+ class="flex-1 text-[11px]"
239
+ :icon="copiedCSS ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
240
+ @click="copyCSS(exportCSS())"
241
+ />
242
+ <UButton
243
+ v-if="hasAppConfigChanges"
244
+ color="neutral"
245
+ variant="soft"
246
+ size="sm"
247
+ label="app.config.ts"
248
+ :icon="copiedAppConfig ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
249
+ class="flex-1 text-[11px]"
250
+ @click="copyAppConfig(exportAppConfig())"
251
+ />
252
+ <UTooltip text="Reset theme">
253
+ <UButton
254
+ color="neutral"
255
+ variant="outline"
256
+ size="sm"
257
+ icon="i-lucide-rotate-ccw"
258
+ class="ms-auto ring-default hover:bg-elevated/50"
259
+ @click="resetTheme"
260
+ />
261
+ </UTooltip>
262
+ </div>
263
+ </fieldset>
264
+ </template>
265
+ </UPopover>
266
+ </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
  }