@almadar/ui 2.27.3 → 2.27.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/components/atoms/flow/FlowLabel.d.ts +23 -0
  2. package/dist/components/atoms/flow/FlowMinimap.d.ts +28 -0
  3. package/dist/components/atoms/flow/FlowNodeShell.d.ts +25 -0
  4. package/dist/components/atoms/flow/FlowPort.d.ts +26 -0
  5. package/dist/components/atoms/flow/FlowWire.d.ts +39 -0
  6. package/dist/components/atoms/flow/index.d.ts +13 -0
  7. package/dist/components/atoms/index.d.ts +1 -0
  8. package/dist/components/index.cjs +1744 -1017
  9. package/dist/components/index.js +853 -141
  10. package/dist/components/molecules/avl/AvlBehaviorGlyph.d.ts +61 -0
  11. package/dist/components/molecules/avl/index.d.ts +1 -0
  12. package/dist/components/molecules/flow/BehaviorNode.d.ts +28 -0
  13. package/dist/components/molecules/flow/EffectNode.d.ts +26 -0
  14. package/dist/components/molecules/flow/EventWireEdge.d.ts +23 -0
  15. package/dist/components/molecules/flow/ExprNode.d.ts +27 -0
  16. package/dist/components/molecules/flow/FlowStateNode.d.ts +18 -0
  17. package/dist/components/molecules/flow/NodePalette.d.ts +36 -0
  18. package/dist/components/molecules/flow/OrbitalNode.d.ts +31 -0
  19. package/dist/components/molecules/flow/TransitionEdge.d.ts +26 -0
  20. package/dist/components/molecules/flow/index.d.ts +8 -0
  21. package/dist/components/molecules/index.d.ts +1 -0
  22. package/dist/flow/index.cjs +3832 -0
  23. package/dist/flow/index.d.cts +367 -0
  24. package/dist/flow/index.d.ts +10 -0
  25. package/dist/flow/index.js +3793 -0
  26. package/dist/providers/index.cjs +145 -143
  27. package/dist/providers/index.js +43 -41
  28. package/dist/runtime/index.cjs +978 -920
  29. package/dist/runtime/index.js +204 -146
  30. package/package.json +7 -1
