@movk/nuxt 1.1.1 → 1.2.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 (121) hide show
  1. package/README.md +5 -29
  2. package/dist/module.d.mts +3 -31
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +135 -77
  5. package/dist/runtime/auto-form/controls.d.ts +221 -0
  6. package/dist/runtime/auto-form/controls.js +70 -0
  7. package/dist/runtime/{utils → auto-form}/field-utils.d.ts +4 -20
  8. package/dist/runtime/{utils → auto-form}/field-utils.js +1 -2
  9. package/dist/runtime/auto-form/metadata.d.ts +22 -0
  10. package/dist/runtime/auto-form/metadata.js +53 -0
  11. package/dist/runtime/auto-form/provider.d.ts +27 -0
  12. package/dist/runtime/{internal/useAutoFormProvider.js → auto-form/provider.js} +1 -1
  13. package/dist/runtime/{utils → auto-form}/reactive-utils.d.ts +4 -22
  14. package/dist/runtime/{utils → auto-form}/schema-introspector.d.ts +3 -9
  15. package/dist/runtime/{utils → auto-form}/schema-introspector.js +11 -9
  16. package/dist/runtime/components/AutoForm.d.vue.ts +4 -5
  17. package/dist/runtime/components/AutoForm.vue +12 -35
  18. package/dist/runtime/components/AutoForm.vue.d.ts +4 -5
  19. package/dist/runtime/components/ColorChooser.d.vue.ts +10 -6
  20. package/dist/runtime/components/ColorChooser.vue +4 -7
  21. package/dist/runtime/components/ColorChooser.vue.d.ts +10 -6
  22. package/dist/runtime/components/DatePicker.d.vue.ts +16 -10
  23. package/dist/runtime/components/DatePicker.vue.d.ts +16 -10
  24. package/dist/runtime/components/SearchForm.d.vue.ts +171 -0
  25. package/dist/runtime/components/SearchForm.vue +216 -0
  26. package/dist/runtime/components/SearchForm.vue.d.ts +171 -0
  27. package/dist/runtime/components/SlideVerify.d.vue.ts +5 -32
  28. package/dist/runtime/components/SlideVerify.vue +4 -4
  29. package/dist/runtime/components/SlideVerify.vue.d.ts +5 -32
  30. package/dist/runtime/components/StarRating.d.vue.ts +8 -16
  31. package/dist/runtime/components/StarRating.vue +50 -65
  32. package/dist/runtime/components/StarRating.vue.d.ts +8 -16
  33. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +10 -2
  34. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +16 -23
  35. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +10 -2
  36. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +26 -0
  37. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue +50 -0
  38. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +26 -0
  39. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +8 -2
  40. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +2 -2
  41. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +8 -2
  42. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +8 -2
  43. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +29 -64
  44. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +8 -2
  45. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +8 -2
  46. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +15 -69
  47. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +8 -2
  48. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +36 -0
  49. package/dist/runtime/components/input/AsPhoneNumberInput.vue +35 -0
  50. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +36 -0
  51. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +17 -9
  52. package/dist/runtime/components/input/WithCharacterLimit.vue +5 -5
  53. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +17 -9
  54. package/dist/runtime/components/input/WithClear.d.vue.ts +13 -9
  55. package/dist/runtime/components/input/WithClear.vue +2 -2
  56. package/dist/runtime/components/input/WithClear.vue.d.ts +13 -9
  57. package/dist/runtime/components/input/WithCopy.d.vue.ts +16 -10
  58. package/dist/runtime/components/input/WithCopy.vue +3 -3
  59. package/dist/runtime/components/input/WithCopy.vue.d.ts +16 -10
  60. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +36 -0
  61. package/dist/runtime/components/input/WithFloatingLabel.vue +67 -0
  62. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +36 -0
  63. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -9
  64. package/dist/runtime/components/input/WithPasswordToggle.vue +3 -3
  65. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -9
  66. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +1 -1
  67. package/dist/runtime/components/theme-picker/ThemePicker.vue +19 -25
  68. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +1 -1
  69. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +1 -7
  70. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +1 -7
  71. package/dist/runtime/composables/index.d.ts +8 -0
  72. package/dist/runtime/composables/index.js +8 -0
  73. package/dist/runtime/composables/useApiFetch.d.ts +17 -14
  74. package/dist/runtime/composables/useApiFetch.js +3 -28
  75. package/dist/runtime/composables/useAutoForm.d.ts +14 -98
  76. package/dist/runtime/composables/useAutoForm.js +37 -157
  77. package/dist/runtime/composables/useClientApiFetch.d.ts +5 -6
  78. package/dist/runtime/composables/useDownloadWithProgress.js +5 -6
  79. package/dist/runtime/composables/useLazyApiFetch.d.ts +18 -0
  80. package/dist/runtime/composables/useLazyApiFetch.js +4 -0
  81. package/dist/runtime/composables/useTheme.d.ts +17 -14
  82. package/dist/runtime/composables/useTheme.js +68 -72
  83. package/dist/runtime/composables/useUploadWithProgress.d.ts +2 -2
  84. package/dist/runtime/composables/useUploadWithProgress.js +7 -7
  85. package/dist/runtime/constants/api-defaults.d.ts +9 -0
  86. package/dist/runtime/constants/api-defaults.js +32 -0
  87. package/dist/runtime/constants/auto-form.d.ts +0 -2
  88. package/dist/runtime/constants/auto-form.js +0 -25
  89. package/dist/runtime/constants/grid-cols.d.ts +7 -0
  90. package/dist/runtime/constants/grid-cols.js +44 -0
  91. package/dist/runtime/plugins/api.factory.js +78 -121
  92. package/dist/runtime/plugins/theme.js +44 -64
  93. package/dist/runtime/style.css +1 -1
  94. package/dist/runtime/types/api.d.ts +277 -146
  95. package/dist/runtime/types/auto-form.d.ts +122 -411
  96. package/dist/runtime/types/index.d.ts +3 -2
  97. package/dist/runtime/types/index.js +3 -2
  98. package/dist/runtime/types/module.d.ts +96 -0
  99. package/dist/runtime/types/theme.d.ts +2 -0
  100. package/dist/runtime/types/zod.d.ts +11 -10
  101. package/dist/runtime/utils/api-utils.d.ts +27 -48
  102. package/dist/runtime/utils/api-utils.js +18 -47
  103. package/dist/runtime/utils/meta.d.ts +7 -0
  104. package/dist/runtime/utils/meta.js +16 -0
  105. package/dist/types.d.mts +6 -2
  106. package/package.json +68 -37
  107. package/dist/runtime/composables/useApiAuth.d.ts +0 -47
  108. package/dist/runtime/composables/useApiAuth.js +0 -66
  109. package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
  110. package/dist/runtime/schemas/api.d.ts +0 -590
  111. package/dist/runtime/schemas/api.js +0 -228
  112. package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
  113. package/dist/runtime/server/api/_movk/session.post.js +0 -18
  114. package/dist/runtime/types/auth.d.ts +0 -34
  115. package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
  116. package/dist/runtime/types/components.d.ts +0 -43
  117. package/dist/runtime/utils/auto-form.d.ts +0 -3
  118. package/dist/runtime/utils/auto-form.js +0 -18
  119. /package/dist/runtime/{utils → auto-form}/reactive-utils.js +0 -0
  120. /package/dist/runtime/types/{auto-form-renderer.js → module.js} +0 -0
  121. /package/dist/runtime/types/{components.js → theme.js} +0 -0
