@owanturist/signal-form 0.2.0 → 0.4.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.map +1 -1
- package/dist/index.d.cts +93 -93
- package/dist/index.d.ts +93 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -130,35 +130,35 @@ declare abstract class SignalForm<TParams extends SignalFormParams = any> {
|
|
|
130
130
|
submit(): Promise<void>;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
type
|
|
133
|
+
type GetFormParams<TTarget> = TTarget extends SignalForm<infer TParams> ? TParams : never;
|
|
134
134
|
|
|
135
|
-
type
|
|
135
|
+
type GetFormParam<TTarget, TKey extends keyof SignalFormParams> = GetFormParams<TTarget>[TKey];
|
|
136
136
|
|
|
137
|
-
type
|
|
137
|
+
type GetFormError<TForm extends SignalForm> = GetFormParam<TForm, "error.schema">;
|
|
138
138
|
|
|
139
|
-
type
|
|
139
|
+
type GetFormErrorSetter<TForm extends SignalForm> = GetFormParam<TForm, "error.setter">;
|
|
140
140
|
|
|
141
|
-
type
|
|
141
|
+
type GetFormErrorVerbose<TForm extends SignalForm> = GetFormParam<TForm, "error.schema.verbose">;
|
|
142
142
|
|
|
143
|
-
type
|
|
143
|
+
type GetFormFlag<TForm extends SignalForm> = GetFormParam<TForm, "flag.schema">;
|
|
144
144
|
|
|
145
|
-
type
|
|
145
|
+
type GetFormFlagSetter<TForm extends SignalForm> = GetFormParam<TForm, "flag.setter">;
|
|
146
146
|
|
|
147
|
-
type
|
|
147
|
+
type GetFormFlagVerbose<TForm extends SignalForm> = GetFormParam<TForm, "flag.schema.verbose">;
|
|
148
148
|
|
|
149
|
-
type
|
|
149
|
+
type GetFormInput<TForm extends SignalForm> = GetFormParam<TForm, "input.schema">;
|
|
150
150
|
|
|
151
|
-
type
|
|
151
|
+
type GetFormInputSetter<TForm extends SignalForm> = GetFormParam<TForm, "input.setter">;
|
|
152
152
|
|
|
153
|
-
type
|
|
153
|
+
type GetFormOutput<TForm extends SignalForm> = GetFormParam<TForm, "output.schema">;
|
|
154
154
|
|
|
155
|
-
type
|
|
155
|
+
type GetFormOutputVerbose<TForm extends SignalForm> = GetFormParam<TForm, "output.schema.verbose">;
|
|
156
156
|
|
|
157
|
-
type
|
|
157
|
+
type GetFormValidateOn<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.schema">;
|
|
158
158
|
|
|
159
|
-
type
|
|
159
|
+
type GetFormValidateOnSetter<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.setter">;
|
|
160
160
|
|
|
161
|
-
type
|
|
161
|
+
type GetFormValidateOnVerbose<TForm extends SignalForm> = GetFormParam<TForm, "validateOn.schema.verbose">;
|
|
162
162
|
|
|
163
163
|
declare function isSignalForm(value: unknown): value is SignalForm;
|
|
164
164
|
|
|
@@ -422,7 +422,7 @@ type FormShapeFields<TFields = Record<string, SignalForm>> = {
|
|
|
422
422
|
};
|
|
423
423
|
|
|
424
424
|
type GetFormShapeParam<TFields extends FormShapeFields<TFields>, TKey extends keyof SignalFormParams> = {
|
|
425
|
-
readonly [TField in keyof TFields]:
|
|
425
|
+
readonly [TField in keyof TFields]: GetFormParam<TFields[TField], TKey>;
|
|
426
426
|
};
|
|
427
427
|
|
|
428
428
|
type FormShapeErrorVerbose<TFields extends FormShapeFields<TFields>> = GetFormShapeParam<TFields, "error.schema.verbose">;
|
|
@@ -477,7 +477,7 @@ interface FormShapeParams<TFields extends FormShapeFields<TFields>> extends Sign
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
type FormShapeStateFields<TFields extends FormShapeFields<TFields>> = {
|
|
480
|
-
[TField in keyof TFields]: SignalFormState<
|
|
480
|
+
[TField in keyof TFields]: SignalFormState<GetFormParams<TFields[TField]>>;
|
|
481
481
|
};
|
|
482
482
|
declare class FormShapeState<TFields extends FormShapeFields<TFields> = Record<string, SignalForm>> extends SignalFormState<FormShapeParams<TFields>> {
|
|
483
483
|
readonly _host: Lazy<FormShape$1<TFields>>;
|
|
@@ -533,40 +533,40 @@ declare function FormShape<TFields extends FormShapeFields<TFields>>(fields: TFi
|
|
|
533
533
|
|
|
534
534
|
declare function isFormShape(value: unknown): value is FormShape$1<FormShapeFields>;
|
|
535
535
|
|
|
536
|
-
type FormListErrorVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
536
|
+
type FormListErrorVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormErrorVerbose<TElement>>;
|
|
537
537
|
|
|
538
|
-
type FormListErrorSetter<TElement extends SignalForm> = Setter<null | ReadonlyArray<undefined |
|
|
538
|
+
type FormListErrorSetter<TElement extends SignalForm> = Setter<null | ReadonlyArray<undefined | GetFormErrorSetter<TElement>>, [
|
|
539
539
|
FormListErrorVerbose<TElement>
|
|
540
540
|
]>;
|
|
541
541
|
|
|
542
|
-
type FormListFlagVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
542
|
+
type FormListFlagVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormFlagVerbose<TElement>>;
|
|
543
543
|
|
|
544
|
-
type FormListFlagSetter<TElement extends SignalForm> = Setter<boolean | ReadonlyArray<undefined |
|
|
544
|
+
type FormListFlagSetter<TElement extends SignalForm> = Setter<boolean | ReadonlyArray<undefined | GetFormFlagSetter<TElement>>, [
|
|
545
545
|
FormListFlagVerbose<TElement>
|
|
546
546
|
]>;
|
|
547
547
|
|
|
548
|
-
type FormListInput<TElement extends SignalForm> = ReadonlyArray<
|
|
548
|
+
type FormListInput<TElement extends SignalForm> = ReadonlyArray<GetFormInput<TElement>>;
|
|
549
549
|
|
|
550
|
-
type
|
|
551
|
-
FormListInput<TElement>,
|
|
552
|
-
FormListInput<TElement>
|
|
553
|
-
]>;
|
|
554
|
-
|
|
555
|
-
type FormListValidateOnVerbose<TElement extends SignalForm> = ReadonlyArray<GetSignalFormValidateOnVerbose<TElement>>;
|
|
550
|
+
type FormListValidateOnVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormValidateOnVerbose<TElement>>;
|
|
556
551
|
|
|
557
|
-
type FormListValidateOnSetter<TElement extends SignalForm> = Setter<ValidateStrategy | ReadonlyArray<undefined |
|
|
552
|
+
type FormListValidateOnSetter<TElement extends SignalForm> = Setter<ValidateStrategy | ReadonlyArray<undefined | GetFormValidateOnSetter<TElement>>, [
|
|
558
553
|
FormListValidateOnVerbose<TElement>
|
|
559
554
|
]>;
|
|
560
555
|
|
|
561
|
-
type FormListError<TElement extends SignalForm> = null | ReadonlyArray<
|
|
556
|
+
type FormListError<TElement extends SignalForm> = null | ReadonlyArray<GetFormError<TElement>>;
|
|
562
557
|
|
|
563
|
-
type FormListFlag<TElement extends SignalForm> = boolean | ReadonlyArray<
|
|
558
|
+
type FormListFlag<TElement extends SignalForm> = boolean | ReadonlyArray<GetFormFlag<TElement>>;
|
|
559
|
+
|
|
560
|
+
type FormListInputSetter<TElement extends SignalForm> = Setter<ReadonlyArray<GetFormInputSetter<TElement>>, [
|
|
561
|
+
FormListInput<TElement>,
|
|
562
|
+
FormListInput<TElement>
|
|
563
|
+
]>;
|
|
564
564
|
|
|
565
|
-
type FormListOutput<TElement extends SignalForm> = ReadonlyArray<
|
|
565
|
+
type FormListOutput<TElement extends SignalForm> = ReadonlyArray<GetFormOutput<TElement>>;
|
|
566
566
|
|
|
567
|
-
type FormListOutputVerbose<TElement extends SignalForm> = ReadonlyArray<
|
|
567
|
+
type FormListOutputVerbose<TElement extends SignalForm> = ReadonlyArray<GetFormOutputVerbose<TElement>>;
|
|
568
568
|
|
|
569
|
-
type FormListValidateOn<TElement extends SignalForm> = ValidateStrategy | ReadonlyArray<
|
|
569
|
+
type FormListValidateOn<TElement extends SignalForm> = ValidateStrategy | ReadonlyArray<GetFormValidateOn<TElement>>;
|
|
570
570
|
|
|
571
571
|
interface FormListParams<TElement extends SignalForm> extends SignalFormParams {
|
|
572
572
|
"input.schema": FormListInput<TElement>;
|
|
@@ -584,13 +584,13 @@ interface FormListParams<TElement extends SignalForm> extends SignalFormParams {
|
|
|
584
584
|
"error.schema.verbose": FormListErrorVerbose<TElement>;
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
type FormListElementFactoryInternal<TElement extends SignalForm> = (input:
|
|
587
|
+
type FormListElementFactoryInternal<TElement extends SignalForm> = (input: GetFormInput<TElement>, index: number) => SignalFormState<GetFormParams<TElement>>;
|
|
588
588
|
declare class FormListState<TElement extends SignalForm = SignalForm> extends SignalFormState<FormListParams<TElement>> {
|
|
589
589
|
private readonly _factory;
|
|
590
|
-
readonly _initialInputs: Signal<ReadonlyArray<
|
|
590
|
+
readonly _initialInputs: Signal<ReadonlyArray<GetFormInput<TElement>>>;
|
|
591
591
|
readonly _host: Lazy<FormList$1<TElement>>;
|
|
592
|
-
readonly _elements: Signal<ReadonlyArray<SignalFormState<
|
|
593
|
-
constructor(parent: null | SignalFormState, _factory: FormListElementFactoryInternal<TElement>, _initialInputs: Signal<ReadonlyArray<
|
|
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>>>);
|
|
594
594
|
_childOf(parent: null | SignalFormState): FormListState<TElement>;
|
|
595
595
|
_getElements(monitor: Monitor): ReadonlyArray<TElement>;
|
|
596
596
|
readonly _initial: _owanturist_signal.ReadonlySignal<FormListInput<TElement>>;
|
|
@@ -633,16 +633,16 @@ declare class FormList$1<TElement extends SignalForm> extends SignalForm<FormLis
|
|
|
633
633
|
setElements(setter: Setter<ReadonlyArray<TElement>, [ReadonlyArray<TElement>, Monitor]>): void;
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
-
type FormListElementFactory<TElement extends SignalForm> = (input:
|
|
636
|
+
type FormListElementFactory<TElement extends SignalForm> = (input: GetFormInput<TElement>, index: number) => TElement;
|
|
637
637
|
interface FormListOptions<TElement extends SignalForm> {
|
|
638
638
|
/**
|
|
639
639
|
* @default []
|
|
640
640
|
*/
|
|
641
|
-
readonly initial?:
|
|
641
|
+
readonly initial?: FormListInput<TElement>;
|
|
642
642
|
/**
|
|
643
643
|
* @default {@link initial}
|
|
644
644
|
*/
|
|
645
|
-
readonly input?:
|
|
645
|
+
readonly input?: FormListInput<TElement>;
|
|
646
646
|
readonly touched?: FormListFlagSetter<TElement>;
|
|
647
647
|
readonly validateOn?: FormListValidateOnSetter<TElement>;
|
|
648
648
|
readonly error?: FormListErrorSetter<TElement>;
|
|
@@ -659,30 +659,30 @@ interface FormOptionalSchema<TEnabled, TElement> {
|
|
|
659
659
|
readonly element: TElement;
|
|
660
660
|
}
|
|
661
661
|
|
|
662
|
-
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>>;
|
|
663
663
|
|
|
664
664
|
type FormOptionalErrorVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "error.schema.verbose">;
|
|
665
665
|
|
|
666
|
-
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">>>, [
|
|
667
667
|
FormOptionalErrorVerbose<TEnabled, TElement>
|
|
668
668
|
]>;
|
|
669
669
|
|
|
670
670
|
type FormOptionalFlagVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "flag.schema.verbose">;
|
|
671
671
|
|
|
672
|
-
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">>>, [
|
|
673
673
|
FormOptionalFlagVerbose<TEnabled, TElement>
|
|
674
674
|
]>;
|
|
675
675
|
|
|
676
|
-
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">>;
|
|
677
677
|
|
|
678
|
-
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">>>, [
|
|
679
679
|
FormOptionalInput<TEnabled, TElement>,
|
|
680
680
|
FormOptionalInput<TEnabled, TElement>
|
|
681
681
|
]>;
|
|
682
682
|
|
|
683
683
|
type FormOptionalValidateOnVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "validateOn.schema.verbose">;
|
|
684
684
|
|
|
685
|
-
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">>>, [
|
|
686
686
|
FormOptionalValidateOnVerbose<TEnabled, TElement>
|
|
687
687
|
]>;
|
|
688
688
|
|
|
@@ -690,7 +690,7 @@ type FormOptionalError<TEnabled extends SignalForm, TElement extends SignalForm>
|
|
|
690
690
|
|
|
691
691
|
type FormOptionalFlag<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "flag.schema", boolean>;
|
|
692
692
|
|
|
693
|
-
type FormOptionalOutput<TElement extends SignalForm> = undefined |
|
|
693
|
+
type FormOptionalOutput<TElement extends SignalForm> = undefined | GetFormParam<TElement, "output.schema">;
|
|
694
694
|
|
|
695
695
|
type FormOptionalOutputVerbose<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptionalParam<TEnabled, TElement, "output.schema.verbose">;
|
|
696
696
|
|
|
@@ -714,11 +714,11 @@ interface FormOptionalParams<TEnabled extends SignalForm, TElement extends Signa
|
|
|
714
714
|
|
|
715
715
|
declare class FormOptionalState<TEnabled extends SignalForm, TElement extends SignalForm> extends SignalFormState<FormOptionalParams<TEnabled, TElement>> {
|
|
716
716
|
readonly _host: Lazy<FormOptional$1<TEnabled, TElement>>;
|
|
717
|
-
readonly _enabled: SignalFormState<
|
|
718
|
-
readonly _element: SignalFormState<
|
|
719
|
-
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>>);
|
|
720
720
|
private _isEnabled;
|
|
721
|
-
_getEnabledElement(monitor: Monitor): undefined | SignalFormState<
|
|
721
|
+
_getEnabledElement(monitor: Monitor): undefined | SignalFormState<GetFormParams<TElement>>;
|
|
722
722
|
_childOf(parent: null | SignalFormState): FormOptionalState<TEnabled, TElement>;
|
|
723
723
|
private _toConcise;
|
|
724
724
|
private _toVerbose;
|
|
@@ -769,11 +769,11 @@ interface FormOptionalOptions<TEnabled extends SignalForm, TElement extends Sign
|
|
|
769
769
|
error?: FormOptionalErrorSetter<TEnabled, TElement>;
|
|
770
770
|
}
|
|
771
771
|
type FormOptional<TEnabled extends SignalForm, TElement extends SignalForm> = FormOptional$1<TEnabled, TElement>;
|
|
772
|
-
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>;
|
|
773
773
|
|
|
774
774
|
declare function isFormOptional(anything: unknown): anything is FormOptional$1<SignalForm, SignalForm>;
|
|
775
775
|
|
|
776
|
-
type FormSwitchBranches<TKind extends SignalForm> =
|
|
776
|
+
type FormSwitchBranches<TKind extends SignalForm> = GetFormParam<TKind, "output.schema"> extends string ? Record<GetFormParam<TKind, "output.schema">, SignalForm> : never;
|
|
777
777
|
|
|
778
778
|
interface FormSwitchConciseSchema<TActive, TBranch> {
|
|
779
779
|
readonly active: TActive;
|
|
@@ -790,10 +790,10 @@ interface FormSwitchVerboseSchema<TActive, TBranches> {
|
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
type GetFormSwitchBranchesParam<TBranches extends FormSwitchBranches<SignalForm>, TKey extends keyof SignalFormParams> = Compute<{
|
|
793
|
-
readonly [TBranch in keyof TBranches]:
|
|
793
|
+
readonly [TBranch in keyof TBranches]: GetFormParam<TBranches[TBranch], TKey>;
|
|
794
794
|
}>;
|
|
795
795
|
|
|
796
|
-
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>>>;
|
|
797
797
|
|
|
798
798
|
type FormSwitchErrorVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "error.schema.verbose">;
|
|
799
799
|
|
|
@@ -803,12 +803,12 @@ interface FormSwitchBranch<TKind, TValue> {
|
|
|
803
803
|
}
|
|
804
804
|
|
|
805
805
|
type FormSwitchBranchUnion<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>, TKey extends keyof SignalFormParams> = {
|
|
806
|
-
[TBranch in
|
|
807
|
-
}[
|
|
806
|
+
[TBranch in GetFormOutput<TKind>]: FormSwitchBranch<TBranch, GetFormParam<TBranches[TBranch], TKey>>;
|
|
807
|
+
}[GetFormOutput<TKind>];
|
|
808
808
|
|
|
809
|
-
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">, [
|
|
810
810
|
FormSwitchBranchUnion<TKind, TBranches, "error.schema.verbose">
|
|
811
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
811
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "error.setter">, Setter<null | Partial<GetFormSwitchBranchesParam<TBranches, "error.setter">>, [
|
|
812
812
|
GetFormSwitchBranchesParam<TBranches, "error.schema.verbose">
|
|
813
813
|
]>>>, [
|
|
814
814
|
FormSwitchErrorVerbose<TKind, TBranches>
|
|
@@ -816,9 +816,9 @@ type FormSwitchErrorSetter<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
816
816
|
|
|
817
817
|
type FormSwitchFlagVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "flag.schema.verbose">;
|
|
818
818
|
|
|
819
|
-
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">, [
|
|
820
820
|
FormSwitchBranchUnion<TKind, TBranches, "flag.schema.verbose">
|
|
821
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
821
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "flag.setter">, Setter<boolean | Partial<GetFormSwitchBranchesParam<TBranches, "flag.setter">>, [
|
|
822
822
|
GetFormSwitchBranchesParam<TBranches, "flag.schema.verbose">
|
|
823
823
|
]>>>, [
|
|
824
824
|
FormSwitchFlagVerbose<TKind, TBranches>
|
|
@@ -826,7 +826,7 @@ type FormSwitchFlagSetter<TKind extends SignalForm, TBranches extends FormSwitch
|
|
|
826
826
|
|
|
827
827
|
type FormSwitchInput<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "input.schema">;
|
|
828
828
|
|
|
829
|
-
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">>, [
|
|
830
830
|
GetFormSwitchBranchesParam<TBranches, "input.schema">,
|
|
831
831
|
GetFormSwitchBranchesParam<TBranches, "input.schema">
|
|
832
832
|
]>>>, [
|
|
@@ -836,9 +836,9 @@ type FormSwitchInputSetter<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
836
836
|
|
|
837
837
|
type FormSwitchValidateOnVerbose<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchVerboseParam<TKind, TBranches, "validateOn.schema.verbose">;
|
|
838
838
|
|
|
839
|
-
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">, [
|
|
840
840
|
FormSwitchBranchUnion<TKind, TBranches, "validateOn.schema.verbose">
|
|
841
|
-
]>>> | Partial<FormSwitchVerboseSchema<
|
|
841
|
+
]>>> | Partial<FormSwitchVerboseSchema<GetFormParam<TKind, "validateOn.setter">, Setter<ValidateStrategy | Partial<GetFormSwitchBranchesParam<TBranches, "validateOn.setter">>, [
|
|
842
842
|
GetFormSwitchBranchesParam<TBranches, "validateOn.schema.verbose">
|
|
843
843
|
]>>>, [
|
|
844
844
|
FormSwitchValidateOnVerbose<TKind, TBranches>
|
|
@@ -848,7 +848,7 @@ type FormSwitchActiveBranch<TBranches extends FormSwitchBranches<SignalForm>> =
|
|
|
848
848
|
[TBranch in keyof TBranches]: FormSwitchBranch<TBranch, TBranches[TBranch]>;
|
|
849
849
|
}[keyof TBranches];
|
|
850
850
|
|
|
851
|
-
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>>;
|
|
852
852
|
|
|
853
853
|
type FormSwitchError<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitchConciseParam<TKind, TBranches, "error.schema", null>;
|
|
854
854
|
|
|
@@ -877,76 +877,76 @@ interface FormSwitchParams<TKind extends SignalForm, TBranches extends FormSwitc
|
|
|
877
877
|
}
|
|
878
878
|
|
|
879
879
|
type FormSwitchStateBranches<TBranches> = {
|
|
880
|
-
[TBranch in keyof TBranches]: SignalFormState<
|
|
880
|
+
[TBranch in keyof TBranches]: SignalFormState<GetFormParams<TBranches[TBranch]>>;
|
|
881
881
|
};
|
|
882
882
|
type ActiveSwitchStateBranch<TBranches> = FormSwitchBranch<keyof TBranches, FormSwitchStateBranches<TBranches>[keyof TBranches]>;
|
|
883
883
|
declare class FormSwitchState<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> extends SignalFormState<FormSwitchParams<TKind, TBranches>> {
|
|
884
884
|
readonly _host: Lazy<FormSwitch$1<TKind, TBranches>>;
|
|
885
|
-
readonly _active: SignalFormState<
|
|
885
|
+
readonly _active: SignalFormState<GetFormParams<TKind>>;
|
|
886
886
|
readonly _branches: FormSwitchStateBranches<TBranches>;
|
|
887
|
-
constructor(parent: null | SignalFormState, active: SignalFormState<
|
|
887
|
+
constructor(parent: null | SignalFormState, active: SignalFormState<GetFormParams<TKind>>, branches: FormSwitchStateBranches<TBranches>);
|
|
888
888
|
_getActiveBranch(monitor: Monitor): undefined | ActiveSwitchStateBranch<TBranches>;
|
|
889
889
|
private _toConcise;
|
|
890
890
|
private _toVerbose;
|
|
891
891
|
_childOf(parent: null | SignalFormState): FormSwitchState<TKind, TBranches>;
|
|
892
892
|
readonly _initial: _owanturist_signal.ReadonlySignal<{
|
|
893
|
-
readonly active:
|
|
894
|
-
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]; };
|
|
895
895
|
}>;
|
|
896
896
|
_setInitial(monitor: Monitor, setter: FormSwitchInputSetter<TKind, TBranches>): void;
|
|
897
897
|
_patchInitial(monitor: Monitor, initial: FormSwitchInput<TKind, TBranches>): void;
|
|
898
898
|
readonly _input: _owanturist_signal.ReadonlySignal<{
|
|
899
|
-
readonly active:
|
|
900
|
-
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]; };
|
|
901
901
|
}>;
|
|
902
902
|
_setInput(monitor: Monitor, setter: FormSwitchInputSetter<TKind, TBranches>): void;
|
|
903
903
|
readonly _error: _owanturist_signal.ReadonlySignal<FormSwitchError<TKind, TBranches>>;
|
|
904
904
|
readonly _errorVerbose: _owanturist_signal.ReadonlySignal<{
|
|
905
|
-
readonly active:
|
|
906
|
-
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]; };
|
|
907
907
|
}>;
|
|
908
908
|
_setError(monitor: Monitor, setter: FormSwitchErrorSetter<TKind, TBranches>): void;
|
|
909
909
|
readonly _validateOn: _owanturist_signal.ReadonlySignal<FormSwitchValidateOn<TKind, TBranches>>;
|
|
910
910
|
readonly _validateOnVerbose: _owanturist_signal.ReadonlySignal<{
|
|
911
|
-
readonly active:
|
|
912
|
-
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]; };
|
|
913
913
|
}>;
|
|
914
914
|
_setValidateOn(monitor: Monitor, setter: FormSwitchValidateOnSetter<TKind, TBranches>): void;
|
|
915
915
|
readonly _touched: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
916
916
|
readonly _touchedVerbose: _owanturist_signal.ReadonlySignal<{
|
|
917
|
-
readonly active:
|
|
918
|
-
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]; };
|
|
919
919
|
}>;
|
|
920
920
|
_setTouched(monitor: Monitor, setter: FormSwitchFlagSetter<TKind, TBranches>): void;
|
|
921
921
|
readonly _output: _owanturist_signal.ReadonlySignal<FormSwitchOutput<TKind, TBranches> | null>;
|
|
922
922
|
readonly _outputVerbose: _owanturist_signal.ReadonlySignal<{
|
|
923
|
-
readonly active:
|
|
924
|
-
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]; };
|
|
925
925
|
}>;
|
|
926
926
|
readonly _valid: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
927
927
|
readonly _validVerbose: _owanturist_signal.ReadonlySignal<{
|
|
928
|
-
readonly active:
|
|
929
|
-
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]; };
|
|
930
930
|
}>;
|
|
931
931
|
readonly _invalid: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
932
932
|
readonly _invalidVerbose: _owanturist_signal.ReadonlySignal<{
|
|
933
|
-
readonly active:
|
|
934
|
-
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]; };
|
|
935
935
|
}>;
|
|
936
936
|
readonly _validated: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
937
937
|
readonly _validatedVerbose: _owanturist_signal.ReadonlySignal<{
|
|
938
|
-
readonly active:
|
|
939
|
-
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]; };
|
|
940
940
|
}>;
|
|
941
941
|
_forceValidated(monitor: Monitor): void;
|
|
942
942
|
readonly _dirty: _owanturist_signal.ReadonlySignal<FormSwitchFlag<TKind, TBranches>>;
|
|
943
943
|
readonly _dirtyVerbose: _owanturist_signal.ReadonlySignal<{
|
|
944
|
-
readonly active:
|
|
945
|
-
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]; };
|
|
946
946
|
}>;
|
|
947
947
|
readonly _dirtyOnVerbose: _owanturist_signal.ReadonlySignal<{
|
|
948
|
-
readonly active:
|
|
949
|
-
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]; };
|
|
950
950
|
}>;
|
|
951
951
|
_reset(monitor: Monitor, resetter: undefined | FormSwitchInputSetter<TKind, TBranches>): void;
|
|
952
952
|
_getChildren<TChildParams extends SignalFormParams>(monitor: Monitor): ReadonlyArray<SignalFormChild<TChildParams, FormSwitchParams<TKind, TBranches>>>;
|
|
@@ -969,8 +969,8 @@ interface FormSwitchOptions<TKind extends SignalForm, TBranches extends FormSwit
|
|
|
969
969
|
error?: FormSwitchErrorSetter<TKind, TBranches>;
|
|
970
970
|
}
|
|
971
971
|
type FormSwitch<TKind extends SignalForm, TBranches extends FormSwitchBranches<TKind>> = FormSwitch$1<TKind, TBranches>;
|
|
972
|
-
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>;
|
|
973
973
|
|
|
974
974
|
declare function isFormSwitch(anything: unknown): anything is FormSwitch$1<SignalForm, FormSwitchBranches<SignalForm>>;
|
|
975
975
|
|
|
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
|
|
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 };
|