@movk/nuxt 0.1.1 → 1.0.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 (60) hide show
  1. package/README.md +84 -9
  2. package/dist/module.d.mts +11 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +29 -3
  5. package/dist/runtime/components/AutoForm.d.vue.ts +12 -6
  6. package/dist/runtime/components/AutoForm.vue +3 -1
  7. package/dist/runtime/components/AutoForm.vue.d.ts +12 -6
  8. package/dist/runtime/components/ColorChooser.d.vue.ts +11 -5
  9. package/dist/runtime/components/ColorChooser.vue.d.ts +11 -5
  10. package/dist/runtime/components/DatePicker.d.vue.ts +14 -5
  11. package/dist/runtime/components/DatePicker.vue.d.ts +14 -5
  12. package/dist/runtime/components/StarRating.d.vue.ts +7 -7
  13. package/dist/runtime/components/StarRating.vue.d.ts +7 -7
  14. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +6 -4
  15. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +6 -4
  16. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +6 -4
  17. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +6 -4
  18. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +6 -4
  19. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +6 -4
  20. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +6 -4
  21. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +6 -4
  22. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -5
  23. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -5
  24. package/dist/runtime/components/input/WithClear.d.vue.ts +12 -5
  25. package/dist/runtime/components/input/WithClear.vue.d.ts +12 -5
  26. package/dist/runtime/components/input/WithCopy.d.vue.ts +12 -5
  27. package/dist/runtime/components/input/WithCopy.vue.d.ts +12 -5
  28. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -5
  29. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -5
  30. package/dist/runtime/composables/useApiAuth.d.ts +47 -0
  31. package/dist/runtime/composables/useApiAuth.js +66 -0
  32. package/dist/runtime/composables/useApiFetch.d.ts +42 -0
  33. package/dist/runtime/composables/useApiFetch.js +43 -0
  34. package/dist/runtime/composables/useAutoForm.d.ts +874 -54
  35. package/dist/runtime/composables/useClientApiFetch.d.ts +24 -0
  36. package/dist/runtime/composables/useClientApiFetch.js +8 -0
  37. package/dist/runtime/composables/useDateFormatter.d.ts +21 -7
  38. package/dist/runtime/composables/useDateFormatter.js +92 -57
  39. package/dist/runtime/composables/useDownloadWithProgress.d.ts +48 -0
  40. package/dist/runtime/composables/useDownloadWithProgress.js +85 -0
  41. package/dist/runtime/composables/useUploadWithProgress.d.ts +52 -0
  42. package/dist/runtime/composables/useUploadWithProgress.js +117 -0
  43. package/dist/runtime/plugins/api.factory.d.ts +2 -0
  44. package/dist/runtime/plugins/api.factory.js +188 -0
  45. package/dist/runtime/schemas/api.d.ts +354 -0
  46. package/dist/runtime/schemas/api.js +212 -0
  47. package/dist/runtime/server/api/_movk/session.post.d.ts +10 -0
  48. package/dist/runtime/server/api/_movk/session.post.js +18 -0
  49. package/dist/runtime/types/api.d.ts +218 -0
  50. package/dist/runtime/types/api.js +8 -0
  51. package/dist/runtime/types/auth.d.ts +34 -0
  52. package/dist/runtime/types/auto-form-renderer.d.ts +14 -22
  53. package/dist/runtime/types/auto-form-renderer.js +0 -0
  54. package/dist/runtime/types/components.d.ts +29 -41
  55. package/dist/runtime/types/components.js +0 -0
  56. package/dist/runtime/types/index.d.ts +1 -0
  57. package/dist/runtime/types/index.js +3 -2
  58. package/dist/runtime/utils/api-utils.d.ts +64 -0
  59. package/dist/runtime/utils/api-utils.js +127 -0
  60. package/package.json +32 -25
@@ -1,7 +1,7 @@
1
1
  import type { z } from 'zod/v4';
2
2
  import type { AutoFormRendererLayoutProps } from '../../types/auto-form-renderer.js';