@@ -1,19 +1,27 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithCharacterLimitProps } from '../../types/components.js';
1
+ import type { InputProps, InputSlots, InputValue } from '@nuxt/ui';
2
+ import type { OmitByKey } from '@movk/core';
3
+ import type { ClassNameValue } from '../../types/index.js';
4
+ export interface WithCharacterLimitProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
5
+ /**
6
+ * 最大允许输入的字符数
7
+ * @defaultValue 50
8
+ */
9
+ maxLength?: number;
10
+ /** 字符计数器的自定义样式类 */
11
+ counterClass?: ClassNameValue;
12
+ }
3
13
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<import("@nuxt/ui/.").AcceptableValue> & {
5
- modelValue?: InputProps["modelValue"];
14
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
15
+ modelValue?: T;
6
16
  }) & {
7
- onBlur?: ((event: FocusEvent) => any) | undefined;
8
- onChange?: ((event: Event) => any) | undefined;
9
- "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
17
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
10
18
  }> & (typeof globalThis extends {
11
19
  __VLS_PROPS_FALLBACK: infer P;
12
20
  } ? P : {});
13
21
  expose: (exposed: {}) => void;
14
22
  attrs: any;
15
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
16
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue | undefined) => void);
23
+ slots: OmitByKey<InputSlots, "trailing">;
24
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
17
25
  }>) => import("vue").VNode & {
18
26
  __ctx?: Awaited<typeof __VLS_setup>;
19
27
  };
