@almadar/ui 5.125.0 → 5.127.0
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/avl/index.cjs +84 -47
- package/dist/avl/index.d.cts +1859 -0
- package/dist/avl/index.d.ts +1859 -0
- package/dist/avl/index.js +85 -48
- package/dist/components/index.cjs +86 -48
- package/dist/components/index.d.cts +27 -1
- package/dist/components/index.d.ts +27 -1
- package/dist/components/index.js +86 -48
- package/dist/context/index.cjs +3 -2
- package/dist/context/index.js +3 -2
- package/dist/hooks/index.cjs +3 -2
- package/dist/hooks/index.js +3 -2
- package/dist/marketing/index.d.cts +1086 -0
- package/dist/marketing/index.d.ts +1086 -0
- package/dist/providers/index.cjs +83 -46
- package/dist/providers/index.js +83 -46
- package/dist/runtime/index.cjs +84 -47
- package/dist/runtime/index.js +85 -48
- package/package.json +6 -6
|
@@ -0,0 +1,1859 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { JsonObject, JsonValue, OrbitalSchema, Expression, UISlot, EntityData, EditFocus, EventPayload, ThemeDefinition } from '@almadar/core';
|
|
4
|
+
import { Node, Edge, NodeProps, EdgeProps } from '@xyflow/react';
|
|
5
|
+
import { AnyPatternConfig } from '@almadar/core/patterns';
|
|
6
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Almadar Visual Language (AVL) shared types.
|
|
10
|
+
*
|
|
11
|
+
* Every AVL atom renders a `<g>` element (not `<svg>`) and accepts
|
|
12
|
+
* AvlBaseProps for positioning and styling within a parent SVG.
|
|
13
|
+
*/
|
|
14
|
+
interface AvlBaseProps {
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
color?: string;
|
|
18
|
+
opacity?: number;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
type AvlEffectType = 'render-ui' | 'set' | 'persist' | 'fetch' | 'emit' | 'navigate' | 'notify' | 'call-service' | 'spawn' | 'despawn' | 'do' | 'if' | 'log';
|
|
22
|
+
type AvlFieldTypeKind = 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'object' | 'array';
|
|
23
|
+
type AvlPersistenceKind = 'persistent' | 'runtime' | 'singleton' | 'instance';
|
|
24
|
+
type AvlOperatorNamespace = 'arithmetic' | 'comparison' | 'logic' | 'string' | 'collection' | 'time' | 'control' | 'async';
|
|
25
|
+
declare const AVL_OPERATOR_COLORS: Record<AvlOperatorNamespace, string>;
|
|
26
|
+
declare const AVL_FIELD_TYPE_SHAPES: Record<AvlFieldTypeKind, string>;
|
|
27
|
+
type StateRole = 'initial' | 'terminal' | 'hub' | 'error' | 'default';
|
|
28
|
+
declare const STATE_COLORS: Record<StateRole, {
|
|
29
|
+
fill: string;
|
|
30
|
+
border: string;
|
|
31
|
+
}>;
|
|
32
|
+
type EffectCategory = 'ui' | 'data' | 'communication' | 'lifecycle' | 'control';
|
|
33
|
+
declare const EFFECT_CATEGORY_COLORS: Record<EffectCategory, {
|
|
34
|
+
color: string;
|
|
35
|
+
bg: string;
|
|
36
|
+
}>;
|
|
37
|
+
declare const EFFECT_TYPE_TO_CATEGORY: Record<AvlEffectType, EffectCategory>;
|
|
38
|
+
declare const CONNECTION_COLORS: {
|
|
39
|
+
readonly forward: {
|
|
40
|
+
readonly color: "#1E293B";
|
|
41
|
+
readonly width: 2;
|
|
42
|
+
readonly dash: "none";
|
|
43
|
+
};
|
|
44
|
+
readonly backward: {
|
|
45
|
+
readonly color: "#94A3B8";
|
|
46
|
+
readonly width: 1.5;
|
|
47
|
+
readonly dash: "6 3";
|
|
48
|
+
};
|
|
49
|
+
readonly selfLoop: {
|
|
50
|
+
readonly color: "#CBD5E1";
|
|
51
|
+
readonly width: 1;
|
|
52
|
+
readonly dash: "3 2";
|
|
53
|
+
};
|
|
54
|
+
readonly emitListen: {
|
|
55
|
+
readonly color: "#F97316";
|
|
56
|
+
readonly width: 1.5;
|
|
57
|
+
readonly dash: "4 3";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
declare function getStateRole(name: string, isInitial?: boolean, isTerminal?: boolean, transitionCount?: number, maxTransitionCount?: number): StateRole;
|
|
61
|
+
|
|
62
|
+
interface AvlOrbitalProps {
|
|
63
|
+
cx?: number;
|
|
64
|
+
cy?: number;
|
|
65
|
+
r?: number;
|
|
66
|
+
label?: string;
|
|
67
|
+
color?: string;
|
|
68
|
+
opacity?: number;
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
declare const AvlOrbital: React__default.FC<AvlOrbitalProps>;
|
|
72
|
+
|
|
73
|
+
interface AvlEntityProps extends AvlBaseProps {
|
|
74
|
+
r?: number;
|
|
75
|
+
fieldCount?: number;
|
|
76
|
+
persistence?: AvlPersistenceKind;
|
|
77
|
+
label?: string;
|
|
78
|
+
}
|
|
79
|
+
declare const AvlEntity: React__default.FC<AvlEntityProps>;
|
|
80
|
+
|
|
81
|
+
interface AvlTraitProps {
|
|
82
|
+
cx?: number;
|
|
83
|
+
cy?: number;
|
|
84
|
+
rx?: number;
|
|
85
|
+
ry?: number;
|
|
86
|
+
rotation?: number;
|
|
87
|
+
label?: string;
|
|
88
|
+
color?: string;
|
|
89
|
+
opacity?: number;
|
|
90
|
+
className?: string;
|
|
91
|
+
}
|
|
92
|
+
declare const AvlTrait: React__default.FC<AvlTraitProps>;
|
|
93
|
+
|
|
94
|
+
interface AvlPageProps extends AvlBaseProps {
|
|
95
|
+
size?: number;
|
|
96
|
+
label?: string;
|
|
97
|
+
}
|
|
98
|
+
declare const AvlPage: React__default.FC<AvlPageProps>;
|
|
99
|
+
|
|
100
|
+
interface AvlApplicationProps extends AvlBaseProps {
|
|
101
|
+
width?: number;
|
|
102
|
+
height?: number;
|
|
103
|
+
label?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const AvlApplication: React__default.FC<AvlApplicationProps>;
|
|
106
|
+
|
|
107
|
+
interface AvlStateProps extends AvlBaseProps {
|
|
108
|
+
name?: string;
|
|
109
|
+
isInitial?: boolean;
|
|
110
|
+
isTerminal?: boolean;
|
|
111
|
+
width?: number;
|
|
112
|
+
height?: number;
|
|
113
|
+
/** V2: Role-based fill color. When set, overrides monochrome rendering. */
|
|
114
|
+
role?: StateRole;
|
|
115
|
+
/** V2: Number of transitions touching this state. Drives proportional width. */
|
|
116
|
+
transitionCount?: number;
|
|
117
|
+
}
|
|
118
|
+
declare const AvlState: React__default.FC<AvlStateProps>;
|
|
119
|
+
|
|
120
|
+
interface AvlTransitionProps {
|
|
121
|
+
x1: number;
|
|
122
|
+
y1: number;
|
|
123
|
+
x2: number;
|
|
124
|
+
y2: number;
|
|
125
|
+
curved?: boolean;
|
|
126
|
+
/** Center point to curve away from (curves outward if provided). */
|
|
127
|
+
curveAwayFrom?: {
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
};
|
|
131
|
+
label?: string;
|
|
132
|
+
color?: string;
|
|
133
|
+
opacity?: number;
|
|
134
|
+
className?: string;
|
|
135
|
+
}
|
|
136
|
+
declare const AvlTransition: React__default.FC<AvlTransitionProps>;
|
|
137
|
+
|
|
138
|
+
interface AvlEventProps extends AvlBaseProps {
|
|
139
|
+
size?: number;
|
|
140
|
+
label?: string;
|
|
141
|
+
}
|
|
142
|
+
declare const AvlEvent: React__default.FC<AvlEventProps>;
|
|
143
|
+
|
|
144
|
+
interface AvlGuardProps extends AvlBaseProps {
|
|
145
|
+
size?: number;
|
|
146
|
+
label?: string;
|
|
147
|
+
}
|
|
148
|
+
declare const AvlGuard: React__default.FC<AvlGuardProps>;
|
|
149
|
+
|
|
150
|
+
interface AvlEffectProps extends AvlBaseProps {
|
|
151
|
+
effectType: AvlEffectType;
|
|
152
|
+
size?: number;
|
|
153
|
+
label?: string;
|
|
154
|
+
/** V2: Render a category-colored background circle behind the icon. */
|
|
155
|
+
showBackground?: boolean;
|
|
156
|
+
}
|
|
157
|
+
declare const AvlEffect: React__default.FC<AvlEffectProps>;
|
|
158
|
+
|
|
159
|
+
interface AvlFieldProps extends AvlBaseProps {
|
|
160
|
+
/** Angle in radians from entity center. */
|
|
161
|
+
angle?: number;
|
|
162
|
+
length?: number;
|
|
163
|
+
required?: boolean;
|
|
164
|
+
label?: string;
|
|
165
|
+
}
|
|
166
|
+
declare const AvlField: React__default.FC<AvlFieldProps>;
|
|
167
|
+
|
|
168
|
+
interface AvlFieldTypeProps extends AvlBaseProps {
|
|
169
|
+
kind: AvlFieldTypeKind;
|
|
170
|
+
size?: number;
|
|
171
|
+
label?: string;
|
|
172
|
+
}
|
|
173
|
+
declare const AvlFieldType: React__default.FC<AvlFieldTypeProps>;
|
|
174
|
+
|
|
175
|
+
interface AvlBindingProps {
|
|
176
|
+
x1: number;
|
|
177
|
+
y1: number;
|
|
178
|
+
x2: number;
|
|
179
|
+
y2: number;
|
|
180
|
+
label?: string;
|
|
181
|
+
color?: string;
|
|
182
|
+
opacity?: number;
|
|
183
|
+
className?: string;
|
|
184
|
+
}
|
|
185
|
+
declare const AvlBinding: React__default.FC<AvlBindingProps>;
|
|
186
|
+
|
|
187
|
+
interface AvlPersistenceProps extends AvlBaseProps {
|
|
188
|
+
kind: AvlPersistenceKind;
|
|
189
|
+
size?: number;
|
|
190
|
+
label?: string;
|
|
191
|
+
}
|
|
192
|
+
declare const AvlPersistence: React__default.FC<AvlPersistenceProps>;
|
|
193
|
+
|
|
194
|
+
interface AvlOperatorProps extends AvlBaseProps {
|
|
195
|
+
name: string;
|
|
196
|
+
namespace?: AvlOperatorNamespace;
|
|
197
|
+
size?: number;
|
|
198
|
+
}
|
|
199
|
+
declare const AvlOperator: React__default.FC<AvlOperatorProps>;
|
|
200
|
+
|
|
201
|
+
interface AvlSExprProps extends AvlBaseProps {
|
|
202
|
+
width?: number;
|
|
203
|
+
height?: number;
|
|
204
|
+
label?: string;
|
|
205
|
+
}
|
|
206
|
+
declare const AvlSExpr: React__default.FC<AvlSExprProps>;
|
|
207
|
+
|
|
208
|
+
interface AvlLiteralProps extends AvlBaseProps {
|
|
209
|
+
value: string;
|
|
210
|
+
size?: number;
|
|
211
|
+
}
|
|
212
|
+
declare const AvlLiteral: React__default.FC<AvlLiteralProps>;
|
|
213
|
+
|
|
214
|
+
interface AvlBindingRefProps extends AvlBaseProps {
|
|
215
|
+
path: string;
|
|
216
|
+
size?: number;
|
|
217
|
+
}
|
|
218
|
+
declare const AvlBindingRef: React__default.FC<AvlBindingRefProps>;
|
|
219
|
+
|
|
220
|
+
interface AvlStateMachineState {
|
|
221
|
+
name: string;
|
|
222
|
+
isInitial?: boolean;
|
|
223
|
+
isTerminal?: boolean;
|
|
224
|
+
}
|
|
225
|
+
interface AvlStateMachineTransition {
|
|
226
|
+
from: string;
|
|
227
|
+
to: string;
|
|
228
|
+
event?: string;
|
|
229
|
+
guard?: string;
|
|
230
|
+
effects?: AvlEffectType[];
|
|
231
|
+
}
|
|
232
|
+
interface AvlStateMachineProps {
|
|
233
|
+
states: AvlStateMachineState[];
|
|
234
|
+
transitions: AvlStateMachineTransition[];
|
|
235
|
+
className?: string;
|
|
236
|
+
color?: string;
|
|
237
|
+
animated?: boolean;
|
|
238
|
+
}
|
|
239
|
+
declare const AvlStateMachine: React__default.FC<AvlStateMachineProps>;
|
|
240
|
+
|
|
241
|
+
interface AvlOrbitalUnitTrait {
|
|
242
|
+
name: string;
|
|
243
|
+
color?: string;
|
|
244
|
+
}
|
|
245
|
+
interface AvlOrbitalUnitPage {
|
|
246
|
+
name: string;
|
|
247
|
+
}
|
|
248
|
+
interface AvlOrbitalUnitProps {
|
|
249
|
+
entityName: string;
|
|
250
|
+
fields?: number;
|
|
251
|
+
persistence?: AvlPersistenceKind;
|
|
252
|
+
traits: AvlOrbitalUnitTrait[];
|
|
253
|
+
pages: AvlOrbitalUnitPage[];
|
|
254
|
+
className?: string;
|
|
255
|
+
color?: string;
|
|
256
|
+
animated?: boolean;
|
|
257
|
+
}
|
|
258
|
+
declare const AvlOrbitalUnit: React__default.FC<AvlOrbitalUnitProps>;
|
|
259
|
+
|
|
260
|
+
interface AvlClosedCircuitState {
|
|
261
|
+
name: string;
|
|
262
|
+
}
|
|
263
|
+
interface AvlClosedCircuitTransition {
|
|
264
|
+
from: string;
|
|
265
|
+
to: string;
|
|
266
|
+
event?: string;
|
|
267
|
+
guard?: string;
|
|
268
|
+
effects?: AvlEffectType[];
|
|
269
|
+
}
|
|
270
|
+
interface AvlClosedCircuitProps {
|
|
271
|
+
states: AvlClosedCircuitState[];
|
|
272
|
+
transitions: AvlClosedCircuitTransition[];
|
|
273
|
+
className?: string;
|
|
274
|
+
color?: string;
|
|
275
|
+
animated?: boolean;
|
|
276
|
+
}
|
|
277
|
+
declare const AvlClosedCircuit: React__default.FC<AvlClosedCircuitProps>;
|
|
278
|
+
|
|
279
|
+
interface AvlEmitListenProps {
|
|
280
|
+
emitter: {
|
|
281
|
+
name: string;
|
|
282
|
+
fields?: number;
|
|
283
|
+
};
|
|
284
|
+
listener: {
|
|
285
|
+
name: string;
|
|
286
|
+
fields?: number;
|
|
287
|
+
};
|
|
288
|
+
eventName?: string;
|
|
289
|
+
className?: string;
|
|
290
|
+
color?: string;
|
|
291
|
+
animated?: boolean;
|
|
292
|
+
}
|
|
293
|
+
declare const AvlEmitListen: React__default.FC<AvlEmitListenProps>;
|
|
294
|
+
|
|
295
|
+
interface AvlSlotMapSlot {
|
|
296
|
+
name: string;
|
|
297
|
+
/** Manual position overrides. Omit for auto-layout. */
|
|
298
|
+
x?: number;
|
|
299
|
+
y?: number;
|
|
300
|
+
width?: number;
|
|
301
|
+
height?: number;
|
|
302
|
+
}
|
|
303
|
+
interface AvlSlotMapProps {
|
|
304
|
+
slots: AvlSlotMapSlot[];
|
|
305
|
+
pageWidth?: number;
|
|
306
|
+
pageHeight?: number;
|
|
307
|
+
className?: string;
|
|
308
|
+
color?: string;
|
|
309
|
+
animated?: boolean;
|
|
310
|
+
}
|
|
311
|
+
declare const AvlSlotMap: React__default.FC<AvlSlotMapProps>;
|
|
312
|
+
|
|
313
|
+
interface AvlExprTreeNode {
|
|
314
|
+
label: string;
|
|
315
|
+
type: 'operator' | 'literal' | 'binding';
|
|
316
|
+
children?: AvlExprTreeNode[];
|
|
317
|
+
}
|
|
318
|
+
interface AvlExprTreeProps {
|
|
319
|
+
expression: AvlExprTreeNode;
|
|
320
|
+
className?: string;
|
|
321
|
+
color?: string;
|
|
322
|
+
animated?: boolean;
|
|
323
|
+
}
|
|
324
|
+
declare const AvlExprTree: React__default.FC<AvlExprTreeProps>;
|
|
325
|
+
|
|
326
|
+
interface AvlTransitionLaneEffect {
|
|
327
|
+
type: AvlEffectType | string;
|
|
328
|
+
}
|
|
329
|
+
interface AvlTransitionLaneProps {
|
|
330
|
+
event: string;
|
|
331
|
+
guard?: string;
|
|
332
|
+
effects: AvlTransitionLaneEffect[];
|
|
333
|
+
width: number;
|
|
334
|
+
x?: number;
|
|
335
|
+
y?: number;
|
|
336
|
+
isBackward?: boolean;
|
|
337
|
+
isSelfLoop?: boolean;
|
|
338
|
+
color?: string;
|
|
339
|
+
onTransitionClick?: () => void;
|
|
340
|
+
}
|
|
341
|
+
declare const AvlTransitionLane: React__default.FC<AvlTransitionLaneProps>;
|
|
342
|
+
|
|
343
|
+
interface AvlSwimLaneProps {
|
|
344
|
+
listenedEvents: string[];
|
|
345
|
+
emittedEvents: string[];
|
|
346
|
+
centerWidth: number;
|
|
347
|
+
height: number;
|
|
348
|
+
color?: string;
|
|
349
|
+
children: React__default.ReactNode;
|
|
350
|
+
}
|
|
351
|
+
declare const AvlSwimLane: React__default.FC<AvlSwimLaneProps>;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* AvlBehaviorGlyph - Visual identity for a behavior.
|
|
355
|
+
*
|
|
356
|
+
* Generates a unique glyph from behavior properties:
|
|
357
|
+
* - Core shape = persistence type
|
|
358
|
+
* - Spokes = field count
|
|
359
|
+
* - Rings = state count
|
|
360
|
+
* - Markers = effect types used
|
|
361
|
+
* - Color = domain hue
|
|
362
|
+
* - Composition = child glyphs + event wiring (molecule/organism)
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
declare const DOMAIN_COLORS: Record<string, string>;
|
|
366
|
+
type BehaviorLevel = 'atom' | 'molecule' | 'organism';
|
|
367
|
+
type GlyphSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
368
|
+
interface BehaviorGlyphChild {
|
|
369
|
+
name: string;
|
|
370
|
+
fieldCount?: number;
|
|
371
|
+
stateCount?: number;
|
|
372
|
+
persistence?: AvlPersistenceKind;
|
|
373
|
+
effectTypes?: AvlEffectType[];
|
|
374
|
+
}
|
|
375
|
+
interface BehaviorGlyphConnection {
|
|
376
|
+
from: string;
|
|
377
|
+
to: string;
|
|
378
|
+
event: string;
|
|
379
|
+
}
|
|
380
|
+
interface AvlBehaviorGlyphProps {
|
|
381
|
+
/** Behavior name */
|
|
382
|
+
name: string;
|
|
383
|
+
/** Composition level */
|
|
384
|
+
level?: BehaviorLevel;
|
|
385
|
+
/** Domain for color coding */
|
|
386
|
+
domain?: string;
|
|
387
|
+
/** Override color (otherwise derived from domain) */
|
|
388
|
+
color?: string;
|
|
389
|
+
/** Entity field count (drives spoke count) */
|
|
390
|
+
fieldCount?: number;
|
|
391
|
+
/** State count (drives ring count) */
|
|
392
|
+
stateCount?: number;
|
|
393
|
+
/** Persistence type (drives core shape) */
|
|
394
|
+
persistence?: AvlPersistenceKind;
|
|
395
|
+
/** Effect types used (drives markers on rings) */
|
|
396
|
+
effectTypes?: AvlEffectType[];
|
|
397
|
+
/** Child behaviors for molecule/organism composition */
|
|
398
|
+
children?: BehaviorGlyphChild[];
|
|
399
|
+
/** Event connections between children (organism level) */
|
|
400
|
+
connections?: BehaviorGlyphConnection[];
|
|
401
|
+
/** Size preset */
|
|
402
|
+
size?: GlyphSize;
|
|
403
|
+
/** Show text labels */
|
|
404
|
+
showLabels?: boolean;
|
|
405
|
+
/** Animate orbital rings */
|
|
406
|
+
animated?: boolean;
|
|
407
|
+
/** Additional className */
|
|
408
|
+
className?: string;
|
|
409
|
+
/** Click handler */
|
|
410
|
+
onClick?: () => void;
|
|
411
|
+
}
|
|
412
|
+
declare const AvlBehaviorGlyph: React__default.FC<AvlBehaviorGlyphProps>;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* AVL layout utilities for positioning atoms in composed diagrams.
|
|
416
|
+
*/
|
|
417
|
+
/** Distribute N points evenly around a ring.
|
|
418
|
+
* Handles edge cases: 1 state (centered), 2 states (horizontal). */
|
|
419
|
+
declare function ringPositions(cx: number, cy: number, r: number, count: number, startAngle?: number): Array<{
|
|
420
|
+
x: number;
|
|
421
|
+
y: number;
|
|
422
|
+
angle: number;
|
|
423
|
+
}>;
|
|
424
|
+
/** Create an SVG arc path between two angles on a circle. */
|
|
425
|
+
declare function arcPath(cx: number, cy: number, r: number, startAngle: number, endAngle: number): string;
|
|
426
|
+
/** Distribute N points radially from a center. */
|
|
427
|
+
declare function radialPositions(cx: number, cy: number, innerR: number, outerR: number, count: number, startAngle?: number): Array<{
|
|
428
|
+
x1: number;
|
|
429
|
+
y1: number;
|
|
430
|
+
x2: number;
|
|
431
|
+
y2: number;
|
|
432
|
+
angle: number;
|
|
433
|
+
}>;
|
|
434
|
+
/** Simple grid layout: position items in columns and rows. */
|
|
435
|
+
declare function gridPositions(startX: number, startY: number, cols: number, cellWidth: number, cellHeight: number, count: number): Array<{
|
|
436
|
+
x: number;
|
|
437
|
+
y: number;
|
|
438
|
+
col: number;
|
|
439
|
+
row: number;
|
|
440
|
+
}>;
|
|
441
|
+
/** Compute a quadratic bezier control point offset perpendicular to the line. */
|
|
442
|
+
declare function curveControlPoint(x1: number, y1: number, x2: number, y2: number, offset: number): {
|
|
443
|
+
cpx: number;
|
|
444
|
+
cpy: number;
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* AVL Schema Parser
|
|
449
|
+
*
|
|
450
|
+
* Pure functions that transform an OrbitalSchema into structured data
|
|
451
|
+
* for each zoom level of the Cosmic Zoom visualization.
|
|
452
|
+
*
|
|
453
|
+
* Imports all types from @almadar/core.
|
|
454
|
+
*
|
|
455
|
+
* @packageDocumentation
|
|
456
|
+
*/
|
|
457
|
+
|
|
458
|
+
interface SerializedEffect extends JsonObject {
|
|
459
|
+
type: string;
|
|
460
|
+
args: JsonValue[];
|
|
461
|
+
}
|
|
462
|
+
interface ApplicationOrbitalData {
|
|
463
|
+
name: string;
|
|
464
|
+
entityName: string;
|
|
465
|
+
fieldCount: number;
|
|
466
|
+
persistence: string;
|
|
467
|
+
traitNames: string[];
|
|
468
|
+
pageNames: string[];
|
|
469
|
+
position: {
|
|
470
|
+
x: number;
|
|
471
|
+
y: number;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
interface CrossLink {
|
|
475
|
+
emitterOrbital: string;
|
|
476
|
+
listenerOrbital: string;
|
|
477
|
+
eventName: string;
|
|
478
|
+
emitterTrait: string;
|
|
479
|
+
listenerTrait: string;
|
|
480
|
+
}
|
|
481
|
+
interface ApplicationLevelData {
|
|
482
|
+
orbitals: ApplicationOrbitalData[];
|
|
483
|
+
crossLinks: CrossLink[];
|
|
484
|
+
}
|
|
485
|
+
interface FieldInfo extends JsonObject {
|
|
486
|
+
name: string;
|
|
487
|
+
type: string;
|
|
488
|
+
required: boolean;
|
|
489
|
+
hasDefault: boolean;
|
|
490
|
+
}
|
|
491
|
+
interface OrbitalTraitInfo extends JsonObject {
|
|
492
|
+
name: string;
|
|
493
|
+
stateCount: number;
|
|
494
|
+
eventCount: number;
|
|
495
|
+
transitionCount: number;
|
|
496
|
+
emits: string[];
|
|
497
|
+
listens: string[];
|
|
498
|
+
}
|
|
499
|
+
interface OrbitalPageInfo extends JsonObject {
|
|
500
|
+
name: string;
|
|
501
|
+
route: string;
|
|
502
|
+
}
|
|
503
|
+
interface ExternalLink extends JsonObject {
|
|
504
|
+
targetOrbital: string;
|
|
505
|
+
eventName: string;
|
|
506
|
+
direction: string;
|
|
507
|
+
traitName: string;
|
|
508
|
+
}
|
|
509
|
+
interface OrbitalLevelData {
|
|
510
|
+
name: string;
|
|
511
|
+
entity: {
|
|
512
|
+
name: string;
|
|
513
|
+
fields: FieldInfo[];
|
|
514
|
+
persistence: string;
|
|
515
|
+
};
|
|
516
|
+
traits: OrbitalTraitInfo[];
|
|
517
|
+
pages: OrbitalPageInfo[];
|
|
518
|
+
externalLinks: ExternalLink[];
|
|
519
|
+
}
|
|
520
|
+
interface TraitStateInfo extends JsonObject {
|
|
521
|
+
name: string;
|
|
522
|
+
isInitial: boolean | null;
|
|
523
|
+
isTerminal: boolean | null;
|
|
524
|
+
}
|
|
525
|
+
interface TraitTransitionInfo extends JsonObject {
|
|
526
|
+
from: string;
|
|
527
|
+
to: string;
|
|
528
|
+
event: string;
|
|
529
|
+
guard: JsonValue | null;
|
|
530
|
+
effects: SerializedEffect[];
|
|
531
|
+
index: number;
|
|
532
|
+
}
|
|
533
|
+
interface TraitLevelData extends JsonObject {
|
|
534
|
+
name: string;
|
|
535
|
+
linkedEntity: string;
|
|
536
|
+
states: TraitStateInfo[];
|
|
537
|
+
transitions: TraitTransitionInfo[];
|
|
538
|
+
emittedEvents: string[];
|
|
539
|
+
listenedEvents: string[];
|
|
540
|
+
}
|
|
541
|
+
interface ExprTreeNode {
|
|
542
|
+
label: string;
|
|
543
|
+
type: 'operator' | 'literal' | 'binding';
|
|
544
|
+
children?: ExprTreeNode[];
|
|
545
|
+
}
|
|
546
|
+
interface SlotTarget {
|
|
547
|
+
name: string;
|
|
548
|
+
pattern: string;
|
|
549
|
+
}
|
|
550
|
+
interface TransitionLevelData {
|
|
551
|
+
from: string;
|
|
552
|
+
to: string;
|
|
553
|
+
event: string;
|
|
554
|
+
guard: ExprTreeNode | null;
|
|
555
|
+
effects: ExprTreeNode[];
|
|
556
|
+
slotTargets: SlotTarget[];
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Parse the application-level view: all orbitals with cross-orbital links.
|
|
560
|
+
*/
|
|
561
|
+
declare function parseApplicationLevel(schema: OrbitalSchema): ApplicationLevelData;
|
|
562
|
+
/**
|
|
563
|
+
* Parse a single orbital's detail view.
|
|
564
|
+
*/
|
|
565
|
+
declare function parseOrbitalLevel(schema: OrbitalSchema, orbitalName: string): OrbitalLevelData | null;
|
|
566
|
+
/**
|
|
567
|
+
* Parse a trait's state machine for the detail view.
|
|
568
|
+
*/
|
|
569
|
+
declare function parseTraitLevel(schema: OrbitalSchema, orbitalName: string, traitName: string): TraitLevelData | null;
|
|
570
|
+
/**
|
|
571
|
+
* Parse a single transition for the detail view.
|
|
572
|
+
*/
|
|
573
|
+
declare function parseTransitionLevel(schema: OrbitalSchema, orbitalName: string, traitName: string, transitionIndex: number): TransitionLevelData | null;
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* AVL Canvas Types
|
|
577
|
+
*
|
|
578
|
+
* Types for the unified AVL + Flow canvas. These define the data shapes
|
|
579
|
+
* for React Flow nodes and edges that render AVL primitives.
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
/** The four zoom bands of the unified AVL canvas. */
|
|
583
|
+
type ZoomBand = 'system' | 'module' | 'behavior' | 'detail';
|
|
584
|
+
/** Thresholds for zoom band transitions (React Flow viewport zoom). */
|
|
585
|
+
declare const ZOOM_BAND_THRESHOLDS: {
|
|
586
|
+
readonly system: readonly [0.1, 0.4];
|
|
587
|
+
readonly module: readonly [0.4, 1];
|
|
588
|
+
readonly behavior: readonly [1, 2.5];
|
|
589
|
+
readonly detail: readonly [2.5, 5];
|
|
590
|
+
};
|
|
591
|
+
/** Data carried by every orbital node in the unified canvas. */
|
|
592
|
+
interface AvlNodeData extends JsonObject {
|
|
593
|
+
orbitalName: string;
|
|
594
|
+
entityName: string;
|
|
595
|
+
persistence: string;
|
|
596
|
+
fields: FieldInfo[];
|
|
597
|
+
traits: OrbitalTraitInfo[];
|
|
598
|
+
pages: OrbitalPageInfo[];
|
|
599
|
+
traitDetails: {
|
|
600
|
+
[k: string]: TraitLevelData;
|
|
601
|
+
};
|
|
602
|
+
externalLinks: ExternalLink[];
|
|
603
|
+
}
|
|
604
|
+
/** Data carried by edges in the unified canvas. */
|
|
605
|
+
interface AvlEdgeData extends JsonObject {
|
|
606
|
+
edgeKind: string;
|
|
607
|
+
event: string | null;
|
|
608
|
+
fromTrait: string | null;
|
|
609
|
+
toTrait: string | null;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/** Determine which zoom band the current viewport zoom falls into. */
|
|
613
|
+
declare function computeZoomBand(zoom: number): ZoomBand;
|
|
614
|
+
/**
|
|
615
|
+
* Compute progress (0..1) within a zoom band.
|
|
616
|
+
* Useful for crossfade transitions between bands.
|
|
617
|
+
*/
|
|
618
|
+
declare function zoomProgress(zoom: number, band: ZoomBand): number;
|
|
619
|
+
/** Context providing the current zoom band to all node components. */
|
|
620
|
+
declare const ZoomBandContext: React.Context<ZoomBand>;
|
|
621
|
+
/** Hook to read the current zoom band. */
|
|
622
|
+
declare function useZoomBand(): ZoomBand;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* AVL Flow Converter
|
|
626
|
+
*
|
|
627
|
+
* Converts an OrbitalSchema into React Flow nodes and edges
|
|
628
|
+
* for the unified AVL canvas. Reuses the existing AVL schema parser.
|
|
629
|
+
*/
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Transform an OrbitalSchema into React Flow nodes and edges.
|
|
633
|
+
* Pre-parses all orbital and trait details for responsive zoom.
|
|
634
|
+
*/
|
|
635
|
+
declare function schemaToFlowGraph(schema: OrbitalSchema): {
|
|
636
|
+
nodes: Node<AvlNodeData>[];
|
|
637
|
+
edges: Edge<AvlEdgeData>[];
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* AVL ELK Layout
|
|
642
|
+
*
|
|
643
|
+
* Shared ELK-based layout engine for state machines. Extracted from
|
|
644
|
+
* AvlTraitScene so both the V2 scene renderer and the V3 BehaviorView
|
|
645
|
+
* can share the same layout computation.
|
|
646
|
+
*/
|
|
647
|
+
|
|
648
|
+
interface LayoutNode {
|
|
649
|
+
id: string;
|
|
650
|
+
x: number;
|
|
651
|
+
y: number;
|
|
652
|
+
width: number;
|
|
653
|
+
height: number;
|
|
654
|
+
isInitial?: boolean;
|
|
655
|
+
isTerminal?: boolean;
|
|
656
|
+
role: StateRole;
|
|
657
|
+
transitionCount: number;
|
|
658
|
+
}
|
|
659
|
+
interface LayoutEdge {
|
|
660
|
+
id: string;
|
|
661
|
+
from: string;
|
|
662
|
+
to: string;
|
|
663
|
+
event: string;
|
|
664
|
+
effects: Array<{
|
|
665
|
+
type: string;
|
|
666
|
+
}>;
|
|
667
|
+
guard: boolean;
|
|
668
|
+
guardExpr?: string;
|
|
669
|
+
index: number;
|
|
670
|
+
labelX: number;
|
|
671
|
+
labelY: number;
|
|
672
|
+
labelW: number;
|
|
673
|
+
labelH: number;
|
|
674
|
+
points: Array<{
|
|
675
|
+
x: number;
|
|
676
|
+
y: number;
|
|
677
|
+
}>;
|
|
678
|
+
isSelf: boolean;
|
|
679
|
+
isBackward: boolean;
|
|
680
|
+
}
|
|
681
|
+
interface ElkLayout {
|
|
682
|
+
nodes: LayoutNode[];
|
|
683
|
+
edges: LayoutEdge[];
|
|
684
|
+
width: number;
|
|
685
|
+
height: number;
|
|
686
|
+
}
|
|
687
|
+
declare function computeTraitLayout(data: TraitLevelData): Promise<ElkLayout>;
|
|
688
|
+
declare function edgePath(points: Array<{
|
|
689
|
+
x: number;
|
|
690
|
+
y: number;
|
|
691
|
+
}>): string;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* SystemNode — Compact orbital node for the system zoom band (0.1x-0.4x).
|
|
695
|
+
*
|
|
696
|
+
* Renders miniature AVL primitives: entity glyph, field-type dots,
|
|
697
|
+
* state chain (role-colored dots), and page squares.
|
|
698
|
+
*/
|
|
699
|
+
|
|
700
|
+
interface SystemNodeProps {
|
|
701
|
+
data: AvlNodeData;
|
|
702
|
+
}
|
|
703
|
+
declare const SystemNode: React__default.FC<SystemNodeProps>;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* MiniStateMachine — Inline simplified state machine for the ModuleCard.
|
|
707
|
+
*
|
|
708
|
+
* Renders a compact left-to-right flow of AvlState nodes connected
|
|
709
|
+
* by AvlTransition arrows, with AvlEffect icons below.
|
|
710
|
+
* No ELK layout needed — uses simple horizontal positioning.
|
|
711
|
+
*/
|
|
712
|
+
|
|
713
|
+
interface MiniStateMachineProps {
|
|
714
|
+
data: TraitLevelData;
|
|
715
|
+
className?: string;
|
|
716
|
+
}
|
|
717
|
+
declare const MiniStateMachine: React__default.FC<MiniStateMachineProps>;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* ModuleCard — Structured card for the module zoom band (0.4x-1.0x).
|
|
721
|
+
*
|
|
722
|
+
* Renders AVL primitives inside a card container:
|
|
723
|
+
* - Entity section: AvlEntity glyph + AvlPersistence + AvlFieldType grid
|
|
724
|
+
* - Trait sections: MiniStateMachine per trait + AvlEffect icons + emit/listen indicators
|
|
725
|
+
* - Pages section: AvlPage squares with route labels
|
|
726
|
+
*/
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* ModuleCard — a card summarizing one course module or lesson with progress
|
|
730
|
+
* and entry point.
|
|
731
|
+
*
|
|
732
|
+
* @capabilities course module card, lesson card, curriculum unit card, learning-path step card
|
|
733
|
+
*/
|
|
734
|
+
interface ModuleCardProps {
|
|
735
|
+
data: AvlNodeData;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Self-contained ModuleCard. The connection `<Handle>`s need the ReactFlow store,
|
|
739
|
+
* so standalone they'd throw ("no zustand provider as an ancestor"). When this
|
|
740
|
+
* card isn't already a flow node (`useNodeId() === null`) it bundles its own
|
|
741
|
+
* `<ReactFlowProvider>` so it renders anywhere; inside `<FlowCanvas>` it's a real
|
|
742
|
+
* node and renders raw (no nested provider). The provider is an implementation
|
|
743
|
+
* detail, never a precondition for using the component.
|
|
744
|
+
*/
|
|
745
|
+
declare const ModuleCard: React__default.FC<ModuleCardProps>;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* BehaviorView — Full state machine for the behavior zoom band (1.0x-2.5x).
|
|
749
|
+
*
|
|
750
|
+
* Uses ELK layout from avl-elk-layout.ts. Renders AvlState, AvlTransitionLane,
|
|
751
|
+
* and AvlSwimLane inside an inline SVG within a React Flow node.
|
|
752
|
+
*/
|
|
753
|
+
|
|
754
|
+
interface BehaviorViewProps {
|
|
755
|
+
data: AvlNodeData;
|
|
756
|
+
}
|
|
757
|
+
declare const BehaviorView: React__default.FC<BehaviorViewProps>;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* DetailView — Transition specification card for the detail zoom band (2.5x-5.0x).
|
|
761
|
+
*
|
|
762
|
+
* Renders a spec card with: from/to AvlState nodes, AvlEvent trigger,
|
|
763
|
+
* AvlGuard diamond, numbered AvlEffect icons with binding paths,
|
|
764
|
+
* and AvlFieldType shapes.
|
|
765
|
+
*/
|
|
766
|
+
|
|
767
|
+
interface DetailViewProps {
|
|
768
|
+
data: AvlNodeData;
|
|
769
|
+
}
|
|
770
|
+
declare const DetailView: React__default.FC<DetailViewProps>;
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* AvlOrbitalNode — Single React Flow node type for the unified AVL canvas.
|
|
774
|
+
*
|
|
775
|
+
* Reads the current ZoomBand from context and renders the appropriate
|
|
776
|
+
* sub-component: SystemNode, ModuleCard, BehaviorView, or DetailView.
|
|
777
|
+
*
|
|
778
|
+
* Using a single node type (instead of switching types per zoom band)
|
|
779
|
+
* prevents React from unmounting/remounting nodes on zoom changes.
|
|
780
|
+
*/
|
|
781
|
+
|
|
782
|
+
declare const AvlOrbitalNode: React__default.FC<NodeProps>;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* AvlTransitionEdge — React Flow edge for state machine transitions.
|
|
786
|
+
*
|
|
787
|
+
* Bezier path with event label at midpoint. Guard diamond and effect
|
|
788
|
+
* dot indicators shown inline. Forward transitions are solid dark,
|
|
789
|
+
* backward transitions are dashed lighter.
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
interface AvlTransitionEdgeData {
|
|
793
|
+
[key: string]: string | boolean | undefined;
|
|
794
|
+
event: string;
|
|
795
|
+
hasGuard?: boolean;
|
|
796
|
+
hasEffects?: boolean;
|
|
797
|
+
}
|
|
798
|
+
type AvlTransitionFlowEdge = Edge<AvlTransitionEdgeData, 'transition'>;
|
|
799
|
+
declare const AvlTransitionEdge: React__default.FC<EdgeProps<AvlTransitionFlowEdge>>;
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* AvlEventWireEdge — React Flow edge for emit/listen event wiring.
|
|
803
|
+
*
|
|
804
|
+
* Dashed orange Bezier path with event name label at midpoint.
|
|
805
|
+
* Uses AVL CONNECTION_COLORS.emitListen styling.
|
|
806
|
+
*/
|
|
807
|
+
|
|
808
|
+
interface AvlEventWireEdgeData {
|
|
809
|
+
[key: string]: string | boolean | undefined;
|
|
810
|
+
event: string;
|
|
811
|
+
compatible?: boolean;
|
|
812
|
+
}
|
|
813
|
+
type AvlEventWireFlowEdge = Edge<AvlEventWireEdgeData, 'eventWire'>;
|
|
814
|
+
declare const AvlEventWireEdge: React__default.FC<EdgeProps<AvlEventWireFlowEdge>>;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* AvlBackwardEdge — Dashed backward/retry transition edge.
|
|
818
|
+
*
|
|
819
|
+
* Uses CONNECTION_COLORS.backward styling: dashed, lighter color.
|
|
820
|
+
*/
|
|
821
|
+
|
|
822
|
+
declare const AvlBackwardEdge: React__default.FC<EdgeProps>;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* AvlPageEdge — Thin solid page-reference edge.
|
|
826
|
+
*
|
|
827
|
+
* Slate colored, 1px, used for page-to-trait references.
|
|
828
|
+
*/
|
|
829
|
+
|
|
830
|
+
declare const AvlPageEdge: React__default.FC<EdgeProps>;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* AvlBindingEdge — Dotted violet binding edge with @ marker.
|
|
834
|
+
*
|
|
835
|
+
* Used for data binding connections. Dotted line at 1px with
|
|
836
|
+
* a small @ label at the midpoint.
|
|
837
|
+
*/
|
|
838
|
+
|
|
839
|
+
declare const AvlBindingEdge: React__default.FC<EdgeProps>;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* AVL Preview Types
|
|
843
|
+
*
|
|
844
|
+
* Types for the V3 FlowCanvas: UI projection mode.
|
|
845
|
+
* Nodes show rendered UI thumbnails, edges show events.
|
|
846
|
+
* Two levels: overview (one node per orbital) and expanded (one node per UI state).
|
|
847
|
+
*
|
|
848
|
+
* Uses @almadar/core types for schema-level constructs.
|
|
849
|
+
*/
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* The navigation levels of the FlowCanvas.
|
|
853
|
+
*
|
|
854
|
+
* - `overview` (L1) — one card per orbital, showing the orbital's composed
|
|
855
|
+
* render-ui at INIT.
|
|
856
|
+
* - `expanded` (L2) — one card per organism-authored transition + one
|
|
857
|
+
* grouped card per imported-behavior alias.
|
|
858
|
+
* - `behavior-expanded` (L3) — drilled into a single imported behavior at
|
|
859
|
+
* L2: one card per transition of THAT behavior. Used to inspect what an
|
|
860
|
+
* import contributes without leaving the canvas.
|
|
861
|
+
* - `trait-expanded` — one card per trait of a single orbital, connected
|
|
862
|
+
* by intra-orbital `emits → listens` edges. Used by the cosmic tab to
|
|
863
|
+
* render the trait-level circuit when the user drills into an orbital
|
|
864
|
+
* from the L1 grid. Not used by the canvas tab today.
|
|
865
|
+
*/
|
|
866
|
+
type ViewLevel = 'overview' | 'expanded' | 'behavior-expanded' | 'trait-expanded';
|
|
867
|
+
/**
|
|
868
|
+
* Screen size preset for OrbPreview rendering inside nodes.
|
|
869
|
+
*
|
|
870
|
+
* Aligned with the four-breakpoint responsiveness audit:
|
|
871
|
+
* mobile — phone portrait (≤640px)
|
|
872
|
+
* tablet — iPad / small landscape (641–1024px)
|
|
873
|
+
* laptop — 13–15" notebook (1025–1440px)
|
|
874
|
+
* wide — desktop / monitor (≥1441px)
|
|
875
|
+
*
|
|
876
|
+
* Preset widths are representative viewport widths within each range; the
|
|
877
|
+
* preview renders at exactly this width so the embedded UI experiences
|
|
878
|
+
* the same media-query / container-query behavior it would at the real
|
|
879
|
+
* viewport. `minHeight` only floors the preview frame; vertical sizing is
|
|
880
|
+
* content-driven (BrowserPlayground height="auto").
|
|
881
|
+
*/
|
|
882
|
+
type ScreenSize = 'mobile' | 'tablet' | 'laptop' | 'wide';
|
|
883
|
+
/**
|
|
884
|
+
* An interactive element inside a render-ui pattern that fires an event.
|
|
885
|
+
* For example, a button with `event: "CHECKOUT"` is an event source.
|
|
886
|
+
* These are used to draw edges from the specific trigger element to the
|
|
887
|
+
* target screen, making the prototype flow concrete.
|
|
888
|
+
*/
|
|
889
|
+
interface PatternEventSource {
|
|
890
|
+
/** The event name fired by this element (e.g., "CHECKOUT"). */
|
|
891
|
+
event: string;
|
|
892
|
+
/** The pattern type of the trigger element (e.g., "button", "link", "icon-button"). */
|
|
893
|
+
patternType: string;
|
|
894
|
+
/** Human label if available (e.g., "Checkout", "Submit"). */
|
|
895
|
+
label?: string;
|
|
896
|
+
/**
|
|
897
|
+
* Path within the pattern tree (e.g., "children.2" means third child).
|
|
898
|
+
* Used to position the handle near the trigger element.
|
|
899
|
+
*/
|
|
900
|
+
path: string;
|
|
901
|
+
/** Vertical position hint (0..1) for handle placement on the node. */
|
|
902
|
+
positionHint: number;
|
|
903
|
+
/** Typed payload fields if this event carries data. */
|
|
904
|
+
payloadFields?: Array<{
|
|
905
|
+
name: string;
|
|
906
|
+
type: string;
|
|
907
|
+
required?: boolean;
|
|
908
|
+
}>;
|
|
909
|
+
}
|
|
910
|
+
/** A slot + pattern config pair extracted from a render-ui effect. */
|
|
911
|
+
interface RenderUIEntry {
|
|
912
|
+
slot: UISlot | string;
|
|
913
|
+
pattern: AnyPatternConfig;
|
|
914
|
+
}
|
|
915
|
+
/** Data for a preview node (used at both overview and expanded levels). */
|
|
916
|
+
interface PreviewNodeData {
|
|
917
|
+
[key: string]: string | number | boolean | string[] | Expression | null | RenderUIEntry[] | PatternEventSource[] | Array<{
|
|
918
|
+
event: string;
|
|
919
|
+
fromState: string;
|
|
920
|
+
toState: string;
|
|
921
|
+
}> | OrbitalSchema | EntityData | undefined;
|
|
922
|
+
/** Orbital this node belongs to. */
|
|
923
|
+
orbitalName: string;
|
|
924
|
+
/** Trait name (only at expanded level). */
|
|
925
|
+
traitName?: string;
|
|
926
|
+
/** State name after this transition fires (expanded level). */
|
|
927
|
+
stateName?: string;
|
|
928
|
+
/** Event that triggers this transition (expanded level). */
|
|
929
|
+
transitionEvent?: string;
|
|
930
|
+
/** From state (expanded level). */
|
|
931
|
+
fromState?: string;
|
|
932
|
+
/** To state (expanded level). */
|
|
933
|
+
toState?: string;
|
|
934
|
+
/**
|
|
935
|
+
* Render-ui patterns extracted from the transition's effects.
|
|
936
|
+
* Each entry is a slot + pattern config pair.
|
|
937
|
+
*/
|
|
938
|
+
patterns: RenderUIEntry[];
|
|
939
|
+
/**
|
|
940
|
+
* Interactive elements within the patterns that fire events.
|
|
941
|
+
* Each one becomes a source handle on the node, allowing edges
|
|
942
|
+
* to connect from the specific button/link to the target screen.
|
|
943
|
+
*/
|
|
944
|
+
eventSources: PatternEventSource[];
|
|
945
|
+
/** Behavior layer for visual indicator (color band). */
|
|
946
|
+
layer?: string;
|
|
947
|
+
/** State role for visual indicator. */
|
|
948
|
+
stateRole?: 'initial' | 'terminal' | 'hub' | 'error' | 'default';
|
|
949
|
+
/** All effect types on this transition (for overlay). */
|
|
950
|
+
effectTypes?: string[];
|
|
951
|
+
/** Guard expression (for overlay). */
|
|
952
|
+
guard?: Expression | null;
|
|
953
|
+
entityName?: string;
|
|
954
|
+
persistence?: string;
|
|
955
|
+
fieldCount?: number;
|
|
956
|
+
traitCount?: number;
|
|
957
|
+
pageRoutes?: string[];
|
|
958
|
+
/**
|
|
959
|
+
* Generation status for this orbital. When `'running'`, the overview node
|
|
960
|
+
* renders a spinner overlay + accent border so the user can see which
|
|
961
|
+
* orbital the coordinator is currently dispatching to. Other states are
|
|
962
|
+
* available so consumers can also paint success/error treatments
|
|
963
|
+
* (e.g. green border on completion, red on failure). Default is `'idle'`.
|
|
964
|
+
*
|
|
965
|
+
* Set by FlowCanvasProps.orbitalStatus and threaded through the converter.
|
|
966
|
+
* Future expansion: hover over a `'running'` node to surface the subagent
|
|
967
|
+
* trace inline.
|
|
968
|
+
*/
|
|
969
|
+
status?: 'idle' | 'running' | 'success' | 'error';
|
|
970
|
+
/**
|
|
971
|
+
* The `OrbitalSchema.name` this node was derived from. The reserved value
|
|
972
|
+
* `'__design_system__'` identifies nodes belonging to the Design System
|
|
973
|
+
* tab's synthesized catalog schema, so downstream event handlers can route
|
|
974
|
+
* mutation events to the project theme manifest instead of the project's
|
|
975
|
+
* orbital schema. Unset for project orbitals — handlers treat absence as
|
|
976
|
+
* "project schema".
|
|
977
|
+
*/
|
|
978
|
+
sourceSchemaName?: string;
|
|
979
|
+
/**
|
|
980
|
+
* Set when this L2 card represents a grouped imported-behavior bucket
|
|
981
|
+
* (one card per `uses[]` alias instead of one per transition). The alias
|
|
982
|
+
* comes from `Trait.sourceBehavior.alias` populated by the inline phase.
|
|
983
|
+
* Double-clicking such a card drills into L3 (`behavior-expanded`) to
|
|
984
|
+
* see that alias's transitions.
|
|
985
|
+
*
|
|
986
|
+
* Absent on organism-authored transition cards and L1 overview cards.
|
|
987
|
+
*/
|
|
988
|
+
behaviorAlias?: string;
|
|
989
|
+
/**
|
|
990
|
+
* Human-readable behavior name for a grouped imported-behavior card
|
|
991
|
+
* (e.g. `'std/behaviors/std-stat-card'`). Comes from
|
|
992
|
+
* `Trait.sourceBehavior.behavior`. Renderer surfaces it as a label.
|
|
993
|
+
*/
|
|
994
|
+
behaviorName?: string;
|
|
995
|
+
/**
|
|
996
|
+
* How many transitions are collapsed into this grouped imported-behavior
|
|
997
|
+
* card. Renderer can surface it as a "+N screens" badge.
|
|
998
|
+
*/
|
|
999
|
+
transitionCount?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* Discriminator for the node variant. Absent on overview/expanded/
|
|
1002
|
+
* behavior-expanded cards (those use field-presence-based discrimination
|
|
1003
|
+
* via `behaviorAlias`/`transitionEvent`). Set to `'trait-card'` for nodes
|
|
1004
|
+
* produced by `orbitalToTraitGraph` so renderers can branch cleanly.
|
|
1005
|
+
*/
|
|
1006
|
+
kind?: 'trait-card';
|
|
1007
|
+
/**
|
|
1008
|
+
* Trait-card transitions (`kind === 'trait-card'` only). One row per
|
|
1009
|
+
* transition; each row is clickable and drills to L4 transition detail
|
|
1010
|
+
* in cosmic. `event` is the trigger; `fromState` / `toState` mirror the
|
|
1011
|
+
* underlying state-machine edge.
|
|
1012
|
+
*/
|
|
1013
|
+
transitions?: Array<{
|
|
1014
|
+
event: string;
|
|
1015
|
+
fromState: string;
|
|
1016
|
+
toState: string;
|
|
1017
|
+
}>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Trait-card `emits` event names (`kind === 'trait-card'` only). One
|
|
1020
|
+
* source handle per entry on the right edge of the card. Drives the
|
|
1021
|
+
* outgoing wire endpoints in `orbitalToTraitGraph`.
|
|
1022
|
+
*/
|
|
1023
|
+
emits?: string[];
|
|
1024
|
+
/**
|
|
1025
|
+
* Trait-card `listens` event names (`kind === 'trait-card'` only). One
|
|
1026
|
+
* target handle per entry on the left edge of the card. Drives the
|
|
1027
|
+
* incoming wire endpoints in `orbitalToTraitGraph`.
|
|
1028
|
+
*/
|
|
1029
|
+
listens?: string[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Trait-card `linkedEntity` (`kind === 'trait-card'` only). Surfaced as a
|
|
1032
|
+
* subtitle/badge next to the trait name so users can see what entity the
|
|
1033
|
+
* trait operates on. Mirrors `Trait.linkedEntity` from the resolved schema.
|
|
1034
|
+
*/
|
|
1035
|
+
linkedEntity?: string;
|
|
1036
|
+
/** Full parsed schema threaded to node renderers (e.g. TraitCardNode). */
|
|
1037
|
+
_fullSchema?: OrbitalSchema;
|
|
1038
|
+
/** Mock entity data for the orbital preview. */
|
|
1039
|
+
_mockData?: EntityData;
|
|
1040
|
+
}
|
|
1041
|
+
/** Data for event flow edges. */
|
|
1042
|
+
interface EventEdgeData {
|
|
1043
|
+
[key: string]: string | boolean | undefined;
|
|
1044
|
+
/** The event name displayed on the edge. */
|
|
1045
|
+
event: string;
|
|
1046
|
+
/** Source state name (expanded level). */
|
|
1047
|
+
fromState?: string;
|
|
1048
|
+
/** Target state name (expanded level). */
|
|
1049
|
+
toState?: string;
|
|
1050
|
+
/** Whether this is a backward/retry transition. */
|
|
1051
|
+
isBackward?: boolean;
|
|
1052
|
+
/** Whether this is a cross-orbital event wire (overview level). */
|
|
1053
|
+
isCrossOrbital?: boolean;
|
|
1054
|
+
/** Source trait (for cross-orbital wires). */
|
|
1055
|
+
fromTrait?: string;
|
|
1056
|
+
/** Target trait (for cross-orbital wires). */
|
|
1057
|
+
toTrait?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* The pattern type that triggers this event (e.g., "button").
|
|
1060
|
+
* Displayed on the edge label for context.
|
|
1061
|
+
*/
|
|
1062
|
+
triggerPatternType?: string;
|
|
1063
|
+
/** The trigger element's label (e.g., "Checkout"). */
|
|
1064
|
+
triggerLabel?: string;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* AVL Preview Converter
|
|
1069
|
+
*
|
|
1070
|
+
* Extracts render-ui pattern configs from OrbitalSchema transitions
|
|
1071
|
+
* and builds React Flow graphs for the two FlowCanvas levels:
|
|
1072
|
+
* - Overview: one node per orbital (INIT transition UI)
|
|
1073
|
+
* - Expanded: one node per UI state within an orbital
|
|
1074
|
+
*
|
|
1075
|
+
* Key feature: detects interactive elements (buttons, links) inside
|
|
1076
|
+
* patterns that fire events. These become per-element source handles
|
|
1077
|
+
* so edges connect from the specific trigger element to the target screen.
|
|
1078
|
+
*
|
|
1079
|
+
* Uses @almadar/core types for schema-level constructs.
|
|
1080
|
+
*/
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Build a React Flow graph for the overview level.
|
|
1084
|
+
* Each orbital gets one node showing its INIT transition's UI.
|
|
1085
|
+
*/
|
|
1086
|
+
declare function schemaToOverviewGraph(schema: OrbitalSchema, mockData?: EntityData, behaviorMeta?: Record<string, {
|
|
1087
|
+
layer: string;
|
|
1088
|
+
}>, layoutHint?: 'pipeline' | 'grid', orbitalStatus?: Record<string, PreviewNodeData['status']>, screenSize?: ScreenSize): {
|
|
1089
|
+
nodes: Node<PreviewNodeData>[];
|
|
1090
|
+
edges: Edge<EventEdgeData>[];
|
|
1091
|
+
};
|
|
1092
|
+
/**
|
|
1093
|
+
* Build a React Flow graph for the L2 (expanded) level.
|
|
1094
|
+
*
|
|
1095
|
+
* Organism-authored traits (no `sourceBehavior` metadata) emit one
|
|
1096
|
+
* transition card per render-ui-bearing transition (the historical
|
|
1097
|
+
* behavior). Imported traits (cloned by the inline phase from `uses[]`)
|
|
1098
|
+
* collapse into one grouped card per `sourceBehavior.alias`, so the user
|
|
1099
|
+
* sees `Stats`, `Graphs`, `Layout`, etc. as single cards rather than 9
|
|
1100
|
+
* anonymous `INIT` peers (STUDIO-1). Drill into a grouped card to reach
|
|
1101
|
+
* L3 (`orbitalAliasToExpandedGraph`).
|
|
1102
|
+
*/
|
|
1103
|
+
declare function orbitalToExpandedGraph(schema: OrbitalSchema, orbitalName: string, mockData?: EntityData, screenSize?: ScreenSize): {
|
|
1104
|
+
nodes: Node<PreviewNodeData>[];
|
|
1105
|
+
edges: Edge<EventEdgeData>[];
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* OrbPreviewNode
|
|
1110
|
+
*
|
|
1111
|
+
* React Flow node that renders a real OrbPreview inside it.
|
|
1112
|
+
* The canvas is always live and editable (like Figma). Clicking any
|
|
1113
|
+
* rendered UI element selects its pattern and shows props in the
|
|
1114
|
+
* TransitionPanel. No edit mode toggle needed.
|
|
1115
|
+
*
|
|
1116
|
+
* The header is the drag handle for React Flow. The content area
|
|
1117
|
+
* passes clicks through to the pattern elements.
|
|
1118
|
+
*/
|
|
1119
|
+
|
|
1120
|
+
declare const OrbPreviewNode: React__default.NamedExoticComponent<NodeProps>;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* EventFlowEdge
|
|
1124
|
+
*
|
|
1125
|
+
* React Flow edge for the V3 FlowCanvas. Shows the event name and
|
|
1126
|
+
* optionally the trigger element (button label) that fires it.
|
|
1127
|
+
*
|
|
1128
|
+
* When the edge originates from a specific event source handle,
|
|
1129
|
+
* the label shows "Button Label \u2192 EVENT" to make the connection
|
|
1130
|
+
* between UI element and transition clear.
|
|
1131
|
+
*/
|
|
1132
|
+
|
|
1133
|
+
declare const EventFlowEdge: React__default.NamedExoticComponent<EdgeProps>;
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* AVL Behavior Compose Types
|
|
1137
|
+
*
|
|
1138
|
+
* Types for behavior-level composition canvas.
|
|
1139
|
+
* At this level, each node represents a BEHAVIOR (not an orbital).
|
|
1140
|
+
* A behavior is a higher-level unit: atom (1 orbital), molecule (1 orbital
|
|
1141
|
+
* with composed traits), or organism (multiple orbitals).
|
|
1142
|
+
*
|
|
1143
|
+
* Three navigation levels:
|
|
1144
|
+
* Behavior (compose): One node per behavior showing AvlBehaviorGlyph
|
|
1145
|
+
* Overview: One node per orbital showing live UI (OrbPreviewNode)
|
|
1146
|
+
* Expanded: One node per UI state within an orbital (OrbPreviewNode)
|
|
1147
|
+
*/
|
|
1148
|
+
|
|
1149
|
+
/** Serializable payload field — mirrors EventPayloadField from @almadar/core. */
|
|
1150
|
+
interface SerializedPayloadField extends JsonObject {
|
|
1151
|
+
name: string;
|
|
1152
|
+
type: string;
|
|
1153
|
+
required: boolean | null;
|
|
1154
|
+
description: string | null;
|
|
1155
|
+
}
|
|
1156
|
+
/** Serializable behavior glyph child — mirrors BehaviorGlyphChild from AvlBehaviorGlyph. */
|
|
1157
|
+
interface SerializedGlyphChild extends JsonObject {
|
|
1158
|
+
name: string;
|
|
1159
|
+
fieldCount: number | null;
|
|
1160
|
+
stateCount: number | null;
|
|
1161
|
+
persistence: string | null;
|
|
1162
|
+
effectTypes: string[];
|
|
1163
|
+
}
|
|
1164
|
+
/** Serializable behavior glyph connection — mirrors BehaviorGlyphConnection from AvlBehaviorGlyph. */
|
|
1165
|
+
interface SerializedGlyphConnection extends JsonObject {
|
|
1166
|
+
from: string;
|
|
1167
|
+
to: string;
|
|
1168
|
+
event: string;
|
|
1169
|
+
}
|
|
1170
|
+
/** Extended view level adding 'behavior' to the existing overview/expanded. */
|
|
1171
|
+
type ComposeViewLevel = 'behavior' | 'overview' | 'expanded';
|
|
1172
|
+
/** An event that can be wired between behaviors. */
|
|
1173
|
+
interface ConnectableEvent extends JsonObject {
|
|
1174
|
+
/** Event name (e.g., "ADD_TO_CART"). */
|
|
1175
|
+
event: string;
|
|
1176
|
+
/** Typed payload fields if declared. */
|
|
1177
|
+
payloadFields: SerializedPayloadField[] | null;
|
|
1178
|
+
/** Vertical position hint (0..1) for handle placement on the node. */
|
|
1179
|
+
positionHint: number;
|
|
1180
|
+
}
|
|
1181
|
+
/** Data for a BehaviorComposeNode in React Flow. */
|
|
1182
|
+
interface BehaviorComposeNodeData extends JsonObject {
|
|
1183
|
+
/** Behavior name from registry (e.g., "std-cart"). */
|
|
1184
|
+
behaviorName: string;
|
|
1185
|
+
/** Composition level: atom, molecule, organism. */
|
|
1186
|
+
level: string;
|
|
1187
|
+
/** Domain for color coding (e.g., "commerce"). */
|
|
1188
|
+
domain: string | null;
|
|
1189
|
+
/** Layer classification (e.g., "Domain", "UI Patterns"). */
|
|
1190
|
+
layer: string | null;
|
|
1191
|
+
/** Primary entity name (e.g., "CartItem"). */
|
|
1192
|
+
entityName: string;
|
|
1193
|
+
/** Number of states in the behavior. */
|
|
1194
|
+
stateCount: number;
|
|
1195
|
+
/** Number of entity fields. */
|
|
1196
|
+
fieldCount: number | null;
|
|
1197
|
+
/** Persistence kind. */
|
|
1198
|
+
persistence: string | null;
|
|
1199
|
+
/** Effect types used by this behavior. */
|
|
1200
|
+
effectTypes: string[] | null;
|
|
1201
|
+
/** Child behaviors for molecule/organism glyphs. */
|
|
1202
|
+
children: SerializedGlyphChild[] | null;
|
|
1203
|
+
/** Connections between children (for organism glyphs). */
|
|
1204
|
+
connections: SerializedGlyphConnection[] | null;
|
|
1205
|
+
/** Events this behavior can emit (source handles). */
|
|
1206
|
+
connectableEvents: ConnectableEvent[];
|
|
1207
|
+
/** Behaviors this is composable with (for palette hints). */
|
|
1208
|
+
composableWith: string[] | null;
|
|
1209
|
+
/** Names of orbitals produced by this behavior (for drill-down). */
|
|
1210
|
+
orbitalNames: string[];
|
|
1211
|
+
}
|
|
1212
|
+
/** Edge data for behavior-level wiring. */
|
|
1213
|
+
interface BehaviorWireEdgeData extends JsonObject {
|
|
1214
|
+
/** The event name displayed on the edge. */
|
|
1215
|
+
event: string;
|
|
1216
|
+
/** Source behavior name. */
|
|
1217
|
+
sourceBehavior: string;
|
|
1218
|
+
/** Target behavior name. */
|
|
1219
|
+
targetBehavior: string;
|
|
1220
|
+
/** Typed payload fields if declared. */
|
|
1221
|
+
payloadFields: SerializedPayloadField[] | null;
|
|
1222
|
+
}
|
|
1223
|
+
/** Mapping from behavior name to its metadata + produced orbitals. */
|
|
1224
|
+
interface BehaviorCanvasEntry {
|
|
1225
|
+
/** Behavior name (e.g., "std-cart"). */
|
|
1226
|
+
behaviorName: string;
|
|
1227
|
+
/** Composition level. */
|
|
1228
|
+
level: BehaviorLevel;
|
|
1229
|
+
/** Domain for color coding. */
|
|
1230
|
+
domain?: string;
|
|
1231
|
+
/** Layer classification. */
|
|
1232
|
+
layer?: string;
|
|
1233
|
+
/** Primary entity name. */
|
|
1234
|
+
entityName: string;
|
|
1235
|
+
/** Number of states. */
|
|
1236
|
+
stateCount: number;
|
|
1237
|
+
/** Number of entity fields. */
|
|
1238
|
+
fieldCount?: number;
|
|
1239
|
+
/** Persistence kind. */
|
|
1240
|
+
persistence?: string;
|
|
1241
|
+
/** Effect types used. */
|
|
1242
|
+
effectTypes?: string[];
|
|
1243
|
+
/** Child behaviors (molecule/organism). */
|
|
1244
|
+
children?: SerializedGlyphChild[];
|
|
1245
|
+
/** Connections between children (organism). */
|
|
1246
|
+
connections?: SerializedGlyphConnection[];
|
|
1247
|
+
/** Events available for wiring. */
|
|
1248
|
+
connectableEvents: ConnectableEvent[];
|
|
1249
|
+
/** Compatible behavior names. */
|
|
1250
|
+
composableWith?: string[];
|
|
1251
|
+
/** Orbital names produced by this behavior (for drill-down mapping). */
|
|
1252
|
+
orbitalNames: string[];
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* BehaviorComposeNode
|
|
1257
|
+
*
|
|
1258
|
+
* React Flow custom node for behavior-level composition.
|
|
1259
|
+
* Shows AvlBehaviorGlyph instead of live UI (OrbPreview).
|
|
1260
|
+
* Each behavior is one compact node with event handles for wiring.
|
|
1261
|
+
*
|
|
1262
|
+
* This is the compose-level node. Double-clicking drills into
|
|
1263
|
+
* the orbital-level view (OrbPreviewNode).
|
|
1264
|
+
*/
|
|
1265
|
+
|
|
1266
|
+
declare const BehaviorComposeNode: React__default.NamedExoticComponent<NodeProps>;
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* AVL Behavior Compose Converter
|
|
1270
|
+
*
|
|
1271
|
+
* Converts BehaviorCanvasEntry[] to React Flow nodes and edges
|
|
1272
|
+
* for the behavior-level composition canvas.
|
|
1273
|
+
*
|
|
1274
|
+
* Parallel to avl-preview-converter.ts which works at the orbital level.
|
|
1275
|
+
* This works one level higher: each node is a behavior (not an orbital).
|
|
1276
|
+
*/
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Build a React Flow graph for behavior-level composition.
|
|
1280
|
+
* Each behavior entry becomes one BehaviorComposeNode.
|
|
1281
|
+
*/
|
|
1282
|
+
declare function behaviorsToComposeGraph(entries: BehaviorCanvasEntry[], wires: BehaviorWireEdgeData[], layoutHint?: 'pipeline' | 'grid'): {
|
|
1283
|
+
nodes: Node<BehaviorComposeNodeData>[];
|
|
1284
|
+
edges: Edge<BehaviorWireEdgeData>[];
|
|
1285
|
+
};
|
|
1286
|
+
/** Registry record shape (matches behaviors-registry.json entries). */
|
|
1287
|
+
interface BehaviorRegistryRecord {
|
|
1288
|
+
name: string;
|
|
1289
|
+
level: 'atom' | 'molecule' | 'organism';
|
|
1290
|
+
family: string;
|
|
1291
|
+
layer: string;
|
|
1292
|
+
description: string;
|
|
1293
|
+
complexity: {
|
|
1294
|
+
states: number;
|
|
1295
|
+
events: number;
|
|
1296
|
+
transitions: number;
|
|
1297
|
+
};
|
|
1298
|
+
defaultEntity: {
|
|
1299
|
+
name: string;
|
|
1300
|
+
persistence?: string;
|
|
1301
|
+
fields: Array<{
|
|
1302
|
+
name: string;
|
|
1303
|
+
type: string;
|
|
1304
|
+
required?: boolean;
|
|
1305
|
+
}>;
|
|
1306
|
+
};
|
|
1307
|
+
connectableEvents: string[];
|
|
1308
|
+
eventPayloads: {
|
|
1309
|
+
[k: string]: Array<{
|
|
1310
|
+
name: string;
|
|
1311
|
+
type: string;
|
|
1312
|
+
required?: boolean;
|
|
1313
|
+
}>;
|
|
1314
|
+
};
|
|
1315
|
+
composableWith: string[];
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Convert a registry entry to a BehaviorCanvasEntry.
|
|
1319
|
+
* Maps connectableEvents + eventPayloads into typed ConnectableEvent[].
|
|
1320
|
+
*/
|
|
1321
|
+
declare function registryEntryToCanvasEntry(entry: BehaviorRegistryRecord, orbitalNames: string[]): BehaviorCanvasEntry;
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* Build an `EditFocus` from a clicked element's `data-orb-*` address (stamped by
|
|
1325
|
+
* UISlotRenderer). The owning orbital is read from the DOM (`data-orb-orbital`,
|
|
1326
|
+
* walking up via `closest` when the clicked node itself doesn't carry it); since
|
|
1327
|
+
* `EditFocus.orbital` is required, returns `null` when it can't be resolved.
|
|
1328
|
+
*/
|
|
1329
|
+
declare function deriveEditFocusFromElement(el: HTMLElement): EditFocus | null;
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* useCanvasDnd — drag/drop primitives for the AVL canvas surface.
|
|
1333
|
+
*
|
|
1334
|
+
* Shares the sensor stack + collision waterfall with `useDataDnd` (both
|
|
1335
|
+
* import from `hooks/useAlmadarDndCollision`); diverges on drop semantics
|
|
1336
|
+
* because palette → canvas is a cursor-resolved tree insert, not a
|
|
1337
|
+
* sortable-list reorder.
|
|
1338
|
+
*
|
|
1339
|
+
* Pointer-sensor based so it works inside React Flow nodes (the native
|
|
1340
|
+
* HTML5 DnD path was swallowed by React Flow's pan/zoom handlers).
|
|
1341
|
+
*
|
|
1342
|
+
* Event contract (defaults — overridable via `CanvasDndProvider.onDrop`):
|
|
1343
|
+
* - On drag start: emits `UI:DRAG_START` { kind, data }
|
|
1344
|
+
* - On drag end: emits `UI:DRAG_END` { kind, data }
|
|
1345
|
+
* - On 'pattern' drop: emits `UI:PATTERN_DROP` { patternType, containerNode, parentPath?, index? }
|
|
1346
|
+
* - On 'behavior' drop: emits `UI:BEHAVIOR_DROP` { behaviorName, containerNode }
|
|
1347
|
+
*
|
|
1348
|
+
* The `onDrop` callback lets consumers route OTHER payload kinds (e.g.
|
|
1349
|
+
* `'pattern-instance'` for in-canvas reorder of an existing pattern) to
|
|
1350
|
+
* their own bus events or schema mutations. Reorder semantics belong in
|
|
1351
|
+
* the consumer because they touch the SExpr tree directly — this primitive
|
|
1352
|
+
* only resolves payload + target + cursor and hands them off.
|
|
1353
|
+
*/
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Drag kinds the canvas understands. Open-ended `string` so consumers can
|
|
1357
|
+
* introduce new kinds (e.g. `'pattern-instance'` for in-canvas reorder of an
|
|
1358
|
+
* existing pattern) without touching this file — the provider's defaults
|
|
1359
|
+
* cover `'pattern'` and `'behavior'`; everything else routes through the
|
|
1360
|
+
* consumer's `onDrop`.
|
|
1361
|
+
*/
|
|
1362
|
+
type CanvasDragKind = 'pattern' | 'behavior' | (string & {});
|
|
1363
|
+
/**
|
|
1364
|
+
* Payload carried by a draggable. For `'pattern'` tiles `data` is
|
|
1365
|
+
* `{ type: string }`, for `'behavior'` tiles `{ name: string }`. For consumer
|
|
1366
|
+
* kinds (e.g. `'pattern-instance'`) the shape is whatever the consumer
|
|
1367
|
+
* agrees on with its own `onDrop`.
|
|
1368
|
+
*/
|
|
1369
|
+
interface CanvasDragPayload {
|
|
1370
|
+
kind: CanvasDragKind;
|
|
1371
|
+
data: EventPayload;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Orbital/trait/transition context a drop will mutate.
|
|
1375
|
+
*
|
|
1376
|
+
* Has an explicit `[key: string]: string | undefined` index signature so it
|
|
1377
|
+
* structurally matches `EventPayload` — required because we pass the whole
|
|
1378
|
+
* object as a field on the `UI:PATTERN_DROP` payload.
|
|
1379
|
+
*/
|
|
1380
|
+
interface CanvasContainerNode {
|
|
1381
|
+
orbitalName?: string;
|
|
1382
|
+
traitName?: string;
|
|
1383
|
+
transitionEvent?: string;
|
|
1384
|
+
[key: string]: string | undefined;
|
|
1385
|
+
}
|
|
1386
|
+
/** Drop-target metadata stored on each droppable's `data` field. */
|
|
1387
|
+
interface CanvasDropTarget {
|
|
1388
|
+
/**
|
|
1389
|
+
* `l1` = outer orbital frame (overview level).
|
|
1390
|
+
* `l2` = render-ui slot inside an expanded orbital.
|
|
1391
|
+
* `wrapper` = page-level catch-all fired when nothing inner caught the drop.
|
|
1392
|
+
*/
|
|
1393
|
+
level: 'l1' | 'l2' | 'wrapper' | (string & {});
|
|
1394
|
+
/** Full or partial container context this drop will mutate. */
|
|
1395
|
+
containerNode: CanvasContainerNode;
|
|
1396
|
+
/**
|
|
1397
|
+
* Optional resolver called at drop time to derive `parentPath` + `index`
|
|
1398
|
+
* from the pointer's final client position. L2 slots use this to walk the
|
|
1399
|
+
* DOM under their `contentRef` and find the nearest `data-accepts-children`
|
|
1400
|
+
* container plus the cursor-relative insertion index.
|
|
1401
|
+
*/
|
|
1402
|
+
resolvePath?: (cursor: {
|
|
1403
|
+
x: number;
|
|
1404
|
+
y: number;
|
|
1405
|
+
}) => {
|
|
1406
|
+
parentPath: string;
|
|
1407
|
+
index: number;
|
|
1408
|
+
} | null;
|
|
1409
|
+
}
|
|
1410
|
+
interface CanvasDropEvent {
|
|
1411
|
+
payload: CanvasDragPayload;
|
|
1412
|
+
target: CanvasDropTarget;
|
|
1413
|
+
/** Final pointer client position, when dnd-kit could compute it. */
|
|
1414
|
+
cursor: {
|
|
1415
|
+
x: number;
|
|
1416
|
+
y: number;
|
|
1417
|
+
} | null;
|
|
1418
|
+
/**
|
|
1419
|
+
* Resolved insertion path/index from `target.resolvePath(cursor)`. Null
|
|
1420
|
+
* when the target has no resolver or the cursor was unavailable.
|
|
1421
|
+
*/
|
|
1422
|
+
resolved: {
|
|
1423
|
+
parentPath: string;
|
|
1424
|
+
index: number;
|
|
1425
|
+
} | null;
|
|
1426
|
+
}
|
|
1427
|
+
interface UseCanvasDraggableArgs {
|
|
1428
|
+
/** Unique id (per-tile). dnd-kit uses this to track the active drag. */
|
|
1429
|
+
id: string;
|
|
1430
|
+
payload: CanvasDragPayload;
|
|
1431
|
+
disabled?: boolean;
|
|
1432
|
+
}
|
|
1433
|
+
interface UseCanvasDraggableResult {
|
|
1434
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
1435
|
+
attributes: ReturnType<typeof useDraggable>['attributes'];
|
|
1436
|
+
listeners: ReturnType<typeof useDraggable>['listeners'];
|
|
1437
|
+
isDragging: boolean;
|
|
1438
|
+
/** Spread on the tile — live transform + grab cursor + touch-action. */
|
|
1439
|
+
style: React__default.CSSProperties;
|
|
1440
|
+
}
|
|
1441
|
+
declare function useCanvasDraggable({ id, payload, disabled, }: UseCanvasDraggableArgs): UseCanvasDraggableResult;
|
|
1442
|
+
interface UseCanvasDroppableArgs {
|
|
1443
|
+
id: string;
|
|
1444
|
+
target: CanvasDropTarget;
|
|
1445
|
+
/** Which drag kinds this zone accepts. Defaults to ['pattern','behavior']. */
|
|
1446
|
+
accepts?: readonly CanvasDragKind[];
|
|
1447
|
+
disabled?: boolean;
|
|
1448
|
+
}
|
|
1449
|
+
interface UseCanvasDroppableResult {
|
|
1450
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
1451
|
+
isOver: boolean;
|
|
1452
|
+
}
|
|
1453
|
+
declare function useCanvasDroppable({ id, target, accepts, disabled, }: UseCanvasDroppableArgs): UseCanvasDroppableResult;
|
|
1454
|
+
interface CanvasDndProviderProps {
|
|
1455
|
+
children: React__default.ReactNode;
|
|
1456
|
+
/**
|
|
1457
|
+
* Override the default drop behavior. The default emits `UI:PATTERN_DROP`
|
|
1458
|
+
* / `UI:BEHAVIOR_DROP` based on payload kind. Pass an `onDrop` to route
|
|
1459
|
+
* additional kinds (e.g. `'pattern-instance'` reorder) elsewhere, or to
|
|
1460
|
+
* mutate schema directly without going through the bus.
|
|
1461
|
+
*
|
|
1462
|
+
* Return `true` from `onDrop` to suppress the default emit; return
|
|
1463
|
+
* `false`/`undefined` to fall through to defaults after running your code.
|
|
1464
|
+
*/
|
|
1465
|
+
onDrop?: (drop: CanvasDropEvent) => boolean | void;
|
|
1466
|
+
/**
|
|
1467
|
+
* Renders the floating preview that follows the cursor during a drag.
|
|
1468
|
+
* @dnd-kit moves the source DOM node via CSS transform, which gets clipped
|
|
1469
|
+
* by any ancestor with `overflow: hidden|auto|scroll` (e.g. a scrollable
|
|
1470
|
+
* palette column). Returning a node here mounts a portal-attached overlay
|
|
1471
|
+
* outside the clip so the user always sees what they're dragging.
|
|
1472
|
+
*
|
|
1473
|
+
* Receives the active payload (or null between drags) and returns the
|
|
1474
|
+
* preview element — typically the same JSX the tile renders inline.
|
|
1475
|
+
*/
|
|
1476
|
+
renderOverlay?: (payload: CanvasDragPayload | null) => React__default.ReactNode;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Wraps a canvas subtree in one DndContext + sensors + collision waterfall.
|
|
1480
|
+
* Every `useCanvasDraggable` / `useCanvasDroppable` inside this provider
|
|
1481
|
+
* participates in the same drag session.
|
|
1482
|
+
*/
|
|
1483
|
+
declare function CanvasDndProvider({ children, onDrop, renderOverlay, }: CanvasDndProviderProps): React__default.ReactElement;
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* OrbInspector
|
|
1487
|
+
*
|
|
1488
|
+
* Universal contextual inspector for .orb programs. Built into FlowCanvas.
|
|
1489
|
+
* Two tabs: Inspector (contextual sections) and Code (.orb syntax view).
|
|
1490
|
+
*
|
|
1491
|
+
* Inspector shows different sections based on what was clicked:
|
|
1492
|
+
* - Orbital header → entity fields, traits, pages
|
|
1493
|
+
* - Pattern element → pattern props, entity (if entity-aware), transition (if fires event)
|
|
1494
|
+
* - Transition node → state diagram, guard, effects, render-ui source
|
|
1495
|
+
*
|
|
1496
|
+
* Code tab shows the .orb representation of the selected context.
|
|
1497
|
+
*
|
|
1498
|
+
* When `editable` is true, inspector fields become inputs.
|
|
1499
|
+
*/
|
|
1500
|
+
|
|
1501
|
+
interface OrbInspectorProps {
|
|
1502
|
+
node: PreviewNodeData;
|
|
1503
|
+
schema: OrbitalSchema;
|
|
1504
|
+
editable?: boolean;
|
|
1505
|
+
/**
|
|
1506
|
+
* Studio persona viewing the inspector. Controls tab visibility (Code is
|
|
1507
|
+
* architect-only, Styles is universal) and section visibility (Entity,
|
|
1508
|
+
* raw guard, raw effects are architect-only). Default `'builder'` matches
|
|
1509
|
+
* pre-Phase-2 behavior except for the new Styles tab, which every persona
|
|
1510
|
+
* gets.
|
|
1511
|
+
*/
|
|
1512
|
+
userType?: 'builder' | 'designer' | 'architect';
|
|
1513
|
+
/**
|
|
1514
|
+
* Project theme tokens (Design System tab only). When provided AND the
|
|
1515
|
+
* selection originates from the synthesized `__design_system__` schema,
|
|
1516
|
+
* the Styles tab renders an editable token-row list; edits emit
|
|
1517
|
+
* `UI:PROP_CHANGE` with `propName: '__token__.<group>.<key>'` and the
|
|
1518
|
+
* page-level dispatcher routes them to `themeManifest.setToken`.
|
|
1519
|
+
*/
|
|
1520
|
+
themeManifest?: ThemeDefinition;
|
|
1521
|
+
onSchemaChange?: (schema: OrbitalSchema) => void;
|
|
1522
|
+
onClose: () => void;
|
|
1523
|
+
}
|
|
1524
|
+
declare function OrbInspector({ node, schema, editable, userType, themeManifest, onSchemaChange, onClose }: OrbInspectorProps): React__default.ReactElement;
|
|
1525
|
+
declare namespace OrbInspector {
|
|
1526
|
+
var displayName: string;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* FlowCanvas — V3 UI Projection Canvas
|
|
1531
|
+
*
|
|
1532
|
+
* The canvas IS the app. Nodes show rendered UI thumbnails from
|
|
1533
|
+
* render-ui effects. Edges show events connecting screens.
|
|
1534
|
+
*
|
|
1535
|
+
* Two navigation levels:
|
|
1536
|
+
* Level 1 (Overview): One node per orbital showing INIT UI
|
|
1537
|
+
* Level 2 (Expanded): One node per UI state within an orbital
|
|
1538
|
+
*
|
|
1539
|
+
* Double-click to expand an orbital. Click a node for code callback.
|
|
1540
|
+
* Escape to go back. AVL overlays on hover (future).
|
|
1541
|
+
*/
|
|
1542
|
+
|
|
1543
|
+
interface FlowCanvasProps {
|
|
1544
|
+
schema: OrbitalSchema | string;
|
|
1545
|
+
mockData?: EntityData;
|
|
1546
|
+
className?: string;
|
|
1547
|
+
width?: number | string;
|
|
1548
|
+
height?: number | string;
|
|
1549
|
+
onNodeClick?: (context: {
|
|
1550
|
+
level: ViewLevel | 'code' | 'transition';
|
|
1551
|
+
orbital: string;
|
|
1552
|
+
trait?: string;
|
|
1553
|
+
transition?: string;
|
|
1554
|
+
}) => void;
|
|
1555
|
+
onLevelChange?: (level: ViewLevel, orbital?: string) => void;
|
|
1556
|
+
/**
|
|
1557
|
+
* GAP-52: fired when the user double-clicks an orbital. Consumers (e.g. the
|
|
1558
|
+
* builder workspace) use this as the trigger to enter cosmic mode
|
|
1559
|
+
* (`AvlOrbitalsCosmicZoom`) for the focused orbital.
|
|
1560
|
+
*
|
|
1561
|
+
* The level at which this fires is controlled by `cosmicEntryLevel` (default
|
|
1562
|
+
* `'expanded'`). At `'expanded'` the existing overview→expanded drill is
|
|
1563
|
+
* preserved — the callback fires only on the second double-click. At
|
|
1564
|
+
* `'overview'` the callback fires on the FIRST double-click and the existing
|
|
1565
|
+
* drill is suppressed for that interaction. `'both'` fires at either level.
|
|
1566
|
+
*
|
|
1567
|
+
* The callback runs unconditionally — persona / permission gating is the
|
|
1568
|
+
* consumer's responsibility.
|
|
1569
|
+
*/
|
|
1570
|
+
onOrbitalDoubleClick?: (orbital: string) => void;
|
|
1571
|
+
/**
|
|
1572
|
+
* GAP-53: which level the `onOrbitalDoubleClick` callback fires at.
|
|
1573
|
+
* - `'expanded'` (default, non-breaking) — fires only at L2 expanded; the
|
|
1574
|
+
* first overview double-click still drills overview→expanded.
|
|
1575
|
+
* - `'overview'` — fires at L1 overview on the FIRST double-click. The
|
|
1576
|
+
* overview→expanded drill is suppressed when the callback is provided.
|
|
1577
|
+
* - `'both'` — fires at either level.
|
|
1578
|
+
*/
|
|
1579
|
+
cosmicEntryLevel?: 'expanded' | 'overview' | 'both';
|
|
1580
|
+
initialOrbital?: string;
|
|
1581
|
+
/** Start at Level 2 (expanded) when initialOrbital is set. Default: 'overview'. */
|
|
1582
|
+
initialLevel?: ViewLevel;
|
|
1583
|
+
/** Pre-select a node on mount (opens OrbInspector). */
|
|
1584
|
+
initialSelectedNode?: PreviewNodeData;
|
|
1585
|
+
/** Enable editing in the inspector. When true, fields become inputs. */
|
|
1586
|
+
editable?: boolean;
|
|
1587
|
+
/** Called when the user edits the schema via the inspector. */
|
|
1588
|
+
onSchemaChange?: (schema: OrbitalSchema) => void;
|
|
1589
|
+
/** Called when the user presses Delete/Backspace with a pattern selected. */
|
|
1590
|
+
onPatternDelete?: (context: {
|
|
1591
|
+
patternId: string;
|
|
1592
|
+
nodeData: PreviewNodeData;
|
|
1593
|
+
}) => void;
|
|
1594
|
+
/** Called when the user drags from a source handle to a target handle (event wiring). */
|
|
1595
|
+
onEventWire?: (wire: {
|
|
1596
|
+
eventName: string;
|
|
1597
|
+
sourceOrbital: string;
|
|
1598
|
+
targetOrbital: string;
|
|
1599
|
+
sourceTraitName?: string;
|
|
1600
|
+
targetTraitName?: string;
|
|
1601
|
+
}) => void;
|
|
1602
|
+
/** Behavior layer metadata for node styling (layer color bands). */
|
|
1603
|
+
behaviorMeta?: Record<string, {
|
|
1604
|
+
layer: string;
|
|
1605
|
+
}>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Per-orbital generation status. Keyed by orbital name. Drives the spinner
|
|
1608
|
+
* + accent border treatment on the overview node and (future) the hover
|
|
1609
|
+
* trace surface. Defaults to `'idle'` for missing entries. Consumers
|
|
1610
|
+
* derive this from agent subagent_start/complete SSE events.
|
|
1611
|
+
*/
|
|
1612
|
+
orbitalStatus?: Record<string, PreviewNodeData['status']>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Hover handler for overview-level orbital nodes. Fires with the orbital
|
|
1615
|
+
* name on enter and `null` on leave. Reserved for the upcoming trace
|
|
1616
|
+
* tooltip: consumers will use it to anchor a popover that shows the
|
|
1617
|
+
* subagent's live trace + reasoning for the hovered orbital.
|
|
1618
|
+
*/
|
|
1619
|
+
onOrbitalHover?: (orbitalName: string | null) => void;
|
|
1620
|
+
/** Layout hint: 'pipeline' renders nodes left-to-right, 'grid' (default) uses sqrt-based grid. */
|
|
1621
|
+
layoutHint?: 'pipeline' | 'grid';
|
|
1622
|
+
/** Called when the user clicks a node in overview level (for composition hints). */
|
|
1623
|
+
onNodeSelect?: (orbitalName: string) => void;
|
|
1624
|
+
/** When 'behavior', shows behavior-level glyph nodes instead of orbital previews. */
|
|
1625
|
+
composeLevel?: ComposeViewLevel;
|
|
1626
|
+
/** Behavior entries for compose mode (only when composeLevel='behavior'). */
|
|
1627
|
+
behaviorEntries?: BehaviorCanvasEntry[];
|
|
1628
|
+
/** Event wires between behaviors (only when composeLevel='behavior'). */
|
|
1629
|
+
behaviorWires?: BehaviorWireEdgeData[];
|
|
1630
|
+
/** @deprecated Use onNodeClick instead. Kept for AvlCosmicZoom compat. */
|
|
1631
|
+
onZoomChange?: (level: string, context: Record<string, string | undefined>) => void;
|
|
1632
|
+
/** @deprecated Not used in V3. */
|
|
1633
|
+
focusTarget?: {
|
|
1634
|
+
type: string;
|
|
1635
|
+
name: string;
|
|
1636
|
+
};
|
|
1637
|
+
/** @deprecated Not used in V3. */
|
|
1638
|
+
color?: string;
|
|
1639
|
+
/** @deprecated Not used in V3. */
|
|
1640
|
+
animated?: boolean;
|
|
1641
|
+
/** @deprecated Not used in V3. */
|
|
1642
|
+
initialTrait?: string;
|
|
1643
|
+
/** @deprecated Not used in V3. */
|
|
1644
|
+
stateCoverage?: Record<string, string>;
|
|
1645
|
+
/**
|
|
1646
|
+
* Studio persona viewing the canvas. Drives `OrbInspector` tab/section
|
|
1647
|
+
* visibility — designers and builders hide the raw `code` tab and the
|
|
1648
|
+
* architect-only Entity / raw-guard / raw-effects sections; architects see
|
|
1649
|
+
* everything. Default `'builder'` preserves pre-Phase-2 behavior.
|
|
1650
|
+
*/
|
|
1651
|
+
userType?: 'builder' | 'designer' | 'architect';
|
|
1652
|
+
/**
|
|
1653
|
+
* Project theme tokens (Design System tab only). Forwarded to `OrbInspector`
|
|
1654
|
+
* so the Styles tab can render an editable token list when the selection
|
|
1655
|
+
* originates from the synthesized `__design_system__` schema.
|
|
1656
|
+
*/
|
|
1657
|
+
themeManifest?: ThemeDefinition;
|
|
1658
|
+
}
|
|
1659
|
+
declare const FlowCanvas: React__default.FC<FlowCanvasProps>;
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* ZoomBreadcrumb — HTML overlay showing current zoom band context.
|
|
1663
|
+
*
|
|
1664
|
+
* Positioned absolute top-left of the FlowCanvas.
|
|
1665
|
+
* Shows AVL primitive icons inline with breadcrumb segments.
|
|
1666
|
+
*/
|
|
1667
|
+
|
|
1668
|
+
interface ZoomBreadcrumbProps {
|
|
1669
|
+
band: ZoomBand;
|
|
1670
|
+
applicationName?: string;
|
|
1671
|
+
orbitalName?: string;
|
|
1672
|
+
traitName?: string;
|
|
1673
|
+
eventName?: string;
|
|
1674
|
+
}
|
|
1675
|
+
declare const ZoomBreadcrumb: React__default.FC<ZoomBreadcrumbProps>;
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* ZoomLegend — Collapsible HTML overlay showing AVL primitives
|
|
1679
|
+
* relevant to the current zoom band.
|
|
1680
|
+
*/
|
|
1681
|
+
|
|
1682
|
+
interface ZoomLegendProps {
|
|
1683
|
+
band: ZoomBand;
|
|
1684
|
+
}
|
|
1685
|
+
declare const ZoomLegend: React__default.FC<ZoomLegendProps>;
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* AVL Cosmic Zoom State Machine
|
|
1689
|
+
*
|
|
1690
|
+
* useReducer-based state machine managing which zoom level is displayed,
|
|
1691
|
+
* what is selected, and animation state.
|
|
1692
|
+
*
|
|
1693
|
+
* Shared by AvlOrbitalsCosmicZoom (2D) and Avl3DViewer (3D). The 3D
|
|
1694
|
+
* viewer drills through every level (`application → orbital → trait →
|
|
1695
|
+
* transition`); the 2D cosmic view skips the `'orbital'` level after
|
|
1696
|
+
* COSMIC-1 (no Orbital-View screen) by dispatching `JUMP_TO_TRAIT_CIRCUIT`
|
|
1697
|
+
* to land directly at `'trait'`.
|
|
1698
|
+
*
|
|
1699
|
+
* @packageDocumentation
|
|
1700
|
+
*/
|
|
1701
|
+
type ZoomLevel = 'application' | 'orbital' | 'trait' | 'transition';
|
|
1702
|
+
|
|
1703
|
+
/**
|
|
1704
|
+
* AvlCosmicZoom — Interactive Orbital Visualization
|
|
1705
|
+
*
|
|
1706
|
+
* V3: Delegates to FlowCanvas. Nodes are live OrbPreview renders
|
|
1707
|
+
* of each orbital/transition. Two-level navigation (overview + expanded).
|
|
1708
|
+
* Props interface preserved for backward compatibility with callers.
|
|
1709
|
+
*/
|
|
1710
|
+
|
|
1711
|
+
interface AvlCosmicZoomProps {
|
|
1712
|
+
/** The orbital schema (parsed object or JSON string) */
|
|
1713
|
+
schema: OrbitalSchema | string;
|
|
1714
|
+
/** CSS class for the outer container */
|
|
1715
|
+
className?: string;
|
|
1716
|
+
/** Primary color for the visualization */
|
|
1717
|
+
color?: string;
|
|
1718
|
+
/** Enable animations (default: true) */
|
|
1719
|
+
animated?: boolean;
|
|
1720
|
+
/** Pre-select an orbital on mount */
|
|
1721
|
+
initialOrbital?: string;
|
|
1722
|
+
/** Pre-select a trait on mount */
|
|
1723
|
+
initialTrait?: string;
|
|
1724
|
+
/** Callback when zoom level changes */
|
|
1725
|
+
onZoomChange?: (level: ZoomLevel, context: {
|
|
1726
|
+
orbital?: string;
|
|
1727
|
+
trait?: string;
|
|
1728
|
+
}) => void;
|
|
1729
|
+
/** Container width */
|
|
1730
|
+
width?: number | string;
|
|
1731
|
+
/** Container height */
|
|
1732
|
+
height?: number | string;
|
|
1733
|
+
/** Coverage data for verification overlay */
|
|
1734
|
+
stateCoverage?: Record<string, 'covered' | 'uncovered' | 'partial'>;
|
|
1735
|
+
/** Dynamic focus target. Changes animate the zoom to the specified orbital/trait. */
|
|
1736
|
+
focusTarget?: {
|
|
1737
|
+
type: 'orbital' | 'trait';
|
|
1738
|
+
name: string;
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
declare const AvlCosmicZoom: React__default.FC<AvlCosmicZoomProps>;
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* AvlOrbitalsCosmicZoom — Orbital Interaction Visualization
|
|
1745
|
+
*
|
|
1746
|
+
* Composed organism: renders AvlOrbitalUnit molecules positioned on a canvas,
|
|
1747
|
+
* connected by cross-orbital event wire arrows. No React Flow dependency.
|
|
1748
|
+
* Designed for documentation use.
|
|
1749
|
+
*
|
|
1750
|
+
* Composition:
|
|
1751
|
+
* - AvlOrbitalUnit (molecule) for each orbital
|
|
1752
|
+
* - SVG overlay for event wires between orbitals
|
|
1753
|
+
* - Click to select an orbital and show info panel
|
|
1754
|
+
*
|
|
1755
|
+
* @packageDocumentation
|
|
1756
|
+
*/
|
|
1757
|
+
|
|
1758
|
+
interface AvlOrbitalsCosmicZoomProps {
|
|
1759
|
+
/** The orbital schema (parsed object or JSON string) */
|
|
1760
|
+
schema: OrbitalSchema | string;
|
|
1761
|
+
/** CSS class for the outer container */
|
|
1762
|
+
className?: string;
|
|
1763
|
+
/** Primary color for the visualization */
|
|
1764
|
+
color?: string;
|
|
1765
|
+
/** Enable animations (default: true) */
|
|
1766
|
+
animated?: boolean;
|
|
1767
|
+
/** Container width */
|
|
1768
|
+
width?: number | string;
|
|
1769
|
+
/** Container height */
|
|
1770
|
+
height?: number | string;
|
|
1771
|
+
/**
|
|
1772
|
+
* GAP-52: name of the orbital to highlight with a persistent ring/glow.
|
|
1773
|
+
* Independent from user-driven selection (click). Used by the builder workspace
|
|
1774
|
+
* when entering cosmic mode from a focused orbital — the focused orbital is
|
|
1775
|
+
* highlighted while the user can still click any other orbital to select it.
|
|
1776
|
+
*/
|
|
1777
|
+
highlightedOrbital?: string;
|
|
1778
|
+
/**
|
|
1779
|
+
* GAP-55: fired when the user clicks an orbital tile. Consumers (e.g. the
|
|
1780
|
+
* builder workspace) use this as the trigger to drill INTO the clicked
|
|
1781
|
+
* orbital — typically by switching back to the canvas tab and opening the
|
|
1782
|
+
* clicked orbital at L2 expanded. Local `selected` toggle (visual highlight +
|
|
1783
|
+
* info panel) still fires regardless of whether the callback is provided.
|
|
1784
|
+
*/
|
|
1785
|
+
onOrbitalSelect?: (orbital: string) => void;
|
|
1786
|
+
/**
|
|
1787
|
+
* GAP-54: minimum zoom factor when scroll-wheel zooming. Default 0.4.
|
|
1788
|
+
*/
|
|
1789
|
+
minZoom?: number;
|
|
1790
|
+
/**
|
|
1791
|
+
* GAP-54: maximum zoom factor when scroll-wheel zooming. Default 3.
|
|
1792
|
+
*/
|
|
1793
|
+
maxZoom?: number;
|
|
1794
|
+
}
|
|
1795
|
+
declare const AvlOrbitalsCosmicZoom: React__default.FC<AvlOrbitalsCosmicZoomProps>;
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* AvlTraitScene V2 - Zoom Level 3
|
|
1799
|
+
*
|
|
1800
|
+
* Left-to-right horizontal flow with color-coded states,
|
|
1801
|
+
* transition lanes, and swim lanes for emit/listen events.
|
|
1802
|
+
*/
|
|
1803
|
+
|
|
1804
|
+
interface AvlTraitSceneProps {
|
|
1805
|
+
data: TraitLevelData;
|
|
1806
|
+
color?: string;
|
|
1807
|
+
onTransitionClick?: (transitionIndex: number, position: {
|
|
1808
|
+
x: number;
|
|
1809
|
+
y: number;
|
|
1810
|
+
}) => void;
|
|
1811
|
+
}
|
|
1812
|
+
declare const AvlTraitScene: React__default.FC<AvlTraitSceneProps>;
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* AvlTransitionScene V2 - Zoom Level 4
|
|
1816
|
+
*
|
|
1817
|
+
* Card layout replacing vertical waterfall.
|
|
1818
|
+
* Reads like a spec card: from → to, trigger, guard, effects.
|
|
1819
|
+
*/
|
|
1820
|
+
|
|
1821
|
+
interface AvlTransitionSceneProps {
|
|
1822
|
+
data: TransitionLevelData;
|
|
1823
|
+
color?: string;
|
|
1824
|
+
}
|
|
1825
|
+
declare const AvlTransitionScene: React__default.FC<AvlTransitionSceneProps>;
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* AvlClickTarget
|
|
1829
|
+
*
|
|
1830
|
+
* Transparent SVG rect overlay that makes AVL atoms clickable.
|
|
1831
|
+
* AVL atoms render <g> elements which don't natively support
|
|
1832
|
+
* bounding-box click events. This wrapper adds an invisible
|
|
1833
|
+
* rect with pointer events and optional hover glow.
|
|
1834
|
+
*
|
|
1835
|
+
* @packageDocumentation
|
|
1836
|
+
*/
|
|
1837
|
+
|
|
1838
|
+
interface AvlClickTargetProps {
|
|
1839
|
+
/** Bounding box position */
|
|
1840
|
+
x: number;
|
|
1841
|
+
y: number;
|
|
1842
|
+
width: number;
|
|
1843
|
+
height: number;
|
|
1844
|
+
/** Click handler */
|
|
1845
|
+
onClick: () => void;
|
|
1846
|
+
/** Hover callback */
|
|
1847
|
+
onHover?: (hovering: boolean) => void;
|
|
1848
|
+
/** Cursor style (default: pointer) */
|
|
1849
|
+
cursor?: string;
|
|
1850
|
+
/** Glow color on hover */
|
|
1851
|
+
glowColor?: string;
|
|
1852
|
+
/** Accessible label */
|
|
1853
|
+
label?: string;
|
|
1854
|
+
/** Children (the AVL atoms to render on top) */
|
|
1855
|
+
children: React__default.ReactNode;
|
|
1856
|
+
}
|
|
1857
|
+
declare const AvlClickTarget: React__default.FC<AvlClickTargetProps>;
|
|
1858
|
+
|
|
1859
|
+
export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, type ApplicationLevelData, AvlApplication, type AvlApplicationProps, AvlBackwardEdge, type AvlBaseProps, AvlBehaviorGlyph, type AvlBehaviorGlyphProps, AvlBinding, AvlBindingEdge, type AvlBindingProps, AvlBindingRef, type AvlBindingRefProps, AvlClickTarget, type AvlClickTargetProps, AvlClosedCircuit, type AvlClosedCircuitProps, type AvlClosedCircuitState, type AvlClosedCircuitTransition, AvlCosmicZoom, type AvlCosmicZoomProps, type AvlEdgeData, AvlEffect, type AvlEffectProps, type AvlEffectType, AvlEmitListen, type AvlEmitListenProps, AvlEntity, type AvlEntityProps, AvlEvent, type AvlEventProps, AvlEventWireEdge, type AvlEventWireEdgeData, AvlExprTree, type AvlExprTreeNode, type AvlExprTreeProps, AvlField, type AvlFieldProps, AvlFieldType, type AvlFieldTypeKind, type AvlFieldTypeProps, AvlGuard, type AvlGuardProps, AvlLiteral, type AvlLiteralProps, type AvlNodeData, AvlOperator, type AvlOperatorNamespace, type AvlOperatorProps, AvlOrbital, AvlOrbitalNode, type AvlOrbitalProps, AvlOrbitalUnit, type AvlOrbitalUnitPage, type AvlOrbitalUnitProps, type AvlOrbitalUnitTrait, AvlOrbitalsCosmicZoom, type AvlOrbitalsCosmicZoomProps, AvlPage, AvlPageEdge, type AvlPageProps, AvlPersistence, type AvlPersistenceKind, type AvlPersistenceProps, AvlSExpr, type AvlSExprProps, AvlSlotMap, type AvlSlotMapProps, type AvlSlotMapSlot, AvlState, AvlStateMachine, type AvlStateMachineProps, type AvlStateMachineState, type AvlStateMachineTransition, type AvlStateProps, AvlSwimLane, type AvlSwimLaneProps, AvlTrait, type AvlTraitProps, AvlTraitScene, type AvlTraitSceneProps, AvlTransition, AvlTransitionEdge, type AvlTransitionEdgeData, AvlTransitionLane, type AvlTransitionLaneProps, type AvlTransitionProps, AvlTransitionScene, type AvlTransitionSceneProps, type BehaviorCanvasEntry, BehaviorComposeNode, type BehaviorComposeNodeData, type BehaviorGlyphChild, type BehaviorGlyphConnection, type BehaviorLevel, type BehaviorRegistryRecord, BehaviorView, type BehaviorWireEdgeData, CONNECTION_COLORS, type CanvasContainerNode, CanvasDndProvider, type CanvasDndProviderProps, type CanvasDragKind, type CanvasDragPayload, type CanvasDropEvent, type CanvasDropTarget, type ComposeViewLevel, type ConnectableEvent, type CrossLink, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, type EffectCategory, type ElkLayout, type EventEdgeData, EventFlowEdge, FlowCanvas, type FlowCanvasProps, type GlyphSize, type LayoutEdge, type LayoutNode, MiniStateMachine, ModuleCard, OrbInspector, type OrbInspectorProps, OrbPreviewNode, type OrbitalLevelData, type PatternEventSource, type PreviewNodeData, type RenderUIEntry, STATE_COLORS, type StateRole, SystemNode, type TraitLevelData, type TransitionLevelData, type UseCanvasDraggableArgs, type UseCanvasDraggableResult, type UseCanvasDroppableArgs, type UseCanvasDroppableResult, type ViewLevel, ZOOM_BAND_THRESHOLDS, type ZoomBand, ZoomBandContext, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, type ZoomLevel, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, deriveEditFocusFromElement, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useCanvasDraggable, useCanvasDroppable, useZoomBand, zoomProgress };
|