3
- declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<AutoFormRendererLayoutProps<S>> & import("vue").PublicProps & (typeof globalThis extends {
3
+ declare const __VLS_export: <S extends z.ZodObject>(__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<AutoFormRendererLayoutProps<S>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
6
6
  } ? P : {});
7
7
  expose: (exposed: {}) => void;
@@ -13,6 +13,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
13
13
  };
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
- type __VLS_PrettifyLocal<T> = {
16
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
17
+ [K in keyof T]: T[K];
18
+ } : {
17
19
  [K in keyof T as K]: T[K];
18
- } & {};
20
+ }) & {};
@@ -1,7 +1,7 @@
1
1
  import type { z } from 'zod/v4';
2
2
  import type { AutoFormRendererLayoutProps } from '../../types/auto-form-renderer.js';
3
- declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<AutoFormRendererLayoutProps<S>> & import("vue").PublicProps & (typeof globalThis extends {
3
+ declare const __VLS_export: <S extends z.ZodObject>(__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<AutoFormRendererLayoutProps<S>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
6
6
  } ? P : {});
7
7
  expose: (exposed: {}) => void;
@@ -13,6 +13,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
13
13
  };
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
- type __VLS_PrettifyLocal<T> = {
16
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
17
+ [K in keyof T]: T[K];
18
+ } : {
17
19
  [K in keyof T as K]: T[K];
18
- } & {};
20
+ }) & {};
@@ -1,7 +1,7 @@
1
1
  import type { z } from 'zod/v4';
2
2
  import type { AutoFormRendererNestedProps } from '../../types/auto-form-renderer.js';
3
- declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<AutoFormRendererNestedProps<S>> & import("vue").PublicProps & (typeof globalThis extends {
3
+ declare const __VLS_export: <S extends z.ZodObject>(__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<AutoFormRendererNestedProps<S>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
6
6
  } ? P : {});
7
7
  expose: (exposed: {}) => void;
@@ -13,6 +13,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
13
13
  };
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
- type __VLS_PrettifyLocal<T> = {
16
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
17
+ [K in keyof T]: T[K];
18
+ } : {
17
19
  [K in keyof T as K]: T[K];
18
- } & {};
20
+ }) & {};
@@ -1,7 +1,7 @@
1
1
  import type { z } from 'zod/v4';
2
2
  import type { AutoFormRendererNestedProps } from '../../types/auto-form-renderer.js';
3
- declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<AutoFormRendererNestedProps<S>> & import("vue").PublicProps & (typeof globalThis extends {
3
+ declare const __VLS_export: <S extends z.ZodObject>(__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<AutoFormRendererNestedProps<S>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
6
6
  } ? P : {});
7
7
  expose: (exposed: {}) => void;
@@ -13,6 +13,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
13
13
  };
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
- type __VLS_PrettifyLocal<T> = {
16
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
17
+ [K in keyof T]: T[K];
18
+ } : {
17
19
  [K in keyof T as K]: T[K];
18
- } & {};
20
+ }) & {};
@@ -1,9 +1,13 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithCharacterLimitProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithCharacterLimitProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onBlur?: ((event: FocusEvent) => any) | undefined;
8
+ onChange?: ((event: Event) => any) | undefined;
9
+ "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
10
+ }> & (typeof globalThis extends {
7
11
  __VLS_PROPS_FALLBACK: infer P;
8
12
  } ? P : {});
9
13
  expose: (exposed: {}) => void;
@@ -15,6 +19,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
19
  };
16
20
  declare const _default: typeof __VLS_export;
17
21
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
22
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
23
+ [K in keyof T]: T[K];
24
+ } : {
19
25
  [K in keyof T as K]: T[K];
20
- } & {};
26
+ }) & {};
@@ -1,9 +1,13 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithCharacterLimitProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithCharacterLimitProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onBlur?: ((event: FocusEvent) => any) | undefined;
8
+ onChange?: ((event: Event) => any) | undefined;
9
+ "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
10
+ }> & (typeof globalThis extends {
7
11
  __VLS_PROPS_FALLBACK: infer P;
8
12
  } ? P : {});
9
13
  expose: (exposed: {}) => void;
@@ -15,6 +19,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
19
  };
16
20
  declare const _default: typeof __VLS_export;
17
21
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
22
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
23
+ [K in keyof T]: T[K];
24
+ } : {
19
25
  [K in keyof T as K]: T[K];
20
- } & {};
26
+ }) & {};
@@ -1,9 +1,14 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithClearProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithClearProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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> & {
5
5
  modelValue?: InputProps<T>["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onClear?: (() => any) | undefined;
8
+ onBlur?: ((event: FocusEvent) => any) | undefined;
9
+ onChange?: ((event: Event) => any) | undefined;
10
+ "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
11
+ }> & (typeof globalThis extends {
7
12
  __VLS_PROPS_FALLBACK: infer P;
8
13
  } ? P : {});
9
14
  expose: (exposed: {}) => void;
@@ -15,6 +20,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
20
  };
