@builder-builder/builder 0.0.3 → 0.0.5
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 +8 -0
- package/dist/check.js +18 -0
- package/dist/core/builder.d.ts +31 -22
- package/dist/core/builder.js +73 -27
- package/dist/core/collection/collection.d.ts +9 -12
- package/dist/core/collection/collection.js +9 -27
- package/dist/core/collection/index.d.ts +1 -1
- package/dist/core/collection/method.d.ts +22 -43
- package/dist/core/component/component.d.ts +1 -4
- package/dist/core/component/graph.d.ts +0 -3
- package/dist/core/component/graph.js +7 -9
- package/dist/core/component/method.d.ts +7 -9
- package/dist/core/expectation.d.ts +39 -0
- package/dist/{assert → core}/expectation.js +3 -2
- package/dist/core/graph.d.ts +2 -1
- package/dist/core/graph.js +3 -1
- package/dist/core/index.d.ts +8 -4
- package/dist/core/index.js +3 -1
- package/dist/core/option/graph.js +7 -5
- package/dist/core/option/method.d.ts +60 -42
- package/dist/core/option/method.js +7 -3
- package/dist/core/option/option.d.ts +14 -7
- package/dist/core/option/option.js +15 -23
- package/dist/core/option/select.d.ts +6 -1
- package/dist/core/option/select.js +5 -1
- package/dist/core/parameter.d.ts +48 -0
- package/dist/core/parameter.js +31 -0
- package/dist/core/when/config.d.ts +20 -0
- package/dist/core/when/config.js +4 -0
- package/dist/core/when/constrain.d.ts +14 -0
- package/dist/core/when/index.d.ts +5 -0
- package/dist/core/when/index.js +2 -0
- package/dist/core/when/nullability.d.ts +18 -0
- package/dist/core/when/nullability.js +1 -0
- package/dist/core/when/resolve.d.ts +18 -0
- package/dist/core/when/resolve.js +22 -0
- package/dist/index.d.ts +7 -10
- package/dist/index.js +2 -3
- package/dist/{config.d.ts → model.d.ts} +1 -1
- package/dist/model.js +1 -0
- package/dist/paths.d.ts +4 -3
- package/dist/resolve/index.d.ts +2 -2
- package/dist/resolve/instance.d.ts +2 -2
- package/dist/resolve/models.d.ts +1 -1
- package/dist/resolve/order.d.ts +7 -6
- package/dist/resolve/render.d.ts +4 -4
- package/dist/resolve/render.js +49 -60
- package/dist/resolve/validate.d.ts +6 -5
- package/dist/resolve/validate.js +5 -4
- package/dist/schemas/index.d.ts +2 -6
- package/dist/schemas/index.js +1 -3
- package/dist/serialise/deserialise.js +11 -6
- package/dist/serialise/index.d.ts +2 -2
- package/dist/serialise/index.js +1 -1
- package/dist/{schemas/serialise.d.ts → serialise/schemas.d.ts} +1050 -242
- package/dist/{schemas/serialise.js → serialise/schemas.js} +47 -47
- package/dist/serialise/serialise.d.ts +1 -1
- package/dist/serialise/serialise.js +19 -2
- package/dist/ui.d.ts +12 -12
- package/dist/ui.js +23 -16
- package/package.json +1 -1
- package/dist/assert/assert.d.ts +0 -28
- package/dist/assert/assert.js +0 -28
- package/dist/assert/expectation.d.ts +0 -20
- package/dist/assert/index.d.ts +0 -3
- package/dist/assert/index.js +0 -2
- package/dist/invariant.d.ts +0 -1
- package/dist/invariant.js +0 -6
- package/dist/schemas/layout.d.ts +0 -52
- package/dist/schemas/layout.js +0 -6
- /package/dist/{config.js → core/when/constrain.js} +0 -0
package/dist/core/graph.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuilderModels } from '../
|
|
1
|
+
import type { BuilderModels } from '../model';
|
|
2
2
|
export type GraphKeys = ReadonlySet<string>;
|
|
3
3
|
export type GraphPath = {
|
|
4
4
|
name: string;
|
|
@@ -6,3 +6,4 @@ export type GraphPath = {
|
|
|
6
6
|
models: BuilderModels;
|
|
7
7
|
};
|
|
8
8
|
export type GraphPaths = ReadonlyArray<GraphPath>;
|
|
9
|
+
export declare function crossProduct(left: BuilderModels, right: BuilderModels): BuilderModels;
|
package/dist/core/graph.js
CHANGED
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export type { BuilderCollectionConfig, BuilderCollectionEnableConfig, BuilderCollectionEntries, BuilderCollectionMatchConfig, BuilderCollectionMethod, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderCollectionUnlessConfig, BuilderCollectionWhenConfig
|
|
1
|
+
export type { BuilderCollectionConfig, BuilderCollectionEnableConfig, BuilderCollectionEntries, BuilderCollectionMatchConfig, BuilderCollectionMethod, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderCollectionUnlessConfig, BuilderCollectionWhenConfig } from './collection/index';
|
|
2
2
|
export type { BuilderComponentEntries, BuilderComponentMap, BuilderComponentMethod, BuilderComponentNamesOf } from './component/index';
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
3
|
+
export type { BuilderExpectationEntries, BuilderExpectations, BuilderModelAsserted } from './expectation';
|
|
4
|
+
export type { BuilderOptionEnableConfig, BuilderOptionEntries, BuilderOptionMatchConfig, BuilderOptionMethod, BuilderOptionUnlessConfig, BuilderOptionValues, BuilderOptionValuesMap, BuilderOptionWhenConfig, BuilderSelectTypeLabels, BuilderSelectTypeValues } from './option/index';
|
|
5
|
+
export type { BuilderWhenEnableConfig, BuilderWhenMatchConfig, BuilderWhenUnlessConfig } from './when/index';
|
|
6
|
+
export type { BuilderMerge, BuilderGeneric, BuilderModelOf, Builders, BuilderState, BuilderStateEmpty, BuilderStateOf } from './builder';
|
|
7
|
+
export { Builder, builder } from './builder.js';
|
|
5
8
|
export { BuilderCollection, collection, resolveCollectionModels, resolveCollectionNames } from './collection/index.js';
|
|
6
9
|
export { BuilderComponent, BuilderComponentGraph } from './component/index.js';
|
|
10
|
+
export { BuilderExpectation, component, option } from './expectation.js';
|
|
7
11
|
export { BuilderOption, BuilderOptionGraph, select, BuilderSelectType, BuilderToggleType, toggleBoolean, toggleNumber, toggleString, enable, match, unless } from './option/index.js';
|
|
8
|
-
export {
|
|
12
|
+
export { BuilderParameter, BuilderParameterSchema } from './parameter.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export { Builder, builder } from './builder.js';
|
|
1
2
|
export { BuilderCollection, collection, resolveCollectionModels, resolveCollectionNames } from './collection/index.js';
|
|
2
3
|
export { BuilderComponent, BuilderComponentGraph } from './component/index.js';
|
|
4
|
+
export { BuilderExpectation, component, option } from './expectation.js';
|
|
3
5
|
export { BuilderOption, BuilderOptionGraph, select, BuilderSelectType, BuilderToggleType, toggleBoolean, toggleNumber, toggleString, enable, match, unless } from './option/index.js';
|
|
4
|
-
export {
|
|
6
|
+
export { BuilderParameter, BuilderParameterSchema } from './parameter.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { crossProduct } from '../graph.js';
|
|
1
2
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
3
|
-
import { BuilderOption } from './option.js';
|
|
3
|
+
import { check } from '../../check.js';
|
|
4
|
+
import { BuilderOption, BuilderOptionValuesSchema } from './option.js';
|
|
4
5
|
import { BuilderSelectType } from './select.js';
|
|
5
6
|
export class BuilderOptionGraph {
|
|
6
7
|
paths;
|
|
@@ -15,7 +16,7 @@ export class BuilderOptionGraph {
|
|
|
15
16
|
}
|
|
16
17
|
get(name) {
|
|
17
18
|
const graphPath = this.paths.find((graphPath) => graphPath.name === name);
|
|
18
|
-
|
|
19
|
+
check.truthy(graphPath, `Option '${name}' not found in graph! ❌`);
|
|
19
20
|
return graphPath;
|
|
20
21
|
}
|
|
21
22
|
add(option) {
|
|
@@ -53,18 +54,19 @@ export class BuilderOptionGraph {
|
|
|
53
54
|
function mergePaths(dependencyKeys, graphPaths) {
|
|
54
55
|
const dependencyPaths = Array.from(dependencyKeys).map((dependencyKey) => {
|
|
55
56
|
const dependencyPath = graphPaths.find((graphPath) => graphPath.name === dependencyKey);
|
|
56
|
-
|
|
57
|
+
check.truthy(dependencyPath, `Option dependency '${dependencyKey}' not found in graph! ❌`);
|
|
57
58
|
return dependencyPath;
|
|
58
59
|
});
|
|
59
60
|
const [first, ...rest] = dependencyPaths;
|
|
60
61
|
return rest.reduce((merged, next) => {
|
|
61
62
|
const keys = new Set([...merged.keys, ...next.keys, next.name]);
|
|
62
|
-
const models = next.models
|
|
63
|
+
const models = crossProduct(next.models, merged.models);
|
|
63
64
|
return { keys, models };
|
|
64
65
|
}, { keys: new Set([...first.keys, first.name]), models: first.models });
|
|
65
66
|
}
|
|
66
67
|
function optionValues(option) {
|
|
67
68
|
const values = option.values;
|
|
69
|
+
check.assert(BuilderOptionValuesSchema, values);
|
|
68
70
|
if (v.is(v.instance(BuilderSelectType), values)) {
|
|
69
71
|
return [...values.options];
|
|
70
72
|
}
|
|
@@ -1,52 +1,70 @@
|
|
|
1
|
-
import type { BuilderPrimitive } from '../../
|
|
2
|
-
import type { BuilderPath,
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { BuilderOptionValues, BuilderOptionValuesMap } from './option';
|
|
6
|
-
import
|
|
7
|
-
export type BuilderOptionEnableConfig<Values extends BuilderOptionValues = BuilderOptionValues> =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export type
|
|
12
|
-
readonly
|
|
13
|
-
|
|
14
|
-
readonly selectMap: SelectMap;
|
|
15
|
-
};
|
|
16
|
-
export type BuilderOptionUnlessConfig<Values extends BuilderOptionValues = BuilderOptionValues, UnlessPath extends BuilderPath = BuilderPath> = {
|
|
17
|
-
readonly type: 'unless';
|
|
18
|
-
readonly unlessPath: UnlessPath;
|
|
19
|
-
readonly disabledValues: ReadonlyArray<BuilderPrimitive>;
|
|
20
|
-
readonly values: Values;
|
|
21
|
-
};
|
|
22
|
-
export type BuilderOptionWhenConfig = BuilderOptionEnableConfig<BuilderOptionValues> | BuilderOptionMatchConfig<BuilderOptionValuesMap> | BuilderOptionUnlessConfig<BuilderOptionValues>;
|
|
23
|
-
export type BuilderOptionWhenConfigValues<Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionEnableConfig<infer Values> ? Values : Config extends BuilderOptionUnlessConfig<infer Values> ? Values : Config extends BuilderOptionMatchConfig<infer SelectMapType> ? NonNullable<SelectMapType[keyof SelectMapType]> & BuilderOptionValues : never;
|
|
1
|
+
import type { BuilderPrimitive } from '../../model';
|
|
2
|
+
import type { BuilderPath, BuilderResolvePath, BuilderValidPath, BuilderValidPaths } from '../../paths';
|
|
3
|
+
import type { BuilderMerge, BuilderState } from '../builder';
|
|
4
|
+
import type { BuilderWhenEnableConfig, BuilderWhenMatchConfig, BuilderWhenUnlessConfig, WhenNullability, WhenPathsNullable } from '../when/index';
|
|
5
|
+
import type { BuilderOption, BuilderOptionValueType, BuilderOptionValues, BuilderOptionValuesMap } from './option';
|
|
6
|
+
import { BuilderParameter } from '../parameter.js';
|
|
7
|
+
export type BuilderOptionEnableConfig<Values extends BuilderOptionValues | BuilderParameter = BuilderOptionValues | BuilderParameter> = BuilderWhenEnableConfig<OptionPayload<Values>>;
|
|
8
|
+
export type BuilderOptionMatchConfig<SelectMap extends BuilderOptionValuesMap | BuilderParameter = BuilderOptionValuesMap | BuilderParameter, MatchPath extends BuilderPath = BuilderPath> = BuilderWhenMatchConfig<SelectMap, MatchPath>;
|
|
9
|
+
export type BuilderOptionUnlessConfig<Values extends BuilderOptionValues | BuilderParameter = BuilderOptionValues | BuilderParameter, UnlessPath extends BuilderPath = BuilderPath> = BuilderWhenUnlessConfig<OptionPayload<Values>, UnlessPath>;
|
|
10
|
+
export type BuilderOptionWhenConfig = BuilderOptionEnableConfig | BuilderOptionMatchConfig | BuilderOptionUnlessConfig;
|
|
11
|
+
export type BuilderOptionWhenConfigValues<Config extends BuilderOptionWhenConfig> = Config extends {
|
|
12
|
+
readonly values: infer Values;
|
|
13
|
+
} ? Values extends BuilderOptionValues ? Values : never : Config extends BuilderOptionMatchConfig<infer SelectMapType> ? SelectMapType extends BuilderOptionValuesMap ? NonNullable<SelectMapType[keyof SelectMapType]> & BuilderOptionValues : never : never;
|
|
24
14
|
export type BuilderOptionMethod<State extends BuilderState> = {
|
|
25
|
-
<const Name extends string, const Values extends BuilderOptionValues>(name: Name, values: Values):
|
|
15
|
+
<const Name extends string, const Values extends BuilderOptionValues>(name: Name, values: Values): BuilderMerge<State, {
|
|
26
16
|
model: State['model'] & {
|
|
27
|
-
[K in Name]: Values
|
|
17
|
+
[K in Name]: BuilderOptionValueType<Values>;
|
|
28
18
|
};
|
|
29
19
|
options: [...State['options'], BuilderOption<Name, Values>];
|
|
30
|
-
}
|
|
31
|
-
|
|
20
|
+
}>;
|
|
21
|
+
<const Name extends string>(name: Name, values: BuilderParameter): BuilderMerge<State, {
|
|
32
22
|
model: State['model'] & {
|
|
33
|
-
[K in Name]:
|
|
23
|
+
[K in Name]: string;
|
|
34
24
|
};
|
|
35
|
-
options: [...State['options'], BuilderOption<Name,
|
|
36
|
-
}
|
|
25
|
+
options: [...State['options'], BuilderOption<Name, BuilderParameter>];
|
|
26
|
+
}>;
|
|
27
|
+
when: {
|
|
28
|
+
<const GatePaths extends BuilderValidPaths<State['model']>, const Name extends string>(gatePaths: GatePaths, name: Name, config: BuilderParameter): BuilderMerge<State, {
|
|
29
|
+
model: State['model'] & {
|
|
30
|
+
[K in Name]: string | WhenPathsNullable<State['model'], GatePaths>;
|
|
31
|
+
};
|
|
32
|
+
options: [...State['options'], BuilderOption<Name, BuilderParameter>];
|
|
33
|
+
}>;
|
|
34
|
+
<const GatePaths extends BuilderValidPaths<State['model']>, const Name extends string, const Config extends BuilderOptionWhenConfig>(gatePaths: GatePaths, name: Name, config: Config & ValidOptionWhenConfig<State['model'], Config>): BuilderMerge<State, OptionWhenResult<State, GatePaths, Name, Config>>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const enable: typeof createEnable & {
|
|
38
|
+
parameter: () => BuilderParameter;
|
|
39
|
+
};
|
|
40
|
+
export declare const match: typeof createMatch & {
|
|
41
|
+
parameter: () => BuilderParameter;
|
|
42
|
+
};
|
|
43
|
+
export declare const unless: typeof createUnless & {
|
|
44
|
+
parameter: () => BuilderParameter;
|
|
45
|
+
};
|
|
46
|
+
type OptionPayload<Values extends BuilderOptionValues | BuilderParameter = BuilderOptionValues | BuilderParameter> = {
|
|
47
|
+
readonly values: Values;
|
|
48
|
+
};
|
|
49
|
+
type WhenParameterOf<Config extends BuilderOptionWhenConfig> = Config extends {
|
|
50
|
+
readonly values: infer Values;
|
|
51
|
+
} ? Values extends BuilderParameter ? Values : never : never;
|
|
52
|
+
type OptionWhenResult<State extends BuilderState, GatePaths extends BuilderValidPaths<State['model']>, Name extends string, Config extends BuilderOptionWhenConfig> = WhenParameterOf<Config> extends never ? {
|
|
53
|
+
model: State['model'] & {
|
|
54
|
+
[K in Name]: BuilderOptionValueType<BuilderOptionWhenConfigValues<Config>> | WhenNullability<State['model'], GatePaths, Config>;
|
|
55
|
+
};
|
|
56
|
+
options: [...State['options'], BuilderOption<Name, BuilderOptionWhenConfigValues<Config>>];
|
|
57
|
+
} : {
|
|
58
|
+
model: State['model'] & {
|
|
59
|
+
[K in Name]: string | null;
|
|
60
|
+
};
|
|
61
|
+
options: [...State['options'], BuilderOption<Name, WhenParameterOf<Config>>];
|
|
37
62
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export declare function unless<const Values extends BuilderOptionValues, const UnlessPath extends BuilderPath>(unlessPath: UnlessPath, disabledValues: ReadonlyArray<BuilderPrimitive>, values: Values): BuilderOptionUnlessConfig<Values, UnlessPath>;
|
|
41
|
-
type OptionConfigNullable<Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionUnlessConfig ? null : Config extends BuilderOptionMatchConfig<infer SelectMapType> ? null extends SelectMapType[keyof SelectMapType] ? null : never : never;
|
|
42
|
-
type OptionGatePathNullable<Model, Path extends BuilderPath> = null extends BuilderResolvePath<Model, Path> ? null : never;
|
|
43
|
-
type OptionGatePathsNullable<Model, GatePaths extends BuilderPaths> = GatePaths extends readonly [
|
|
44
|
-
infer Head extends BuilderPath,
|
|
45
|
-
...infer Tail extends BuilderPaths
|
|
46
|
-
] ? OptionGatePathNullable<Model, Head> | OptionGatePathsNullable<Model, Tail> : never;
|
|
47
|
-
type OptionWhenNullability<Model, GatePaths extends BuilderPaths, Config extends BuilderOptionWhenConfig> = OptionGatePathsNullable<Model, GatePaths> | OptionConfigNullable<Config>;
|
|
48
|
-
type MatchKeyOfConfig<Model, Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionMatchConfig<any, infer MatchPath> ? BuilderResolvePath<Model, MatchPath> & string : string;
|
|
49
|
-
type WhenConfigConstrained<Model, Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionMatchConfig<any, infer MatchPath> ? BuilderOptionMatchConfig<Record<MatchKeyOfConfig<Model, Config>, BuilderOptionValuesMap[string]>, MatchPath & Readonly<BuilderValidPath<Model>>> : Config extends BuilderOptionUnlessConfig ? Config & {
|
|
63
|
+
type WhenMatchKeyOf<Model, Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionMatchConfig<any, infer MatchPath> ? BuilderResolvePath<Model, MatchPath> & string : string;
|
|
64
|
+
type ValidOptionWhenConfig<Model, Config extends BuilderOptionWhenConfig> = Config extends BuilderOptionMatchConfig<infer SelectMap, infer MatchPath> ? SelectMap extends BuilderParameter ? BuilderOptionMatchConfig<SelectMap, MatchPath & Readonly<BuilderValidPath<Model>>> : BuilderOptionMatchConfig<Record<WhenMatchKeyOf<Model, Config>, BuilderOptionValuesMap[string]>, MatchPath & Readonly<BuilderValidPath<Model>>> : Config extends BuilderOptionUnlessConfig<infer Values, infer UnlessPath> ? Values extends BuilderParameter ? BuilderOptionUnlessConfig<Values, UnlessPath & Readonly<BuilderValidPath<Model>>> : Config & {
|
|
50
65
|
readonly unlessPath: Readonly<BuilderValidPath<Model>>;
|
|
51
66
|
} : Config;
|
|
67
|
+
declare function createEnable<const Values extends BuilderOptionValues>(values: Values): BuilderOptionEnableConfig<Values>;
|
|
68
|
+
declare function createMatch<const MatchPath extends BuilderPath, const SelectMap extends BuilderOptionValuesMap>(matchPath: MatchPath, selectMap: SelectMap): BuilderOptionMatchConfig<SelectMap, MatchPath>;
|
|
69
|
+
declare function createUnless<const Values extends BuilderOptionValues, const UnlessPath extends BuilderPath>(unlessPath: UnlessPath, disabledValues: ReadonlyArray<BuilderPrimitive>, values: Values): BuilderOptionUnlessConfig<Values, UnlessPath>;
|
|
52
70
|
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { BuilderParameter } from '../parameter.js';
|
|
2
|
+
export const enable = Object.assign(createEnable, { parameter: () => new BuilderParameter() });
|
|
3
|
+
export const match = Object.assign(createMatch, { parameter: () => new BuilderParameter() });
|
|
4
|
+
export const unless = Object.assign(createUnless, { parameter: () => new BuilderParameter() });
|
|
5
|
+
function createEnable(values) {
|
|
2
6
|
return { type: 'enable', values };
|
|
3
7
|
}
|
|
4
|
-
|
|
8
|
+
function createMatch(matchPath, selectMap) {
|
|
5
9
|
return { type: 'match', matchPath, selectMap };
|
|
6
10
|
}
|
|
7
|
-
|
|
11
|
+
function createUnless(unlessPath, disabledValues, values) {
|
|
8
12
|
return { type: 'unless', unlessPath, disabledValues, values };
|
|
9
13
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import type { BuilderPaths } from '../../paths';
|
|
2
|
+
import type { BuilderParameter } from '../parameter';
|
|
2
3
|
import type { BuilderOptionWhenConfig } from './method';
|
|
3
|
-
import type {
|
|
4
|
-
import type { BuilderToggleType } from './toggle';
|
|
4
|
+
import type { BuilderSelectTypeValues } from './select';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
|
+
import { BuilderSelectType } from './select.js';
|
|
7
|
+
import { BuilderToggleType } from './toggle.js';
|
|
8
|
+
export declare const BuilderOptionValuesSchema: v.UnionSchema<[v.InstanceSchema<typeof BuilderSelectType, undefined>, v.InstanceSchema<typeof BuilderToggleType, undefined>], undefined>;
|
|
9
|
+
export type BuilderOptionValues = v.InferOutput<typeof BuilderOptionValuesSchema>;
|
|
10
|
+
export declare const BuilderOptionValuesMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.UnionSchema<[v.InstanceSchema<typeof BuilderSelectType, undefined>, v.InstanceSchema<typeof BuilderToggleType, undefined>], undefined>, undefined>, undefined>;
|
|
11
|
+
export type BuilderOptionValuesMap = v.InferOutput<typeof BuilderOptionValuesMapSchema>;
|
|
6
12
|
export type BuilderOptionValueSchema = v.GenericSchema<string | number | boolean | null>;
|
|
7
13
|
export type BuilderSelectTypeGeneric = BuilderSelectType<BuilderSelectTypeValues, BuilderOptionValueSchema>;
|
|
8
14
|
export type BuilderToggleTypeGeneric = BuilderToggleType<BuilderOptionValueSchema>;
|
|
9
|
-
export type
|
|
10
|
-
|
|
15
|
+
export type BuilderOptionValueType<Values> = Values extends BuilderParameter ? string : Values extends {
|
|
16
|
+
readonly value: infer Value;
|
|
17
|
+
} ? Value : never;
|
|
11
18
|
export type BuilderOptionEntries = ReadonlyArray<BuilderOption>;
|
|
12
|
-
export declare class BuilderOption<const Name extends string = string, const Values extends BuilderOptionValues = BuilderOptionValues> {
|
|
19
|
+
export declare class BuilderOption<const Name extends string = string, const Values extends BuilderOptionValues | BuilderParameter = BuilderOptionValues | BuilderParameter> {
|
|
13
20
|
readonly model: {
|
|
14
|
-
[K in Name]: Values
|
|
21
|
+
[K in Name]: BuilderOptionValueType<Values>;
|
|
15
22
|
};
|
|
16
23
|
readonly name: Name;
|
|
17
24
|
readonly values: Values;
|
|
18
25
|
readonly gatePaths: BuilderPaths;
|
|
19
26
|
readonly config: BuilderOptionWhenConfig | null;
|
|
20
27
|
constructor(name: Name, values: Values, gatePaths?: BuilderPaths, config?: BuilderOptionWhenConfig | null);
|
|
21
|
-
resolve(model: unknown): BuilderOption<Name> | null;
|
|
28
|
+
resolve(model: unknown): BuilderOption<Name, BuilderOptionValues> | null;
|
|
22
29
|
dependencyKeys(): ReadonlyArray<string>;
|
|
23
30
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
2
|
+
import { check } from '../../check.js';
|
|
3
|
+
import { resolve } from '../when/index.js';
|
|
4
|
+
import { BuilderSelectType } from './select.js';
|
|
5
|
+
import { BuilderToggleType } from './toggle.js';
|
|
6
|
+
export const BuilderOptionValuesSchema = v.union([
|
|
7
|
+
v.instance(BuilderSelectType),
|
|
8
|
+
v.instance(BuilderToggleType)
|
|
9
|
+
]);
|
|
10
|
+
export const BuilderOptionValuesMapSchema = v.record(v.string(), v.nullable(BuilderOptionValuesSchema));
|
|
3
11
|
export class BuilderOption {
|
|
4
12
|
name;
|
|
5
13
|
values;
|
|
@@ -12,28 +20,12 @@ export class BuilderOption {
|
|
|
12
20
|
this.config = config;
|
|
13
21
|
}
|
|
14
22
|
resolve(model) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
switch (this.config.type) {
|
|
22
|
-
case 'enable': {
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
case 'match': {
|
|
26
|
-
const matchPath = this.config.matchPath;
|
|
27
|
-
const entry = this.config.selectMap[String(readPath(model, matchPath))];
|
|
28
|
-
return entry ? new BuilderOption(this.name, entry) : null;
|
|
29
|
-
}
|
|
30
|
-
case 'unless': {
|
|
31
|
-
const value = readPath(model, this.config.unlessPath);
|
|
32
|
-
return !this.config.disabledValues.includes(value)
|
|
33
|
-
? this
|
|
34
|
-
: null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
23
|
+
check.assert(BuilderOptionValuesSchema, this.values);
|
|
24
|
+
return resolve(this, model, (selectMap, matchValue) => {
|
|
25
|
+
check.assert(BuilderOptionValuesMapSchema, selectMap);
|
|
26
|
+
const entry = selectMap[matchValue];
|
|
27
|
+
return entry ? new BuilderOption(this.name, entry) : null;
|
|
28
|
+
});
|
|
37
29
|
}
|
|
38
30
|
dependencyKeys() {
|
|
39
31
|
const keys = new Set(this.gatePaths.map((path) => String(path[0])));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BuilderOptionValueSchema } from './option';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
+
import { BuilderParameter } from '../parameter.js';
|
|
3
4
|
export type BuilderSelectTypeValues = readonly [string, ...ReadonlyArray<string>];
|
|
4
5
|
export type BuilderSelectTypeLabels<Values extends BuilderSelectTypeValues> = Partial<Record<Values[number], string>>;
|
|
5
6
|
export declare class BuilderSelectType<const Values extends BuilderSelectTypeValues = BuilderSelectTypeValues, const ValueSchema extends BuilderOptionValueSchema = BuilderOptionValueSchema> {
|
|
@@ -14,4 +15,8 @@ export declare class BuilderSelectType<const Values extends BuilderSelectTypeVal
|
|
|
14
15
|
optional(): BuilderSelectType<Values, v.NullableSchema<ValueSchema, undefined>>;
|
|
15
16
|
labels(optionLabels: BuilderSelectTypeLabels<Values>): BuilderSelectType<Values, ValueSchema>;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
declare function createSelect<const Values extends BuilderSelectTypeValues>(values: Values): BuilderSelectType<Values, v.UnionSchema<v.LiteralSchema<Values[number], undefined>[], undefined>>;
|
|
19
|
+
export declare const select: typeof createSelect & {
|
|
20
|
+
parameter: () => BuilderParameter;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
import { BuilderParameter } from '../parameter.js';
|
|
2
3
|
export class BuilderSelectType {
|
|
3
4
|
options;
|
|
4
5
|
valueSchema;
|
|
@@ -23,8 +24,11 @@ export class BuilderSelectType {
|
|
|
23
24
|
return new BuilderSelectType(this.options, this.valueSchema, this.defaultValue, this.isOptional, optionLabels);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
function createSelect(values) {
|
|
27
28
|
const [defaultValue] = values;
|
|
28
29
|
const valueSchema = v.union(values.map((value) => v.literal(value)));
|
|
29
30
|
return new BuilderSelectType(values, valueSchema, defaultValue, false);
|
|
30
31
|
}
|
|
32
|
+
export const select = Object.assign(createSelect, {
|
|
33
|
+
parameter: () => new BuilderParameter()
|
|
34
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { BuilderValidPath } from '../paths';
|
|
2
|
+
import type { BuilderState, BuilderStateMerge } from './builder';
|
|
3
|
+
import type { BuilderOption, BuilderOptionEnableConfig, BuilderOptionEntries, BuilderOptionMatchConfig, BuilderOptionUnlessConfig, BuilderOptionValues, BuilderOptionWhenConfig } from './option/index';
|
|
4
|
+
import type { WhenConfigNullable } from './when/index';
|
|
5
|
+
import * as v from 'valibot';
|
|
6
|
+
export declare class BuilderParameter {
|
|
7
|
+
readonly parameter: true;
|
|
8
|
+
}
|
|
9
|
+
export declare const BuilderParameterSchema: v.InstanceSchema<typeof BuilderParameter, undefined>;
|
|
10
|
+
export type ParameterisedOptions<Options extends BuilderOptionEntries> = {
|
|
11
|
+
[K in keyof Options]: Options[K] extends BuilderOption<infer Name, infer Values> ? Values extends BuilderParameter ? BuilderOption<Name, Values> : never : never;
|
|
12
|
+
}[number];
|
|
13
|
+
export type BuilderBindings<State extends BuilderState> = {
|
|
14
|
+
readonly [P in ParameterisedOptions<State['options']> as P['name']]?: ValidBinding<State['model']>;
|
|
15
|
+
};
|
|
16
|
+
export type ReplaceOption<Options extends BuilderOptionEntries, BoundNames extends string> = Options extends readonly [
|
|
17
|
+
infer Head extends BuilderOption,
|
|
18
|
+
...infer Tail extends BuilderOptionEntries
|
|
19
|
+
] ? Head extends BuilderOption<infer Name, infer Values> ? Values extends BuilderParameter ? Name extends BoundNames ? [...ReplaceOption<Tail, BoundNames>] : [Head, ...ReplaceOption<Tail, BoundNames>] : [Head, ...ReplaceOption<Tail, BoundNames>] : [Head, ...ReplaceOption<Tail, BoundNames>] : [];
|
|
20
|
+
export type BuilderBoundState<State extends BuilderState, Bindings extends Record<string, unknown>> = BuilderStateMerge<State, {
|
|
21
|
+
options: ReplaceOption<State['options'], Extract<keyof Bindings, string>>;
|
|
22
|
+
model: Omit<State['model'], keyof Bindings> & {
|
|
23
|
+
[K in Extract<keyof Bindings, string>]: BindingModelType<Bindings[K]>;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
export declare function extractValues(config: BuilderOptionWhenConfig): BuilderOptionValues;
|
|
27
|
+
export declare function bindOptions<Bindings extends Record<string, unknown>>(options: BuilderOptionEntries, bindings: Bindings): BuilderOptionEntries;
|
|
28
|
+
type ValidEnableConfig = BuilderOptionEnableConfig<BuilderOptionEnableConfig['values']>;
|
|
29
|
+
type ValidMatchConfig<Model> = BuilderOptionMatchConfig<BuilderOptionMatchConfig['selectMap'], Readonly<BuilderValidPath<Model>>>;
|
|
30
|
+
type ValidUnlessConfig<Model> = BuilderOptionUnlessConfig<BuilderOptionUnlessConfig['values'], Readonly<BuilderValidPath<Model>>>;
|
|
31
|
+
type ValidBinding<Model> = BuilderOptionValues | ValidEnableConfig | ValidMatchConfig<Model> | ValidUnlessConfig<Model>;
|
|
32
|
+
type BindingConfigNullable<Binding> = Binding extends {
|
|
33
|
+
readonly type: string;
|
|
34
|
+
} ? WhenConfigNullable<Binding> : never;
|
|
35
|
+
type BindingValueType<Binding> = Binding extends {
|
|
36
|
+
readonly type: 'match';
|
|
37
|
+
readonly selectMap: infer SelectMap extends Record<string, unknown>;
|
|
38
|
+
} ? NonNullable<SelectMap[keyof SelectMap]> extends {
|
|
39
|
+
readonly value: infer Value;
|
|
40
|
+
} ? Value : string : Binding extends {
|
|
41
|
+
readonly values: infer Values;
|
|
42
|
+
} ? Values extends {
|
|
43
|
+
readonly value: infer Value;
|
|
44
|
+
} ? Value : string : Binding extends {
|
|
45
|
+
readonly value: infer Value;
|
|
46
|
+
} ? Value : string;
|
|
47
|
+
type BindingModelType<Binding> = BindingValueType<Binding> | BindingConfigNullable<Binding>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderWhenConfigSchema } from './when/index.js';
|
|
3
|
+
export class BuilderParameter {
|
|
4
|
+
parameter = true;
|
|
5
|
+
}
|
|
6
|
+
export const BuilderParameterSchema = v.instance(BuilderParameter);
|
|
7
|
+
export function extractValues(config) {
|
|
8
|
+
if (config.type === 'match') {
|
|
9
|
+
return Object.values(config.selectMap).find((value) => value !== null);
|
|
10
|
+
}
|
|
11
|
+
return config.values;
|
|
12
|
+
}
|
|
13
|
+
export function bindOptions(options, bindings) {
|
|
14
|
+
return options.map((option) => {
|
|
15
|
+
const binding = bindings[option.name];
|
|
16
|
+
if (binding == null) {
|
|
17
|
+
return option;
|
|
18
|
+
}
|
|
19
|
+
return bindOption(option, binding);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function createOption(option, values, config) {
|
|
23
|
+
const OptionConstructor = option.constructor;
|
|
24
|
+
return new OptionConstructor(option.name, values, option.gatePaths, config);
|
|
25
|
+
}
|
|
26
|
+
function bindOption(option, binding) {
|
|
27
|
+
if (v.is(BuilderWhenConfigSchema, binding)) {
|
|
28
|
+
return createOption(option, extractValues(binding), binding);
|
|
29
|
+
}
|
|
30
|
+
return createOption(option, binding, option.config);
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BuilderPrimitive } from '../../model';
|
|
2
|
+
import type { BuilderPath } from '../../paths';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
export declare const BuilderWhenConfigSchema: v.ObjectSchema<{
|
|
5
|
+
readonly type: v.PicklistSchema<["enable", "match", "unless"], undefined>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
export type BuilderWhenConfig = v.InferOutput<typeof BuilderWhenConfigSchema>;
|
|
8
|
+
export type BuilderWhenEnableConfig<Payload> = {
|
|
9
|
+
readonly type: 'enable';
|
|
10
|
+
} & Payload;
|
|
11
|
+
export type BuilderWhenMatchConfig<SelectMap = Record<string, unknown>, MatchPath extends BuilderPath = BuilderPath> = {
|
|
12
|
+
readonly type: 'match';
|
|
13
|
+
readonly matchPath: MatchPath;
|
|
14
|
+
readonly selectMap: SelectMap;
|
|
15
|
+
};
|
|
16
|
+
export type BuilderWhenUnlessConfig<Payload, UnlessPath extends BuilderPath = BuilderPath> = {
|
|
17
|
+
readonly type: 'unless';
|
|
18
|
+
readonly unlessPath: UnlessPath;
|
|
19
|
+
readonly disabledValues: ReadonlyArray<BuilderPrimitive>;
|
|
20
|
+
} & Payload;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BuilderValidPath } from '../../paths';
|
|
2
|
+
export type WhenConfigConstrained<Model, Config extends {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
}> = Config extends {
|
|
5
|
+
readonly type: 'match';
|
|
6
|
+
readonly matchPath: infer MatchPath;
|
|
7
|
+
} ? Config & {
|
|
8
|
+
readonly matchPath: MatchPath & Readonly<BuilderValidPath<Model>>;
|
|
9
|
+
} : Config extends {
|
|
10
|
+
readonly type: 'unless';
|
|
11
|
+
readonly unlessPath: infer UnlessPath;
|
|
12
|
+
} ? Config & {
|
|
13
|
+
readonly unlessPath: UnlessPath & Readonly<BuilderValidPath<Model>>;
|
|
14
|
+
} : Config;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { BuilderWhenConfig, BuilderWhenEnableConfig, BuilderWhenMatchConfig, BuilderWhenUnlessConfig } from './config';
|
|
2
|
+
export { BuilderWhenConfigSchema } from './config.js';
|
|
3
|
+
export type { WhenConfigNullable, WhenNullability, WhenPathsNullable } from './nullability';
|
|
4
|
+
export type { WhenConfigConstrained } from './constrain';
|
|
5
|
+
export { resolve } from './resolve.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BuilderPath, BuilderPaths, BuilderResolvePath } from '../../paths';
|
|
2
|
+
export type WhenConfigNullable<Config extends {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
}> = Config extends {
|
|
5
|
+
readonly type: 'unless';
|
|
6
|
+
} ? null : Config extends {
|
|
7
|
+
readonly type: 'match';
|
|
8
|
+
readonly selectMap: infer SelectMap;
|
|
9
|
+
} ? null extends SelectMap[keyof SelectMap] ? null : never : never;
|
|
10
|
+
export type WhenPathsNullable<Model, GatePaths extends BuilderPaths> = GatePaths extends readonly [
|
|
11
|
+
infer Head extends BuilderPath,
|
|
12
|
+
...infer Tail extends BuilderPaths
|
|
13
|
+
] ? WhenPathNullable<Model, Head> | WhenPathsNullable<Model, Tail> : never;
|
|
14
|
+
export type WhenNullability<Model, GatePaths extends BuilderPaths, Config extends {
|
|
15
|
+
readonly type: string;
|
|
16
|
+
}> = WhenPathsNullable<Model, GatePaths> | WhenConfigNullable<Config>;
|
|
17
|
+
type WhenPathNullable<Model, Path extends BuilderPath> = null extends BuilderResolvePath<Model, Path> ? null : never;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BuilderPath, BuilderPaths } from '../../paths';
|
|
2
|
+
export declare function resolve<Entry extends Resolvable>(entry: Entry, model: unknown, onMatch: (selectMap: unknown, matchValue: string) => Entry | null): Entry | null;
|
|
3
|
+
type ResolvableConfig = {
|
|
4
|
+
readonly type: 'enable';
|
|
5
|
+
} | {
|
|
6
|
+
readonly type: 'match';
|
|
7
|
+
readonly matchPath: BuilderPath;
|
|
8
|
+
readonly selectMap: unknown;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: 'unless';
|
|
11
|
+
readonly unlessPath: BuilderPath;
|
|
12
|
+
readonly disabledValues: ReadonlyArray<unknown>;
|
|
13
|
+
};
|
|
14
|
+
interface Resolvable {
|
|
15
|
+
readonly gatePaths: BuilderPaths;
|
|
16
|
+
readonly config: ResolvableConfig | null;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readPath } from '../../paths.js';
|
|
2
|
+
export function resolve(entry, model, onMatch) {
|
|
3
|
+
if (entry.config === null) {
|
|
4
|
+
return entry;
|
|
5
|
+
}
|
|
6
|
+
if (!entry.gatePaths.every((path) => !!readPath(model, path))) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
switch (entry.config.type) {
|
|
10
|
+
case 'enable': {
|
|
11
|
+
return entry;
|
|
12
|
+
}
|
|
13
|
+
case 'match': {
|
|
14
|
+
const matchValue = String(readPath(model, entry.config.matchPath));
|
|
15
|
+
return onMatch(entry.config.selectMap, matchValue);
|
|
16
|
+
}
|
|
17
|
+
case 'unless': {
|
|
18
|
+
const value = readPath(model, entry.config.unlessPath);
|
|
19
|
+
return !entry.config.disabledValues.includes(value) ? entry : null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export type {
|
|
3
|
-
export type { BuilderData, BuilderModel, BuilderModelMutable, BuilderModels, BuilderPrimitive, BuilderPrimitives, BuilderVariant, BuilderVariants } from './config';
|
|
4
|
-
export type { Builder, BuilderCollectionConfig, BuilderCollectionEntries, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderComponentEntries, BuilderComponentNamesOf, BuilderFactory, BuilderGeneric, BuilderModelOf, BuilderOptionEntries, BuilderOptionValues, BuilderOptionValuesMap, BuilderPart, BuilderParts, BuilderSelectTypeLabels, BuilderSelectTypeValues, BuilderState, BuilderStateOf } from './core/index';
|
|
1
|
+
export type { BuilderData, BuilderModel, BuilderModels, BuilderPrimitive, BuilderPrimitives, BuilderVariant, BuilderVariants } from './model';
|
|
2
|
+
export type { Builder, Builders, BuilderCollectionEntries, BuilderComponentEntries, BuilderGeneric, BuilderModelOf, BuilderOptionEntries } from './core/index';
|
|
5
3
|
export type { BuilderModelPaths, BuilderResolvePath, BuilderValidPath } from './paths';
|
|
6
4
|
export type { BuilderPath, BuilderPaths } from './schemas/index';
|
|
7
|
-
export type { BuilderDataValidated, BuilderDescription, BuilderDescriptionItem, BuilderErrorComponentMissing, BuilderErrorComponentUnexpected, BuilderErrorsValidate, BuilderErrorValidate, BuilderErrorVariantInvalid, BuilderErrorVariantMissing,
|
|
5
|
+
export type { BuilderDataValidated, BuilderDescription, BuilderDescriptionItem, BuilderErrorComponentMissing, BuilderErrorComponentUnexpected, BuilderErrorsValidate, BuilderErrorValidate, BuilderErrorVariantInvalid, BuilderErrorVariantMissing, BuilderOrder, BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderResult, BuilderValidateResult } from './resolve/index';
|
|
8
6
|
export type { BuilderUICollection, BuilderUIDescribe, BuilderUIItem, BuilderUIItems, BuilderUIPage } from './schemas/index';
|
|
9
|
-
export type { BuilderUI, BuilderUIFactory,
|
|
10
|
-
export type { BuilderCollectionSerialised, BuilderCollectionWhenConfigSerialised, BuilderComponentSerialised, BuilderOptionSerialised, BuilderOptionWhenConfigSerialised, BuilderSelectTypeSerialised, BuilderSerialised, BuilderToggleTypeSerialised, BuilderUISerialised, BuilderValuesSerialised } from './serialise/index';
|
|
11
|
-
export { BuilderExpectation } from './
|
|
12
|
-
export {
|
|
13
|
-
export { builder, BuilderCollection, BuilderComponent, BuilderOption, BuilderSelectType, BuilderToggleType, collection, enable, match, select, toggleBoolean, toggleNumber, toggleString, unless } from './core/index.js';
|
|
7
|
+
export type { BuilderUI, BuilderUIFactory, BuilderUIs } from './ui';
|
|
8
|
+
export type { BuilderCollectionSerialised, BuilderCollectionWhenConfigSerialised, BuilderComponentSerialised, BuilderOptionSerialised, BuilderOptionWhenConfigSerialised, BuilderParameterSerialised, BuilderSelectTypeSerialised, BuilderSerialised, BuilderToggleTypeSerialised, BuilderUISerialised, BuilderValuesSerialised } from './serialise/index';
|
|
9
|
+
export { BuilderExpectation, component, option } from './core/index.js';
|
|
10
|
+
export { builder, BuilderCollection, BuilderComponent, BuilderOption, BuilderParameter, BuilderSelectType, BuilderToggleType, collection, enable, match, select, toggleBoolean, toggleNumber, toggleString, unless } from './core/index.js';
|
|
14
11
|
export { instance, models, order, ordinal, render, validate } from './resolve/index.js';
|
|
15
12
|
export { deserialise, serialise } from './serialise/index.js';
|
|
16
13
|
export { ui } from './ui.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { BuilderExpectation } from './
|
|
2
|
-
export {
|
|
3
|
-
export { builder, BuilderCollection, BuilderComponent, BuilderOption, BuilderSelectType, BuilderToggleType, collection, enable, match, select, toggleBoolean, toggleNumber, toggleString, unless } from './core/index.js';
|
|
1
|
+
export { BuilderExpectation, component, option } from './core/index.js';
|
|
2
|
+
export { builder, BuilderCollection, BuilderComponent, BuilderOption, BuilderParameter, BuilderSelectType, BuilderToggleType, collection, enable, match, select, toggleBoolean, toggleNumber, toggleString, unless } from './core/index.js';
|
|
4
3
|
export { instance, models, order, ordinal, render, validate } from './resolve/index.js';
|
|
5
4
|
export { deserialise, serialise } from './serialise/index.js';
|
|
6
5
|
export { ui } from './ui.js';
|
|
@@ -3,7 +3,7 @@ export type { BuilderPrimitive, BuilderPrimitives } from './schemas/index';
|
|
|
3
3
|
export type BuilderModel = {
|
|
4
4
|
readonly [key: string]: BuilderPrimitive | BuilderModels;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type BuilderModelInput = Record<string, unknown>;
|
|
7
7
|
export type BuilderModels = ReadonlyArray<BuilderModel>;
|
|
8
8
|
export type BuilderVariant = {
|
|
9
9
|
readonly model: BuilderModel;
|
package/dist/model.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|