@almadar/ui 2.43.0 → 2.46.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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * BehaviorComposeNode
3
+ *
4
+ * React Flow custom node for behavior-level composition.
5
+ * Shows AvlBehaviorGlyph instead of live UI (OrbPreview).
6
+ * Each behavior is one compact node with event handles for wiring.
7
+ *
8
+ * This is the compose-level node. Double-clicking drills into
9
+ * the orbital-level view (OrbPreviewNode).
10
+ */
11
+ import React from 'react';
12
+ import { type NodeProps } from '@xyflow/react';
13
+ export declare const BehaviorComposeNode: React.NamedExoticComponent<NodeProps>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * AVL Behavior Compose Converter
3
+ *
4
+ * Converts BehaviorCanvasEntry[] to React Flow nodes and edges
5
+ * for the behavior-level composition canvas.
6
+ *
7
+ * Parallel to avl-preview-converter.ts which works at the orbital level.
8
+ * This works one level higher: each node is a behavior (not an orbital).
9
+ */
10
+ import type { Node, Edge } from '@xyflow/react';
11
+ import type { BehaviorCanvasEntry, BehaviorComposeNodeData, BehaviorWireEdgeData } from './avl-behavior-compose-types';
12
+ /**
13
+ * Build a React Flow graph for behavior-level composition.
14
+ * Each behavior entry becomes one BehaviorComposeNode.
15
+ */
16
+ export declare function behaviorsToComposeGraph(entries: BehaviorCanvasEntry[], wires: BehaviorWireEdgeData[], layoutHint?: 'pipeline' | 'grid'): {
17
+ nodes: Node<BehaviorComposeNodeData>[];
18
+ edges: Edge<BehaviorWireEdgeData>[];
19
+ };
20
+ /** Registry record shape (matches behaviors-registry.json entries). */
21
+ export interface BehaviorRegistryRecord {
22
+ name: string;
23
+ level: 'atom' | 'molecule' | 'organism';
24
+ family: string;
25
+ layer: string;
26
+ description: string;
27
+ complexity: {
28
+ states: number;
29
+ events: number;
30
+ transitions: number;
31
+ };
32
+ defaultEntity: {
33
+ name: string;
34
+ persistence?: string;
35
+ fields: Array<{
36
+ name: string;
37
+ type: string;
38
+ required?: boolean;
39
+ }>;
40
+ };
41
+ connectableEvents: string[];
42
+ eventPayloads: Record<string, Array<{
43
+ name: string;
44
+ type: string;
45
+ required?: boolean;
46
+ }>>;
47
+ composableWith: string[];
48
+ }
49
+ /**
50
+ * Convert a registry entry to a BehaviorCanvasEntry.
51
+ * Maps connectableEvents + eventPayloads into typed ConnectableEvent[].
52
+ */
53
+ export declare function registryEntryToCanvasEntry(entry: BehaviorRegistryRecord, orbitalNames: string[]): BehaviorCanvasEntry;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * AVL Behavior Compose Types
3
+ *
4
+ * Types for behavior-level composition canvas.
5
+ * At this level, each node represents a BEHAVIOR (not an orbital).
6
+ * A behavior is a higher-level unit: atom (1 orbital), molecule (1 orbital
7
+ * with composed traits), or organism (multiple orbitals).
8
+ *
9
+ * Three navigation levels:
10
+ * Behavior (compose): One node per behavior showing AvlBehaviorGlyph
11
+ * Overview: One node per orbital showing live UI (OrbPreviewNode)
12
+ * Expanded: One node per UI state within an orbital (OrbPreviewNode)
13
+ */
14
+ import type { EntityPersistence, EventPayloadField } from '@almadar/core';
15
+ import type { BehaviorLevel, BehaviorGlyphChild, BehaviorGlyphConnection } from './AvlBehaviorGlyph';
16
+ import type { AvlEffectType } from '../../atoms/avl/types';
17
+ /** Extended view level adding 'behavior' to the existing overview/expanded. */
18
+ export type ComposeViewLevel = 'behavior' | 'overview' | 'expanded';
19
+ /** An event that can be wired between behaviors. */
20
+ export interface ConnectableEvent {
21
+ /** Event name (e.g., "ADD_TO_CART"). */
22
+ event: string;
23
+ /** Typed payload fields if declared. */
24
+ payloadFields?: EventPayloadField[];
25
+ /** Vertical position hint (0..1) for handle placement on the node. */
26
+ positionHint: number;
27
+ }
28
+ /** Data for a BehaviorComposeNode in React Flow. */
29
+ export interface BehaviorComposeNodeData extends Record<string, unknown> {
30
+ /** Behavior name from registry (e.g., "std-cart"). */
31
+ behaviorName: string;
32
+ /** Composition level: atom, molecule, organism. */
33
+ level: BehaviorLevel;
34
+ /** Domain for color coding (e.g., "commerce"). */
35
+ domain?: string;
36
+ /** Layer classification (e.g., "Domain", "UI Patterns"). */
37
+ layer?: string;
38
+ /** Primary entity name (e.g., "CartItem"). */
39
+ entityName: string;
40
+ /** Number of states in the behavior. */
41
+ stateCount: number;
42
+ /** Number of entity fields. */
43
+ fieldCount?: number;
44
+ /** Persistence kind. */
45
+ persistence?: EntityPersistence;
46
+ /** Effect types used by this behavior. */
47
+ effectTypes?: AvlEffectType[];
48
+ /** Child behaviors for molecule/organism glyphs. */
49
+ children?: BehaviorGlyphChild[];
50
+ /** Connections between children (for organism glyphs). */
51
+ connections?: BehaviorGlyphConnection[];
52
+ /** Events this behavior can emit (source handles). */
53
+ connectableEvents: ConnectableEvent[];
54
+ /** Behaviors this is composable with (for palette hints). */
55
+ composableWith?: string[];
56
+ /** Names of orbitals produced by this behavior (for drill-down). */
57
+ orbitalNames: string[];
58
+ }
59
+ /** Edge data for behavior-level wiring. */
60
+ export interface BehaviorWireEdgeData extends Record<string, unknown> {
61
+ /** The event name displayed on the edge. */
62
+ event: string;
63
+ /** Source behavior name. */
64
+ sourceBehavior: string;
65
+ /** Target behavior name. */
66
+ targetBehavior: string;
67
+ /** Typed payload fields if declared. */
68
+ payloadFields?: EventPayloadField[];
69
+ }
70
+ /** Mapping from behavior name to its metadata + produced orbitals. */
71
+ export interface BehaviorCanvasEntry {
72
+ /** Behavior name (e.g., "std-cart"). */
73
+ behaviorName: string;
74
+ /** Composition level. */
75
+ level: BehaviorLevel;
76
+ /** Domain for color coding. */
77
+ domain?: string;
78
+ /** Layer classification. */
79
+ layer?: string;
80
+ /** Primary entity name. */
81
+ entityName: string;
82
+ /** Number of states. */
83
+ stateCount: number;
84
+ /** Number of entity fields. */
85
+ fieldCount?: number;
86
+ /** Persistence kind. */
87
+ persistence?: EntityPersistence;
88
+ /** Effect types used. */
89
+ effectTypes?: AvlEffectType[];
90
+ /** Child behaviors (molecule/organism). */
91
+ children?: BehaviorGlyphChild[];
92
+ /** Connections between children (organism). */
93
+ connections?: BehaviorGlyphConnection[];
94
+ /** Events available for wiring. */
95
+ connectableEvents: ConnectableEvent[];
96
+ /** Compatible behavior names. */
97
+ composableWith?: string[];
98
+ /** Orbital names produced by this behavior (for drill-down mapping). */
99
+ orbitalNames: string[];
100
+ }
@@ -19,7 +19,9 @@ import type { PreviewNodeData, EventEdgeData } from './avl-preview-types';
19
19
  * Build a React Flow graph for the overview level.