16
21
  declare const _default: typeof __VLS_export;
17
22
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
23
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
24
+ [K in keyof T]: T[K];
25
+ } : {
19
26
  [K in keyof T as K]: T[K];
20
- } & {};
27
+ }) & {};
@@ -1,9 +1,14 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithClearProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithClearProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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> & {
5
5
  modelValue?: InputProps<T>["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onClear?: (() => any) | undefined;
8
+ onBlur?: ((event: FocusEvent) => any) | undefined;
9
+ onChange?: ((event: Event) => any) | undefined;
10
+ "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
11
+ }> & (typeof globalThis extends {
7
12
  __VLS_PROPS_FALLBACK: infer P;
8
13
  } ? P : {});
9
14
  expose: (exposed: {}) => void;
@@ -15,6 +20,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
20
  };
16
21
  declare const _default: typeof __VLS_export;
17
22
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
23
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
24
+ [K in keyof T]: T[K];
25
+ } : {
19
26
  [K in keyof T as K]: T[K];
20
- } & {};
27
+ }) & {};
@@ -1,9 +1,14 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithCopyProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithCopyProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
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;
11
+ }> & (typeof globalThis extends {
7
12
  __VLS_PROPS_FALLBACK: infer P;
8
13
  } ? P : {});
9
14
  expose: (exposed: {}) => void;
@@ -15,6 +20,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
20
  };
16
21
  declare const _default: typeof __VLS_export;
17
22
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
23
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
24
+ [K in keyof T]: T[K];
25
+ } : {
19
26
  [K in keyof T as K]: T[K];
20
- } & {};
27
+ }) & {};
@@ -1,9 +1,14 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithCopyProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithCopyProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
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;
11
+ }> & (typeof globalThis extends {
7
12
  __VLS_PROPS_FALLBACK: infer P;
8
13
  } ? P : {});
9
14
  expose: (exposed: {}) => void;
@@ -15,6 +20,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
20
  };
16
21
  declare const _default: typeof __VLS_export;
17
22
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
23
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
24
+ [K in keyof T]: T[K];
25
+ } : {
19
26
  [K in keyof T as K]: T[K];
20
- } & {};
27
+ }) & {};
@@ -1,9 +1,13 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithPasswordToggleProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithPasswordToggleProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onBlur?: ((event: FocusEvent) => any) | undefined;
8
+ onChange?: ((event: Event) => any) | undefined;
9
+ "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
10
+ }> & (typeof globalThis extends {
7
11
  __VLS_PROPS_FALLBACK: infer P;
8
12
  } ? P : {});
9
13
  expose: (exposed: {}) => void;
@@ -15,6 +19,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
19
  };
16
20
  declare const _default: typeof __VLS_export;
17
21
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
22
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
23
+ [K in keyof T]: T[K];
24
+ } : {
19
25
  [K in keyof T as K]: T[K];
20
- } & {};
26
+ }) & {};
@@ -1,9 +1,13 @@
1
1
  import type { InputProps, InputValue } from '@nuxt/ui';
2
2
  import type { WithPasswordToggleProps } from '../../types/components.js';
3
- 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<(WithPasswordToggleProps<import("@nuxt/ui/.").AcceptableValue> & {
3
+ 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
5
  modelValue?: InputProps["modelValue"];
6
- }) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((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)>>> & import("vue").PublicProps & (typeof globalThis extends {
6
+ }) & {
7
+ onBlur?: ((event: FocusEvent) => any) | undefined;
8
+ onChange?: ((event: Event) => any) | undefined;
9
+ "onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
10
+ }> & (typeof globalThis extends {
7
11
  __VLS_PROPS_FALLBACK: infer P;
8
12
  } ? P : {});
9
13
  expose: (exposed: {}) => void;
@@ -15,6 +19,8 @@ declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awai
15
19
  };
16
20
  declare const _default: typeof __VLS_export;
17
21
  export default _default;