@@ -1,20 +1,24 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithClearProps } from '../../types/components.js';
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ export interface WithClearProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
4
+ /** 清除按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ }
7
+ export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
8
+ clear: [];
9
+ };
3
10
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<import("@nuxt/ui/.").AcceptableValue> & {
11
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
5
12
  modelValue?: InputProps<T>["modelValue"];
6
13
  }) & {
7
- onClear?: (() => any) | undefined;
8
- onBlur?: ((event: FocusEvent) => any) | undefined;
9
- onChange?: ((event: Event) => any) | undefined;
10
- "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
14
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
11
15
  }> & (typeof globalThis extends {
12
16
  __VLS_PROPS_FALLBACK: infer P;
13
17
  } ? P : {});
14
18
  expose: (exposed: {}) => void;
15
19
  attrs: any;
16
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
17
- emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: T | undefined) => void);
20
+ slots: OmitByKey<InputSlots, "trailing">;
21
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
18
22
  }>) => import("vue").VNode & {
19
23
  __ctx?: Awaited<typeof __VLS_setup>;
20
24
  };
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { UInput, UButton } from "#components";
3
3
  import { isEmpty } from "@movk/core";
4
- const { buttonProps } = defineProps({
4
+ const props = defineProps({
5
5
  buttonProps: { type: Object, required: false }
6
6
  });
7
7
  const emit = defineEmits(["update:modelValue", "blur", "change", "clear"]);
@@ -33,7 +33,7 @@ function handleClear() {
33
33
  size="sm"
34
34
  icon="i-lucide-circle-x"
35
35
  aria-label="Clear input"
36
- v-bind="buttonProps"
36
+ v-bind="props.buttonProps"
37
37
  @click="handleClear"
38
38
  />
39
39
  </template>
@@ -1,20 +1,24 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithClearProps } from '../../types/components.js';
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ export interface WithClearProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
4
+ /** 清除按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ }
7
+ export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
8
+ clear: [];
9
+ };
3
10
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<import("@nuxt/ui/.").AcceptableValue> & {
11
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
5
12
  modelValue?: InputProps<T>["modelValue"];
6
13
  }) & {
7
- onClear?: (() => any) | undefined;
8
- onBlur?: ((event: FocusEvent) => any) | undefined;
9
- onChange?: ((event: Event) => any) | undefined;
10
- "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
14
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
11
15
  }> & (typeof globalThis extends {
12
16
  __VLS_PROPS_FALLBACK: infer P;
13
17
  } ? P : {});
14
18
  expose: (exposed: {}) => void;
15
19
  attrs: any;
16
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
17
- emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: T | undefined) => void);
20
+ slots: OmitByKey<InputSlots, "trailing">;
21
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
18
22
  }>) => import("vue").VNode & {
19
23
  __ctx?: Awaited<typeof __VLS_setup>;
20
24
  };
@@ -1,20 +1,26 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithCopyProps } from '../../types/components.js';
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue, TooltipProps } from '@nuxt/ui';
3
+ export interface WithCopyProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
4
+ /** 复制按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ /** 提示框的自定义属性 */
7
+ tooltipProps?: TooltipProps;
8
+ }
9
+ export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
10
+ copy: [value: string];
11
+ };
3
12
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<import("@nuxt/ui/.").AcceptableValue> & {
5
- modelValue?: InputProps["modelValue"];
13
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<T> & {
14
+ modelValue?: T;
6
15
  }) & {
7
- onBlur?: ((event: FocusEvent) => any) | undefined;
8
- onChange?: ((event: Event) => any) | undefined;
9
- onCopy?: ((value: string) => any) | undefined;
10
- "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
16
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
11
17
  }> & (typeof globalThis extends {
12
18
  __VLS_PROPS_FALLBACK: infer P;
13
19
  } ? P : {});
