@effect-app/vue-components 4.0.0-beta.26 → 4.0.0-beta.261

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 (198) hide show
  1. package/README.md +13 -9
  2. package/dist/reset.css +39 -38
  3. package/dist/types/components/CommandButton.vue.d.ts +24 -5
  4. package/dist/types/components/OmegaForm/InputProps.d.ts +1 -1
  5. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
  6. package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +2 -2
  7. package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +1 -1
  8. package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
  9. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -1
  10. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -1
  11. package/dist/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +2 -2
  12. package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +3 -3
  13. package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
  14. package/dist/types/components/OmegaForm/createUseFormWithCustomInput.d.ts +2 -2
  15. package/dist/types/components/OmegaForm/errors.d.ts +33 -0
  16. package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
  17. package/dist/types/components/OmegaForm/hocs.d.ts +3 -0
  18. package/dist/types/components/OmegaForm/index.d.ts +13 -3
  19. package/dist/types/components/OmegaForm/inputs.d.ts +4 -0
  20. package/dist/types/components/OmegaForm/meta/checks.d.ts +4 -0
  21. package/dist/types/components/OmegaForm/meta/createMeta.d.ts +33 -0
  22. package/dist/types/components/OmegaForm/meta/defaults.d.ts +21 -0
  23. package/dist/types/components/OmegaForm/meta/redacted.d.ts +2 -0
  24. package/dist/types/components/OmegaForm/meta/types.d.ts +56 -0
  25. package/dist/types/components/OmegaForm/meta/walker.d.ts +18 -0
  26. package/dist/types/components/OmegaForm/persistency.d.ts +58 -0
  27. package/dist/types/components/OmegaForm/submit.d.ts +60 -0
  28. package/dist/types/components/OmegaForm/types.d.ts +289 -0
  29. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +7 -213
  30. package/dist/types/components/OmegaForm/validation/localized.d.ts +10 -0
  31. package/dist/types/index.d.ts +0 -1
  32. package/dist/types/utils/index.d.ts +8 -8
  33. package/dist/vue-components.es.js +29 -44
  34. package/dist/vue-components10.es.js +5 -0
  35. package/dist/vue-components11.es.js +20 -0
  36. package/dist/vue-components12.es.js +49 -0
  37. package/dist/vue-components13.es.js +128 -0
  38. package/dist/vue-components14.es.js +65 -0
  39. package/dist/vue-components15.es.js +114 -0
  40. package/dist/vue-components16.es.js +22 -0
  41. package/dist/vue-components17.es.js +5 -0
  42. package/dist/vue-components18.es.js +80 -0
  43. package/dist/vue-components19.es.js +93 -0
  44. package/dist/vue-components2.es.js +11 -0
  45. package/dist/vue-components20.es.js +73 -0
  46. package/dist/vue-components21.es.js +12 -0
  47. package/dist/vue-components22.es.js +56 -0
  48. package/dist/vue-components23.es.js +5 -0
  49. package/dist/vue-components24.es.js +44 -0
  50. package/dist/vue-components25.es.js +5 -0
  51. package/dist/vue-components26.es.js +84 -0
  52. package/dist/vue-components28.es.js +8 -0
  53. package/dist/vue-components29.es.js +9 -0
  54. package/dist/vue-components3.es.js +98 -0
  55. package/dist/vue-components30.es.js +269 -0
  56. package/dist/vue-components32.es.js +8 -0
  57. package/dist/vue-components33.es.js +73 -0
  58. package/dist/vue-components34.es.js +5 -0
  59. package/dist/vue-components35.es.js +52 -0
  60. package/dist/vue-components36.es.js +5 -0
  61. package/dist/vue-components37.es.js +24 -0
  62. package/dist/vue-components38.es.js +5 -0
  63. package/dist/vue-components39.es.js +59 -0
  64. package/dist/vue-components4.es.js +5 -0
  65. package/dist/vue-components40.es.js +5 -0
  66. package/dist/vue-components41.es.js +12 -0
  67. package/dist/vue-components42.es.js +22 -0
  68. package/dist/vue-components44.es.js +9 -0
  69. package/dist/vue-components45.es.js +4 -0
  70. package/dist/vue-components46.es.js +38 -0
  71. package/dist/vue-components47.es.js +27 -0
  72. package/dist/vue-components48.es.js +28 -0
  73. package/dist/vue-components49.es.js +7 -0
  74. package/dist/vue-components5.es.js +24 -0
  75. package/dist/vue-components50.es.js +18 -0
  76. package/dist/vue-components51.es.js +36 -0
  77. package/dist/vue-components52.es.js +18 -0
  78. package/dist/vue-components53.es.js +21 -0
  79. package/dist/vue-components54.es.js +30 -0
  80. package/dist/vue-components55.es.js +7 -0
  81. package/dist/vue-components56.es.js +9 -0
  82. package/dist/vue-components57.es.js +38 -0
  83. package/dist/vue-components58.es.js +25 -0
  84. package/dist/vue-components59.es.js +128 -0
  85. package/dist/vue-components6.es.js +13 -0
  86. package/dist/vue-components60.es.js +24 -0
  87. package/dist/vue-components61.es.js +21 -0
  88. package/dist/vue-components62.es.js +9 -0
  89. package/dist/vue-components63.es.js +19 -0
  90. package/dist/vue-components64.es.js +5 -0
  91. package/dist/vue-components65.es.js +29 -0
  92. package/dist/vue-components66.es.js +5 -0
  93. package/dist/vue-components67.es.js +43 -0
  94. package/dist/vue-components68.es.js +100 -0
  95. package/dist/vue-components69.es.js +33 -0
  96. package/dist/vue-components7.es.js +13 -0
  97. package/dist/vue-components70.es.js +19 -0
  98. package/dist/vue-components71.es.js +48 -0
  99. package/dist/vue-components8.es.js +35 -0
  100. package/dist/vue-components9.es.js +47 -0
  101. package/package.json +30 -30
  102. package/src/components/CommandButton.vue +96 -16
  103. package/src/components/OmegaForm/InputProps.ts +1 -1
  104. package/src/components/OmegaForm/OmegaArray.vue +8 -9
  105. package/src/components/OmegaForm/OmegaAutoGen.vue +3 -2
  106. package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -1
  107. package/src/components/OmegaForm/OmegaFormInput.vue +1 -1
  108. package/src/components/OmegaForm/OmegaInput.vue +15 -38
  109. package/src/components/OmegaForm/OmegaInputVuetify.vue +5 -2
  110. package/src/components/OmegaForm/OmegaInternalInput.vue +17 -5
  111. package/src/components/OmegaForm/OmegaTaggedUnion.vue +10 -3
  112. package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +6 -6
  113. package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
  114. package/src/components/OmegaForm/blockDialog.ts +18 -6
  115. package/src/components/OmegaForm/createUseFormWithCustomInput.ts +2 -1
  116. package/src/components/OmegaForm/errors.ts +136 -0
  117. package/src/components/OmegaForm/getOmegaStore.ts +1 -1
  118. package/src/components/OmegaForm/hocs.ts +19 -0
  119. package/src/components/OmegaForm/index.ts +16 -4
  120. package/src/components/OmegaForm/inputs.ts +22 -0
  121. package/src/components/OmegaForm/meta/checks.ts +82 -0
  122. package/src/components/OmegaForm/meta/createMeta.ts +140 -0
  123. package/src/components/OmegaForm/meta/defaults.ts +261 -0
  124. package/src/components/OmegaForm/meta/redacted.ts +66 -0
  125. package/src/components/OmegaForm/meta/types.ts +78 -0
  126. package/src/components/OmegaForm/meta/walker.ts +248 -0
  127. package/src/components/OmegaForm/persistency.ts +247 -0
  128. package/src/components/OmegaForm/submit.ts +131 -0
  129. package/src/components/OmegaForm/types.ts +759 -0
  130. package/src/components/OmegaForm/useOmegaForm.ts +99 -893
  131. package/src/components/OmegaForm/useRegisterField.ts +1 -1
  132. package/src/components/OmegaForm/validation/localized.ts +203 -0
  133. package/src/index.ts +0 -1
  134. package/src/reset.css +39 -38
  135. package/src/utils/index.ts +11 -8
  136. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -159
  137. package/dist/types/constants/index.d.ts +0 -1
  138. package/dist/vue-components.es10.js +0 -239
  139. package/dist/vue-components.es11.js +0 -32
  140. package/dist/vue-components.es12.js +0 -503
  141. package/dist/vue-components.es13.js +0 -49
  142. package/dist/vue-components.es14.js +0 -4
  143. package/dist/vue-components.es15.js +0 -4
  144. package/dist/vue-components.es16.js +0 -6
  145. package/dist/vue-components.es17.js +0 -13
  146. package/dist/vue-components.es18.js +0 -57
  147. package/dist/vue-components.es19.js +0 -56
  148. package/dist/vue-components.es2.js +0 -30
  149. package/dist/vue-components.es20.js +0 -8
  150. package/dist/vue-components.es21.js +0 -8
  151. package/dist/vue-components.es22.js +0 -5
  152. package/dist/vue-components.es23.js +0 -5
  153. package/dist/vue-components.es24.js +0 -4
  154. package/dist/vue-components.es25.js +0 -4
  155. package/dist/vue-components.es26.js +0 -4
  156. package/dist/vue-components.es27.js +0 -4
  157. package/dist/vue-components.es28.js +0 -19
  158. package/dist/vue-components.es29.js +0 -13
  159. package/dist/vue-components.es3.js +0 -17
  160. package/dist/vue-components.es30.js +0 -194
  161. package/dist/vue-components.es32.js +0 -31
  162. package/dist/vue-components.es33.js +0 -6
  163. package/dist/vue-components.es34.js +0 -4
  164. package/dist/vue-components.es35.js +0 -4
  165. package/dist/vue-components.es36.js +0 -113
  166. package/dist/vue-components.es38.js +0 -9
  167. package/dist/vue-components.es39.js +0 -34
  168. package/dist/vue-components.es4.js +0 -52
  169. package/dist/vue-components.es41.js +0 -6
  170. package/dist/vue-components.es42.js +0 -25
  171. package/dist/vue-components.es43.js +0 -7
  172. package/dist/vue-components.es44.js +0 -23
  173. package/dist/vue-components.es45.js +0 -32
  174. package/dist/vue-components.es46.js +0 -24
  175. package/dist/vue-components.es47.js +0 -14
  176. package/dist/vue-components.es48.js +0 -7
  177. package/dist/vue-components.es49.js +0 -21
  178. package/dist/vue-components.es5.js +0 -52
  179. package/dist/vue-components.es50.js +0 -11
  180. package/dist/vue-components.es51.js +0 -33
  181. package/dist/vue-components.es52.js +0 -50
  182. package/dist/vue-components.es53.js +0 -28
  183. package/dist/vue-components.es54.js +0 -13
  184. package/dist/vue-components.es55.js +0 -67
  185. package/dist/vue-components.es56.js +0 -58
  186. package/dist/vue-components.es57.js +0 -19
  187. package/dist/vue-components.es58.js +0 -35
  188. package/dist/vue-components.es59.js +0 -31
  189. package/dist/vue-components.es6.js +0 -69
  190. package/dist/vue-components.es60.js +0 -44
  191. package/dist/vue-components.es61.js +0 -4
  192. package/dist/vue-components.es62.js +0 -46
  193. package/dist/vue-components.es63.js +0 -4
  194. package/dist/vue-components.es7.js +0 -83
  195. package/dist/vue-components.es8.js +0 -63
  196. package/dist/vue-components.es9.js +0 -21
  197. package/src/components/OmegaForm/OmegaFormStuff.ts +0 -1276
  198. package/src/constants/index.ts +0 -1
