@effect-app/vue-components 0.27.16 → 1.0.0-next.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 (74) hide show
  1. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +2 -3
  2. package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +4 -4
  3. package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +22 -0
  4. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -2
  5. package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +7 -37
  6. package/dist/types/components/OmegaForm/index.d.ts +1 -7
  7. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +65 -1
  8. package/dist/types/utils/index.d.ts +9 -0
  9. package/dist/vue-components.es.js +16 -25
  10. package/dist/vue-components.es10.js +5 -333
  11. package/dist/vue-components.es11.js +54 -6
  12. package/dist/vue-components.es12.js +71 -6
  13. package/dist/vue-components.es13.js +6 -2
  14. package/dist/vue-components.es14.js +6 -2
  15. package/dist/vue-components.es15.js +3 -86
  16. package/dist/vue-components.es16.js +5 -0
  17. package/dist/vue-components.es17.js +90 -7
  18. package/dist/vue-components.es18.js +42 -2
  19. package/dist/vue-components.es19.js +1 -1
  20. package/dist/vue-components.es2.js +10 -20
  21. package/dist/vue-components.es20.js +2 -126
  22. package/dist/vue-components.es21.js +92 -0
  23. package/dist/vue-components.es23.js +7 -5
  24. package/dist/vue-components.es24.js +31 -3
  25. package/dist/vue-components.es26.js +2 -11
  26. package/dist/vue-components.es27.js +11 -90
  27. package/dist/vue-components.es28.js +22 -41
  28. package/dist/vue-components.es29.js +5 -2
  29. package/dist/vue-components.es3.js +12 -8
  30. package/dist/vue-components.es30.js +18 -20
  31. package/dist/vue-components.es31.js +30 -5
  32. package/dist/vue-components.es32.js +17 -16
  33. package/dist/vue-components.es33.js +7 -25
  34. package/dist/vue-components.es34.js +5 -22
  35. package/dist/vue-components.es35.js +19 -12
  36. package/dist/vue-components.es36.js +9 -5
  37. package/dist/vue-components.es37.js +31 -19
  38. package/dist/vue-components.es38.js +48 -9
  39. package/dist/vue-components.es39.js +20 -25
  40. package/dist/vue-components.es4.js +40 -43
  41. package/dist/vue-components.es40.js +114 -47
  42. package/dist/vue-components.es42.js +4 -65
  43. package/dist/vue-components.es43.js +54 -45
  44. package/dist/vue-components.es44.js +54 -15
  45. package/dist/vue-components.es45.js +15 -31
  46. package/dist/vue-components.es46.js +30 -26
  47. package/dist/vue-components.es47.js +29 -42
  48. package/dist/vue-components.es48.js +41 -114
  49. package/dist/vue-components.es49.js +4 -0
  50. package/dist/vue-components.es5.js +29 -70
  51. package/dist/vue-components.es50.js +44 -2
  52. package/dist/vue-components.es51.js +2 -44
  53. package/dist/vue-components.es6.js +211 -31
  54. package/dist/vue-components.es7.js +331 -49
  55. package/dist/vue-components.es8.js +2 -29
  56. package/dist/vue-components.es9.js +10 -148
  57. package/package.json +2 -2
  58. package/src/components/OmegaForm/OmegaArray.vue +4 -2
  59. package/src/components/OmegaForm/OmegaAutoGen.vue +5 -5
  60. package/src/components/OmegaForm/OmegaErrorsContext.ts +10 -8
  61. package/src/components/OmegaForm/{OmegaErrors.vue → OmegaErrorsInternal.vue} +11 -5
  62. package/src/components/OmegaForm/OmegaFormInput.vue +4 -2
  63. package/src/components/OmegaForm/OmegaFormStuff.ts +5 -6
  64. package/src/components/OmegaForm/OmegaInput.vue +4 -2
  65. package/src/components/OmegaForm/OmegaWrapper.vue +23 -247
  66. package/src/components/OmegaForm/index.ts +1 -7
  67. package/src/components/OmegaForm/useOmegaForm.ts +227 -7
  68. package/src/utils/index.ts +16 -0
  69. package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +0 -15
  70. package/dist/vue-components.es22.js +0 -12
  71. package/dist/vue-components.es25.js +0 -5
  72. package/dist/vue-components.es41.js +0 -28
  73. package/dist/vue-components.es52.js +0 -4
  74. package/dist/vue-components.es53.js +0 -6