20
20
  * Each orbital gets one node showing its INIT transition's UI.
21
21
  */
22
- export declare function schemaToOverviewGraph(schema: OrbitalSchema, mockData?: Record<string, unknown[]>): {
22
+ export declare function schemaToOverviewGraph(schema: OrbitalSchema, mockData?: Record<string, unknown[]>, behaviorMeta?: Record<string, {
23
+ layer: string;
24
+ }>, layoutHint?: 'pipeline' | 'grid'): {
23
25
  nodes: Node<PreviewNodeData>[];
24
26
  edges: Edge<EventEdgeData>[];
25
27
  };
@@ -39,6 +39,12 @@ export interface PatternEventSource {
39
39
  path: string;
40
40
  /** Vertical position hint (0..1) for handle placement on the node. */
41
41
  positionHint: number;
42
+ /** Typed payload fields if this event carries data. */
43
+ payloadFields?: Array<{
44
+ name: string;
45
+ type: string;
46
+ required?: boolean;
47
+ }>;
42
48
  }
43
49
  /** A slot + pattern config pair extracted from a render-ui effect. */
44
50
  export interface RenderUIEntry {
@@ -70,6 +76,8 @@ export interface PreviewNodeData extends Record<string, unknown> {
70
76
  * to connect from the specific button/link to the target screen.
71
77
  */
72
78
  eventSources: PatternEventSource[];
79
+ /** Behavior layer for visual indicator (color band). */
80
+ layer?: string;
73
81
  /** State role for visual indicator. */
74
82
  stateRole?: 'initial' | 'terminal' | 'hub' | 'error' | 'default';
75
83
  /** All effect types on this transition (for overlay). */
@@ -27,6 +27,9 @@ export { type ViewLevel, type PreviewNodeData, type EventEdgeData, type PatternE
27
27
  export { schemaToOverviewGraph, orbitalToExpandedGraph } from './avl-preview-converter';
28
28
  export { OrbPreviewNode, ScreenSizeContext } from './OrbPreviewNode';
29
29
  export { EventFlowEdge } from './EventFlowEdge';
30
+ export { type ComposeViewLevel, type BehaviorComposeNodeData, type BehaviorWireEdgeData, type BehaviorCanvasEntry, type ConnectableEvent } from './avl-behavior-compose-types';
31
+ export { BehaviorComposeNode } from './BehaviorComposeNode';
32
+ export { behaviorsToComposeGraph, registryEntryToCanvasEntry, type BehaviorRegistryRecord } from './avl-behavior-compose-converter';
30
33
  export { Avl3DOrbitalNode, type Avl3DOrbitalNodeProps } from './Avl3DOrbitalNode';
31
34
  export { Avl3DCrossWire, type Avl3DCrossWireProps } from './Avl3DCrossWire';
32
35
  export { Avl3DEntityCore, type Avl3DEntityCoreProps } from './Avl3DEntityCore';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Wire Validation
3
+ *
4
+ * Validates event wire compatibility between behaviors based on typed payloads.
5
+ * Used by FlowCanvas when the user drags between event handles.
6
+ */
7
+ export interface PayloadField {
8
+ name: string;
9
+ type: string;
10
+ required?: boolean;
11
+ }
12
+ export interface WireValidationResult {
13
+ valid: boolean;
14
+ warnings: string[];
15
+ }
16
+ /**
17
+ * Validate that a wire between two event handles is payload-compatible.
18
+ *
19
+ * Rules:
20
+ * - If neither side declares a payload, the wire is valid (no data contract).
21
+ * - If source has payload but target doesn't, valid with info (data is unused).
22
+ * - If target expects required fields that source doesn't provide, warn.
23
+ * - If both have fields with the same name but different types, warn.
24
+ */
25
+ export declare function validateWire(sourcePayload: PayloadField[] | undefined, targetPayload: PayloadField[] | undefined): WireValidationResult;
26
+ /**
27
+ * Format payload fields into a tooltip string.
28
+ * Example: "{ data: object (req), query: string }"
29
+ */
30
+ export declare function formatPayloadTooltip(fields: PayloadField[]): string;
@@ -14,6 +14,7 @@
14
14
  import React from 'react';
15
15
  import type { OrbitalSchema } from '@almadar/core';
16
16
  import type { ViewLevel, PreviewNodeData } from '../../molecules/avl/avl-preview-types';
17
+ import type { ComposeViewLevel, BehaviorCanvasEntry, BehaviorWireEdgeData } from '../../molecules/avl/avl-behavior-compose-types';
17
18
  export interface FlowCanvasProps {
18
19
  schema: OrbitalSchema | string;
19
20
  mockData?: Record<string, unknown[]>;
@@ -28,6 +29,10 @@ export interface FlowCanvasProps {
28
29
  }) => void;
29
30
  onLevelChange?: (level: ViewLevel, orbital?: string) => void;
30
31
  initialOrbital?: string;
32
+ /** Start at Level 2 (expanded) when initialOrbital is set. Default: 'overview'. */
33
+ initialLevel?: ViewLevel;
34
+ /** Pre-select a node on mount (opens OrbInspector). */
35
+ initialSelectedNode?: PreviewNodeData;
31
36
  /** Enable editing in the inspector. When true, fields become inputs. */
32
37
  editable?: boolean;
33
38
  /** Called when the user edits the schema via the inspector. */
@@ -45,6 +50,20 @@ export interface FlowCanvasProps {
45
50
  sourceTraitName?: string;
46
51
  targetTraitName?: string;
47
52
  }) => void;
53
+ /** Behavior layer metadata for node styling (layer color bands). */
54
+ behaviorMeta?: Record<string, {
55
+ layer: string;
56
+ }>;
57
+ /** Layout hint: 'pipeline' renders nodes left-to-right, 'grid' (default) uses sqrt-based grid. */
58
+ layoutHint?: 'pipeline' | 'grid';
59
+ /** Called when the user clicks a node in overview level (for composition hints). */
60
+ onNodeSelect?: (orbitalName: string) => void;
61
+ /** When 'behavior', shows behavior-level glyph nodes instead of orbital previews. */
62
+ composeLevel?: ComposeViewLevel;
63
+ /** Behavior entries for compose mode (only when composeLevel='behavior'). */
64
+ behaviorEntries?: BehaviorCanvasEntry[];
65
+ /** Event wires between behaviors (only when composeLevel='behavior'). */
66
+ behaviorWires?: BehaviorWireEdgeData[];
48
67
  /** @deprecated Use onNodeClick instead. Kept for AvlCosmicZoom compat. */
49
68
  onZoomChange?: (level: string, context: Record<string, string | undefined>) => void;
50
69
  /** @deprecated Not used in V3. */
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WalkMinimap
3
+ *
4
+ * Visual minimap for orbital-verify state walks.
5
+ * Shows trait overview pills, state graph for active trait,
6
+ * and coverage progress. Replaces the text-based walk step indicator.
7
+ *
8
+ * Data comes from window.__orbitalWalkStep, window.__orbitalWalkTraits,
9
+ * and window.__orbitalCoveredEdges (broadcast by phase4-browser.ts).
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import * as React from 'react';
14
+ export declare function WalkMinimap(): React.ReactElement | null;
15
+ export declare namespace WalkMinimap {
16
+ var displayName: string;
17
+ }