18
- type __VLS_PrettifyLocal<T> = {
22
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
23
+ [K in keyof T]: T[K];
24
+ } : {
19
25
  [K in keyof T as K]: T[K];
20
- } & {};
26
+ }) & {};
@@ -0,0 +1,47 @@
1
+ import type { UseApiAuthReturn } from '../types/api.js';
2
+ /**
3
+ * API 认证 Composable
4
+ *
5
+ * 提供完整的登录、登出、刷新用户信息等功能,
6
+ * 与 nuxt-auth-utils 无缝集成。
7
+ *
8
+ * @returns UseApiAuthReturn 认证相关方法和状态
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const { login, clear, loggedIn, user } = useApiAuth()
13
+ *
14
+ * // 基础登录
15
+ * await login({
16
+ * loginPath: '/auth/login',
17
+ * credentials: { username: 'admin', password: '123456' }
18
+ * })
19
+ *
20
+ * // 登录后获取用户信息
21
+ * await login({
22
+ * loginPath: '/auth/login',
23
+ * credentials: { username: 'admin', password: '123456' },
24
+ * userInfoPath: '/auth/me'
25
+ * })
26
+ *
27
+ * // 自定义 token 提取和 session 构建
28
+ * await login({
29
+ * loginPath: '/auth/login',
30
+ * credentials: { username: 'admin', password: '123456' },
31
+ * tokenExtractor: (res) => res.data?.accessToken,
32
+ * sessionBuilder: (user, token) => ({
33
+ * user: { id: user.id, name: user.name },
34
+ * secure: { token, permissions: user.permissions }
35
+ * })
36
+ * })
37
+ *
38
+ * // 登出
39
+ * await clear()
40
+ *
41
+ * // 响应式状态
42
+ * if (loggedIn.value) {
43
+ * console.log('当前用户:', user.value)
44
+ * }
45
+ * ```
46
+ */
47
+ export declare function useApiAuth(): UseApiAuthReturn;
@@ -0,0 +1,66 @@
1
+ import { getPath } from "@movk/core";
2
+ import { useNuxtApp, useRuntimeConfig, useUserSession } from "#imports";
3
+ export function useApiAuth() {
4
+ const { $api } = useNuxtApp();
5
+ const userSession = useUserSession();
6
+ const moduleConfig = useRuntimeConfig().public.movkApi;
7
+ const buildAuthHeader = (token, authConfig = {}) => {
8
+ const tokenType = authConfig.tokenType === "Custom" ? authConfig.customTokenType || "" : authConfig.tokenType || "Bearer";
9
+ return tokenType ? `${tokenType} ${token}` : token;
10
+ };
11
+ const getHeaderName = (authConfig = {}) => {
12
+ return authConfig.headerName || "Authorization";
13
+ };
14
+ const defaultTokenExtractor = (response) => {
15
+ return getPath(response, "data.token") ?? getPath(response, "data.accessToken") ?? getPath(response, "token");
16
+ };
17
+ const defaultSessionBuilder = (user, token) => ({
18
+ user,
19
+ token,
20
+ loggedInAt: (/* @__PURE__ */ new Date()).toISOString()
21
+ });
22
+ async function login(options) {
23
+ const {
24
+ loginPath,
25
+ credentials,
26
+ userInfoPath,
27
+ tokenExtractor = defaultTokenExtractor,
28
+ sessionBuilder = defaultSessionBuilder,
29
+ endpoint
30
+ } = options;
31
+ const api = endpoint ? $api.use(endpoint) : $api;
32
+ const loginResponse = await api.$fetch(loginPath, {
33
+ method: "POST",
34
+ body: credentials
35
+ });
36
+ const token = tokenExtractor(loginResponse);
37
+ if (!token) {
38
+ throw new Error("Login failed: token not found in response");
39
+ }
40
+ let userInfo;
41
+ if (userInfoPath) {
42
+ const endpointConfig = api.getConfig();
43
+ const authConfig = endpointConfig.auth || moduleConfig.auth || {};
44
+ const headerName = getHeaderName(authConfig);
45
+ const headerValue = buildAuthHeader(token, authConfig);
46
+ const userResponse = await api.$fetch(userInfoPath, {
47
+ headers: { [headerName]: headerValue },
48
+ context: { toast: false }
49
+ });
50
+ userInfo = getPath(userResponse, "data") ?? userResponse;
51
+ } else {
52
+ userInfo = getPath(loginResponse, "data") ?? loginResponse;
53
+ }
54
+ const sessionData = sessionBuilder(userInfo, token);
55
+ await $fetch("/api/_movk/session", {
56
+ method: "POST",
57
+ body: sessionData
58
+ });
59
+ await userSession.fetch();
60
+ return { user: userInfo, token };
61
+ }
62
+ return {
63
+ login,
64
+ ...userSession
65
+ };
66
+ }
@@ -0,0 +1,42 @@
1
+ import type { UseApiFetchOptions, UseApiFetchReturn } from '../types/api.js';
2
+ /**
3
+ * API Fetch 组合式函数
4
+ *
5
+ * 基于 Nuxt useFetch 封装,提供:
6
+ * - 自动认证(从 session 获取 token)
7
+ * - 业务状态码检查
8
+ * - Toast 提示(通过内置 hooks 统一处理)
9
+ * - 自动数据解包
10
+ * - 支持用户自定义 hooks(与内置 hooks 合并执行)
11
+ *
12
+ * @typeParam ResT - API 响应 data 字段的原始类型
13
+ * @typeParam DataT - transform 转换后的最终类型(默认等于 ResT)
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // 基础用法(自动解包 data 字段)
18
+ * const { data, pending, error } = await useApiFetch<User[]>('/users')
19
+ *
20
+ * // POST 请求
21
+ * const { data } = await useApiFetch('/users', {
22
+ * method: 'POST',
23
+ * body: { name: 'test' }
24
+ * })
25
+ *
26
+ * // 自定义 transform(双泛型,接收解包后的数据)
27
+ * const { data } = await useApiFetch<{ content: User[] }, User[]>('/users', {
28
+ * transform: ({ content }) => content ?? []
29
+ * })
30
+ *
31
+ * // 使用其他端点
32
+ * const { data } = await useApiFetch('/users', { endpoint: 'v2' })
33
+ *
34
+ * // 自定义 hooks(与内置 hooks 合并执行)
35
+ * const { data } = await useApiFetch('/users', {
36
+ * onResponse({ response }) {
37
+ * console.log('用户自定义处理:', response._data)
38
+ * }
39
+ * })
40
+ * ```
41
+ */
42
+ export declare function useApiFetch<ResT = unknown, DataT = ResT>(url: string | (() => string), options?: UseApiFetchOptions<ResT, DataT>): UseApiFetchReturn<DataT>;
@@ -0,0 +1,43 @@
1
+ import { useNuxtApp, useFetch } from "#imports";
2
+ import { createTransform, mergeFetchHooks } from "../utils/api-utils.js";
3
+ export function useApiFetch(url, options = {}) {
4
+ const { $api } = useNuxtApp();
5
+ const {
6
+ endpoint,
7
+ toast,
8
+ skipBusinessCheck = false,
9
+ transform: userTransform,
10
+ onRequest: userOnRequest,
11
+ onRequestError: userOnRequestError,
12
+ onResponse: userOnResponse,
13
+ onResponseError: userOnResponseError,
14
+ ...fetchOptions
15
+ } = options;
16
+ const apiInstance = endpoint ? $api.use(endpoint) : $api;
17
+ const endpointConfig = apiInstance.getConfig();
18
+ const builtinHooks = endpointConfig.builtinHooks || {};
19
+ const transformFn = createTransform({
20
+ skipBusinessCheck,
21
+ userTransform,
22
+ successConfig: endpointConfig.success
23
+ });
24
+ const mergedHooks = mergeFetchHooks(builtinHooks, {
25
+ onRequest: userOnRequest,
26
+ onRequestError: userOnRequestError,
27
+ onResponse: userOnResponse,
28
+ onResponseError: userOnResponseError
29
+ });
30
+ const context = { toast, skipBusinessCheck };
31
+ return useFetch(url, {
32
+ ...fetchOptions,
33
+ $fetch: apiInstance.$fetch,
34
+ transform: transformFn,
35
+ // 合并后的 hooks
36
+ onRequest: mergedHooks.onRequest,
37
+ onRequestError: mergedHooks.onRequestError,
38
+ onResponse: mergedHooks.onResponse,
39
+ onResponseError: mergedHooks.onResponseError,
40
+ // 传递请求级配置给内置 hooks
41
+ context
42
+ });
43
+ }