14
20
  expose: (exposed: {}) => void;
15
21
  attrs: any;
16
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
17
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue | undefined) => void);
22
+ slots: OmitByKey<InputSlots, "trailing">;
23
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
18
24
  }>) => import("vue").VNode & {
19
25
  __ctx?: Awaited<typeof __VLS_setup>;
20
26
  };
@@ -2,7 +2,7 @@
2
2
  import { UInput, UButton, UTooltip } from "#components";
3
3
  import { useClipboard } from "@vueuse/core";
4
4
  import { isEmpty } from "@movk/core";
5
- const { buttonProps, tooltipProps } = defineProps({
5
+ const props = defineProps({
6
6
  buttonProps: { type: Object, required: false },
7
7
  tooltipProps: { type: Object, required: false }
8
8
  });
@@ -33,14 +33,14 @@ function handleCopy() {
33
33
  </template>
34
34
 
35
35
  <template v-if="!isEmpty(modelValue)" #trailing>
36
- <UTooltip text="Copy to clipboard" v-bind="tooltipProps">
36
+ <UTooltip text="Copy to clipboard" v-bind="props.tooltipProps">
37
37
  <UButton
38
38
  :color="copied ? 'success' : 'neutral'"
39
39
  variant="link"
40
40
  size="sm"
41
41
  :icon="copied ? 'i-lucide-copy-check' : 'i-lucide-copy'"
42
42
  aria-label="Copy to clipboard"
43
- v-bind="buttonProps"
43
+ v-bind="props.buttonProps"
44
44
  @click="handleCopy"
45
45
  />
46
46
  </UTooltip>
@@ -1,20 +1,26 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithCopyProps } from '../../types/components.js';
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue, TooltipProps } from '@nuxt/ui';
3
+ export interface WithCopyProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
4
+ /** 复制按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ /** 提示框的自定义属性 */
7
+ tooltipProps?: TooltipProps;
8
+ }
9
+ export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
10
+ copy: [value: string];
11
+ };
3
12
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<import("@nuxt/ui/.").AcceptableValue> & {
5
- modelValue?: InputProps["modelValue"];
13
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<T> & {
14
+ modelValue?: T;
6
15
  }) & {
7
- onBlur?: ((event: FocusEvent) => any) | undefined;
8
- onChange?: ((event: Event) => any) | undefined;
9
- onCopy?: ((value: string) => any) | undefined;
10
- "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
16
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
11
17
  }> & (typeof globalThis extends {
12
18
  __VLS_PROPS_FALLBACK: infer P;
13
19
  } ? P : {});
14
20
  expose: (exposed: {}) => void;
15
21
  attrs: any;