@@ -1,8 +1,7 @@
1
1
  import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
2
2
  import { type OmegaInputProps } from "./OmegaFormStuff";
3
- declare const _default: <// dprint ignore - somehow with 120 chars, this becomes a mess. should report it.
4
- From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__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<{
5
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "label" | "type" | "options" | "validators" | "items"> & {
3
+ declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__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<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "validators" | "options" | "label" | "type" | "items"> & {
6
5
  defaultItems?: DeepValue<From, DeepKeys<From>>;
7
6
  items?: "please use `defaultItems` instead";
8
7
  }) & {}> & import("vue").PublicProps;
@@ -8,9 +8,9 @@ export declare const OmegaErrorsKey: InjectionKey<{
8
8
  clearErrors: () => void;
9
9
  showErrors: Ref<boolean>;
10
10
  showErrorsOn: ShowErrorsOn;
11
- generalErrors: Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>;
11
+ generalErrors: Readonly<Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>>;
12
12
  }>;
13
- export declare function provideOmegaErrors(formSubmissionAttempts: Ref<number>, generalErrors: Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>, showErrorsOn?: ShowErrorsOn): {
13
+ export declare function buildOmegaErrors(formSubmissionAttempts: Ref<number>, generalErrors: Readonly<Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>>, showErrorsOn?: ShowErrorsOn): {
14
14
  errors: Readonly<Ref<readonly {
15
15
  readonly label: string;
16
16
  readonly inputId: string;
@@ -24,7 +24,7 @@ export declare function provideOmegaErrors(formSubmissionAttempts: Ref<number>,
24
24
  removeError: (inputId: string) => void;
25
25
  clearErrors: () => void;
26
26
  showErrors: import("vue").ComputedRef<boolean>;
27
- generalErrors: Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined, (Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>;
27
+ generalErrors: Readonly<Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined, (Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>>;
28
28
  showErrorsOn: ShowErrorsOn;
29
29
  };
30
30
  export declare function useOmegaErrors(): {
@@ -34,5 +34,5 @@ export declare function useOmegaErrors(): {
34
34
  clearErrors: () => void;
35
35
  showErrors: Ref<boolean>;
36
36
  showErrorsOn: ShowErrorsOn;
37
- generalErrors: Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>;
37
+ generalErrors: Readonly<Ref<(Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined>>;
38
38
  };
@@ -0,0 +1,22 @@
1
+ import type { StandardSchemaV1Issue } from "@tanstack/vue-form";
2
+ import { type OmegaError } from "./OmegaFormStuff";
3
+ type __VLS_Props = {
4
+ errors: readonly OmegaError[];
5
+ generalErrors: (Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined;
6
+ showErrors: boolean;
7
+ };
8
+ declare var __VLS_6: {
9
+ errors: readonly OmegaError[];
10
+ showedGeneralErrors: string[];
11
+ };
12
+ type __VLS_Slots = {} & {
13
+ default?: (props: typeof __VLS_6) => any;
14
+ };
15
+ declare const __VLS_component: 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>;
16
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -1,6 +1,5 @@
1
1
  import { type OmegaInputProps } from "./OmegaFormStuff";
2
- declare const _default: <// dprint ignore - somehow with 120 chars, this becomes a mess. should report it.
3
- From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__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<{
2
+ declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__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
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & OmegaInputProps<From, To> & {}> & import("vue").PublicProps;
5
4
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
6
5
  attrs: any;
@@ -1,45 +1,15 @@
1
- import { type S } from "effect-app";
2
- import { type FormProps, type OmegaFormState, type ShowErrorsOn } from "./OmegaFormStuff";
3
- import { type DefaultInputProps, type OmegaConfig, type OmegaFormReturn } from "./useOmegaForm";
1
+ import { type OmegaFormState } from "./OmegaFormStuff";
2
+ import { type DefaultInputProps, type OmegaFormReturn } from "./useOmegaForm";
4
3
  declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof OmegaFormState<From, To> = keyof OmegaFormState<From, To>, Props = DefaultInputProps<From>>(__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<{
5
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ({
6
- omegaConfig?: OmegaConfig<From>;
7
- subscribe?: K[];
8
- showErrorsOn?: ShowErrorsOn;
9
- } & Omit<FormProps<From, To>, "onSubmit"> & (({
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
10
5
  form: OmegaFormReturn<From, To, Props>;
11
- schema?: undefined;
12
- } | {
13
- form?: undefined;
14
- schema: S.Schema<To, From, never>;
15
- }) & ({
16
- isLoading: boolean;
17
- onSubmit: (value: To, extra: Pick<{
18
- formApi: import("./OmegaFormStuff").OmegaFormParams<From, To>;
19
- meta: any;
20
- value: To;
21
- }, "formApi" | "meta">) => void;
22
- } | {
23
- isLoading?: undefined;
24
- onSubmit?: (value: To, extra: Pick<{
25
- formApi: import("./OmegaFormStuff").OmegaFormParams<From, To>;
26
- meta: any;
27
- value: To;
28
- }, "formApi" | "meta">) => ReturnType<(props: {
29
- formApi: import("./OmegaFormStuff").OmegaFormParams<From, To>;
30
- meta: any;
31
- value: To;
32
- }) => Promise<any> | import("effect/Fiber").RuntimeFiber<any, any> | import("effect/Effect").Effect<import("effect/Fiber").RuntimeFiber<any, any>, any, never>>;
33
- }))) & {}> & import("vue").PublicProps;
6
+ disabled?: boolean;
7
+ subscribe?: K[];
8
+ } & {}> & import("vue").PublicProps;
34
9
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
35
10
  attrs: any;
36
11
  slots: {
37
- default(): void;
38
- internalForm(props: {
39
- form: OmegaFormReturn<From, To>;
40
- subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>;
41
- }): void;
42
- externalForm(props: {
12
+ default(props: {
43
13
  subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>;
44
14
  }): void;
45
15
  };
@@ -1,11 +1,5 @@
1
- import { default as OmegaArray } from "./OmegaArray.vue";
2
- import { default as OmegaAutoGen } from "./OmegaAutoGen.vue";
3
- import { default as OmegaErrors } from "./OmegaErrors.vue";
4
- import { default as OmegaFormInput } from "./OmegaFormInput.vue";
5
1
  import { default as OmegaInput } from "./OmegaInput.vue";
6
- import { default as OmegaForm } from "./OmegaWrapper.vue";
7
2
  export * as OmegaErrorsContext from "./OmegaErrorsContext";
8
3
  export * from "./OmegaFormStuff";
9
- export { default } from "./OmegaWrapper.vue";
10
4
  export { type OmegaFormReturn, useOmegaForm } from "./useOmegaForm";
11
- export { OmegaArray, OmegaAutoGen, OmegaErrors, OmegaForm, OmegaFormInput, OmegaInput };
5
+ export { OmegaInput };
@@ -1,8 +1,13 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { S } from "effect-app";
3
3
  import { type InjectionKey } from "vue";
4
+ import { getOmegaStore } from "./getOmegaStore";
4
5
  import { type InputProps } from "./InputProps";
5
- import { type FieldValidators, type FilterItems, type FormProps, type MetaRecord, type NestedKeyOf, type OmegaFormApi, type TypeOverride } from "./OmegaFormStuff";
6
+ import OmegaArray from "./OmegaArray.vue";
7
+ import OmegaAutoGen from "./OmegaAutoGen.vue";
8
+ import OmegaErrorsInternal from "./OmegaErrorsInternal.vue";
9
+ import { type FieldValidators, type FilterItems, type FormProps, type MetaRecord, type NestedKeyOf, type OmegaFormApi, OmegaFormState, ShowErrorsOn, type TypeOverride } from "./OmegaFormStuff";
10
+ import OmegaForm from "./OmegaWrapper.vue";
6
11
  type keysRule<T> = {
7
12
  keys?: NestedKeyOf<T>[];
8
13
  banKeys?: "You should only use one of banKeys or keys, not both, moron";
@@ -12,6 +17,7 @@ type keysRule<T> = {
12
17
  };
13
18
  export type OmegaConfig<T> = {
14
19
  i18nNamespace?: string;
20
+ showErrorsOn?: ShowErrorsOn;
15
21
  persistency?: {
16
22
  /** Order of importance:
17
23
  * - "querystring": Highest priority when persisting
@@ -56,6 +62,64 @@ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To exten
56
62
  }>) => import("vue").VNode & {
57
63
  __ctx?: Awaited<typeof __VLS_setup>;
58
64
  };
65
+ Errors: (__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<{
66
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Omit<ReturnType<typeof OmegaErrorsInternal["props"]>, "errors" | "generalErrors" | "showErrors"> & Partial<{}>> & import("vue").PublicProps;
67
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
68
+ attrs: any;
69
+ slots: {};
70
+ emit: {};
71
+ }>) => import("vue").VNode & {
72
+ __ctx?: Awaited<typeof __VLS_setup>;
73
+ };
74
+ Array: (__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<{
75
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Omit<ReturnType<typeof OmegaArray<From, To>>["props"], "form"> & Partial<{}>> & import("vue").PublicProps;
76
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
77
+ attrs: any;
78
+ slots: {
79
+ default(props: {
80
+ subField: any;
81
+ subState: any;
82
+ index: number;
83
+ field: any;
84
+ }): void;
85
+ preArray(props: {
86
+ field: any;
87
+ state: any;
88
+ }): void;
89
+ postArray(props: {
90
+ field: any;
91
+ state: any;
92
+ }): void;
93
+ field(props: {
94
+ field: any;
95
+ }): void;
96
+ };
97
+ emit: {};
98
+ }>) => import("vue").VNode & {
99
+ __ctx?: Awaited<typeof __VLS_setup>;
100
+ };
101
+ AutoGen: (__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<{
102
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Omit<ReturnType<typeof OmegaAutoGen<From, To>>["props"], "form"> & Partial<{}>> & import("vue").PublicProps;
103
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
104
+ attrs: any;
105
+ slots: {};
106
+ emit: {};
107
+ }>) => import("vue").VNode & {
108
+ __ctx?: Awaited<typeof __VLS_setup>;
109
+ };
110
+ Form: <K extends keyof OmegaFormState<To, From>, Props = DefaultInputProps<From>>(__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<{
111
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ReturnType<typeof OmegaForm<From, To, K, Props>>["props"] & Partial<{}>> & import("vue").PublicProps;
112
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
113
+ attrs: any;
114
+ slots: {
115
+ default(props: {
116
+ subscribedValues: ReturnType<typeof getOmegaStore<To, From, K>>["value"];
117
+ }): void;
118
+ };
119
+ emit: {};
120
+ }>) => import("vue").VNode & {
121
+ __ctx?: Awaited<typeof __VLS_setup>;
122
+ };
59
123
  }
60
124
  export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Props = DefaultInputProps<From>>(schema: S.Schema<To, From, never>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To, Props>;
61
125
  export {};
@@ -1,4 +1,5 @@
1
1
  import { type makeIntl } from "@effect-app/vue";
2
+ import { type S } from "effect-app";
2
3
  import { type InjectionKey } from "vue";
3
4
  export declare const useIntlKey: InjectionKey<ReturnType<typeof makeIntl>["useIntl"]>;
4
5
  export declare const useIntl: () => {
@@ -8,3 +9,11 @@ export declare const useIntl: () => {
8
9
  readonly intl: import("@effect-app/vue").IntlShape<string>;
9
10
  };
10
11
  export declare const provideIntl: (intl: ReturnType<typeof makeIntl>["useIntl"]) => void;
12
+ /**
13
+ * Recursively extracts the source AST from a transformation chain.
14
+ * If the provided AST is a transformation, it follows the chain to find the original source AST.
15
+ *
16
+ * @param ast - The AST node to extract the transformation source from
17
+ * @returns The source AST at the end of the transformation chain
18
+ */
19
+ export declare function getTransformationFrom(ast: S.AST.AST): S.AST.Declaration | S.AST.Literal | S.AST.UniqueSymbol | S.AST.UndefinedKeyword | S.AST.VoidKeyword | S.AST.NeverKeyword | S.AST.UnknownKeyword | S.AST.AnyKeyword | S.AST.StringKeyword | S.AST.NumberKeyword | S.AST.BooleanKeyword | S.AST.BigIntKeyword | S.AST.SymbolKeyword | S.AST.ObjectKeyword | S.AST.Enums | S.AST.TemplateLiteral | S.AST.Refinement<S.AST.AST> | S.AST.TupleType | S.AST.TypeLiteral | S.AST.Union<S.AST.AST> | S.AST.Suspend;
@@ -1,14 +1,9 @@
1
1
  import * as o from "./vue-components.es2.js";
2
- import { provideIntl as l, useIntl as s, useIntlKey as u } from "./vue-components.es3.js";
2
+ import { getTransformationFrom as f, provideIntl as l, useIntl as s, useIntlKey as i } from "./vue-components.es3.js";
3
3
  import { default as d } from "./vue-components.es4.js";
4
- import { default as i } from "./vue-components.es5.js";
5
- import { default as O } from "./vue-components.es6.js";
6
- import { default as y } from "./vue-components.es7.js";
7
- import * as m from "./vue-components.es8.js";
8
- import { useOmegaForm as h } from "./vue-components.es9.js";
9
- import { createMeta as b, duplicateSchema as M, generateInputStandardSchemaFromFieldMeta as j, generateMetaFromSchema as A, nullableInput as E } from "./vue-components.es10.js";
10
- import { default as v } from "./vue-components.es11.js";
11
- import { default as C } from "./vue-components.es12.js";
4
+ import * as n from "./vue-components.es5.js";
5
+ import { useOmegaForm as g } from "./vue-components.es6.js";
6
+ import { createMeta as y, duplicateSchema as F, generateInputStandardSchemaFromFieldMeta as O, generateMetaFromSchema as h, nullableInput as S } from "./vue-components.es7.js";
12
7
  function a(r) {
13
8
  for (const e in o)
14
9
  if (Object.prototype.hasOwnProperty.call(o, e)) {
@@ -16,23 +11,19 @@ function a(r) {
16
11
  t && typeof t == "object" && r.component(e, t);
17
12
  }
18
13
  }
19
- const n = { install: a };
14
+ const m = { install: a };
20
15
  export {
21
- d as OmegaArray,
22
- i as OmegaAutoGen,
23
- v as OmegaErrors,
24
- m as OmegaErrorsContext,
25
- C as OmegaForm,
26
- O as OmegaFormInput,
27
- y as OmegaInput,
28
- b as createMeta,
29
- n as default,
30
- M as duplicateSchema,
31
- j as generateInputStandardSchemaFromFieldMeta,
32
- A as generateMetaFromSchema,
33
- E as nullableInput,
16
+ n as OmegaErrorsContext,
17
+ d as OmegaInput,
18
+ y as createMeta,
19
+ m as default,
20
+ F as duplicateSchema,
21
+ O as generateInputStandardSchemaFromFieldMeta,
22
+ h as generateMetaFromSchema,
23
+ f as getTransformationFrom,
24
+ S as nullableInput,
34
25
  l as provideIntl,
35
26
  s as useIntl,
36
- u as useIntlKey,
37
- h as useOmegaForm
27
+ i as useIntlKey,
28
+ g as useOmegaForm
38
29
  };
@@ -1,335 +1,7 @@
1
- import { S as n, Option as c, pipe as L } from "effect-app";
2
- import { useIntl as U } from "./vue-components.es3.js";
3
- const N = n.NonEmptyArray(n.String), _ = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === n.Null.ast), g = (e) => !e || !n.AST.isUnion(e) ? !1 : e.types.find((i) => i._tag === "UndefinedKeyword") ? "undefined" : e.types.find((i) => i === n.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: p }, o = {}) => {
4
- if (t && t._tag === "Transformation")
5
- return m({
6
- parent: i,
7
- meta: e,
8
- property: t.from
9
- });
10
- if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
11
- return m({
12
- meta: e,
13
- propertySignatures: t.propertySignatures
14
- });
15
- if (p) {
16
- for (const r of p) {
17
- const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
18
- if (n.AST.isUnion(r.type)) {
19
- const T = r.type.types.filter(
20
- (s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
21
- ).map((s) => s._tag === "Transformation" ? s.from : s);
22
- if (T.some(
23
- (s) => "propertySignatures" in s
24
- )) {
25
- if (!a) {
26
- const s = m({
27
- parent: l,
28
- property: r.type,
29
- meta: { required: u, nullableOrUndefined: a }
30
- });
31
- o[l] = s;
32
- }
33
- for (const s of T)
34
- "propertySignatures" in s && Object.assign(
35
- o,
36
- m({
37
- parent: l,
38
- propertySignatures: s.propertySignatures,
39
- meta: { required: u, nullableOrUndefined: a }
40
- })
41
- );
42
- } else {
43
- const s = T.filter(n.AST.isTupleType);
44
- if (s.length > 0) {
45
- const f = s[0];
46
- if (o[l] = {
47
- type: "multiple",
48
- members: f.elements,
49
- rest: f.rest,
50
- required: u,
51
- nullableOrUndefined: a
52
- }, f.rest && f.rest.length > 0) {
53
- const d = f.rest[0];
54
- if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
55
- for (const y of d.type.propertySignatures) {
56
- const b = `${l}.${y.name.toString()}`, S = m({
57
- parent: b,
58
- property: y.type,
59
- meta: {
60
- required: !g(y.type),
61
- nullableOrUndefined: g(y.type)
62
- }
63
- });
64
- if (S && typeof S == "object" && "type" in S && (o[b] = S, S.type === "multiple" && n.AST.isTupleType(y.type) && y.type.rest && y.type.rest.length > 0)) {
65
- const O = y.type.rest[0];
66
- if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
67
- for (const v of O.type.propertySignatures) {
68
- const M = `${b}.${v.name.toString()}`, x = m({
69
- parent: M,
70
- property: v.type,
71
- meta: {
72
- required: !g(v.type),
73
- nullableOrUndefined: g(v.type)
74
- }
75
- });
76
- x && typeof x == "object" && "type" in x && (o[M] = x);
77
- }
78
- }
79
- }
80
- }
81
- } else {
82
- const f = m({
83
- parent: l,
84
- property: r.type,
85
- meta: { required: u, nullableOrUndefined: a }
86
- });
87
- o[l] = f;
88
- }
89
- }
90
- } else if ("propertySignatures" in A)
91
- Object.assign(
92
- o,
93
- m({
94
- parent: l,
95
- propertySignatures: A.propertySignatures,
96
- meta: { required: u, nullableOrUndefined: a }
97
- })
98
- );
99
- else if (n.AST.isTupleType(r.type))
100
- if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
101
- const h = r.type.rest[0].type;
102
- if (h._tag === "TypeLiteral" && "propertySignatures" in h)
103
- for (const s of h.propertySignatures) {
104
- const f = `${l}.${s.name.toString()}`;
105
- if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
106
- const d = s.type.rest[0].type;
107
- if (d._tag === "TypeLiteral" && "propertySignatures" in d)
108
- for (const y of d.propertySignatures) {
109
- const b = `${f}.${y.name.toString()}`, S = m({
110
- parent: b,
111
- property: y.type,
112
- meta: {
113
- required: !g(y.type),
114
- nullableOrUndefined: g(y.type)
115
- }
116
- });
117
- o[b] = S;
118
- }
119
- else
120
- o[f] = {
121
- type: "multiple",
122
- members: s.type.elements,
123
- rest: s.type.rest,
124
- required: !g(s.type),
125
- nullableOrUndefined: g(s.type)
126
- };
127
- } else {
128
- const d = m({
129
- parent: f,
130
- property: s.type,
131
- meta: {
132
- required: !g(s.type),
133
- nullableOrUndefined: g(s.type)
134
- }
135
- });
136
- o[f] = d;
137
- }
138
- }
139
- } else
140
- o[l] = {
141
- type: "multiple",
142
- members: r.type.elements,
143
- rest: r.type.rest,
144
- required: u,
145
- nullableOrUndefined: a
146
- };
147
- else {
148
- const T = m({
149
- parent: l,
150
- property: r.type,
151
- meta: { required: u, nullableOrUndefined: a }
152
- });
153
- o[l] = T;
154
- }
155
- }
156
- return o;
157
- }
158
- if (t) {
159
- const r = _(t);
160
- if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
161
- const a = t.types.find(
162
- (u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
163
- );
164
- return "propertySignatures" in a ? m({
165
- propertySignatures: a.propertySignatures,
166
- parent: i,
167
- meta: e
168
- }) : t.types.every(n.AST.isLiteral) ? {
169
- ...e,
170
- type: "select",
171
- members: t.types.map((u) => u.literal)
172
- } : {
173
- ...e,
174
- ...m({
175
- parent: i,
176
- meta: e,
177
- property: a
178
- })
179
- };
180
- }
181
- if (n.AST.isTupleType(t))
182
- return {
183
- ...e,
184
- type: "multiple",
185
- members: t.elements,
186
- rest: t.rest
187
- };
188
- const l = n.AST.getAnnotation(
189
- t,
190
- n.AST.JSONSchemaAnnotationId
191
- ).pipe(c.getOrElse(() => ({})));
192
- return e = { ...e, ...l }, "from" in t ? m({
193
- parent: i,
194
- meta: e,
195
- property: t.from
196
- }) : (e.type = n.AST.getAnnotation(
197
- t,
198
- n.AST.TitleAnnotationId
199
- ).pipe(
200
- c.getOrElse(() => "unknown")
201
- ), e);
202
- }
203
- return o;
204
- }, q = (e) => {
205
- const i = e.ast, t = {};
206
- if (i._tag === "Transformation" || i._tag === "Refinement")
207
- return q(n.make(i.from));
208
- if ("propertySignatures" in i) {
209
- const p = m({
210
- propertySignatures: i.propertySignatures
211
- });
212
- if (Object.values(p).every((r) => r && "type" in r))
213
- return p;
214
- const o = (r, l = "") => {
215
- for (const a in r) {
216
- const u = l ? `${l}.${a}` : a;
217
- r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
218
- }
219
- };
220
- o(p);
221
- }
222
- return t;
223
- }, w = (e) => n.extend(e, n.Struct({})), $ = (e) => {
224
- const i = q(e), t = L(
225
- e.ast,
226
- c.liftPredicate((p) => p._tag === "Refinement" && "filter" in p),
227
- c.flatMap((p) => n.AST.getJSONSchemaAnnotation(p)),
228
- c.filter((p) => "items" in p),
229
- c.filterMap(({ items: p }) => n.decodeUnknownOption(N)(p)),
230
- c.zipWith(
231
- n.AST.getMessageAnnotation(e.ast),
232
- (p, o) => ({
233
- items: p,
234
- message: o("")
235
- })
236
- ),
237
- c.getOrUndefined
238
- );
239
- return { schema: e, meta: i, filterItems: t };
240
- }, K = (e) => {
241
- const { trans: i } = U();
242
- let t;
243
- switch (e.type) {
244
- case "string":
245
- t = n.String.annotations({
246
- message: () => i("validation.empty")
247
- }), e.format === "email" && (t = n.compose(
248
- t,
249
- n.Email.annotations({
250
- message: () => i("validation.email.invalid")
251
- })
252
- )), e.required && t.annotations({
253
- message: () => i("validation.empty")
254
- }), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
255
- message: () => i("validation.string.maxLength", {
256
- maxLength: e.maxLength
257
- })
258
- })), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
259
- message: () => i("validation.string.minLength", {
260
- minLength: e.minLength
261
- })
262
- }));
263
- break;
264
- case "number":
265
- t = n.Number.annotations({
266
- message: () => i("validation.empty")
267
- }), e.required && t.annotations({
268
- message: () => i("validation.empty")
269
- }), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
270
- message: () => i("validation.number.min", {
271
- minimum: e.minimum,
272
- isExclusive: !0
273
- })
274
- })), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
275
- message: () => i("validation.number.max", {
276
- maximum: e.maximum,
277
- isExclusive: !0
278
- })
279
- })), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
280
- message: () => i("validation.number.min", {
281
- minimum: e.exclusiveMinimum,
282
- isExclusive: !1
283
- })
284
- })), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
285
- message: () => i("validation.number.max", {
286
- maximum: e.exclusiveMaximum,
287
- isExclusive: !1
288
- })
289
- }));
290
- break;
291
- case "select":
292
- t = n.Literal(...e.members).annotations({
293
- message: () => ({
294
- message: i("validation.not_a_valid", {
295
- type: "select",
296
- message: e.members.join(", ")
297
- }),
298
- override: !0
299
- })
300
- });
301
- break;
302
- case "multiple":
303
- t = n.Array(n.String).annotations({
304
- message: () => i("validation.not_a_valid", {
305
- type: "multiple",
306
- message: e.members.join(", ")
307
- })
308
- });
309
- break;
310
- case "boolean":
311
- t = n.Boolean;
312
- break;
313
- // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
314
- case "unknown":
315
- t = n.Unknown;
316
- break;
317
- }
318
- return e.required ? t.pipe(
319
- n.annotations({
320
- message: () => i("validation.empty")
321
- })
322
- ) : t = n.NullishOr(t), n.standardSchemaV1(t);
323
- }, P = (e, i) => n.NullOr(e).pipe(
324
- n.transform(n.typeSchema(e), {
325
- decode: (t) => t ?? i(),
326
- encode: (t) => t
327
- })
328
- );
1
+ import { isFunction as c } from "./vue-components.es18.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
329
3
  export {
330
- m as createMeta,
331
- w as duplicateSchema,
332
- K as generateInputStandardSchemaFromFieldMeta,
333
- $ as generateMetaFromSchema,
334
- P as nullableInput
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
335
7
  };