@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.
Files changed (216) hide show
  1. package/dist/check.d.ts +2 -1
  2. package/dist/check.js +6 -2
  3. package/dist/entities/builder/builder.d.ts +494 -0
  4. package/dist/entities/builder/builder.js +84 -0
  5. package/dist/entities/builder/builders.d.ts +20 -0
  6. package/dist/entities/builder/builders.js +18 -0
  7. package/dist/entities/builder/expectation.d.ts +12 -0
  8. package/dist/entities/builder/index.d.ts +7 -0
  9. package/dist/entities/builder/index.js +3 -0
  10. package/dist/entities/builder/methods.d.ts +58 -0
  11. package/dist/entities/builder/methods.js +30 -0
  12. package/dist/entities/builder/parameter.d.ts +61 -0
  13. package/dist/entities/builder/parameter.js +18 -0
  14. package/dist/entities/builder/state.d.ts +26 -0
  15. package/dist/entities/builder/validate.d.ts +3 -0
  16. package/dist/entities/builder/validate.js +108 -0
  17. package/dist/entities/collection/collection.d.ts +37 -0
  18. package/dist/entities/collection/collection.js +42 -0
  19. package/dist/entities/collection/config.d.ts +1094 -0
  20. package/dist/entities/collection/config.js +23 -0
  21. package/dist/entities/collection/expectation.d.ts +7 -0
  22. package/dist/entities/collection/expectation.js +4 -0
  23. package/dist/entities/collection/index.d.ts +8 -0
  24. package/dist/entities/collection/index.js +4 -0
  25. package/dist/entities/collection/when.d.ts +9 -0
  26. package/dist/entities/collection/when.js +2 -0
  27. package/dist/entities/component/component.d.ts +403 -0
  28. package/dist/entities/component/component.js +24 -0
  29. package/dist/entities/component/details.d.ts +82 -0
  30. package/dist/entities/component/details.js +17 -0
  31. package/dist/entities/component/expectation.d.ts +8 -0
  32. package/dist/entities/component/expectation.js +7 -0
  33. package/dist/entities/component/index.d.ts +8 -0
  34. package/dist/entities/component/index.js +4 -0
  35. package/dist/entities/component/when.d.ts +11 -0
  36. package/dist/entities/component/when.js +20 -0
  37. package/dist/entities/errors.d.ts +21 -0
  38. package/dist/entities/expectation.d.ts +44 -0
  39. package/dist/entities/expectation.js +23 -0
  40. package/dist/entities/index.d.ts +18 -0
  41. package/dist/entities/index.js +9 -0
  42. package/dist/entities/option/expectation.d.ts +2 -0
  43. package/dist/entities/option/expectation.js +4 -0
  44. package/dist/entities/option/index.d.ts +11 -0
  45. package/dist/entities/option/index.js +6 -0
  46. package/dist/entities/option/option.d.ts +347 -0
  47. package/dist/entities/option/option.js +24 -0
  48. package/dist/entities/option/select.d.ts +49 -0
  49. package/dist/entities/option/select.js +40 -0
  50. package/dist/entities/option/toggle.d.ts +39 -0
  51. package/dist/entities/option/toggle.js +42 -0
  52. package/dist/entities/option/values.d.ts +63 -0
  53. package/dist/entities/option/values.js +8 -0
  54. package/dist/entities/option/when.d.ts +9 -0
  55. package/dist/entities/option/when.js +2 -0
  56. package/dist/entities/serialise.d.ts +3801 -0
  57. package/dist/entities/serialise.js +41 -0
  58. package/dist/entities/ui/describe.d.ts +100 -0
  59. package/dist/entities/ui/describe.js +22 -0
  60. package/dist/entities/ui/index.d.ts +14 -0
  61. package/dist/entities/ui/index.js +7 -0
  62. package/dist/entities/ui/label.d.ts +18 -0
  63. package/dist/entities/ui/label.js +12 -0
  64. package/dist/entities/ui/page.d.ts +96 -0
  65. package/dist/entities/ui/page.js +20 -0
  66. package/dist/entities/ui/pages.d.ts +431 -0
  67. package/dist/entities/ui/pages.js +29 -0
  68. package/dist/entities/ui/parameter.d.ts +7 -0
  69. package/dist/entities/ui/parameter.js +29 -0
  70. package/dist/entities/ui/ui.d.ts +1582 -0
  71. package/dist/entities/ui/ui.js +53 -0
  72. package/dist/entities/ui/uis.d.ts +10 -0
  73. package/dist/entities/ui/uis.js +20 -0
  74. package/dist/entities/ui/validate.d.ts +8 -0
  75. package/dist/entities/ui/validate.js +21 -0
  76. package/dist/entities/validate.d.ts +28 -0
  77. package/dist/entities/validate.js +1 -0
  78. package/dist/entities/when.d.ts +176 -0
  79. package/dist/entities/when.js +47 -0
  80. package/dist/exception.d.ts +8 -0
  81. package/dist/exception.js +7 -0
  82. package/dist/index.d.ts +37 -13
  83. package/dist/index.js +22 -5
  84. package/dist/mappers/assert/builder.d.ts +2 -0
  85. package/dist/mappers/assert/builder.js +46 -0
  86. package/dist/mappers/assert/expectation.d.ts +2 -0
  87. package/dist/mappers/assert/expectation.js +23 -0
  88. package/dist/mappers/assert/index.d.ts +6 -0
  89. package/dist/mappers/assert/index.js +4 -0
  90. package/dist/mappers/assert/model.d.ts +13 -0
  91. package/dist/mappers/assert/model.js +47 -0
  92. package/dist/mappers/assert/models.d.ts +33 -0
  93. package/dist/mappers/assert/models.js +74 -0
  94. package/dist/mappers/assert/ui.d.ts +2 -0
  95. package/dist/mappers/assert/ui.js +22 -0
  96. package/dist/mappers/index.d.ts +7 -0
  97. package/dist/mappers/index.js +4 -0
  98. package/dist/mappers/instance/index.d.ts +1 -0
  99. package/dist/mappers/instance/index.js +1 -0
  100. package/dist/mappers/instance/instance.d.ts +4 -0
  101. package/dist/mappers/instance/instance.js +33 -0
  102. package/dist/mappers/models/component-graph.d.ts +9 -0
  103. package/dist/{core/component/graph.js → mappers/models/component-graph.js} +3 -3
  104. package/dist/{core → mappers/models}/graph.d.ts +4 -1
  105. package/dist/mappers/models/graph.js +17 -0
  106. package/dist/mappers/models/index.d.ts +1 -0
  107. package/dist/mappers/models/index.js +1 -0
  108. package/dist/mappers/models/models.d.ts +3 -0
  109. package/dist/mappers/models/models.js +37 -0
  110. package/dist/mappers/models/option-graph.d.ts +9 -0
  111. package/dist/mappers/models/option-graph.js +77 -0
  112. package/dist/mappers/order/index.d.ts +2 -0
  113. package/dist/mappers/order/index.js +1 -0
  114. package/dist/mappers/order/order.d.ts +14 -0
  115. package/dist/mappers/order/order.js +31 -0
  116. package/dist/mappers/render/index.d.ts +4 -0
  117. package/dist/mappers/render/index.js +2 -0
  118. package/dist/mappers/render/ordinal.d.ts +1 -0
  119. package/dist/mappers/render/ordinal.js +20 -0
  120. package/dist/mappers/render/pages.d.ts +15 -0
  121. package/dist/mappers/render/pages.js +1 -0
  122. package/dist/mappers/render/render.d.ts +8 -0
  123. package/dist/mappers/render/render.js +124 -0
  124. package/dist/mappers/resolve.d.ts +9 -0
  125. package/dist/mappers/resolve.js +57 -0
  126. package/dist/model.d.ts +8 -8
  127. package/dist/paths.d.ts +5 -16
  128. package/dist/paths.js +3 -0
  129. package/dist/primitive.d.ts +5 -0
  130. package/dist/{schemas/primitives.js → primitive.js} +0 -2
  131. package/dist/references.d.ts +60 -0
  132. package/dist/references.js +26 -0
  133. package/dist/serialisable.d.ts +10 -0
  134. package/dist/serialisable.js +5 -0
  135. package/dist/walker/index.d.ts +2 -0
  136. package/dist/walker/index.js +1 -0
  137. package/dist/walker/walkable.d.ts +4 -0
  138. package/dist/walker/walkable.js +4 -0
  139. package/dist/walker/walker.d.ts +18 -0
  140. package/dist/walker/walker.js +103 -0
  141. package/dist/walker/walkers.d.ts +8 -0
  142. package/dist/walker/walkers.js +51 -0
  143. package/package.json +10 -4
  144. package/dist/core/builder.d.ts +0 -70
  145. package/dist/core/builder.js +0 -124
  146. package/dist/core/collection/collection.d.ts +0 -32
  147. package/dist/core/collection/collection.js +0 -37
  148. package/dist/core/collection/index.d.ts +0 -4
  149. package/dist/core/collection/index.js +0 -2
  150. package/dist/core/collection/method.d.ts +0 -30
  151. package/dist/core/collection/method.js +0 -11
  152. package/dist/core/component/component.d.ts +0 -9
  153. package/dist/core/component/component.js +0 -10
  154. package/dist/core/component/graph.d.ts +0 -9
  155. package/dist/core/component/index.d.ts +0 -4
  156. package/dist/core/component/index.js +0 -2
  157. package/dist/core/component/method.d.ts +0 -11
  158. package/dist/core/expectation.d.ts +0 -45
  159. package/dist/core/expectation.js +0 -22
  160. package/dist/core/graph.js +0 -3
  161. package/dist/core/index.d.ts +0 -12
  162. package/dist/core/index.js +0 -6
  163. package/dist/core/option/graph.d.ts +0 -10
  164. package/dist/core/option/graph.js +0 -78
  165. package/dist/core/option/index.d.ts +0 -9
  166. package/dist/core/option/index.js +0 -5
  167. package/dist/core/option/method.d.ts +0 -70
  168. package/dist/core/option/method.js +0 -13
  169. package/dist/core/option/option.d.ts +0 -30
  170. package/dist/core/option/option.js +0 -42
  171. package/dist/core/option/select.d.ts +0 -22
  172. package/dist/core/option/select.js +0 -34
  173. package/dist/core/option/toggle.d.ts +0 -14
  174. package/dist/core/option/toggle.js +0 -27
  175. package/dist/core/parameter.d.ts +0 -48
  176. package/dist/core/parameter.js +0 -31
  177. package/dist/core/when/config.d.ts +0 -20
  178. package/dist/core/when/config.js +0 -4
  179. package/dist/core/when/constrain.d.ts +0 -14
  180. package/dist/core/when/index.d.ts +0 -5
  181. package/dist/core/when/index.js +0 -2
  182. package/dist/core/when/nullability.d.ts +0 -18
  183. package/dist/core/when/resolve.d.ts +0 -18
  184. package/dist/core/when/resolve.js +0 -22
  185. package/dist/resolve/index.d.ts +0 -9
  186. package/dist/resolve/index.js +0 -5
  187. package/dist/resolve/instance.d.ts +0 -3
  188. package/dist/resolve/instance.js +0 -26
  189. package/dist/resolve/models.d.ts +0 -3
  190. package/dist/resolve/models.js +0 -10
  191. package/dist/resolve/order.d.ts +0 -19
  192. package/dist/resolve/order.js +0 -24
  193. package/dist/resolve/render.d.ts +0 -21
  194. package/dist/resolve/render.js +0 -171
  195. package/dist/resolve/validate.d.ts +0 -33
  196. package/dist/resolve/validate.js +0 -51
  197. package/dist/schemas/description.d.ts +0 -5
  198. package/dist/schemas/description.js +0 -3
  199. package/dist/schemas/index.d.ts +0 -6
  200. package/dist/schemas/index.js +0 -3
  201. package/dist/schemas/primitives.d.ts +0 -9
  202. package/dist/schemas/ui.d.ts +0 -96
  203. package/dist/schemas/ui.js +0 -23
  204. package/dist/serialise/deserialise.d.ts +0 -9
  205. package/dist/serialise/deserialise.js +0 -113
  206. package/dist/serialise/index.d.ts +0 -4
  207. package/dist/serialise/index.js +0 -3
  208. package/dist/serialise/schemas.d.ts +0 -1885
  209. package/dist/serialise/schemas.js +0 -141
  210. package/dist/serialise/serialise.d.ts +0 -10
  211. package/dist/serialise/serialise.js +0 -140
  212. package/dist/ui.d.ts +0 -18
  213. package/dist/ui.js +0 -53
  214. /package/dist/{core/component/method.js → entities/builder/expectation.js} +0 -0
  215. /package/dist/{core/when/constrain.js → entities/builder/state.js} +0 -0
  216. /package/dist/{core/when/nullability.js → entities/errors.js} +0 -0
