@almadar/ui 2.19.2 → 2.20.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,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { OrbitalSchema } from '@almadar/core';
2
3
 
3
4
  /**
4
5
  * Almadar Visual Language (AVL) shared types.
@@ -311,4 +312,281 @@ declare function curveControlPoint(x1: number, y1: number, x2: number, y2: numbe
311
312
  cpy: number;
312
313
  };
313
314
 
314
- export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, type AvlApplicationProps, type AvlBaseProps, AvlBinding, type AvlBindingProps, AvlBindingRef, type AvlBindingRefProps, AvlClosedCircuit, type AvlClosedCircuitProps, type AvlClosedCircuitState, type AvlClosedCircuitTransition, AvlEffect, type AvlEffectProps, type AvlEffectType, AvlEmitListen, type AvlEmitListenProps, AvlEntity, type AvlEntityProps, AvlEvent, type AvlEventProps, AvlExprTree, type AvlExprTreeNode, type AvlExprTreeProps, AvlField, type AvlFieldProps, AvlFieldType, type AvlFieldTypeKind, type AvlFieldTypeProps, AvlGuard, type AvlGuardProps, AvlLiteral, type AvlLiteralProps, AvlOperator, type AvlOperatorNamespace, type AvlOperatorProps, AvlOrbital, type AvlOrbitalProps, AvlOrbitalUnit, type AvlOrbitalUnitPage, type AvlOrbitalUnitProps, type AvlOrbitalUnitTrait, AvlPage, 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, AvlTrait, type AvlTraitProps, AvlTransition, type AvlTransitionProps, arcPath, curveControlPoint, gridPositions, radialPositions, ringPositions };
315
+ /**
316
+ * AVL Cosmic Zoom State Machine
317
+ *
318
+ * useReducer-based state machine managing which zoom level is displayed,
319
+ * what is selected, and animation state.
320
+ *
321
+ * @packageDocumentation
322
+ */
323
+ type ZoomLevel = 'application' | 'orbital' | 'trait' | 'transition';
324
+
325
+ /**
326
+ * AvlCosmicZoom - Interactive Zoomable Orbital Visualization
327
+ *
328
+ * The host organism that owns the SVG viewport and delegates to
329
+ * scene renderers at each zoom level. Manages animation, pan/zoom,
330
+ * and breadcrumb navigation.
331
+ *
332
+ * @packageDocumentation
333
+ */
334
+
335
+ interface AvlCosmicZoomProps {
336
+ /** The orbital schema (parsed object or JSON string) */
337
+ schema: OrbitalSchema | string;
338
+ /** CSS class for the outer container */
339
+ className?: string;
340
+ /** Primary color for the visualization */
341
+ color?: string;
342
+ /** Enable animations (default: true) */
343
+ animated?: boolean;
344
+ /** Pre-select an orbital on mount */
345
+ initialOrbital?: string;
346
+ /** Pre-select a trait on mount */
347
+ initialTrait?: string;
348
+ /** Callback when zoom level changes */
349
+ onZoomChange?: (level: ZoomLevel, context: {
350
+ orbital?: string;
351
+ trait?: string;
352
+ }) => void;
353
+ /** Container width */
354
+ width?: number | string;
355
+ /** Container height */
356
+ height?: number | string;
357
+ /** Coverage data for verification overlay */
358
+ stateCoverage?: Record<string, 'covered' | 'uncovered' | 'partial'>;
359
+ }
360
+ declare const AvlCosmicZoom: React.FC<AvlCosmicZoomProps>;
361
+
362
+ /**
363
+ * AVL Schema Parser
364
+ *
365
+ * Pure functions that transform an OrbitalSchema into structured data
366
+ * for each zoom level of the Cosmic Zoom visualization.
367
+ *
368
+ * Imports all types from @almadar/core.
369
+ *
370
+ * @packageDocumentation
371
+ */
372
+
373
+ interface ApplicationOrbitalData {
374
+ name: string;
375
+ entityName: string;
376
+ fieldCount: number;
377
+ persistence: string;
378
+ traitNames: string[];
379
+ pageNames: string[];
380
+ position: {
381
+ x: number;
382
+ y: number;
383
+ };
384
+ }
385
+ interface CrossLink {
386
+ emitterOrbital: string;
387
+ listenerOrbital: string;
388
+ eventName: string;
389
+ emitterTrait: string;
390
+ listenerTrait: string;
391
+ }
392
+ interface ApplicationLevelData {
393
+ orbitals: ApplicationOrbitalData[];
394
+ crossLinks: CrossLink[];
395
+ }
396
+ interface FieldInfo {
397
+ name: string;
398
+ type: string;
399
+ required: boolean;
400
+ hasDefault: boolean;
401
+ }
402
+ interface OrbitalTraitInfo {
403
+ name: string;
404
+ stateCount: number;
405
+ eventCount: number;
406
+ transitionCount: number;
407
+ emits: string[];
408
+ listens: string[];
409
+ }
410
+ interface OrbitalPageInfo {
411
+ name: string;
412
+ route: string;
413
+ }
414
+ interface ExternalLink {
415
+ targetOrbital: string;
416
+ eventName: string;
417
+ direction: 'out' | 'in';
418
+ traitName: string;
419
+ }
420
+ interface OrbitalLevelData {
421
+ name: string;
422
+ entity: {
423
+ name: string;
424
+ fields: FieldInfo[];
425
+ persistence: string;
426
+ };
427
+ traits: OrbitalTraitInfo[];
428
+ pages: OrbitalPageInfo[];
429
+ externalLinks: ExternalLink[];
430
+ }
431
+ interface TraitStateInfo {
432
+ name: string;
433
+ isInitial?: boolean;
434
+ isTerminal?: boolean;
435
+ }
436
+ interface TraitTransitionInfo {
437
+ from: string;
438
+ to: string;
439
+ event: string;
440
+ guard?: unknown;
441
+ effects: Array<{
442
+ type: string;
443
+ args: unknown[];
444
+ }>;
445
+ index: number;
446
+ }
447
+ interface TraitLevelData {
448
+ name: string;
449
+ linkedEntity: string;
450
+ states: TraitStateInfo[];
451
+ transitions: TraitTransitionInfo[];
452
+ emittedEvents: string[];
453
+ listenedEvents: string[];
454
+ }
455
+ interface ExprTreeNode {
456
+ label: string;
457
+ type: 'operator' | 'literal' | 'binding';
458
+ children?: ExprTreeNode[];
459
+ }
460
+ interface SlotTarget {
461
+ name: string;
462
+ pattern: string;
463
+ }
464
+ interface TransitionLevelData {
465
+ from: string;
466
+ to: string;
467
+ event: string;
468
+ guard: ExprTreeNode | null;
469
+ effects: ExprTreeNode[];
470
+ slotTargets: SlotTarget[];
471
+ }
472
+ /**
473
+ * Parse the application-level view: all orbitals with cross-orbital links.
474
+ */
475
+ declare function parseApplicationLevel(schema: OrbitalSchema): ApplicationLevelData;
476
+ /**
477
+ * Parse a single orbital's detail view.
478
+ */
479
+ declare function parseOrbitalLevel(schema: OrbitalSchema, orbitalName: string): OrbitalLevelData | null;
480
+ /**
481
+ * Parse a trait's state machine for the detail view.
482
+ */
483
+ declare function parseTraitLevel(schema: OrbitalSchema, orbitalName: string, traitName: string): TraitLevelData | null;
484
+ /**
485
+ * Parse a single transition for the detail view.
486
+ */
487
+ declare function parseTransitionLevel(schema: OrbitalSchema, orbitalName: string, traitName: string, transitionIndex: number): TransitionLevelData | null;
488
+
489
+ /**
490
+ * AvlApplicationScene - Zoom Level 1
491
+ *
492
+ * Shows all orbitals in the application with cross-orbital
493
+ * emit/listen arrows. Each orbital is a clickable AvlOrbitalUnit.
494
+ */
495
+
496
+ interface AvlApplicationSceneProps {
497
+ data: ApplicationLevelData;
498
+ color?: string;
499
+ onOrbitalClick?: (orbitalName: string, position: {
500
+ x: number;
501
+ y: number;
502
+ }) => void;
503
+ }
504
+ declare const AvlApplicationScene: React.FC<AvlApplicationSceneProps>;
505
+
506
+ /**
507
+ * AvlOrbitalScene - Zoom Level 2
508
+ *
509
+ * Shows a single orbital: entity nucleus with fields,
510
+ * trait rings, page markers, and external connection arrows.
511
+ */
512
+
513
+ interface AvlOrbitalSceneProps {
514
+ data: OrbitalLevelData;
515
+ color?: string;
516
+ /** Currently highlighted trait (before zooming in) */
517
+ highlightedTrait?: string | null;
518
+ onTraitClick?: (traitName: string, position: {
519
+ x: number;
520
+ y: number;
521
+ }) => void;
522
+ /** Called when a trait tab is hovered/selected (highlight without zoom) */
523
+ onTraitHighlight?: (traitName: string | null) => void;
524
+ }
525
+ declare const AvlOrbitalScene: React.FC<AvlOrbitalSceneProps>;
526
+
527
+ /**
528
+ * AvlTraitScene - Zoom Level 3
529
+ *
530
+ * Shows a trait's state machine using ELK (elkjs) for automatic
531
+ * node and edge label placement. No label overlap.
532
+ */
533
+
534
+ interface AvlTraitSceneProps {
535
+ data: TraitLevelData;
536
+ color?: string;
537
+ onTransitionClick?: (transitionIndex: number, position: {
538
+ x: number;
539
+ y: number;
540
+ }) => void;
541
+ }
542
+ declare const AvlTraitScene: React.FC<AvlTraitSceneProps>;
543
+
544
+ /**
545
+ * AvlTransitionScene - Zoom Level 4
546
+ *
547
+ * Shows a single transition in detail as a vertical flow:
548
+ * FromState -> Event card -> Guard -> Effects -> ToState
549
+ *
550
+ * Labels are placed in cards between arrow segments,
551
+ * never overlapping the lines.
552
+ */
553
+
554
+ interface AvlTransitionSceneProps {
555
+ data: TransitionLevelData;
556
+ color?: string;
557
+ }
558
+ declare const AvlTransitionScene: React.FC<AvlTransitionSceneProps>;
559
+
560
+ /**
561
+ * AvlClickTarget
562
+ *
563
+ * Transparent SVG rect overlay that makes AVL atoms clickable.
564
+ * AVL atoms render <g> elements which don't natively support
565
+ * bounding-box click events. This wrapper adds an invisible
566
+ * rect with pointer events and optional hover glow.
567
+ *
568
+ * @packageDocumentation
569
+ */
570
+
571
+ interface AvlClickTargetProps {
572
+ /** Bounding box position */
573
+ x: number;
574
+ y: number;
575
+ width: number;
576
+ height: number;
577
+ /** Click handler */
578
+ onClick: () => void;
579
+ /** Hover callback */
580
+ onHover?: (hovering: boolean) => void;
581
+ /** Cursor style (default: pointer) */
582
+ cursor?: string;
583
+ /** Glow color on hover */
584
+ glowColor?: string;
585
+ /** Accessible label */
586
+ label?: string;
587
+ /** Children (the AVL atoms to render on top) */
588
+ children: React.ReactNode;
589
+ }
590
+ declare const AvlClickTarget: React.FC<AvlClickTargetProps>;
591
+
592
+ export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, type ApplicationLevelData, AvlApplication, type AvlApplicationProps, AvlApplicationScene, type AvlApplicationSceneProps, type AvlBaseProps, AvlBinding, type AvlBindingProps, AvlBindingRef, type AvlBindingRefProps, AvlClickTarget, type AvlClickTargetProps, AvlClosedCircuit, type AvlClosedCircuitProps, type AvlClosedCircuitState, type AvlClosedCircuitTransition, AvlCosmicZoom, type AvlCosmicZoomProps, AvlEffect, type AvlEffectProps, type AvlEffectType, AvlEmitListen, type AvlEmitListenProps, AvlEntity, type AvlEntityProps, AvlEvent, type AvlEventProps, AvlExprTree, type AvlExprTreeNode, type AvlExprTreeProps, AvlField, type AvlFieldProps, AvlFieldType, type AvlFieldTypeKind, type AvlFieldTypeProps, AvlGuard, type AvlGuardProps, AvlLiteral, type AvlLiteralProps, AvlOperator, type AvlOperatorNamespace, type AvlOperatorProps, AvlOrbital, type AvlOrbitalProps, AvlOrbitalScene, type AvlOrbitalSceneProps, AvlOrbitalUnit, type AvlOrbitalUnitPage, type AvlOrbitalUnitProps, type AvlOrbitalUnitTrait, AvlPage, 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, AvlTrait, type AvlTraitProps, AvlTraitScene, type AvlTraitSceneProps, AvlTransition, type AvlTransitionProps, AvlTransitionScene, type AvlTransitionSceneProps, type CrossLink, type OrbitalLevelData, type TraitLevelData, type TransitionLevelData, type ZoomLevel, arcPath, curveControlPoint, gridPositions, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, ringPositions };
@@ -31,3 +31,4 @@ export { AvlEmitListen, type AvlEmitListenProps } from '../components/molecules/
31
31
  export { AvlSlotMap, type AvlSlotMapProps, type AvlSlotMapSlot } from '../components/molecules/avl';
32
32
  export { AvlExprTree, type AvlExprTreeProps, type AvlExprTreeNode } from '../components/molecules/avl';
33
33
  export { ringPositions, arcPath, radialPositions, gridPositions, curveControlPoint } from '../components/molecules/avl';
34
+ export { AvlCosmicZoom, type AvlCosmicZoomProps, AvlApplicationScene, type AvlApplicationSceneProps, AvlOrbitalScene, type AvlOrbitalSceneProps, 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';