16
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
17
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue | undefined) => void);
22
+ slots: OmitByKey<InputSlots, "trailing">;
23
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
18
24
  }>) => import("vue").VNode & {
19
25
  __ctx?: Awaited<typeof __VLS_setup>;
20
26
  };
@@ -0,0 +1,36 @@
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ import type { ClassNameValue } from '../../types/index.js';
4
+ export interface WithFloatingLabelProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
5
+ /** 浮动标签文本 */
6
+ label?: string;
7
+ /** 浮动标签的自定义样式类 */
8
+ labelClass?: ClassNameValue;
9
+ /** 清除按钮的自定义属性 */
10
+ clearButtonProps?: ButtonProps;
11
+ }
12
+ export type WithFloatingLabelEmits<T extends InputValue = InputValue> = InputEmits<T> & {
13
+ clear: [];
14
+ };
15
+ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithFloatingLabelProps<T> & {
17
+ modelValue?: T;
18
+ }) & {
19
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
24
+ attrs: any;
25
+ slots: OmitByKey<InputSlots, "default" | "trailing">;
26
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
27
+ }>) => import("vue").VNode & {
28
+ __ctx?: Awaited<typeof __VLS_setup>;
29
+ };
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
33
+ [K in keyof T]: T[K];
34
+ } : {
35
+ [K in keyof T as K]: T[K];
36
+ }) & {};
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ import { computed, useAttrs } from "vue";
3
+ import { UInput, UButton } from "#components";
4
+ import { isEmpty } from "@movk/core";
5
+ const props = defineProps({
6
+ label: { type: String, required: false },
7
+ labelClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
8
+ clearButtonProps: { type: Object, required: false }
9
+ });
10
+ const emit = defineEmits(["update:modelValue", "blur", "change", "clear"]);
11
+ const slots = defineSlots();
12
+ defineOptions({ inheritAttrs: false });
13
+ const attrs = useAttrs();
14
+ const modelValue = defineModel({ type: null });
15
+ const labelLeftClass = computed(() => {
16
+ const hasLeading = !!(attrs["leading-icon"] || attrs.avatar || attrs.leadingIcon || slots.leading);
17
+ if (!hasLeading) return "left-0";
18
+ const offsetMap = {
19
+ xs: "left-5",
20
+ sm: "left-6",
21
+ md: "left-7",
22
+ lg: "left-8",
23
+ xl: "left-9"
24
+ };
25
+ return offsetMap[attrs.size ?? "md"] ?? "left-7";
26
+ });
27
+ function handleClear() {
28
+ modelValue.value = void 0;
29
+ emit("clear");
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <UInput
35
+ v-model="modelValue"
36
+ :placeholder="props.placeholder ?? ''"
37
+ :ui="{ base: 'peer', trailing: 'pe-1' }"
38
+ v-bind="$attrs"
39
+ @blur="emit('blur', $event)"
40
+ @change="emit('change', $event)"
41
+ >
42
+ <template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
43
+ <slot :name="slotName" v-bind="slotProps ?? {}" />
44
+ </template>
45
+
46
+ <template v-if="props.label" #default>
47
+ <label
48
+ class="pointer-events-none absolute -top-2.5 text-highlighted text-xs font-medium px-1.5 transition-all peer-focus:-top-2.5 peer-focus:text-highlighted peer-focus:text-xs peer-focus:font-medium peer-placeholder-shown:text-sm peer-placeholder-shown:text-dimmed peer-placeholder-shown:top-1.5 peer-placeholder-shown:font-normal"
49
+ :class="[labelLeftClass, props.labelClass]"
50
+ >
51
+ <span class="inline-flex bg-default px-1">{{ props.label }}</span>
52
+ </label>
53
+ </template>
54
+
55
+ <template v-if="!isEmpty(modelValue)" #trailing>
56
+ <UButton
57
+ color="neutral"
58
+ variant="link"
59
+ size="sm"
60
+ icon="i-lucide-circle-x"
61
+ aria-label="Clear input"
62
+ v-bind="props.clearButtonProps"
63
+ @click="handleClear"
64
+ />
65
+ </template>
66
+ </UInput>
67
+ </template>
@@ -0,0 +1,36 @@
1
+ import { type OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputEmits, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ import type { ClassNameValue } from '../../types/index.js';
4
+ export interface WithFloatingLabelProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
5
+ /** 浮动标签文本 */
6
+ label?: string;
7
+ /** 浮动标签的自定义样式类 */
8
+ labelClass?: ClassNameValue;
9
+ /** 清除按钮的自定义属性 */
10
+ clearButtonProps?: ButtonProps;
11
+ }
12
+ export type WithFloatingLabelEmits<T extends InputValue = InputValue> = InputEmits<T> & {
13
+ clear: [];
14
+ };
15
+ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithFloatingLabelProps<T> & {
17
+ modelValue?: T;
18
+ }) & {
19
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
24
+ attrs: any;
25
+ slots: OmitByKey<InputSlots, "default" | "trailing">;
26
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
27
+ }>) => import("vue").VNode & {
28
+ __ctx?: Awaited<typeof __VLS_setup>;
29
+ };
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
33
+ [K in keyof T]: T[K];
34
+ } : {
35
+ [K in keyof T as K]: T[K];
36
+ }) & {};
@@ -1,19 +1,21 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithPasswordToggleProps } from '../../types/components.js';
1
+ import type { OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ export interface WithPasswordToggleProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue'> {
4
+ /** 切换按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ }
3
7
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithPasswordToggleProps<import("@nuxt/ui/.").AcceptableValue> & {
5
- modelValue?: InputProps["modelValue"];
8
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithPasswordToggleProps<T> & {
9
+ modelValue?: T;
6
10
  }) & {
7
- onBlur?: ((event: FocusEvent) => any) | undefined;
8
- onChange?: ((event: Event) => any) | undefined;
9
- "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
11
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
10
12
  }> & (typeof globalThis extends {
11
13
  __VLS_PROPS_FALLBACK: infer P;
12
14
  } ? P : {});
13
15
  expose: (exposed: {}) => void;
14
16
  attrs: any;
15
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
16
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue | undefined) => void);
17
+ slots: OmitByKey<InputSlots, "trailing">;
18
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
17
19
  }>) => import("vue").VNode & {
18
20
  __ctx?: Awaited<typeof __VLS_setup>;
19
21
  };
@@ -1,14 +1,14 @@
1
1
  <script setup>
2
2
  import { UInput, UButton } from "#components";
3
3
  import { useToggle } from "@vueuse/core";
4
- const { buttonProps } = defineProps({
4
+ const props = defineProps({
5
5
  buttonProps: { type: Object, required: false }
6
6
  });
7
7
  const emit = defineEmits(["update:modelValue", "blur", "change"]);
8
8
  const slots = defineSlots();
9
9
  defineOptions({ inheritAttrs: false });
10
10
  const modelValue = defineModel({ type: null });
11
- const [value, toggle] = useToggle();
11
+ const [value, toggle] = useToggle(false);
12
12
  </script>
13
13
 
14
14
  <template>
@@ -32,7 +32,7 @@ const [value, toggle] = useToggle();
32
32
  :icon="value ? 'i-lucide-eye-off' : 'i-lucide-eye'"
33
33
  :aria-label="value ? 'Hide password' : 'Show password'"
34
34
  :aria-pressed="value"
35
- v-bind="buttonProps"
35
+ v-bind="props.buttonProps"
36
36
  @click="toggle()"
37
37
  />
38
38
  </template>
@@ -1,19 +1,21 @@
1
- import type { InputProps, InputValue } from '@nuxt/ui';
2
- import type { WithPasswordToggleProps } from '../../types/components.js';
1
+ import type { OmitByKey } from '@movk/core';
2
+ import type { ButtonProps, InputProps, InputSlots, InputValue } from '@nuxt/ui';
3
+ export interface WithPasswordToggleProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue'> {
4
+ /** 切换按钮的自定义属性 */
5
+ buttonProps?: ButtonProps;
6
+ }
3
7
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithPasswordToggleProps<import("@nuxt/ui/.").AcceptableValue> & {
5
- modelValue?: InputProps["modelValue"];
8
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithPasswordToggleProps<T> & {
9
+ modelValue?: T;
6
10
  }) & {
7
- onBlur?: ((event: FocusEvent) => any) | undefined;
8
- onChange?: ((event: Event) => any) | undefined;
9
- "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
11
+ [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
10
12
  }> & (typeof globalThis extends {
11
13
  __VLS_PROPS_FALLBACK: infer P;
12
14
  } ? P : {});
13
15
  expose: (exposed: {}) => void;
14
16
  attrs: any;
15
- slots: import("@movk/core").OmitByKey<import("@nuxt/ui/.").InputSlots, "trailing">;
16
- emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui/.").AcceptableValue | undefined) => void);
17
+ slots: OmitByKey<InputSlots, "trailing">;
18
+ emit: any & ((event: "update:modelValue", value: T | undefined) => void);
17
19
  }>) => import("vue").VNode & {
18
20
  __ctx?: Awaited<typeof __VLS_setup>;
19
21
  };