@@ -0,0 +1,11 @@
1
+ import type { BuilderPath } from '../../paths';
2
+ import type { BuilderPrimitives } from '../../primitive';
3
+ import type { Refable } from '../../references';
4
+ import type { BuilderEnableConfig, BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderWhen } from '../when';
5
+ import type { BuilderComponentDetails } from './details';
6
+ export type BuilderComponentWhen = BuilderWhen<Refable<BuilderComponentDetails>>;
7
+ export declare const componentWhen: {
8
+ enable: <const Payload extends Refable<BuilderComponentDetails>>(payload?: Payload) => BuilderEnableConfig<Payload>;
9
+ match: <const Payload extends Refable<BuilderComponentDetails>, const MatchPath extends Refable<BuilderPath>, const SelectMap extends Refable<BuilderMatchSelectMap<Refable<BuilderComponentDetails>>>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderMatchConfig<Payload, MatchPath, SelectMap>;
10
+ unless: <const UnlessPath extends Refable<BuilderPath>, const Payload extends Refable<BuilderComponentDetails>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitives, payload?: Payload) => BuilderUnlessConfig<Payload, UnlessPath>;
11
+ };
@@ -0,0 +1,20 @@
1
+ import { createWhenFactories } from '../when.js';
2
+ import { componentDetails } from './details.js';
3
+ const baseFactories = createWhenFactories();
4
+ export const componentWhen = {
5
+ enable: (payload) => {
6
+ return {
7
+ type: 'enable',
8
+ payload: (payload ?? componentDetails([]))
9
+ };
10
+ },
11
+ match: baseFactories.match,
12
+ unless: (unlessPath, disabledValues, payload) => {
13
+ return {
14
+ type: 'unless',
15
+ unlessPath,
16
+ disabledValues,
17
+ payload: (payload ?? componentDetails([]))
18
+ };
19
+ }
20
+ };
@@ -0,0 +1,21 @@
1
+ import type { BuilderPath } from '../paths';
2
+ import type { BuilderExpectationKind } from './expectation';
3
+ export type BuilderErrorUnmetExpectation = {
4
+ readonly kind: 'unmet-expectation';
5
+ readonly expectationKind: BuilderExpectationKind;
6
+ readonly name: string;
7
+ };
8
+ export type BuilderErrorUnboundParameter = {
9
+ readonly kind: 'unbound-parameter';
10
+ readonly name: string;
11
+ };
12
+ export type BuilderErrorInvalidGatePath = {
13
+ readonly kind: 'invalid-gate-path';
14
+ readonly name: string;
15
+ readonly path: BuilderPath;
16
+ };
17
+ export type BuilderErrorDuplicateName = {
18
+ readonly kind: 'duplicate-name';
19
+ readonly entryKind: 'option' | 'component' | 'collection';
20
+ readonly name: string;
21
+ };
@@ -0,0 +1,44 @@
1
+ import * as v from 'valibot';
2
+ export declare const BuilderExpectationKindSchema: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
3
+ export type BuilderExpectationKind = v.InferOutput<typeof BuilderExpectationKindSchema>;
4
+ export declare class BuilderExpectation<Name extends string = string, Value = unknown, Kind extends BuilderExpectationKind = BuilderExpectationKind> {
5
+ readonly type: 'expectation';
6
+ readonly _value: Value;
7
+ readonly name: Name;
8
+ readonly kind: Kind;
9
+ constructor(name: Name, kind: Kind);
10
+ }
11
+ export declare const BuilderExpectationSchema: v.InstanceSchema<typeof BuilderExpectation, undefined>;
12
+ export declare const BuilderExpectationsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.InstanceSchema<typeof BuilderExpectation, undefined>, undefined>, v.ReadonlyAction<BuilderExpectation<string, unknown, "option" | "component" | "collection" | "detail">[]>]>;
13
+ export type BuilderExpectations = v.InferOutput<typeof BuilderExpectationsSchema>;
14
+ export declare const BuilderExpectationSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
+ readonly name: v.StringSchema<undefined>;
16
+ readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
17
+ }, undefined>, v.MetadataAction<{
18
+ name: string;
19
+ kind: "option" | "component" | "collection" | "detail";
20
+ }, {
21
+ readonly serialisable: typeof BuilderExpectation;
22
+ readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
23
+ }>, v.ReadonlyAction<{
24
+ name: string;
25
+ kind: "option" | "component" | "collection" | "detail";
26
+ }>]>;
27
+ export type BuilderExpectationSerialised = v.InferOutput<typeof BuilderExpectationSerialisedSchema>;
28
+ export declare const BuilderExpectationsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
29
+ readonly name: v.StringSchema<undefined>;
30
+ readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
31
+ }, undefined>, v.MetadataAction<{
32
+ name: string;
33
+ kind: "option" | "component" | "collection" | "detail";
34
+ }, {
35
+ readonly serialisable: typeof BuilderExpectation;
36
+ readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
37
+ }>, v.ReadonlyAction<{
38
+ name: string;
39
+ kind: "option" | "component" | "collection" | "detail";
40
+ }>]>, undefined>, v.ReadonlyAction<Readonly<{
41
+ name: string;
42
+ kind: "option" | "component" | "collection" | "detail";
43
+ }>[]>]>;
44
+ export type BuilderExpectationsSerialised = v.InferOutput<typeof BuilderExpectationsSerialisedSchema>;
@@ -0,0 +1,23 @@
1
+ import * as v from 'valibot';
2
+ import { serialisable } from '../serialisable.js';
3
+ export const BuilderExpectationKindSchema = v.picklist([
4
+ 'option',
5
+ 'component',
6
+ 'collection',
7
+ 'detail'
8
+ ]);
9
+ export class BuilderExpectation {
10
+ name;
11
+ kind;
12
+ constructor(name, kind) {
13
+ this.name = name;
14
+ this.kind = kind;
15
+ }
16
+ }
17
+ export const BuilderExpectationSchema = v.instance(BuilderExpectation);
18
+ export const BuilderExpectationsSchema = v.pipe(v.array(BuilderExpectationSchema), v.readonly());
19
+ export const BuilderExpectationSerialisedSchema = serialisable(BuilderExpectation, v.object({
20
+ name: v.string(),
21
+ kind: BuilderExpectationKindSchema
22
+ }));
23
+ export const BuilderExpectationsSerialisedSchema = v.pipe(v.array(BuilderExpectationSerialisedSchema), v.readonly());
@@ -0,0 +1,18 @@
1
+ export type { BuilderGeneric, BuilderInstanceOf, BuilderReference, BuilderReferences, BuilderSerialised, BuilderState, BuilderStateAppend, BuilderStateEmpty, BuilderStateOf } from './builder/index';
2
+ export type { BuilderCollectionConfigSerialised, BuilderCollectionPayload, BuilderCollections, BuilderCollectionSerialised, BuilderCollectionsSerialised, BuilderCollectionWhen, BuilderCollectionWhenSerialised, BuilderErrorInvalidCollectionBounds, CollectionNamesOf, CollectionShape } from './collection/index';
3
+ export type { BuilderComponentDetailsSerialised, BuilderComponentPayload, BuilderComponents, BuilderComponentSerialised, BuilderComponentsSerialised, BuilderComponentWhen, BuilderComponentWhenSerialised } from './component/index';
4
+ export type { BuilderErrorDuplicateName, BuilderErrorInvalidGatePath, BuilderErrorUnboundParameter, BuilderErrorUnmetExpectation } from './errors';
5
+ export type { BuilderOptionPayload, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionValues, BuilderOptionValuesSerialised, BuilderOptionWhen, BuilderOptionWhenSerialised, BuilderSelectTypeLabels, BuilderSelectTypeSerialised, BuilderSelectTypeValues, BuilderToggleTypeSerialised, BuilderToggleValueType } from './option/index';
6
+ export type { BuilderDescription, BuilderDescriptionItem, BuilderErrorPagesUnknownCollection, BuilderUIDescribeSerialised, BuilderUIGeneric, BuilderUIItem, BuilderUIItems, BuilderUIItemsSerialised, BuilderUILabelSerialised, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIReference, BuilderUIReferences, BuilderUISerialised } from './ui/index';
7
+ export type { BuilderExpectationKind, BuilderExpectations, BuilderExpectationSerialised, BuilderExpectationsSerialised } from './expectation';
8
+ export type { BuilderWhen, BuilderWhenConfig, WhenSerialised } from './when';
9
+ export type { BuilderCollectionConfigValidated, BuilderCollectionsValidated, BuilderCollectionValidated, BuilderComponentDetailsValidated, BuilderComponentsValidated, BuilderComponentValidated, BuilderOptionsValidated, BuilderOptionValidated, BuilderUIItemsValidated, BuilderUIItemValidated, BuilderUIValidated, BuilderValidated, Strip, StripTuple } from './validate';
10
+ export { Builder, builders, BuilderSchema, BuilderSerialisedSchema, mergeBuilderParts } from './builder/index.js';
11
+ export { BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, collectionConfig, collectionExpectation, collectionWhen } from './collection/index.js';
12
+ export { BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, componentDetails, componentExpectation, componentWhen, detailExpectation } from './component/index.js';
13
+ export { deserialise, serialise } from './serialise.js';
14
+ export { BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenUnlessSchema, createWhenFactories, createWhenSerialisedSchema } from './when.js';
15
+ export { BuilderExpectation, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
16
+ export { parameter } from '../references.js';
17
+ export { BuilderOption, BuilderOptionSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, optionExpectation, optionWhen, select, toggleBoolean, toggleNumber, toggleString } from './option/index.js';
18
+ export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUILabel, BuilderUILabelSchema, BuilderUILabelSerialisedSchema, BuilderUIPage, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPages, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, mergeUIParts, uis } from './ui/index.js';
@@ -0,0 +1,9 @@
1
+ export { Builder, builders, BuilderSchema, BuilderSerialisedSchema, mergeBuilderParts } from './builder/index.js';
2
+ export { BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, collectionConfig, collectionExpectation, collectionWhen } from './collection/index.js';
3
+ export { BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, componentDetails, componentExpectation, componentWhen, detailExpectation } from './component/index.js';
4
+ export { deserialise, serialise } from './serialise.js';
5
+ export { BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenUnlessSchema, createWhenFactories, createWhenSerialisedSchema } from './when.js';
6
+ export { BuilderExpectation, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
7
+ export { parameter } from '../references.js';
8
+ export { BuilderOption, BuilderOptionSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, optionExpectation, optionWhen, select, toggleBoolean, toggleNumber, toggleString } from './option/index.js';
9
+ export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUILabel, BuilderUILabelSchema, BuilderUILabelSerialisedSchema, BuilderUIPage, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPages, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, mergeUIParts, uis } from './ui/index.js';
@@ -0,0 +1,2 @@
1
+ import { BuilderExpectation } from '../expectation.js';
2
+ export declare function optionExpectation<const Name extends string>(name: Name): BuilderExpectation<Name, string, "option">;
@@ -0,0 +1,4 @@
1
+ import { BuilderExpectation } from '../expectation.js';
2
+ export function optionExpectation(name) {
3
+ return new BuilderExpectation(name, 'option');
4
+ }
@@ -0,0 +1,11 @@
1
+ export type { BuilderOptionPayload, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionWhenSerialised } from './option';
2
+ export type { BuilderSelectTypeLabels, BuilderSelectTypeSerialised, BuilderSelectTypeValues } from './select';
3
+ export type { BuilderToggleTypeSerialised, BuilderToggleValueType } from './toggle';
4
+ export type { BuilderOptionValues, BuilderOptionValuesSerialised } from './values';
5
+ export type { BuilderOptionWhen } from './when';
6
+ export { BuilderOption, BuilderOptionSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema } from './option.js';
7
+ export { BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, select } from './select.js';
8
+ export { BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, toggleBoolean, toggleNumber, toggleString } from './toggle.js';
9
+ export { BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema } from './values.js';
10
+ export { optionExpectation } from './expectation.js';
11
+ export { optionWhen } from './when.js';
@@ -0,0 +1,6 @@
1
+ export { BuilderOption, BuilderOptionSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema } from './option.js';
2
+ export { BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, select } from './select.js';
3
+ export { BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, toggleBoolean, toggleNumber, toggleString } from './toggle.js';
4
+ export { BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema } from './values.js';
5
+ export { optionExpectation } from './expectation.js';
6
+ export { optionWhen } from './when.js';
@@ -0,0 +1,347 @@
1
+ import type { BuilderPaths } from '../../paths';
2
+ import type { Refable } from '../../references';
3
+ import type { BuilderWhen, WhenSerialised } from '../when';
4
+ import type { BuilderOptionValues, BuilderOptionValuesSerialised } from './values';
5
+ import * as v from 'valibot';
6
+ export type BuilderOptionPayload = BuilderOptionValues | BuilderWhen<Refable<BuilderOptionValues>>;
7
+ export declare class BuilderOption<const Name extends string = string, const Payload extends Refable<BuilderOptionPayload> = Refable<BuilderOptionPayload>, const GatePaths extends Refable<BuilderPaths> = Refable<BuilderPaths>> {
8
+ readonly type: 'option';
9
+ readonly name: Name;
10
+ readonly payload: Payload;
11
+ readonly gatePaths?: GatePaths;
12
+ constructor(name: Name, payload: Payload, gatePaths?: GatePaths);
13
+ }
14
+ export declare const BuilderOptionSchema: v.InstanceSchema<typeof BuilderOption, undefined>;
15
+ export type BuilderOptions = ReadonlyArray<BuilderOption>;
16
+ export declare const BuilderOptionWhenSerialisedSchema: v.GenericSchema;
17
+ export type BuilderOptionWhenSerialised = WhenSerialised<BuilderOptionValuesSerialised>;
18
+ export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
19
+ readonly name: v.StringSchema<undefined>;
20
+ readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
21
+ readonly type: v.LiteralSchema<"ref", undefined>;
22
+ readonly id: v.StringSchema<undefined>;
23
+ readonly name: v.StringSchema<undefined>;
24
+ }, undefined>, v.ReadonlyAction<{
25
+ type: "ref";
26
+ id: string;
27
+ name: string;
28
+ }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
29
+ readonly type: v.LiteralSchema<"select", undefined>;
30
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
31
+ readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
32
+ readonly isOptional: v.BooleanSchema<undefined>;
33
+ readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
34
+ }, undefined>, v.MetadataAction<{
35
+ type: "select";
36
+ readonly options: readonly [string, ...string[]];
37
+ defaultValue: string | null;
38
+ isOptional: boolean;
39
+ optionLabels: {
40
+ [x: string]: string;
41
+ };
42
+ }, {
43
+ readonly serialisable: typeof import("./select").BuilderSelectType;
44
+ readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
45
+ }>, v.ReadonlyAction<{
46
+ type: "select";
47
+ readonly options: readonly [string, ...string[]];
48
+ defaultValue: string | null;
49
+ isOptional: boolean;
50
+ optionLabels: {
51
+ [x: string]: string;
52
+ };
53
+ }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
54
+ readonly type: v.LiteralSchema<"toggle", undefined>;
55
+ readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
56
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
57
+ readonly isOptional: v.BooleanSchema<undefined>;
58
+ }, undefined>, v.MetadataAction<{
59
+ type: "toggle";
60
+ valueType: "string" | "number" | "boolean";
61
+ defaultValue: string | number | boolean | null;
62
+ isOptional: boolean;
63
+ }, {
64
+ readonly serialisable: typeof import("./toggle").BuilderToggleType;
65
+ readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
66
+ }>, v.ReadonlyAction<{
67
+ type: "toggle";
68
+ valueType: "string" | "number" | "boolean";
69
+ defaultValue: string | number | boolean | null;
70
+ isOptional: boolean;
71
+ }>]>], undefined>, v.ReadonlyAction<Readonly<{
72
+ type: "select";
73
+ readonly options: readonly [string, ...string[]];
74
+ defaultValue: string | null;
75
+ isOptional: boolean;
76
+ optionLabels: {
77
+ [x: string]: string;
78
+ };
79
+ }> | Readonly<{
80
+ type: "toggle";
81
+ valueType: "string" | "number" | "boolean";
82
+ defaultValue: string | number | boolean | null;
83
+ isOptional: boolean;
84
+ }>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
85
+ readonly refable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
86
+ readonly type: v.LiteralSchema<"select", undefined>;
87
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
88
+ readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
89
+ readonly isOptional: v.BooleanSchema<undefined>;
90
+ readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
91
+ }, undefined>, v.MetadataAction<{
92
+ type: "select";
93
+ readonly options: readonly [string, ...string[]];
94
+ defaultValue: string | null;
95
+ isOptional: boolean;
96
+ optionLabels: {
97
+ [x: string]: string;
98
+ };
99
+ }, {
100
+ readonly serialisable: typeof import("./select").BuilderSelectType;
101
+ readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
102
+ }>, v.ReadonlyAction<{
103
+ type: "select";
104
+ readonly options: readonly [string, ...string[]];
105
+ defaultValue: string | null;
106
+ isOptional: boolean;
107
+ optionLabels: {
108
+ [x: string]: string;
109
+ };
110
+ }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
111
+ readonly type: v.LiteralSchema<"toggle", undefined>;
112
+ readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
113
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
114
+ readonly isOptional: v.BooleanSchema<undefined>;
115
+ }, undefined>, v.MetadataAction<{
116
+ type: "toggle";
117
+ valueType: "string" | "number" | "boolean";
118
+ defaultValue: string | number | boolean | null;
119
+ isOptional: boolean;
120
+ }, {
121
+ readonly serialisable: typeof import("./toggle").BuilderToggleType;
122
+ readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
123
+ }>, v.ReadonlyAction<{
124
+ type: "toggle";
125
+ valueType: "string" | "number" | "boolean";
126
+ defaultValue: string | number | boolean | null;
127
+ isOptional: boolean;
128
+ }>]>], undefined>, v.ReadonlyAction<Readonly<{
129
+ type: "select";
130
+ readonly options: readonly [string, ...string[]];
131
+ defaultValue: string | null;
132
+ isOptional: boolean;
133
+ optionLabels: {
134
+ [x: string]: string;
135
+ };
136
+ }> | Readonly<{
137
+ type: "toggle";
138
+ valueType: "string" | "number" | "boolean";
139
+ defaultValue: string | number | boolean | null;
140
+ isOptional: boolean;
141
+ }>>]>, v.GenericSchema], undefined>;
142
+ }>]>;
143
+ readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
144
+ readonly type: v.LiteralSchema<"ref", undefined>;
145
+ readonly id: v.StringSchema<undefined>;
146
+ readonly name: v.StringSchema<undefined>;
147
+ }, undefined>, v.ReadonlyAction<{
148
+ type: "ref";
149
+ id: string;
150
+ name: string;
151
+ }>]>, 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<{
152
+ type: "ref";
153
+ id: string;
154
+ name: string;
155
+ }>, {
156
+ 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)[])[]>]>;
157
+ }>]>, undefined>;
158
+ }, undefined>, v.MetadataAction<{
159
+ name: string;
160
+ payload: unknown;
161
+ gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
162
+ type: "ref";
163
+ id: string;
164
+ name: string;
165
+ }> | undefined;
166
+ }, {
167
+ readonly serialisable: typeof BuilderOption;
168
+ readonly instance: v.InstanceSchema<typeof BuilderOption, undefined>;
169
+ }>, v.ReadonlyAction<{
170
+ name: string;
171
+ payload: unknown;
172
+ gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
173
+ type: "ref";
174
+ id: string;
175
+ name: string;
176
+ }> | undefined;
177
+ }>]>;
178
+ export type BuilderOptionSerialised = v.InferOutput<typeof BuilderOptionSerialisedSchema>;
179
+ export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
180
+ readonly name: v.StringSchema<undefined>;
181
+ readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
182
+ readonly type: v.LiteralSchema<"ref", undefined>;
183
+ readonly id: v.StringSchema<undefined>;
184
+ readonly name: v.StringSchema<undefined>;
185
+ }, undefined>, v.ReadonlyAction<{
186
+ type: "ref";
187
+ id: string;
188
+ name: string;
189
+ }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
190
+ readonly type: v.LiteralSchema<"select", undefined>;
191
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
192
+ readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
193
+ readonly isOptional: v.BooleanSchema<undefined>;
194
+ readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
195
+ }, undefined>, v.MetadataAction<{
196
+ type: "select";
197
+ readonly options: readonly [string, ...string[]];
198
+ defaultValue: string | null;
199
+ isOptional: boolean;
200
+ optionLabels: {
201
+ [x: string]: string;
202
+ };
203
+ }, {
204
+ readonly serialisable: typeof import("./select").BuilderSelectType;
205
+ readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
206
+ }>, v.ReadonlyAction<{
207
+ type: "select";
208
+ readonly options: readonly [string, ...string[]];
209
+ defaultValue: string | null;
210
+ isOptional: boolean;
211
+ optionLabels: {
212
+ [x: string]: string;
213
+ };
214
+ }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
215
+ readonly type: v.LiteralSchema<"toggle", undefined>;
216
+ readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
217
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
218
+ readonly isOptional: v.BooleanSchema<undefined>;
219
+ }, undefined>, v.MetadataAction<{
220
+ type: "toggle";
221
+ valueType: "string" | "number" | "boolean";
222
+ defaultValue: string | number | boolean | null;
223
+ isOptional: boolean;
224
+ }, {
225
+ readonly serialisable: typeof import("./toggle").BuilderToggleType;
226
+ readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
227
+ }>, v.ReadonlyAction<{
228
+ type: "toggle";
229
+ valueType: "string" | "number" | "boolean";
230
+ defaultValue: string | number | boolean | null;
231
+ isOptional: boolean;
232
+ }>]>], undefined>, v.ReadonlyAction<Readonly<{
233
+ type: "select";
234
+ readonly options: readonly [string, ...string[]];
235
+ defaultValue: string | null;
236
+ isOptional: boolean;
237
+ optionLabels: {
238
+ [x: string]: string;
239
+ };
240
+ }> | Readonly<{
241
+ type: "toggle";
242
+ valueType: "string" | "number" | "boolean";
243
+ defaultValue: string | number | boolean | null;
244
+ isOptional: boolean;
245
+ }>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
246
+ readonly refable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
247
+ readonly type: v.LiteralSchema<"select", undefined>;
248
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
249
+ readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
250
+ readonly isOptional: v.BooleanSchema<undefined>;
251
+ readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
252
+ }, undefined>, v.MetadataAction<{
253
+ type: "select";
254
+ readonly options: readonly [string, ...string[]];
255
+ defaultValue: string | null;
256
+ isOptional: boolean;
257
+ optionLabels: {
258
+ [x: string]: string;
259
+ };
260
+ }, {
261
+ readonly serialisable: typeof import("./select").BuilderSelectType;
262
+ readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
263
+ }>, v.ReadonlyAction<{
264
+ type: "select";
265
+ readonly options: readonly [string, ...string[]];
266
+ defaultValue: string | null;
267
+ isOptional: boolean;
268
+ optionLabels: {
269
+ [x: string]: string;
270
+ };
271
+ }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
272
+ readonly type: v.LiteralSchema<"toggle", undefined>;
273
+ readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
274
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
275
+ readonly isOptional: v.BooleanSchema<undefined>;
276
+ }, undefined>, v.MetadataAction<{
277
+ type: "toggle";
278
+ valueType: "string" | "number" | "boolean";
279
+ defaultValue: string | number | boolean | null;
280
+ isOptional: boolean;
281
+ }, {
282
+ readonly serialisable: typeof import("./toggle").BuilderToggleType;
283
+ readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
284
+ }>, v.ReadonlyAction<{
285
+ type: "toggle";
286
+ valueType: "string" | "number" | "boolean";
287
+ defaultValue: string | number | boolean | null;
288
+ isOptional: boolean;
289
+ }>]>], undefined>, v.ReadonlyAction<Readonly<{
290
+ type: "select";
291
+ readonly options: readonly [string, ...string[]];
292
+ defaultValue: string | null;
293
+ isOptional: boolean;
294
+ optionLabels: {
295
+ [x: string]: string;
296
+ };
297
+ }> | Readonly<{
298
+ type: "toggle";
299
+ valueType: "string" | "number" | "boolean";
300
+ defaultValue: string | number | boolean | null;
301
+ isOptional: boolean;
302
+ }>>]>, v.GenericSchema], undefined>;
303
+ }>]>;
304
+ readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
305
+ readonly type: v.LiteralSchema<"ref", undefined>;
306
+ readonly id: v.StringSchema<undefined>;
307
+ readonly name: v.StringSchema<undefined>;
308
+ }, undefined>, v.ReadonlyAction<{
309
+ type: "ref";
310
+ id: string;
311
+ name: string;
312
+ }>]>, 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<{
313
+ type: "ref";
314
+ id: string;
315
+ name: string;
316
+ }>, {
317
+ 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)[])[]>]>;
318
+ }>]>, undefined>;
319
+ }, undefined>, v.MetadataAction<{
320
+ name: string;
321
+ payload: unknown;
322
+ gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
323
+ type: "ref";
324
+ id: string;
325
+ name: string;
326
+ }> | undefined;
327
+ }, {
328
+ readonly serialisable: typeof BuilderOption;
329
+ readonly instance: v.InstanceSchema<typeof BuilderOption, undefined>;
330
+ }>, v.ReadonlyAction<{
331
+ name: string;
332
+ payload: unknown;
333
+ gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
334
+ type: "ref";
335
+ id: string;
336
+ name: string;
337
+ }> | undefined;
338
+ }>]>, undefined>, v.ReadonlyAction<Readonly<{
339
+ name: string;
340
+ payload: unknown;
341
+ gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
342
+ type: "ref";
343
+ id: string;
344
+ name: string;
345
+ }> | undefined;
346
+ }>[]>]>;
347
+ export type BuilderOptionsSerialised = v.InferOutput<typeof BuilderOptionsSerialisedSchema>;
@@ -0,0 +1,24 @@
1
+ import * as v from 'valibot';
2
+ import { BuilderPathsSchema } from '../../paths.js';
3
+ import { refable } from '../../references.js';
4
+ import { serialisable } from '../../serialisable.js';
5
+ import { createWhenSerialisedSchema } from '../when.js';
6
+ import { BuilderOptionValuesSerialisedSchema } from './values.js';
7
+ export class BuilderOption {
8
+ name;
9
+ payload;
10
+ gatePaths;
11
+ constructor(name, payload, gatePaths) {
12
+ this.name = name;
13
+ this.payload = payload;
14
+ this.gatePaths = gatePaths;
15
+ }
16
+ }
17
+ export const BuilderOptionSchema = v.instance(BuilderOption);
18
+ export const BuilderOptionWhenSerialisedSchema = createWhenSerialisedSchema(BuilderOptionValuesSerialisedSchema);
19
+ export const BuilderOptionSerialisedSchema = serialisable(BuilderOption, v.object({
20
+ name: v.string(),
21
+ payload: refable(v.union([BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema])),
22
+ gatePaths: v.optional(refable(BuilderPathsSchema))
23
+ }));
24
+ export const BuilderOptionsSerialisedSchema = v.pipe(v.array(BuilderOptionSerialisedSchema), v.readonly());
@@ -0,0 +1,49 @@
1
+ import * as v from 'valibot';
2
+ export type BuilderSelectTypeLabels<Values extends BuilderSelectTypeValues> = Partial<Record<Values[number], string>>;
3
+ export type BuilderSelectTypeValues = readonly [string, ...ReadonlyArray<string>];
4
+ export declare class BuilderSelectType<const Values extends BuilderSelectTypeValues = BuilderSelectTypeValues, const ValueSchema extends v.GenericSchema<string | null> = v.GenericSchema<string | null>> {
5
+ readonly value: v.InferOutput<ValueSchema>;
6
+ readonly type: "select";
7
+ readonly options: Values;
8
+ readonly valueSchema: ValueSchema;
9
+ readonly defaultValue: v.InferOutput<ValueSchema>;
10
+ readonly isOptional: boolean;
11
+ readonly optionLabels: BuilderSelectTypeLabels<Values>;
12
+ constructor(values: Values, defaultValue: v.InferOutput<ValueSchema>, optional?: boolean, optionLabels?: BuilderSelectTypeLabels<Values>);
13
+ default(newDefault: v.InferOutput<ValueSchema>): BuilderSelectType<Values, ValueSchema>;
14
+ optional(): BuilderSelectType<Values, v.NullableSchema<ValueSchema, undefined>>;
15
+ labels(optionLabels: BuilderSelectTypeLabels<Values>): BuilderSelectType<Values, ValueSchema>;
16
+ }
17
+ type SelectSchema<Values extends BuilderSelectTypeValues> = v.UnionSchema<{
18
+ [K in keyof Values]: v.LiteralSchema<Values[K], undefined>;
19
+ }, undefined>;
20
+ export declare function select<const Values extends BuilderSelectTypeValues>(values: Values): BuilderSelectType<Values, SelectSchema<Values>>;
21
+ export declare const BuilderSelectTypeSchema: v.InstanceSchema<typeof BuilderSelectType, undefined>;
22
+ export declare const BuilderSelectTypeSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
+ readonly type: v.LiteralSchema<"select", undefined>;
24
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
25
+ readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
26
+ readonly isOptional: v.BooleanSchema<undefined>;
27
+ readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
28
+ }, undefined>, v.MetadataAction<{
29
+ type: "select";
30
+ readonly options: readonly [string, ...string[]];
31
+ defaultValue: string | null;
32
+ isOptional: boolean;
33
+ optionLabels: {
34
+ [x: string]: string;
35
+ };
36
+ }, {
37
+ readonly serialisable: typeof BuilderSelectType;
38
+ readonly instance: v.InstanceSchema<typeof BuilderSelectType, undefined>;
39
+ }>, v.ReadonlyAction<{
40
+ type: "select";
41
+ readonly options: readonly [string, ...string[]];
42
+ defaultValue: string | null;
43
+ isOptional: boolean;
44
+ optionLabels: {
45
+ [x: string]: string;
46
+ };
47
+ }>]>;
48
+ export type BuilderSelectTypeSerialised = v.InferOutput<typeof BuilderSelectTypeSerialisedSchema>;
49
+ export {};