@builder-builder/builder 0.0.7 → 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 +9 -3
- package/dist/core/builder.d.ts +0 -74
- package/dist/core/builder.js +0 -109
- 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 -42
- package/dist/core/expectation.js +0 -18
- package/dist/core/graph.js +0 -3
- package/dist/core/index.d.ts +0 -14
- package/dist/core/index.js +0 -7
- 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 -10
- 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 -16
- package/dist/core/option/toggle.js +0 -29
- package/dist/core/parameter.d.ts +0 -48
- package/dist/core/parameter.js +0 -31
- package/dist/core/validate.d.ts +0 -26
- package/dist/core/validate.js +0 -43
- 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 -10
- package/dist/resolve/index.js +0 -5
- package/dist/resolve/instance.d.ts +0 -35
- package/dist/resolve/instance.js +0 -80
- package/dist/resolve/models.d.ts +0 -3
- package/dist/resolve/models.js +0 -20
- package/dist/resolve/order.d.ts +0 -21
- package/dist/resolve/order.js +0 -27
- package/dist/resolve/render.d.ts +0 -23
- package/dist/resolve/render.js +0 -171
- package/dist/resolve/validate.d.ts +0 -37
- package/dist/resolve/validate.js +0 -47
- 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 -14
- package/dist/serialise/deserialise.js +0 -119
- package/dist/serialise/index.d.ts +0 -6
- package/dist/serialise/index.js +0 -4
- package/dist/serialise/schemas.d.ts +0 -1946
- package/dist/serialise/schemas.js +0 -150
- package/dist/serialise/serialise.d.ts +0 -13
- package/dist/serialise/serialise.js +0 -147
- package/dist/serialise/validate.d.ts +0 -26
- package/dist/serialise/validate.js +0 -148
- package/dist/ui.d.ts +0 -19
- package/dist/ui.js +0 -44
- /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,431 @@
|
|
|
1
|
+
import type { Refable, RefableSerialised } from '../../references';
|
|
2
|
+
import type { BuilderUIDescribe, BuilderUIDescribeSerialised } from './describe';
|
|
3
|
+
import type { BuilderUILabel, BuilderUILabelSerialised } from './label';
|
|
4
|
+
import type { BuilderUIPage, BuilderUIPageSerialised } from './page';
|
|
5
|
+
import * as v from 'valibot';
|
|
6
|
+
export type BuilderUIItem = Refable<BuilderUIPage | BuilderUIDescribe | BuilderUIPages>;
|
|
7
|
+
export type BuilderUIItems = ReadonlyArray<BuilderUIItem>;
|
|
8
|
+
export declare class BuilderUIPages<const Name extends string = string, const Label extends Refable<BuilderUILabel> = Refable<BuilderUILabel>, const Items extends Refable<BuilderUIItems> = Refable<BuilderUIItems>> {
|
|
9
|
+
readonly type: "pages";
|
|
10
|
+
readonly name: Name;
|
|
11
|
+
readonly label: Label;
|
|
12
|
+
readonly items: Items;
|
|
13
|
+
constructor(name: Name, label: Label, items: Items);
|
|
14
|
+
}
|
|
15
|
+
export declare const BuilderUIPagesSchema: v.InstanceSchema<typeof BuilderUIPages, undefined>;
|
|
16
|
+
export type BuilderUIPagesSerialised = {
|
|
17
|
+
readonly type: 'pages';
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly label: RefableSerialised<BuilderUILabelSerialised>;
|
|
20
|
+
readonly items: RefableSerialised<BuilderUIItemsSerialised>;
|
|
21
|
+
};
|
|
22
|
+
export type BuilderUIItemSerialised = RefableSerialised<BuilderUIPageSerialised | BuilderUIDescribeSerialised | BuilderUIPagesSerialised>;
|
|
23
|
+
export type BuilderUIItemsSerialised = ReadonlyArray<BuilderUIItemSerialised>;
|
|
24
|
+
export declare const BuilderUIPagesSerialisedSchema: v.GenericSchema<BuilderUIPagesSerialised>;
|
|
25
|
+
export declare const BuilderUIItemsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
26
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
27
|
+
readonly id: v.StringSchema<undefined>;
|
|
28
|
+
readonly name: v.StringSchema<undefined>;
|
|
29
|
+
}, undefined>, v.ReadonlyAction<{
|
|
30
|
+
type: "ref";
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
34
|
+
readonly type: v.LiteralSchema<"page", undefined>;
|
|
35
|
+
readonly label: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
36
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
37
|
+
readonly id: v.StringSchema<undefined>;
|
|
38
|
+
readonly name: v.StringSchema<undefined>;
|
|
39
|
+
}, undefined>, v.ReadonlyAction<{
|
|
40
|
+
type: "ref";
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
44
|
+
readonly label: v.StringSchema<undefined>;
|
|
45
|
+
}, undefined>, v.MetadataAction<{
|
|
46
|
+
label: string;
|
|
47
|
+
}, {
|
|
48
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
49
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
50
|
+
}>, v.ReadonlyAction<{
|
|
51
|
+
label: string;
|
|
52
|
+
}>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
|
|
53
|
+
type: "ref";
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
}> | Readonly<{
|
|
57
|
+
label: string;
|
|
58
|
+
}>, {
|
|
59
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
60
|
+
readonly label: v.StringSchema<undefined>;
|
|
61
|
+
}, undefined>, v.MetadataAction<{
|
|
62
|
+
label: string;
|
|
63
|
+
}, {
|
|
64
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
65
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
66
|
+
}>, v.ReadonlyAction<{
|
|
67
|
+
label: string;
|
|
68
|
+
}>]>;
|
|
69
|
+
}>]>;
|
|
70
|
+
readonly paths: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
71
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
72
|
+
readonly id: v.StringSchema<undefined>;
|
|
73
|
+
readonly name: v.StringSchema<undefined>;
|
|
74
|
+
}, undefined>, v.ReadonlyAction<{
|
|
75
|
+
type: "ref";
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, v.MetadataAction<readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
79
|
+
type: "ref";
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
}>, {
|
|
83
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
84
|
+
}>]>;
|
|
85
|
+
}, undefined>, v.MetadataAction<{
|
|
86
|
+
type: "page";
|
|
87
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
88
|
+
type: "ref";
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
}> | Readonly<{
|
|
92
|
+
label: string;
|
|
93
|
+
}>;
|
|
94
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
95
|
+
type: "ref";
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
}>;
|
|
99
|
+
}, {
|
|
100
|
+
readonly serialisable: typeof BuilderUIPage;
|
|
101
|
+
readonly instance: v.InstanceSchema<typeof BuilderUIPage, undefined>;
|
|
102
|
+
}>, v.ReadonlyAction<{
|
|
103
|
+
type: "page";
|
|
104
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
105
|
+
type: "ref";
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
}> | Readonly<{
|
|
109
|
+
label: string;
|
|
110
|
+
}>;
|
|
111
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
112
|
+
type: "ref";
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
}>;
|
|
116
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
117
|
+
readonly type: v.LiteralSchema<"describe", undefined>;
|
|
118
|
+
readonly label: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
119
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
120
|
+
readonly id: v.StringSchema<undefined>;
|
|
121
|
+
readonly name: v.StringSchema<undefined>;
|
|
122
|
+
}, undefined>, v.ReadonlyAction<{
|
|
123
|
+
type: "ref";
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
127
|
+
readonly label: v.StringSchema<undefined>;
|
|
128
|
+
}, undefined>, v.MetadataAction<{
|
|
129
|
+
label: string;
|
|
130
|
+
}, {
|
|
131
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
132
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
133
|
+
}>, v.ReadonlyAction<{
|
|
134
|
+
label: string;
|
|
135
|
+
}>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
|
|
136
|
+
type: "ref";
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
}> | Readonly<{
|
|
140
|
+
label: string;
|
|
141
|
+
}>, {
|
|
142
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
143
|
+
readonly label: v.StringSchema<undefined>;
|
|
144
|
+
}, undefined>, v.MetadataAction<{
|
|
145
|
+
label: string;
|
|
146
|
+
}, {
|
|
147
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
148
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
149
|
+
}>, v.ReadonlyAction<{
|
|
150
|
+
label: string;
|
|
151
|
+
}>]>;
|
|
152
|
+
}>]>;
|
|
153
|
+
readonly paths: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
154
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
155
|
+
readonly id: v.StringSchema<undefined>;
|
|
156
|
+
readonly name: v.StringSchema<undefined>;
|
|
157
|
+
}, undefined>, v.ReadonlyAction<{
|
|
158
|
+
type: "ref";
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, v.MetadataAction<readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
162
|
+
type: "ref";
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
}>, {
|
|
166
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
167
|
+
}>]>;
|
|
168
|
+
}, undefined>, v.MetadataAction<{
|
|
169
|
+
type: "describe";
|
|
170
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
171
|
+
type: "ref";
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
}> | Readonly<{
|
|
175
|
+
label: string;
|
|
176
|
+
}>;
|
|
177
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
178
|
+
type: "ref";
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
}>;
|
|
182
|
+
}, {
|
|
183
|
+
readonly serialisable: typeof BuilderUIDescribe;
|
|
184
|
+
readonly instance: v.InstanceSchema<typeof BuilderUIDescribe, undefined>;
|
|
185
|
+
}>, v.ReadonlyAction<{
|
|
186
|
+
type: "describe";
|
|
187
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
188
|
+
type: "ref";
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
}> | Readonly<{
|
|
192
|
+
label: string;
|
|
193
|
+
}>;
|
|
194
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
195
|
+
type: "ref";
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
}>;
|
|
199
|
+
}>]>, v.GenericSchema<BuilderUIPagesSerialised>], undefined>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
|
|
200
|
+
type: "ref";
|
|
201
|
+
id: string;
|
|
202
|
+
name: string;
|
|
203
|
+
}> | Readonly<{
|
|
204
|
+
type: "describe";
|
|
205
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
206
|
+
type: "ref";
|
|
207
|
+
id: string;
|
|
208
|
+
name: string;
|
|
209
|
+
}> | Readonly<{
|
|
210
|
+
label: string;
|
|
211
|
+
}>;
|
|
212
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
213
|
+
type: "ref";
|
|
214
|
+
id: string;
|
|
215
|
+
name: string;
|
|
216
|
+
}>;
|
|
217
|
+
}> | Readonly<{
|
|
218
|
+
type: "page";
|
|
219
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
220
|
+
type: "ref";
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
}> | Readonly<{
|
|
224
|
+
label: string;
|
|
225
|
+
}>;
|
|
226
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
227
|
+
type: "ref";
|
|
228
|
+
id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
}>;
|
|
231
|
+
}> | BuilderUIPagesSerialised, {
|
|
232
|
+
readonly refable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
233
|
+
readonly type: v.LiteralSchema<"page", undefined>;
|
|
234
|
+
readonly label: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
235
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
236
|
+
readonly id: v.StringSchema<undefined>;
|
|
237
|
+
readonly name: v.StringSchema<undefined>;
|
|
238
|
+
}, undefined>, v.ReadonlyAction<{
|
|
239
|
+
type: "ref";
|
|
240
|
+
id: string;
|
|
241
|
+
name: string;
|
|
242
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
243
|
+
readonly label: v.StringSchema<undefined>;
|
|
244
|
+
}, undefined>, v.MetadataAction<{
|
|
245
|
+
label: string;
|
|
246
|
+
}, {
|
|
247
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
248
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
249
|
+
}>, v.ReadonlyAction<{
|
|
250
|
+
label: string;
|
|
251
|
+
}>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
|
|
252
|
+
type: "ref";
|
|
253
|
+
id: string;
|
|
254
|
+
name: string;
|
|
255
|
+
}> | Readonly<{
|
|
256
|
+
label: string;
|
|
257
|
+
}>, {
|
|
258
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
259
|
+
readonly label: v.StringSchema<undefined>;
|
|
260
|
+
}, undefined>, v.MetadataAction<{
|
|
261
|
+
label: string;
|
|
262
|
+
}, {
|
|
263
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
264
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
265
|
+
}>, v.ReadonlyAction<{
|
|
266
|
+
label: string;
|
|
267
|
+
}>]>;
|
|
268
|
+
}>]>;
|
|
269
|
+
readonly paths: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
270
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
271
|
+
readonly id: v.StringSchema<undefined>;
|
|
272
|
+
readonly name: v.StringSchema<undefined>;
|
|
273
|
+
}, undefined>, v.ReadonlyAction<{
|
|
274
|
+
type: "ref";
|
|
275
|
+
id: string;
|
|
276
|
+
name: string;
|
|
277
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, v.MetadataAction<readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
278
|
+
type: "ref";
|
|
279
|
+
id: string;
|
|
280
|
+
name: string;
|
|
281
|
+
}>, {
|
|
282
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
283
|
+
}>]>;
|
|
284
|
+
}, undefined>, v.MetadataAction<{
|
|
285
|
+
type: "page";
|
|
286
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
287
|
+
type: "ref";
|
|
288
|
+
id: string;
|
|
289
|
+
name: string;
|
|
290
|
+
}> | Readonly<{
|
|
291
|
+
label: string;
|
|
292
|
+
}>;
|
|
293
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
294
|
+
type: "ref";
|
|
295
|
+
id: string;
|
|
296
|
+
name: string;
|
|
297
|
+
}>;
|
|
298
|
+
}, {
|
|
299
|
+
readonly serialisable: typeof BuilderUIPage;
|
|
300
|
+
readonly instance: v.InstanceSchema<typeof BuilderUIPage, undefined>;
|
|
301
|
+
}>, v.ReadonlyAction<{
|
|
302
|
+
type: "page";
|
|
303
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
304
|
+
type: "ref";
|
|
305
|
+
id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
}> | Readonly<{
|
|
308
|
+
label: string;
|
|
309
|
+
}>;
|
|
310
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
311
|
+
type: "ref";
|
|
312
|
+
id: string;
|
|
313
|
+
name: string;
|
|
314
|
+
}>;
|
|
315
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
316
|
+
readonly type: v.LiteralSchema<"describe", undefined>;
|
|
317
|
+
readonly label: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
318
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
319
|
+
readonly id: v.StringSchema<undefined>;
|
|
320
|
+
readonly name: v.StringSchema<undefined>;
|
|
321
|
+
}, undefined>, v.ReadonlyAction<{
|
|
322
|
+
type: "ref";
|
|
323
|
+
id: string;
|
|
324
|
+
name: string;
|
|
325
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
326
|
+
readonly label: v.StringSchema<undefined>;
|
|
327
|
+
}, undefined>, v.MetadataAction<{
|
|
328
|
+
label: string;
|
|
329
|
+
}, {
|
|
330
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
331
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
332
|
+
}>, v.ReadonlyAction<{
|
|
333
|
+
label: string;
|
|
334
|
+
}>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
|
|
335
|
+
type: "ref";
|
|
336
|
+
id: string;
|
|
337
|
+
name: string;
|
|
338
|
+
}> | Readonly<{
|
|
339
|
+
label: string;
|
|
340
|
+
}>, {
|
|
341
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
342
|
+
readonly label: v.StringSchema<undefined>;
|
|
343
|
+
}, undefined>, v.MetadataAction<{
|
|
344
|
+
label: string;
|
|
345
|
+
}, {
|
|
346
|
+
readonly serialisable: typeof BuilderUILabel;
|
|
347
|
+
readonly instance: v.InstanceSchema<typeof BuilderUILabel, undefined>;
|
|
348
|
+
}>, v.ReadonlyAction<{
|
|
349
|
+
label: string;
|
|
350
|
+
}>]>;
|
|
351
|
+
}>]>;
|
|
352
|
+
readonly paths: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
353
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
354
|
+
readonly id: v.StringSchema<undefined>;
|
|
355
|
+
readonly name: v.StringSchema<undefined>;
|
|
356
|
+
}, undefined>, v.ReadonlyAction<{
|
|
357
|
+
type: "ref";
|
|
358
|
+
id: string;
|
|
359
|
+
name: string;
|
|
360
|
+
}>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, v.MetadataAction<readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
361
|
+
type: "ref";
|
|
362
|
+
id: string;
|
|
363
|
+
name: string;
|
|
364
|
+
}>, {
|
|
365
|
+
readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
366
|
+
}>]>;
|
|
367
|
+
}, undefined>, v.MetadataAction<{
|
|
368
|
+
type: "describe";
|
|
369
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
370
|
+
type: "ref";
|
|
371
|
+
id: string;
|
|
372
|
+
name: string;
|
|
373
|
+
}> | Readonly<{
|
|
374
|
+
label: string;
|
|
375
|
+
}>;
|
|
376
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
377
|
+
type: "ref";
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
}>;
|
|
381
|
+
}, {
|
|
382
|
+
readonly serialisable: typeof BuilderUIDescribe;
|
|
383
|
+
readonly instance: v.InstanceSchema<typeof BuilderUIDescribe, undefined>;
|
|
384
|
+
}>, v.ReadonlyAction<{
|
|
385
|
+
type: "describe";
|
|
386
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
387
|
+
type: "ref";
|
|
388
|
+
id: string;
|
|
389
|
+
name: string;
|
|
390
|
+
}> | Readonly<{
|
|
391
|
+
label: string;
|
|
392
|
+
}>;
|
|
393
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
394
|
+
type: "ref";
|
|
395
|
+
id: string;
|
|
396
|
+
name: string;
|
|
397
|
+
}>;
|
|
398
|
+
}>]>, v.GenericSchema<BuilderUIPagesSerialised>], undefined>;
|
|
399
|
+
}>]>, undefined>, v.ReadonlyAction<(import("../..").BuilderRef | Readonly<{
|
|
400
|
+
type: "ref";
|
|
401
|
+
id: string;
|
|
402
|
+
name: string;
|
|
403
|
+
}> | Readonly<{
|
|
404
|
+
type: "describe";
|
|
405
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
406
|
+
type: "ref";
|
|
407
|
+
id: string;
|
|
408
|
+
name: string;
|
|
409
|
+
}> | Readonly<{
|
|
410
|
+
label: string;
|
|
411
|
+
}>;
|
|
412
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
413
|
+
type: "ref";
|
|
414
|
+
id: string;
|
|
415
|
+
name: string;
|
|
416
|
+
}>;
|
|
417
|
+
}> | Readonly<{
|
|
418
|
+
type: "page";
|
|
419
|
+
label: import("../..").BuilderRef | Readonly<{
|
|
420
|
+
type: "ref";
|
|
421
|
+
id: string;
|
|
422
|
+
name: string;
|
|
423
|
+
}> | Readonly<{
|
|
424
|
+
label: string;
|
|
425
|
+
}>;
|
|
426
|
+
paths: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
|
|
427
|
+
type: "ref";
|
|
428
|
+
id: string;
|
|
429
|
+
name: string;
|
|
430
|
+
}>;
|
|
431
|
+
}> | BuilderUIPagesSerialised)[]>]>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { refable } from '../../references.js';
|
|
3
|
+
import { serialisable } from '../../serialisable.js';
|
|
4
|
+
import { BuilderUIDescribeSerialisedSchema } from './describe.js';
|
|
5
|
+
import { BuilderUILabelSerialisedSchema } from './label.js';
|
|
6
|
+
import { BuilderUIPageSerialisedSchema } from './page.js';
|
|
7
|
+
export class BuilderUIPages {
|
|
8
|
+
type = 'pages';
|
|
9
|
+
name;
|
|
10
|
+
label;
|
|
11
|
+
items;
|
|
12
|
+
constructor(name, label, items) {
|
|
13
|
+
this.name = name;
|
|
14
|
+
this.label = label;
|
|
15
|
+
this.items = items;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const BuilderUIPagesSchema = v.instance(BuilderUIPages);
|
|
19
|
+
export const BuilderUIPagesSerialisedSchema = serialisable(BuilderUIPages, v.object({
|
|
20
|
+
type: v.literal('pages'),
|
|
21
|
+
name: v.string(),
|
|
22
|
+
label: refable(BuilderUILabelSerialisedSchema),
|
|
23
|
+
items: refable(v.lazy(() => BuilderUIItemsSerialisedSchema))
|
|
24
|
+
}));
|
|
25
|
+
export const BuilderUIItemsSerialisedSchema = v.pipe(v.array(refable(v.union([
|
|
26
|
+
BuilderUIPageSerialisedSchema,
|
|
27
|
+
BuilderUIDescribeSerialisedSchema,
|
|
28
|
+
BuilderUIPagesSerialisedSchema
|
|
29
|
+
]))), v.readonly());
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Refable } from '../../references';
|
|
2
|
+
import type { BuilderGeneric } from '../builder/index';
|
|
3
|
+
import type { BuilderUIItems } from './pages';
|
|
4
|
+
import type { BuilderUIGeneric } from './ui';
|
|
5
|
+
import { BuilderUI } from './ui.js';
|
|
6
|
+
export type BuilderUIBindings = Record<string, string | BuilderUIGeneric | BuilderUIItems | unknown>;
|
|
7
|
+
export declare function bindUI<BuilderType extends Refable<BuilderGeneric>>(ui: BuilderUI<BuilderType>, bindings: BuilderUIBindings): BuilderUI<BuilderType>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { createWalkerBinding } from '../../walker/index.js';
|
|
3
|
+
import { BuilderUILabel } from './label.js';
|
|
4
|
+
import { BuilderUIItemsSerialisedSchema } from './pages.js';
|
|
5
|
+
import { BuilderUI, BuilderUISchema } from './ui.js';
|
|
6
|
+
import { mergeUIParts } from './uis.js';
|
|
7
|
+
export function bindUI(ui, bindings) {
|
|
8
|
+
const merged = mergeUIParts(Object.values(bindings));
|
|
9
|
+
const walk = createWalkerBinding({
|
|
10
|
+
lookupBinding: (ref) => {
|
|
11
|
+
const binding = bindings[ref.name];
|
|
12
|
+
if (binding == null) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (typeof binding === 'string') {
|
|
16
|
+
return new BuilderUILabel(binding);
|
|
17
|
+
}
|
|
18
|
+
if (v.is(BuilderUISchema, binding)) {
|
|
19
|
+
return [...binding.items];
|
|
20
|
+
}
|
|
21
|
+
return binding;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const boundItems = walk(BuilderUIItemsSerialisedSchema, ui.items);
|
|
25
|
+
return new BuilderUI(ui.builder, [...ui.references, ...merged.references], boundItems, [
|
|
26
|
+
...ui.expectations,
|
|
27
|
+
...merged.expectations
|
|
28
|
+
]);
|
|
29
|
+
}
|