@elaraai/east-ui 1.0.39 → 1.0.41
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/src/collections/calendar/index.d.ts +275 -62
- package/dist/src/collections/calendar/index.d.ts.map +1 -1
- package/dist/src/collections/calendar/index.js +168 -51
- package/dist/src/collections/calendar/index.js.map +1 -1
- package/dist/src/collections/calendar/types.d.ts +228 -22
- package/dist/src/collections/calendar/types.d.ts.map +1 -1
- package/dist/src/collections/calendar/types.js +132 -18
- package/dist/src/collections/calendar/types.js.map +1 -1
- package/dist/src/collections/deck/index.d.ts +2229 -0
- package/dist/src/collections/deck/index.d.ts.map +1 -0
- package/dist/src/collections/deck/index.js +461 -0
- package/dist/src/collections/deck/index.js.map +1 -0
- package/dist/src/collections/deck/types.d.ts +327 -0
- package/dist/src/collections/deck/types.d.ts.map +1 -0
- package/dist/src/collections/deck/types.js +206 -0
- package/dist/src/collections/deck/types.js.map +1 -0
- package/dist/src/collections/index.d.ts +2 -0
- package/dist/src/collections/index.d.ts.map +1 -1
- package/dist/src/collections/index.js +2 -0
- package/dist/src/collections/index.js.map +1 -1
- package/dist/src/collections/value-tree/index.d.ts +380 -0
- package/dist/src/collections/value-tree/index.d.ts.map +1 -0
- package/dist/src/collections/value-tree/index.js +688 -0
- package/dist/src/collections/value-tree/index.js.map +1 -0
- package/dist/src/collections/value-tree/materialize.d.ts +65 -0
- package/dist/src/collections/value-tree/materialize.d.ts.map +1 -0
- package/dist/src/collections/value-tree/materialize.js +238 -0
- package/dist/src/collections/value-tree/materialize.js.map +1 -0
- package/dist/src/collections/value-tree/types.d.ts +324 -0
- package/dist/src/collections/value-tree/types.d.ts.map +1 -0
- package/dist/src/collections/value-tree/types.js +168 -0
- package/dist/src/collections/value-tree/types.js.map +1 -0
- package/dist/src/component.d.ts +1047 -61
- package/dist/src/component.d.ts.map +1 -1
- package/dist/src/component.js +97 -3
- package/dist/src/component.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +4 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +3 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/layout/splitter/index.d.ts +1 -0
- package/dist/src/layout/splitter/index.d.ts.map +1 -1
- package/dist/src/layout/splitter/index.js +2 -1
- package/dist/src/layout/splitter/index.js.map +1 -1
- package/dist/src/layout/splitter/types.d.ts +9 -0
- package/dist/src/layout/splitter/types.d.ts.map +1 -1
- package/dist/src/layout/splitter/types.js +4 -0
- package/dist/src/layout/splitter/types.js.map +1 -1
- package/dist/src/navigation/app/index.d.ts +135 -0
- package/dist/src/navigation/app/index.d.ts.map +1 -0
- package/dist/src/navigation/app/index.js +191 -0
- package/dist/src/navigation/app/index.js.map +1 -0
- package/dist/src/navigation/index.d.ts +1 -0
- package/dist/src/navigation/index.d.ts.map +1 -1
- package/dist/src/navigation/index.js +1 -0
- package/dist/src/navigation/index.js.map +1 -1
- package/dist/src/navigation/pages/types.d.ts +15 -1
- package/dist/src/navigation/pages/types.d.ts.map +1 -1
- package/dist/src/navigation/pages/types.js.map +1 -1
- package/dist/src/platform/slice/impl.js +2 -2
- package/dist/src/platform/slice/impl.js.map +1 -1
- package/dist/src/runtime/collections/calendar.d.ts +10 -5
- package/dist/src/runtime/collections/calendar.d.ts.map +1 -1
- package/dist/src/runtime/collections/calendar.js +10 -5
- package/dist/src/runtime/collections/calendar.js.map +1 -1
- package/dist/src/runtime/collections/deck.d.ts +1066 -0
- package/dist/src/runtime/collections/deck.d.ts.map +1 -0
- package/dist/src/runtime/collections/deck.js +54 -0
- package/dist/src/runtime/collections/deck.js.map +1 -0
- package/dist/src/runtime/collections/index.d.ts +2 -0
- package/dist/src/runtime/collections/index.d.ts.map +1 -1
- package/dist/src/runtime/collections/index.js +2 -0
- package/dist/src/runtime/collections/index.js.map +1 -1
- package/dist/src/runtime/collections/value-tree.d.ts +202 -0
- package/dist/src/runtime/collections/value-tree.d.ts.map +1 -0
- package/dist/src/runtime/collections/value-tree.js +49 -0
- package/dist/src/runtime/collections/value-tree.js.map +1 -0
- package/dist/src/runtime/navigation/app.d.ts +50 -0
- package/dist/src/runtime/navigation/app.d.ts.map +1 -0
- package/dist/src/runtime/navigation/app.js +51 -0
- package/dist/src/runtime/navigation/app.js.map +1 -0
- package/dist/src/runtime/navigation/index.d.ts +1 -0
- package/dist/src/runtime/navigation/index.d.ts.map +1 -1
- package/dist/src/runtime/navigation/index.js +1 -0
- package/dist/src/runtime/navigation/index.js.map +1 -1
- package/dist/test/collections/calendar.examples.d.ts +2 -0
- package/dist/test/collections/calendar.examples.d.ts.map +1 -1
- package/dist/test/collections/calendar.examples.js +74 -42
- package/dist/test/collections/calendar.examples.js.map +1 -1
- package/dist/test/collections/deck.examples.d.ts +8 -0
- package/dist/test/collections/deck.examples.d.ts.map +1 -0
- package/dist/test/collections/deck.examples.js +169 -0
- package/dist/test/collections/deck.examples.js.map +1 -0
- package/dist/test/collections/planner.examples.js +2 -2
- package/dist/test/collections/value-tree.examples.d.ts +10 -0
- package/dist/test/collections/value-tree.examples.d.ts.map +1 -0
- package/dist/test/collections/value-tree.examples.js +263 -0
- package/dist/test/collections/value-tree.examples.js.map +1 -0
- package/dist/test/display/image.examples.js +1 -1
- package/dist/test/display/image.examples.js.map +1 -1
- package/dist/test/layout/aligned-stack.examples.js +4 -4
- package/dist/test/layout/aligned-stack.examples.js.map +1 -1
- package/dist/test/layout/dock.examples.js +6 -6
- package/dist/test/layout/dock.examples.js.map +1 -1
- package/dist/test/layout/splitter.examples.d.ts +1 -0
- package/dist/test/layout/splitter.examples.d.ts.map +1 -1
- package/dist/test/layout/splitter.examples.js +11 -0
- package/dist/test/layout/splitter.examples.js.map +1 -1
- package/dist/test/navigation/app.examples.d.ts +22 -0
- package/dist/test/navigation/app.examples.d.ts.map +1 -0
- package/dist/test/navigation/app.examples.js +116 -0
- package/dist/test/navigation/app.examples.js.map +1 -0
- package/dist/test/navigation/nav-list.examples.js +2 -2
- package/dist/test/navigation/nav-list.examples.js.map +1 -1
- package/dist/test/overlays/drawer.examples.js +2 -2
- package/dist/test/overlays/drawer.examples.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* ValueTree types — the editable value-driven tree (#360).
|
|
7
|
+
*
|
|
8
|
+
* A ValueTree materializes ANY East value into a fixed recursive node IR
|
|
9
|
+
* at factory time (the renderer never sees the host type): structs,
|
|
10
|
+
* arrays, string-keyed dicts, options and variants become branch nodes;
|
|
11
|
+
* primitive leaves carry their typed value for leaf-type-aware editing;
|
|
12
|
+
* everything else (sets, blobs, vectors, matrices, refs, functions,
|
|
13
|
+
* beyond-depth recursion) renders as a printed read-only `opaque` node.
|
|
14
|
+
*
|
|
15
|
+
* Edits report through typed callbacks over {@link ValueTreePathType}
|
|
16
|
+
* paths — the host owns the data and reconciles (the Reactive
|
|
17
|
+
* re-materialization pattern every collection uses).
|
|
18
|
+
*/
|
|
19
|
+
import { ArrayType, AsyncFunctionType, BooleanType, DateTimeType, FloatType, IntegerType, NullType, OptionType, RecursiveType, StringType, StructType, VariantType } from "@elaraai/east";
|
|
20
|
+
/**
|
|
21
|
+
* One step of a node path.
|
|
22
|
+
*
|
|
23
|
+
* @property append - Append a new element to the array at the path so far
|
|
24
|
+
* (terminal step of array `onInsert` paths; disambiguates an array
|
|
25
|
+
* append inside a dict from a dict key insert)
|
|
26
|
+
* @property field - Struct field name
|
|
27
|
+
* @property index - Array element index
|
|
28
|
+
* @property key - Dict entry key (an existing entry mid-path; the NEW key
|
|
29
|
+
* as the terminal step of dict `onInsert` paths)
|
|
30
|
+
* @property some - Descend into an option's `some` payload
|
|
31
|
+
* @property tag - Descend into a variant's active payload
|
|
32
|
+
*/
|
|
33
|
+
export declare const ValueTreeStepType: VariantType<{
|
|
34
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
35
|
+
readonly append: NullType;
|
|
36
|
+
/** Struct field name */
|
|
37
|
+
readonly field: StringType;
|
|
38
|
+
/** Array element index */
|
|
39
|
+
readonly index: IntegerType;
|
|
40
|
+
/** Dict entry key */
|
|
41
|
+
readonly key: StringType;
|
|
42
|
+
/** Descend into an option's `some` payload */
|
|
43
|
+
readonly some: NullType;
|
|
44
|
+
/** Descend into a variant's active payload */
|
|
45
|
+
readonly tag: NullType;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Type representing one path step.
|
|
49
|
+
*/
|
|
50
|
+
export type ValueTreeStepType = typeof ValueTreeStepType;
|
|
51
|
+
/**
|
|
52
|
+
* A node path — root-to-node steps.
|
|
53
|
+
*/
|
|
54
|
+
export declare const ValueTreePathType: ArrayType<VariantType<{
|
|
55
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
56
|
+
readonly append: NullType;
|
|
57
|
+
/** Struct field name */
|
|
58
|
+
readonly field: StringType;
|
|
59
|
+
/** Array element index */
|
|
60
|
+
readonly index: IntegerType;
|
|
61
|
+
/** Dict entry key */
|
|
62
|
+
readonly key: StringType;
|
|
63
|
+
/** Descend into an option's `some` payload */
|
|
64
|
+
readonly some: NullType;
|
|
65
|
+
/** Descend into a variant's active payload */
|
|
66
|
+
readonly tag: NullType;
|
|
67
|
+
}>>;
|
|
68
|
+
/**
|
|
69
|
+
* Type representing a node path.
|
|
70
|
+
*/
|
|
71
|
+
export type ValueTreePathType = typeof ValueTreePathType;
|
|
72
|
+
/**
|
|
73
|
+
* A primitive leaf value — both the node payload (current value) and the
|
|
74
|
+
* `onEdit` payload (new value), so editors and edits share one shape.
|
|
75
|
+
*
|
|
76
|
+
* @property string - String leaf
|
|
77
|
+
* @property integer - Integer leaf
|
|
78
|
+
* @property float - Float leaf
|
|
79
|
+
* @property boolean - Boolean leaf
|
|
80
|
+
* @property datetime - DateTime leaf
|
|
81
|
+
* @property null - Null leaf (display-only)
|
|
82
|
+
*/
|
|
83
|
+
export declare const ValueTreeLeafType: VariantType<{
|
|
84
|
+
/** String leaf */
|
|
85
|
+
readonly string: StringType;
|
|
86
|
+
/** Integer leaf */
|
|
87
|
+
readonly integer: IntegerType;
|
|
88
|
+
/** Float leaf */
|
|
89
|
+
readonly float: FloatType;
|
|
90
|
+
/** Boolean leaf */
|
|
91
|
+
readonly boolean: BooleanType;
|
|
92
|
+
/** DateTime leaf */
|
|
93
|
+
readonly datetime: DateTimeType;
|
|
94
|
+
/** Null leaf (display-only) */
|
|
95
|
+
readonly null: NullType;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Type representing a primitive leaf value.
|
|
99
|
+
*/
|
|
100
|
+
export type ValueTreeLeafType = typeof ValueTreeLeafType;
|
|
101
|
+
/**
|
|
102
|
+
* The materialized value tree.
|
|
103
|
+
*
|
|
104
|
+
* @property struct - Named fields
|
|
105
|
+
* @property array - Ordered elements (insert/remove targets)
|
|
106
|
+
* @property dict - Keyed entries; `editable` is true only for
|
|
107
|
+
* string-keyed dicts (other key types are browsable read-only — their
|
|
108
|
+
* printed keys cannot round-trip through path steps)
|
|
109
|
+
* @property option - `some` payload or empty (toggled via `onTag` "some"/"none")
|
|
110
|
+
* @property variant - Active tag + all tags (switched via `onTag`) + payload
|
|
111
|
+
* @property leaf - Primitive value (edited via `onEdit`)
|
|
112
|
+
* @property opaque - Summarized read-only value (sets, blobs, vectors,
|
|
113
|
+
* matrices, refs, functions, beyond-depth recursion)
|
|
114
|
+
*/
|
|
115
|
+
export declare const ValueTreeNodeType: RecursiveType<VariantType<{
|
|
116
|
+
/** Named fields */
|
|
117
|
+
readonly struct: StructType<{
|
|
118
|
+
readonly fields: ArrayType<StructType<{
|
|
119
|
+
readonly name: StringType;
|
|
120
|
+
readonly node: import("@elaraai/east").RecursiveTypeMarker;
|
|
121
|
+
}>>;
|
|
122
|
+
}>;
|
|
123
|
+
/** Ordered elements */
|
|
124
|
+
readonly array: StructType<{
|
|
125
|
+
readonly items: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
|
|
126
|
+
}>;
|
|
127
|
+
/** Keyed entries (editable only when string-keyed) */
|
|
128
|
+
readonly dict: StructType<{
|
|
129
|
+
readonly entries: ArrayType<StructType<{
|
|
130
|
+
readonly key: StringType;
|
|
131
|
+
readonly node: import("@elaraai/east").RecursiveTypeMarker;
|
|
132
|
+
}>>;
|
|
133
|
+
readonly editable: BooleanType;
|
|
134
|
+
}>;
|
|
135
|
+
/** `some` payload or empty */
|
|
136
|
+
readonly option: StructType<{
|
|
137
|
+
readonly value: OptionType<import("@elaraai/east").RecursiveTypeMarker>;
|
|
138
|
+
}>;
|
|
139
|
+
/** Active tag + all tags + payload */
|
|
140
|
+
readonly variant: StructType<{
|
|
141
|
+
readonly tag: StringType;
|
|
142
|
+
readonly tags: ArrayType<StringType>;
|
|
143
|
+
readonly value: import("@elaraai/east").RecursiveTypeMarker;
|
|
144
|
+
}>;
|
|
145
|
+
/** Primitive value */
|
|
146
|
+
readonly leaf: VariantType<{
|
|
147
|
+
/** String leaf */
|
|
148
|
+
readonly string: StringType;
|
|
149
|
+
/** Integer leaf */
|
|
150
|
+
readonly integer: IntegerType;
|
|
151
|
+
/** Float leaf */
|
|
152
|
+
readonly float: FloatType;
|
|
153
|
+
/** Boolean leaf */
|
|
154
|
+
readonly boolean: BooleanType;
|
|
155
|
+
/** DateTime leaf */
|
|
156
|
+
readonly datetime: DateTimeType;
|
|
157
|
+
/** Null leaf (display-only) */
|
|
158
|
+
readonly null: NullType;
|
|
159
|
+
}>;
|
|
160
|
+
/** Printed read-only value */
|
|
161
|
+
readonly opaque: StringType;
|
|
162
|
+
}>>;
|
|
163
|
+
/**
|
|
164
|
+
* Type representing a materialized value-tree node.
|
|
165
|
+
*/
|
|
166
|
+
export type ValueTreeNodeType = typeof ValueTreeNodeType;
|
|
167
|
+
/**
|
|
168
|
+
* Style configuration for the ValueTree container.
|
|
169
|
+
*
|
|
170
|
+
* @property height - Pinned height (CSS length; rows virtualize within)
|
|
171
|
+
* @property maxHeight - Height cap (content-sized up to it, then scrolls)
|
|
172
|
+
*/
|
|
173
|
+
export declare const ValueTreeStyleType: StructType<{
|
|
174
|
+
readonly height: OptionType<StringType>;
|
|
175
|
+
readonly maxHeight: OptionType<StringType>;
|
|
176
|
+
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Type representing the ValueTree style structure.
|
|
179
|
+
*/
|
|
180
|
+
export type ValueTreeStyleType = typeof ValueTreeStyleType;
|
|
181
|
+
/**
|
|
182
|
+
* The full ValueTree payload — the `component.ts` variant's struct; use
|
|
183
|
+
* for `ValueTypeOf<typeof ValueTree.Types.Root>` in renderers and
|
|
184
|
+
* assertions.
|
|
185
|
+
*
|
|
186
|
+
* Callback slots are ASYNC function types: handlers routinely write
|
|
187
|
+
* State (an async platform effect), and a synchronous function is a
|
|
188
|
+
* subtype of its async counterpart — so both fit.
|
|
189
|
+
*
|
|
190
|
+
* @property root - The materialized node tree
|
|
191
|
+
* @property onEdit - Leaf edit callback (path + new leaf value)
|
|
192
|
+
* @property onInsert - Append/insert callback (array/dict node path)
|
|
193
|
+
* @property onRemove - Remove callback (element/entry path)
|
|
194
|
+
* @property onTag - Variant tag switch / option toggle callback
|
|
195
|
+
* @property style - Layout style
|
|
196
|
+
*/
|
|
197
|
+
export declare const ValueTreeRootType: StructType<{
|
|
198
|
+
readonly root: RecursiveType<VariantType<{
|
|
199
|
+
/** Named fields */
|
|
200
|
+
readonly struct: StructType<{
|
|
201
|
+
readonly fields: ArrayType<StructType<{
|
|
202
|
+
readonly name: StringType;
|
|
203
|
+
readonly node: import("@elaraai/east").RecursiveTypeMarker;
|
|
204
|
+
}>>;
|
|
205
|
+
}>;
|
|
206
|
+
/** Ordered elements */
|
|
207
|
+
readonly array: StructType<{
|
|
208
|
+
readonly items: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
|
|
209
|
+
}>;
|
|
210
|
+
/** Keyed entries (editable only when string-keyed) */
|
|
211
|
+
readonly dict: StructType<{
|
|
212
|
+
readonly entries: ArrayType<StructType<{
|
|
213
|
+
readonly key: StringType;
|
|
214
|
+
readonly node: import("@elaraai/east").RecursiveTypeMarker;
|
|
215
|
+
}>>;
|
|
216
|
+
readonly editable: BooleanType;
|
|
217
|
+
}>;
|
|
218
|
+
/** `some` payload or empty */
|
|
219
|
+
readonly option: StructType<{
|
|
220
|
+
readonly value: OptionType<import("@elaraai/east").RecursiveTypeMarker>;
|
|
221
|
+
}>;
|
|
222
|
+
/** Active tag + all tags + payload */
|
|
223
|
+
readonly variant: StructType<{
|
|
224
|
+
readonly tag: StringType;
|
|
225
|
+
readonly tags: ArrayType<StringType>;
|
|
226
|
+
readonly value: import("@elaraai/east").RecursiveTypeMarker;
|
|
227
|
+
}>;
|
|
228
|
+
/** Primitive value */
|
|
229
|
+
readonly leaf: VariantType<{
|
|
230
|
+
/** String leaf */
|
|
231
|
+
readonly string: StringType;
|
|
232
|
+
/** Integer leaf */
|
|
233
|
+
readonly integer: IntegerType;
|
|
234
|
+
/** Float leaf */
|
|
235
|
+
readonly float: FloatType;
|
|
236
|
+
/** Boolean leaf */
|
|
237
|
+
readonly boolean: BooleanType;
|
|
238
|
+
/** DateTime leaf */
|
|
239
|
+
readonly datetime: DateTimeType;
|
|
240
|
+
/** Null leaf (display-only) */
|
|
241
|
+
readonly null: NullType;
|
|
242
|
+
}>;
|
|
243
|
+
/** Printed read-only value */
|
|
244
|
+
readonly opaque: StringType;
|
|
245
|
+
}>>;
|
|
246
|
+
readonly onEdit: OptionType<AsyncFunctionType<[ArrayType<VariantType<{
|
|
247
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
248
|
+
readonly append: NullType;
|
|
249
|
+
/** Struct field name */
|
|
250
|
+
readonly field: StringType;
|
|
251
|
+
/** Array element index */
|
|
252
|
+
readonly index: IntegerType;
|
|
253
|
+
/** Dict entry key */
|
|
254
|
+
readonly key: StringType;
|
|
255
|
+
/** Descend into an option's `some` payload */
|
|
256
|
+
readonly some: NullType;
|
|
257
|
+
/** Descend into a variant's active payload */
|
|
258
|
+
readonly tag: NullType;
|
|
259
|
+
}>>, VariantType<{
|
|
260
|
+
/** String leaf */
|
|
261
|
+
readonly string: StringType;
|
|
262
|
+
/** Integer leaf */
|
|
263
|
+
readonly integer: IntegerType;
|
|
264
|
+
/** Float leaf */
|
|
265
|
+
readonly float: FloatType;
|
|
266
|
+
/** Boolean leaf */
|
|
267
|
+
readonly boolean: BooleanType;
|
|
268
|
+
/** DateTime leaf */
|
|
269
|
+
readonly datetime: DateTimeType;
|
|
270
|
+
/** Null leaf (display-only) */
|
|
271
|
+
readonly null: NullType;
|
|
272
|
+
}>], NullType>>;
|
|
273
|
+
readonly onInsert: OptionType<AsyncFunctionType<[ArrayType<VariantType<{
|
|
274
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
275
|
+
readonly append: NullType;
|
|
276
|
+
/** Struct field name */
|
|
277
|
+
readonly field: StringType;
|
|
278
|
+
/** Array element index */
|
|
279
|
+
readonly index: IntegerType;
|
|
280
|
+
/** Dict entry key */
|
|
281
|
+
readonly key: StringType;
|
|
282
|
+
/** Descend into an option's `some` payload */
|
|
283
|
+
readonly some: NullType;
|
|
284
|
+
/** Descend into a variant's active payload */
|
|
285
|
+
readonly tag: NullType;
|
|
286
|
+
}>>], NullType>>;
|
|
287
|
+
readonly onRemove: OptionType<AsyncFunctionType<[ArrayType<VariantType<{
|
|
288
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
289
|
+
readonly append: NullType;
|
|
290
|
+
/** Struct field name */
|
|
291
|
+
readonly field: StringType;
|
|
292
|
+
/** Array element index */
|
|
293
|
+
readonly index: IntegerType;
|
|
294
|
+
/** Dict entry key */
|
|
295
|
+
readonly key: StringType;
|
|
296
|
+
/** Descend into an option's `some` payload */
|
|
297
|
+
readonly some: NullType;
|
|
298
|
+
/** Descend into a variant's active payload */
|
|
299
|
+
readonly tag: NullType;
|
|
300
|
+
}>>], NullType>>;
|
|
301
|
+
readonly onTag: OptionType<AsyncFunctionType<[ArrayType<VariantType<{
|
|
302
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
303
|
+
readonly append: NullType;
|
|
304
|
+
/** Struct field name */
|
|
305
|
+
readonly field: StringType;
|
|
306
|
+
/** Array element index */
|
|
307
|
+
readonly index: IntegerType;
|
|
308
|
+
/** Dict entry key */
|
|
309
|
+
readonly key: StringType;
|
|
310
|
+
/** Descend into an option's `some` payload */
|
|
311
|
+
readonly some: NullType;
|
|
312
|
+
/** Descend into a variant's active payload */
|
|
313
|
+
readonly tag: NullType;
|
|
314
|
+
}>>, StringType], NullType>>;
|
|
315
|
+
readonly style: OptionType<StructType<{
|
|
316
|
+
readonly height: OptionType<StringType>;
|
|
317
|
+
readonly maxHeight: OptionType<StringType>;
|
|
318
|
+
}>>;
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* Type representing the full ValueTree payload.
|
|
322
|
+
*/
|
|
323
|
+
export type ValueTreeRootType = typeof ValueTreeRootType;
|
|
324
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/collections/value-tree/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,EACd,MAAM,eAAe,CAAC;AAMvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;IAC1B,wEAAwE;;IAExE,wBAAwB;;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9B,sCAAsC;;;;;;QAMtC,sBAAsB;;YA7DtB,kBAAkB;;YAElB,mBAAmB;;YAEnB,iBAAiB;;YAEjB,mBAAmB;;YAEnB,oBAAoB;;YAEpB,+BAA+B;;;QAqD/B,8BAA8B;;;;QA5G9B,wEAAwE;;QAExE,wBAAwB;;QAExB,0BAA0B;;QAE1B,qBAAqB;;QAErB,8CAA8C;;QAE9C,8CAA8C;;;QAmC9C,kBAAkB;;QAElB,mBAAmB;;QAEnB,iBAAiB;;QAEjB,mBAAmB;;QAEnB,oBAAoB;;QAEpB,+BAA+B;;;;QAvD/B,wEAAwE;;QAExE,wBAAwB;;QAExB,0BAA0B;;QAE1B,qBAAqB;;QAErB,8CAA8C;;QAE9C,8CAA8C;;;;QAV9C,wEAAwE;;QAExE,wBAAwB;;QAExB,0BAA0B;;QAE1B,qBAAqB;;QAErB,8CAA8C;;QAE9C,8CAA8C;;;;QAV9C,wEAAwE;;QAExE,wBAAwB;;QAExB,0BAA0B;;QAE1B,qBAAqB;;QAErB,8CAA8C;;QAE9C,8CAA8C;;;;;;;EA0JhD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* ValueTree types — the editable value-driven tree (#360).
|
|
7
|
+
*
|
|
8
|
+
* A ValueTree materializes ANY East value into a fixed recursive node IR
|
|
9
|
+
* at factory time (the renderer never sees the host type): structs,
|
|
10
|
+
* arrays, string-keyed dicts, options and variants become branch nodes;
|
|
11
|
+
* primitive leaves carry their typed value for leaf-type-aware editing;
|
|
12
|
+
* everything else (sets, blobs, vectors, matrices, refs, functions,
|
|
13
|
+
* beyond-depth recursion) renders as a printed read-only `opaque` node.
|
|
14
|
+
*
|
|
15
|
+
* Edits report through typed callbacks over {@link ValueTreePathType}
|
|
16
|
+
* paths — the host owns the data and reconciles (the Reactive
|
|
17
|
+
* re-materialization pattern every collection uses).
|
|
18
|
+
*/
|
|
19
|
+
import { ArrayType, AsyncFunctionType, BooleanType, DateTimeType, FloatType, IntegerType, NullType, OptionType, RecursiveType, StringType, StructType, VariantType, } from "@elaraai/east";
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Paths
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* One step of a node path.
|
|
25
|
+
*
|
|
26
|
+
* @property append - Append a new element to the array at the path so far
|
|
27
|
+
* (terminal step of array `onInsert` paths; disambiguates an array
|
|
28
|
+
* append inside a dict from a dict key insert)
|
|
29
|
+
* @property field - Struct field name
|
|
30
|
+
* @property index - Array element index
|
|
31
|
+
* @property key - Dict entry key (an existing entry mid-path; the NEW key
|
|
32
|
+
* as the terminal step of dict `onInsert` paths)
|
|
33
|
+
* @property some - Descend into an option's `some` payload
|
|
34
|
+
* @property tag - Descend into a variant's active payload
|
|
35
|
+
*/
|
|
36
|
+
export const ValueTreeStepType = VariantType({
|
|
37
|
+
/** Append to the array at the path so far (terminal `onInsert` step) */
|
|
38
|
+
append: NullType,
|
|
39
|
+
/** Struct field name */
|
|
40
|
+
field: StringType,
|
|
41
|
+
/** Array element index */
|
|
42
|
+
index: IntegerType,
|
|
43
|
+
/** Dict entry key */
|
|
44
|
+
key: StringType,
|
|
45
|
+
/** Descend into an option's `some` payload */
|
|
46
|
+
some: NullType,
|
|
47
|
+
/** Descend into a variant's active payload */
|
|
48
|
+
tag: NullType,
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* A node path — root-to-node steps.
|
|
52
|
+
*/
|
|
53
|
+
export const ValueTreePathType = ArrayType(ValueTreeStepType);
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// Leaves
|
|
56
|
+
// ============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* A primitive leaf value — both the node payload (current value) and the
|
|
59
|
+
* `onEdit` payload (new value), so editors and edits share one shape.
|
|
60
|
+
*
|
|
61
|
+
* @property string - String leaf
|
|
62
|
+
* @property integer - Integer leaf
|
|
63
|
+
* @property float - Float leaf
|
|
64
|
+
* @property boolean - Boolean leaf
|
|
65
|
+
* @property datetime - DateTime leaf
|
|
66
|
+
* @property null - Null leaf (display-only)
|
|
67
|
+
*/
|
|
68
|
+
export const ValueTreeLeafType = VariantType({
|
|
69
|
+
/** String leaf */
|
|
70
|
+
string: StringType,
|
|
71
|
+
/** Integer leaf */
|
|
72
|
+
integer: IntegerType,
|
|
73
|
+
/** Float leaf */
|
|
74
|
+
float: FloatType,
|
|
75
|
+
/** Boolean leaf */
|
|
76
|
+
boolean: BooleanType,
|
|
77
|
+
/** DateTime leaf */
|
|
78
|
+
datetime: DateTimeType,
|
|
79
|
+
/** Null leaf (display-only) */
|
|
80
|
+
null: NullType,
|
|
81
|
+
});
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// Nodes
|
|
84
|
+
// ============================================================================
|
|
85
|
+
/**
|
|
86
|
+
* The materialized value tree.
|
|
87
|
+
*
|
|
88
|
+
* @property struct - Named fields
|
|
89
|
+
* @property array - Ordered elements (insert/remove targets)
|
|
90
|
+
* @property dict - Keyed entries; `editable` is true only for
|
|
91
|
+
* string-keyed dicts (other key types are browsable read-only — their
|
|
92
|
+
* printed keys cannot round-trip through path steps)
|
|
93
|
+
* @property option - `some` payload or empty (toggled via `onTag` "some"/"none")
|
|
94
|
+
* @property variant - Active tag + all tags (switched via `onTag`) + payload
|
|
95
|
+
* @property leaf - Primitive value (edited via `onEdit`)
|
|
96
|
+
* @property opaque - Summarized read-only value (sets, blobs, vectors,
|
|
97
|
+
* matrices, refs, functions, beyond-depth recursion)
|
|
98
|
+
*/
|
|
99
|
+
export const ValueTreeNodeType = RecursiveType(node => VariantType({
|
|
100
|
+
/** Named fields */
|
|
101
|
+
struct: StructType({
|
|
102
|
+
fields: ArrayType(StructType({ name: StringType, node })),
|
|
103
|
+
}),
|
|
104
|
+
/** Ordered elements */
|
|
105
|
+
array: StructType({
|
|
106
|
+
items: ArrayType(node),
|
|
107
|
+
}),
|
|
108
|
+
/** Keyed entries (editable only when string-keyed) */
|
|
109
|
+
dict: StructType({
|
|
110
|
+
entries: ArrayType(StructType({ key: StringType, node })),
|
|
111
|
+
editable: BooleanType,
|
|
112
|
+
}),
|
|
113
|
+
/** `some` payload or empty */
|
|
114
|
+
option: StructType({
|
|
115
|
+
value: OptionType(node),
|
|
116
|
+
}),
|
|
117
|
+
/** Active tag + all tags + payload */
|
|
118
|
+
variant: StructType({
|
|
119
|
+
tag: StringType,
|
|
120
|
+
tags: ArrayType(StringType),
|
|
121
|
+
value: node,
|
|
122
|
+
}),
|
|
123
|
+
/** Primitive value */
|
|
124
|
+
leaf: ValueTreeLeafType,
|
|
125
|
+
/** Printed read-only value */
|
|
126
|
+
opaque: StringType,
|
|
127
|
+
}));
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// Style
|
|
130
|
+
// ============================================================================
|
|
131
|
+
/**
|
|
132
|
+
* Style configuration for the ValueTree container.
|
|
133
|
+
*
|
|
134
|
+
* @property height - Pinned height (CSS length; rows virtualize within)
|
|
135
|
+
* @property maxHeight - Height cap (content-sized up to it, then scrolls)
|
|
136
|
+
*/
|
|
137
|
+
export const ValueTreeStyleType = StructType({
|
|
138
|
+
height: OptionType(StringType),
|
|
139
|
+
maxHeight: OptionType(StringType),
|
|
140
|
+
});
|
|
141
|
+
// ============================================================================
|
|
142
|
+
// Root payload
|
|
143
|
+
// ============================================================================
|
|
144
|
+
/**
|
|
145
|
+
* The full ValueTree payload — the `component.ts` variant's struct; use
|
|
146
|
+
* for `ValueTypeOf<typeof ValueTree.Types.Root>` in renderers and
|
|
147
|
+
* assertions.
|
|
148
|
+
*
|
|
149
|
+
* Callback slots are ASYNC function types: handlers routinely write
|
|
150
|
+
* State (an async platform effect), and a synchronous function is a
|
|
151
|
+
* subtype of its async counterpart — so both fit.
|
|
152
|
+
*
|
|
153
|
+
* @property root - The materialized node tree
|
|
154
|
+
* @property onEdit - Leaf edit callback (path + new leaf value)
|
|
155
|
+
* @property onInsert - Append/insert callback (array/dict node path)
|
|
156
|
+
* @property onRemove - Remove callback (element/entry path)
|
|
157
|
+
* @property onTag - Variant tag switch / option toggle callback
|
|
158
|
+
* @property style - Layout style
|
|
159
|
+
*/
|
|
160
|
+
export const ValueTreeRootType = StructType({
|
|
161
|
+
root: ValueTreeNodeType,
|
|
162
|
+
onEdit: OptionType(AsyncFunctionType([ValueTreePathType, ValueTreeLeafType], NullType)),
|
|
163
|
+
onInsert: OptionType(AsyncFunctionType([ValueTreePathType], NullType)),
|
|
164
|
+
onRemove: OptionType(AsyncFunctionType([ValueTreePathType], NullType)),
|
|
165
|
+
onTag: OptionType(AsyncFunctionType([ValueTreePathType, StringType], NullType)),
|
|
166
|
+
style: OptionType(ValueTreeStyleType),
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/collections/value-tree/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,GACd,MAAM,eAAe,CAAC;AAEvB,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;IACzC,wEAAwE;IACxE,MAAM,EAAE,QAAQ;IAChB,wBAAwB;IACxB,KAAK,EAAE,UAAU;IACjB,0BAA0B;IAC1B,KAAK,EAAE,WAAW;IAClB,qBAAqB;IACrB,GAAG,EAAE,U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