@elaraai/east-ui 1.0.97 → 1.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/src/collections/index.d.ts +0 -1
  2. package/dist/src/collections/index.d.ts.map +1 -1
  3. package/dist/src/collections/index.js +0 -1
  4. package/dist/src/collections/index.js.map +1 -1
  5. package/dist/src/component.d.ts +0 -999
  6. package/dist/src/component.d.ts.map +1 -1
  7. package/dist/src/component.js +0 -44
  8. package/dist/src/component.js.map +1 -1
  9. package/dist/src/contracts/drag.d.ts +2 -2
  10. package/dist/src/contracts/drag.js +2 -2
  11. package/dist/src/contracts/editing.d.ts +4 -0
  12. package/dist/src/contracts/editing.d.ts.map +1 -1
  13. package/dist/src/contracts/editing.js +2 -1
  14. package/dist/src/contracts/editing.js.map +1 -1
  15. package/dist/src/index.d.ts +2 -1
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/index.js +4 -1
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/internal.d.ts +4 -1
  20. package/dist/src/internal.d.ts.map +1 -1
  21. package/dist/src/internal.js +5 -2
  22. package/dist/src/internal.js.map +1 -1
  23. package/dist/src/layout/snap-grid/index.d.ts +1 -0
  24. package/dist/src/layout/snap-grid/index.d.ts.map +1 -1
  25. package/dist/src/pick/panel/index.js +1 -1
  26. package/dist/src/pick/panel/index.js.map +1 -1
  27. package/dist/src/platform/slice/index.d.ts +4 -7
  28. package/dist/src/platform/slice/index.d.ts.map +1 -1
  29. package/dist/src/platform/slice/index.js +5 -8
  30. package/dist/src/platform/slice/index.js.map +1 -1
  31. package/dist/src/platform/slice/record-area.d.ts +181 -0
  32. package/dist/src/platform/slice/record-area.d.ts.map +1 -0
  33. package/dist/src/platform/slice/record-area.js +304 -0
  34. package/dist/src/platform/slice/record-area.js.map +1 -0
  35. package/dist/src/platform/slice/record-chrome.d.ts +138 -0
  36. package/dist/src/platform/slice/record-chrome.d.ts.map +1 -1
  37. package/dist/src/platform/slice/record-plan.d.ts +34 -1
  38. package/dist/src/platform/slice/record-plan.d.ts.map +1 -1
  39. package/dist/src/platform/slice/record-plan.js +126 -3
  40. package/dist/src/platform/slice/record-plan.js.map +1 -1
  41. package/dist/src/platform/slice/record-series.d.ts +166 -0
  42. package/dist/src/platform/slice/record-series.d.ts.map +1 -0
  43. package/dist/src/platform/slice/record-series.js +258 -0
  44. package/dist/src/platform/slice/record-series.js.map +1 -0
  45. package/dist/src/platform/slice/record-types.d.ts +1862 -13
  46. package/dist/src/platform/slice/record-types.d.ts.map +1 -1
  47. package/dist/src/platform/slice/record-types.js +50 -4
  48. package/dist/src/platform/slice/record-types.js.map +1 -1
  49. package/dist/src/platform/slice/record.d.ts +17 -2
  50. package/dist/src/platform/slice/record.d.ts.map +1 -1
  51. package/dist/src/platform/slice/record.js +62 -9
  52. package/dist/src/platform/slice/record.js.map +1 -1
  53. package/dist/src/runtime/collections/index.d.ts +0 -1
  54. package/dist/src/runtime/collections/index.d.ts.map +1 -1
  55. package/dist/src/runtime/collections/index.js +0 -1
  56. package/dist/src/runtime/collections/index.js.map +1 -1
  57. package/dist/src/runtime/record-slice-source.d.ts +298 -0
  58. package/dist/src/runtime/record-slice-source.d.ts.map +1 -1
  59. package/dist/src/runtime/record-slice-source.js +554 -16
  60. package/dist/src/runtime/record-slice-source.js.map +1 -1
  61. package/dist/src/runtime/record-slice.d.ts +87 -3
  62. package/dist/src/runtime/record-slice.d.ts.map +1 -1
  63. package/dist/src/runtime/record-slice.js +175 -12
  64. package/dist/src/runtime/record-slice.js.map +1 -1
  65. package/dist/src/slice/record/index.d.ts +69 -0
  66. package/dist/src/slice/record/index.d.ts.map +1 -1
  67. package/dist/src/style/color.d.ts +237 -0
  68. package/dist/src/style/color.d.ts.map +1 -0
  69. package/dist/src/style/color.js +105 -0
  70. package/dist/src/style/color.js.map +1 -0
  71. package/dist/src/style/namespace.d.ts +151 -1
  72. package/dist/src/style/namespace.d.ts.map +1 -1
  73. package/dist/src/style/namespace.js +9 -1
  74. package/dist/src/style/namespace.js.map +1 -1
  75. package/dist/src/style.d.ts +3 -0
  76. package/dist/src/style.d.ts.map +1 -1
  77. package/dist/src/style.js +3 -0
  78. package/dist/src/style.js.map +1 -1
  79. package/dist/test/style.examples.d.ts +1 -0
  80. package/dist/test/style.examples.d.ts.map +1 -1
  81. package/dist/test/style.examples.js +17 -2
  82. package/dist/test/style.examples.js.map +1 -1
  83. package/package.json +4 -4
  84. package/dist/src/collections/schematic/index.d.ts +0 -1390
  85. package/dist/src/collections/schematic/index.d.ts.map +0 -1
  86. package/dist/src/collections/schematic/index.js +0 -815
  87. package/dist/src/collections/schematic/index.js.map +0 -1
  88. package/dist/src/collections/schematic/types.d.ts +0 -1183
  89. package/dist/src/collections/schematic/types.d.ts.map +0 -1
  90. package/dist/src/collections/schematic/types.js +0 -724
  91. package/dist/src/collections/schematic/types.js.map +0 -1
  92. package/dist/src/runtime/collections/schematic.d.ts +0 -73
  93. package/dist/src/runtime/collections/schematic.d.ts.map +0 -1
  94. package/dist/src/runtime/collections/schematic.js +0 -69
  95. package/dist/src/runtime/collections/schematic.js.map +0 -1
  96. package/dist/test/collections/schematic.examples.d.ts +0 -23
  97. package/dist/test/collections/schematic.examples.d.ts.map +0 -1
  98. package/dist/test/collections/schematic.examples.js +0 -602
  99. package/dist/test/collections/schematic.examples.js.map +0 -1