@@ -0,0 +1,367 @@
1
+ import React from 'react';
2
+ import { NodeProps, Node, EdgeProps, Edge } from '@xyflow/react';
3
+ import { State } from '@almadar/core';
4
+
5
+ /**
6
+ * FlowPort Component
7
+ *
8
+ * Connection point rendered on a graph node. Shows a small circle that
9
+ * indicates whether the port is connected or available for wiring.
10
+ * Direction determines label placement (left for inputs, right for outputs).
11
+ */
12
+
13
+ interface FlowPortProps {
14
+ /** Whether this port receives or sends connections. */
15
+ direction: 'in' | 'out';
16
+ /** Semantic type of the port (e.g. "string", "event", "entity"). */
17
+ portType: string;
18
+ /** Human-readable label shown beside the circle. */
19
+ label?: string;
20
+ /** Whether the port currently has a wire attached. */
21
+ connected?: boolean;
22
+ /** Whether a dragged wire is compatible with this port. */
23
+ compatible?: boolean;
24
+ className?: string;
25
+ }
26
+ /**
27
+ * A 12px circle with optional label indicating a node connection point.
28
+ * Outlined when disconnected, filled primary when connected, green ring when compatible.
29
+ */
30
+ declare const FlowPort: React.FC<FlowPortProps>;
31
+
32
+ /**
33
+ * FlowNodeShell Component
34
+ *
35
+ * Outer container for a graph node. Provides the card-like wrapper with a
36
+ * thin colored header bar, optional node-type label, and selection / warning
37
+ * ring states. Children are rendered in the body area below the header.
38
+ */
39
+
40
+ interface FlowNodeShellProps {
41
+ /** Whether this node is currently selected on the canvas. */
42
+ selected?: boolean;
43
+ /** Whether this node has a validation warning. */
44
+ warning?: boolean;
45
+ /** Semantic node type label shown in the header (e.g. "Entity", "Trait"). */
46
+ nodeType?: string;
47
+ /** Background color for the 8px header bar. Any valid CSS color. */
48
+ headerColor?: string;
49
+ children: React.ReactNode;
50
+ className?: string;
51
+ }
52
+ /**
53
+ * Card-style wrapper for flow nodes with a colored header strip.
54
+ * Selection adds a solid primary ring; warnings show a dashed warning ring.
55
+ */
56
+ declare const FlowNodeShell: React.FC<FlowNodeShellProps>;
57
+
58
+ /**
59
+ * FlowLabel Component
60
+ *
61
+ * A pill-shaped label used on flow wires (edges) to annotate transitions,
62
+ * events, or guards. Supports truncation with a native title tooltip and
63
+ * semantic color variants.
64
+ */
65
+
66
+ type FlowLabelVariant = 'default' | 'primary' | 'warning' | 'error';
67
+ interface FlowLabelProps {
68
+ /** Text content of the label. */
69
+ text: string;
70
+ /** Max visible character count before truncation. Omit to show full text. */
71
+ truncate?: number;
72
+ /** Color variant mapping to Badge semantics. */
73
+ variant?: FlowLabelVariant;
74
+ className?: string;
75
+ }
76
+ /**
77
+ * Badge-based pill label for annotating wires in a flow graph.
78
+ * Long text is truncated with an ellipsis and full text appears on hover via title.
79
+ */
80
+ declare const FlowLabel: React.FC<FlowLabelProps>;
81
+
82
+ /**
83
+ * FlowWire Component
84
+ *
85
+ * Provides style objects and an SVG `<path>` wrapper for flow-graph edges.
86
+ * Wire colors come from the AVL CONNECTION_COLORS palette. The exported
87
+ * `getFlowWireStyle` helper can be used independently of the component
88
+ * (e.g. when integrating with React Flow edge renderers).
89
+ */
90
+
91
+ type FlowWireType = 'transition' | 'event' | 'data' | 'guard';
92
+ type FlowWireStatus = 'valid' | 'invalid' | 'pending';
93
+ interface FlowWireProps {
94
+ /** Semantic wire category. Determines base color. */
95
+ wireType?: FlowWireType;
96
+ /** Validation or runtime status. 'invalid' overrides color to red. */
97
+ status?: FlowWireStatus;
98
+ /** Whether the wire shows a flowing dash animation. */
99
+ animated?: boolean;
100
+ /** SVG path data string (the "d" attribute). */
101
+ d?: string;
102
+ className?: string;
103
+ }
104
+ interface FlowWireStyle {
105
+ stroke: string;
106
+ strokeWidth: number;
107
+ strokeDasharray?: string;
108
+ animation?: string;
109
+ }
110
+ /**
111
+ * Compute SVG path style props for a flow wire.
112
+ *
113
+ * @returns An object suitable for spreading onto an SVG `<path>` element's style.
114
+ */
115
+ declare function getFlowWireStyle(props: Pick<FlowWireProps, 'wireType' | 'status' | 'animated'>): FlowWireStyle;
116
+ /**
117
+ * SVG path element styled as a flow wire.
118
+ * Pass the `d` prop with a path data string for rendering.
119
+ */
120
+ declare const FlowWire: React.FC<FlowWireProps>;
121
+
122
+ /**
123
+ * FlowMinimap Component
124
+ *
125
+ * A styled container that wraps a React Flow MiniMap at the organism level.
126
+ * Since atoms must not depend on React Flow, this component only provides the
127
+ * card-styled wrapper box and exports a color config object that organisms pass
128
+ * through to the MiniMap props.
129
+ */
130
+
131
+ interface FlowMinimapProps {
132
+ /** Additional class names applied to the wrapper. */
133
+ className?: string;
134
+ children?: React.ReactNode;
135
+ }
136
+ /**
137
+ * Color tokens for the React Flow MiniMap component.
138
+ * Organisms import this and spread it onto `<MiniMap {...MINIMAP_COLORS} />`.
139
+ */
140
+ declare const MINIMAP_COLORS: {
141
+ readonly nodeColor: "var(--color-primary, #3B82F6)";
142
+ readonly maskColor: "var(--color-background, #ffffff80)";
143
+ readonly nodeStrokeColor: "var(--color-border, #E5E7EB)";
144
+ };
145
+ /**
146
+ * Card-styled wrapper for the React Flow MiniMap.
147
+ * Render the actual `<MiniMap>` component as children at the organism level.
148
+ */
149
+ declare const FlowMinimap: React.FC<FlowMinimapProps>;
150
+
151
+ /**
152
+ * FlowStateNode Component
153
+ *
154
+ * Custom React Flow node for a state machine state.
155
+ * Renders a FlowNodeShell with role-based header color, state name,
156
+ * and initial/terminal badges. Handles are placed at top (target)
157
+ * and bottom (source) for vertical transition wiring.
158
+ */
159
+
160
+ /** React Flow node type for state machine states, backed by @almadar/core State. */
161
+ type StateFlowNode = Node<State & Record<string, unknown>, 'state'>;
162
+ /**
163
+ * React Flow custom node that visualises a single state machine state.
164
+ * Uses STATE_COLORS for the header bar and shows role badges.
165
+ */
166
+ declare const FlowStateNode: React.FC<NodeProps<StateFlowNode>>;
167
+
168
+ /**
169
+ * OrbitalNode Component
170
+ *
171
+ * Custom React Flow node for an orbital unit. Displays entity name,
172
+ * trait/page counts, and per-event Handles for emit (source, right)
173
+ * and listen (target, left) wiring.
174
+ */
175
+
176
+ /** Data shape for orbital flow nodes, extending Record<string, unknown> for React Flow v12. */
177
+ interface OrbitalNodeData extends Record<string, unknown> {
178
+ /** Orbital unit name. */
179
+ name: string;
180
+ /** Primary entity name. */
181
+ entityName: string;
182
+ /** Number of traits attached. */
183
+ traitCount: number;
184
+ /** Number of pages attached. */
185
+ pageCount: number;
186
+ /** Events this orbital emits. */
187
+ emits: string[];
188
+ /** Events this orbital listens for. */
189
+ listens: string[];
190
+ }
191
+ /** React Flow node type for orbital units. */
192
+ type OrbitalFlowNode = Node<OrbitalNodeData, 'orbital'>;
193
+ /**
194
+ * React Flow custom node for an orbital unit showing entity info,
195
+ * trait/page stats, and per-event connection handles.
196
+ */
197
+ declare const OrbitalNode: React.FC<NodeProps<OrbitalFlowNode>>;
198
+
199
+ /**
200
+ * BehaviorNode Component
201
+ *
202
+ * Custom React Flow node for a standard behavior. Shows name,
203
+ * truncated description, state count, and per-event Handles for
204
+ * emit (source, right) and listen (target, left) wiring.
205
+ */
206
+
207
+ /** Data shape for behavior flow nodes, extending Record<string, unknown> for React Flow v12. */
208
+ interface BehaviorNodeData extends Record<string, unknown> {
209
+ /** Behavior name (e.g. "std-cart"). */
210
+ name: string;
211
+ /** Optional description, truncated after 60 chars. */
212
+ description?: string;
213
+ /** Number of states in this behavior. */
214
+ stateCount: number;
215
+ /** Events this behavior emits. */
216
+ emits: string[];
217
+ /** Events this behavior listens for. */
218
+ listens: string[];
219
+ }
220
+ /** React Flow node type for behavior nodes. */
221
+ type BehaviorFlowNode = Node<BehaviorNodeData, 'behavior'>;
222
+ /**
223
+ * React Flow custom node for a standard behavior with event port handles.
224
+ */
225
+ declare const BehaviorNode: React.FC<NodeProps<BehaviorFlowNode>>;
226
+
227
+ type AvlOperatorNamespace = 'arithmetic' | 'comparison' | 'logic' | 'string' | 'collection' | 'time' | 'control' | 'async';
228
+ type EffectCategory = 'ui' | 'data' | 'communication' | 'lifecycle' | 'control';
229
+
230
+ /**
231
+ * ExprNode Component
232
+ *
233
+ * Custom React Flow node for an S-expression operator.
234
+ * Shows the operator name in namespace-colored FlowNodeShell,
235
+ * with one target Handle per operand (left, staggered) and
236
+ * one source Handle for the result (right).
237
+ */
238
+
239
+ /** Data shape for expression flow nodes, extending Record<string, unknown> for React Flow v12. */
240
+ interface ExprNodeData extends Record<string, unknown> {
241
+ /** Operator name (e.g. "+", "concat", "if"). */
242
+ operator: string;
243
+ /** Operator namespace for color coding. */
244
+ namespace?: AvlOperatorNamespace;
245
+ /** Number of operand inputs. */
246
+ operandCount: number;
247
+ }
248
+ /** React Flow node type for S-expression operator nodes. */
249
+ type ExprFlowNode = Node<ExprNodeData, 'expr'>;
250
+ /**
251
+ * React Flow custom node visualising an S-expression operator.
252
+ * Operand handles fan out vertically on the left; result exits right.
253
+ */
254
+ declare const ExprNode: React.FC<NodeProps<ExprFlowNode>>;
255
+
256
+ /**
257
+ * EffectNode Component
258
+ *
259
+ * Custom React Flow node for an effect in a transition.
260
+ * Shows the effect type with a category-colored header and
261
+ * optional args caption. One target Handle (left) for input,
262
+ * one source Handle (right) for chain output.
263
+ */
264
+
265
+ /** Data shape for effect flow nodes, extending Record<string, unknown> for React Flow v12. */
266
+ interface EffectNodeData extends Record<string, unknown> {
267
+ /** Effect type identifier (e.g. "render-ui", "set", "emit"). */
268
+ effectType: string;
269
+ /** Optional stringified args summary. */
270
+ args?: string;
271
+ /** Category override. Derived from effectType when omitted. */
272
+ category?: EffectCategory;
273
+ }
274
+ /** React Flow node type for effect nodes in transition chains. */
275
+ type EffectFlowNode = Node<EffectNodeData, 'effect'>;
276
+ /**
277
+ * React Flow custom node for an effect in a transition chain.
278
+ */
279
+ declare const EffectNode: React.FC<NodeProps<EffectFlowNode>>;
280
+
281
+ /**
282
+ * TransitionEdge Component
283
+ *
284
+ * Custom React Flow edge for state machine transitions.
285
+ * Uses a Bezier path with a FlowLabel pill at the midpoint showing
286
+ * the event name. Guard (diamond) and effect indicators are shown
287
+ * as small inline icons beside the label.
288
+ */
289
+
290
+ /** Data shape for transition flow edges, extending Record<string, unknown> for React Flow v12. */
291
+ interface TransitionEdgeData extends Record<string, unknown> {
292
+ /** Triggering event name. */
293
+ event: string;
294
+ /** Whether this transition has a guard condition. */
295
+ hasGuard?: boolean;
296
+ /** Whether this transition has effects attached. */
297
+ hasEffects?: boolean;
298
+ }
299
+ /** React Flow edge type for state machine transitions. */
300
+ type TransitionFlowEdge = Edge<TransitionEdgeData, 'transition'>;
301
+ /**
302
+ * React Flow custom edge that renders a Bezier curve with an event label pill.
303
+ * Guard and effect presence are shown as small indicator icons.
304
+ */
305
+ declare const TransitionEdge: React.FC<EdgeProps<TransitionFlowEdge>>;
306
+
307
+ /**
308
+ * EventWireEdge Component
309
+ *
310
+ * Custom React Flow edge for event wiring between orbitals/behaviors.
311
+ * Renders a dashed orange Bezier path (from CONNECTION_COLORS.emitListen)
312
+ * with a FlowLabel pill at the midpoint. Incompatible wires turn red.
313
+ */
314
+
315
+ /** Data shape for event wire flow edges, extending Record<string, unknown> for React Flow v12. */
316
+ interface EventWireEdgeData extends Record<string, unknown> {
317
+ /** Event name being wired. */
318
+ event: string;
319
+ /** Whether emitter and listener schemas are compatible. */
320
+ compatible?: boolean;
321
+ }
322
+ /** React Flow edge type for emit/listen event wiring. */
323
+ type EventWireFlowEdge = Edge<EventWireEdgeData, 'eventWire'>;
324
+ /**
325
+ * React Flow custom edge for emit/listen event wiring.
326
+ * Dashed orange when compatible, dashed red when incompatible.
327
+ */
328
+ declare const EventWireEdge: React.FC<EdgeProps<EventWireFlowEdge>>;
329
+
330
+ /**
331
+ * NodePalette Component
332
+ *
333
+ * Draggable node type sidebar for a flow editor. Renders categories of
334
+ * tiles that can be dragged onto a React Flow canvas. Each tile sets
335
+ * `application/reactflow` data on the drag transfer so the canvas
336
+ * `onDrop` handler knows which node type to create.
337
+ *
338
+ * This is a pure HTML component with no React Flow imports.
339
+ */
340
+
341
+ interface NodePaletteItem {
342
+ /** Node type identifier set on the drag transfer. */
343
+ type: string;
344
+ /** Human-readable label shown on the tile. */
345
+ label: string;
346
+ /** Lucide icon name for the tile. */
347
+ icon: string;
348
+ }
349
+ interface NodePaletteCategory {
350
+ /** Category heading. */
351
+ name: string;
352
+ /** Draggable items in this category. */
353
+ items: NodePaletteItem[];
354
+ }
355
+ interface NodePaletteProps {
356
+ /** Grouped node types available for dragging. */
357
+ categories: NodePaletteCategory[];
358
+ /** Additional CSS classes on the outer container. */
359
+ className?: string;
360
+ }
361
+ /**
362
+ * Sidebar palette of draggable node tiles grouped by category.
363
+ * Drag a tile onto a ReactFlow canvas to create that node type.
364
+ */
365
+ declare const NodePalette: React.FC<NodePaletteProps>;
366
+
367
+ export { type BehaviorFlowNode, BehaviorNode, type BehaviorNodeData, type EffectFlowNode, EffectNode, type EffectNodeData, EventWireEdge, type EventWireEdgeData, type EventWireFlowEdge, type ExprFlowNode, ExprNode, type ExprNodeData, FlowLabel, type FlowLabelProps, type FlowLabelVariant, FlowMinimap, type FlowMinimapProps, FlowNodeShell, type FlowNodeShellProps, FlowPort, type FlowPortProps, FlowStateNode, FlowWire, type FlowWireProps, type FlowWireStatus, type FlowWireStyle, type FlowWireType, MINIMAP_COLORS, NodePalette, type NodePaletteCategory, type NodePaletteProps, type OrbitalFlowNode, OrbitalNode, type OrbitalNodeData, type StateFlowNode, TransitionEdge, type TransitionEdgeData, type TransitionFlowEdge, getFlowWireStyle };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @almadar/ui/flow
3
+ *
4
+ * OrbitalFlow — React Flow-based interactive graph editor for .orb structures.
5
+ * Atoms are pure visual primitives. Molecules are custom React Flow node/edge types.
6
+ */
7
+ export { FlowPort, type FlowPortProps, FlowNodeShell, type FlowNodeShellProps, FlowLabel, type FlowLabelProps, type FlowLabelVariant, FlowWire, type FlowWireProps, type FlowWireType, type FlowWireStatus, type FlowWireStyle, getFlowWireStyle, FlowMinimap, type FlowMinimapProps, MINIMAP_COLORS, } from '../components/atoms/flow';
8
+ export { FlowStateNode, type StateFlowNode, OrbitalNode, type OrbitalNodeData, type OrbitalFlowNode, BehaviorNode, type BehaviorNodeData, type BehaviorFlowNode, ExprNode, type ExprNodeData, type ExprFlowNode, EffectNode, type EffectNodeData, type EffectFlowNode, } from '../components/molecules/flow';
9
+ export { TransitionEdge, type TransitionEdgeData, type TransitionFlowEdge, EventWireEdge, type EventWireEdgeData, type EventWireFlowEdge, } from '../components/molecules/flow';
10
+ export { NodePalette, type NodePaletteProps, type NodePaletteCategory, } from '../components/molecules/flow';