@effect-app/vue-components 4.0.0-beta.157 → 4.0.0-beta.159

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 (124) hide show
  1. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
  2. package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +1 -1
  3. package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +1 -1
  4. package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
  5. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -1
  6. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -1
  7. package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
  8. package/dist/types/components/OmegaForm/createUseFormWithCustomInput.d.ts +2 -2
  9. package/dist/types/components/OmegaForm/errors.d.ts +33 -0
  10. package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
  11. package/dist/types/components/OmegaForm/hocs.d.ts +3 -0
  12. package/dist/types/components/OmegaForm/index.d.ts +13 -3
  13. package/dist/types/components/OmegaForm/inputs.d.ts +4 -0
  14. package/dist/types/components/OmegaForm/meta/checks.d.ts +4 -0
  15. package/dist/types/components/OmegaForm/meta/createMeta.d.ts +32 -0
  16. package/dist/types/components/OmegaForm/meta/defaults.d.ts +2 -0
  17. package/dist/types/components/OmegaForm/meta/redacted.d.ts +2 -0
  18. package/dist/types/components/OmegaForm/meta/types.d.ts +56 -0
  19. package/dist/types/components/OmegaForm/meta/walker.d.ts +18 -0
  20. package/dist/types/components/OmegaForm/persistency.d.ts +58 -0
  21. package/dist/types/components/OmegaForm/submit.d.ts +60 -0
  22. package/dist/types/components/OmegaForm/types.d.ts +281 -0
  23. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -212
  24. package/dist/types/components/OmegaForm/validation/localized.d.ts +10 -0
  25. package/dist/vue-components.es.js +24 -16
  26. package/dist/vue-components10.es.js +4 -4
  27. package/dist/vue-components11.es.js +19 -12
  28. package/dist/vue-components12.es.js +22 -444
  29. package/dist/vue-components13.es.js +126 -3
  30. package/dist/vue-components14.es.js +61 -34
  31. package/dist/vue-components15.es.js +57 -24
  32. package/dist/vue-components16.es.js +20 -26
  33. package/dist/vue-components17.es.js +4 -6
  34. package/dist/vue-components18.es.js +78 -16
  35. package/dist/vue-components19.es.js +86 -30
  36. package/dist/vue-components20.es.js +72 -17
  37. package/dist/vue-components21.es.js +10 -19
  38. package/dist/vue-components22.es.js +54 -28
  39. package/dist/vue-components23.es.js +4 -6
  40. package/dist/vue-components24.es.js +43 -8
  41. package/dist/vue-components25.es.js +4 -37
  42. package/dist/vue-components26.es.js +83 -24
  43. package/dist/vue-components28.es.js +6 -22
  44. package/dist/vue-components29.es.js +8 -20
  45. package/dist/vue-components3.es.js +2 -2
  46. package/dist/vue-components30.es.js +267 -7
  47. package/dist/vue-components32.es.js +7 -4
  48. package/dist/vue-components33.es.js +71 -27
  49. package/dist/vue-components34.es.js +4 -4
  50. package/dist/vue-components35.es.js +50 -27
  51. package/dist/vue-components36.es.js +4 -5
  52. package/dist/vue-components37.es.js +23 -17
  53. package/dist/vue-components38.es.js +4 -55
  54. package/dist/vue-components39.es.js +57 -3
  55. package/dist/vue-components40.es.js +4 -43
  56. package/dist/vue-components41.es.js +11 -4
  57. package/dist/vue-components42.es.js +17 -79
  58. package/dist/vue-components44.es.js +8 -7
  59. package/dist/vue-components45.es.js +3 -8
  60. package/dist/vue-components46.es.js +36 -267
  61. package/dist/vue-components47.es.js +27 -0
  62. package/dist/vue-components48.es.js +27 -7
  63. package/dist/vue-components49.es.js +6 -79
  64. package/dist/vue-components50.es.js +17 -4
  65. package/dist/vue-components51.es.js +32 -69
  66. package/dist/vue-components52.es.js +17 -4
  67. package/dist/vue-components53.es.js +19 -22
  68. package/dist/vue-components54.es.js +29 -4
  69. package/dist/vue-components55.es.js +6 -58
  70. package/dist/vue-components56.es.js +8 -4
  71. package/dist/vue-components57.es.js +37 -11
  72. package/dist/vue-components58.es.js +24 -21
  73. package/dist/{vue-components27.es.js → vue-components59.es.js} +2 -2
  74. package/dist/vue-components6.es.js +11 -11
  75. package/dist/vue-components60.es.js +23 -8
  76. package/dist/vue-components61.es.js +18 -232
  77. package/dist/vue-components62.es.js +7 -31
  78. package/dist/vue-components63.es.js +19 -8
  79. package/dist/vue-components64.es.js +4 -35
  80. package/dist/vue-components65.es.js +29 -0
  81. package/dist/vue-components66.es.js +5 -0
  82. package/dist/vue-components67.es.js +29 -0
  83. package/dist/vue-components68.es.js +6 -0
  84. package/dist/vue-components69.es.js +18 -0
  85. package/dist/vue-components7.es.js +11 -26
  86. package/dist/vue-components70.es.js +40 -0
  87. package/dist/vue-components71.es.js +81 -0
  88. package/dist/vue-components72.es.js +33 -0
  89. package/dist/vue-components73.es.js +19 -0
  90. package/dist/vue-components74.es.js +48 -0
  91. package/dist/vue-components8.es.js +33 -45
  92. package/dist/vue-components9.es.js +46 -4
  93. package/package.json +7 -7
  94. package/src/components/CommandButton.vue +3 -1
  95. package/src/components/OmegaForm/OmegaArray.vue +1 -1
  96. package/src/components/OmegaForm/OmegaAutoGen.vue +2 -1
  97. package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -1
  98. package/src/components/OmegaForm/OmegaFormInput.vue +1 -1
  99. package/src/components/OmegaForm/OmegaInput.vue +6 -68
  100. package/src/components/OmegaForm/OmegaInputVuetify.vue +1 -1
  101. package/src/components/OmegaForm/OmegaInternalInput.vue +5 -11
  102. package/src/components/OmegaForm/OmegaTaggedUnion.vue +2 -1
  103. package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
  104. package/src/components/OmegaForm/blockDialog.ts +10 -1
  105. package/src/components/OmegaForm/createUseFormWithCustomInput.ts +2 -1
  106. package/src/components/OmegaForm/errors.ts +136 -0
  107. package/src/components/OmegaForm/getOmegaStore.ts +1 -1
  108. package/src/components/OmegaForm/hocs.ts +19 -0
  109. package/src/components/OmegaForm/index.ts +16 -4
  110. package/src/components/OmegaForm/inputs.ts +22 -0
  111. package/src/components/OmegaForm/meta/checks.ts +81 -0
  112. package/src/components/OmegaForm/meta/createMeta.ts +138 -0
  113. package/src/components/OmegaForm/meta/defaults.ts +132 -0
  114. package/src/components/OmegaForm/meta/redacted.ts +66 -0
  115. package/src/components/OmegaForm/meta/types.ts +78 -0
  116. package/src/components/OmegaForm/meta/walker.ts +247 -0
  117. package/src/components/OmegaForm/persistency.ts +247 -0
  118. package/src/components/OmegaForm/submit.ts +128 -0
  119. package/src/components/OmegaForm/types.ts +751 -0
  120. package/src/components/OmegaForm/useOmegaForm.ts +49 -913
  121. package/src/components/OmegaForm/validation/localized.ts +202 -0
  122. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -173
  123. package/dist/vue-components31.es.js +0 -19
  124. package/src/components/OmegaForm/OmegaFormStuff.ts +0 -1422
