@almadar/ui 2.45.0 → 2.46.1

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.
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { OrbitalSchema, UISlot, Expression } from '@almadar/core';
3
+ import { OrbitalSchema, UISlot, Expression, EntityPersistence, EventPayloadField } from '@almadar/core';
4
4
  import { Node, Edge, NodeProps, EdgeProps } from '@xyflow/react';
5
5
 
6
6
  /**
@@ -851,6 +851,12 @@ interface PatternEventSource {
851
851
  path: string;
852
852
  /** Vertical position hint (0..1) for handle placement on the node. */
853
853
  positionHint: number;
854
+ /** Typed payload fields if this event carries data. */
855
+ payloadFields?: Array<{
856
+ name: string;
857
+ type: string;
858
+ required?: boolean;
859
+ }>;
854
860
  }
855
861
  /** A slot + pattern config pair extracted from a render-ui effect. */
856
862
  interface RenderUIEntry {
@@ -882,6 +888,8 @@ interface PreviewNodeData extends Record<string, unknown> {
882
888
  * to connect from the specific button/link to the target screen.
883
889
  */
884
890
  eventSources: PatternEventSource[];
891
+ /** Behavior layer for visual indicator (color band). */
892
+ layer?: string;
885
893
  /** State role for visual indicator. */
886
894
  stateRole?: 'initial' | 'terminal' | 'hub' | 'error' | 'default';
887
895
  /** All effect types on this transition (for overlay). */
@@ -938,7 +946,9 @@ interface EventEdgeData extends Record<string, unknown> {
938
946
  * Build a React Flow graph for the overview level.
939
947
  * Each orbital gets one node showing its INIT transition's UI.
940
948
  */
941
- declare function schemaToOverviewGraph(schema: OrbitalSchema, mockData?: Record<string, unknown[]>): {
949
+ declare function schemaToOverviewGraph(schema: OrbitalSchema, mockData?: Record<string, unknown[]>, behaviorMeta?: Record<string, {
950
+ layer: string;
951
+ }>, layoutHint?: 'pipeline' | 'grid'): {
942
952
  nodes: Node<PreviewNodeData>[];
943
953
  edges: Edge<EventEdgeData>[];
944
954
  };
@@ -980,6 +990,171 @@ declare const OrbPreviewNode: React__default.NamedExoticComponent<NodeProps>;
980
990
 
981
991
  declare const EventFlowEdge: React__default.NamedExoticComponent<EdgeProps>;
982
992
 
993
+ /**
994
+ * AVL Behavior Compose Types
995
+ *
996
+ * Types for behavior-level composition canvas.
997
+ * At this level, each node represents a BEHAVIOR (not an orbital).
998
+ * A behavior is a higher-level unit: atom (1 orbital), molecule (1 orbital
999
+ * with composed traits), or organism (multiple orbitals).
1000
+ *
1001
+ * Three navigation levels:
1002
+ * Behavior (compose): One node per behavior showing AvlBehaviorGlyph
1003
+ * Overview: One node per orbital showing live UI (OrbPreviewNode)
1004
+ * Expanded: One node per UI state within an orbital (OrbPreviewNode)
1005
+ */
1006
+
1007
+ /** Extended view level adding 'behavior' to the existing overview/expanded. */
1008
+ type ComposeViewLevel = 'behavior' | 'overview' | 'expanded';
1009
+ /** An event that can be wired between behaviors. */
1010
+ interface ConnectableEvent {
1011
+ /** Event name (e.g., "ADD_TO_CART"). */
1012
+ event: string;
1013
+ /** Typed payload fields if declared. */
1014
+ payloadFields?: EventPayloadField[];
1015
+ /** Vertical position hint (0..1) for handle placement on the node. */
1016
+ positionHint: number;
1017
+ }
1018
+ /** Data for a BehaviorComposeNode in React Flow. */
1019
+ interface BehaviorComposeNodeData extends Record<string, unknown> {
1020
+ /** Behavior name from registry (e.g., "std-cart"). */
1021
+ behaviorName: string;
1022
+ /** Composition level: atom, molecule, organism. */
1023
+ level: BehaviorLevel;
1024
+ /** Domain for color coding (e.g., "commerce"). */
1025
+ domain?: string;
1026
+ /** Layer classification (e.g., "Domain", "UI Patterns"). */
1027
+ layer?: string;
1028
+ /** Primary entity name (e.g., "CartItem"). */
1029
+ entityName: string;
1030
+ /** Number of states in the behavior. */
1031
+ stateCount: number;
1032
+ /** Number of entity fields. */
1033
+ fieldCount?: number;
1034
+ /** Persistence kind. */
1035
+ persistence?: EntityPersistence;
1036
+ /** Effect types used by this behavior. */
1037
+ effectTypes?: AvlEffectType[];
1038
+ /** Child behaviors for molecule/organism glyphs. */
1039
+ children?: BehaviorGlyphChild[];
1040
+ /** Connections between children (for organism glyphs). */
1041
+ connections?: BehaviorGlyphConnection[];
1042
+ /** Events this behavior can emit (source handles). */
1043
+ connectableEvents: ConnectableEvent[];
1044
+ /** Behaviors this is composable with (for palette hints). */
1045
+ composableWith?: string[];
1046
+ /** Names of orbitals produced by this behavior (for drill-down). */
1047
+ orbitalNames: string[];
1048
+ }
1049
+ /** Edge data for behavior-level wiring. */
1050
+ interface BehaviorWireEdgeData extends Record<string, unknown> {
1051
+ /** The event name displayed on the edge. */
1052
+ event: string;
1053
+ /** Source behavior name. */
1054
+ sourceBehavior: string;
1055
+ /** Target behavior name. */
1056
+ targetBehavior: string;
1057
+ /** Typed payload fields if declared. */
1058
+ payloadFields?: EventPayloadField[];
1059
+ }
1060
+ /** Mapping from behavior name to its metadata + produced orbitals. */
1061
+ interface BehaviorCanvasEntry {
1062
+ /** Behavior name (e.g., "std-cart"). */
1063
+ behaviorName: string;
1064
+ /** Composition level. */
1065
+ level: BehaviorLevel;
1066
+ /** Domain for color coding. */
1067
+ domain?: string;
1068
+ /** Layer classification. */
1069
+ layer?: string;
1070
+ /** Primary entity name. */
1071
+ entityName: string;
1072
+ /** Number of states. */
1073
+ stateCount: number;
1074
+ /** Number of entity fields. */
1075
+ fieldCount?: number;
1076
+ /** Persistence kind. */
1077
+ persistence?: EntityPersistence;
1078
+ /** Effect types used. */
1079
+ effectTypes?: AvlEffectType[];
1080
+ /** Child behaviors (molecule/organism). */
1081
+ children?: BehaviorGlyphChild[];
1082
+ /** Connections between children (organism). */
1083
+ connections?: BehaviorGlyphConnection[];
1084
+ /** Events available for wiring. */
1085
+ connectableEvents: ConnectableEvent[];
1086
+ /** Compatible behavior names. */
1087
+ composableWith?: string[];
1088
+ /** Orbital names produced by this behavior (for drill-down mapping). */
1089
+ orbitalNames: string[];
1090
+ }
1091
+
1092
+ /**
1093
+ * BehaviorComposeNode
1094
+ *
1095
+ * React Flow custom node for behavior-level composition.
1096
+ * Shows AvlBehaviorGlyph instead of live UI (OrbPreview).
1097
+ * Each behavior is one compact node with event handles for wiring.
1098
+ *
1099
+ * This is the compose-level node. Double-clicking drills into
1100
+ * the orbital-level view (OrbPreviewNode).
1101
+ */
1102
+
1103
+ declare const BehaviorComposeNode: React__default.NamedExoticComponent<NodeProps>;
1104
+
1105
+ /**
1106
+ * AVL Behavior Compose Converter
1107
+ *
1108
+ * Converts BehaviorCanvasEntry[] to React Flow nodes and edges
1109
+ * for the behavior-level composition canvas.
1110
+ *
1111
+ * Parallel to avl-preview-converter.ts which works at the orbital level.
1112
+ * This works one level higher: each node is a behavior (not an orbital).
1113
+ */
1114
+
1115
+ /**
1116
+ * Build a React Flow graph for behavior-level composition.
1117
+ * Each behavior entry becomes one BehaviorComposeNode.
1118
+ */
1119
+ declare function behaviorsToComposeGraph(entries: BehaviorCanvasEntry[], wires: BehaviorWireEdgeData[], layoutHint?: 'pipeline' | 'grid'): {
1120
+ nodes: Node<BehaviorComposeNodeData>[];
1121
+ edges: Edge<BehaviorWireEdgeData>[];
1122
+ };
1123
+ /** Registry record shape (matches behaviors-registry.json entries). */
1124
+ interface BehaviorRegistryRecord {
1125
+ name: string;
1126
+ level: 'atom' | 'molecule' | 'organism';
1127
+ family: string;
1128
+ layer: string;
1129
+ description: string;
1130
+ complexity: {
1131
+ states: number;
1132
+ events: number;
1133
+ transitions: number;
1134
+ };
1135
+ defaultEntity: {
1136
+ name: string;
1137
+ persistence?: string;
1138
+ fields: Array<{
1139
+ name: string;
1140
+ type: string;
1141
+ required?: boolean;
1142
+ }>;
1143
+ };
1144
+ connectableEvents: string[];
1145
+ eventPayloads: Record<string, Array<{
1146
+ name: string;
1147
+ type: string;
1148
+ required?: boolean;
1149
+ }>>;
1150
+ composableWith: string[];
1151
+ }
1152
+ /**
1153
+ * Convert a registry entry to a BehaviorCanvasEntry.
1154
+ * Maps connectableEvents + eventPayloads into typed ConnectableEvent[].
1155
+ */
1156
+ declare function registryEntryToCanvasEntry(entry: BehaviorRegistryRecord, orbitalNames: string[]): BehaviorCanvasEntry;
1157
+
983
1158
  /**
984
1159
  * OrbInspector
985
1160
  *
@@ -1057,6 +1232,20 @@ interface FlowCanvasProps {
1057
1232
  sourceTraitName?: string;
1058
1233
  targetTraitName?: string;
1059
1234
  }) => void;
1235
+ /** Behavior layer metadata for node styling (layer color bands). */
1236
+ behaviorMeta?: Record<string, {
1237
+ layer: string;
1238
+ }>;
1239
+ /** Layout hint: 'pipeline' renders nodes left-to-right, 'grid' (default) uses sqrt-based grid. */
1240
+ layoutHint?: 'pipeline' | 'grid';
1241
+ /** Called when the user clicks a node in overview level (for composition hints). */
1242
+ onNodeSelect?: (orbitalName: string) => void;
1243
+ /** When 'behavior', shows behavior-level glyph nodes instead of orbital previews. */
1244
+ composeLevel?: ComposeViewLevel;
1245
+ /** Behavior entries for compose mode (only when composeLevel='behavior'). */
1246
+ behaviorEntries?: BehaviorCanvasEntry[];
1247
+ /** Event wires between behaviors (only when composeLevel='behavior'). */
1248
+ behaviorWires?: BehaviorWireEdgeData[];
1060
1249
  /** @deprecated Use onNodeClick instead. Kept for AvlCosmicZoom compat. */
1061
1250
  onZoomChange?: (level: string, context: Record<string, string | undefined>) => void;
1062
1251
  /** @deprecated Not used in V3. */
@@ -1213,4 +1402,4 @@ interface AvlClickTargetProps {
1213
1402
  }
1214
1403
  declare const AvlClickTarget: React__default.FC<AvlClickTargetProps>;
1215
1404
 
1216
- 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, 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 BehaviorGlyphChild, type BehaviorGlyphConnection, type BehaviorLevel, BehaviorView, CONNECTION_COLORS, 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 ViewLevel, ZOOM_BAND_THRESHOLDS, type ZoomBand, ZoomBandContext, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, type ZoomLevel, arcPath, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useZoomBand, zoomProgress };
1405
+ 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, 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 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 ViewLevel, ZOOM_BAND_THRESHOLDS, type ZoomBand, ZoomBandContext, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, type ZoomLevel, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useZoomBand, zoomProgress };
@@ -55,5 +55,8 @@ export { type ViewLevel, type PreviewNodeData, type EventEdgeData, type PatternE
55
55
  export { schemaToOverviewGraph, orbitalToExpandedGraph } from '../components/molecules/avl/avl-preview-converter';
56
56
  export { OrbPreviewNode } from '../components/molecules/avl/OrbPreviewNode';
57
57
  export { EventFlowEdge } from '../components/molecules/avl/EventFlowEdge';
58
+ export { type ComposeViewLevel, type BehaviorComposeNodeData, type BehaviorWireEdgeData, type BehaviorCanvasEntry, type ConnectableEvent } from '../components/molecules/avl/avl-behavior-compose-types';
59
+ export { BehaviorComposeNode } from '../components/molecules/avl/BehaviorComposeNode';
60
+ export { behaviorsToComposeGraph, registryEntryToCanvasEntry, type BehaviorRegistryRecord } from '../components/molecules/avl/avl-behavior-compose-converter';
58
61
  export { OrbInspector, type OrbInspectorProps } from '../components/organisms/avl/OrbInspector';
59
62
  export { FlowCanvas, type FlowCanvasProps, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, AvlCosmicZoom, type AvlCosmicZoomProps, AvlTraitScene, type AvlTraitSceneProps, AvlTransitionScene, type AvlTransitionSceneProps, AvlClickTarget, type AvlClickTargetProps, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, type ApplicationLevelData, type OrbitalLevelData, type TraitLevelData, type TransitionLevelData, type CrossLink, type ZoomLevel, } from '../components/organisms/avl';