@@ -0,0 +1,759 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import type { DeepKeys, DeepValue, FieldApi, FieldAsyncValidateOrFn, FieldState, FieldValidateOrFn, FormApi, FormAsyncValidateOrFn, FormOptions, FormState, FormValidateOrFn, StandardSchemaV1, VueFormApi } from "@tanstack/vue-form"
3
+ import type * as Effect from "effect-app/Effect"
4
+ import type * as S from "effect-app/Schema"
5
+ import type { UnionToTuples } from "effect-app/utils"
6
+ import type { Fiber as EffectFiber } from "effect/Fiber"
7
+ import type * as Order from "effect/Order"
8
+ import type { Redacted } from "effect/Redacted"
9
+ import type { AllowedComponentProps, ComponentCustomProps, ComputedRef, PublicProps, ShallowUnwrapRef, VNode, VNodeProps } from "vue"
10
+ import type { MergedInputProps, OmegaFieldInternalApi, TaggedUnionOptionsArray } from "./InputProps"
11
+ import type { MetaRecord, NestedKeyOf } from "./meta/types"
12
+ import type { defaultValuesPriorityUnion as PersistencyPriority, Policies as PersistencyPolicies } from "./persistency"
13
+ import type { FormErrors } from "./submit"
14
+
15
+ export type FieldPath<T> = unknown extends T ? string
16
+ // technically we cannot have primitive at the root
17
+ : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? ""
18
+ // technically we cannot have array at the root
19
+ : T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`>
20
+ : {
21
+ [K in keyof T]: FieldPath_<T[K], K & string>
22
+ }[keyof T]
23
+
24
+ export type FieldPath_<T, Path extends string> = unknown extends T ? string
25
+ : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? Path
26
+ : T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path
27
+ : {
28
+ [K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>
29
+ }[keyof T]
30
+
31
+ export type BaseProps<From, TName extends FieldPath<From>> = {
32
+ /**
33
+ * Will fallback to i18n when not specified.
34
+ * Can also be provided via #label slot for custom HTML labels.
35
+ * When using the slot, it receives bindings: { required, id, label }
36
+ */
37
+ label?: string
38
+ validators?: FieldValidators<From>
39
+ // Use FlexibleArrayPath: if name contains [], just use TName; otherwise intersect with Leaves<From>
40
+ name: TName
41
+ /**
42
+ * Optional class to apply to the input element.
43
+ * - If a string is provided, it will be used instead of the general class
44
+ * - If null is provided, no class will be applied (neither inputClass nor general class)
45
+ * - If undefined (not provided), the general class will be used
46
+ */
47
+ inputClass?: string | null
48
+ }
49
+
50
+ export type TypesWithOptions = "radio" | "select" | "multiple" | "autocomplete" | "autocompletemultiple"
51
+ export type DefaultTypeProps = {
52
+ type?: TypeOverride
53
+ options?: undefined
54
+ } | {
55
+ type?: TypesWithOptions
56
+ // TODO: options should depend on `type`, but since there is auto-type, we can't currently enforce it.
57
+ // hence we allow it also for type? (undefined) atm
58
+ options?: {
59
+ title: string
60
+ value: unknown
61
+ }[]
62
+ }
63
+
64
+ export type OmegaInputPropsBase<
65
+ From extends Record<PropertyKey, any>,
66
+ To extends Record<PropertyKey, any>,
67
+ Name extends DeepKeys<From>
68
+ > = {
69
+ form: OF<From, To> & {
70
+ meta: MetaRecord<From>
71
+ i18nNamespace?: string
72
+ }
73
+ } & BaseProps<From, Name>
74
+
75
+ export type OmegaInputProps<
76
+ From extends Record<PropertyKey, any>,
77
+ To extends Record<PropertyKey, any>,
78
+ Name extends DeepKeys<From>,
79
+ TypeProps = DefaultTypeProps
80
+ > = {
81
+ form: OmegaFormReturn<From, To, TypeProps> & {
82
+ meta: MetaRecord<From>
83
+ i18nNamespace?: string
84
+ }
85
+ } & BaseProps<From, Name>
86
+
87
+ export type OmegaArrayProps<
88
+ From extends Record<PropertyKey, any>,
89
+ To extends Record<PropertyKey, any>,
90
+ Name extends DeepKeys<From>
91
+ > =
92
+ & Omit<
93
+ OmegaInputProps<From, To, Name>,
94
+ "validators" | "options" | "label" | "type" | "items" | "name"
95
+ >
96
+ & {
97
+ name: DeepKeys<From>
98
+ defaultItems?: DeepValue<From, DeepKeys<From>>
99
+ // deprecated items, caused bugs in state update, use defaultItems instead. It's not a simple Never, because Volar explodes
100
+ items?: "please use `defaultItems` instead"
101
+ }
102
+
103
+ export type TypeOverride =
104
+ | "string"
105
+ | "text"
106
+ | "number"
107
+ | "select"
108
+ | "multiple"
109
+ | "boolean"
110
+ | "radio"
111
+ | "autocomplete"
112
+ | "autocompletemultiple"
113
+ | "switch"
114
+ | "range"
115
+ | "password"
116
+ | "email"
117
+ | "date"
118
+
119
+ export interface OmegaError {
120
+ label: string
121
+ inputId: string
122
+ errors: readonly string[]
123
+ }
124
+
125
+ export type FormProps<From, To> =
126
+ & Omit<
127
+ FormOptions<
128
+ From,
129
+ FormValidateOrFn<From> | undefined,
130
+ FormValidateOrFn<From> | undefined,
131
+ StandardSchemaV1<From, To>,
132
+ FormValidateOrFn<From> | undefined,
133
+ FormAsyncValidateOrFn<From> | undefined,
134
+ FormValidateOrFn<From> | undefined,
135
+ FormAsyncValidateOrFn<From> | undefined,
136
+ FormValidateOrFn<From> | undefined,
137
+ FormAsyncValidateOrFn<From> | undefined,
138
+ FormAsyncValidateOrFn<From> | undefined,
139
+ Record<string, any> | undefined // TODO
140
+ >,
141
+ | "onSubmit"
142
+ | "defaultValues"
143
+ >
144
+ & {
145
+ // when defaultValues are allowed to be undefined, then they should also be allowed to be partial
146
+ // this fixes validator issues where a defaultValue of "" leads to "requires at least 1 character", while manually emptying the field changes it to "is required"
147
+ defaultValues?: Partial<From>
148
+ onSubmit?: (props: {
149
+ formApi: OmegaFormParams<From, To>
150
+ meta: any
151
+ value: To
152
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any>
153
+ }
154
+
155
+ export type OmegaFormParams<From, To> = FormApi<
156
+ From,
157
+ FormValidateOrFn<From> | undefined,
158
+ FormValidateOrFn<From> | undefined,
159
+ StandardSchemaV1<From, To>,
160
+ FormValidateOrFn<From> | undefined,
161
+ FormAsyncValidateOrFn<From> | undefined,
162
+ FormValidateOrFn<From> | undefined,
163
+ FormAsyncValidateOrFn<From> | undefined,
164
+ FormValidateOrFn<From> | undefined,
165
+ FormAsyncValidateOrFn<From> | undefined,
166
+ FormAsyncValidateOrFn<From> | undefined,
167
+ Record<string, any> | undefined
168
+ >
169
+
170
+ export type OmegaFormState<From, To> = FormState<
171
+ From,
172
+ FormValidateOrFn<From> | undefined,
173
+ FormValidateOrFn<From> | undefined,
174
+ StandardSchemaV1<From, To>,
175
+ FormValidateOrFn<From> | undefined,
176
+ FormAsyncValidateOrFn<From> | undefined,
177
+ FormValidateOrFn<From> | undefined,
178
+ FormAsyncValidateOrFn<From> | undefined,
179
+ FormValidateOrFn<From> | undefined,
180
+ FormAsyncValidateOrFn<From> | undefined,
181
+ FormAsyncValidateOrFn<From> | undefined
182
+ >
183
+
184
+ // TODO: stitch TSubmitMeta somehow
185
+ export type OmegaFormApi<From, To, TSubmitMeta = Record<string, any> | undefined> =
186
+ & OmegaFormParams<From, To>
187
+ & VueFormApi<
188
+ From,
189
+ FormValidateOrFn<From> | undefined,
190
+ FormValidateOrFn<From> | undefined,
191
+ StandardSchemaV1<From, To>,
192
+ FormValidateOrFn<From> | undefined,
193
+ FormAsyncValidateOrFn<From> | undefined,
194
+ FormValidateOrFn<From> | undefined,
195
+ FormAsyncValidateOrFn<From> | undefined,
196
+ FormValidateOrFn<From> | undefined,
197
+ FormAsyncValidateOrFn<From> | undefined,
198
+ FormAsyncValidateOrFn<From> | undefined,
199
+ TSubmitMeta
200
+ >
201
+
202
+ export type FormComponent<T, S> = VueFormApi<
203
+ T,
204
+ FormValidateOrFn<T> | undefined,
205
+ FormValidateOrFn<T> | undefined,
206
+ StandardSchemaV1<T, S>,
207
+ FormValidateOrFn<T> | undefined,
208
+ FormAsyncValidateOrFn<T> | undefined,
209
+ FormValidateOrFn<T> | undefined,
210
+ FormAsyncValidateOrFn<T> | undefined,
211
+ FormValidateOrFn<T> | undefined,
212
+ FormAsyncValidateOrFn<T> | undefined,
213
+ FormAsyncValidateOrFn<T> | undefined,
214
+ Record<string, any> | undefined
215
+ >
216
+
217
+ export type FormType<
218
+ From extends Record<PropertyKey, any>,
219
+ To extends Record<PropertyKey, any>,
220
+ Name extends DeepKeys<From>
221
+ > = OmegaFormApi<From, To> & {
222
+ Field: OmegaFieldInternalApi<From, Name>
223
+ }
224
+
225
+ export type PrefixFromDepth<
226
+ K extends string | number,
227
+ _TDepth extends any[]
228
+ > = K
229
+
230
+ export type FieldValidators<T> = {
231
+ onChangeAsync?: FieldAsyncValidateOrFn<T, any, any>
232
+ onChange?: FieldValidateOrFn<T, any, any>
233
+ onBlur?: FieldValidateOrFn<T, any, any>
234
+ onBlurAsync?: FieldAsyncValidateOrFn<T, any, any>
235
+ }
236
+
237
+ export type OmegaAutoGenMeta<
238
+ From extends Record<PropertyKey, any>,
239
+ To extends Record<PropertyKey, any>,
240
+ Name extends DeepKeys<From>
241
+ > = Omit<OmegaInputProps<From, To, Name>, "form">
242
+
243
+ type keysRule<T> =
244
+ | {
245
+ keys?: NestedKeyOf<T>[]
246
+ banKeys?: "You should only use one of banKeys or keys, not both, moron"
247
+ }
248
+ | {
249
+ keys?: "You should only use one of banKeys or keys, not both, moron"
250
+ banKeys?: NestedKeyOf<T>[]
251
+ }
252
+
253
+ export type Policies = PersistencyPolicies
254
+ export type defaultValuesPriorityUnion = PersistencyPriority
255
+
256
+ export type OmegaConfig<T> = {
257
+ i18nNamespace?: string
258
+
259
+ persistency?: {
260
+ /** Order of importance:
261
+ * - "querystring": Highest priority when persisting
262
+ * - "local" and then "session": Lower priority storage options
263
+ */
264
+ policies?: UnionToTuples<Policies>
265
+ overrideDefaultValues?: "deprecated: use defaultValuesPriority"
266
+ id?: string
267
+ } & keysRule<T>
268
+
269
+ ignorePreventCloseEvents?: boolean
270
+
271
+ /**
272
+ * Prevents browser window/tab exit when form has unsaved changes.
273
+ * Shows native browser "Leave site?" dialog.
274
+ *
275
+ * @remarks
276
+ * - Opt-in only: Must explicitly enable
277
+ * - Independent from data persistence feature
278
+ */
279
+ preventWindowExit?: "prevent" | "prevent-and-reset" | "nope"
280
+
281
+ input?: any
282
+
283
+ /**
284
+ * Default values order is: Tanstack default values passed as second parameter to useOmegaForm, then persistency
285
+ * default values from querystring or local/session storage, then defaults from schema
286
+ * You can customize the order and with omegaConfig.defaultValuesPriority
287
+ * default value = ['tanstack', 'persistency', 'schema']
288
+ */
289
+ defaultValuesPriority?: UnionToTuples<defaultValuesPriorityUnion>
290
+
291
+ defaultFromSchema?: "deprecated: use defaultValuesPriority"
292
+ }
293
+
294
+ export interface OF<From, To> extends OmegaFormApi<From, To> {
295
+ meta: MetaRecord<From>
296
+ unionMeta: Record<string, MetaRecord<From>>
297
+ clear: () => void
298
+ /**
299
+ * Backfills the untouched children of any materialised nullable struct with
300
+ * their schema default (or `null`), so the live `values` matches what
301
+ * validation and decoding see. Called after a field change.
302
+ */
303
+ normalizeNullableStructs: () => void
304
+ i18nNamespace?: string
305
+ ignorePreventCloseEvents?: boolean
306
+ registerField: (
307
+ field: ComputedRef<{
308
+ name: string
309
+ label: string
310
+ id: string
311
+ }>
312
+ ) => void
313
+ /** @experimental */
314
+ handleSubmitEffect: {
315
+ /**
316
+ * when `checkErrors` is true, the Effect will fail with `FormErrors<From>` when there are validation errors
317
+ * @experimental */
318
+ (options: { checkErrors: true; meta?: Record<string, any> }): Effect.Effect<void, FormErrors<From>>
319
+ /** @experimental */
320
+ (options?: { meta?: Record<string, any> }): Effect.Effect<void>
321
+ }
322
+ }
323
+
324
+ type __VLS_PrettifyLocal<T> =
325
+ & {
326
+ [K in keyof T]: T[K]
327
+ }
328
+ & {}
329
+
330
+ // Type aliases for Array component slots - using cached types for performance
331
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
332
+ type CachedFieldApi<
333
+ From extends Record<PropertyKey, any>,
334
+ To extends Record<PropertyKey, any>,
335
+ TypeProps = DefaultTypeProps
336
+ > = FieldApi<
337
+ From,
338
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
339
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>,
340
+ | FieldValidateOrFn<
341
+ From,
342
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
343
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
344
+ >
345
+ | undefined,
346
+ | FieldValidateOrFn<
347
+ From,
348
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
349
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
350
+ >
351
+ | undefined,
352
+ | FieldAsyncValidateOrFn<
353
+ From,
354
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
355
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
356
+ >
357
+ | undefined,
358
+ | FieldValidateOrFn<
359
+ From,
360
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
361
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
362
+ >
363
+ | undefined,
364
+ | FieldAsyncValidateOrFn<
365
+ From,
366
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
367
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
368
+ >
369
+ | undefined,
370
+ | FieldValidateOrFn<
371
+ From,
372
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
373
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
374
+ >
375
+ | undefined,
376
+ | FieldAsyncValidateOrFn<
377
+ From,
378
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
379
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
380
+ >
381
+ | undefined,
382
+ | FieldValidateOrFn<
383
+ From,
384
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
385
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
386
+ >
387
+ | undefined,
388
+ | FieldAsyncValidateOrFn<
389
+ From,
390
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
391
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
392
+ >
393
+ | undefined,
394
+ FormValidateOrFn<From> | undefined,
395
+ FormValidateOrFn<From> | undefined,
396
+ StandardSchemaV1<From, To>,
397
+ FormValidateOrFn<From> | undefined,
398
+ FormAsyncValidateOrFn<From> | undefined,
399
+ FormValidateOrFn<From> | undefined,
400
+ FormAsyncValidateOrFn<From> | undefined,
401
+ FormValidateOrFn<From> | undefined,
402
+ FormAsyncValidateOrFn<From> | undefined,
403
+ FormAsyncValidateOrFn<From> | undefined,
404
+ Record<string, any> | undefined
405
+ >
406
+
407
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
408
+ type CachedFieldState<
409
+ From extends Record<PropertyKey, any>,
410
+ To extends Record<PropertyKey, any>,
411
+ TypeProps = DefaultTypeProps
412
+ > = FieldState<
413
+ From,
414
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
415
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>,
416
+ | FieldValidateOrFn<
417
+ From,
418
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
419
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
420
+ >
421
+ | undefined,
422
+ | FieldValidateOrFn<
423
+ From,
424
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
425
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
426
+ >
427
+ | undefined,
428
+ | FieldAsyncValidateOrFn<
429
+ From,
430
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
431
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
432
+ >
433
+ | undefined,
434
+ | FieldValidateOrFn<
435
+ From,
436
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
437
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
438
+ >
439
+ | undefined,
440
+ | FieldAsyncValidateOrFn<
441
+ From,
442
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
443
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
444
+ >
445
+ | undefined,
446
+ | FieldValidateOrFn<
447
+ From,
448
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
449
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
450
+ >
451
+ | undefined,
452
+ | FieldAsyncValidateOrFn<
453
+ From,
454
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
455
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
456
+ >
457
+ | undefined,
458
+ | FieldValidateOrFn<
459
+ From,
460
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
461
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
462
+ >
463
+ | undefined,
464
+ | FieldAsyncValidateOrFn<
465
+ From,
466
+ OmegaFormReturn<From, To, TypeProps>["_keys"],
467
+ DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
468
+ >
469
+ | undefined,
470
+ FormValidateOrFn<From> | undefined,
471
+ FormValidateOrFn<From> | undefined,
472
+ StandardSchemaV1<From, To>,
473
+ FormValidateOrFn<From> | undefined,
474
+ FormAsyncValidateOrFn<From> | undefined,
475
+ FormValidateOrFn<From> | undefined,
476
+ FormAsyncValidateOrFn<From> | undefined,
477
+ FormValidateOrFn<From> | undefined,
478
+ FormAsyncValidateOrFn<From> | undefined
479
+ >
480
+
481
+ export interface OmegaFormReturn<
482
+ From extends Record<PropertyKey, any>,
483
+ To extends Record<PropertyKey, any>,
484
+ TypeProps = DefaultTypeProps
485
+ > extends OF<From, To> {
486
+ // Pre-computed type aliases - computed ONCE for performance
487
+ _paths: FieldPath<From>
488
+ _keys: NestedKeyOf<From>
489
+ _schema: S.Codec<To, From>
490
+
491
+ // this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above..
492
+ Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(
493
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
494
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
495
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
496
+ __VLS_setup?: Promise<{
497
+ props:
498
+ & __VLS_PrettifyLocal<
499
+ & Pick<
500
+ & Partial<{}>
501
+ & Omit<
502
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
503
+ never
504
+ >,
505
+ never
506
+ >
507
+ & TypeProps
508
+ & Partial<{}>
509
+ >
510
+ & BaseProps<From, Name>
511
+ & PublicProps
512
+ expose(exposed: ShallowUnwrapRef<{}>): void
513
+ attrs: any
514
+ slots: {
515
+ default?(props: MergedInputProps<From, Name>): void
516
+ label?: (props: { required: boolean; id: string; label: string }) => void
517
+ }
518
+ emit: {}
519
+ }>
520
+ ) => VNode & {
521
+ __ctx?: Awaited<typeof __VLS_setup>
522
+ }
523
+ Errors: (
524
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
525
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
526
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
527
+ __VLS_setup?: Promise<{
528
+ props:
529
+ & __VLS_PrettifyLocal<
530
+ & Pick<
531
+ & Partial<{}>
532
+ & Omit<
533
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
534
+ never
535
+ >,
536
+ never
537
+ >
538
+ & Partial<{}>
539
+ >
540
+ & PublicProps
541
+ expose(exposed: ShallowUnwrapRef<{}>): void
542
+ attrs: any
543
+ slots: {
544
+ default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => void
545
+ }
546
+ emit: {}
547
+ }>
548
+ ) => VNode & {
549
+ __ctx?: Awaited<typeof __VLS_setup>
550
+ }
551
+ TaggedUnion: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
552
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
553
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
554
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
555
+ __VLS_setup?: Promise<{
556
+ props:
557
+ & __VLS_PrettifyLocal<
558
+ & Pick<
559
+ & Partial<{}>
560
+ & Omit<
561
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
562
+ never
563
+ >,
564
+ never
565
+ >
566
+ & {
567
+ name?: Name
568
+ type?: "select" | "radio"
569
+ options: TaggedUnionOptionsArray<From, Name>
570
+ _debugName?: [NoInfer<Name>]
571
+ label?: string
572
+ }
573
+ & {}
574
+ >
575
+ & PublicProps
576
+ expose(exposed: ShallowUnwrapRef<{}>): void
577
+ attrs: any
578
+ slots: Record<
579
+ string,
580
+ (props: {
581
+ field: FieldApi<
582
+ From,
583
+ Name,
584
+ DeepValue<From, Name>,
585
+ any,
586
+ any,
587
+ any,
588
+ any,
589
+ any,
590
+ any,
591
+ any,
592
+ any,
593
+ any,
594
+ any,
595
+ any,
596
+ any,
597
+ any,
598
+ any,
599
+ any,
600
+ any,
601
+ any,
602
+ any,
603
+ any,
604
+ any
605
+ >
606
+ state: FieldState<
607
+ From,
608
+ Name,
609
+ DeepValue<From, Name>,
610
+ any,
611
+ any,
612
+ any,
613
+ any,
614
+ any,
615
+ any,
616
+ any,
617
+ any,
618
+ any,
619
+ any,
620
+ any,
621
+ any,
622
+ any,
623
+ any,
624
+ any,
625
+ any,
626
+ any,
627
+ any
628
+ >
629
+ }) => any
630
+ >
631
+ emit: {}
632
+ }>
633
+ ) => VNode & {
634
+ __ctx?: Awaited<typeof __VLS_setup>
635
+ }
636
+ Array: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
637
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
638
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
639
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
640
+ __VLS_setup?: Promise<{
641
+ props:
642
+ & __VLS_PrettifyLocal<
643
+ & Pick<
644
+ & Partial<{}>
645
+ & Omit<
646
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
647
+ never
648
+ >,
649
+ never
650
+ >
651
+ & (Omit<OmegaArrayProps<From, To, Name>, "form">)
652
+ & {}
653
+ >
654
+ & PublicProps
655
+ expose(exposed: ShallowUnwrapRef<{}>): void
656
+ attrs: any
657
+ slots: {
658
+ "pre-array"?: (props: {
659
+ field: CachedFieldApi<From, To, TypeProps>
660
+ state: CachedFieldState<From, To, TypeProps>
661
+ }) => any
662
+ } & {
663
+ default?: (props: {
664
+ subField: CachedFieldApi<From, To, TypeProps>
665
+ subState: CachedFieldState<From, To, TypeProps>
666
+ index: number
667
+ field: CachedFieldApi<From, To, TypeProps>
668
+ }) => any
669
+ } & {
670
+ "post-array"?: (props: {
671
+ field: CachedFieldApi<From, To, TypeProps>
672
+ state: CachedFieldState<From, To, TypeProps>
673
+ }) => any
674
+ } & {
675
+ field?: (props: {
676
+ field: CachedFieldApi<From, To, TypeProps>
677
+ }) => any
678
+ }
679
+ emit: {}
680
+ }>
681
+ ) => VNode & {
682
+ __ctx?: Awaited<typeof __VLS_setup>
683
+ }
684
+
685
+ AutoGen: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
686
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
687
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
688
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
689
+ __VLS_setup?: Promise<{
690
+ props:
691
+ & __VLS_PrettifyLocal<
692
+ Pick<
693
+ & Partial<{}>
694
+ & Omit<
695
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
696
+ never
697
+ >,
698
+ never
699
+ > & {
700
+ // form: OmegaInputProps<From, To>["form"]
701
+ pick?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
702
+ omit?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
703
+ labelMap?: (key: OmegaFormReturn<From, To, TypeProps>["_keys"]) => string | undefined
704
+ filterMap?: <M extends OmegaAutoGenMeta<From, To, Name>>(
705
+ key: OmegaFormReturn<From, To, TypeProps>["_keys"],
706
+ meta: M
707
+ ) => boolean | M
708
+ order?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
709
+ sort?: Order.Order<OmegaAutoGenMeta<From, To, Name>>
710
+ } & {}
711
+ >
712
+ & PublicProps
713
+ expose(exposed: ShallowUnwrapRef<{}>): void
714
+ attrs: any
715
+ slots: {
716
+ default(props: {
717
+ child: OmegaAutoGenMeta<From, To, Name>
718
+ }): void
719
+ }
720
+ emit: {}
721
+ }>
722
+ ) => VNode & {
723
+ __ctx?: Awaited<typeof __VLS_setup>
724
+ }
725
+
726
+ Form: <K extends keyof OmegaFormState<To, From>>(
727
+ __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
728
+ __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
729
+ __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
730
+ __VLS_setup?: Promise<{
731
+ props:
732
+ & __VLS_PrettifyLocal<
733
+ Pick<
734
+ & Partial<{}>
735
+ & Omit<
736
+ {} & VNodeProps & AllowedComponentProps & ComponentCustomProps,
737
+ never
738
+ >,
739
+ never
740
+ > & {
741
+ // form: OmegaFormReturn<From, To, Props>
742
+ disabled?: boolean
743
+ subscribe?: K[]
744
+ } & {}
745
+ >
746
+ & PublicProps
747
+ expose(exposed: ShallowUnwrapRef<{}>): void
748
+ attrs: any
749
+ slots: {
750
+ default(props: {
751
+ subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>
752
+ }): void
753
+ }
754
+ emit: {}
755
+ }>
756
+ ) => VNode & {
757
+ __ctx?: Awaited<typeof __VLS_setup>
758
+ }
759
+ }