@kaskad/types 0.0.1 → 0.0.2

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.
@@ -0,0 +1,63 @@
1
+ const NodeTypes = [
2
+ 'unknown',
3
+ 'string',
4
+ 'number',
5
+ 'boolean',
6
+ 'array',
7
+ 'object',
8
+ 'map',
9
+ 'set',
10
+ 'component',
11
+ 'componentSchema',
12
+ 'command',
13
+ 'shape',
14
+ 'variantShape',
15
+ ];
16
+
17
+ // Type guards for built-in computation schemas
18
+ function isFormulaComputation(schema) {
19
+ return schema.computationType === 'formula';
20
+ }
21
+ function isIfComputation(schema) {
22
+ return schema.computationType === 'if';
23
+ }
24
+ function isForComputation(schema) {
25
+ return schema.computationType === 'for';
26
+ }
27
+ function isTemplateComputation(schema) {
28
+ return schema.computationType === 'template';
29
+ }
30
+ function isSwitchComputation(schema) {
31
+ return schema.computationType === 'switch';
32
+ }
33
+
34
+ function findChildValueType(valueType, path) {
35
+ if (!path.length) {
36
+ return valueType;
37
+ }
38
+ const [head, ...tail] = path;
39
+ switch (valueType.type) {
40
+ case 'array': {
41
+ return findChildValueType(valueType.item, tail);
42
+ }
43
+ case 'object': {
44
+ const found = valueType.fields[head];
45
+ if (!found) {
46
+ throw new Error(`Field ${head} not found in object description.`);
47
+ }
48
+ return findChildValueType(found, tail);
49
+ }
50
+ case 'map': {
51
+ return findChildValueType(valueType.item, tail);
52
+ }
53
+ default:
54
+ return valueType;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Generated bundle index. Do not edit.
60
+ */
61
+
62
+ export { NodeTypes, findChildValueType, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
63
+ //# sourceMappingURL=kaskad-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kaskad-types.mjs","sources":["../../../../libs/types/src/lib/value-type.ts","../../../../libs/types/src/lib/computation-schema.ts","../../../../libs/types/src/lib/util/find-child-value-type.ts","../../../../libs/types/src/kaskad-types.ts"],"sourcesContent":["export interface UnknownValueType {\n readonly type: 'unknown';\n}\n\nexport interface StringValueType {\n readonly type: 'string';\n}\n\nexport interface NumberValueType {\n readonly type: 'number';\n}\n\nexport interface BooleanValueType {\n readonly type: 'boolean';\n}\n\nexport interface ArrayValueType {\n readonly type: 'array';\n readonly item: ValueType;\n}\n\nexport interface ObjectValueType {\n readonly type: 'object';\n readonly fields: Record<string, ValueType>;\n}\n\nexport interface MapValueType {\n readonly type: 'map';\n readonly item: ValueType;\n}\n\nexport interface SetValueType {\n readonly type: 'set';\n readonly item: ValueType;\n}\n\nexport interface ComponentValueType {\n readonly type: 'component';\n}\n\nexport interface ComponentSchemaValueType {\n readonly type: 'componentSchema';\n}\n\nexport interface CommandValueType {\n readonly type: 'command';\n readonly args?: ValueType[];\n readonly returns?: string;\n}\n\nexport interface ShapeValueType {\n readonly type: 'shape';\n readonly shapeType: string;\n}\n\nexport interface VariantShapeValueType {\n readonly type: 'variantShape';\n readonly shapeType: string;\n}\n\nexport type ValueType =\n | UnknownValueType\n | StringValueType\n | NumberValueType\n | BooleanValueType\n | ArrayValueType\n | ObjectValueType\n | MapValueType\n | SetValueType\n | ComponentValueType\n | ComponentSchemaValueType\n | CommandValueType\n | ShapeValueType\n | VariantShapeValueType;\n\nexport type NodeType = ValueType['type'];\n\nexport const NodeTypes: NodeType[] = [\n 'unknown',\n 'string',\n 'number',\n 'boolean',\n 'array',\n 'object',\n 'map',\n 'set',\n 'component',\n 'componentSchema',\n 'command',\n 'shape',\n 'variantShape',\n];\n","import { ComponentRef } from './branded';\nimport { ComponentSchemaNodeSchema, NodeSchema } from './node-schema';\nimport { ValueType } from './value-type';\n\nexport interface ComputationSchema {\n readonly computationType: string;\n}\n\nexport interface TemplateComputationSchema extends ComputationSchema {\n readonly computationType: 'template';\n readonly path: string;\n readonly ref?: ComponentRef;\n readonly defer: {\n placeholder: NodeSchema;\n error: NodeSchema;\n } | null;\n readonly contractVariables: Record<string, unknown>;\n}\n\nexport interface FormulaComputationSchema extends ComputationSchema {\n readonly computationType: 'formula';\n readonly formula: string;\n}\n\nexport interface IfComputationSchema extends ComputationSchema {\n readonly computationType: 'if';\n readonly if: NodeSchema;\n readonly then: NodeSchema;\n readonly else: NodeSchema;\n}\n\nexport interface DimensionSchema {\n items: NodeSchema;\n itemsType: ValueType;\n item: NodeSchema;\n index: NodeSchema;\n first: NodeSchema;\n last: NodeSchema;\n trackBy: NodeSchema;\n}\n\nexport interface ForComputationSchema extends ComputationSchema {\n readonly computationType: 'for';\n readonly dimensions: DimensionSchema[];\n readonly yield: NodeSchema;\n}\n\nexport interface SwitchComputationSchema extends ComputationSchema {\n readonly computationType: 'switch';\n readonly source: NodeSchema;\n readonly cases: { equals: unknown; then: ComponentSchemaNodeSchema }[];\n readonly default: ComponentSchemaNodeSchema;\n}\n\n// Type guards for built-in computation schemas\nexport function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema {\n return schema.computationType === 'formula';\n}\n\nexport function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema {\n return schema.computationType === 'if';\n}\n\nexport function isForComputation(schema: ComputationSchema): schema is ForComputationSchema {\n return schema.computationType === 'for';\n}\n\nexport function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema {\n return schema.computationType === 'template';\n}\n\nexport function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema {\n return schema.computationType === 'switch';\n}\n","import { ValueType } from '../value-type';\n\nexport function findChildValueType(valueType: ValueType, path: string[]): ValueType {\n if (!path.length) {\n return valueType;\n }\n\n const [head, ...tail] = path;\n\n switch (valueType.type) {\n case 'array': {\n return findChildValueType(valueType.item, tail);\n }\n case 'object': {\n const found = valueType.fields[head];\n if (!found) {\n throw new Error(`Field ${head} not found in object description.`);\n }\n return findChildValueType(found, tail);\n }\n case 'map': {\n return findChildValueType(valueType.item, tail);\n }\n default:\n return valueType;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AA6EO,MAAM,SAAS,GAAe;IACnC,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,KAAK;IACL,KAAK;IACL,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,OAAO;IACP,cAAc;;;ACpChB;AACM,SAAU,oBAAoB,CAAC,MAAyB,EAAA;AAC5D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,SAAS;AAC7C;AAEM,SAAU,eAAe,CAAC,MAAyB,EAAA;AACvD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,IAAI;AACxC;AAEM,SAAU,gBAAgB,CAAC,MAAyB,EAAA;AACxD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,KAAK;AACzC;AAEM,SAAU,qBAAqB,CAAC,MAAyB,EAAA;AAC7D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU;AAC9C;AAEM,SAAU,mBAAmB,CAAC,MAAyB,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ;AAC5C;;ACvEM,SAAU,kBAAkB,CAAC,SAAoB,EAAE,IAAc,EAAA;AACrE,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,QAAA,OAAO,SAAS;;IAGlB,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI;AAE5B,IAAA,QAAQ,SAAS,CAAC,IAAI;QACpB,KAAK,OAAO,EAAE;YACZ,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;QAEjD,KAAK,QAAQ,EAAE;YACb,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;YACpC,IAAI,CAAC,KAAK,EAAE;AACV,gBAAA,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAA,iCAAA,CAAmC,CAAC;;AAEnE,YAAA,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;;QAExC,KAAK,KAAK,EAAE;YACV,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;AAEjD,QAAA;AACE,YAAA,OAAO,SAAS;;AAEtB;;AC1BA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaskad/types",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "21.1.3",
6
6
  "vite": "7.3.1",
@@ -8,18 +8,18 @@
8
8
  "@nx/vite": "22.4.5"
9
9
  },
10
10
  "sideEffects": false,
11
- "module": "esm2022/kaskad-types.js",
12
- "typings": "kaskad-types.d.ts",
11
+ "module": "fesm2022/kaskad-types.mjs",
12
+ "typings": "types/kaskad-types.d.ts",
13
13
  "exports": {
14
14
  "./package.json": {
15
15
  "default": "./package.json"
16
16
  },
17
17
  ".": {
18
- "types": "./kaskad-types.d.ts",
19
- "default": "./esm2022/kaskad-types.js"
18
+ "types": "./types/kaskad-types.d.ts",
19
+ "default": "./fesm2022/kaskad-types.mjs"
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
23
  "tslib": "^2.3.0"
24
24
  }
25
- }
25
+ }
@@ -0,0 +1,214 @@
1
+ type RefSpaceId = string;
2
+ type ComponentId = string;
3
+ type ComponentRef = string;
4
+
5
+ interface UnknownValueType {
6
+ readonly type: 'unknown';
7
+ }
8
+ interface StringValueType {
9
+ readonly type: 'string';
10
+ }
11
+ interface NumberValueType {
12
+ readonly type: 'number';
13
+ }
14
+ interface BooleanValueType {
15
+ readonly type: 'boolean';
16
+ }
17
+ interface ArrayValueType {
18
+ readonly type: 'array';
19
+ readonly item: ValueType;
20
+ }
21
+ interface ObjectValueType {
22
+ readonly type: 'object';
23
+ readonly fields: Record<string, ValueType>;
24
+ }
25
+ interface MapValueType {
26
+ readonly type: 'map';
27
+ readonly item: ValueType;
28
+ }
29
+ interface SetValueType {
30
+ readonly type: 'set';
31
+ readonly item: ValueType;
32
+ }
33
+ interface ComponentValueType {
34
+ readonly type: 'component';
35
+ }
36
+ interface ComponentSchemaValueType {
37
+ readonly type: 'componentSchema';
38
+ }
39
+ interface CommandValueType {
40
+ readonly type: 'command';
41
+ readonly args?: ValueType[];
42
+ readonly returns?: string;
43
+ }
44
+ interface ShapeValueType {
45
+ readonly type: 'shape';
46
+ readonly shapeType: string;
47
+ }
48
+ interface VariantShapeValueType {
49
+ readonly type: 'variantShape';
50
+ readonly shapeType: string;
51
+ }
52
+ type ValueType = UnknownValueType | StringValueType | NumberValueType | BooleanValueType | ArrayValueType | ObjectValueType | MapValueType | SetValueType | ComponentValueType | ComponentSchemaValueType | CommandValueType | ShapeValueType | VariantShapeValueType;
53
+ type NodeType = ValueType['type'];
54
+ declare const NodeTypes: NodeType[];
55
+
56
+ /**
57
+ * Mirror binding: bidirectional sync between a node and a parent variable.
58
+ * Selector formats:
59
+ * - "$varName" - Variable in nearest ancestor that has it
60
+ * - "^Component->propName" - Specific component type with property
61
+ */
62
+ interface MirrorBindingSchema {
63
+ bindingType: 'mirror';
64
+ selector: string;
65
+ }
66
+ /**
67
+ * Object binding: sync object entries with repeated components.
68
+ * Each component instance represents a key-value pair.
69
+ */
70
+ interface ObjectBindingSchema {
71
+ bindingType: 'object';
72
+ componentSelector: string;
73
+ mapping: {
74
+ key: string;
75
+ value: string;
76
+ };
77
+ }
78
+ /**
79
+ * Selection binding: sync selection state with repeated components.
80
+ * Each component instance has a key and selected state.
81
+ */
82
+ interface SelectionBindingSchema {
83
+ bindingType: 'selection';
84
+ componentSelector: string;
85
+ mapping: {
86
+ key: string;
87
+ selected: string;
88
+ };
89
+ }
90
+ /**
91
+ * Array binding: sync array values with repeated components.
92
+ * Each component instance represents an array element.
93
+ */
94
+ interface ArrayBindingSchema {
95
+ bindingType: 'array';
96
+ componentSelector: string;
97
+ mapping: {
98
+ value: string;
99
+ };
100
+ }
101
+ type BindingSchema = MirrorBindingSchema | ObjectBindingSchema | SelectionBindingSchema | ArrayBindingSchema;
102
+ type BindingType = BindingSchema['bindingType'];
103
+
104
+ type AnyFn = (...args: unknown[]) => unknown;
105
+
106
+ type NodeChangeHandlerSchema = {
107
+ selector: string;
108
+ command: NodeSchema;
109
+ };
110
+ type ComponentNodeInlineValue = {
111
+ componentType: string;
112
+ ref: ComponentRef;
113
+ props: Map<string, NodeSchema>;
114
+ variables: Map<string, NodeSchema>;
115
+ onNodeChange: NodeChangeHandlerSchema[];
116
+ };
117
+ type ComponentNodeValue = ComponentNodeInlineValue | string | null;
118
+ type CommandValue = {
119
+ runnerType: 'js' | 'inline';
120
+ target: string | AnyFn;
121
+ owner: ComponentId | null;
122
+ };
123
+ type ShapeValue = {
124
+ [key: string]: NodeSchema;
125
+ };
126
+ type VariantShapeValue = {
127
+ [key: string]: NodeSchema | string;
128
+ };
129
+ interface NodeSchemaBase<T extends ValueType = ValueType, V = unknown> {
130
+ valueType: T;
131
+ value: V | null;
132
+ computation: ComputationSchema | null;
133
+ binding: BindingSchema | null;
134
+ extraBinding?: BindingSchema | null;
135
+ }
136
+ type UnknownNodeSchema = NodeSchemaBase<UnknownValueType>;
137
+ type BooleanNodeSchema = NodeSchemaBase<BooleanValueType, boolean>;
138
+ type StringNodeSchema = NodeSchemaBase<StringValueType, string>;
139
+ type NumberNodeSchema = NodeSchemaBase<NumberValueType, number>;
140
+ type ArrayNodeSchema = NodeSchemaBase<ArrayValueType, NodeSchema[]>;
141
+ type ObjectNodeSchema = NodeSchemaBase<ObjectValueType, Record<string, NodeSchema>>;
142
+ type MapNodeSchema = NodeSchemaBase<MapValueType, Record<string, NodeSchema>>;
143
+ type SetNodeSchema = NodeSchemaBase<SetValueType, NodeSchema[]>;
144
+ type CommandNodeSchema = NodeSchemaBase<CommandValueType, CommandValue>;
145
+ type ComponentNodeSchema = NodeSchemaBase<ComponentValueType, ComponentNodeValue>;
146
+ type ComponentSchemaNodeSchema = NodeSchemaBase<ComponentSchemaValueType, unknown>;
147
+ type ShapeNodeSchema = NodeSchemaBase<ShapeValueType, ShapeValue>;
148
+ type VariantShapeNodeSchema = NodeSchemaBase<VariantShapeValueType, VariantShapeValue>;
149
+ type LeafNodeSchema = UnknownNodeSchema | BooleanNodeSchema | StringNodeSchema | NumberNodeSchema | CommandNodeSchema | ComponentSchemaNodeSchema | ShapeNodeSchema | VariantShapeNodeSchema;
150
+ type NodeSchema = LeafNodeSchema | ObjectNodeSchema | MapNodeSchema | SetNodeSchema | ComponentNodeSchema | ArrayNodeSchema;
151
+
152
+ interface ComputationSchema {
153
+ readonly computationType: string;
154
+ }
155
+ interface TemplateComputationSchema extends ComputationSchema {
156
+ readonly computationType: 'template';
157
+ readonly path: string;
158
+ readonly ref?: ComponentRef;
159
+ readonly defer: {
160
+ placeholder: NodeSchema;
161
+ error: NodeSchema;
162
+ } | null;
163
+ readonly contractVariables: Record<string, unknown>;
164
+ }
165
+ interface FormulaComputationSchema extends ComputationSchema {
166
+ readonly computationType: 'formula';
167
+ readonly formula: string;
168
+ }
169
+ interface IfComputationSchema extends ComputationSchema {
170
+ readonly computationType: 'if';
171
+ readonly if: NodeSchema;
172
+ readonly then: NodeSchema;
173
+ readonly else: NodeSchema;
174
+ }
175
+ interface DimensionSchema {
176
+ items: NodeSchema;
177
+ itemsType: ValueType;
178
+ item: NodeSchema;
179
+ index: NodeSchema;
180
+ first: NodeSchema;
181
+ last: NodeSchema;
182
+ trackBy: NodeSchema;
183
+ }
184
+ interface ForComputationSchema extends ComputationSchema {
185
+ readonly computationType: 'for';
186
+ readonly dimensions: DimensionSchema[];
187
+ readonly yield: NodeSchema;
188
+ }
189
+ interface SwitchComputationSchema extends ComputationSchema {
190
+ readonly computationType: 'switch';
191
+ readonly source: NodeSchema;
192
+ readonly cases: {
193
+ equals: unknown;
194
+ then: ComponentSchemaNodeSchema;
195
+ }[];
196
+ readonly default: ComponentSchemaNodeSchema;
197
+ }
198
+ declare function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema;
199
+ declare function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema;
200
+ declare function isForComputation(schema: ComputationSchema): schema is ForComputationSchema;
201
+ declare function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema;
202
+ declare function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema;
203
+
204
+ type NodePathSegment = string | number;
205
+ type NodePath = NodePathSegment[];
206
+ interface NodePosition {
207
+ readonly componentId: ComponentId | null;
208
+ readonly path: NodePath;
209
+ }
210
+
211
+ declare function findChildValueType(valueType: ValueType, path: string[]): ValueType;
212
+
213
+ export { NodeTypes, findChildValueType, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
214
+ export type { AnyFn, ArrayBindingSchema, ArrayNodeSchema, ArrayValueType, BindingSchema, BindingType, BooleanNodeSchema, BooleanValueType, CommandNodeSchema, CommandValue, CommandValueType, ComponentId, ComponentNodeInlineValue, ComponentNodeSchema, ComponentNodeValue, ComponentRef, ComponentSchemaNodeSchema, ComponentSchemaValueType, ComponentValueType, ComputationSchema, DimensionSchema, ForComputationSchema, FormulaComputationSchema, IfComputationSchema, LeafNodeSchema, MapNodeSchema, MapValueType, MirrorBindingSchema, NodeChangeHandlerSchema, NodePath, NodePathSegment, NodePosition, NodeSchema, NodeSchemaBase, NodeType, NumberNodeSchema, NumberValueType, ObjectBindingSchema, ObjectNodeSchema, ObjectValueType, RefSpaceId, SelectionBindingSchema, SetNodeSchema, SetValueType, ShapeNodeSchema, ShapeValue, ShapeValueType, StringNodeSchema, StringValueType, SwitchComputationSchema, TemplateComputationSchema, UnknownNodeSchema, UnknownValueType, ValueType, VariantShapeNodeSchema, VariantShapeValue, VariantShapeValueType };
package/esm2022/index.js DELETED
@@ -1,9 +0,0 @@
1
- export * from './lib/branded';
2
- export * from './lib/value-type';
3
- export * from './lib/binding';
4
- export * from './lib/computation-schema';
5
- export * from './lib/node-schema';
6
- export * from './lib/node-path';
7
- export * from './lib/misc';
8
- export * from './lib/util/find-child-value-type';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/types/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './lib/branded';\nexport * from './lib/value-type';\nexport * from './lib/binding';\nexport * from './lib/computation-schema';\nexport * from './lib/node-schema';\nexport * from './lib/node-path';\nexport * from './lib/misc';\nexport * from './lib/util/find-child-value-type';\n"]}
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=kaskad-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kaskad-types.js","sourceRoot":"","sources":["../../../../libs/types/src/kaskad-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=binding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/binding.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Mirror binding: bidirectional sync between a node and a parent variable.\n * Selector formats:\n * - \"$varName\" - Variable in nearest ancestor that has it\n * - \"^Component->propName\" - Specific component type with property\n */\nexport interface MirrorBindingSchema {\n bindingType: 'mirror';\n selector: string;\n}\n\n/**\n * Object binding: sync object entries with repeated components.\n * Each component instance represents a key-value pair.\n */\nexport interface ObjectBindingSchema {\n bindingType: 'object';\n componentSelector: string;\n mapping: {\n key: string;\n value: string;\n };\n}\n\n/**\n * Selection binding: sync selection state with repeated components.\n * Each component instance has a key and selected state.\n */\nexport interface SelectionBindingSchema {\n bindingType: 'selection';\n componentSelector: string;\n mapping: {\n key: string;\n selected: string;\n };\n}\n\n/**\n * Array binding: sync array values with repeated components.\n * Each component instance represents an array element.\n */\nexport interface ArrayBindingSchema {\n bindingType: 'array';\n componentSelector: string;\n mapping: {\n value: string;\n };\n}\n\nexport type BindingSchema = MirrorBindingSchema | ObjectBindingSchema | SelectionBindingSchema | ArrayBindingSchema;\n\nexport type BindingType = BindingSchema['bindingType'];\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=branded.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"branded.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/branded.ts"],"names":[],"mappings":"","sourcesContent":["export type RefSpaceId = string;\nexport type ComponentId = string;\nexport type ComponentRef = string;\n"]}
@@ -1,17 +0,0 @@
1
- // Type guards for built-in computation schemas
2
- export function isFormulaComputation(schema) {
3
- return schema.computationType === 'formula';
4
- }
5
- export function isIfComputation(schema) {
6
- return schema.computationType === 'if';
7
- }
8
- export function isForComputation(schema) {
9
- return schema.computationType === 'for';
10
- }
11
- export function isTemplateComputation(schema) {
12
- return schema.computationType === 'template';
13
- }
14
- export function isSwitchComputation(schema) {
15
- return schema.computationType === 'switch';
16
- }
17
- //# sourceMappingURL=computation-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computation-schema.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/computation-schema.ts"],"names":[],"mappings":"AAsDA,+CAA+C;AAC/C,MAAM,UAAU,oBAAoB,CAAC,MAAyB;IAC5D,OAAO,MAAM,CAAC,eAAe,KAAK,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,OAAO,MAAM,CAAC,eAAe,KAAK,IAAI,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAyB;IACxD,OAAO,MAAM,CAAC,eAAe,KAAK,KAAK,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAyB;IAC7D,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAyB;IAC3D,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC;AAC7C,CAAC","sourcesContent":["import { ComponentRef } from './branded';\nimport { ComponentSchemaNodeSchema, NodeSchema } from './node-schema';\nimport { ValueType } from './value-type';\n\nexport interface ComputationSchema {\n readonly computationType: string;\n}\n\nexport interface TemplateComputationSchema extends ComputationSchema {\n readonly computationType: 'template';\n readonly path: string;\n readonly ref?: ComponentRef;\n readonly defer: {\n placeholder: NodeSchema;\n error: NodeSchema;\n } | null;\n readonly contractVariables: Record<string, unknown>;\n}\n\nexport interface FormulaComputationSchema extends ComputationSchema {\n readonly computationType: 'formula';\n readonly formula: string;\n}\n\nexport interface IfComputationSchema extends ComputationSchema {\n readonly computationType: 'if';\n readonly if: NodeSchema;\n readonly then: NodeSchema;\n readonly else: NodeSchema;\n}\n\nexport interface DimensionSchema {\n items: NodeSchema;\n itemsType: ValueType;\n item: NodeSchema;\n index: NodeSchema;\n first: NodeSchema;\n last: NodeSchema;\n trackBy: NodeSchema;\n}\n\nexport interface ForComputationSchema extends ComputationSchema {\n readonly computationType: 'for';\n readonly dimensions: DimensionSchema[];\n readonly yield: NodeSchema;\n}\n\nexport interface SwitchComputationSchema extends ComputationSchema {\n readonly computationType: 'switch';\n readonly source: NodeSchema;\n readonly cases: { equals: unknown; then: ComponentSchemaNodeSchema }[];\n readonly default: ComponentSchemaNodeSchema;\n}\n\n// Type guards for built-in computation schemas\nexport function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema {\n return schema.computationType === 'formula';\n}\n\nexport function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema {\n return schema.computationType === 'if';\n}\n\nexport function isForComputation(schema: ComputationSchema): schema is ForComputationSchema {\n return schema.computationType === 'for';\n}\n\nexport function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema {\n return schema.computationType === 'template';\n}\n\nexport function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema {\n return schema.computationType === 'switch';\n}\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=misc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/misc.ts"],"names":[],"mappings":"","sourcesContent":["export type AnyFn = (...args: unknown[]) => unknown;\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=node-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-path.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/node-path.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentId } from './branded';\n\nexport type NodePathSegment = string | number;\nexport type NodePath = NodePathSegment[];\n\nexport interface NodePosition {\n readonly componentId: ComponentId | null;\n readonly path: NodePath;\n}\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=node-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-schema.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/node-schema.ts"],"names":[],"mappings":"","sourcesContent":["import { BindingSchema } from './binding';\nimport { ComponentId, ComponentRef } from './branded';\nimport { ComputationSchema } from './computation-schema';\nimport { AnyFn } from './misc';\nimport {\n ArrayValueType,\n BooleanValueType,\n CommandValueType,\n ComponentSchemaValueType,\n ComponentValueType,\n MapValueType,\n NumberValueType,\n ObjectValueType,\n SetValueType,\n ShapeValueType,\n StringValueType,\n UnknownValueType,\n ValueType,\n VariantShapeValueType,\n} from './value-type';\n\nexport type NodeChangeHandlerSchema = {\n selector: string;\n command: NodeSchema;\n};\n\nexport type ComponentNodeInlineValue = {\n componentType: string;\n ref: ComponentRef;\n props: Map<string, NodeSchema>;\n variables: Map<string, NodeSchema>;\n onNodeChange: NodeChangeHandlerSchema[];\n};\nexport type ComponentNodeValue = ComponentNodeInlineValue | string | null;\n\nexport type CommandValue = {\n runnerType: 'js' | 'inline';\n target: string | AnyFn;\n owner: ComponentId | null;\n};\n\nexport type ShapeValue = {\n [key: string]: NodeSchema;\n};\n\nexport type VariantShapeValue = {\n [key: string]: NodeSchema | string;\n};\n\nexport interface NodeSchemaBase<T extends ValueType = ValueType, V = unknown> {\n valueType: T;\n value: V | null;\n computation: ComputationSchema | null;\n binding: BindingSchema | null;\n extraBinding?: BindingSchema | null;\n}\n\nexport type UnknownNodeSchema = NodeSchemaBase<UnknownValueType>;\nexport type BooleanNodeSchema = NodeSchemaBase<BooleanValueType, boolean>;\nexport type StringNodeSchema = NodeSchemaBase<StringValueType, string>;\nexport type NumberNodeSchema = NodeSchemaBase<NumberValueType, number>;\nexport type ArrayNodeSchema = NodeSchemaBase<ArrayValueType, NodeSchema[]>;\nexport type ObjectNodeSchema = NodeSchemaBase<ObjectValueType, Record<string, NodeSchema>>;\nexport type MapNodeSchema = NodeSchemaBase<MapValueType, Record<string, NodeSchema>>;\nexport type SetNodeSchema = NodeSchemaBase<SetValueType, NodeSchema[]>;\nexport type CommandNodeSchema = NodeSchemaBase<CommandValueType, CommandValue>;\nexport type ComponentNodeSchema = NodeSchemaBase<ComponentValueType, ComponentNodeValue>;\nexport type ComponentSchemaNodeSchema = NodeSchemaBase<ComponentSchemaValueType, unknown>;\nexport type ShapeNodeSchema = NodeSchemaBase<ShapeValueType, ShapeValue>;\nexport type VariantShapeNodeSchema = NodeSchemaBase<VariantShapeValueType, VariantShapeValue>;\n\nexport type LeafNodeSchema =\n | UnknownNodeSchema\n | BooleanNodeSchema\n | StringNodeSchema\n | NumberNodeSchema\n | CommandNodeSchema\n | ComponentSchemaNodeSchema\n | ShapeNodeSchema\n | VariantShapeNodeSchema;\n\nexport type NodeSchema =\n | LeafNodeSchema\n | ObjectNodeSchema\n | MapNodeSchema\n | SetNodeSchema\n | ComponentNodeSchema\n | ArrayNodeSchema;\n"]}
@@ -1,24 +0,0 @@
1
- export function findChildValueType(valueType, path) {
2
- if (!path.length) {
3
- return valueType;
4
- }
5
- const [head, ...tail] = path;
6
- switch (valueType.type) {
7
- case 'array': {
8
- return findChildValueType(valueType.item, tail);
9
- }
10
- case 'object': {
11
- const found = valueType.fields[head];
12
- if (!found) {
13
- throw new Error(`Field ${head} not found in object description.`);
14
- }
15
- return findChildValueType(found, tail);
16
- }
17
- case 'map': {
18
- return findChildValueType(valueType.item, tail);
19
- }
20
- default:
21
- return valueType;
22
- }
23
- }
24
- //# sourceMappingURL=find-child-value-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-child-value-type.js","sourceRoot":"","sources":["../../../../../../libs/types/src/lib/util/find-child-value-type.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,SAAoB,EAAE,IAAc;IACrE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAE7B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,mCAAmC,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;QACD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import { ValueType } from '../value-type';\n\nexport function findChildValueType(valueType: ValueType, path: string[]): ValueType {\n if (!path.length) {\n return valueType;\n }\n\n const [head, ...tail] = path;\n\n switch (valueType.type) {\n case 'array': {\n return findChildValueType(valueType.item, tail);\n }\n case 'object': {\n const found = valueType.fields[head];\n if (!found) {\n throw new Error(`Field ${head} not found in object description.`);\n }\n return findChildValueType(found, tail);\n }\n case 'map': {\n return findChildValueType(valueType.item, tail);\n }\n default:\n return valueType;\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- export const NodeTypes = [
2
- 'unknown',
3
- 'string',
4
- 'number',
5
- 'boolean',
6
- 'array',
7
- 'object',
8
- 'map',
9
- 'set',
10
- 'component',
11
- 'componentSchema',
12
- 'command',
13
- 'shape',
14
- 'variantShape',
15
- ];
16
- //# sourceMappingURL=value-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"value-type.js","sourceRoot":"","sources":["../../../../../libs/types/src/lib/value-type.ts"],"names":[],"mappings":"AA6EA,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,KAAK;IACL,KAAK;IACL,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,OAAO;IACP,cAAc;CACf,CAAC","sourcesContent":["export interface UnknownValueType {\n readonly type: 'unknown';\n}\n\nexport interface StringValueType {\n readonly type: 'string';\n}\n\nexport interface NumberValueType {\n readonly type: 'number';\n}\n\nexport interface BooleanValueType {\n readonly type: 'boolean';\n}\n\nexport interface ArrayValueType {\n readonly type: 'array';\n readonly item: ValueType;\n}\n\nexport interface ObjectValueType {\n readonly type: 'object';\n readonly fields: Record<string, ValueType>;\n}\n\nexport interface MapValueType {\n readonly type: 'map';\n readonly item: ValueType;\n}\n\nexport interface SetValueType {\n readonly type: 'set';\n readonly item: ValueType;\n}\n\nexport interface ComponentValueType {\n readonly type: 'component';\n}\n\nexport interface ComponentSchemaValueType {\n readonly type: 'componentSchema';\n}\n\nexport interface CommandValueType {\n readonly type: 'command';\n readonly args?: ValueType[];\n readonly returns?: string;\n}\n\nexport interface ShapeValueType {\n readonly type: 'shape';\n readonly shapeType: string;\n}\n\nexport interface VariantShapeValueType {\n readonly type: 'variantShape';\n readonly shapeType: string;\n}\n\nexport type ValueType =\n | UnknownValueType\n | StringValueType\n | NumberValueType\n | BooleanValueType\n | ArrayValueType\n | ObjectValueType\n | MapValueType\n | SetValueType\n | ComponentValueType\n | ComponentSchemaValueType\n | CommandValueType\n | ShapeValueType\n | VariantShapeValueType;\n\nexport type NodeType = ValueType['type'];\n\nexport const NodeTypes: NodeType[] = [\n 'unknown',\n 'string',\n 'number',\n 'boolean',\n 'array',\n 'object',\n 'map',\n 'set',\n 'component',\n 'componentSchema',\n 'command',\n 'shape',\n 'variantShape',\n];\n"]}
package/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './lib/branded';
2
- export * from './lib/value-type';
3
- export * from './lib/binding';
4
- export * from './lib/computation-schema';
5
- export * from './lib/node-schema';
6
- export * from './lib/node-path';
7
- export * from './lib/misc';
8
- export * from './lib/util/find-child-value-type';
package/kaskad-types.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@kaskad/types" />
5
- export * from './index';
package/lib/binding.d.ts DELETED
@@ -1,47 +0,0 @@
1
- /**
2
- * Mirror binding: bidirectional sync between a node and a parent variable.
3
- * Selector formats:
4
- * - "$varName" - Variable in nearest ancestor that has it
5
- * - "^Component->propName" - Specific component type with property
6
- */
7
- export interface MirrorBindingSchema {
8
- bindingType: 'mirror';
9
- selector: string;
10
- }
11
- /**
12
- * Object binding: sync object entries with repeated components.
13
- * Each component instance represents a key-value pair.
14
- */
15
- export interface ObjectBindingSchema {
16
- bindingType: 'object';
17
- componentSelector: string;
18
- mapping: {
19
- key: string;
20
- value: string;
21
- };
22
- }
23
- /**
24
- * Selection binding: sync selection state with repeated components.
25
- * Each component instance has a key and selected state.
26
- */
27
- export interface SelectionBindingSchema {
28
- bindingType: 'selection';
29
- componentSelector: string;
30
- mapping: {
31
- key: string;
32
- selected: string;
33
- };
34
- }
35
- /**
36
- * Array binding: sync array values with repeated components.
37
- * Each component instance represents an array element.
38
- */
39
- export interface ArrayBindingSchema {
40
- bindingType: 'array';
41
- componentSelector: string;
42
- mapping: {
43
- value: string;
44
- };
45
- }
46
- export type BindingSchema = MirrorBindingSchema | ObjectBindingSchema | SelectionBindingSchema | ArrayBindingSchema;
47
- export type BindingType = BindingSchema['bindingType'];
package/lib/branded.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export type RefSpaceId = string;
2
- export type ComponentId = string;
3
- export type ComponentRef = string;
@@ -1,54 +0,0 @@
1
- import { ComponentRef } from './branded';
2
- import { ComponentSchemaNodeSchema, NodeSchema } from './node-schema';
3
- import { ValueType } from './value-type';
4
- export interface ComputationSchema {
5
- readonly computationType: string;
6
- }
7
- export interface TemplateComputationSchema extends ComputationSchema {
8
- readonly computationType: 'template';
9
- readonly path: string;
10
- readonly ref?: ComponentRef;
11
- readonly defer: {
12
- placeholder: NodeSchema;
13
- error: NodeSchema;
14
- } | null;
15
- readonly contractVariables: Record<string, unknown>;
16
- }
17
- export interface FormulaComputationSchema extends ComputationSchema {
18
- readonly computationType: 'formula';
19
- readonly formula: string;
20
- }
21
- export interface IfComputationSchema extends ComputationSchema {
22
- readonly computationType: 'if';
23
- readonly if: NodeSchema;
24
- readonly then: NodeSchema;
25
- readonly else: NodeSchema;
26
- }
27
- export interface DimensionSchema {
28
- items: NodeSchema;
29
- itemsType: ValueType;
30
- item: NodeSchema;
31
- index: NodeSchema;
32
- first: NodeSchema;
33
- last: NodeSchema;
34
- trackBy: NodeSchema;
35
- }
36
- export interface ForComputationSchema extends ComputationSchema {
37
- readonly computationType: 'for';
38
- readonly dimensions: DimensionSchema[];
39
- readonly yield: NodeSchema;
40
- }
41
- export interface SwitchComputationSchema extends ComputationSchema {
42
- readonly computationType: 'switch';
43
- readonly source: NodeSchema;
44
- readonly cases: {
45
- equals: unknown;
46
- then: ComponentSchemaNodeSchema;
47
- }[];
48
- readonly default: ComponentSchemaNodeSchema;
49
- }
50
- export declare function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema;
51
- export declare function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema;
52
- export declare function isForComputation(schema: ComputationSchema): schema is ForComputationSchema;
53
- export declare function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema;
54
- export declare function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema;
package/lib/misc.d.ts DELETED
@@ -1 +0,0 @@
1
- export type AnyFn = (...args: unknown[]) => unknown;
@@ -1,7 +0,0 @@
1
- import { ComponentId } from './branded';
2
- export type NodePathSegment = string | number;
3
- export type NodePath = NodePathSegment[];
4
- export interface NodePosition {
5
- readonly componentId: ComponentId | null;
6
- readonly path: NodePath;
7
- }
@@ -1,50 +0,0 @@
1
- import { BindingSchema } from './binding';
2
- import { ComponentId, ComponentRef } from './branded';
3
- import { ComputationSchema } from './computation-schema';
4
- import { AnyFn } from './misc';
5
- import { ArrayValueType, BooleanValueType, CommandValueType, ComponentSchemaValueType, ComponentValueType, MapValueType, NumberValueType, ObjectValueType, SetValueType, ShapeValueType, StringValueType, UnknownValueType, ValueType, VariantShapeValueType } from './value-type';
6
- export type NodeChangeHandlerSchema = {
7
- selector: string;
8
- command: NodeSchema;
9
- };
10
- export type ComponentNodeInlineValue = {
11
- componentType: string;
12
- ref: ComponentRef;
13
- props: Map<string, NodeSchema>;
14
- variables: Map<string, NodeSchema>;
15
- onNodeChange: NodeChangeHandlerSchema[];
16
- };
17
- export type ComponentNodeValue = ComponentNodeInlineValue | string | null;
18
- export type CommandValue = {
19
- runnerType: 'js' | 'inline';
20
- target: string | AnyFn;
21
- owner: ComponentId | null;
22
- };
23
- export type ShapeValue = {
24
- [key: string]: NodeSchema;
25
- };
26
- export type VariantShapeValue = {
27
- [key: string]: NodeSchema | string;
28
- };
29
- export interface NodeSchemaBase<T extends ValueType = ValueType, V = unknown> {
30
- valueType: T;
31
- value: V | null;
32
- computation: ComputationSchema | null;
33
- binding: BindingSchema | null;
34
- extraBinding?: BindingSchema | null;
35
- }
36
- export type UnknownNodeSchema = NodeSchemaBase<UnknownValueType>;
37
- export type BooleanNodeSchema = NodeSchemaBase<BooleanValueType, boolean>;
38
- export type StringNodeSchema = NodeSchemaBase<StringValueType, string>;
39
- export type NumberNodeSchema = NodeSchemaBase<NumberValueType, number>;
40
- export type ArrayNodeSchema = NodeSchemaBase<ArrayValueType, NodeSchema[]>;
41
- export type ObjectNodeSchema = NodeSchemaBase<ObjectValueType, Record<string, NodeSchema>>;
42
- export type MapNodeSchema = NodeSchemaBase<MapValueType, Record<string, NodeSchema>>;
43
- export type SetNodeSchema = NodeSchemaBase<SetValueType, NodeSchema[]>;
44
- export type CommandNodeSchema = NodeSchemaBase<CommandValueType, CommandValue>;
45
- export type ComponentNodeSchema = NodeSchemaBase<ComponentValueType, ComponentNodeValue>;
46
- export type ComponentSchemaNodeSchema = NodeSchemaBase<ComponentSchemaValueType, unknown>;
47
- export type ShapeNodeSchema = NodeSchemaBase<ShapeValueType, ShapeValue>;
48
- export type VariantShapeNodeSchema = NodeSchemaBase<VariantShapeValueType, VariantShapeValue>;
49
- export type LeafNodeSchema = UnknownNodeSchema | BooleanNodeSchema | StringNodeSchema | NumberNodeSchema | CommandNodeSchema | ComponentSchemaNodeSchema | ShapeNodeSchema | VariantShapeNodeSchema;
50
- export type NodeSchema = LeafNodeSchema | ObjectNodeSchema | MapNodeSchema | SetNodeSchema | ComponentNodeSchema | ArrayNodeSchema;
@@ -1,2 +0,0 @@
1
- import { ValueType } from '../value-type';
2
- export declare function findChildValueType(valueType: ValueType, path: string[]): ValueType;
@@ -1,50 +0,0 @@
1
- export interface UnknownValueType {
2
- readonly type: 'unknown';
3
- }
4
- export interface StringValueType {
5
- readonly type: 'string';
6
- }
7
- export interface NumberValueType {
8
- readonly type: 'number';
9
- }
10
- export interface BooleanValueType {
11
- readonly type: 'boolean';
12
- }
13
- export interface ArrayValueType {
14
- readonly type: 'array';
15
- readonly item: ValueType;
16
- }
17
- export interface ObjectValueType {
18
- readonly type: 'object';
19
- readonly fields: Record<string, ValueType>;
20
- }
21
- export interface MapValueType {
22
- readonly type: 'map';
23
- readonly item: ValueType;
24
- }
25
- export interface SetValueType {
26
- readonly type: 'set';
27
- readonly item: ValueType;
28
- }
29
- export interface ComponentValueType {
30
- readonly type: 'component';
31
- }
32
- export interface ComponentSchemaValueType {
33
- readonly type: 'componentSchema';
34
- }
35
- export interface CommandValueType {
36
- readonly type: 'command';
37
- readonly args?: ValueType[];
38
- readonly returns?: string;
39
- }
40
- export interface ShapeValueType {
41
- readonly type: 'shape';
42
- readonly shapeType: string;
43
- }
44
- export interface VariantShapeValueType {
45
- readonly type: 'variantShape';
46
- readonly shapeType: string;
47
- }
48
- export type ValueType = UnknownValueType | StringValueType | NumberValueType | BooleanValueType | ArrayValueType | ObjectValueType | MapValueType | SetValueType | ComponentValueType | ComponentSchemaValueType | CommandValueType | ShapeValueType | VariantShapeValueType;
49
- export type NodeType = ValueType['type'];
50
- export declare const NodeTypes: NodeType[];