@@ -1,3 +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>;
1
+ declare const __VLS_export: any;
2
2
  declare const _default: typeof __VLS_export;
3
3
  export default _default;
@@ -1,10 +1,9 @@
1
1
  <script setup>
2
- import { useAppConfig, useColorMode } from "#imports";
2
+ import { useColorMode } from "#imports";
3
3
  import { useClipboard } from "@vueuse/core";
4
4
  import { ref } from "vue";
5
- import { useTheme } from "../../composables/useTheme";
5
+ import { useTheme } from "../../composables";
6
6
  import ThemePickerButton from "./ThemePickerButton.vue";
7
- const appConfig = useAppConfig();
8
7
  const colorMode = useColorMode();
9
8
  const open = ref(false);
10
9
  const { copy: copyCSS, copied: copiedCSS } = useClipboard();
@@ -14,7 +13,7 @@ const {
14
13
  neutral,
15
14
  primaryColors,
16
15
  primary,
17
- setBlackAsPrimary,
16
+ blackAsPrimary,
18
17
  radiuses,
19
18
  radius,
20
19
  fonts,
@@ -32,10 +31,7 @@ const {
32
31
  </script>
33
32
 
34
33
  <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
- >
34
+ <UPopover v-model:open="open" :ui="{ content: 'w-72 px-6 py-4 flex flex-col gap-4 overflow-y-auto max-h-[calc(100vh-5rem)]' }">
39
35
  <template #default>
40
36
  <UButton
41
37
  icon="i-lucide-swatch-book"
@@ -57,17 +53,20 @@ const {
57
53
  size="xs"
58
54
  color="neutral"
59
55
  variant="link"
60
- target="_blank"
61
- icon="i-lucide-circle-help"
56
+ icon="i-lucide-help-circle"
62
57
  class="p-0 -my-0.5"
63
58
  :ui="{ leadingIcon: 'size-3' }"
64
59
  />
65
60
  </legend>
66
61
 
67
62
  <div class="grid grid-cols-3 gap-1 -mx-2">
68
- <ThemePickerButton label="Black" :selected="appConfig.theme.blackAsPrimary" @click="setBlackAsPrimary(true)">
63
+ <ThemePickerButton
64
+ label="Black"
65
+ :selected="blackAsPrimary"
66
+ @click="blackAsPrimary = true"
67
+ >
69
68
  <template #leading>
70
- <span class="inline-block w-2 h-2 rounded-full bg-black dark:bg-white" />
69
+ <span class="inline-block size-2 rounded-full bg-black dark:bg-white" />
71
70
  </template>
72
71
  </ThemePickerButton>
73
72
 
@@ -76,7 +75,7 @@ const {
76
75
  :key="color"
77
76
  :label="color"
78
77
  :chip="color"
79
- :selected="!appConfig.theme.blackAsPrimary && primary === color"
78
+ :selected="!blackAsPrimary && primary === color"
80
79
  @click="primary = color"
81
80
  />
82
81
  </div>
@@ -91,8 +90,7 @@ const {
91
90
  size="xs"
92
91
  color="neutral"
93
92
  variant="link"
94
- target="_blank"
95
- icon="i-lucide-circle-help"
93
+ icon="i-lucide-help-circle"
96
94
  class="p-0 -my-0.5"
97
95
  :ui="{ leadingIcon: 'size-3' }"
98
96
  />
@@ -119,8 +117,7 @@ const {
119
117
  size="xs"
120
118
  color="neutral"
121
119
  variant="link"
122
- target="_blank"
123
- icon="i-lucide-circle-help"
120
+ icon="i-lucide-help-circle"
124
121
  class="p-0 -my-0.5"
125
122
  :ui="{ leadingIcon: 'size-3' }"
126
123
  />
@@ -147,8 +144,7 @@ const {
147
144
  size="xs"
148
145
  color="neutral"
149
146
  variant="link"
150
- target="_blank"
151
- icon="i-lucide-circle-help"
147
+ icon="i-lucide-help-circle"
152
148
  class="p-0 -my-0.5"
153
149
  :ui="{ leadingIcon: 'size-3' }"
154
150
  />
@@ -176,8 +172,7 @@ const {
176
172
  size="xs"
177
173
  color="neutral"
178
174
  variant="link"
179
- target="_blank"
180
- icon="i-lucide-circle-help"
175
+ icon="i-lucide-help-circle"
181
176
  class="p-0 -my-0.5"
182
177
  :ui="{ leadingIcon: 'size-3' }"
183
178
  />
@@ -205,8 +200,7 @@ const {
205
200
  size="xs"
206
201
  color="neutral"
207
202
  variant="link"
208
- target="_blank"
209
- icon="i-lucide-circle-help"
203
+ icon="i-lucide-help-circle"
210
204
  class="p-0 -my-0.5"
211
205
  :ui="{ leadingIcon: 'size-3' }"
212
206
  />
@@ -236,7 +230,7 @@ const {
236
230
  size="sm"
237
231
  label="main.css"
238
232
  class="flex-1 text-[11px]"
239
- :icon="copiedCSS ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
233
+ :icon="copiedCSS ? 'i-lucide-copy-check' : 'i-lucide-copy'"
240
234
  @click="copyCSS(exportCSS())"
241
235
  />
242
236
  <UButton
@@ -245,7 +239,7 @@ const {
245
239
  variant="soft"
246
240
  size="sm"
247
241
  label="app.config.ts"
248
- :icon="copiedAppConfig ? appConfig.ui.icons.copyCheck : appConfig.ui.icons.copy"
242
+ :icon="copiedAppConfig ? 'i-lucide-copy-check' : 'i-lucide-copy'"
249
243
  class="flex-1 text-[11px]"
250
244
  @click="copyAppConfig(exportAppConfig())"
251
245
  />
@@ -1,3 +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>;
1
+ declare const __VLS_export: any;
2
2
  declare const _default: typeof __VLS_export;
3
3
  export default _default;
@@ -1,13 +1,7 @@
1
- type __VLS_Props = {
2
- label: string;
3
- icon?: string;
4
- chip?: string;
5
- selected?: boolean;
6
- };
7
1
  type __VLS_Slots = {
8
2
  leading: () => any;
9
3
  };
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>;
4
+ declare const __VLS_base: any;
11
5
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
6
  declare const _default: typeof __VLS_export;
13
7
  export default _default;