@effect-app/vue-components 4.0.0-beta.20 → 4.0.0-beta.201
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.
- package/README.md +36 -8
- package/dist/reset.css +52 -0
- package/dist/types/components/CommandButton.vue.d.ts +6 -4
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -1
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/createUseFormWithCustomInput.d.ts +2 -2
- package/dist/types/components/OmegaForm/errors.d.ts +33 -0
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/hocs.d.ts +3 -0
- package/dist/types/components/OmegaForm/index.d.ts +13 -3
- package/dist/types/components/OmegaForm/inputs.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/checks.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/createMeta.d.ts +32 -0
- package/dist/types/components/OmegaForm/meta/defaults.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/redacted.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/types.d.ts +56 -0
- package/dist/types/components/OmegaForm/meta/walker.d.ts +18 -0
- package/dist/types/components/OmegaForm/persistency.d.ts +58 -0
- package/dist/types/components/OmegaForm/submit.d.ts +60 -0
- package/dist/types/components/OmegaForm/types.d.ts +281 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +7 -213
- package/dist/types/components/OmegaForm/validation/localized.d.ts +10 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/index.d.ts +6 -6
- package/dist/vue-components.es.js +29 -45
- package/dist/vue-components10.es.js +5 -0
- package/dist/vue-components11.es.js +20 -0
- package/dist/vue-components12.es.js +49 -0
- package/dist/vue-components13.es.js +128 -0
- package/dist/vue-components14.es.js +65 -0
- package/dist/vue-components15.es.js +60 -0
- package/dist/vue-components16.es.js +22 -0
- package/dist/vue-components17.es.js +5 -0
- package/dist/vue-components18.es.js +80 -0
- package/dist/vue-components19.es.js +92 -0
- package/dist/vue-components2.es.js +11 -0
- package/dist/vue-components20.es.js +73 -0
- package/dist/vue-components21.es.js +12 -0
- package/dist/vue-components22.es.js +56 -0
- package/dist/vue-components23.es.js +5 -0
- package/dist/vue-components24.es.js +44 -0
- package/dist/vue-components25.es.js +5 -0
- package/dist/vue-components26.es.js +84 -0
- package/dist/vue-components28.es.js +8 -0
- package/dist/vue-components29.es.js +9 -0
- package/dist/vue-components3.es.js +86 -0
- package/dist/vue-components30.es.js +269 -0
- package/dist/vue-components32.es.js +8 -0
- package/dist/vue-components33.es.js +73 -0
- package/dist/vue-components34.es.js +5 -0
- package/dist/vue-components35.es.js +52 -0
- package/dist/vue-components36.es.js +5 -0
- package/dist/vue-components37.es.js +24 -0
- package/dist/vue-components38.es.js +5 -0
- package/dist/vue-components39.es.js +59 -0
- package/dist/vue-components4.es.js +5 -0
- package/dist/vue-components40.es.js +5 -0
- package/dist/vue-components41.es.js +12 -0
- package/dist/vue-components42.es.js +22 -0
- package/dist/vue-components44.es.js +9 -0
- package/dist/vue-components45.es.js +4 -0
- package/dist/vue-components46.es.js +38 -0
- package/dist/vue-components47.es.js +27 -0
- package/dist/vue-components48.es.js +28 -0
- package/dist/vue-components49.es.js +7 -0
- package/dist/vue-components5.es.js +24 -0
- package/dist/vue-components50.es.js +18 -0
- package/dist/vue-components51.es.js +36 -0
- package/dist/vue-components52.es.js +18 -0
- package/dist/vue-components53.es.js +21 -0
- package/dist/vue-components54.es.js +30 -0
- package/dist/vue-components55.es.js +7 -0
- package/dist/vue-components56.es.js +9 -0
- package/dist/vue-components57.es.js +38 -0
- package/dist/vue-components58.es.js +25 -0
- package/dist/vue-components59.es.js +128 -0
- package/dist/vue-components6.es.js +13 -0
- package/dist/vue-components60.es.js +24 -0
- package/dist/vue-components61.es.js +21 -0
- package/dist/vue-components62.es.js +9 -0
- package/dist/vue-components63.es.js +19 -0
- package/dist/vue-components64.es.js +5 -0
- package/dist/vue-components65.es.js +29 -0
- package/dist/vue-components66.es.js +5 -0
- package/dist/vue-components67.es.js +29 -0
- package/dist/vue-components68.es.js +6 -0
- package/dist/vue-components69.es.js +18 -0
- package/dist/vue-components7.es.js +13 -0
- package/dist/vue-components70.es.js +40 -0
- package/dist/vue-components71.es.js +81 -0
- package/dist/vue-components72.es.js +33 -0
- package/dist/vue-components73.es.js +19 -0
- package/dist/vue-components74.es.js +48 -0
- package/dist/vue-components8.es.js +35 -0
- package/dist/vue-components9.es.js +47 -0
- package/package.json +35 -31
- package/src/components/CommandButton.vue +55 -7
- package/src/components/OmegaForm/OmegaArray.vue +2 -4
- package/src/components/OmegaForm/OmegaAutoGen.vue +2 -1
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaFormInput.vue +1 -1
- package/src/components/OmegaForm/OmegaInput.vue +7 -36
- package/src/components/OmegaForm/OmegaInputVuetify.vue +5 -2
- package/src/components/OmegaForm/OmegaInternalInput.vue +18 -10
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +2 -1
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
- package/src/components/OmegaForm/blockDialog.ts +18 -6
- package/src/components/OmegaForm/createUseFormWithCustomInput.ts +2 -1
- package/src/components/OmegaForm/errors.ts +136 -0
- package/src/components/OmegaForm/getOmegaStore.ts +1 -1
- package/src/components/OmegaForm/hocs.ts +19 -0
- package/src/components/OmegaForm/index.ts +16 -4
- package/src/components/OmegaForm/inputs.ts +22 -0
- package/src/components/OmegaForm/meta/checks.ts +81 -0
- package/src/components/OmegaForm/meta/createMeta.ts +138 -0
- package/src/components/OmegaForm/meta/defaults.ts +132 -0
- package/src/components/OmegaForm/meta/redacted.ts +66 -0
- package/src/components/OmegaForm/meta/types.ts +78 -0
- package/src/components/OmegaForm/meta/walker.ts +248 -0
- package/src/components/OmegaForm/persistency.ts +247 -0
- package/src/components/OmegaForm/submit.ts +128 -0
- package/src/components/OmegaForm/types.ts +751 -0
- package/src/components/OmegaForm/useOmegaForm.ts +58 -893
- package/src/components/OmegaForm/validation/localized.ts +202 -0
- package/src/index.ts +0 -1
- package/src/reset.css +52 -0
- package/src/utils/index.ts +10 -7
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -157
- package/dist/types/constants/index.d.ts +0 -1
- package/dist/vue-components.es10.js +0 -239
- package/dist/vue-components.es11.js +0 -32
- package/dist/vue-components.es12.js +0 -481
- package/dist/vue-components.es13.js +0 -49
- package/dist/vue-components.es14.js +0 -4
- package/dist/vue-components.es15.js +0 -4
- package/dist/vue-components.es16.js +0 -13
- package/dist/vue-components.es17.js +0 -6
- package/dist/vue-components.es18.js +0 -13
- package/dist/vue-components.es19.js +0 -57
- package/dist/vue-components.es2.js +0 -31
- package/dist/vue-components.es20.js +0 -56
- package/dist/vue-components.es21.js +0 -8
- package/dist/vue-components.es22.js +0 -8
- package/dist/vue-components.es23.js +0 -5
- package/dist/vue-components.es24.js +0 -5
- package/dist/vue-components.es25.js +0 -4
- package/dist/vue-components.es26.js +0 -4
- package/dist/vue-components.es27.js +0 -4
- package/dist/vue-components.es28.js +0 -4
- package/dist/vue-components.es29.js +0 -19
- package/dist/vue-components.es3.js +0 -17
- package/dist/vue-components.es30.js +0 -194
- package/dist/vue-components.es32.js +0 -31
- package/dist/vue-components.es33.js +0 -6
- package/dist/vue-components.es34.js +0 -4
- package/dist/vue-components.es35.js +0 -4
- package/dist/vue-components.es36.js +0 -113
- package/dist/vue-components.es38.js +0 -9
- package/dist/vue-components.es39.js +0 -34
- package/dist/vue-components.es4.js +0 -52
- package/dist/vue-components.es41.js +0 -6
- package/dist/vue-components.es42.js +0 -25
- package/dist/vue-components.es43.js +0 -7
- package/dist/vue-components.es44.js +0 -23
- package/dist/vue-components.es45.js +0 -32
- package/dist/vue-components.es46.js +0 -24
- package/dist/vue-components.es47.js +0 -14
- package/dist/vue-components.es48.js +0 -7
- package/dist/vue-components.es49.js +0 -21
- package/dist/vue-components.es5.js +0 -52
- package/dist/vue-components.es50.js +0 -11
- package/dist/vue-components.es51.js +0 -33
- package/dist/vue-components.es52.js +0 -50
- package/dist/vue-components.es53.js +0 -28
- package/dist/vue-components.es54.js +0 -13
- package/dist/vue-components.es55.js +0 -67
- package/dist/vue-components.es56.js +0 -58
- package/dist/vue-components.es57.js +0 -19
- package/dist/vue-components.es58.js +0 -35
- package/dist/vue-components.es59.js +0 -31
- package/dist/vue-components.es6.js +0 -69
- package/dist/vue-components.es60.js +0 -44
- package/dist/vue-components.es61.js +0 -4
- package/dist/vue-components.es62.js +0 -46
- package/dist/vue-components.es63.js +0 -4
- package/dist/vue-components.es7.js +0 -83
- package/dist/vue-components.es8.js +0 -63
- package/dist/vue-components.es9.js +0 -21
- package/src/components/OmegaForm/OmegaFormStuff.ts +0 -1184
- package/src/constants/index.ts +0 -1
package/README.md
CHANGED
|
@@ -61,9 +61,9 @@ The doc app itself is a client app of the libary, therefore PrimeVue is imported
|
|
|
61
61
|
module.exports = {
|
|
62
62
|
vite: {
|
|
63
63
|
resolve: {
|
|
64
|
-
dedupe: [
|
|
65
|
-
}
|
|
66
|
-
}
|
|
64
|
+
dedupe: ["vue", /primevue\/.+/]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -103,7 +103,7 @@ If you have your own special set of SVG icons, you may create a font file (`.wof
|
|
|
103
103
|
The client app shall import `style.css`, usually in the entry file:
|
|
104
104
|
|
|
105
105
|
```js
|
|
106
|
-
import
|
|
106
|
+
import "my-lib/dist/style.css"
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
### Third-party dependencies
|
|
@@ -132,7 +132,7 @@ The dependency to be externalized may be declared as peer dependency in your lib
|
|
|
132
132
|
If you don't expect the client app of your library also needing the same dependency, you may embed cherry-picked functions. For example, to embed the `fill` function of popular library [lodash](https://lodash.com), import the `fill` function like the following:
|
|
133
133
|
|
|
134
134
|
```js
|
|
135
|
-
import fill from
|
|
135
|
+
import fill from "lodash/fill"
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
Even with tree-shaking, the codes being brought into your library may still be large, as the function may have its own dependencies.
|
|
@@ -183,23 +183,51 @@ In [tsconfig.json](tsconfig.js), set the following to address [Issue #32](https:
|
|
|
183
183
|
}
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
## v4 Breaking Changes (from v3)
|
|
187
|
+
|
|
188
|
+
### 1. Vuetify 4 CSS Reset Removed
|
|
189
|
+
|
|
190
|
+
Vuetify 4 removed the aggressive global CSS reset that v3 included (universal `margin: 0; padding: 0`, list/heading/input resets, etc.). If your app relied on these defaults, opt in to the supplemental reset:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import "@effect-app/vue-components/reset.css"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 2. Nested union `_tag` handling
|
|
197
|
+
|
|
198
|
+
`S.TaggedStruct` produces a bare `Literal` AST node, while legacy `S.Struct({ _tag: S.Literal("X") })` produces `Union([Literal("X")])` after `AST.toType`. Both patterns now correctly produce `"select"` metadata thanks to the `unwrapSingleLiteralUnion` helper. A `console.warn` is emitted for the legacy pattern to encourage migration to `TaggedStruct`.
|
|
199
|
+
|
|
200
|
+
### 3. `UndefinedOr` defaults include the key with explicit `undefined`
|
|
201
|
+
|
|
202
|
+
- **v3**: `defaultsValueFromSchema` skipped keys where the recursive call returned `undefined`, so `UndefinedOr` fields were omitted from the result object entirely.
|
|
203
|
+
- **v4**: The key is present in the result with an explicit `undefined` value.
|
|
204
|
+
|
|
205
|
+
### 4. `S.optionalKey(X).pipe(S.withDecodingDefault(...))` support
|
|
206
|
+
|
|
207
|
+
- **v3**: Not supported. The v3 equivalent `S.optionalWith` encoded defaults inside a `PropertySignatureTransformation`, opaque to AST inspection.
|
|
208
|
+
- **v4**: `defaultsValueFromSchema` detects `PropertySignatureTransformation` and extracts defaults, enabling `withDecodingDefault` as a new pattern for declaring field defaults directly on the schema.
|
|
209
|
+
|
|
186
210
|
### On Submit event
|
|
187
|
-
|
|
211
|
+
|
|
212
|
+
The :on-submit event could be tricky in `<OmegaForm />` component.
|
|
188
213
|
This is a prop that is basically a map of Tanstack Form `onSubmit` option and accept a function that return a Promise. If you want to use it as an event, you have to manage the state of loading yourself with `@submit` with a function returning `void`
|
|
189
214
|
|
|
190
215
|
E.g.
|
|
191
216
|
|
|
192
217
|
to use it as a Promise based Tanstack way:
|
|
218
|
+
|
|
193
219
|
```html
|
|
194
|
-
|
|
220
|
+
<OmegaForm :schema="schema" :on-submit="onSubmit" :subscribe="['values']">
|
|
195
221
|
```
|
|
196
222
|
|
|
197
223
|
to use it as an event:
|
|
224
|
+
|
|
198
225
|
```html
|
|
199
226
|
<OmegaForm :schema="schema" @submit="onSubmit" :is-loading="false" :subscribe="['values']">
|
|
200
227
|
```
|
|
201
228
|
|
|
202
229
|
this will give you a type error instead, because `:is-loading` is only accepted in event mode
|
|
230
|
+
|
|
203
231
|
```html
|
|
204
|
-
|
|
232
|
+
<OmegaForm :schema="schema" :on-submit="onSubmit" :is-loading="false" :subscribe="['values']">
|
|
205
233
|
```
|
package/dist/reset.css
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Supplemental CSS reset for Vuetify 4.
|
|
3
|
+
* Vuetify 4 removed the aggressive global reset that v3 included.
|
|
4
|
+
* Import this file to restore equivalent behavior:
|
|
5
|
+
* import '@effect-app/vue-components/reset.css'
|
|
6
|
+
*/
|
|
7
|
+
@layer vuetify-reset {
|
|
8
|
+
body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ul,
|
|
13
|
+
ol {
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
list-style: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h1,
|
|
20
|
+
h2,
|
|
21
|
+
h3,
|
|
22
|
+
h4,
|
|
23
|
+
h5,
|
|
24
|
+
h6 {
|
|
25
|
+
margin: 0;
|
|
26
|
+
font-size: inherit;
|
|
27
|
+
font-weight: inherit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
p {
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
input,
|
|
35
|
+
textarea,
|
|
36
|
+
select {
|
|
37
|
+
border: 0;
|
|
38
|
+
background: transparent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
a {
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
color: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
figure,
|
|
47
|
+
details,
|
|
48
|
+
summary {
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CommandBase } from "@effect-app/vue";
|
|
1
|
+
import type { CommandBase, Progress } from "@effect-app/vue";
|
|
2
|
+
import type * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
2
3
|
import type { VBtn } from "vuetify/components";
|
|
3
4
|
export type VBtnProps = VBtn["$props"];
|
|
4
5
|
export interface ButtonProps extends /* @vue-ignore */ VBtnProps {
|
|
@@ -6,18 +7,19 @@ export interface ButtonProps extends /* @vue-ignore */ VBtnProps {
|
|
|
6
7
|
/** Command Button is an easy way to connect commands and have it execute on click, while keeping track of disabled/loading states automatically */
|
|
7
8
|
declare const _default: typeof __VLS_export;
|
|
8
9
|
export default _default;
|
|
9
|
-
declare const __VLS_export: <I = never>(__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<{
|
|
10
|
+
declare const __VLS_export: <I = never, RA = unknown, RE = unknown>(__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<{
|
|
10
11
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
11
12
|
input: NoInfer<I>;
|
|
12
|
-
command: CommandBase<I>;
|
|
13
|
+
command: CommandBase<I, any, RA, RE>;
|
|
13
14
|
empty?: boolean;
|
|
14
15
|
} | {
|
|
15
|
-
command: CommandBase
|
|
16
|
+
command: CommandBase<any, any, RA, RE>;
|
|
16
17
|
input?: undefined;
|
|
17
18
|
empty?: boolean;
|
|
18
19
|
}) & {
|
|
19
20
|
disabled?: ButtonProps["disabled"];
|
|
20
21
|
title?: string;
|
|
22
|
+
mapProgress?: (result: AsyncResult.AsyncResult<RA, RE>) => Progress | undefined;
|
|
21
23
|
} & ButtonProps> & (typeof globalThis extends {
|
|
22
24
|
__VLS_PROPS_FALLBACK: infer P;
|
|
23
25
|
} ? P : {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DeepKeys } from "@tanstack/vue-form";
|
|
2
|
-
import { type OmegaArrayProps } from "./
|
|
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 "./
|
|
3
|
+
import { type OmegaAutoGenMeta, type OmegaInputProps } from "./types";
|
|
4
4
|
declare const __VLS_export: <// dprint-ignore
|
|
5
5
|
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<{
|
|
6
6
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StandardSchemaV1Issue } from "@tanstack/vue-form";
|
|
2
|
-
import { type OmegaError } from "./
|
|
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 "./
|
|
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 "./
|
|
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 {
|
|
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 "./
|
|
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 "./
|
|
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("./
|
|
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 "./
|
|
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>>;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
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>) => 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> | {
|
|
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>) => {
|
|
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>) => {
|
|
29
|
+
schema: S.Codec<To, From>;
|
|
30
|
+
meta: MetaRecord<To>;
|
|
31
|
+
unionMeta: Record<string, MetaRecord<To>>;
|
|
32
|
+
};
|
|
@@ -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;
|
|
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>;
|
|
26
|
+
export type RunPromise = <A, E>(eff: Effect.Effect<A, E>) => 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>, 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 {};
|