@@ -1,5 +1,5 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
- import { type OmegaArrayProps } from "./OmegaFormStuff";
2
+ import { type OmegaArrayProps } from "./types";
3
3
  declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__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
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<OmegaArrayProps<From, To, Name>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
@@ -1,6 +1,6 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { Order } from "effect-app";
3
- import { type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff";
3
+ import { type OmegaAutoGenMeta, type OmegaInputProps } from "./types";
4
4
  declare const __VLS_export: <From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>, Name extends DeepKeys<From>>(__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<{
5
5
  props: import("vue").PublicProps & __VLS_PrettifyLocal<{
6
6
  form: OmegaInputProps<From, To, Name>["form"];
@@ -1,5 +1,5 @@
1
1
  import type { StandardSchemaV1Issue } from "@tanstack/vue-form";
2
- import { type OmegaError } from "./OmegaFormStuff";
2
+ import { type OmegaError } from "./types";
3
3
  type __VLS_Props = {
4
4
  generalErrors: (Record<string, StandardSchemaV1Issue[]> | undefined)[];
5
5
  errors: OmegaError[];
@@ -1,6 +1,6 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import type { MergedInputProps } from "./InputProps";
3
- import type { BaseProps, DefaultTypeProps } from "./OmegaFormStuff";
3
+ import type { BaseProps, DefaultTypeProps } from "./types";
4
4
  declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__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<{
5
5
  props: import("vue").PublicProps & __VLS_PrettifyLocal<BaseProps<From, Name> & DefaultTypeProps> & (typeof globalThis extends {
6
6
  __VLS_PROPS_FALLBACK: infer P;
@@ -1,5 +1,5 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
- import { type OmegaInputPropsBase } from "./OmegaFormStuff";
2
+ import { type OmegaInputPropsBase } from "./types";
3
3
  declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__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
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<OmegaInputPropsBase<From, To, Name>> & (typeof globalThis extends {
5
5
  __VLS_PROPS_FALLBACK: infer P;
@@ -1,7 +1,8 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { type ComputedRef } from "vue";
3
3
  import type { OmegaFieldInternalApi } from "./InputProps";
4
- import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
4
+ import type { MetaRecord, NestedKeyOf } from "./meta/types";
5
+ import type { FieldValidators, TypeOverride } from "./types";
5
6
  declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__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<{
6
7
  props: import("vue").PublicProps & __VLS_PrettifyLocal<{
7
8
  field: OmegaFieldInternalApi<From, Name>;
@@ -1,4 +1,4 @@
1
- import { type DefaultTypeProps, type OmegaFormState } from "./OmegaFormStuff";
1
+ import { type DefaultTypeProps, type OmegaFormState } from "./types";
2
2
  import { type OmegaFormReturn } from "./useOmegaForm";
3
3
  declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof OmegaFormState<From, To> = keyof OmegaFormState<From, To>, Props = DefaultTypeProps>(__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
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<{
@@ -1,4 +1,4 @@
1
1
  import { type Component } from "vue";
2
- import { type DefaultTypeProps } from "./OmegaFormStuff";
2
+ import { type DefaultTypeProps } from "./types";
3
3
  import { useOmegaForm } from "./useOmegaForm";
4
- export declare const createUseFormWithCustomInput: <TypeProps = DefaultTypeProps>(CustomInputComponent: Component) => <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(...args: Parameters<typeof useOmegaForm<From, To>>) => import("./useOmegaForm").OmegaFormReturn<From, To, TypeProps>;
4
+ export declare const createUseFormWithCustomInput: <TypeProps = DefaultTypeProps>(CustomInputComponent: Component) => <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(...args: Parameters<typeof useOmegaForm<From, To>>) => import("./types").OmegaFormReturn<From, To, TypeProps>;
@@ -0,0 +1,33 @@
1
+ import { type Component, type ComputedRef, type ConcreteComponent, type Ref } from "vue";
2
+ import type { OF } from "./useOmegaForm";
3
+ export declare const useErrorLabel: (form: OF<any, any>) => (propsName: string) => string;
4
+ export declare const eHoc: (errorProps: {
5
+ form: OF<any, any>;
6
+ fieldMap: Ref<Map<string, {
7
+ id: string;
8
+ label: string;
9
+ }>>;
10
+ }) => <P>(WrappedComponent: Component<P>) => ConcreteComponent<P>;
11
+ export declare const makeFieldMap: () => {
12
+ fieldMap: Ref<Map<string, {
13
+ label: string;
14
+ id: string;
15
+ }> & Omit<Map<string, {
16
+ label: string;
17
+ id: string;
18
+ }>, keyof Map<any, any>>, Map<string, {
19
+ label: string;
20
+ id: string;
21
+ }> | (Map<string, {
22
+ label: string;
23
+ id: string;
24
+ }> & Omit<Map<string, {
25
+ label: string;
26
+ id: string;
27
+ }>, keyof Map<any, any>>)>;
28
+ registerField: (field: ComputedRef<{
29
+ name: string;
30
+ label: string;
31
+ id: string;
32
+ }>) => void;
33
+ };
@@ -1,3 +1,3 @@
1
1
  import { type Ref } from "vue";
2
- import type { OmegaFormApi, OmegaFormState } from "./OmegaFormStuff";
2
+ import type { OmegaFormApi, OmegaFormState } from "./types";
3
3
  export declare function getOmegaStore<To, From, K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>>(form: OmegaFormApi<To, From>, subscribe?: K[]): Ref<K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<To, From>, K>>;
@@ -0,0 +1,3 @@
1
+ import { type Component, type ConcreteComponent } from "vue";
2
+ import type { OF } from "./useOmegaForm";
3
+ export declare const fHoc: (form: OF<any, any>) => <P>(WrappedComponent: Component<P>) => ConcreteComponent<P>;
@@ -1,10 +1,20 @@
1
- export * from "./OmegaFormStuff";
2
- export { type OmegaConfig, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm";
1
+ import type { S } from "effect-app";
2
+ export { getInputType, type SupportedInputs } from "./inputs";
3
+ export { createMeta, generateMetaFromSchema, isNullableOrUndefined, metadataFromAst } from "./meta/createMeta";
4
+ export type { CreateMeta, FilterItems } from "./meta/createMeta";
5
+ export { defaultsValueFromSchema } from "./meta/defaults";
6
+ export { toFormSchema } from "./meta/redacted";
7
+ export type { BaseFieldMeta, BooleanFieldMeta, DateFieldMeta, FieldMeta, MetaRecord, MultipleFieldMeta, NestedKeyOf, NumberFieldMeta, SelectFieldMeta, StringFieldMeta, UnknownFieldMeta } from "./meta/types";
8
+ export { deepMerge } from "./persistency";
9
+ export type { BaseProps, DefaultTypeProps, FieldPath, FieldPath_, FieldValidators, FormComponent, FormProps, FormType, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, OmegaFormApi, OmegaFormParams, OmegaFormState, OmegaInputProps, OmegaInputPropsBase, PrefixFromDepth, TypeOverride, TypesWithOptions } from "./types";
10
+ export { makeStandardSchemaV1Hooks, toLocalizedStandardSchemaV1 } from "./validation/localized";
11
+ export { FormErrors, OmegaFormKey, useErrorLabel, useOmegaForm } from "./useOmegaForm";
12
+ export type { defaultValuesPriorityUnion, OF, OmegaConfig, OmegaFormReturn, Policies } from "./useOmegaForm";
3
13
  export { type ExtractTagValue, type ExtractUnionBranch, type InputProps, type MergedInputProps, type TaggedUnionOption, type TaggedUnionOptionsArray, type TaggedUnionProps } from "./InputProps";
4
14
  export { default as OmegaInput } from "./OmegaInput.vue";
5
15
  export { default as OmegaVuetifyInput } from "./OmegaInternalInput.vue";
6
16
  export { default as OmegaTaggedUnion } from "./OmegaTaggedUnion.vue";
7
17
  export { default as OmegaTaggedUnionInternal } from "./OmegaTaggedUnionInternal.vue";
8
18
  export { useOnClose, usePreventClose } from "./blockDialog";
9
- export { getInputType } from "./OmegaFormStuff";
10
19
  export { createUseFormWithCustomInput } from "./createUseFormWithCustomInput";
20
+ export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never, never>;
@@ -0,0 +1,4 @@
1
+ declare const supportedInputs: readonly ["button", "checkbox", "color", "date", "email", "number", "password", "radio", "range", "search", "submit", "tel", "text", "time", "url"];
2
+ export type SupportedInputs = typeof supportedInputs[number];
3
+ export declare const getInputType: (input: string) => SupportedInputs;
4
+ export {};
@@ -0,0 +1,4 @@
1
+ import { S } from "effect-app";
2
+ import type { FieldMeta } from "./types";
3
+ export declare const getCheckMetas: (property: S.AST.AST) => Array<Record<string, any>>;
4
+ export declare const getFieldMetadataFromAst: (property: S.AST.AST) => Partial<FieldMeta> & Record<string, unknown>;
@@ -0,0 +1,32 @@
1
+ import { type Effect, S } from "effect-app";
2
+ import type { FieldMeta, MetaRecord } from "./types";
3
+ export type FilterItems = {
4
+ items: readonly [string, ...string[]];
5
+ message: string | Effect.Effect<string, never, never> | {
6
+ readonly message: string | Effect.Effect<string>;
7
+ };
8
+ };
9
+ export type CreateMeta = {
10
+ parent?: string;
11
+ meta?: Record<string, any>;
12
+ nullableOrUndefined?: false | "undefined" | "null";
13
+ } & ({
14
+ propertySignatures: readonly S.AST.PropertySignature[];
15
+ property?: never;
16
+ } | {
17
+ propertySignatures?: never;
18
+ property: S.AST.AST;
19
+ });
20
+ export declare const unwrapDeclaration: (property: S.AST.AST) => S.AST.AST;
21
+ export declare const isNullableOrUndefined: (property: false | S.AST.AST | undefined) => false | "undefined" | "null";
22
+ export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
23
+ export declare const metadataFromAst: <From, To>(schema: S.Codec<To, From, never>) => {
24
+ meta: MetaRecord<To>;
25
+ defaultValues: Record<string, any>;
26
+ unionMeta: Record<string, MetaRecord<To>>;
27
+ };
28
+ export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From, never>) => {
29
+ schema: S.Codec<To, From, never>;
30
+ meta: MetaRecord<To>;
31
+ unionMeta: Record<string, MetaRecord<To>>;
32
+ };
@@ -0,0 +1,2 @@
1
+ import { S } from "effect-app";
2
+ export declare const defaultsValueFromSchema: (schema: S.Schema<any>, record?: Record<string, any>) => any;
@@ -0,0 +1,2 @@
1
+ import { S } from "effect-app";
2
+ export declare const toFormSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never>;
@@ -0,0 +1,56 @@
1
+ import type { DeepKeys } from "@tanstack/vue-form";
2
+ import type { S } from "effect-app";
3
+ import type { Redacted } from "effect/Redacted";
4
+ type StripRedacted<T> = T extends Redacted<any> ? string : T extends ReadonlyArray<infer U> ? ReadonlyArray<StripRedacted<U>> : T extends Record<string, any> ? {
5
+ [K in keyof T]: StripRedacted<T[K]>;
6
+ } : T;
7
+ export type NestedKeyOf<T> = DeepKeys<StripRedacted<T>>;
8
+ export type BaseFieldMeta = {
9
+ required: boolean;
10
+ nullableOrUndefined?: false | "undefined" | "null";
11
+ /**
12
+ * True when the schema property is `S.optionalKey` (AST
13
+ * `context.isOptional`) — i.e. the key should be ABSENT from the submitted
14
+ * object when empty, not present with `undefined`. Distinct from
15
+ * `required: false`, which may also mean "empty string is valid" for
16
+ * unconstrained `S.String` fields.
17
+ */
18
+ isOptionalKey?: boolean;
19
+ };
20
+ export type StringFieldMeta = BaseFieldMeta & {
21
+ type: "string";
22
+ maxLength?: number;
23
+ minLength?: number;
24
+ format?: string;
25
+ };
26
+ export type NumberFieldMeta = BaseFieldMeta & {
27
+ type: "number";
28
+ minimum?: number;
29
+ maximum?: number;
30
+ exclusiveMinimum?: number;
31
+ exclusiveMaximum?: number;
32
+ refinement?: "int";
33
+ };
34
+ export type SelectFieldMeta = BaseFieldMeta & {
35
+ type: "select";
36
+ members: any[];
37
+ };
38
+ export type MultipleFieldMeta = BaseFieldMeta & {
39
+ type: "multiple";
40
+ members: any[];
41
+ rest: readonly S.AST.AST[];
42
+ };
43
+ export type BooleanFieldMeta = BaseFieldMeta & {
44
+ type: "boolean";
45
+ };
46
+ export type DateFieldMeta = BaseFieldMeta & {
47
+ type: "date";
48
+ };
49
+ export type UnknownFieldMeta = BaseFieldMeta & {
50
+ type: "unknown";
51
+ };
52
+ export type FieldMeta = StringFieldMeta | NumberFieldMeta | SelectFieldMeta | MultipleFieldMeta | BooleanFieldMeta | DateFieldMeta | UnknownFieldMeta;
53
+ export type MetaRecord<T = string> = {
54
+ [K in NestedKeyOf<T>]?: FieldMeta;
55
+ };
56
+ export {};
@@ -0,0 +1,18 @@
1
+ import { S } from "effect-app";
2
+ import type { FieldMeta, MetaRecord } from "./types";
3
+ export type WalkerContext<T> = {
4
+ acc: Partial<MetaRecord<T>>;
5
+ unionMeta: Record<string, MetaRecord<T>>;
6
+ };
7
+ export type ParentMeta = {
8
+ required: boolean;
9
+ nullableOrUndefined: false | "null" | "undefined";
10
+ /** Set when iterating the members of a nullable discriminated union */
11
+ isNullableDiscriminatedUnion?: boolean;
12
+ /** Set when this property was declared with S.optionalKey */
13
+ isOptionalKey?: boolean;
14
+ };
15
+ export declare const leafMetaForAst: (ast: S.AST.AST, parentMeta: ParentMeta) => FieldMeta;
16
+ export declare const walkStruct: <T>(propertySignatures: readonly S.AST.PropertySignature[], parent: string, parentMeta: ParentMeta, ctx: WalkerContext<T>) => void;
17
+ export declare const classifyAndWalkUnion: <T>(unionAst: S.AST.Union, key: string, parentMeta: ParentMeta, ctx: WalkerContext<T>) => void;
18
+ export declare const walk: <T>(ast: S.AST.AST, key: string, parentMeta: ParentMeta, ctx: WalkerContext<T>) => void;
@@ -0,0 +1,58 @@
1
+ import { type ComputedRef } from "vue";
2
+ import { type MetaRecord } from "./meta/types";
3
+ export type Policies = "local" | "session" | "querystring";
4
+ export type DefaultValuesPriorityUnion = "tanstack" | "persistency" | "schema";
5
+ export type defaultValuesPriorityUnion = DefaultValuesPriorityUnion;
6
+ export interface PersistencyConfig {
7
+ /** Order of importance:
8
+ * - "querystring": Highest priority when persisting
9
+ * - "local" and then "session": Lower priority storage options
10
+ */
11
+ policies?: ReadonlyArray<Policies>;
12
+ overrideDefaultValues?: "deprecated: use defaultValuesPriority";
13
+ id?: string;
14
+ keys?: ReadonlyArray<string> | "You should only use one of banKeys or keys, not both, moron";
15
+ banKeys?: ReadonlyArray<string> | "You should only use one of banKeys or keys, not both, moron";
16
+ }
17
+ export declare function deepMerge(target: any, source: any): any;
18
+ export interface UsePersistencyOptions<From> {
19
+ meta: MetaRecord<From>;
20
+ persistency?: PersistencyConfig;
21
+ preventWindowExit?: "prevent" | "prevent-and-reset" | "nope";
22
+ defaultValuesPriority?: DefaultValuesPriorityUnion[] | readonly DefaultValuesPriorityUnion[];
23
+ /** Tanstack-provided default values (highest priority by default). */
24
+ tanstackDefaultValues?: any;
25
+ /** Lazy schema-derived defaults factory. */
26
+ schemaDefaultValues: () => any;
27
+ /**
28
+ * Lazy accessor for the form. Lazy because persistency is created BEFORE
29
+ * the form (its `defaultValues` are passed into `useForm`), but the
30
+ * persistence callbacks (`persistData`, `saveDataInUrl`, the
31
+ * `beforeunload` listener) only run later and need the live form.
32
+ */
33
+ getForm: () => {
34
+ store: {
35
+ state: {
36
+ values: any;
37
+ isDirty: boolean;
38
+ };
39
+ };
40
+ getFieldValue: (path: any) => any;
41
+ };
42
+ }
43
+ export interface UsePersistencyReturn {
44
+ defaultValues: ComputedRef<any>;
45
+ persistencyKey: ComputedRef<string>;
46
+ persistData: () => void;
47
+ saveDataInUrl: () => void;
48
+ clearUrlParams: () => void;
49
+ }
50
+ /**
51
+ * Encapsulates form-data persistency: loading default values from
52
+ * localStorage / sessionStorage / querystring, persisting them on unmount
53
+ * or window blur, and the optional `preventWindowExit` warning listener.
54
+ *
55
+ * The `prevent-and-reset` reset-on-success behavior is intentionally NOT
56
+ * owned here — the consumer wires that to its own form submit lifecycle.
57
+ */
58
+ export declare const usePersistency: <From>(opts: UsePersistencyOptions<From>) => UsePersistencyReturn;
@@ -0,0 +1,60 @@
1
+ import * as api from "@opentelemetry/api";
2
+ import type { DeepKeys, StandardSchemaV1Issue, ValidationError, ValidationErrorMap } from "@tanstack/vue-form";
3
+ import { Effect } from "effect-app";
4
+ import type { Fiber as EffectFiber } from "effect/Fiber";
5
+ import type { OmegaFormApi, OmegaFormParams } from "./types";
6
+ declare const FormErrors_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
7
+ readonly _tag: "FormErrors";
8
+ } & Readonly<A>;
9
+ export declare class FormErrors<From> extends FormErrors_base<{
10
+ form: {
11
+ errors: (Record<string, StandardSchemaV1Issue[]> | undefined)[];
12
+ errorMap: ValidationErrorMap<undefined, undefined, Record<string, StandardSchemaV1Issue[]>, undefined, undefined, undefined, undefined, undefined, undefined, undefined>;
13
+ };
14
+ fields: Record<DeepKeys<From>, {
15
+ errors: ValidationError[];
16
+ errorMap: ValidationErrorMap;
17
+ }>;
18
+ }> {
19
+ }
20
+ export declare const wrapWithSpan: (span: api.Span | undefined, toWrap: () => any) => any;
21
+ export type UserOnSubmit<From, To> = (props: {
22
+ formApi: OmegaFormParams<From, To>;
23
+ meta: any;
24
+ value: To;
25
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>;
26
+ export type RunPromise = <A, E>(eff: Effect.Effect<A, E, never>) => Promise<A>;
27
+ /**
28
+ * Wraps the user's `onSubmit` to:
29
+ * - run inside the OpenTelemetry span passed via `meta.currentSpan`
30
+ * - decode the raw form `value` (validators only validate, they don't transform)
31
+ * - normalize Promise / Effect / Fiber return values to a Promise
32
+ *
33
+ * Returns `undefined` when `userOnSubmit` is `undefined` (so callers can pass it
34
+ * directly to `useForm({ onSubmit })` without changing semantics).
35
+ */
36
+ export declare const wrapOnSubmit: <From, To>(userOnSubmit: UserOnSubmit<From, To> | undefined, decode: (value: From) => Effect.Effect<To, any, never>, runPromise: RunPromise) => (({ formApi, meta, value }: {
37
+ formApi: OmegaFormParams<From, To>;
38
+ meta: any;
39
+ value: From;
40
+ }) => any) | undefined;
41
+ /**
42
+ * Builds the public submit handlers from a `useForm`-returned `form`:
43
+ * - `handleSubmit` injects the current OpenTelemetry span as `meta.currentSpan`.
44
+ * - `handleSubmitEffect` runs `handleSubmit` inside an Effect that picks up the
45
+ * ambient `Effect.currentSpan`. With `checkErrors: true`, it fails with
46
+ * `FormErrors<From>` when validation produced errors.
47
+ */
48
+ export declare const makeSubmitHandlers: <From, To>(form: OmegaFormApi<From, To>) => {
49
+ handleSubmit: (meta?: Record<string, any>) => Promise<void>;
50
+ handleSubmitEffect: {
51
+ (options: {
52
+ checkErrors: true;
53
+ meta?: Record<string, any>;
54
+ }): Effect.Effect<void, FormErrors<From>>;
55
+ (options?: {
56
+ meta?: Record<string, any>;
57
+ }): Effect.Effect<void>;
58
+ };
59
+ };
60
+ export {};