ovr 6.0.1 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/LICENSE.md +2 -0
  2. package/dist/app/index.d.ts +1 -1
  3. package/dist/app/index.d.ts.map +1 -1
  4. package/dist/app/index.js +17 -11
  5. package/dist/context/index.d.ts +37 -13
  6. package/dist/context/index.d.ts.map +1 -1
  7. package/dist/context/index.js +70 -29
  8. package/dist/cookie/index.d.ts +1 -1
  9. package/dist/cookie/index.d.ts.map +1 -1
  10. package/dist/cookie/index.js +2 -2
  11. package/dist/index.d.ts +4 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -2
  14. package/dist/jsx/elements.d.ts +194 -2
  15. package/dist/jsx/elements.d.ts.map +1 -1
  16. package/dist/jsx/index.d.ts.map +1 -1
  17. package/dist/jsx/index.js +18 -8
  18. package/dist/middleware/index.d.ts +12 -3
  19. package/dist/middleware/index.d.ts.map +1 -1
  20. package/dist/multipart/index.d.ts +5 -0
  21. package/dist/multipart/index.d.ts.map +1 -1
  22. package/dist/multipart/index.js +22 -24
  23. package/dist/render/index.d.ts +1 -0
  24. package/dist/render/index.d.ts.map +1 -1
  25. package/dist/render/index.js +6 -4
  26. package/dist/route/index.d.ts +143 -42
  27. package/dist/route/index.d.ts.map +1 -1
  28. package/dist/route/index.js +95 -43
  29. package/dist/schema/index.d.ts +1286 -0
  30. package/dist/schema/index.d.ts.map +1 -0
  31. package/dist/schema/index.js +1321 -0
  32. package/dist/trie/index.d.ts.map +1 -1
  33. package/dist/trie/index.js +8 -2
  34. package/dist/util/index.d.ts +138 -9
  35. package/dist/util/index.d.ts.map +1 -1
  36. package/dist/util/index.js +152 -19
  37. package/package.json +4 -1
  38. package/src/app/index.ts +17 -15
  39. package/src/context/index.ts +116 -40
  40. package/src/cookie/index.ts +5 -5
  41. package/src/index.ts +4 -3
  42. package/src/jsx/elements.ts +320 -64
  43. package/src/jsx/index.ts +16 -8
  44. package/src/middleware/index.ts +19 -8
  45. package/src/multipart/index.ts +25 -27
  46. package/src/render/index.ts +7 -4
  47. package/src/route/index.ts +338 -94
  48. package/src/schema/index.ts +2794 -0
  49. package/src/trie/index.ts +12 -2
  50. package/src/util/index.ts +193 -19
