@voltro/client 0.51.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +356 -0
- package/THIRD-PARTY-NOTICES.md +169 -1
- package/dist/form.d.ts +228 -0
- package/dist/form.js +2 -0
- package/dist/formData-BO7zkG_F.js +386 -0
- package/dist/index.d.ts +526 -16
- package/dist/index.js +1527 -1261
- package/package.json +10 -3
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -5,7 +5,7 @@ property of its respective copyright holders and is used under the terms of
|
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/client itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (12 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -37,6 +37,146 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
37
37
|
SOFTWARE.
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## @tanstack/devtools-event-client@0.4.4
|
|
41
|
+
|
|
42
|
+
License: MIT
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
MIT License
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2025 TanStack
|
|
48
|
+
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
+
in the Software without restriction, including without limitation the rights
|
|
52
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
+
furnished to do so, subject to the following conditions:
|
|
55
|
+
|
|
56
|
+
The above copyright notice and this permission notice shall be included in all
|
|
57
|
+
copies or substantial portions of the Software.
|
|
58
|
+
|
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
+
SOFTWARE.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## @tanstack/form-core@1.33.5
|
|
69
|
+
|
|
70
|
+
License: MIT
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
MIT License
|
|
74
|
+
|
|
75
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
76
|
+
|
|
77
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
78
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
79
|
+
in the Software without restriction, including without limitation the rights
|
|
80
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
81
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
82
|
+
furnished to do so, subject to the following conditions:
|
|
83
|
+
|
|
84
|
+
The above copyright notice and this permission notice shall be included in all
|
|
85
|
+
copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
88
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
89
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
90
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
91
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
92
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
93
|
+
SOFTWARE.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## @tanstack/pacer-lite@0.1.1
|
|
97
|
+
|
|
98
|
+
License: MIT
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
MIT License
|
|
102
|
+
|
|
103
|
+
Copyright (c) 2025 Tanner Linsley
|
|
104
|
+
|
|
105
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
106
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
107
|
+
in the Software without restriction, including without limitation the rights
|
|
108
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
109
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
110
|
+
furnished to do so, subject to the following conditions:
|
|
111
|
+
|
|
112
|
+
The above copyright notice and this permission notice shall be included in all
|
|
113
|
+
copies or substantial portions of the Software.
|
|
114
|
+
|
|
115
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
116
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
117
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
118
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
119
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
120
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
121
|
+
SOFTWARE.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## @tanstack/react-store@0.11.1
|
|
125
|
+
|
|
126
|
+
License: MIT
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
MIT License
|
|
130
|
+
|
|
131
|
+
Copyright (c) 2021 Tanner Linsley
|
|
132
|
+
|
|
133
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
134
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
135
|
+
in the Software without restriction, including without limitation the rights
|
|
136
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
137
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
138
|
+
furnished to do so, subject to the following conditions:
|
|
139
|
+
|
|
140
|
+
The above copyright notice and this permission notice shall be included in all
|
|
141
|
+
copies or substantial portions of the Software.
|
|
142
|
+
|
|
143
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
144
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
145
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
146
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
147
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
148
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
149
|
+
SOFTWARE.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## @tanstack/store@0.11.1
|
|
153
|
+
|
|
154
|
+
License: MIT
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
MIT License
|
|
158
|
+
|
|
159
|
+
Copyright (c) 2021 Tanner Linsley
|
|
160
|
+
|
|
161
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
162
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
163
|
+
in the Software without restriction, including without limitation the rights
|
|
164
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
165
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
166
|
+
furnished to do so, subject to the following conditions:
|
|
167
|
+
|
|
168
|
+
The above copyright notice and this permission notice shall be included in all
|
|
169
|
+
copies or substantial portions of the Software.
|
|
170
|
+
|
|
171
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
172
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
173
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
174
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
175
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
176
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
177
|
+
SOFTWARE.
|
|
178
|
+
```
|
|
179
|
+
|
|
40
180
|
## jose@6.2.8
|
|
41
181
|
|
|
42
182
|
License: MIT
|
|
@@ -329,6 +469,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
329
469
|
SOFTWARE.
|
|
330
470
|
```
|
|
331
471
|
|
|
472
|
+
## use-sync-external-store@1.6.0
|
|
473
|
+
|
|
474
|
+
License: MIT
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
MIT License
|
|
478
|
+
|
|
479
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
480
|
+
|
|
481
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
482
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
483
|
+
in the Software without restriction, including without limitation the rights
|
|
484
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
485
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
486
|
+
furnished to do so, subject to the following conditions:
|
|
487
|
+
|
|
488
|
+
The above copyright notice and this permission notice shall be included in all
|
|
489
|
+
copies or substantial portions of the Software.
|
|
490
|
+
|
|
491
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
492
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
493
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
494
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
495
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
496
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
497
|
+
SOFTWARE.
|
|
498
|
+
```
|
|
499
|
+
|
|
332
500
|
## uuid@11.1.1
|
|
333
501
|
|
|
334
502
|
License: MIT
|
package/dist/form.d.ts
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { ParseResult } from 'effect';
|
|
2
|
+
import { Schema } from 'effect';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Walk a ParseError's issue tree into structured, PATH-PRESERVING issues.
|
|
6
|
+
* Every leaf keeps its full path (`address.city`, `entries.0.startsAt`) —
|
|
7
|
+
* nothing collapses to the top-level segment.
|
|
8
|
+
*/
|
|
9
|
+
export declare const decodeFieldIssues: (error: ParseResult.ParseError) => ReadonlyArray<FieldIssue>;
|
|
10
|
+
|
|
11
|
+
/** The document's locale per the framework contract (`<html lang>`); `'en'`
|
|
12
|
+
* outside a browser. Primary subtag only (`de-AT` → `de`). */
|
|
13
|
+
export declare const documentLocale: () => string;
|
|
14
|
+
|
|
15
|
+
export declare interface FieldDescriptor {
|
|
16
|
+
/** Property name on the input object. */
|
|
17
|
+
readonly name: string;
|
|
18
|
+
/** Human label — the Schema `title` annotation, else the humanised name. */
|
|
19
|
+
readonly label: string;
|
|
20
|
+
/** The default widget kind. `'custom'` ⇒ supply a render-prop. */
|
|
21
|
+
readonly widget: WidgetKind;
|
|
22
|
+
/** True when the property must be present (in JSON-Schema `required`). */
|
|
23
|
+
readonly required: boolean;
|
|
24
|
+
/** True when the value may be `null` (e.g. `Schema.NullOr`). */
|
|
25
|
+
readonly nullable: boolean;
|
|
26
|
+
/** Present for closed value sets (a `Schema.Literal` union → `select`). */
|
|
27
|
+
readonly options?: ReadonlyArray<FieldOption>;
|
|
28
|
+
/** The resolved JSON-Schema node — carries `maxLength` / `pattern` /
|
|
29
|
+
* `minimum` / `format` / `description` for widgets + validation hints. */
|
|
30
|
+
readonly jsonSchema: Readonly<Record<string, unknown>>;
|
|
31
|
+
/** Dotted parent path for a nested-struct member (`'address'` for
|
|
32
|
+
* `address.city`) — the SECTION a renderer groups it under. Top-level
|
|
33
|
+
* fields carry none. Overridable via `formField({ section })`. */
|
|
34
|
+
readonly section?: string;
|
|
35
|
+
/** Human label for the section (humanised path tail). */
|
|
36
|
+
readonly sectionLabel?: string;
|
|
37
|
+
/** Help text — the Schema `description` annotation. */
|
|
38
|
+
readonly description?: string;
|
|
39
|
+
/** Declared ordering (`formField({ order })`); fields sort by it, stable
|
|
40
|
+
* against declaration order. */
|
|
41
|
+
readonly order?: number;
|
|
42
|
+
/** For `widget: 'array'` (array of structs): the ITEM's field descriptors,
|
|
43
|
+
* names relative to one item (`startsAt`, not `entries.0.startsAt`). */
|
|
44
|
+
readonly item?: ReadonlyArray<FieldDescriptor>;
|
|
45
|
+
/** For `widget: 'reference'`: the referenced TABLE — a renderer binds a
|
|
46
|
+
* query-backed picker to it; the VALUE stays the id (or id list). Comes
|
|
47
|
+
* from `formField({ reference: 'stores' })`. */
|
|
48
|
+
readonly reference?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare interface FieldErrors {
|
|
52
|
+
readonly [field: string]: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One structured validation issue. `path` is the dotted field path
|
|
56
|
+
* (`'email'`, `'address.city'`, `'entries.0.startsAt'`); `id` is the stable
|
|
57
|
+
* message id (`'validation.minLength'`); `params` feed its template;
|
|
58
|
+
* `fallback` is a rendered English default so an unknown id still shows a
|
|
59
|
+
* sentence, never a bare key. */
|
|
60
|
+
export declare interface FieldIssue {
|
|
61
|
+
readonly path: string;
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
64
|
+
readonly fallback: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export declare interface FieldOption {
|
|
68
|
+
readonly value: string;
|
|
69
|
+
readonly label: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** One display section of a form: `name` is the section path (`'address'`),
|
|
73
|
+
* `undefined` for the top-level run of unsectioned fields. Contiguous in
|
|
74
|
+
* display order, so a renderer can walk sections top to bottom. */
|
|
75
|
+
export declare interface FieldSection {
|
|
76
|
+
readonly name: string | undefined;
|
|
77
|
+
readonly label: string | undefined;
|
|
78
|
+
readonly fields: ReadonlyArray<FieldDescriptor>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** DOM id of the JSON script the 422 re-render embeds (survives the
|
|
82
|
+
* `interactive:'none'` strip — it is neither `type="module"` nor `src`). */
|
|
83
|
+
export declare const FORM_FLASH_SCRIPT_ID = "__voltro_form_flash__";
|
|
84
|
+
|
|
85
|
+
/** Hidden field carrying the form's instance key (multi-form pages). */
|
|
86
|
+
export declare const FORM_KEY_FIELD = "__voltro_form";
|
|
87
|
+
|
|
88
|
+
/** URL prefix the web listener mounts the no-JS endpoint under. */
|
|
89
|
+
export declare const FORM_PATH_PREFIX = "/form/";
|
|
90
|
+
|
|
91
|
+
/** Hidden field carrying the declared success-redirect path. */
|
|
92
|
+
export declare const FORM_REDIRECT_FIELD = "__voltro_redirect";
|
|
93
|
+
|
|
94
|
+
/** The path a native `<AutoForm>` POST goes to. */
|
|
95
|
+
export declare const formActionPath: (mutationTag: string) => string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Convert posted form entries into the input object the mutation's schema
|
|
99
|
+
* decodes — the shape `validateFields` (and the RPC payload) expects.
|
|
100
|
+
*
|
|
101
|
+
* Mapping rules (the documented contract):
|
|
102
|
+
* - **checkbox/switch**: present → `true`, absent → `false`. A native POST
|
|
103
|
+
* omits an unchecked checkbox entirely, so absence is data, not a gap.
|
|
104
|
+
* - **number**: `Number(raw)`; `''` → the field is omitted (`undefined`), so
|
|
105
|
+
* an optional number stays absent and a required one reports "missing"
|
|
106
|
+
* instead of silently becoming `0`.
|
|
107
|
+
* - **date/datetime**: the string passes through (the schema's encoded side);
|
|
108
|
+
* `''` → omitted, same reasoning as number.
|
|
109
|
+
* - **arrays** (multi-select): `getAll` semantics — every entry under the key,
|
|
110
|
+
* items converted per the array's item type (number items → `Number`).
|
|
111
|
+
* - **unknown keys are dropped**: only names the schema declares are mapped,
|
|
112
|
+
* so protocol fields (`__voltro_form`, …) never reach the input object —
|
|
113
|
+
* the server rejects undeclared fields, and a hidden bookkeeping field must
|
|
114
|
+
* not turn every no-JS submit into a validation error.
|
|
115
|
+
*/
|
|
116
|
+
export declare const formDataToInput: (schema: Schema.Schema.Any, entries: Iterable<FormEntry>) => Record<string, unknown>;
|
|
117
|
+
|
|
118
|
+
/** One posted entry. File entries must be filtered out by the caller —
|
|
119
|
+
* uploads are a declared limit of the no-JS path. */
|
|
120
|
+
export declare type FormEntry = readonly [name: string, value: string];
|
|
121
|
+
|
|
122
|
+
/** UI metadata for one schema field, as an annotations object:
|
|
123
|
+
*
|
|
124
|
+
* Schema.String.annotations(formField({ section: 'contact', order: 2 }))
|
|
125
|
+
*
|
|
126
|
+
* Rides the JSON-Schema annotation (merged, not replaced — verified), so it
|
|
127
|
+
* survives the same normalisation every other descriptor fact does. */
|
|
128
|
+
export declare const formField: (meta: {
|
|
129
|
+
readonly label?: string;
|
|
130
|
+
readonly section?: string;
|
|
131
|
+
readonly order?: number;
|
|
132
|
+
readonly widget?: WidgetKind;
|
|
133
|
+
/** Mark the field a REFERENCE to a table: `formField({ reference: 'stores' })`
|
|
134
|
+
* → `widget: 'reference'` carrying the target, value = the id (or id
|
|
135
|
+
* list, for a multi-reference feeding a target's `relations:`). */
|
|
136
|
+
readonly reference?: string;
|
|
137
|
+
}) => {
|
|
138
|
+
readonly jsonSchema: {
|
|
139
|
+
readonly "x-voltro": typeof meta;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The error/values payload a failed no-JS form POST carries back into the
|
|
145
|
+
* 422 re-render. Keyed by `formKey` so a page with several forms re-fills
|
|
146
|
+
* only the one that was submitted. The SSR render passes it through the
|
|
147
|
+
* server-request context; the client reads the same payload back off the
|
|
148
|
+
* `#__voltro_form_flash__` JSON script, so a late-hydrating page shows the
|
|
149
|
+
* identical state (no mismatch, no vanished errors).
|
|
150
|
+
*/
|
|
151
|
+
export declare interface FormFlashPayload {
|
|
152
|
+
/** The submitted form's key — `<AutoForm formKey>` or its mutation tag. */
|
|
153
|
+
readonly formKey: string;
|
|
154
|
+
/** The mapped input values as posted (pre-decode), to re-fill the fields. */
|
|
155
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
156
|
+
/** First error per field — the `validateFields` shape. */
|
|
157
|
+
readonly errors: Readonly<Record<string, string>>;
|
|
158
|
+
/** A non-field error (the RPC refused after valid input: guard, server). */
|
|
159
|
+
readonly formError?: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Group an ordered field list into contiguous sections — the structure a
|
|
164
|
+
* form (or its skeleton — the placeholder must have the SHAPE of the real
|
|
165
|
+
* thing, title rows included) renders. Pure; feeds `<FormSkeleton>`,
|
|
166
|
+
* `<AutoForm>` layouts and `form.section(...)` alike.
|
|
167
|
+
*/
|
|
168
|
+
export declare const formSections: (fields: ReadonlyArray<FieldDescriptor>) => ReadonlyArray<FieldSection>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Render one issue id to display text: app resolver first (its `undefined`
|
|
172
|
+
* falls through), then the built-in catalog for the locale's primary subtag,
|
|
173
|
+
* then English, then the issue's own fallback sentence.
|
|
174
|
+
*/
|
|
175
|
+
export declare const resolveValidationMessage: (issue: Pick<FieldIssue, "id" | "params" | "fallback">, options?: ValidateOptions) => string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Derive table COLUMNS from a query's output `Schema` — an
|
|
179
|
+
* `Schema.Array(Schema.Struct({...}))`. Drills into the array's element and maps
|
|
180
|
+
* its properties (same descriptor shape as `schemaToFields`, reused for
|
|
181
|
+
* `<DataTable>` cells). Returns `[]` if the output isn't an array of objects.
|
|
182
|
+
*/
|
|
183
|
+
export declare const schemaToColumns: (schema: Schema.Schema.Any) => ReadonlyArray<FieldDescriptor>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Derive the ordered field list for a `Schema.Struct` input. Returns `[]` for a
|
|
187
|
+
* schema with no object properties (a scalar, `Schema.Void`, or anything
|
|
188
|
+
* `JSONSchema.make` cannot represent).
|
|
189
|
+
*/
|
|
190
|
+
export declare const schemaToFields: (schema: Schema.Schema.Any) => ReadonlyArray<FieldDescriptor>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Validate `values` against an input `schema`. Uses the same
|
|
194
|
+
* `decodeUnknownEither` path the store's `.validate(...)` uses, so client and
|
|
195
|
+
* server speak ONE schema; `{ errors: 'all' }` collects every field in one
|
|
196
|
+
* pass. Client-side validation is non-authoritative UX — the server
|
|
197
|
+
* re-validates the same schema on the mutation.
|
|
198
|
+
*/
|
|
199
|
+
export declare const validateFields: (schema: Schema.Schema.Any, values: unknown, options?: ValidateOptions) => ValidationResult;
|
|
200
|
+
|
|
201
|
+
export declare interface ValidateOptions {
|
|
202
|
+
/** BCP-47-ish tag; only the primary subtag is read. Default: the document's
|
|
203
|
+
* `<html lang>`, else `'en'`. */
|
|
204
|
+
readonly locale?: string;
|
|
205
|
+
readonly messages?: ValidationMessageResolver;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Resolve one message id to display text. Return `undefined` to fall through
|
|
209
|
+
* to the built-in en/de defaults — so a resolver only has to know the ids it
|
|
210
|
+
* overrides. Wire it to `@voltro/i18n` in one line:
|
|
211
|
+
* `messages: (id, params) => t(id, params)`. */
|
|
212
|
+
export declare type ValidationMessageResolver = (id: string, params: Readonly<Record<string, unknown>> | undefined, fallback: string) => string | undefined;
|
|
213
|
+
|
|
214
|
+
export declare interface ValidationResult {
|
|
215
|
+
readonly valid: boolean;
|
|
216
|
+
/** Display text per field path — what `<AutoForm>` and custom widgets
|
|
217
|
+
* render inline. First issue per field wins. */
|
|
218
|
+
readonly errors: FieldErrors;
|
|
219
|
+
/** Every issue, structured — for widget kits that translate themselves. */
|
|
220
|
+
readonly issues: ReadonlyArray<FieldIssue>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** The default widget kinds the framework can render from a schema. `'custom'`
|
|
224
|
+
* means "no default widget" — the field needs a render-prop (a nested object,
|
|
225
|
+
* an array of objects, or a multi-branch union). Mirrors innovation/01's set. */
|
|
226
|
+
export declare type WidgetKind = 'text' | 'textarea' | 'number' | 'checkbox' | 'switch' | 'select' | 'radio' | 'async-select' | 'multi-select' | 'date' | 'datetime' | 'daterange' | 'file' | 'hidden' | 'array' | 'reference' | 'custom';
|
|
227
|
+
|
|
228
|
+
export { }
|
package/dist/form.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./formData-BO7zkG_F.js";
|
|
2
|
+
export { f as FORM_FLASH_SCRIPT_ID, s as FORM_KEY_FIELD, u as FORM_PATH_PREFIX, i as FORM_REDIRECT_FIELD, d as decodeFieldIssues, t as documentLocale, e as formActionPath, c as formDataToInput, n as formField, r as formSections, a as resolveValidationMessage, l as schemaToColumns, o as schemaToFields, p as validateFields };
|