@owanturist/signal-form 0.1.1 → 0.3.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -169
- package/dist/index.d.ts +160 -169
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -44,8 +44,11 @@ declare abstract class SignalFormState<TParams extends SignalFormParams = any> {
|
|
|
44
44
|
_parentOf<TChild extends SignalFormState>(child: TChild): TChild;
|
|
45
45
|
_hasSameRootWith(another: SignalFormState): boolean;
|
|
46
46
|
abstract readonly _initial: ReadonlySignal<TParams["input.schema"]>;
|
|
47
|
-
abstract _replaceInitial(monitor: Monitor, state: undefined | this, isMounting: boolean): void;
|
|
48
47
|
abstract _setInitial(monitor: Monitor, setter: TParams["input.setter"]): void;
|
|
48
|
+
/**
|
|
49
|
+
* Like {@link _setInitial} but a no-op for explicitly set initials.
|
|
50
|
+
*/
|
|
51
|
+
abstract _patchInitial(monitor: Monitor, initial: TParams["input.schema"]): void;
|
|
49
52
|
abstract readonly _input: ReadonlySignal<TParams["input.schema"]>;
|
|
50
53
|
abstract _setInput(monitor: Monitor, setter: TParams["input.setter"]): void;
|
|
51
54
|
abstract readonly _error: ReadonlySignal<null | TParams["error.schema"]>;
|
|
@@ -68,7 +71,6 @@ declare abstract class SignalFormState<TParams extends SignalFormParams = any> {
|
|
|
68
71
|
abstract _forceValidated(monitor: Monitor): void;
|
|
69
72
|
abstract readonly _dirty: ReadonlySignal<TParams["flag.schema"]>;
|
|
70
73
|
abstract readonly _dirtyVerbose: ReadonlySignal<TParams["flag.schema.verbose"]>;
|
|
71
|
-
abstract readonly _dirtyOn: ReadonlySignal<TParams["flag.schema"]>;
|
|
72
74
|
abstract readonly _dirtyOnVerbose: ReadonlySignal<TParams["flag.schema.verbose"]>;
|
|
73
75
|
readonly _onFocus: Emitter<unknown, void>;
|
|
74
76
|
_getFocusFirstInvalid(monitor: Monitor): null | VoidFunction;
|
|
@@ -128,35 +130,35 @@ declare abstract class SignalForm<TParams extends SignalFormParams = any> {
|
|
|
128
130
|
submit(): Promise<void>;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
type
|
|
133
|
+
type GetFormParams<TTarget> = TTarget extends SignalForm<infer TParams> ? TParams : never;
|
|
132
134
|
|
|
133
|
-
type
|
|
135
|
+
type GetFormParam<TTarget, TKey extends keyof SignalFormParams> = GetFormParams<TTarget>[TKey];
|
|
134
136
|
|
|
135
|
-
type
|
|
137
|
+
type GetFormError<TForm extends SignalForm> = GetFormParam<TForm, "error.schema">;
|
|
136
138
|
|
|
137
|
-
type
|
|
139
|
+
type GetFormErrorSetter<TForm extends SignalForm> = GetFormParam<TForm, "error.setter">;
|
|
138
140
|
|
|
139
|
-
type
|
|
141
|
+
type GetFormErrorVerbose<TForm extends SignalForm> = GetFormParam<TForm, "error.schema.verbose">;
|
|
140
142
|
|
|
141
|
-
type
|
|
143
|
+
type GetFormFlag<TForm extends SignalForm> = GetFormParam<TForm, "flag.schema">;
|
|
142
144
|
|
|
143
|
-
type
|
|
145
|
+
type GetFormFlagSetter<TForm extends SignalForm> = GetFormParam<TForm, "flag.setter">;
|
|
144
146
|
|
|
145
|
-
type
|
|
147
|
+
type GetFormFlagVerbose<TForm extends SignalForm> = GetFormParam<TForm, "flag.schema.verbose">;
|
|
146
148
|
|
|
147
|
-
type
|
|
149
|
+
type GetFormInput<TForm extends SignalForm> = GetFormParam<TForm, "input.schema">;
|
|
148
150
|
|
|
149
|
-
type
|
|
151
|
+
type GetFormInputSetter<TForm extends SignalForm> = GetFormParam<TForm, "input.setter">;
|
|
150
152
|
|
|
151
|
-
type
|
|
153
|
+
type GetFormOutput<TForm extends SignalForm> = GetFormParam<TForm, "output.schema">;
|
|
152
154
|
|
|
153
|
-
type
|
|
155
|
+
type GetFormOutputVerbose<TForm extends SignalForm> = GetFormParam<TForm, "output.schema.verbose">;
|
|
154
156
|
|
|
155
|
-
type
|
|
157
|
+
type GetFormValidateOn<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.schema">;
|
|
156
158
|
|
|
157
|
-
type
|
|
159
|
+
type GetFormValidateOnSetter<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.setter">;
|
|
158
160
|
|
|
159
|
-
type
|
|
161
|
+
type GetFormValidateOnVerbose<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.schema.verbose">;
|
|
160
162
|
|
|
161
163
|
declare function isSignalForm(value: unknown): value is SignalForm;
|
|
162
164
|
|
|
@@ -220,28 +222,21 @@ interface FormUnitTransform<TInput, TError, TOutput> {
|
|
|
220
222
|
}
|
|
221
223
|
|
|
222
224
|
declare class FormUnitState<TInput, TError, TOutput> extends SignalFormState<FormUnitParams<TInput, TError, TOutput>> {
|
|
223
|
-
readonly
|
|
224
|
-
_explicit: Signal<boolean>;
|
|
225
|
-
_current: Signal<TInput>;
|
|
226
|
-
}>;
|
|
225
|
+
readonly _initial: Signal<TInput>;
|
|
227
226
|
readonly _input: Signal<TInput>;
|
|
228
227
|
private readonly _customError;
|
|
229
228
|
readonly _validateOn: Signal<ValidateStrategy>;
|
|
230
229
|
readonly _touched: Signal<boolean>;
|
|
231
230
|
private readonly _transform;
|
|
232
231
|
private readonly _isInputDirty;
|
|
233
|
-
private readonly _isInputEqual;
|
|
234
232
|
private readonly _isOutputEqual;
|
|
235
233
|
private readonly _isErrorEqual;
|
|
234
|
+
private _isInitialExplicit;
|
|
236
235
|
readonly _host: Lazy<FormUnit$1<TInput, TError, TOutput>>;
|
|
237
|
-
constructor(parent: null | SignalFormState,
|
|
238
|
-
_explicit: Signal<boolean>;
|
|
239
|
-
_current: Signal<TInput>;
|
|
240
|
-
}>, _input: Signal<TInput>, _customError: Signal<null | TError>, _validateOn: Signal<ValidateStrategy>, _touched: Signal<boolean>, _transform: Signal<FormUnitTransform<TInput, TError, TOutput>>, _isInputDirty: Equal<TInput>, _isInputEqual: Equal<TInput>, _isOutputEqual: Equal<null | TOutput>, _isErrorEqual: Equal<null | TError>);
|
|
236
|
+
constructor(parent: null | SignalFormState, _initial: Signal<TInput>, _input: Signal<TInput>, _customError: Signal<null | TError>, _validateOn: Signal<ValidateStrategy>, _touched: Signal<boolean>, _transform: Signal<FormUnitTransform<TInput, TError, TOutput>>, _isInputDirty: Equal<TInput>, _isOutputEqual: Equal<null | TOutput>, _isErrorEqual: Equal<null | TError>, _isInitialExplicit: boolean);
|
|
241
237
|
_childOf(parent: null | SignalFormState): FormUnitState<TInput, TError, TOutput>;
|
|
242
|
-
_initial: ReadonlySignal<TInput>;
|
|
243
|
-
_replaceInitial(monitor: Monitor, state: undefined | FormUnitState<TInput, TError, TOutput>, isMounting: boolean): void;
|
|
244
238
|
_setInitial(monitor: Monitor, setter: FormUnitInputSetter<TInput>): void;
|
|
239
|
+
_patchInitial(_monitor: Monitor, candidate: TInput): void;
|
|
245
240
|
_setInput(monitor: Monitor, setter: FormUnitInputSetter<TInput>): void;
|
|
246
241
|
readonly _error: ReadonlySignal<null | TError>;
|
|
247
242
|
readonly _errorVerbose: ReadonlySignal<null | TError>;
|
|
@@ -261,7 +256,6 @@ declare class FormUnitState<TInput, TError, TOutput> extends SignalFormState<For
|
|
|
261
256
|
_forceValidated(): void;
|
|
262
257
|
readonly _dirty: ReadonlySignal<boolean>;
|
|
263
258
|
readonly _dirtyVerbose: ReadonlySignal<boolean>;
|
|
264
|
-
readonly _dirtyOn: Signal<boolean>;
|
|
265
259
|
readonly _dirtyOnVerbose: Signal<boolean>;
|
|
266
260
|
_reset(monitor: Monitor, resetter: undefined | FormUnitInputSetter<TInput>): void;
|
|
267
261
|
_getChildren(): ReadonlyArray<never>;
|
|
@@ -414,63 +408,59 @@ declare function FormUnit<TInput, TError>(input: TInput, options?: FormUnitOptio
|
|
|
414
408
|
|
|
415
409
|
declare function isFormUnit(value: unknown): value is FormUnit$1<unknown, unknown, unknown>;
|
|
416
410
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
411
|
+
/**
|
|
412
|
+
* Self-referential homomorphic constraint: use as `<TFields extends FormShapeFields<TFields>>`.
|
|
413
|
+
*
|
|
414
|
+
* `Record<string, SignalForm>` would reject `interface X { ... }` at user call sites
|
|
415
|
+
* because TS does not infer an implicit string index signature on interfaces (they can
|
|
416
|
+
* be augmented via declaration merging). Mapping over `keyof TFields` instead checks
|
|
417
|
+
* each known key against `SignalForm` without requiring an index signature, so both
|
|
418
|
+
* `interface` and `type` declarations satisfy the constraint.
|
|
419
|
+
*/
|
|
420
|
+
type FormShapeFields<TFields = Record<string, SignalForm>> = {
|
|
421
|
+
readonly [TField in keyof TFields]: SignalForm;
|
|
421
422
|
};
|
|
422
423
|
|
|
423
|
-
type
|
|
424
|
-
[
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
type OmitValues<TObject, TValue> = Compute<Omit<TObject, FilterKeys<TObject, TValue>>>;
|
|
428
|
-
|
|
429
|
-
type FallbackParamWhenNever<TKey extends keyof SignalFormParams, TFallback, TParam> = [
|
|
430
|
-
TParam
|
|
431
|
-
] extends [never] ? TKey extends "input.schema" | "output.schema" | "output.schema.verbose" ? TFallback : never : TParam;
|
|
432
|
-
type GetFormShapeParam<TFields extends FormShapeFields, TKey extends keyof SignalFormParams> = OmitValues<{
|
|
433
|
-
readonly [TField in keyof TFields]: FallbackParamWhenNever<TKey, TFields[TField], GetSignalFormParam<TFields[TField], TKey>>;
|
|
434
|
-
}, never>;
|
|
424
|
+
type GetFormShapeParam<TFields extends FormShapeFields<TFields>, TKey extends keyof SignalFormParams> = {
|
|
425
|
+
readonly [TField in keyof TFields]: GetFormParam<TFields[TField], TKey>;
|
|
426
|
+
};
|
|
435
427
|
|
|
436
|
-
type FormShapeErrorVerbose<TFields extends FormShapeFields
|
|
428
|
+
type FormShapeErrorVerbose<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "error.schema.verbose">;
|
|
437
429
|
|
|
438
|
-
type FormShapeErrorSetter<TFields extends FormShapeFields
|
|
430
|
+
type FormShapeErrorSetter<TFields extends FormShapeFields<TFields>> = Setter<null | Partial<GetFormShapeParam<TFields, "error.setter">>, [
|
|
439
431
|
FormShapeErrorVerbose<TFields>
|
|
440
432
|
]>;
|
|
441
433
|
|
|
442
|
-
type FormShapeFlagVerbose<TFields extends FormShapeFields
|
|
434
|
+
type FormShapeFlagVerbose<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "flag.schema.verbose">;
|
|
443
435
|
|
|
444
|
-
type FormShapeFlagSetter<TFields extends FormShapeFields
|
|
436
|
+
type FormShapeFlagSetter<TFields extends FormShapeFields<TFields>> = Setter<boolean | Partial<GetFormShapeParam<TFields, "flag.setter">>, [
|
|
445
437
|
FormShapeFlagVerbose<TFields>
|
|
446
438
|
]>;
|
|
447
439
|
|
|
448
|
-
type FormShapeInput<TFields extends FormShapeFields
|
|
440
|
+
type FormShapeInput<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "input.schema">;
|
|
449
441
|
|
|
450
|
-
type FormShapeInputSetter<TFields extends FormShapeFields
|
|
442
|
+
type FormShapeInputSetter<TFields extends FormShapeFields<TFields>> = Setter<Partial<GetFormShapeParam<TFields, "input.setter">>, [
|
|
451
443
|
FormShapeInput<TFields>,
|
|
452
444
|
FormShapeInput<TFields>
|
|
453
445
|
]>;
|
|
454
446
|
|
|
455
|
-
type FormShapeValidateOnVerbose<TFields extends FormShapeFields
|
|
447
|
+
type FormShapeValidateOnVerbose<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "validateOn.schema.verbose">;
|
|
456
448
|
|
|
457
|
-
type FormShapeValidateOnSetter<TFields extends FormShapeFields
|
|
449
|
+
type FormShapeValidateOnSetter<TFields extends FormShapeFields<TFields>> = Setter<ValidateStrategy | Partial<GetFormShapeParam<TFields, "validateOn.setter">>, [
|
|
458
450
|
FormShapeValidateOnVerbose<TFields>
|
|
459
451
|
]>;
|
|
460
452
|
|
|
461
|
-
type
|
|
453
|
+
type FormShapeError<TFields extends FormShapeFields<TFields>> = null | GetFormShapeParam<TFields, "error.schema">;
|
|
462
454
|
|
|
463
|
-
type
|
|
455
|
+
type FormShapeFlag<TFields extends FormShapeFields<TFields>> = boolean | GetFormShapeParam<TFields, "flag.schema">;
|
|
464
456
|
|
|
465
|
-
type
|
|
457
|
+
type FormShapeOutput<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "output.schema">;
|
|
466
458
|
|
|
467
|
-
type
|
|
459
|
+
type FormShapeOutputVerbose<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "output.schema.verbose">;
|
|
468
460
|
|
|
469
|
-
type
|
|
461
|
+
type FormShapeValidateOn<TFields extends FormShapeFields<TFields>> = ValidateStrategy | GetFormShapeParam<TFields, "validateOn.schema">;
|
|
470
462
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
interface FormShapeParams<TFields extends FormShapeFields> extends SignalFormParams {
|
|
463
|
+
interface FormShapeParams<TFields extends FormShapeFields<TFields>> extends SignalFormParams {
|
|
474
464
|
readonly "input.schema": FormShapeInput<TFields>;
|
|
475
465
|
readonly "input.setter": FormShapeInputSetter<TFields>;
|
|
476
466
|
readonly "output.schema": FormShapeOutput<TFields>;
|
|
@@ -486,105 +476,97 @@ interface FormShapeParams<TFields extends FormShapeFields> extends SignalFormPar
|
|
|
486
476
|
readonly "error.schema.verbose": FormShapeErrorVerbose<TFields>;
|
|
487
477
|
}
|
|
488
478
|
|
|
489
|
-
type FormShapeStateFields<TFields extends FormShapeFields
|
|
490
|
-
[TField in keyof TFields]: TFields[TField]
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
[TField in keyof TFields]: TFields[TField] extends SignalForm ? never : Signal<TFields[TField]>;
|
|
494
|
-
}, never>;
|
|
495
|
-
declare class FormShapeState<TFields extends FormShapeFields = FormShapeFields> extends SignalFormState<FormShapeParams<TFields>> {
|
|
479
|
+
type FormShapeStateFields<TFields extends FormShapeFields<TFields>> = {
|
|
480
|
+
[TField in keyof TFields]: SignalFormState<GetFormParams<TFields[TField]>>;
|
|
481
|
+
};
|
|
482
|
+
declare class FormShapeState<TFields extends FormShapeFields<TFields> = Record<string, SignalForm>> extends SignalFormState<FormShapeParams<TFields>> {
|
|
496
483
|
readonly _host: Lazy<FormShape$1<TFields>>;
|
|
497
484
|
readonly _fields: FormShapeStateFields<TFields>;
|
|
498
|
-
|
|
499
|
-
constructor(parent: null | SignalFormState, fields: FormShapeStateFields<TFields>, meta: FormShapeStateMeta<TFields>);
|
|
485
|
+
constructor(parent: null | SignalFormState, fields: FormShapeStateFields<TFields>);
|
|
500
486
|
_childOf(parent: null | SignalFormState): FormShapeState<TFields>;
|
|
501
|
-
readonly _initial: _owanturist_signal.ReadonlySignal<
|
|
502
|
-
_replaceInitial(monitor: Monitor, state: undefined | FormShapeState<TFields>, isMounting: boolean): void;
|
|
487
|
+
readonly _initial: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "input.schema">>;
|
|
503
488
|
_setInitial(monitor: Monitor, setter: FormShapeInputSetter<TFields>): void;
|
|
504
|
-
|
|
489
|
+
_patchInitial(monitor: Monitor, initials: FormShapeInput<TFields>): void;
|
|
490
|
+
readonly _input: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "input.schema">>;
|
|
505
491
|
_setInput(monitor: Monitor, setter: FormShapeInputSetter<TFields>): void;
|
|
506
492
|
readonly _error: _owanturist_signal.ReadonlySignal<FormShapeError<TFields>>;
|
|
507
|
-
readonly _errorVerbose: _owanturist_signal.ReadonlySignal<
|
|
493
|
+
readonly _errorVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "error.schema.verbose">>;
|
|
508
494
|
_setError(monitor: Monitor, setter: FormShapeErrorSetter<TFields>): void;
|
|
509
495
|
readonly _validateOn: _owanturist_signal.ReadonlySignal<FormShapeValidateOn<TFields>>;
|
|
510
|
-
readonly _validateOnVerbose: _owanturist_signal.ReadonlySignal<
|
|
496
|
+
readonly _validateOnVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "validateOn.schema.verbose">>;
|
|
511
497
|
_setValidateOn(monitor: Monitor, setter: FormShapeValidateOnSetter<TFields>): void;
|
|
512
498
|
readonly _touched: _owanturist_signal.ReadonlySignal<FormShapeFlag<TFields>>;
|
|
513
|
-
readonly _touchedVerbose: _owanturist_signal.ReadonlySignal<
|
|
499
|
+
readonly _touchedVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
514
500
|
_setTouched(monitor: Monitor, setter: FormShapeFlagSetter<TFields>): void;
|
|
515
|
-
readonly _output: _owanturist_signal.ReadonlySignal<
|
|
516
|
-
readonly _outputVerbose: _owanturist_signal.ReadonlySignal<
|
|
501
|
+
readonly _output: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "output.schema"> | null>;
|
|
502
|
+
readonly _outputVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "output.schema.verbose">>;
|
|
517
503
|
readonly _valid: _owanturist_signal.ReadonlySignal<FormShapeFlag<TFields>>;
|
|
518
|
-
readonly _validVerbose: _owanturist_signal.ReadonlySignal<
|
|
504
|
+
readonly _validVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
519
505
|
readonly _invalid: _owanturist_signal.ReadonlySignal<FormShapeFlag<TFields>>;
|
|
520
|
-
readonly _invalidVerbose: _owanturist_signal.ReadonlySignal<
|
|
506
|
+
readonly _invalidVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
521
507
|
readonly _validated: _owanturist_signal.ReadonlySignal<FormShapeFlag<TFields>>;
|
|
522
|
-
readonly _validatedVerbose: _owanturist_signal.ReadonlySignal<
|
|
508
|
+
readonly _validatedVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
523
509
|
_forceValidated(monitor: Monitor): void;
|
|
524
510
|
readonly _dirty: _owanturist_signal.ReadonlySignal<FormShapeFlag<TFields>>;
|
|
525
|
-
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<
|
|
526
|
-
readonly
|
|
527
|
-
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<Omit<{ readonly [TField in keyof TFields]: [GetSignalFormParam<TFields[TField], "flag.schema.verbose">] extends [never] ? never : GetSignalFormParam<TFields[TField], "flag.schema.verbose">; }, FilterKeys<{ readonly [TField in keyof TFields]: [GetSignalFormParam<TFields[TField], "flag.schema.verbose">] extends [never] ? never : GetSignalFormParam<TFields[TField], "flag.schema.verbose">; }, never>> extends infer T ? { [K in keyof T]: T[K]; } : never>;
|
|
511
|
+
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
512
|
+
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<GetFormShapeParam<TFields, "flag.schema.verbose">>;
|
|
528
513
|
_reset(monitor: Monitor, resetter: undefined | FormShapeInputSetter<TFields>): void;
|
|
529
514
|
_getChildren<TChildParams extends SignalFormParams>(): ReadonlyArray<SignalFormChild<TChildParams, FormShapeParams<TFields>>>;
|
|
530
515
|
}
|
|
531
516
|
|
|
532
|
-
|
|
533
|
-
declare class FormShape$1<TFields extends FormShapeFields> extends SignalForm<FormShapeParams<TFields>> {
|
|
517
|
+
declare class FormShape$1<TFields extends FormShapeFields<TFields>> extends SignalForm<FormShapeParams<TFields>> {
|
|
534
518
|
readonly _state: FormShapeState<TFields>;
|
|
535
519
|
static _getState: typeof SignalForm._getState;
|
|
536
|
-
readonly fields:
|
|
537
|
-
readonly [TField in keyof TFields]: FormShapeField<TFields[TField]>;
|
|
538
|
-
};
|
|
520
|
+
readonly fields: TFields;
|
|
539
521
|
constructor(_state: FormShapeState<TFields>);
|
|
540
522
|
}
|
|
541
523
|
|
|
542
|
-
interface FormShapeOptions<TFields extends FormShapeFields
|
|
524
|
+
interface FormShapeOptions<TFields extends FormShapeFields<TFields>> {
|
|
543
525
|
readonly input?: FormShapeInputSetter<TFields>;
|
|
544
526
|
readonly initial?: FormShapeInputSetter<TFields>;
|
|
545
527
|
readonly touched?: FormShapeFlagSetter<TFields>;
|
|
546
528
|
readonly validateOn?: FormShapeValidateOnSetter<TFields>;
|
|
547
529
|
readonly error?: FormShapeErrorSetter<TFields>;
|
|
548
530
|
}
|
|
549
|
-
type FormShape<TFields extends FormShapeFields
|
|
550
|
-
declare function FormShape<TFields extends FormShapeFields
|
|
531
|
+
type FormShape<TFields extends FormShapeFields<TFields>> = FormShape$1<TFields>;
|
|
532
|
+
declare function FormShape<TFields extends FormShapeFields<TFields>>(fields: TFields, { input, initial, touched, validateOn, error }?: FormShapeOptions<NoInfer<TFields>>): FormShape<TFields>;
|
|
551
533
|
|
|
552
534
|
declare function isFormShape(value: unknown): value is FormShape$1<FormShapeFields>;
|
|
553
535
|
|
|
554
|
-
type FormListErrorVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
536
|
+
type FormListErrorVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormErrorVerbose<TElement>>;
|
|
555
537
|
|
|
556
|
-
type FormListErrorSetter<TElement extends SignalForm> = Setter<null | ReadonlyArray<undefined |
|
|
538
|
+
type FormListErrorSetter<TElement extends SignalForm> = Setter<null | ReadonlyArray<undefined | GetFormErrorSetter<TElement>>, [
|
|
557
539
|
FormListErrorVerbose<TElement>
|
|
558
540
|
]>;
|
|
559
541
|
|
|
560
|
-
type FormListFlagVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
542
|
+
type FormListFlagVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormFlagVerbose<TElement>>;
|
|
561
543
|
|
|
562
|
-
type FormListFlagSetter<TElement extends SignalForm> = Setter<boolean | ReadonlyArray<undefined |
|
|
544
|
+
type FormListFlagSetter<TElement extends SignalForm> = Setter<boolean | ReadonlyArray<undefined | GetFormFlagSetter<TElement>>, [
|
|
563
545
|
FormListFlagVerbose<TElement>
|
|
564
546
|
]>;
|
|
565
547
|
|
|
566
|
-
type FormListInput<TElement extends SignalForm> = ReadonlyArray<
|
|
548
|
+
type FormListInput<TElement extends SignalForm> = ReadonlyArray<GetFormInput<TElement>>;
|
|
567
549
|
|
|
568
|
-
type FormListInputSetter<TElement extends SignalForm> = Setter<ReadonlyArray<
|
|
550
|
+
type FormListInputSetter<TElement extends SignalForm> = Setter<ReadonlyArray<GetFormInput<TElement>>, [
|
|
569
551
|
FormListInput<TElement>,
|
|
570
552
|
FormListInput<TElement>
|
|
571
553
|
]>;
|
|
572
554
|
|
|
573
|
-
type FormListValidateOnVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
555
|
+
type FormListValidateOnVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormValidateOnVerbose<TElement>>;
|
|
574
556
|
|
|
575
|
-
type FormListValidateOnSetter<TElement extends SignalForm> = Setter<ValidateStrategy | ReadonlyArray<undefined |
|
|
557
|
+
type FormListValidateOnSetter<TElement extends SignalForm> = Setter<ValidateStrategy | ReadonlyArray<undefined | GetFormValidateOnSetter<TElement>>, [
|
|
576
558
|
FormListValidateOnVerbose<TElement>
|
|
577
559
|
]>;
|
|
578
560
|
|
|
579
|
-
type FormListError<TElement extends SignalForm> = null | ReadonlyArray<
|
|
561
|
+
type FormListError<TElement extends SignalForm> = null | ReadonlyArray<GetFormError<TElement>>;
|
|
580
562
|
|
|
581
|
-
type FormListFlag<TElement extends SignalForm> = boolean | ReadonlyArray<
|
|
563
|
+
type FormListFlag<TElement extends SignalForm> = boolean | ReadonlyArray<GetFormFlag<TElement>>;
|
|
582
564
|
|
|
583
|
-
type FormListOutput<TElement extends SignalForm> = ReadonlyArray<
|
|
565
|
+
type FormListOutput<TElement extends SignalForm> = ReadonlyArray<GetFormOutput<TElement>>;
|
|
584
566
|
|
|
585
|
-
type FormListOutputVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
567
|
+
type FormListOutputVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormOutputVerbose<TElement>>;
|
|
586
568
|
|
|
587
|
-
type FormListValidateOn<TElement extends SignalForm> = ValidateStrategy | ReadonlyArray<
|
|
569
|
+
type FormListValidateOn<TElement extends SignalForm> = ValidateStrategy | ReadonlyArray<GetFormValidateOn<TElement>>;
|
|
588
570
|
|
|
589
571
|
interface FormListParams<TElement extends SignalForm> extends SignalFormParams {
|
|
590
572
|
"input.schema": FormListInput<TElement>;
|
|
@@ -602,17 +584,18 @@ interface FormListParams<TElement extends SignalForm> extends SignalFormParams {
|
|
|
602
584
|
"error.schema.verbose": FormListErrorVerbose<TElement>;
|
|
603
585
|
}
|
|
604
586
|
|
|
587
|
+
type FormListElementFactoryInternal<TElement extends SignalForm> = (input: GetFormInput<TElement>, index: number) => SignalFormState<GetFormParams<TElement>>;
|
|
605
588
|
declare class FormListState<TElement extends SignalForm = SignalForm> extends SignalFormState<FormListParams<TElement>> {
|
|
589
|
+
private readonly _factory;
|
|
590
|
+
readonly _initialInputs: Signal<ReadonlyArray<GetFormInput<TElement>>>;
|
|
606
591
|
readonly _host: Lazy<FormList$1<TElement>>;
|
|
607
|
-
readonly _elements: Signal<ReadonlyArray<SignalFormState<
|
|
608
|
-
|
|
609
|
-
constructor(parent: null | SignalFormState, elements: ReadonlyArray<SignalFormState<GetSignalFormParams<TElement>>>);
|
|
592
|
+
readonly _elements: Signal<ReadonlyArray<SignalFormState<GetFormParams<TElement>>>>;
|
|
593
|
+
constructor(parent: null | SignalFormState, _factory: FormListElementFactoryInternal<TElement>, _initialInputs: Signal<ReadonlyArray<GetFormInput<TElement>>>, elements?: ReadonlyArray<SignalFormState<GetFormParams<TElement>>>);
|
|
610
594
|
_childOf(parent: null | SignalFormState): FormListState<TElement>;
|
|
611
595
|
_getElements(monitor: Monitor): ReadonlyArray<TElement>;
|
|
612
|
-
_getInitialElements(monitor: Monitor): ReadonlyArray<SignalFormState<GetSignalFormParams<TElement>>>;
|
|
613
596
|
readonly _initial: _owanturist_signal.ReadonlySignal<FormListInput<TElement>>;
|
|
614
|
-
_replaceInitial(monitor: Monitor, state: undefined | FormListState<TElement>, isMounting: boolean): void;
|
|
615
597
|
_setInitial(monitor: Monitor, setter: FormListInputSetter<TElement>): void;
|
|
598
|
+
_patchInitial(monitor: Monitor, initials: FormListInput<TElement>): void;
|
|
616
599
|
readonly _input: _owanturist_signal.ReadonlySignal<FormListInput<TElement>>;
|
|
617
600
|
_setInput(monitor: Monitor, setter: FormListInputSetter<TElement>): void;
|
|
618
601
|
readonly _error: _owanturist_signal.ReadonlySignal<FormListError<TElement>>;
|
|
@@ -635,7 +618,6 @@ declare class FormListState<TElement extends SignalForm = SignalForm> extends Si
|
|
|
635
618
|
_forceValidated(monitor: Monitor): void;
|
|
636
619
|
readonly _dirty: _owanturist_signal.ReadonlySignal<FormListFlag<TElement>>;
|
|
637
620
|
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<FormListFlagVerbose<TElement>>;
|
|
638
|
-
readonly _dirtyOn: _owanturist_signal.ReadonlySignal<FormListFlag<TElement>>;
|
|
639
621
|
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<FormListFlagVerbose<TElement>>;
|
|
640
622
|
_reset(monitor: Monitor, resetter: undefined | FormListInputSetter<TElement>): void;
|
|
641
623
|
_getChildren<TChildParams extends SignalFormParams>(monitor: Monitor): ReadonlyArray<SignalFormChild<TChildParams, FormListParams<TElement>>>;
|
|
@@ -651,15 +633,22 @@ declare class FormList$1<TElement extends SignalForm> extends SignalForm<FormLis
|
|
|
651
633
|
setElements(setter: Setter<ReadonlyArray<TElement>, [ReadonlyArray<TElement>, Monitor]>): void;
|
|
652
634
|
}
|
|
653
635
|
|
|
636
|
+
type FormListElementFactory<TElement extends SignalForm> = (input: GetFormInput<TElement>, index: number) => TElement;
|
|
654
637
|
interface FormListOptions<TElement extends SignalForm> {
|
|
655
|
-
|
|
638
|
+
/**
|
|
639
|
+
* @default []
|
|
640
|
+
*/
|
|
656
641
|
readonly initial?: FormListInputSetter<TElement>;
|
|
642
|
+
/**
|
|
643
|
+
* @default {@link initial}
|
|
644
|
+
*/
|
|
645
|
+
readonly input?: FormListInputSetter<TElement>;
|
|
657
646
|
readonly touched?: FormListFlagSetter<TElement>;
|
|
658
647
|
readonly validateOn?: FormListValidateOnSetter<TElement>;
|
|
659
648
|
readonly error?: FormListErrorSetter<TElement>;
|
|
660
649
|
}
|
|
661
650
|
type FormList<TElement extends SignalForm> = FormList$1<TElement>;
|
|
662
|
-
declare function FormList<TElement extends SignalForm>(
|
|
651
|
+
declare function FormList<TElement extends SignalForm>(factory: FormListElementFactory<TElement>, { input, initial, touched, validateOn, error }?: FormListOptions<TElement>): FormList<TElement>;
|
|
663
652
|
|
|
664
653
|
declare function isFormList(value: unknown): value is FormList$1<SignalForm>;
|
|
665
654
|
|
|
@@ -670,30 +659,30 @@ interface FormOptionalSchema<TEnabled, TElement> {
|
|
|
670
659
|
readonly element: TElement;
|
|
671
660
|
}
|
|
672
661
|
|
|
673
|
-
type FormOptionalParam<TEnabled extends SignalForm, TElement extends SignalForm, TKey extends keyof SignalFormParams, TConcise = never> = TConcise | FormOptionalSchema<TConcise |
|
|
662
|
+
type FormOptionalParam<TEnabled extends SignalForm, TElement extends SignalForm, TKey extends keyof SignalFormParams, TConcise = never> = TConcise | FormOptionalSchema<TConcise | GetFormParam<TEnabled, TKey>, TConcise | GetFormParam<TElement, TKey>>;
|
|
674
663
|
|
|
675
664
|
type FormOptionalErrorVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "error.schema.verbose">;
|
|
676
665
|
|
|
677
|
-
type FormOptionalErrorSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<null | Partial<FormOptionalSchema<
|
|
666
|
+
type FormOptionalErrorSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<null | Partial<FormOptionalSchema<GetFormParam<TEnabled, "error.setter">, GetFormParam<TElement, "error.setter">>>, [
|
|
678
667
|
FormOptionalErrorVerbose<TEnabled, TElement>
|
|
679
668
|
]>;
|
|
680
669
|
|
|
681
670
|
type FormOptionalFlagVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "flag.schema.verbose">;
|
|
682
671
|
|
|
683
|
-
type FormOptionalFlagSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<boolean | Partial<FormOptionalSchema<
|
|
672
|
+
type FormOptionalFlagSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<boolean | Partial<FormOptionalSchema<GetFormParam<TEnabled, "flag.setter">, GetFormParam<TElement, "flag.setter">>>, [
|
|
684
673
|
FormOptionalFlagVerbose<TEnabled, TElement>
|
|
685
674
|
]>;
|
|
686
675
|
|
|
687
|
-
type FormOptionalInput<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalSchema<
|
|
676
|
+
type FormOptionalInput<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalSchema<GetFormParam<TEnabled, "input.schema">, GetFormParam<TElement, "input.schema">>;
|
|
688
677
|
|
|
689
|
-
type FormOptionalInputSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<Partial<FormOptionalSchema<
|
|
678
|
+
type FormOptionalInputSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<Partial<FormOptionalSchema<GetFormParam<TEnabled, "input.setter">, GetFormParam<TElement, "input.setter">>>, [
|
|
690
679
|
FormOptionalInput<TEnabled, TElement>,
|
|
691
680
|
FormOptionalInput<TEnabled, TElement>
|
|
692
681
|
]>;
|
|
693
682
|
|
|
694
683
|
type FormOptionalValidateOnVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "validateOn.schema.verbose">;
|
|
695
684
|
|
|
696
|
-
type FormOptionalValidateOnSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<ValidateStrategy | Partial<FormOptionalSchema<
|
|
685
|
+
type FormOptionalValidateOnSetter<TEnabled extends SignalForm, TElement extends SignalForm> = Setter<ValidateStrategy | Partial<FormOptionalSchema<GetFormParam<TEnabled, "validateOn.setter">, GetFormParam<TElement, "validateOn.setter">>>, [
|
|
697
686
|
FormOptionalValidateOnVerbose<TEnabled, TElement>
|
|
698
687
|
]>;
|
|
699
688
|
|
|
@@ -701,7 +690,7 @@ type FormOptionalError<TEnabled extends SignalForm, TElement extends SignalForm>
|
|
|
701
690
|
|
|
702
691
|
type FormOptionalFlag<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "flag.schema", boolean>;
|
|
703
692
|
|
|
704
|
-
type FormOptionalOutput<TElement extends SignalForm> = undefined |
|
|
693
|
+
type FormOptionalOutput<TElement extends SignalForm> = undefined | GetFormParam<TElement, "output.schema">;
|
|
705
694
|
|
|
706
695
|
type FormOptionalOutputVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "output.schema.verbose">;
|
|
707
696
|
|
|
@@ -725,17 +714,17 @@ interface FormOptionalParams<TEnabled extends SignalForm, TElement extends Signa
|
|
|
725
714
|
|
|
726
715
|
declare class FormOptionalState<TEnabled extends SignalForm, TElement extends SignalForm> extends SignalFormState<FormOptionalParams<TEnabled, TElement>> {
|
|
727
716
|
readonly _host: Lazy<FormOptional$1<TEnabled, TElement>>;
|
|
728
|
-
readonly _enabled: SignalFormState<
|
|
729
|
-
readonly _element: SignalFormState<
|
|
730
|
-
constructor(parent: null | SignalFormState, enabled: SignalFormState<
|
|
717
|
+
readonly _enabled: SignalFormState<GetFormParams<TEnabled>>;
|
|
718
|
+
readonly _element: SignalFormState<GetFormParams<TElement>>;
|
|
719
|
+
constructor(parent: null | SignalFormState, enabled: SignalFormState<GetFormParams<TEnabled>>, element: SignalFormState<GetFormParams<TElement>>);
|
|
731
720
|
private _isEnabled;
|
|
732
|
-
_getEnabledElement(monitor: Monitor): undefined | SignalFormState<
|
|
721
|
+
_getEnabledElement(monitor: Monitor): undefined | SignalFormState<GetFormParams<TElement>>;
|
|
733
722
|
_childOf(parent: null | SignalFormState): FormOptionalState<TEnabled, TElement>;
|
|
734
723
|
private _toConcise;
|
|
735
724
|
private _toVerbose;
|
|
736
725
|
readonly _initial: _owanturist_signal.ReadonlySignal<FormOptionalInput<TEnabled, TElement>>;
|
|
737
726
|
_setInitial(monitor: Monitor, setter: FormOptionalInputSetter<TEnabled, TElement>): void;
|
|
738
|
-
|
|
727
|
+
_patchInitial(monitor: Monitor, initial: FormOptionalInput<TEnabled, TElement>): void;
|
|
739
728
|
readonly _input: _owanturist_signal.ReadonlySignal<FormOptionalInput<TEnabled, TElement>>;
|
|
740
729
|
_setInput(monitor: Monitor, setter: FormOptionalInputSetter<TEnabled, TElement>): void;
|
|
741
730
|
readonly _error: _owanturist_signal.ReadonlySignal<FormOptionalError<TEnabled, TElement>>;
|
|
@@ -758,7 +747,6 @@ declare class FormOptionalState<TEnabled extends SignalForm, TElement extends Si
|
|
|
758
747
|
_forceValidated(monitor: Monitor): void;
|
|
759
748
|
readonly _dirty: _owanturist_signal.ReadonlySignal<FormOptionalFlag<TEnabled, TElement>>;
|
|
760
749
|
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<FormOptionalFlagVerbose<TEnabled, TElement>>;
|
|
761
|
-
readonly _dirtyOn: _owanturist_signal.ReadonlySignal<FormOptionalFlag<TEnabled, TElement>>;
|
|
762
750
|
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<FormOptionalFlagVerbose<TEnabled, TElement>>;
|
|
763
751
|
_reset(monitor: Monitor, resetter: undefined | FormOptionalInputSetter<TEnabled, TElement>): void;
|
|
764
752
|
_getChildren<TChildParams extends SignalFormParams>(monitor: Monitor): ReadonlyArray<SignalFormChild<TChildParams, FormOptionalParams<TEnabled, TElement>>>;
|
|
@@ -781,27 +769,31 @@ interface FormOptionalOptions<TEnabled extends SignalForm, TElement extends Sign
|
|
|
781
769
|
error?: FormOptionalErrorSetter<TEnabled, TElement>;
|
|
782
770
|
}
|
|
783
771
|
type FormOptional<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptional$1<TEnabled, TElement>;
|
|
784
|
-
declare function FormOptional<TEnabled extends SignalForm, TElement extends SignalForm>(enabled: IsEqualType<
|
|
772
|
+
declare function FormOptional<TEnabled extends SignalForm, TElement extends SignalForm>(enabled: IsEqualType<GetFormParam<TEnabled, "output.schema">, boolean> extends true ? TEnabled : never, element: TElement, { input, initial, touched, validateOn, error }?: FormOptionalOptions<TEnabled, TElement>): FormOptional<TEnabled, TElement>;
|
|
785
773
|
|
|
786
774
|
declare function isFormOptional(anything: unknown): anything is FormOptional$1<SignalForm, SignalForm>;
|
|
787
775
|
|
|
788
|
-
type FormSwitchBranches<TKind extends SignalForm> =
|
|
776
|
+
type FormSwitchBranches<TKind extends SignalForm> = GetFormParam<TKind, "output.schema"> extends string ? Record<GetFormParam<TKind, "output.schema">, SignalForm> : never;
|
|
789
777
|
|
|
790
778
|
interface FormSwitchConciseSchema<TActive, TBranch> {
|
|
791
779
|
readonly active: TActive;
|
|
792
780
|
readonly branch: TBranch;
|
|
793
781
|
}
|
|
794
782
|
|
|
783
|
+
type Compute<Obj> = unknown & {
|
|
784
|
+
[K in keyof Obj]: Obj[K];
|
|
785
|
+
};
|
|
786
|
+
|
|
795
787
|
interface FormSwitchVerboseSchema<TActive, TBranches> {
|
|
796
788
|
readonly active: TActive;
|
|
797
789
|
readonly branches: TBranches;
|
|
798
790
|
}
|
|
799
791
|
|
|
800
792
|
type GetFormSwitchBranchesParam<TBranches extends FormSwitchBranches<SignalForm>, TKey extends keyof SignalFormParams> = Compute<{
|
|
801
|
-
readonly [TBranch in keyof TBranches]:
|
|
793
|
+
readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], TKey>;
|
|
802
794
|
}>;
|
|
803
795
|
|
|
804
|
-
type FormSwitchVerboseParam<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams> = Compute<FormSwitchVerboseSchema<
|
|
796
|
+
type FormSwitchVerboseParam<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams> = Compute<FormSwitchVerboseSchema<GetFormParam<TKind, TKey>, GetFormSwitchBranchesParam<TBranches, TKey>>>;
|
|
805
797
|
|
|
806
798
|
type FormSwitchErrorVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "error.schema.verbose">;
|
|
807
799
|
|
|
@@ -811,12 +803,12 @@ interface FormSwitchBranch<TKind, TValue> {
|
|
|
811
803
|
}
|
|
812
804
|
|
|
813
805
|
type FormSwitchBranchUnion<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams> = {
|
|
814
|
-
[TBranch in
|
|
815
|
-
}[
|
|
806
|
+
[TBranch in GetFormOutput<TKind>]: FormSwitchBranch<TBranch, GetFormParam<TBranches[TBranch], TKey>>;
|
|
807
|
+
}[GetFormOutput<TKind>];
|
|
816
808
|
|
|
817
|
-
type FormSwitchErrorSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<null | Partial<FormSwitchConciseSchema<
|
|
809
|
+
type FormSwitchErrorSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<null | Partial<FormSwitchConciseSchema<GetFormParam<TKind, "error.setter">, Setter<null | FormSwitchBranchUnion<TKind, TBranches, "error.setter">, [
|
|
818
810
|
FormSwitchBranchUnion<TKind, TBranches, "error.schema.verbose">
|
|
819
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
811
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "error.setter">, Setter<null | Partial<GetFormSwitchBranchesParam<TBranches, "error.setter">>, [
|
|
820
812
|
GetFormSwitchBranchesParam<TBranches, "error.schema.verbose">
|
|
821
813
|
]>>>, [
|
|
822
814
|
FormSwitchErrorVerbose<TKind, TBranches>
|
|
@@ -824,9 +816,9 @@ type FormSwitchErrorSetter<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
824
816
|
|
|
825
817
|
type FormSwitchFlagVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "flag.schema.verbose">;
|
|
826
818
|
|
|
827
|
-
type FormSwitchFlagSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<boolean | Partial<FormSwitchConciseSchema<
|
|
819
|
+
type FormSwitchFlagSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<boolean | Partial<FormSwitchConciseSchema<GetFormParam<TKind, "flag.setter">, Setter<boolean | FormSwitchBranchUnion<TKind, TBranches, "flag.setter">, [
|
|
828
820
|
FormSwitchBranchUnion<TKind, TBranches, "flag.schema.verbose">
|
|
829
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
821
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "flag.setter">, Setter<boolean | Partial<GetFormSwitchBranchesParam<TBranches, "flag.setter">>, [
|
|
830
822
|
GetFormSwitchBranchesParam<TBranches, "flag.schema.verbose">
|
|
831
823
|
]>>>, [
|
|
832
824
|
FormSwitchFlagVerbose<TKind, TBranches>
|
|
@@ -834,7 +826,7 @@ type FormSwitchFlagSetter<TKind extends SignalForm, TBranches extends FormSwitch
|
|
|
834
826
|
|
|
835
827
|
type FormSwitchInput<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "input.schema">;
|
|
836
828
|
|
|
837
|
-
type FormSwitchInputSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<Partial<FormSwitchVerboseSchema<
|
|
829
|
+
type FormSwitchInputSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "input.setter">, Setter<Partial<GetFormSwitchBranchesParam<TBranches, "input.setter">>, [
|
|
838
830
|
GetFormSwitchBranchesParam<TBranches, "input.schema">,
|
|
839
831
|
GetFormSwitchBranchesParam<TBranches, "input.schema">
|
|
840
832
|
]>>>, [
|
|
@@ -844,9 +836,9 @@ type FormSwitchInputSetter<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
844
836
|
|
|
845
837
|
type FormSwitchValidateOnVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "validateOn.schema.verbose">;
|
|
846
838
|
|
|
847
|
-
type FormSwitchValidateOnSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<ValidateStrategy | Partial<FormSwitchConciseSchema<
|
|
839
|
+
type FormSwitchValidateOnSetter<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = Setter<ValidateStrategy | Partial<FormSwitchConciseSchema<GetFormParam<TKind, "validateOn.setter">, Setter<ValidateStrategy | FormSwitchBranchUnion<TKind, TBranches, "validateOn.setter">, [
|
|
848
840
|
FormSwitchBranchUnion<TKind, TBranches, "validateOn.schema.verbose">
|
|
849
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
841
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "validateOn.setter">, Setter<ValidateStrategy | Partial<GetFormSwitchBranchesParam<TBranches, "validateOn.setter">>, [
|
|
850
842
|
GetFormSwitchBranchesParam<TBranches, "validateOn.schema.verbose">
|
|
851
843
|
]>>>, [
|
|
852
844
|
FormSwitchValidateOnVerbose<TKind, TBranches>
|
|
@@ -856,7 +848,7 @@ type FormSwitchActiveBranch<TBranches extends FormSwitchBranches<SignalForm>> =
|
|
|
856
848
|
[TBranch in keyof TBranches]: FormSwitchBranch<TBranch, TBranches[TBranch]>;
|
|
857
849
|
}[keyof TBranches];
|
|
858
850
|
|
|
859
|
-
type FormSwitchConciseParam<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams, TConcise> = TConcise | FormSwitchConciseSchema<TConcise |
|
|
851
|
+
type FormSwitchConciseParam<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams, TConcise> = TConcise | FormSwitchConciseSchema<TConcise | GetFormParam<TKind, TKey>, TConcise | FormSwitchBranchUnion<TKind, TBranches, TKey>>;
|
|
860
852
|
|
|
861
853
|
type FormSwitchError<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchConciseParam<TKind, TBranches, "error.schema", null>;
|
|
862
854
|
|
|
@@ -885,77 +877,76 @@ interface FormSwitchParams<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
885
877
|
}
|
|
886
878
|
|
|
887
879
|
type FormSwitchStateBranches<TBranches> = {
|
|
888
|
-
[TBranch in keyof TBranches]: SignalFormState<
|
|
880
|
+
[TBranch in keyof TBranches]: SignalFormState<GetFormParams<TBranches[TBranch]>>;
|
|
889
881
|
};
|
|
890
882
|
type ActiveSwitchStateBranch<TBranches> = FormSwitchBranch<keyof TBranches, FormSwitchStateBranches<TBranches>[keyof TBranches]>;
|
|
891
883
|
declare class FormSwitchState<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> extends SignalFormState<FormSwitchParams<TKind, TBranches>> {
|
|
892
884
|
readonly _host: Lazy<FormSwitch$1<TKind, TBranches>>;
|
|
893
|
-
readonly _active: SignalFormState<
|
|
885
|
+
readonly _active: SignalFormState<GetFormParams<TKind>>;
|
|
894
886
|
readonly _branches: FormSwitchStateBranches<TBranches>;
|
|
895
|
-
constructor(parent: null | SignalFormState, active: SignalFormState<
|
|
887
|
+
constructor(parent: null | SignalFormState, active: SignalFormState<GetFormParams<TKind>>, branches: FormSwitchStateBranches<TBranches>);
|
|
896
888
|
_getActiveBranch(monitor: Monitor): undefined | ActiveSwitchStateBranch<TBranches>;
|
|
897
889
|
private _toConcise;
|
|
898
890
|
private _toVerbose;
|
|
899
891
|
_childOf(parent: null | SignalFormState): FormSwitchState<TKind, TBranches>;
|
|
900
892
|
readonly _initial: _owanturist_signal.ReadonlySignal<{
|
|
901
|
-
readonly active:
|
|
902
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
893
|
+
readonly active: GetFormParam<TKind, "input.schema">;
|
|
894
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "input.schema">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "input.schema">; }[K]; };
|
|
903
895
|
}>;
|
|
904
896
|
_setInitial(monitor: Monitor, setter: FormSwitchInputSetter<TKind, TBranches>): void;
|
|
905
|
-
|
|
897
|
+
_patchInitial(monitor: Monitor, initial: FormSwitchInput<TKind, TBranches>): void;
|
|
906
898
|
readonly _input: _owanturist_signal.ReadonlySignal<{
|
|
907
|
-
readonly active:
|
|
908
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
899
|
+
readonly active: GetFormParam<TKind, "input.schema">;
|
|
900
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "input.schema">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "input.schema">; }[K]; };
|
|
909
901
|
}>;
|
|
910
902
|
_setInput(monitor: Monitor, setter: FormSwitchInputSetter<TKind, TBranches>): void;
|
|
911
903
|
readonly _error: _owanturist_signal.ReadonlySignal<FormSwitchError<TKind, TBranches>>;
|
|
912
904
|
readonly _errorVerbose: _owanturist_signal.ReadonlySignal<{
|
|
913
|
-
readonly active:
|
|
914
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
905
|
+
readonly active: GetFormParam<TKind, "error.schema.verbose">;
|
|
906
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "error.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "error.schema.verbose">; }[K]; };
|
|
915
907
|
}>;
|
|
916
908
|
_setError(monitor: Monitor, setter: FormSwitchErrorSetter<TKind, TBranches>): void;
|
|
917
909
|
readonly _validateOn: _owanturist_signal.ReadonlySignal<FormSwitchValidateOn<TKind, TBranches>>;
|
|
918
910
|
readonly _validateOnVerbose: _owanturist_signal.ReadonlySignal<{
|
|
919
|
-
readonly active:
|
|
920
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
911
|
+
readonly active: GetFormParam<TKind, "validateOn.schema.verbose">;
|
|
912
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "validateOn.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "validateOn.schema.verbose">; }[K]; };
|
|
921
913
|
}>;
|
|
922
914
|
_setValidateOn(monitor: Monitor, setter: FormSwitchValidateOnSetter<TKind, TBranches>): void;
|
|
923
915
|
readonly _touched: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
924
916
|
readonly _touchedVerbose: _owanturist_signal.ReadonlySignal<{
|
|
925
|
-
readonly active:
|
|
926
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
917
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
918
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
927
919
|
}>;
|
|
928
920
|
_setTouched(monitor: Monitor, setter: FormSwitchFlagSetter<TKind, TBranches>): void;
|
|
929
921
|
readonly _output: _owanturist_signal.ReadonlySignal<FormSwitchOutput<TKind, TBranches> | null>;
|
|
930
922
|
readonly _outputVerbose: _owanturist_signal.ReadonlySignal<{
|
|
931
|
-
readonly active:
|
|
932
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
923
|
+
readonly active: GetFormParam<TKind, "output.schema.verbose">;
|
|
924
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "output.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "output.schema.verbose">; }[K]; };
|
|
933
925
|
}>;
|
|
934
926
|
readonly _valid: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
935
927
|
readonly _validVerbose: _owanturist_signal.ReadonlySignal<{
|
|
936
|
-
readonly active:
|
|
937
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
928
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
929
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
938
930
|
}>;
|
|
939
931
|
readonly _invalid: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
940
932
|
readonly _invalidVerbose: _owanturist_signal.ReadonlySignal<{
|
|
941
|
-
readonly active:
|
|
942
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
933
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
934
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
943
935
|
}>;
|
|
944
936
|
readonly _validated: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
945
937
|
readonly _validatedVerbose: _owanturist_signal.ReadonlySignal<{
|
|
946
|
-
readonly active:
|
|
947
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
938
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
939
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
948
940
|
}>;
|
|
949
941
|
_forceValidated(monitor: Monitor): void;
|
|
950
942
|
readonly _dirty: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
951
943
|
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<{
|
|
952
|
-
readonly active:
|
|
953
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
944
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
945
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
954
946
|
}>;
|
|
955
|
-
readonly _dirtyOn: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
956
947
|
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<{
|
|
957
|
-
readonly active:
|
|
958
|
-
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]:
|
|
948
|
+
readonly active: GetFormParam<TKind, "flag.schema.verbose">;
|
|
949
|
+
readonly branches: { [K in keyof { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }]: { readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], "flag.schema.verbose">; }[K]; };
|
|
959
950
|
}>;
|
|
960
951
|
_reset(monitor: Monitor, resetter: undefined | FormSwitchInputSetter<TKind, TBranches>): void;
|
|
961
952
|
_getChildren<TChildParams extends SignalFormParams>(monitor: Monitor): ReadonlyArray<SignalFormChild<TChildParams, FormSwitchParams<TKind, TBranches>>>;
|
|
@@ -978,8 +969,8 @@ interface FormSwitchOptions<TKind extends SignalForm, TBranches extends FormSwit
|
|
|
978
969
|
error?: FormSwitchErrorSetter<TKind, TBranches>;
|
|
979
970
|
}
|
|
980
971
|
type FormSwitch<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitch$1<TKind, TBranches>;
|
|
981
|
-
declare function FormSwitch<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>>(active: TKind, branches: IsEqualType<
|
|
972
|
+
declare function FormSwitch<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>>(active: TKind, branches: IsEqualType<GetFormParam<TKind, "output.schema">, keyof TBranches> extends true ? TBranches : never, { input, initial, touched, validateOn, error }?: FormSwitchOptions<TKind, TBranches>): FormSwitch<TKind, TBranches>;
|
|
982
973
|
|
|
983
974
|
declare function isFormSwitch(anything: unknown): anything is FormSwitch$1<SignalForm, FormSwitchBranches<SignalForm>>;
|
|
984
975
|
|
|
985
|
-
export { FormList, type FormListError, type FormListErrorSetter, type FormListErrorVerbose, type FormListFlag, type FormListFlagSetter, type FormListFlagVerbose, type FormListInput, type FormListInputSetter, type FormListOptions, type FormListOutput, type FormListOutputVerbose, type FormListParams, type FormListValidateOn, type FormListValidateOnSetter, type FormListValidateOnVerbose,
|
|
976
|
+
export { FormList, type FormListElementFactory, type FormListError, type FormListErrorSetter, type FormListErrorVerbose, type FormListFlag, type FormListFlagSetter, type FormListFlagVerbose, type FormListInput, type FormListInputSetter, type FormListOptions, type FormListOutput, type FormListOutputVerbose, type FormListParams, type FormListValidateOn, type FormListValidateOnSetter, type FormListValidateOnVerbose, FormOptional, type FormOptionalError, type FormOptionalErrorSetter, type FormOptionalErrorVerbose, type FormOptionalFlag, type FormOptionalFlagSetter, type FormOptionalFlagVerbose, type FormOptionalInput, type FormOptionalInputSetter, type FormOptionalOptions, type FormOptionalOutput, type FormOptionalOutputVerbose, type FormOptionalParams, type FormOptionalSchema, type FormOptionalValidateOn, type FormOptionalValidateOnSetter, type FormOptionalValidateOnVerbose, FormShape, type FormShapeError, type FormShapeErrorSetter, type FormShapeErrorVerbose, type FormShapeFields, type FormShapeFlag, type FormShapeFlagSetter, type FormShapeFlagVerbose, type FormShapeInput, type FormShapeInputSetter, type FormShapeOptions, type FormShapeOutput, type FormShapeOutputVerbose, type FormShapeParams, type FormShapeValidateOn, type FormShapeValidateOnSetter, type FormShapeValidateOnVerbose, FormSwitch, type FormSwitchActiveBranch, type FormSwitchBranch, type FormSwitchBranches, type FormSwitchConciseSchema, type FormSwitchError, type FormSwitchErrorSetter, type FormSwitchErrorVerbose, type FormSwitchFlag, type FormSwitchFlagSetter, type FormSwitchFlagVerbose, type FormSwitchInput, type FormSwitchInputSetter, type FormSwitchOptions, type FormSwitchOutput, type FormSwitchOutputVerbose, type FormSwitchParams, type FormSwitchValidateOn, type FormSwitchValidateOnSetter, type FormSwitchValidateOnVerbose, type FormSwitchVerboseSchema, FormUnit, type FormUnitErrorSetter, type FormUnitFlagSetter, type FormUnitInputSetter, type FormUnitOptions, type FormUnitParams, type FormUnitSchemaOptions, type FormUnitTransformedOptions, type FormUnitTransformer, type FormUnitValidateOnSetter, type FormUnitValidatedOptions, type FormUnitValidator, type GetFormError, type GetFormErrorSetter, type GetFormErrorVerbose, type GetFormFlag, type GetFormFlagSetter, type GetFormFlagVerbose, type GetFormInput, type GetFormInputSetter, type GetFormOutput, type GetFormOutputVerbose, type GetFormParam, type GetFormShapeParam, type GetFormSwitchBranchesParam, type GetFormValidateOn, type GetFormValidateOnSetter, type GetFormValidateOnVerbose, type Result, SignalForm, type SignalFormParams, VALIDATE_ON_CHANGE, VALIDATE_ON_INIT, VALIDATE_ON_SUBMIT, VALIDATE_ON_TOUCH, type ValidateStrategy, type ZodLikeError, type ZodLikeIssue, type ZodLikeSafeParseResult, type ZodLikeSchema, isFormList, isFormOptional, isFormShape, isFormSwitch, isFormUnit, isSignalForm, zodLikeParse };
|