@@ -0,0 +1,1286 @@
1
+ import { type JSX } from "../jsx/index.js";
2
+ import { Multipart } from "../multipart/index.js";
3
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
4
+ export declare namespace Schema {
5
+ /**
6
+ * `Schema.parse` function type
7
+ *
8
+ * @template O Parse output
9
+ * @param value Unknown value to parse
10
+ * @param path Optional issue path (internal)
11
+ * @returns Parse result containing data or issues
12
+ */
13
+ type Parse<O> = (value: unknown, path?: Issue.Path) => Parse.Result<O>;
14
+ namespace Parse {
15
+ /**
16
+ * Valid result type.
17
+ *
18
+ * @template O Parse output
19
+ */
20
+ interface Valid<O> {
21
+ /** Valid parsed data */
22
+ data: O;
23
+ issues?: never;
24
+ }
25
+ /** Invalid result type. */
26
+ interface Invalid extends InstanceType<typeof Schema.AggregateIssue> {
27
+ data?: never;
28
+ }
29
+ /**
30
+ * `Schema.parse` result containing `data` or invalid metadata.
31
+ *
32
+ * @template O Parse output
33
+ * @template M Extra invalid result metadata
34
+ * @template V Extra valid result metadata
35
+ */
36
+ type Result<O, M extends object = {}, V extends object = {}> = (Valid<O> & V) | (Invalid & M);
37
+ /**
38
+ * Type of constructor input (path is required).
39
+ *
40
+ * @template O Parse output
41
+ * @param value Unknown value to parse
42
+ * @param path Issue path (internal)
43
+ * @returns Parse result containing data or issues
44
+ */
45
+ type Constructor<O> = (value: unknown, path: Issue.Path) => Result<O>;
46
+ }
47
+ /**
48
+ * Infer Output type of a schema or shape.
49
+ *
50
+ * @template S Schema or shape type to infer from
51
+ */
52
+ type Infer<S> = S extends Schema<infer Output> ? Output : S extends Object.Shape ? {
53
+ [K in keyof S]: Infer<S[K]>;
54
+ } : S extends any[] ? Infer<S[number]>[] : never;
55
+ /** Schema.Issue type */
56
+ type Issue = InstanceType<typeof Schema.Issue>;
57
+ namespace Issue {
58
+ /** Issue path representation. */
59
+ type Path = (string | number)[];
60
+ /** Non-empty list of issues */
61
+ type List = readonly [Issue, ...Issue[]];
62
+ }
63
+ /**
64
+ * Object schema with extend capability.
65
+ *
66
+ * @template S Object shape type
67
+ */
68
+ type Object<S extends Object.Shape, M extends Object.Mode = "strip"> = ObjectSchema<S, M>;
69
+ namespace Object {
70
+ /** Object schema shape. */
71
+ type Shape = Record<string, Schema<unknown>>;
72
+ /** Object parsing mode. */
73
+ type Mode = "strip" | "strict" | "loose";
74
+ /**
75
+ * Object output type by mode.
76
+ *
77
+ * @template S Object shape
78
+ * @template M Object mode
79
+ */
80
+ type Output<S extends Shape, M extends Mode = "strip"> = M extends "loose" ? Schema.Infer<S> & Record<string, unknown> : Schema.Infer<S>;
81
+ }
82
+ }
83
+ /** Shared shape types for `Shape` related runtime methods. */
84
+ declare namespace ShapeUtil {
85
+ /**
86
+ * Shape key name string.
87
+ *
88
+ * @template S Record-like shape
89
+ */
90
+ type Name<S extends Record<string, unknown>> = Extract<keyof S, string>;
91
+ /**
92
+ * Merge two shapes where `B` overrides `A`.
93
+ *
94
+ * @template A Base shape
95
+ * @template B Extra shape
96
+ */
97
+ type Extend<A extends Record<string, unknown>, B extends Record<string, unknown>> = globalThis.Omit<A, keyof B> & B;
98
+ }
99
+ /** Shared runtime shape operations used by object and form schema methods. */
100
+ declare class ShapeUtil {
101
+ /**
102
+ * Merge two record-like shapes where `extra` keys override `shape`.
103
+ *
104
+ * @template S Base shape
105
+ * @template E Extra shape
106
+ * @param shape Base shape
107
+ * @param extra Extra values to merge
108
+ * @returns Merged shape
109
+ */
110
+ static extend<S extends Record<string, unknown>, E extends Record<string, unknown>>(shape: S, extra: E): ShapeUtil.Extend<S, E>;
111
+ /**
112
+ * Pick keys from a record-like shape.
113
+ *
114
+ * @template S Shape
115
+ * @template N Selected key names
116
+ * @param shape Source shape
117
+ * @param names Non-empty list of keys to include
118
+ * @returns Picked shape
119
+ */
120
+ static pick<S extends Record<string, unknown>, N extends ShapeUtil.Name<S>>(shape: S, names: readonly [N, ...N[]]): Pick<S, N>;
121
+ /**
122
+ * Omit keys from a record-like shape.
123
+ *
124
+ * @template S Shape
125
+ * @template N Removed key names
126
+ * @param shape Source shape
127
+ * @param names Non-empty list of keys to remove
128
+ * @returns Omitted shape
129
+ */
130
+ static omit<S extends Record<string, unknown>, N extends ShapeUtil.Name<S>>(shape: S, names: readonly [N, ...N[]]): Omit<S, N>;
131
+ }
132
+ /**
133
+ * Minimal schema validator geared around parsing form data like
134
+ * multipart `FormData` and `URLSearchParams`.
135
+ *
136
+ * Implements Standard Schema v1 via the `~standard` property (sync validate).
137
+ *
138
+ * @template Output Output type after parsing
139
+ */
140
+ export declare class Schema<Output> implements StandardSchemaV1<unknown, Output> {
141
+ #private;
142
+ /** Validation issue produced during parsing. */
143
+ static readonly Issue: {
144
+ new (expected: unknown, path: Schema.Issue.Path, message?: string): {
145
+ /** Expected type/value. */
146
+ readonly expected: string;
147
+ /** Path to the invalid value. */
148
+ readonly path: Schema.Issue.Path;
149
+ /**
150
+ * @returns `Schema.Issue(path): message`
151
+ */
152
+ toString(): string;
153
+ toJSON(): /*elided*/ any & {
154
+ message: string;
155
+ };
156
+ name: string;
157
+ message: string;
158
+ stack?: string;
159
+ cause?: unknown;
160
+ };
161
+ isError(error: unknown): error is Error;
162
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
163
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
164
+ stackTraceLimit: number;
165
+ };
166
+ /** AggregateIssue containing at least one Schema.Issue */
167
+ static readonly AggregateIssue: {
168
+ new ([first, ...rest]: Schema.Issue[], values?: Form.Value.Map): {
169
+ /** Non-empty tuple of issues */
170
+ readonly issues: Schema.Issue.List;
171
+ /** User submitted / sanitized values */
172
+ readonly values?: Form.Value.Map;
173
+ toString(): string;
174
+ toJSON(): /*elided*/ any & {
175
+ message: string;
176
+ };
177
+ errors: any[];
178
+ name: string;
179
+ message: string;
180
+ stack?: string;
181
+ cause?: unknown;
182
+ };
183
+ };
184
+ readonly "~standard": StandardSchemaV1.Props<unknown, Output>;
185
+ /**
186
+ * Parse and validate an unknown value.
187
+ *
188
+ * @param value Unknown value to parse
189
+ * @param path Optional issue path (internal)
190
+ * @returns Parse result containing data or issues
191
+ */
192
+ parse: Schema.Parse<Output>;
193
+ /**
194
+ * Construct a new schema - used internally.
195
+ *
196
+ * Use static methods on `Schema` to make a new schema.
197
+ *
198
+ * @param parse Parse function that validates and transforms input
199
+ */
200
+ constructor(parse: Schema.Parse.Constructor<Output>);
201
+ /**
202
+ * @internal Required for Field to override and return a `Field` instance
203
+ * from the chained methods instead of a `Schema`
204
+ * @template O Output type of the new schema
205
+ * @param parse Parse function that validates and transforms input
206
+ * @returns New schema instance based on the current instance
207
+ */
208
+ derive<O>(parse: Schema.Parse.Constructor<O>): Schema<O>;
209
+ /**
210
+ * @template T Field tag name
211
+ * @template U Field input type attribute
212
+ * @template V Field option values
213
+ * @returns Optional field
214
+ */
215
+ optional<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>): Field.Instance<Output | undefined, T, U, V>;
216
+ /**
217
+ * @returns Optional schema
218
+ */
219
+ optional(this: Schema<Output>): Schema<Output | undefined>;
220
+ /**
221
+ * @template T Field tag name
222
+ * @template U Field input type attribute
223
+ * @template V Field option values
224
+ * @returns Nullable field
225
+ */
226
+ nullable<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>): Field.Instance<Output | null, T, U, V>;
227
+ /**
228
+ * @returns Nullable schema
229
+ */
230
+ nullable(this: Schema<Output>): Schema<Output | null>;
231
+ /**
232
+ * @template T Field tag name
233
+ * @template U Field input type attribute
234
+ * @template V Field option values
235
+ * @returns Nullish field
236
+ */
237
+ nullish<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>): Field.Instance<Output | null | undefined, T, U, V>;
238
+ /**
239
+ * @returns Nullish schema
240
+ */
241
+ nullish(this: Schema<Output>): Schema<Output | null | undefined>;
242
+ /**
243
+ * @template T Field tag name
244
+ * @template U Field input type attribute
245
+ * @template V Field option values
246
+ * @param value Default value to use when input is undefined
247
+ * @returns Field with default
248
+ */
249
+ default<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>, value: Output): Field.Instance<Output, T, U, V>;
250
+ /**
251
+ * @param value Default value to use when input is undefined
252
+ * @returns Schema with default
253
+ */
254
+ default(this: Schema<Output>, value: Output): Schema<Output>;
255
+ /**
256
+ * @template T Field tag name
257
+ * @template U Field input type attribute
258
+ * @template V Field option values
259
+ * @param fn Preprocess function to run before parsing
260
+ * @returns Schema that preprocesses input before parsing
261
+ */
262
+ preprocess<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>, fn: (value: unknown) => unknown): Field.Instance<Output, T, U, V>;
263
+ /**
264
+ * @param fn Preprocess function to run before parsing
265
+ * @returns Schema that preprocesses input before parsing
266
+ */
267
+ preprocess(this: Schema<Output>, fn: (value: unknown) => unknown): Schema<Output>;
268
+ /**
269
+ * @template O Output type after transformation
270
+ * @template T Field tag name
271
+ * @template U Field input type attribute
272
+ * @template V Field option values
273
+ * @param fn Transform function to apply to parsed output
274
+ * @returns Transformed field
275
+ */
276
+ transform<O, T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>, fn: (value: Output) => O): Field.Instance<O, T, U, V>;
277
+ /**
278
+ * @template O Output type after transformation
279
+ * @param fn Transform function to apply to parsed output
280
+ * @returns Transformed schema
281
+ */
282
+ transform<O>(this: Schema<Output>, fn: (value: Output) => O): Schema<O>;
283
+ /**
284
+ * @template O Output type after pipe
285
+ * @template T Field tag name
286
+ * @template U Field input type attribute
287
+ * @template V Field option values
288
+ * @param next Schema to validate the result with
289
+ * @returns Piped field
290
+ */
291
+ pipe<O, T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>, next: Schema<O>): Field.Instance<O, T, U, V>;
292
+ /**
293
+ * @template O Output type after pipe
294
+ * @param next Schema to validate the result with
295
+ * @returns Piped schema
296
+ */
297
+ pipe<O>(this: Schema<Output>, next: Schema<O>): Schema<O>;
298
+ /**
299
+ * Parse a JSON string and validate the parsed value with the provided schema.
300
+ *
301
+ * @template O Output type
302
+ * @template T Field tag name
303
+ * @template U Field input type attribute
304
+ * @template V Field option values
305
+ * @param schema Schema to validate the parsed JSON value with
306
+ * @param message Issue message when invalid
307
+ * @returns Parsed JSON field
308
+ */
309
+ json<O, T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<string, T, U, V>, schema: Schema<O>, message?: string): Field.Instance<O, T, U, V>;
310
+ /**
311
+ * Parse a JSON string and validate the parsed value with the provided schema.
312
+ *
313
+ * @template O Output type
314
+ * @param schema Schema to validate the parsed JSON value with
315
+ * @param message Issue message when invalid
316
+ * @returns Parsed JSON schema
317
+ */
318
+ json<O>(this: Schema<string>, schema: Schema<O>, message?: string): Schema<O>;
319
+ /**
320
+ * Validate an input is a valid email string using
321
+ * [Reasonable Email Regex by Colin McDonnell](https://colinhacks.com/essays/reasonable-email-regex).
322
+ *
323
+ * @template T Field tag name
324
+ * @template U Field input type attribute
325
+ * @template V Field option values
326
+ * @param message Issue message when invalid
327
+ * @returns Email field
328
+ */
329
+ email<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<string, T, U, V>, message?: string): Field.Instance<string, T, U, V>;
330
+ /**
331
+ * Validate an input is a valid email string using
332
+ * [Reasonable Email Regex by Colin McDonnell](https://colinhacks.com/essays/reasonable-email-regex).
333
+ *
334
+ * @param message Issue message when invalid
335
+ * @returns Email schema
336
+ */
337
+ email(this: Schema<string>, message?: string): Schema<string>;
338
+ /**
339
+ * Validate an input is a valid URL string.
340
+ *
341
+ * @template T Field tag name
342
+ * @template U Field input type attribute
343
+ * @template V Field option values
344
+ * @param message Issue message when invalid
345
+ * @returns URL field
346
+ */
347
+ url<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<string, T, U, V>, message?: string): Field.Instance<string, T, U, V>;
348
+ /**
349
+ * Validate an input is a valid URL string.
350
+ *
351
+ * @param message Issue message when invalid
352
+ * @returns URL schema
353
+ */
354
+ url(this: Schema<string>, message?: string): Schema<string>;
355
+ /**
356
+ * Validate an input is a safe integer.
357
+ *
358
+ * @template T Field tag name
359
+ * @template U Field input type attribute
360
+ * @template V Field option values
361
+ * @param message Issue message when invalid
362
+ * @returns Integer field
363
+ */
364
+ int<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<number, T, U, V>, message?: string): Field.Instance<number, T, U, V>;
365
+ /**
366
+ * Validate an input is a safe integer.
367
+ *
368
+ * @param message Issue message when invalid
369
+ * @returns Integer schema
370
+ */
371
+ int(this: Schema<number>, message?: string): Schema<number>;
372
+ /**
373
+ * Validate an input is greater than or equal to the minimum.
374
+ *
375
+ * For strings, this validates minimum length.
376
+ *
377
+ * @template T Field tag name
378
+ * @template U Field input type attribute
379
+ * @template V Field option values
380
+ * @param value Minimum value or length
381
+ * @param message Issue message when invalid
382
+ * @returns Refined field
383
+ */
384
+ min<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<string, T, U, V>, value: number, message?: string): Field.Instance<string, T, U, V>;
385
+ /**
386
+ * Validate an input is greater than or equal to the minimum.
387
+ *
388
+ * @template T Field tag name
389
+ * @template U Field input type attribute
390
+ * @template V Field option values
391
+ * @param value Minimum value
392
+ * @param message Issue message when invalid
393
+ * @returns Refined field
394
+ */
395
+ min<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<number, T, U, V>, value: number, message?: string): Field.Instance<number, T, U, V>;
396
+ /**
397
+ * Validate an input is greater than or equal to the minimum.
398
+ *
399
+ * @template T Field tag name
400
+ * @template U Field input type attribute
401
+ * @template V Field option values
402
+ * @param value Minimum value
403
+ * @param message Issue message when invalid
404
+ * @returns Refined field
405
+ */
406
+ min<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<bigint, T, U, V>, value: bigint, message?: string): Field.Instance<bigint, T, U, V>;
407
+ /**
408
+ * Validate an input is greater than or equal to the minimum.
409
+ *
410
+ * For strings, this validates minimum length.
411
+ *
412
+ * @param value Minimum value or length
413
+ * @param message Issue message when invalid
414
+ * @returns Refined schema
415
+ */
416
+ min(this: Schema<string>, value: number, message?: string): Schema<string>;
417
+ /**
418
+ * Validate an input is greater than or equal to the minimum.
419
+ *
420
+ * @param value Minimum value
421
+ * @param message Issue message when invalid
422
+ * @returns Refined schema
423
+ */
424
+ min(this: Schema<number>, value: number, message?: string): Schema<number>;
425
+ /**
426
+ * Validate an input is greater than or equal to the minimum.
427
+ *
428
+ * @param value Minimum value
429
+ * @param message Issue message when invalid
430
+ * @returns Refined schema
431
+ */
432
+ min(this: Schema<bigint>, value: bigint, message?: string): Schema<bigint>;
433
+ /**
434
+ * Validate an input is less than or equal to the maximum.
435
+ *
436
+ * For strings, this validates maximum length.
437
+ *
438
+ * @template T Field tag name
439
+ * @template U Field input type attribute
440
+ * @template V Field option values
441
+ * @param value Maximum value or length
442
+ * @param message Issue message when invalid
443
+ * @returns Refined field
444
+ */
445
+ max<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<string, T, U, V>, value: number, message?: string): Field.Instance<string, T, U, V>;
446
+ /**
447
+ * Validate an input is less than or equal to the maximum.
448
+ *
449
+ * @template T Field tag name
450
+ * @template U Field input type attribute
451
+ * @template V Field option values
452
+ * @param value Maximum value
453
+ * @param message Issue message when invalid
454
+ * @returns Refined field
455
+ */
456
+ max<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<number, T, U, V>, value: number, message?: string): Field.Instance<number, T, U, V>;
457
+ /**
458
+ * Validate an input is less than or equal to the maximum.
459
+ *
460
+ * @template T Field tag name
461
+ * @template U Field input type attribute
462
+ * @template V Field option values
463
+ * @param value Maximum value
464
+ * @param message Issue message when invalid
465
+ * @returns Refined field
466
+ */
467
+ max<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<bigint, T, U, V>, value: bigint, message?: string): Field.Instance<bigint, T, U, V>;
468
+ /**
469
+ * Validate an input is less than or equal to the maximum.
470
+ *
471
+ * For strings, this validates maximum length.
472
+ *
473
+ * @param value Maximum value or length
474
+ * @param message Issue message when invalid
475
+ * @returns Refined schema
476
+ */
477
+ max(this: Schema<string>, value: number, message?: string): Schema<string>;
478
+ /**
479
+ * Validate an input is less than or equal to the maximum.
480
+ *
481
+ * @param value Maximum value
482
+ * @param message Issue message when invalid
483
+ * @returns Refined schema
484
+ */
485
+ max(this: Schema<number>, value: number, message?: string): Schema<number>;
486
+ /**
487
+ * Validate an input is less than or equal to the maximum.
488
+ *
489
+ * @param value Maximum value
490
+ * @param message Issue message when invalid
491
+ * @returns Refined schema
492
+ */
493
+ max(this: Schema<bigint>, value: bigint, message?: string): Schema<bigint>;
494
+ /**
495
+ * @template T Field tag name
496
+ * @template U Field input type attribute
497
+ * @template V Field option values
498
+ * @param check Validation function that returns `false` to fail
499
+ * @param message Issue message when invalid
500
+ * @returns Refined field
501
+ */
502
+ refine<T extends Field.Tag, U extends Field.Type, V extends Field.Values | undefined>(this: Field.Instance<Output, T, U, V>, check: (value: Output) => boolean, message: string): Field.Instance<Output, T, U, V>;
503
+ /**
504
+ * @param check Validation function that returns `false` to fail
505
+ * @param message Issue message when invalid
506
+ * @returns Refined schema
507
+ */
508
+ refine(this: Schema<Output>, check: (value: Output) => boolean, message: string): Schema<Output>;
509
+ /**
510
+ * Accepts any value and presents the data as `unknown`.
511
+ *
512
+ * @returns Unknown schema
513
+ */
514
+ static unknown(): Schema<unknown>;
515
+ /**
516
+ * Validate an input is a string.
517
+ *
518
+ * @param message Issue message when invalid
519
+ * @returns String schema
520
+ */
521
+ static string(message?: string): Schema<string>;
522
+ /**
523
+ * Validate an input is a `true` or `false` boolean.
524
+ *
525
+ * @param message Issue message when invalid
526
+ * @returns Boolean schema
527
+ */
528
+ static boolean(message?: string): Schema<boolean>;
529
+ /**
530
+ * Validate an input is a number.
531
+ *
532
+ * Rejects non-finite values like `NaN` and `Infinity`.
533
+ *
534
+ * @param message Issue message when invalid
535
+ * @returns Number schema
536
+ */
537
+ static number(message?: string): Schema<number>;
538
+ /**
539
+ * Validate an input is a big integer.
540
+ *
541
+ * @param message Issue message when invalid
542
+ * @returns Big integer schema
543
+ */
544
+ static bigint(message?: string): Schema<bigint>;
545
+ /**
546
+ * @template L Literal type
547
+ * @param literal Exact value to match
548
+ * @param message Issue message when invalid
549
+ * @returns Literal schema
550
+ */
551
+ static literal<const L>(literal: L, message?: string): Schema<L>;
552
+ /**
553
+ * Validates that the input is strictly equal (`===`) to one of the allowed
554
+ * values.
555
+ *
556
+ * @template A Allowed type
557
+ * @param allowed Allowed values
558
+ * @param message Issue message when invalid
559
+ * @returns Enum schema
560
+ */
561
+ static enum<const A extends readonly [unknown, ...unknown[]]>(allowed: A, message?: string): Schema<A[number]>;
562
+ /**
563
+ * Tries each schema in order and returns the first successfully parsed result.
564
+ *
565
+ * @template S Schemas type
566
+ * @param schemas Schemas to try in order
567
+ * @returns Union schema
568
+ */
569
+ static union<const S extends readonly [Schema<unknown>, ...Schema<unknown>[]]>(schemas: S): Schema<Schema.Infer<S[number]>>;
570
+ /**
571
+ * Validates an input is an instance of the constructor.
572
+ *
573
+ * @template O Output type
574
+ * @param constructor Constructor to validate the input is an instance of
575
+ * @param message Issue message when invalid
576
+ * @returns Validated instance
577
+ */
578
+ static instance<O>(constructor: new (...args: any[]) => O, message?: string): Schema<O>;
579
+ /**
580
+ * Validates that the input is an array and parses each item.
581
+ *
582
+ * @template O Output type
583
+ * @param schema Schema for each array item
584
+ * @param message Issue message when invalid
585
+ * @returns Array schema
586
+ */
587
+ static array<O>(schema: Schema<O>, message?: string): Schema<O[]>;
588
+ /**
589
+ * Validates each key in the shape and returns a new object of parsed outputs.
590
+ *
591
+ * @template S Object shape type
592
+ * @param shape Object shape with schemas for each key
593
+ * @returns Object schema
594
+ */
595
+ static object<S extends Schema.Object.Shape = {}>(shape?: S): Schema.Object<S>;
596
+ }
597
+ /**
598
+ * Runtime object schema that validates plain objects and supports shape helpers.
599
+ *
600
+ * @template Shape Object shape type
601
+ * @template Mode Object parsing mode
602
+ */
603
+ declare class ObjectSchema<Shape extends Schema.Object.Shape, Mode extends Schema.Object.Mode = "strip"> extends Schema<Schema.Object.Output<Shape, Mode>> {
604
+ #private;
605
+ /** Object shape definitions. */
606
+ readonly shape: Shape;
607
+ /**
608
+ * Create a new object schema validator.
609
+ *
610
+ * @param shape Object shape
611
+ * @param mode Object parsing mode
612
+ */
613
+ constructor(shape: Shape, mode?: Mode);
614
+ /**
615
+ * Merge `extra` into the current shape.
616
+ *
617
+ * @template E Extra shape type
618
+ * @param extra Extra shape or object schema to merge
619
+ * @returns New object schema with the merged shape
620
+ */
621
+ extend<E extends Schema.Object.Shape>(extra: E): Schema.Object<ShapeUtil.Extend<Shape, E>, Mode>;
622
+ extend<E extends Schema.Object.Shape>(extra: Schema.Object<E>): Schema.Object<ShapeUtil.Extend<Shape, E>, Mode>;
623
+ /**
624
+ * Keep only selected field names.
625
+ *
626
+ * @template N Selected key names
627
+ * @param names Non-empty list of key names to keep
628
+ * @returns New object schema with only selected keys
629
+ */
630
+ pick<N extends ShapeUtil.Name<Shape>>(names: readonly [N, ...N[]]): ObjectSchema<Pick<Shape, N>, Mode>;
631
+ /**
632
+ * Remove selected field names.
633
+ *
634
+ * @template N Removed key names
635
+ * @param names Non-empty list of key names to remove
636
+ * @returns New object schema without selected keys
637
+ */
638
+ omit<N extends ShapeUtil.Name<Shape>>(names: readonly [N, ...N[]]): ObjectSchema<Omit<Shape, N>, Mode>;
639
+ /**
640
+ * Reject unknown keys during parsing.
641
+ *
642
+ * @returns New object schema in strict mode
643
+ */
644
+ strict(): ObjectSchema<Shape, "strict">;
645
+ /**
646
+ * Preserve unknown keys during parsing.
647
+ *
648
+ * @returns New object schema in loose mode
649
+ */
650
+ loose(): ObjectSchema<Shape, "loose">;
651
+ }
652
+ export declare namespace Form {
653
+ /** Form field shape. */
654
+ type Shape = Record<string, Field.Any>;
655
+ /** Persisted form value */
656
+ type Value = string | number | boolean | string[];
657
+ namespace Value {
658
+ /**
659
+ * Value map by field name.
660
+ *
661
+ * @template S Shape type
662
+ */
663
+ type Map<S extends Shape = Shape> = Partial<Record<ShapeUtil.Name<S>, Value>>;
664
+ }
665
+ /**
666
+ * Encoded form state.
667
+ *
668
+ * @template S Shape type to infer value keys from
669
+ */
670
+ interface State<S extends Shape = Shape> {
671
+ /** Form id generated using the field names */
672
+ readonly id: string;
673
+ /** Non-empty list of validation issues */
674
+ readonly issues?: Schema.Issue.List;
675
+ /** Map of field names to possible values */
676
+ readonly values?: Value.Map<S>;
677
+ }
678
+ namespace Parse {
679
+ /**
680
+ * Field names that are not marked to stream as multipart parts.
681
+ *
682
+ * @template S Form shape
683
+ */
684
+ type NonStreamNames<S extends Shape> = {
685
+ [K in keyof S]-?: S[K] extends Field.Instance<any, any, any, any, infer P> ? P extends true ? never : K : never;
686
+ }[keyof S];
687
+ /**
688
+ * Parsed data shape with streamed `stream()` fields removed.
689
+ *
690
+ * @template S Form shape
691
+ */
692
+ type NonStreamShape<S extends Shape> = Pick<S, NonStreamNames<S>>;
693
+ /**
694
+ * Parsed form data output.
695
+ *
696
+ * @template S Form shape
697
+ */
698
+ export type Data<S extends Shape> = Schema.Infer<NonStreamShape<S>>;
699
+ /**
700
+ * Form parse result.
701
+ *
702
+ * @template S Form shape
703
+ * @template M Extra invalid result metadata
704
+ */
705
+ export type Result<S extends Shape, M extends object = {}> = Schema.Parse.Result<Data<S>, {
706
+ /** Encoded URL search param field state */
707
+ readonly search: Result.Search;
708
+ /** Invalid parses do not expose remaining multipart parts */
709
+ readonly stream?: never;
710
+ } & M, {
711
+ /** Rest of the multipart parts to stream */
712
+ readonly stream?: AsyncGenerator<Multipart.Part>;
713
+ }>;
714
+ export namespace Result {
715
+ /** Form search param key/value */
716
+ type Search = ["_form", string] | undefined;
717
+ }
718
+ export {};
719
+ }
720
+ }
721
+ /**
722
+ * Form schema with JSX rendering capabilities.
723
+ *
724
+ * Parses `FormData` or `URLSearchParams` and generates form field
725
+ * components.
726
+ *
727
+ * @template Shape Form field shape type
728
+ */
729
+ export declare class Form<Shape extends Form.Shape = Form.Shape> {
730
+ #private;
731
+ /** Query param keys ordered as `[return, form]`. */
732
+ static readonly params: readonly ["_return", "_form"];
733
+ /** Field definitions. */
734
+ readonly shape: Shape;
735
+ /** Field names in definition order. */
736
+ readonly names: ShapeUtil.Name<Shape>[];
737
+ /** Maximum expected multipart parts derived from field cardinality. */
738
+ readonly parts: number;
739
+ /**
740
+ * Create a new form schema validator.
741
+ *
742
+ * @param shape Form fields
743
+ */
744
+ constructor(shape: Shape);
745
+ /**
746
+ * Merge `extra` into the current fields.
747
+ *
748
+ * @template E Extra field shape type
749
+ * @param extra Extra fields or form schema to merge
750
+ * @returns New form schema with merged fields
751
+ */
752
+ extend: {
753
+ <E extends Form.Shape>(extra: E): Form<ShapeUtil.Extend<Shape, E>>;
754
+ <E extends Form.Shape>(extra: Form<E>): Form<ShapeUtil.Extend<Shape, E>>;
755
+ (extra: Form<any>): Form<ShapeUtil.Extend<Shape, Form.Shape>>;
756
+ };
757
+ /**
758
+ * Keep only selected field names.
759
+ *
760
+ * @template N Selected field names
761
+ * @param names Non-empty list of field names to keep
762
+ * @returns New form schema with only selected fields
763
+ */
764
+ pick: <N extends ShapeUtil.Name<Shape>>(names: readonly [N, ...N[]]) => Form<Pick<Shape, N>>;
765
+ /**
766
+ * Remove selected field names.
767
+ *
768
+ * @template N Field names to remove
769
+ * @param names Non-empty list of field names to remove
770
+ * @returns New form schema without selected fields
771
+ */
772
+ omit: <N extends ShapeUtil.Name<Shape>>(names: readonly [N, ...N[]]) => Form<Omit<Shape, N>>;
773
+ /**
774
+ * Parse and validate form data.
775
+ *
776
+ * @param source FormData, URLSearchParams, or Multipart to parse
777
+ * @param path Internal path reference
778
+ * @returns Parsed result
779
+ */
780
+ parse: (source: FormData | URLSearchParams | Multipart, path?: Schema.Issue.Path) => Promise<Form.Parse.Result<Shape>>;
781
+ /**
782
+ * Render a single form field.
783
+ *
784
+ * @param props Component props
785
+ * @example
786
+ *
787
+ * ```tsx
788
+ * <User.Field name="username" />
789
+ * ```
790
+ */
791
+ Field: (props: Field.Component.Props<Shape>) => JSX.Element;
792
+ /**
793
+ * Render all form fields.
794
+ *
795
+ * @param props Component props
796
+ * @example
797
+ *
798
+ * ```tsx
799
+ * <User.Fields />
800
+ * ```
801
+ */
802
+ Fields: (props?: Partial<Field.Component.Props<Shape>>) => JSX.Element[];
803
+ /**
804
+ * Access bound sub-components for a field.
805
+ *
806
+ * @template N Type of the form field name
807
+ * @param props Field component props
808
+ * @example
809
+ *
810
+ * ```tsx
811
+ * const Radio = User.component({ name: "radio" });
812
+ *
813
+ * <Radio.Label />
814
+ * <Radio.Control />
815
+ * ```
816
+ */
817
+ component: <N extends ShapeUtil.Name<Shape>>(props: {
818
+ name: N;
819
+ } & Field.Component.Props<Shape>) => Field.Component<Shape[N]>;
820
+ /**
821
+ * Create a Form from a shape or use another Form.
822
+ *
823
+ * @template S Form field shape type
824
+ * @param shape Form fields
825
+ */
826
+ static from<S extends Form.Shape>(shape: S | Form<S>): Form<S>;
827
+ }
828
+ /**
829
+ * Represents a form field with parsing logic and rendering metadata.
830
+ *
831
+ * @template Output Output type of the field
832
+ * @template Tag Tag name
833
+ * @template Type Input type
834
+ * @template Values Persisted field value type
835
+ * @template Stream If the field should be streamed as a part
836
+ */
837
+ declare class FieldSchema<Output = unknown, Tag extends Field.Tag = "input", Type extends Field.Type = Field.Type, Values extends Field.Values | undefined = undefined, Stream extends boolean | undefined = undefined> extends Schema<Output> {
838
+ #private;
839
+ /** Field type */
840
+ readonly type: Type;
841
+ /** Field tag */
842
+ readonly tag: Tag;
843
+ /** Field values */
844
+ readonly values: Values;
845
+ /** Maximum expected multipart part count for this field name. */
846
+ readonly parts: number;
847
+ /** If the field should be streamed as a part */
848
+ readonly streaming?: Stream;
849
+ /**
850
+ * Create a new field.
851
+ *
852
+ * @param options Field options
853
+ * @param parse How to validate the input
854
+ * @param read How to read the form data
855
+ * @param parts Maximum expected multipart parts for this field
856
+ * @param stream If this field should be streamed as a multipart part
857
+ * @param persist If this field should persist invalid state values
858
+ */
859
+ constructor(options: Field.Options<Values, Tag>, parse: Schema<Output> | Schema.Parse.Constructor<Output>, read?: Field.Read, parts?: number, stream?: Stream, persist?: boolean);
860
+ /**
861
+ * @param field Field instance
862
+ * @param data Form data source
863
+ * @param name HTML name attribute
864
+ * @returns Raw field input
865
+ */
866
+ static read(field: Field.Any, data: FormData | URLSearchParams, name: string): Field.Input;
867
+ /**
868
+ * Stream this field as a multipart request `Part`.
869
+ *
870
+ * @returns Part field
871
+ */
872
+ stream(): Field.Instance<Output, Tag, Type, Values, true>;
873
+ /**
874
+ * Persist this field in the encoded invalid form state.
875
+ *
876
+ * Use this for non-sensitive values that should refill after an invalid
877
+ * redirect.
878
+ *
879
+ * @returns Field that persists submitted values across invalid redirects
880
+ */
881
+ persist<U extends Tag extends "input" ? Exclude<Type, "password" | "file"> : Type>(this: Field.Instance<Output, Tag, U, Values, Stream>): Field.Instance<Output, Tag, U, Values, Stream>;
882
+ /**
883
+ * Derive a new Field from the current instance type.
884
+ *
885
+ * @template O Output type of the new Field
886
+ * @param parse Parse function that validates and transforms input
887
+ * @returns New `Field` instance
888
+ */
889
+ derive<O>(parse: Schema.Parse.Constructor<O>): Field.Instance<O, Tag, Type, Values, Stream>;
890
+ /**
891
+ * @template S Form shape type
892
+ * @param props Field control props
893
+ * @returns Field component with sub-components
894
+ */
895
+ component<S extends Form.Shape>(props: Field.Component.Props<S, false>): Field.Component<this>;
896
+ /**
897
+ * @template S Form shape type
898
+ * @param props Field control props including `name` of the field to render
899
+ * @returns Component that renders the HTML field with default structure
900
+ */
901
+ render<S extends Form.Shape>(props: Field.Component.Props<S, false>): JSX.Element;
902
+ /**
903
+ * @param field Field definition
904
+ * @returns `true` when the field persists invalid-state values
905
+ */
906
+ static persisted(field: Field.Any): boolean;
907
+ }
908
+ export declare namespace Field {
909
+ /**
910
+ * Base options to create a Field.
911
+ *
912
+ * @template V Type of the values for group inputs
913
+ * @template T Tag name
914
+ */
915
+ interface Options<V extends Values | undefined = undefined, T extends Tag = Tag> {
916
+ /**
917
+ * Tag name.
918
+ *
919
+ * @default "input"
920
+ */
921
+ readonly tag?: T;
922
+ /** Values are used for group inputs */
923
+ readonly values?: V;
924
+ /** Field props */
925
+ readonly props?: Props;
926
+ }
927
+ /**
928
+ * Raw field value before schema parsing.
929
+ *
930
+ * Single-value fields read one entry, multi-value fields read all entries,
931
+ * and checkboxes read presence.
932
+ */
933
+ type Input = FormDataEntryValue | FormDataEntryValue[] | boolean | undefined;
934
+ /**
935
+ * @param data FormData or URLSearchParams
936
+ * @param name HTML name attribute
937
+ * @returns Resolved value read from the form data
938
+ */
939
+ type Read = (data: FormData | URLSearchParams, name: string) => Input;
940
+ /** Form field tag name */
941
+ type Tag = "input" | "textarea" | "select";
942
+ /** `<input type=...>` */
943
+ type Type = JSX.IntrinsicElements["input"]["type"];
944
+ /** Value type for select and radio options */
945
+ type Values = readonly [string, ...string[]];
946
+ /** Field instance type */
947
+ type Instance<Output = unknown, Tag extends Field.Tag = "input", Type extends Field.Type = Field.Type, Values extends Field.Values | undefined = undefined, Stream extends boolean | undefined = undefined> = FieldSchema<Output, Tag, Type, Values, Stream>;
948
+ /** Any field - `<input type=...>` / `<select>` / `<textarea>` */
949
+ type Any = Instance<any, Tag, Type, Values | undefined, boolean | undefined>;
950
+ /**
951
+ * Obtain the tag name of a field.
952
+ *
953
+ * @template F Field
954
+ */
955
+ type TagOf<F extends Any> = F extends Instance<any, infer T, Field.Type, Field.Values | undefined> ? T : Tag;
956
+ namespace Component {
957
+ /**
958
+ * Component props available to users to pass into the
959
+ * constructed `<Field />` component.
960
+ *
961
+ * @template S Form shape type
962
+ * @template I `true` the state is a `URL`, `false` is just `State`
963
+ */
964
+ type Props<S extends Form.Shape, I extends boolean = true> = {
965
+ /** Field name attribute */
966
+ readonly name: ShapeUtil.Name<S>;
967
+ /** Form state */
968
+ readonly state?: I extends true ? URL : Form.State<S>;
969
+ } & Field.Props;
970
+ /** Root element for the Field component */
971
+ type Root = JSX.IntrinsicElements["div"];
972
+ namespace Root {
973
+ /** Root for input groups */
974
+ type Group = JSX.IntrinsicElements["fieldset"];
975
+ }
976
+ /** `<Field.Legend />` component props */
977
+ type Legend = JSX.IntrinsicElements["legend"];
978
+ /** `<Field.Issue />` component props */
979
+ type Issue = JSX.IntrinsicElements["p"];
980
+ /**
981
+ * `<Field.Control />` component props
982
+ *
983
+ * @template T Tag name
984
+ */
985
+ type Control<T extends Tag> = T extends "textarea" ? JSX.IntrinsicElements["textarea"] : T extends "select" ? JSX.IntrinsicElements["select"] : JSX.IntrinsicElements["input"];
986
+ namespace Control {
987
+ /**
988
+ * `<Field.Control />` component props for group input element.
989
+ *
990
+ * @template T Tag name
991
+ * @template V Option values
992
+ */
993
+ type Group<T extends Tag, V extends Values> = Control<T> & {
994
+ readonly value: V[number];
995
+ };
996
+ }
997
+ /** `<Field.Label />` component props */
998
+ type Label = JSX.IntrinsicElements["label"];
999
+ namespace Label {
1000
+ /**
1001
+ * `<Field.Label />` component props for group input element.
1002
+ *
1003
+ * @template V Option values
1004
+ */
1005
+ type Group<V extends Values> = Label & {
1006
+ readonly value: V[number];
1007
+ };
1008
+ }
1009
+ /**
1010
+ * `<Field.Option />` select component props
1011
+ *
1012
+ * @template V Values
1013
+ */
1014
+ type Option<V extends Values> = JSX.IntrinsicElements["option"] & {
1015
+ /** Option value */
1016
+ readonly value: V[number];
1017
+ };
1018
+ namespace Option {
1019
+ /**
1020
+ * `<Field.Option />` input group component props
1021
+ *
1022
+ * Wrapper for both the `<Label />` and `<Input />` components.
1023
+ *
1024
+ * @template V Values
1025
+ */
1026
+ type Input<V extends Values> = JSX.IntrinsicElements["div"] & {
1027
+ /** Option value */
1028
+ readonly value: V[number];
1029
+ };
1030
+ }
1031
+ }
1032
+ /**
1033
+ * Base Field component object that contains sub-components,
1034
+ * use for fine grained rendering control.
1035
+ *
1036
+ * @template F Field
1037
+ */
1038
+ type Component<F extends Any> = Readonly<{
1039
+ /**
1040
+ * @param props Issue props
1041
+ * @returns Issue container paragraph
1042
+ */
1043
+ Issue: (props?: Component.Issue) => JSX.Element;
1044
+ } & (F extends Instance<any, "select", Field.Type, infer V> ? V extends Values ? {
1045
+ /** Select option values */
1046
+ values: V;
1047
+ /**
1048
+ * @param props Root props
1049
+ * @returns Root container div
1050
+ */
1051
+ Root: (props?: Component.Root) => JSX.Element;
1052
+ /**
1053
+ * @param props Label props
1054
+ * @returns Label element
1055
+ */
1056
+ Label: (props?: Component.Label) => JSX.Element;
1057
+ /**
1058
+ * @param props Control props
1059
+ * @returns Control select element
1060
+ */
1061
+ Control: (props?: Component.Control<"select">) => JSX.Element;
1062
+ /**
1063
+ * @param props Option props
1064
+ * @returns Select option element
1065
+ */
1066
+ Option: (props: Component.Option<V>) => JSX.Element;
1067
+ } : never : F extends Instance<any, "input", Field.Type, infer V> ? V extends Values ? {
1068
+ /** Input group values */
1069
+ values: V;
1070
+ /**
1071
+ * @param props Root props
1072
+ * @returns Root container fieldset
1073
+ */
1074
+ Root: (props?: Component.Root.Group) => JSX.Element;
1075
+ /**
1076
+ * @param props Legend element props
1077
+ * @returns Legend element
1078
+ */
1079
+ Legend: (props?: Component.Legend) => JSX.Element;
1080
+ /**
1081
+ * @param props Label props including `value`
1082
+ * @returns Label element
1083
+ */
1084
+ Label: (props: Component.Label.Group<V>) => JSX.Element;
1085
+ /**
1086
+ * @param props Control props
1087
+ * @returns Control input element
1088
+ */
1089
+ Control: (props?: Component.Control.Group<"input", V>) => JSX.Element;
1090
+ /**
1091
+ * @param props Option props
1092
+ * @returns Both label and input elements together
1093
+ */
1094
+ Option: (props: Component.Option.Input<V>) => JSX.Element;
1095
+ } : {
1096
+ /**
1097
+ * @param props Root props
1098
+ * @returns Root container div
1099
+ */
1100
+ Root: (props?: Component.Root) => JSX.Element;
1101
+ /**
1102
+ * @param props Label props
1103
+ * @returns Label element
1104
+ */
1105
+ Label: (props?: Component.Label) => JSX.Element;
1106
+ /**
1107
+ * @param props Control props
1108
+ * @returns Control input element
1109
+ */
1110
+ Control: (props?: Component.Control<"input">) => JSX.Element;
1111
+ } : {
1112
+ /**
1113
+ * @param props Root props
1114
+ * @returns Root container div
1115
+ */
1116
+ Root: (props?: Component.Root) => JSX.Element;
1117
+ /**
1118
+ * @param props Label props
1119
+ * @returns Label element
1120
+ */
1121
+ Label: (props?: Component.Label) => JSX.Element;
1122
+ /**
1123
+ * @param props Control props
1124
+ * @returns Control textarea element
1125
+ */
1126
+ Control: (props?: Component.Control<"textarea">) => JSX.Element;
1127
+ })>;
1128
+ /** Any field props */
1129
+ type Props = Props.Input | Props.Select | Props.Textarea;
1130
+ namespace Props {
1131
+ /** Extra props in addition to HTML attributes */
1132
+ interface Meta {
1133
+ /** Field label */
1134
+ readonly label?: string;
1135
+ }
1136
+ /** Props for `<input>` fields */
1137
+ export type Input = Meta & JSX.IntrinsicElements["input"];
1138
+ /** Props for `<select>` fields */
1139
+ export type Select = Meta & JSX.IntrinsicElements["select"];
1140
+ /** Props for `<textarea>` fields */
1141
+ export type Textarea = Meta & JSX.IntrinsicElements["textarea"];
1142
+ export {};
1143
+ }
1144
+ }
1145
+ /** Field factory functions */
1146
+ export declare class Field {
1147
+ #private;
1148
+ /**
1149
+ * @param props Input props
1150
+ * @returns Text input field
1151
+ */
1152
+ static text(props?: Field.Props.Input): Field.Instance<string, "input", "text">;
1153
+ /**
1154
+ * @param props Input props
1155
+ * @returns Password input field
1156
+ */
1157
+ static password(props?: Field.Props.Input): Field.Instance<string, "input", "password">;
1158
+ /**
1159
+ * @param props Input props
1160
+ * @returns Search input field
1161
+ */
1162
+ static search(props?: Field.Props.Input): Field.Instance<string, "input", "search">;
1163
+ /**
1164
+ * @param props Input props
1165
+ * @returns Telephone input field
1166
+ */
1167
+ static tel(props?: Field.Props.Input): Field.Instance<string, "input", "tel">;
1168
+ /**
1169
+ * @param props Input props
1170
+ * @returns Color input field
1171
+ */
1172
+ static color(props?: Field.Props.Input): Field.Instance<string, "input", "color">;
1173
+ /**
1174
+ * @param props Input props
1175
+ * @returns Hidden input field
1176
+ */
1177
+ static hidden(props?: Field.Props.Input): Field.Instance<string, "input", "hidden">;
1178
+ /**
1179
+ * @param props Input props
1180
+ * @returns Date input field
1181
+ */
1182
+ static date(props?: Field.Props.Input): Field.Instance<string, "input", "date">;
1183
+ /**
1184
+ * @param props Input props
1185
+ * @returns Datetime input field
1186
+ */
1187
+ static datetime(props?: Field.Props.Input): Field.Instance<string, "input", "datetime-local">;
1188
+ /**
1189
+ * @param props Input props
1190
+ * @returns Month input field
1191
+ */
1192
+ static month(props?: Field.Props.Input): Field.Instance<string, "input", "month">;
1193
+ /**
1194
+ * @param props Input props
1195
+ * @returns Week input field
1196
+ */
1197
+ static week(props?: Field.Props.Input): Field.Instance<string, "input", "week">;
1198
+ /**
1199
+ * @param props Input props
1200
+ * @returns Time input field
1201
+ */
1202
+ static time(props?: Field.Props.Input): Field.Instance<string, "input", "time">;
1203
+ /**
1204
+ * Validates email string.
1205
+ *
1206
+ * @param props Input props
1207
+ * @param message Issue message when invalid
1208
+ * @returns Email input field
1209
+ */
1210
+ static email(props?: Field.Props.Input, message?: string): Field.Instance<string, "input", "email">;
1211
+ /**
1212
+ * Validates parsable URL.
1213
+ *
1214
+ * @param props Input props
1215
+ * @param message Issue message when invalid
1216
+ * @returns URL input field
1217
+ */
1218
+ static url(props?: Field.Props.Input, message?: string): Field.Instance<string, "input", "url">;
1219
+ /**
1220
+ * Coerces to number.
1221
+ *
1222
+ * @param props Input props
1223
+ * @returns Number input field
1224
+ */
1225
+ static number(props?: Field.Props.Input): Field.Instance<number, "input", "number">;
1226
+ /**
1227
+ * Coerces to number.
1228
+ *
1229
+ * @param props Input props
1230
+ * @returns Range input field
1231
+ */
1232
+ static range(props?: Field.Props.Input): Field.Instance<number, "input", "range">;
1233
+ /**
1234
+ * - unchecked => key missing => `false`
1235
+ * - checked => key present => `true`
1236
+ *
1237
+ * @param props Input props
1238
+ * @returns Checkbox input field
1239
+ */
1240
+ static checkbox(props?: Field.Props.Input): Field.Instance<boolean, "input", "checkbox">;
1241
+ /**
1242
+ * @param props Input props
1243
+ * @returns File input field
1244
+ */
1245
+ static file(props?: Field.Props.Input): Field.Instance<File, "input", "file">;
1246
+ /**
1247
+ * @param props Input props
1248
+ * @returns Multiple file input field
1249
+ */
1250
+ static files(props?: Field.Props.Input): Field.Instance<File[], "input", "file">;
1251
+ /**
1252
+ * @template V Value type
1253
+ * @param values Checkbox values
1254
+ * @param props Input props
1255
+ * @returns Checkbox group input field
1256
+ */
1257
+ static checkboxes<const V extends string>(values: readonly [V, ...V[]], props?: Field.Props.Input): Field.Instance<V[], "input", "checkbox", readonly [V, ...V[]]>;
1258
+ /**
1259
+ * @template V Value type
1260
+ * @param values Radio button values
1261
+ * @param props Input props
1262
+ * @returns Radio group input field
1263
+ */
1264
+ static radio<const V extends string>(values: readonly [V, ...V[]], props?: Field.Props.Input): Field.Instance<V, "input", "radio", readonly [V, ...V[]]>;
1265
+ /**
1266
+ * @param props Textarea props
1267
+ * @returns Textarea field
1268
+ */
1269
+ static textarea(props?: Field.Props.Textarea): Field.Instance<string, "textarea">;
1270
+ /**
1271
+ * @template V Value type
1272
+ * @param values Select options
1273
+ * @param props Select props
1274
+ * @returns Select field
1275
+ */
1276
+ static select<const V extends string>(values: readonly [V, ...V[]], props?: Field.Props.Select): Field.Instance<V, "select", Field.Type, readonly [V, ...V[]]>;
1277
+ /**
1278
+ * @template V Value type
1279
+ * @param values Select options
1280
+ * @param props Select props
1281
+ * @returns Multi-select field
1282
+ */
1283
+ static multiselect<const V extends string>(values: readonly [V, ...V[]], props?: Field.Props.Select): Field.Instance<V[], "select", Field.Type, readonly [V, ...V[]]>;
1284
+ }
1285
+ export {};
1286
+ //# sourceMappingURL=index.d.ts.map