@@ -1,815 +0,0 @@
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
- * `Schematic` — a 2D world-coordinate canvas for placing real-world
7
- * entities (tanks, bays, lines, nodes, cells) in space, plus annotation
8
- * zones (rooms, walkways) and key-addressed links, all from flat data
9
- * tables with chart-style field encodings. Interaction is opt-in per
10
- * channel (selection, camera, zone / link / net editing, item moves,
11
- * hover cards) — with nothing bound it is a read-only picture; appearance
12
- * belongs to the linked Library entry; position and live metrics are
13
- * owned here.
14
- *
15
- * @packageDocumentation
16
- */
17
- import { East, Expr, variant, some, none, ArrayType, BooleanType, FloatType, FunctionType, NullType, OptionType, StringType, StructType, } from "@elaraai/east";
18
- import { UIComponentType } from "../../component.js";
19
- import { mapRows } from "../../shared/reify.js";
20
- import { StatusTokenType } from "../../style/interaction.js";
21
- import {} from "../../display/icon/types.js";
22
- import { localSliceHandle, SliceBindType, SliceChromeType } from "../../platform/slice/index.js";
23
- import { SliceAffordanceType } from "../../contracts/slice-affordances.js";
24
- import { SchematicItemType, SchematicZoneType, SchematicLinkType, SchematicPointType, SchematicVertexType, SchematicGeometryType, SchematicZonePatternType, SchematicLinkStyleType, SchematicRouteType, SchematicToneType, SchematicEmphasisType, SchematicSliceEffectType, SchematicLayerType, SchematicSelectionModeType, SchematicRegionType, SchematicSelectionEventType, SchematicViewportEventType, SchematicZoneSelectionEventType, SchematicLinkModeType, SchematicLinkEndpointsType, SchematicLinkCreateEventType, SchematicLinkEditEventType, SchematicNetEndpointsType, SchematicNetType, SchematicItemMoveEventType, } from "./types.js";
25
- // Re-export types
26
- export { SchematicItemType, SchematicZoneType, SchematicLinkType, SchematicPointType, SchematicVertexType, SchematicGeometryType, SchematicZonePatternType, SchematicLinkStyleType, SchematicRouteType, SchematicToneType, SchematicEmphasisType, SchematicSliceEffectType, SchematicLayerType, SchematicSelectionModeType, SchematicRegionType, SchematicSelectionEventType, SchematicViewportEventType, SchematicZoneSelectionEventType, SchematicLinkModeType, SchematicLinkEndpointsType, SchematicLinkCreateEventType, SchematicLinkEditEventType, SchematicNetEndpointsType, SchematicNetType, SchematicItemMoveEventType, } from "./types.js";
27
- /**
28
- * East type for the Schematic root — the resolved mirror of the inline
29
- * `Schematic` struct in `component.ts` (which spells the three `*Hover`
30
- * fields with the recursion `node` where this mirror resolves them to
31
- * `UIComponentType`). Keep the two spellings in sync field-for-field.
32
- *
33
- * @remarks
34
- * Per-field docs live on {@link SchematicConfig}; events and collection
35
- * row types are documented in `./types.ts`.
36
- */
37
- export const SchematicRootType = StructType({
38
- extent: StructType({ width: FloatType, height: FloatType }),
39
- items: ArrayType(SchematicItemType),
40
- zones: ArrayType(SchematicZoneType),
41
- links: ArrayType(SchematicLinkType),
42
- nets: ArrayType(SchematicNetType),
43
- scaleUnit: OptionType(StringType),
44
- grid: OptionType(BooleanType),
45
- navigator: OptionType(BooleanType),
46
- minimap: OptionType(BooleanType),
47
- slice: OptionType(SliceChromeType),
48
- sliceEffect: OptionType(SchematicSliceEffectType),
49
- layers: OptionType(ArrayType(SchematicLayerType)),
50
- height: OptionType(StringType),
51
- maxHeight: OptionType(StringType),
52
- onSelect: OptionType(FunctionType([StringType], NullType)),
53
- selectionMode: OptionType(SchematicSelectionModeType),
54
- onSelectionChange: OptionType(FunctionType([SchematicSelectionEventType], NullType)),
55
- sliceSelectField: OptionType(StringType),
56
- selectZoomFocus: OptionType(BooleanType),
57
- onViewportChange: OptionType(FunctionType([SchematicViewportEventType], NullType)),
58
- onItemOpen: OptionType(FunctionType([StringType], NullType)),
59
- onSelectZone: OptionType(FunctionType([StringType], NullType)),
60
- onZoneSelectionChange: OptionType(FunctionType([SchematicZoneSelectionEventType], NullType)),
61
- linkMode: OptionType(SchematicLinkModeType),
62
- onCreateLink: OptionType(FunctionType([SchematicLinkCreateEventType], NullType)),
63
- onSelectLink: OptionType(FunctionType([StringType], NullType)),
64
- onEditLink: OptionType(FunctionType([SchematicLinkEditEventType], NullType)),
65
- onDeleteLink: OptionType(FunctionType([StringType], NullType)),
66
- readOnly: OptionType(BooleanType),
67
- readOnlyLinks: OptionType(BooleanType),
68
- readOnlyItems: OptionType(BooleanType),
69
- onMoveItem: OptionType(FunctionType([SchematicItemMoveEventType], NullType)),
70
- itemHover: OptionType(FunctionType([StringType], UIComponentType)),
71
- zoneHover: OptionType(FunctionType([StringType], UIComponentType)),
72
- linkHover: OptionType(FunctionType([StringType], UIComponentType)),
73
- onEditNet: OptionType(FunctionType([SchematicNetEndpointsType], NullType)),
74
- canConnect: OptionType(FunctionType([StringType, StringType], BooleanType)),
75
- });
76
- function toneValue(tone) {
77
- return tone !== undefined ? some(variant(tone, null)) : none;
78
- }
79
- /** Wrap an item/zone `tone` colour override into its option — accepts a string
80
- * literal shorthand (`"brand"`) or an East tone expression / value. */
81
- function toneOption(tone) {
82
- if (tone === undefined)
83
- return none;
84
- return typeof tone === "string" ? some(variant(tone, null)) : some(tone);
85
- }
86
- /**
87
- * Builds an `outline` zone pattern value — the dashed boundary with an
88
- * eyebrow label (rooms, cells).
89
- *
90
- * @param config - Optional style configuration (`tone`)
91
- * @returns A `SchematicZonePatternType` value
92
- */
93
- function outline(config) {
94
- return variant("outline", { tone: toneValue(config?.tone) });
95
- }
96
- /**
97
- * Builds a `hatch` zone pattern value — the hatched band (walkways,
98
- * aisles, exclusion strips).
99
- *
100
- * @param config - Optional style configuration (`tone`, `spacing`, `angle`)
101
- * @returns A `SchematicZonePatternType` value
102
- */
103
- function hatch(config) {
104
- return variant("hatch", {
105
- tone: toneValue(config?.tone),
106
- spacing: config?.spacing !== undefined ? some(config.spacing) : none,
107
- angle: config?.angle !== undefined ? some(config.angle) : none,
108
- });
109
- }
110
- /**
111
- * Builds a `solid` link style value — a physical run (pipe, conveyor).
112
- *
113
- * @param config - Optional stroke configuration (`tone`, `weight`)
114
- * @returns A `SchematicLinkStyleType` value
115
- */
116
- function solid(config) {
117
- return variant("solid", {
118
- tone: toneValue(config?.tone),
119
- weight: config?.weight !== undefined ? some(config.weight) : none,
120
- });
121
- }
122
- /**
123
- * Builds a `dashed` link style value — a routing / logical connection.
124
- *
125
- * @param config - Optional stroke configuration (`tone`, `weight`)
126
- * @returns A `SchematicLinkStyleType` value
127
- */
128
- function dashed(config) {
129
- return variant("dashed", {
130
- tone: toneValue(config?.tone),
131
- weight: config?.weight !== undefined ? some(config.weight) : none,
132
- });
133
- }
134
- /**
135
- * Normalise {@link SchematicVertices} into an East-coercible array of
136
- * {@link SchematicVertexType} — plain arrays get `bulge` defaulted to `0`,
137
- * East expressions pass through unchanged (they must already be vertices).
138
- */
139
- function toVertices(vertices) {
140
- if (Array.isArray(vertices)) {
141
- return vertices.map(v => ({
142
- x: v.x,
143
- y: v.y,
144
- bulge: v.bulge !== undefined ? v.bulge : 0,
145
- }));
146
- }
147
- return vertices;
148
- }
149
- /**
150
- * Builds a `rect` geometry value — the axis-aligned box. For zones this is
151
- * the `x/y/width/height` bounding box; for items, the point / marker form.
152
- * Equivalent to omitting `geometry` / `footprint`.
153
- *
154
- * @returns A `SchematicGeometryType` value
155
- */
156
- function rect() {
157
- return East.value(variant("rect", null), SchematicGeometryType);
158
- }
159
- /**
160
- * Builds a `circle` geometry value — a circle centred on the entity anchor
161
- * (an item's `x/y`, or a zone's bounding-box centre). Models tanks, silos,
162
- * and round equipment without flattening to a polygon.
163
- *
164
- * @param radius - Circle radius in world units
165
- * @returns A `SchematicGeometryType` value
166
- */
167
- function circle(radius) {
168
- return East.value(variant("circle", { radius }), SchematicGeometryType);
169
- }
170
- /**
171
- * Builds a `polyline` geometry value — an open, arc-aware polyline in world
172
- * coordinates, optionally widened into a band (a road / aisle / walkway).
173
- *
174
- * @param vertices - Vertices in world coords, in order (each `{ x, y, bulge? }`; `bulge` defaults to `0`)
175
- * @param config - Optional `width` band in world units
176
- * @returns A `SchematicGeometryType` value
177
- */
178
- function polyline(vertices, config) {
179
- return East.value(variant("polyline", {
180
- vertices: toVertices(vertices),
181
- width: config?.width !== undefined ? some(config.width) : none,
182
- }), SchematicGeometryType);
183
- }
184
- /**
185
- * Builds a `polygon` geometry value — a closed, arc-aware polygon in world
186
- * coordinates (a rotated / L-shaped zone, or an equipment footprint).
187
- *
188
- * @param vertices - Boundary vertices in world coords, in order (auto-closed; each `{ x, y, bulge? }`)
189
- * @returns A `SchematicGeometryType` value
190
- */
191
- function polygon(vertices) {
192
- return East.value(variant("polygon", { vertices: toVertices(vertices) }), SchematicGeometryType);
193
- }
194
- /** Resolve a `sliceEmphasis` prop to its `option<Emphasis>` — a `"halo"` /
195
- * `"pulse"` string is sugar for `some(variant(...))`; an East value is already
196
- * the option (so it can be reactively `none` to turn the ring OFF). */
197
- function emphasisOption(emphasis) {
198
- if (emphasis === undefined)
199
- return none;
200
- return typeof emphasis === "string" ? some(variant(emphasis, null)) : emphasis;
201
- }
202
- /** Build the East `SchematicLayer` value from the plain JS declaration. */
203
- function toLayer(l) {
204
- return East.value({
205
- key: l.key,
206
- label: l.label,
207
- visible: l.visible !== undefined ? some(l.visible) : none,
208
- locked: l.locked !== undefined ? some(l.locked) : none,
209
- opacity: l.opacity !== undefined ? some(l.opacity) : none,
210
- tone: toneValue(l.tone),
211
- }, SchematicLayerType);
212
- }
213
- function buildRoot(items, config) {
214
- const itemMapper = config.item;
215
- const resolvedItems = itemMapper === undefined
216
- ? East.value(items, ArrayType(SchematicItemType))
217
- : mapRows(East.value(items), SchematicItemType, (row) => {
218
- const r = itemMapper(row);
219
- if (r instanceof Expr)
220
- return East.value(r, SchematicItemType);
221
- return East.value({
222
- key: r.key,
223
- x: r.x,
224
- y: r.y,
225
- label: r.label,
226
- sublabel: r.sublabel !== undefined ? some(r.sublabel) : none,
227
- icon: r.icon !== undefined ? some(r.icon) : none,
228
- status: r.status !== undefined ? r.status : none,
229
- meter: r.meter !== undefined
230
- ? some(East.value({ value: r.meter.value, max: r.meter.max }, StructType({ value: FloatType, max: FloatType })))
231
- : none,
232
- metric: r.metric !== undefined ? some(r.metric) : none,
233
- width: r.width !== undefined ? some(r.width) : none,
234
- footprint: r.footprint !== undefined ? some(r.footprint) : none,
235
- tone: toneOption(r.tone),
236
- color: r.color !== undefined ? some(r.color) : none,
237
- bg: r.bg !== undefined ? some(r.bg) : none,
238
- fillOpacity: r.fillOpacity !== undefined ? some(r.fillOpacity) : none,
239
- weight: r.weight !== undefined ? some(r.weight) : none,
240
- excluded: r.excluded !== undefined ? some(r.excluded) : none,
241
- layer: r.layer !== undefined ? some(r.layer) : none,
242
- }, SchematicItemType);
243
- });
244
- const zoneMapper = config.zone;
245
- const resolvedZones = config.zones === undefined
246
- ? East.value([], ArrayType(SchematicZoneType))
247
- : zoneMapper === undefined
248
- ? East.value(config.zones, ArrayType(SchematicZoneType))
249
- : mapRows(East.value(config.zones), SchematicZoneType, (row) => {
250
- const r = zoneMapper(row);
251
- if (r instanceof Expr)
252
- return East.value(r, SchematicZoneType);
253
- return East.value({
254
- key: r.key,
255
- label: r.label,
256
- x: r.x,
257
- y: r.y,
258
- width: r.width,
259
- height: r.height,
260
- pattern: r.pattern !== undefined
261
- ? r.pattern
262
- : East.value(outline(), SchematicZonePatternType),
263
- geometry: r.geometry !== undefined ? some(r.geometry) : none,
264
- tone: toneOption(r.tone),
265
- color: r.color !== undefined ? some(r.color) : none,
266
- bg: r.bg !== undefined ? some(r.bg) : none,
267
- fillOpacity: r.fillOpacity !== undefined ? some(r.fillOpacity) : none,
268
- weight: r.weight !== undefined ? some(r.weight) : none,
269
- layer: r.layer !== undefined ? some(r.layer) : none,
270
- }, SchematicZoneType);
271
- });
272
- const linkMapper = config.link;
273
- const resolvedLinks = config.links === undefined
274
- ? East.value([], ArrayType(SchematicLinkType))
275
- : linkMapper === undefined
276
- ? East.value(config.links, ArrayType(SchematicLinkType))
277
- : mapRows(East.value(config.links), SchematicLinkType, (row) => {
278
- const r = linkMapper(row);
279
- if (r instanceof Expr)
280
- return East.value(r, SchematicLinkType);
281
- return East.value({
282
- key: r.key,
283
- from: r.from,
284
- to: r.to,
285
- label: r.label !== undefined ? some(r.label) : none,
286
- metric: r.metric !== undefined ? some(r.metric) : none,
287
- style: r.style !== undefined
288
- ? r.style
289
- : East.value(solid(), SchematicLinkStyleType),
290
- route: r.route !== undefined
291
- ? r.route
292
- : East.value(variant("orthogonal", { corner: none }), SchematicRouteType),
293
- via: r.via !== undefined
294
- ? East.value(r.via, ArrayType(SchematicPointType))
295
- : East.value([], ArrayType(SchematicPointType)),
296
- layer: r.layer !== undefined ? some(r.layer) : none,
297
- }, SchematicLinkType);
298
- });
299
- const netMapper = config.net;
300
- const resolvedNets = config.nets === undefined
301
- ? East.value([], ArrayType(SchematicNetType))
302
- : netMapper === undefined
303
- ? East.value(config.nets, ArrayType(SchematicNetType))
304
- : mapRows(East.value(config.nets), SchematicNetType, (row) => {
305
- const r = netMapper(row);
306
- return East.value({
307
- key: r.key,
308
- sources: East.value(r.sources, ArrayType(StringType)),
309
- destinations: East.value(r.destinations, ArrayType(StringType)),
310
- label: r.label !== undefined ? some(r.label) : none,
311
- metric: r.metric !== undefined ? some(r.metric) : none,
312
- style: r.style !== undefined
313
- ? r.style
314
- : East.value(solid(), SchematicLinkStyleType),
315
- route: r.route !== undefined
316
- ? r.route
317
- : East.value(variant("orthogonal", { corner: none }), SchematicRouteType),
318
- via: r.via !== undefined
319
- ? East.value(r.via, ArrayType(SchematicPointType))
320
- : East.value([], ArrayType(SchematicPointType)),
321
- layer: r.layer !== undefined ? some(r.layer) : none,
322
- }, SchematicNetType);
323
- });
324
- if (config.affordances?.includes("brush")) {
325
- throw new Error("Schematic does not support the 'brush' affordance — its 2D canvas has no continuous 1D axis.");
326
- }
327
- const sliceChromeValue = config.slice !== undefined
328
- ? East.value({
329
- slice: localSliceHandle(config.slice),
330
- affordances: East.value((config.affordances ?? ["search"]).map(a => variant(a, null)), ArrayType(SliceAffordanceType)),
331
- }, SliceChromeType)
332
- : undefined;
333
- return East.value(variant("Schematic", {
334
- extent: { width: config.extent.width, height: config.extent.height },
335
- items: resolvedItems,
336
- zones: resolvedZones,
337
- links: resolvedLinks,
338
- nets: resolvedNets,
339
- scaleUnit: config.scaleUnit !== undefined ? some(config.scaleUnit) : none,
340
- grid: config.grid !== undefined ? some(config.grid) : none,
341
- navigator: config.navigator !== undefined ? some(config.navigator) : none,
342
- minimap: config.minimap !== undefined ? some(config.minimap) : none,
343
- slice: sliceChromeValue ? some(sliceChromeValue) : none,
344
- // Flat slice-effect props → the flat effect struct (each field static or
345
- // reactive via its `SubtypeExprOrValue`); `some` only when any is set.
346
- sliceEffect: (config.sliceHidden ?? config.sliceOpacity ?? config.sliceDesaturate
347
- ?? config.sliceDot ?? config.sliceEmphasis ?? config.sliceFrame ?? config.sliceFrameFit) !== undefined
348
- ? some(East.value({
349
- hidden: config.sliceHidden !== undefined ? some(config.sliceHidden) : none,
350
- opacity: config.sliceOpacity !== undefined ? some(config.sliceOpacity) : none,
351
- desaturate: config.sliceDesaturate !== undefined ? some(config.sliceDesaturate) : none,
352
- dot: config.sliceDot !== undefined ? some(config.sliceDot) : none,
353
- emphasis: emphasisOption(config.sliceEmphasis),
354
- frame: config.sliceFrame !== undefined ? some(config.sliceFrame) : none,
355
- frameFit: config.sliceFrameFit !== undefined ? some(config.sliceFrameFit) : none,
356
- }, SchematicSliceEffectType))
357
- : none,
358
- layers: config.layers !== undefined
359
- ? some(East.value(config.layers.map(toLayer), ArrayType(SchematicLayerType)))
360
- : none,
361
- height: config.height !== undefined ? some(config.height) : none,
362
- maxHeight: config.maxHeight !== undefined ? some(config.maxHeight) : none,
363
- onSelect: config.onSelect !== undefined ? some(config.onSelect) : none,
364
- selectionMode: config.selectionMode !== undefined
365
- ? some(typeof config.selectionMode === "string" ? variant(config.selectionMode, null) : config.selectionMode)
366
- : none,
367
- onSelectionChange: config.onSelectionChange !== undefined ? some(config.onSelectionChange) : none,
368
- sliceSelectField: config.sliceSelectField !== undefined ? some(config.sliceSelectField) : none,
369
- selectZoomFocus: config.selectZoomFocus !== undefined ? some(config.selectZoomFocus) : none,
370
- onViewportChange: config.onViewportChange !== undefined ? some(config.onViewportChange) : none,
371
- onItemOpen: config.onItemOpen !== undefined ? some(config.onItemOpen) : none,
372
- onSelectZone: config.onSelectZone !== undefined ? some(config.onSelectZone) : none,
373
- onZoneSelectionChange: config.onZoneSelectionChange !== undefined ? some(config.onZoneSelectionChange) : none,
374
- linkMode: config.linkMode !== undefined
375
- ? some(typeof config.linkMode === "string" ? variant(config.linkMode, null) : config.linkMode)
376
- : none,
377
- onCreateLink: config.onCreateLink !== undefined ? some(config.onCreateLink) : none,
378
- onSelectLink: config.onSelectLink !== undefined ? some(config.onSelectLink) : none,
379
- onEditLink: config.onEditLink !== undefined ? some(config.onEditLink) : none,
380
- onDeleteLink: config.onDeleteLink !== undefined ? some(config.onDeleteLink) : none,
381
- readOnly: config.readOnly !== undefined ? some(config.readOnly) : none,
382
- readOnlyLinks: config.readOnlyLinks !== undefined ? some(config.readOnlyLinks) : none,
383
- readOnlyItems: config.readOnlyItems !== undefined ? some(config.readOnlyItems) : none,
384
- onMoveItem: config.onMoveItem !== undefined ? some(config.onMoveItem) : none,
385
- itemHover: config.itemHover !== undefined ? some(East.value(config.itemHover, FunctionType([StringType], UIComponentType))) : none,
386
- zoneHover: config.zoneHover !== undefined ? some(East.value(config.zoneHover, FunctionType([StringType], UIComponentType))) : none,
387
- linkHover: config.linkHover !== undefined ? some(East.value(config.linkHover, FunctionType([StringType], UIComponentType))) : none,
388
- onEditNet: config.onEditNet !== undefined ? some(config.onEditNet) : none,
389
- canConnect: config.canConnect !== undefined ? some(config.canConnect) : none,
390
- }), UIComponentType);
391
- }
392
- /**
393
- * Creates a Schematic — a read-only 2D world-coordinate canvas.
394
- *
395
- * @typeParam I - The items-table input
396
- * @typeParam Z - The zones-table input
397
- * @typeParam L - The links-table input
398
- * @param items - The placed-item rows
399
- * @param config - The Schematic configuration ({@link SchematicConfig})
400
- * @returns An East expression of `UIComponentType`
401
- *
402
- * @example
403
- * ```ts
404
- * import { East, variant } from "@elaraai/east";
405
- * import { Schematic, UIComponentType } from "@elaraai/east-ui";
406
- *
407
- * const example = East.function([], UIComponentType, _$ =>
408
- * Schematic.Root(
409
- * [{ id: "UNIT-04", x: 3.0, y: 2.0, kind: "unit", fill: 28.8, cap: 40.0 }],
410
- * {
411
- * extent: { width: 30, height: 12 },
412
- * item: e => ({
413
- * key: e.id, x: e.x, y: e.y, label: e.id,
414
- * sublabel: e.kind,
415
- * meter: { value: e.fill, max: e.cap },
416
- * }),
417
- * },
418
- * ),
419
- * );
420
- * ```
421
- */
422
- function createSchematic(items, config) {
423
- return buildRoot(items, config);
424
- }
425
- // ============================================================================
426
- // Namespace export
427
- // ============================================================================
428
- /**
429
- * Schematic component namespace.
430
- *
431
- * @remarks
432
- * `Schematic.Root(items, config)` builds the canvas from up to three flat
433
- * tables (items, zones, links); closed-set fields in data (`status`,
434
- * `pattern`, `style`) are typed variant values (`Schematic.Types.*`).
435
- */
436
- export const Schematic = {
437
- /**
438
- * Creates a Schematic — a read-only 2D world-coordinate canvas.
439
- *
440
- * @typeParam I - The items-table input
441
- * @typeParam Z - The zones-table input
442
- * @typeParam L - The links-table input
443
- * @param items - The placed-item rows
444
- * @param config - The Schematic configuration ({@link SchematicConfig})
445
- * @returns An East expression of `UIComponentType`
446
- *
447
- * @remarks
448
- * Links address endpoints by item key, so they survive repositioning;
449
- * `via` waypoints route around zones. A walkway band is a zone with
450
- * `pattern: variant("hatch", null)`.
451
- *
452
- * @example
453
- * ```ts
454
- * import { East } from "@elaraai/east";
455
- * import { Schematic, UIComponentType } from "@elaraai/east-ui";
456
- *
457
- * const example = East.function([], UIComponentType, _$ =>
458
- * Schematic.Root(
459
- * [{ id: "UNIT-04", x: 3.0, y: 2.0 }],
460
- * {
461
- * extent: { width: 30, height: 12 },
462
- * item: e => ({ key: e.id, x: e.x, y: e.y, label: e.id }),
463
- * },
464
- * ),
465
- * );
466
- * ```
467
- */
468
- Root: createSchematic,
469
- /**
470
- * Builds an `outline` zone pattern value — the dashed boundary with an
471
- * eyebrow label.
472
- *
473
- * @param config - Optional style configuration (`tone`)
474
- * @returns A `SchematicZonePatternType` value
475
- *
476
- * @example
477
- * ```ts
478
- * Schematic.outline({ tone: "ink" })
479
- * ```
480
- */
481
- outline,
482
- /**
483
- * Builds a `hatch` zone pattern value — the hatched band.
484
- *
485
- * @param config - Optional style configuration (`tone`, `spacing`, `angle`)
486
- * @returns A `SchematicZonePatternType` value
487
- *
488
- * @example
489
- * ```ts
490
- * Schematic.hatch({ spacing: 10, angle: 45 })
491
- * ```
492
- */
493
- hatch,
494
- /**
495
- * Builds a `solid` link style value — a physical run.
496
- *
497
- * @param config - Optional stroke configuration (`tone`, `weight`)
498
- * @returns A `SchematicLinkStyleType` value
499
- *
500
- * @example
501
- * ```ts
502
- * Schematic.solid({ tone: "brand", weight: 3 })
503
- * ```
504
- */
505
- solid,
506
- /**
507
- * Builds a `dashed` link style value — a routing / logical connection.
508
- *
509
- * @param config - Optional stroke configuration (`tone`, `weight`)
510
- * @returns A `SchematicLinkStyleType` value
511
- *
512
- * @example
513
- * ```ts
514
- * Schematic.dashed({ tone: "muted" })
515
- * ```
516
- */
517
- dashed,
518
- /**
519
- * Builds a `rect` geometry value — the axis-aligned box (a zone's
520
- * `x/y/width/height`, or an item's point / marker form). Equals omitting
521
- * `geometry` / `footprint`.
522
- *
523
- * @returns A `SchematicGeometryType` value
524
- *
525
- * @example
526
- * ```ts
527
- * Schematic.rect()
528
- * ```
529
- */
530
- rect,
531
- /**
532
- * Builds a `circle` geometry value — a circle centred on the entity
533
- * anchor (an item's `x/y`, or a zone's bbox centre). Models tanks, silos,
534
- * and round equipment.
535
- *
536
- * @param radius - Circle radius in world units
537
- * @returns A `SchematicGeometryType` value
538
- *
539
- * @example
540
- * ```ts
541
- * Schematic.circle(2.5)
542
- * ```
543
- */
544
- circle,
545
- /**
546
- * Builds a `polyline` geometry value — an open, arc-aware polyline in
547
- * world coordinates, optionally widened into a band (a road / aisle).
548
- * Each vertex's `bulge` curves the edge to the next vertex (0 = straight).
549
- *
550
- * @param vertices - Vertices in world coords, in order (`{ x, y, bulge? }`)
551
- * @param config - Optional `width` band in world units
552
- * @returns A `SchematicGeometryType` value
553
- *
554
- * @example
555
- * ```ts
556
- * Schematic.polyline([{ x: 0, y: 4 }, { x: 12, y: 4, bulge: 0.42 }, { x: 12, y: 9 }], { width: 1.6 })
557
- * ```
558
- */
559
- polyline,
560
- /**
561
- * Builds a `polygon` geometry value — a closed, arc-aware polygon in
562
- * world coordinates (a rotated / L-shaped zone, or an equipment
563
- * footprint). The last vertex's `bulge` curves the closing edge.
564
- *
565
- * @param vertices - Boundary vertices in world coords, in order (auto-closed; `{ x, y, bulge? }`)
566
- * @returns A `SchematicGeometryType` value
567
- *
568
- * @example
569
- * ```ts
570
- * Schematic.polygon([{ x: 2, y: 2 }, { x: 7, y: 3 }, { x: 6, y: 8 }, { x: 1, y: 6 }])
571
- * ```
572
- */
573
- polygon,
574
- Types: {
575
- /**
576
- * East StructType for the Schematic component.
577
- *
578
- * @remarks
579
- * See {@link SchematicRootType} for per-field docs.
580
- *
581
- * @property extent - World-coordinate bounds
582
- * @property items - The placed items
583
- * @property zones - Annotation zones
584
- * @property links - Connections between items
585
- * @property scaleUnit - Optional scale-bar unit
586
- * @property onSelect - Optional item-click callback
587
- */
588
- Schematic: SchematicRootType,
589
- /**
590
- * A resolved placed item.
591
- *
592
- * @property key - Item identity
593
- * @property x - World x of the card centre
594
- * @property y - World y of the card centre
595
- * @property label - Primary identity line
596
- * @property sublabel - Optional muted second line
597
- * @property icon - Optional Font Awesome solid icon name
598
- * @property status - Optional status dot tone
599
- * @property meter - Optional mini utilisation bar
600
- * @property metric - Optional live metric text
601
- * @property width - Optional world width (wide bar form)
602
- * @property footprint - Optional shape footprint (point + icon when absent)
603
- */
604
- Item: SchematicItemType,
605
- /**
606
- * A resolved annotation zone.
607
- *
608
- * @property key - Zone identity
609
- * @property label - Eyebrow label
610
- * @property x - World x (top-left)
611
- * @property y - World y (top-left)
612
- * @property width - World width
613
- * @property height - World height
614
- * @property pattern - Render pattern
615
- * @property geometry - Optional shape geometry (rect when absent)
616
- */
617
- Zone: SchematicZoneType,
618
- /**
619
- * A resolved link between items.
620
- *
621
- * @property key - Link identity
622
- * @property from - Source item key
623
- * @property to - Destination item key
624
- * @property style - Render style
625
- * @property via - Waypoints, in order
626
- */
627
- Link: SchematicLinkType,
628
- /**
629
- * Zone render pattern (`outline` / `hatch`).
630
- *
631
- * @property outline - Dashed boundary with an eyebrow label
632
- * @property hatch - Hatched band
633
- */
634
- ZonePattern: SchematicZonePatternType,
635
- /**
636
- * Link render style (`solid` / `dashed`), each carrying stroke config.
637
- *
638
- * @property solid - A physical run
639
- * @property dashed - A routing / logical connection
640
- */
641
- LinkStyle: SchematicLinkStyleType,
642
- /**
643
- * Link routing mode (`orthogonal` / `direct`).
644
- *
645
- * @property orthogonal - Axis-aligned with rounded corners
646
- * @property direct - Straight segments between anchors
647
- */
648
- Route: SchematicRouteType,
649
- /**
650
- * Theme tone for zone strokes, hatching, and links.
651
- *
652
- * @property brand - Brand teal
653
- * @property ink - Foreground ink
654
- * @property muted - Muted foreground
655
- * @property success - Status ok
656
- * @property warning - Status warn
657
- * @property danger - Status bad
658
- */
659
- Tone: SchematicToneType,
660
- /**
661
- * Shared shape geometry for zones (`geometry`) and item footprints
662
- * (`footprint`).
663
- *
664
- * @property rect - Axis-aligned box
665
- * @property circle - Circle centred on the entity anchor (`radius` in world units)
666
- * @property polyline - Open, arc-aware polyline; optional world-space band width
667
- * @property polygon - Closed, arc-aware polygon (>= 3 vertices)
668
- */
669
- Geometry: SchematicGeometryType,
670
- /**
671
- * A polyline / polygon vertex — a world point plus DXF `bulge`.
672
- *
673
- * @property x - World x
674
- * @property y - World y
675
- * @property bulge - DXF bulge for the edge to the next vertex (0 = straight)
676
- */
677
- Vertex: SchematicVertexType,
678
- /**
679
- * A named layer — a toggleable group of items / zones / links.
680
- *
681
- * @property key - Layer identity (entities reference it via `layer`)
682
- * @property label - Panel display name
683
- * @property visible - Author default visibility
684
- * @property locked - Author default lock (non-selectable)
685
- * @property opacity - Item dim (0–1)
686
- * @property tone - Panel swatch tone
687
- */
688
- Layer: SchematicLayerType,
689
- /**
690
- * The flat slice-driven render effect struct (mirrors the `slice*` props).
691
- */
692
- SliceEffect: SchematicSliceEffectType,
693
- /**
694
- * Matched-item emphasis (`halo` / `pulse`) — annotate `State` with it to
695
- * drive `sliceEmphasis` reactively.
696
- */
697
- Emphasis: SchematicEmphasisType,
698
- /**
699
- * Selection cardinality (`single` / `multiple` / `range`) — drive
700
- * `selectionMode` reactively or read it back.
701
- */
702
- SelectionMode: SchematicSelectionModeType,
703
- /**
704
- * A world-coordinate rectangle swept by a marquee gesture.
705
- *
706
- * @property minX - Left edge (world units)
707
- * @property minY - Top edge (world units)
708
- * @property maxX - Right edge (world units)
709
- * @property maxY - Bottom edge (world units)
710
- */
711
- Region: SchematicRegionType,
712
- /**
713
- * Selection-set change event passed to `onSelectionChange`.
714
- *
715
- * @property key - The item that triggered the change (some for a tap; none for marquee / clear)
716
- * @property selected - Whether `key` is now selected; for bulk changes, whether the set is non-empty
717
- * @property selectedKeys - The full selected set after the gesture
718
- * @property additive - Whether the gesture added to the prior selection vs replaced it
719
- * @property region - The world rectangle a marquee swept (some for a marquee; none otherwise)
720
- */
721
- SelectionEvent: SchematicSelectionEventType,
722
- /**
723
- * Viewport-settled event passed to `onViewportChange` — the camera zoom
724
- * plus the visible world rectangle, debounced to gesture settle points.
725
- *
726
- * @property zoom - The settled camera zoom (1 = fully zoomed out)
727
- * @property minX - Left edge of the visible world rect
728
- * @property minY - Top edge of the visible world rect
729
- * @property maxX - Right edge of the visible world rect
730
- * @property maxY - Bottom edge of the visible world rect
731
- */
732
- ViewportEvent: SchematicViewportEventType,
733
- /**
734
- * Zone selection-set change event passed to `onZoneSelectionChange` —
735
- * the selected zones plus the item keys inside them.
736
- *
737
- * @property key - The zone that triggered the change (some for a tap; none for a clear)
738
- * @property selected - Whether `key` is now selected; for bulk changes, whether the set is non-empty
739
- * @property selectedKeys - The full selected zone set after the gesture
740
- * @property childItemKeys - Item keys inside the selected zones (nested descendants included)
741
- * @property additive - Whether the gesture added to the prior selection vs replaced it
742
- */
743
- ZoneSelectionEvent: SchematicZoneSelectionEventType,
744
- /**
745
- * Connect-gesture mode (`draw` | `connect`) — `draw` adds a physical
746
- * link locally; `connect` is event-only and repeatable.
747
- */
748
- LinkMode: SchematicLinkModeType,
749
- /**
750
- * One connection's endpoints — the unit a connect gesture produces.
751
- *
752
- * @property key - Renderer-generated key for the gesture's connection
753
- * @property from - Source item key
754
- * @property to - Destination item key
755
- */
756
- LinkEndpoints: SchematicLinkEndpointsType,
757
- /**
758
- * Link-creation event passed to `onCreateLink` — the newest link, the
759
- * accumulated Shift-session, and the pair's existing links.
760
- *
761
- * @property link - The newest connection (this drag)
762
- * @property links - The full session set, `link` included
763
- * @property additive - True when Shift extended an open session
764
- * @property existing - Keys of links already joining the newest pair
765
- */
766
- LinkCreateEvent: SchematicLinkCreateEventType,
767
- /**
768
- * Link-edit event passed to `onEditLink` — the endpoints AFTER an
769
- * endpoint connector re-target.
770
- *
771
- * @property key - The edited link's key
772
- * @property from - Source item key after the edit
773
- * @property to - Destination item key after the edit
774
- */
775
- LinkEditEvent: SchematicLinkEditEventType,
776
- /**
777
- * A net — a manifold / bus link (many `sources` → many `destinations`,
778
- * drawn as a trunk with branches).
779
- *
780
- * @property key - Net identity
781
- * @property sources - Source item keys
782
- * @property destinations - Destination item keys
783
- * @property label - Optional mid-trunk label
784
- * @property metric - Optional mid-trunk metric (muted)
785
- * @property style - Stroke style for the whole net
786
- * @property route - Trunk routing mode
787
- * @property via - Optional trunk waypoints
788
- * @property layer - Optional layer membership
789
- */
790
- Net: SchematicNetType,
791
- /**
792
- * A connect-session collapsed to net endpoints (stable session `key`)
793
- * — carried on every `onCreateLink` for upsert-style handlers.
794
- *
795
- * @property key - The session key (stable across the session's commits)
796
- * @property sources - Distinct source item keys so far
797
- * @property destinations - Distinct destination item keys so far
798
- */
799
- NetEndpoints: SchematicNetEndpointsType,
800
- /**
801
- * Item-move event passed to `onMoveItem` — the pressed item's final
802
- * position, every moved key (group move rides the selection), and the
803
- * shared world delta.
804
- *
805
- * @property key - The pressed item's key
806
- * @property x - Final world x
807
- * @property y - Final world y
808
- * @property keys - Every moved item (`key` included)
809
- * @property dx - Shared world x delta
810
- * @property dy - Shared world y delta
811
- */
812
- ItemMoveEvent: SchematicItemMoveEventType,
813
- },
814
- };
815
- //# sourceMappingURL=index.js.map