@builder-builder/builder 0.0.6 → 0.0.8
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/check.d.ts +2 -1
- package/dist/check.js +6 -2
- package/dist/entities/builder/builder.d.ts +494 -0
- package/dist/entities/builder/builder.js +84 -0
- package/dist/entities/builder/builders.d.ts +20 -0
- package/dist/entities/builder/builders.js +18 -0
- package/dist/entities/builder/expectation.d.ts +12 -0
- package/dist/entities/builder/index.d.ts +7 -0
- package/dist/entities/builder/index.js +3 -0
- package/dist/entities/builder/methods.d.ts +58 -0
- package/dist/entities/builder/methods.js +30 -0
- package/dist/entities/builder/parameter.d.ts +61 -0
- package/dist/entities/builder/parameter.js +18 -0
- package/dist/entities/builder/state.d.ts +26 -0
- package/dist/entities/builder/validate.d.ts +3 -0
- package/dist/entities/builder/validate.js +108 -0
- package/dist/entities/collection/collection.d.ts +37 -0
- package/dist/entities/collection/collection.js +42 -0
- package/dist/entities/collection/config.d.ts +1094 -0
- package/dist/entities/collection/config.js +23 -0
- package/dist/entities/collection/expectation.d.ts +7 -0
- package/dist/entities/collection/expectation.js +4 -0
- package/dist/entities/collection/index.d.ts +8 -0
- package/dist/entities/collection/index.js +4 -0
- package/dist/entities/collection/when.d.ts +9 -0
- package/dist/entities/collection/when.js +2 -0
- package/dist/entities/component/component.d.ts +403 -0
- package/dist/entities/component/component.js +24 -0
- package/dist/entities/component/details.d.ts +82 -0
- package/dist/entities/component/details.js +17 -0
- package/dist/entities/component/expectation.d.ts +8 -0
- package/dist/entities/component/expectation.js +7 -0
- package/dist/entities/component/index.d.ts +8 -0
- package/dist/entities/component/index.js +4 -0
- package/dist/entities/component/when.d.ts +11 -0
- package/dist/entities/component/when.js +20 -0
- package/dist/entities/errors.d.ts +21 -0
- package/dist/entities/expectation.d.ts +44 -0
- package/dist/entities/expectation.js +23 -0
- package/dist/entities/index.d.ts +18 -0
- package/dist/entities/index.js +9 -0
- package/dist/entities/option/expectation.d.ts +2 -0
- package/dist/entities/option/expectation.js +4 -0
- package/dist/entities/option/index.d.ts +11 -0
- package/dist/entities/option/index.js +6 -0
- package/dist/entities/option/option.d.ts +347 -0
- package/dist/entities/option/option.js +24 -0
- package/dist/entities/option/select.d.ts +49 -0
- package/dist/entities/option/select.js +40 -0
- package/dist/entities/option/toggle.d.ts +39 -0
- package/dist/entities/option/toggle.js +42 -0
- package/dist/entities/option/values.d.ts +63 -0
- package/dist/entities/option/values.js +8 -0
- package/dist/entities/option/when.d.ts +9 -0
- package/dist/entities/option/when.js +2 -0
- package/dist/entities/serialise.d.ts +3801 -0
- package/dist/entities/serialise.js +41 -0
- package/dist/entities/ui/describe.d.ts +100 -0
- package/dist/entities/ui/describe.js +22 -0
- package/dist/entities/ui/index.d.ts +14 -0
- package/dist/entities/ui/index.js +7 -0
- package/dist/entities/ui/label.d.ts +18 -0
- package/dist/entities/ui/label.js +12 -0
- package/dist/entities/ui/page.d.ts +96 -0
- package/dist/entities/ui/page.js +20 -0
- package/dist/entities/ui/pages.d.ts +431 -0
- package/dist/entities/ui/pages.js +29 -0
- package/dist/entities/ui/parameter.d.ts +7 -0
- package/dist/entities/ui/parameter.js +29 -0
- package/dist/entities/ui/ui.d.ts +1582 -0
- package/dist/entities/ui/ui.js +53 -0
- package/dist/entities/ui/uis.d.ts +10 -0
- package/dist/entities/ui/uis.js +20 -0
- package/dist/entities/ui/validate.d.ts +8 -0
- package/dist/entities/ui/validate.js +21 -0
- package/dist/entities/validate.d.ts +28 -0
- package/dist/entities/validate.js +1 -0
- package/dist/entities/when.d.ts +176 -0
- package/dist/entities/when.js +47 -0
- package/dist/exception.d.ts +8 -0
- package/dist/exception.js +7 -0
- package/dist/index.d.ts +37 -13
- package/dist/index.js +22 -5
- package/dist/mappers/assert/builder.d.ts +2 -0
- package/dist/mappers/assert/builder.js +46 -0
- package/dist/mappers/assert/expectation.d.ts +2 -0
- package/dist/mappers/assert/expectation.js +23 -0
- package/dist/mappers/assert/index.d.ts +6 -0
- package/dist/mappers/assert/index.js +4 -0
- package/dist/mappers/assert/model.d.ts +13 -0
- package/dist/mappers/assert/model.js +47 -0
- package/dist/mappers/assert/models.d.ts +33 -0
- package/dist/mappers/assert/models.js +74 -0
- package/dist/mappers/assert/ui.d.ts +2 -0
- package/dist/mappers/assert/ui.js +22 -0
- package/dist/mappers/index.d.ts +7 -0
- package/dist/mappers/index.js +4 -0
- package/dist/mappers/instance/index.d.ts +1 -0
- package/dist/mappers/instance/index.js +1 -0
- package/dist/mappers/instance/instance.d.ts +4 -0
- package/dist/mappers/instance/instance.js +33 -0
- package/dist/mappers/models/component-graph.d.ts +9 -0
- package/dist/{core/component/graph.js → mappers/models/component-graph.js} +3 -3
- package/dist/{core → mappers/models}/graph.d.ts +4 -1
- package/dist/mappers/models/graph.js +17 -0
- package/dist/mappers/models/index.d.ts +1 -0
- package/dist/mappers/models/index.js +1 -0
- package/dist/mappers/models/models.d.ts +3 -0
- package/dist/mappers/models/models.js +37 -0
- package/dist/mappers/models/option-graph.d.ts +9 -0
- package/dist/mappers/models/option-graph.js +77 -0
- package/dist/mappers/order/index.d.ts +2 -0
- package/dist/mappers/order/index.js +1 -0
- package/dist/mappers/order/order.d.ts +14 -0
- package/dist/mappers/order/order.js +31 -0
- package/dist/mappers/render/index.d.ts +4 -0
- package/dist/mappers/render/index.js +2 -0
- package/dist/mappers/render/ordinal.d.ts +1 -0
- package/dist/mappers/render/ordinal.js +20 -0
- package/dist/mappers/render/pages.d.ts +15 -0
- package/dist/mappers/render/pages.js +1 -0
- package/dist/mappers/render/render.d.ts +8 -0
- package/dist/mappers/render/render.js +124 -0
- package/dist/mappers/resolve.d.ts +9 -0
- package/dist/mappers/resolve.js +57 -0
- package/dist/model.d.ts +8 -8
- package/dist/paths.d.ts +5 -16
- package/dist/paths.js +3 -0
- package/dist/primitive.d.ts +5 -0
- package/dist/{schemas/primitives.js → primitive.js} +0 -2
- package/dist/references.d.ts +60 -0
- package/dist/references.js +26 -0
- package/dist/serialisable.d.ts +10 -0
- package/dist/serialisable.js +5 -0
- package/dist/walker/index.d.ts +2 -0
- package/dist/walker/index.js +1 -0
- package/dist/walker/walkable.d.ts +4 -0
- package/dist/walker/walkable.js +4 -0
- package/dist/walker/walker.d.ts +18 -0
- package/dist/walker/walker.js +103 -0
- package/dist/walker/walkers.d.ts +8 -0
- package/dist/walker/walkers.js +51 -0
- package/package.json +10 -4
- package/dist/core/builder.d.ts +0 -70
- package/dist/core/builder.js +0 -124
- package/dist/core/collection/collection.d.ts +0 -32
- package/dist/core/collection/collection.js +0 -37
- package/dist/core/collection/index.d.ts +0 -4
- package/dist/core/collection/index.js +0 -2
- package/dist/core/collection/method.d.ts +0 -30
- package/dist/core/collection/method.js +0 -11
- package/dist/core/component/component.d.ts +0 -9
- package/dist/core/component/component.js +0 -10
- package/dist/core/component/graph.d.ts +0 -9
- package/dist/core/component/index.d.ts +0 -4
- package/dist/core/component/index.js +0 -2
- package/dist/core/component/method.d.ts +0 -11
- package/dist/core/expectation.d.ts +0 -45
- package/dist/core/expectation.js +0 -22
- package/dist/core/graph.js +0 -3
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.js +0 -6
- package/dist/core/option/graph.d.ts +0 -10
- package/dist/core/option/graph.js +0 -78
- package/dist/core/option/index.d.ts +0 -9
- package/dist/core/option/index.js +0 -5
- package/dist/core/option/method.d.ts +0 -70
- package/dist/core/option/method.js +0 -13
- package/dist/core/option/option.d.ts +0 -30
- package/dist/core/option/option.js +0 -42
- package/dist/core/option/select.d.ts +0 -22
- package/dist/core/option/select.js +0 -34
- package/dist/core/option/toggle.d.ts +0 -14
- package/dist/core/option/toggle.js +0 -27
- package/dist/core/parameter.d.ts +0 -48
- package/dist/core/parameter.js +0 -31
- package/dist/core/when/config.d.ts +0 -20
- package/dist/core/when/config.js +0 -4
- package/dist/core/when/constrain.d.ts +0 -14
- package/dist/core/when/index.d.ts +0 -5
- package/dist/core/when/index.js +0 -2
- package/dist/core/when/nullability.d.ts +0 -18
- package/dist/core/when/resolve.d.ts +0 -18
- package/dist/core/when/resolve.js +0 -22
- package/dist/resolve/index.d.ts +0 -9
- package/dist/resolve/index.js +0 -5
- package/dist/resolve/instance.d.ts +0 -3
- package/dist/resolve/instance.js +0 -26
- package/dist/resolve/models.d.ts +0 -3
- package/dist/resolve/models.js +0 -10
- package/dist/resolve/order.d.ts +0 -19
- package/dist/resolve/order.js +0 -24
- package/dist/resolve/render.d.ts +0 -21
- package/dist/resolve/render.js +0 -171
- package/dist/resolve/validate.d.ts +0 -33
- package/dist/resolve/validate.js +0 -51
- package/dist/schemas/description.d.ts +0 -5
- package/dist/schemas/description.js +0 -3
- package/dist/schemas/index.d.ts +0 -6
- package/dist/schemas/index.js +0 -3
- package/dist/schemas/primitives.d.ts +0 -9
- package/dist/schemas/ui.d.ts +0 -96
- package/dist/schemas/ui.js +0 -23
- package/dist/serialise/deserialise.d.ts +0 -9
- package/dist/serialise/deserialise.js +0 -113
- package/dist/serialise/index.d.ts +0 -4
- package/dist/serialise/index.js +0 -3
- package/dist/serialise/schemas.d.ts +0 -1885
- package/dist/serialise/schemas.js +0 -141
- package/dist/serialise/serialise.d.ts +0 -10
- package/dist/serialise/serialise.js +0 -140
- package/dist/ui.d.ts +0 -18
- package/dist/ui.js +0 -53
- /package/dist/{core/component/method.js → entities/builder/expectation.js} +0 -0
- /package/dist/{core/when/constrain.js → entities/builder/state.js} +0 -0
- /package/dist/{core/when/nullability.js → entities/errors.js} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { serialisable } from '../../serialisable.js';
|
|
3
|
+
export class BuilderSelectType {
|
|
4
|
+
type = 'select';
|
|
5
|
+
options;
|
|
6
|
+
valueSchema;
|
|
7
|
+
defaultValue;
|
|
8
|
+
isOptional;
|
|
9
|
+
optionLabels;
|
|
10
|
+
constructor(values, defaultValue, optional = false, optionLabels = {}) {
|
|
11
|
+
this.options = values;
|
|
12
|
+
const baseSchema = v.union(values.map((value) => v.literal(value)));
|
|
13
|
+
this.valueSchema = (optional ? v.nullable(baseSchema) : baseSchema);
|
|
14
|
+
this.defaultValue = defaultValue;
|
|
15
|
+
this.isOptional = optional;
|
|
16
|
+
this.optionLabels = optionLabels;
|
|
17
|
+
}
|
|
18
|
+
default(newDefault) {
|
|
19
|
+
return new BuilderSelectType(this.options, newDefault, this.isOptional, this.optionLabels);
|
|
20
|
+
}
|
|
21
|
+
optional() {
|
|
22
|
+
const { options, defaultValue } = this;
|
|
23
|
+
return new BuilderSelectType(options, defaultValue, true, this.optionLabels);
|
|
24
|
+
}
|
|
25
|
+
labels(optionLabels) {
|
|
26
|
+
return new BuilderSelectType(this.options, this.defaultValue, this.isOptional, optionLabels);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function select(values) {
|
|
30
|
+
const [defaultValue] = values;
|
|
31
|
+
return new BuilderSelectType(values, defaultValue, false);
|
|
32
|
+
}
|
|
33
|
+
export const BuilderSelectTypeSchema = v.instance(BuilderSelectType);
|
|
34
|
+
export const BuilderSelectTypeSerialisedSchema = serialisable(BuilderSelectType, v.object({
|
|
35
|
+
type: v.literal('select'),
|
|
36
|
+
options: v.pipe(v.tupleWithRest([v.string()], v.string()), v.readonly()),
|
|
37
|
+
defaultValue: v.nullable(v.string()),
|
|
38
|
+
isOptional: v.boolean(),
|
|
39
|
+
optionLabels: v.record(v.string(), v.string())
|
|
40
|
+
}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BuilderPrimitive } from '../../primitive';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
export declare const BuilderToggleValueTypeSchema: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
4
|
+
export type BuilderToggleValueType = v.InferOutput<typeof BuilderToggleValueTypeSchema>;
|
|
5
|
+
export declare class BuilderToggleType<const ValueSchema extends v.GenericSchema<BuilderPrimitive> = v.GenericSchema<BuilderPrimitive>> {
|
|
6
|
+
readonly value: v.InferOutput<ValueSchema>;
|
|
7
|
+
readonly type: "toggle";
|
|
8
|
+
readonly valueType: BuilderToggleValueType;
|
|
9
|
+
readonly valueSchema: ValueSchema;
|
|
10
|
+
readonly defaultValue: v.InferOutput<ValueSchema>;
|
|
11
|
+
readonly isOptional: boolean;
|
|
12
|
+
constructor(valueType: BuilderToggleValueType, defaultValue: v.InferOutput<ValueSchema>, optional?: boolean);
|
|
13
|
+
default(newDefault: v.InferOutput<ValueSchema>): BuilderToggleType<ValueSchema>;
|
|
14
|
+
optional(): BuilderToggleType<v.NullableSchema<ValueSchema, undefined>>;
|
|
15
|
+
}
|
|
16
|
+
export declare function toggleString(): BuilderToggleType<v.StringSchema<undefined>>;
|
|
17
|
+
export declare function toggleBoolean(): BuilderToggleType<v.BooleanSchema<undefined>>;
|
|
18
|
+
export declare function toggleNumber(): BuilderToggleType<v.NumberSchema<undefined>>;
|
|
19
|
+
export declare const BuilderToggleTypeSchema: v.InstanceSchema<typeof BuilderToggleType, undefined>;
|
|
20
|
+
export declare const BuilderToggleTypeSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
21
|
+
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
22
|
+
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
23
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
24
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
25
|
+
}, undefined>, v.MetadataAction<{
|
|
26
|
+
type: "toggle";
|
|
27
|
+
valueType: "string" | "number" | "boolean";
|
|
28
|
+
defaultValue: string | number | boolean | null;
|
|
29
|
+
isOptional: boolean;
|
|
30
|
+
}, {
|
|
31
|
+
readonly serialisable: typeof BuilderToggleType;
|
|
32
|
+
readonly instance: v.InstanceSchema<typeof BuilderToggleType, undefined>;
|
|
33
|
+
}>, v.ReadonlyAction<{
|
|
34
|
+
type: "toggle";
|
|
35
|
+
valueType: "string" | "number" | "boolean";
|
|
36
|
+
defaultValue: string | number | boolean | null;
|
|
37
|
+
isOptional: boolean;
|
|
38
|
+
}>]>;
|
|
39
|
+
export type BuilderToggleTypeSerialised = v.InferOutput<typeof BuilderToggleTypeSerialisedSchema>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { serialisable } from '../../serialisable.js';
|
|
3
|
+
export const BuilderToggleValueTypeSchema = v.picklist(['string', 'boolean', 'number']);
|
|
4
|
+
export class BuilderToggleType {
|
|
5
|
+
type = 'toggle';
|
|
6
|
+
valueType;
|
|
7
|
+
valueSchema;
|
|
8
|
+
defaultValue;
|
|
9
|
+
isOptional;
|
|
10
|
+
constructor(valueType, defaultValue, optional) {
|
|
11
|
+
this.valueType = valueType;
|
|
12
|
+
this.valueSchema = deriveToggleValueSchema(valueType, optional || false);
|
|
13
|
+
this.defaultValue = defaultValue;
|
|
14
|
+
this.isOptional = optional || false;
|
|
15
|
+
}
|
|
16
|
+
default(newDefault) {
|
|
17
|
+
return new BuilderToggleType(this.valueType, newDefault, this.isOptional);
|
|
18
|
+
}
|
|
19
|
+
optional() {
|
|
20
|
+
return new BuilderToggleType(this.valueType, this.defaultValue, true);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function toggleString() {
|
|
24
|
+
return new BuilderToggleType('string', '');
|
|
25
|
+
}
|
|
26
|
+
export function toggleBoolean() {
|
|
27
|
+
return new BuilderToggleType('boolean', false);
|
|
28
|
+
}
|
|
29
|
+
export function toggleNumber() {
|
|
30
|
+
return new BuilderToggleType('number', 0);
|
|
31
|
+
}
|
|
32
|
+
export const BuilderToggleTypeSchema = v.instance(BuilderToggleType);
|
|
33
|
+
export const BuilderToggleTypeSerialisedSchema = serialisable(BuilderToggleType, v.object({
|
|
34
|
+
type: v.literal('toggle'),
|
|
35
|
+
valueType: BuilderToggleValueTypeSchema,
|
|
36
|
+
defaultValue: v.nullable(v.union([v.boolean(), v.string(), v.number()])),
|
|
37
|
+
isOptional: v.boolean()
|
|
38
|
+
}));
|
|
39
|
+
function deriveToggleValueSchema(valueType, optional) {
|
|
40
|
+
const baseSchema = valueType === 'string' ? v.string() : valueType === 'boolean' ? v.boolean() : v.number();
|
|
41
|
+
return optional ? v.nullable(baseSchema) : baseSchema;
|
|
42
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderSelectType } from './select.js';
|
|
3
|
+
import { BuilderToggleType } from './toggle.js';
|
|
4
|
+
export declare const BuilderOptionValuesSchema: v.UnionSchema<[v.InstanceSchema<typeof BuilderSelectType, undefined>, v.InstanceSchema<typeof BuilderToggleType, undefined>], undefined>;
|
|
5
|
+
export type BuilderOptionValues = v.InferOutput<typeof BuilderOptionValuesSchema>;
|
|
6
|
+
export declare const BuilderOptionValuesSerialisedSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
7
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
8
|
+
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
9
|
+
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
10
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
11
|
+
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
12
|
+
}, undefined>, v.MetadataAction<{
|
|
13
|
+
type: "select";
|
|
14
|
+
readonly options: readonly [string, ...string[]];
|
|
15
|
+
defaultValue: string | null;
|
|
16
|
+
isOptional: boolean;
|
|
17
|
+
optionLabels: {
|
|
18
|
+
[x: string]: string;
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
readonly serialisable: typeof BuilderSelectType;
|
|
22
|
+
readonly instance: v.InstanceSchema<typeof BuilderSelectType, undefined>;
|
|
23
|
+
}>, v.ReadonlyAction<{
|
|
24
|
+
type: "select";
|
|
25
|
+
readonly options: readonly [string, ...string[]];
|
|
26
|
+
defaultValue: string | null;
|
|
27
|
+
isOptional: boolean;
|
|
28
|
+
optionLabels: {
|
|
29
|
+
[x: string]: string;
|
|
30
|
+
};
|
|
31
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
32
|
+
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
33
|
+
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
34
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
35
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
36
|
+
}, undefined>, v.MetadataAction<{
|
|
37
|
+
type: "toggle";
|
|
38
|
+
valueType: "string" | "number" | "boolean";
|
|
39
|
+
defaultValue: string | number | boolean | null;
|
|
40
|
+
isOptional: boolean;
|
|
41
|
+
}, {
|
|
42
|
+
readonly serialisable: typeof BuilderToggleType;
|
|
43
|
+
readonly instance: v.InstanceSchema<typeof BuilderToggleType, undefined>;
|
|
44
|
+
}>, v.ReadonlyAction<{
|
|
45
|
+
type: "toggle";
|
|
46
|
+
valueType: "string" | "number" | "boolean";
|
|
47
|
+
defaultValue: string | number | boolean | null;
|
|
48
|
+
isOptional: boolean;
|
|
49
|
+
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
50
|
+
type: "select";
|
|
51
|
+
readonly options: readonly [string, ...string[]];
|
|
52
|
+
defaultValue: string | null;
|
|
53
|
+
isOptional: boolean;
|
|
54
|
+
optionLabels: {
|
|
55
|
+
[x: string]: string;
|
|
56
|
+
};
|
|
57
|
+
}> | Readonly<{
|
|
58
|
+
type: "toggle";
|
|
59
|
+
valueType: "string" | "number" | "boolean";
|
|
60
|
+
defaultValue: string | number | boolean | null;
|
|
61
|
+
isOptional: boolean;
|
|
62
|
+
}>>]>;
|
|
63
|
+
export type BuilderOptionValuesSerialised = v.InferOutput<typeof BuilderOptionValuesSerialisedSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderSelectType, BuilderSelectTypeSerialisedSchema } from './select.js';
|
|
3
|
+
import { BuilderToggleType, BuilderToggleTypeSerialisedSchema } from './toggle.js';
|
|
4
|
+
export const BuilderOptionValuesSchema = v.union([
|
|
5
|
+
v.instance(BuilderSelectType),
|
|
6
|
+
v.instance(BuilderToggleType)
|
|
7
|
+
]);
|
|
8
|
+
export const BuilderOptionValuesSerialisedSchema = v.pipe(v.variant('type', [BuilderSelectTypeSerialisedSchema, BuilderToggleTypeSerialisedSchema]), v.readonly());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Refable } from '../../references';
|
|
2
|
+
import type { BuilderWhen } from '../when';
|
|
3
|
+
import type { BuilderOptionValues } from './values';
|
|
4
|
+
export type BuilderOptionWhen = BuilderWhen<Refable<BuilderOptionValues>>;
|
|
5
|
+
export declare const optionWhen: {
|
|
6
|
+
enable: <const Values extends Refable<import("./select").BuilderSelectType<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleType<import("valibot").GenericSchema<string | number | boolean | null>>>>(values: Values) => import("../when").BuilderEnableConfig<Values>;
|
|
7
|
+
match: <const MatchPayload extends Refable<import("./select").BuilderSelectType<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleType<import("valibot").GenericSchema<string | number | boolean | null>>>, const MatchPath extends Refable<import("../..").BuilderPath>, const SelectMap extends Refable<import("../when").BuilderMatchSelectMap<Refable<import("./select").BuilderSelectType<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleType<import("valibot").GenericSchema<string | number | boolean | null>>>>>>(matchPath: MatchPath, selectMap: SelectMap) => import("../when").BuilderMatchConfig<MatchPayload, MatchPath, SelectMap>;
|
|
8
|
+
unless: <const Values extends Refable<import("./select").BuilderSelectType<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleType<import("valibot").GenericSchema<string | number | boolean | null>>>, const UnlessPath extends Refable<import("../..").BuilderPath>>(unlessPath: UnlessPath, disabledValues: import("../..").BuilderPrimitives, values: Values) => import("../when").BuilderUnlessConfig<Values, UnlessPath>;
|
|
9
|
+
};
|