@qontinui/ui-bridge 0.1.1 → 0.3.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.
Files changed (112) hide show
  1. package/dist/ai/index.d.mts +893 -0
  2. package/dist/ai/index.d.ts +893 -0
  3. package/dist/ai/index.js +3897 -0
  4. package/dist/ai/index.js.map +1 -0
  5. package/dist/ai/index.mjs +3839 -0
  6. package/dist/ai/index.mjs.map +1 -0
  7. package/dist/babel-plugin/index.js +515 -0
  8. package/dist/babel-plugin/index.js.map +1 -0
  9. package/dist/babel-plugin/index.mjs +499 -0
  10. package/dist/babel-plugin/index.mjs.map +1 -0
  11. package/dist/control/index.d.mts +5 -4
  12. package/dist/control/index.d.ts +5 -4
  13. package/dist/core/index.d.mts +115 -42
  14. package/dist/core/index.d.ts +115 -42
  15. package/dist/core/index.js +0 -983
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/index.mjs +1 -972
  18. package/dist/core/index.mjs.map +1 -1
  19. package/dist/debug/index.d.mts +3 -3
  20. package/dist/debug/index.d.ts +3 -3
  21. package/dist/index.d.mts +8 -7
  22. package/dist/index.d.ts +8 -7
  23. package/dist/index.js +8249 -4163
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +8193 -4152
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/{metrics-QCnK0EFw.d.ts → metrics-BfiT_rhZ.d.ts} +2 -2
  28. package/dist/{metrics-BCG7z7Aq.d.mts → metrics-DTA2bwG7.d.mts} +2 -2
  29. package/dist/native/control/index.js +453 -0
  30. package/dist/native/control/index.js.map +1 -0
  31. package/dist/native/control/index.mjs +450 -0
  32. package/dist/native/control/index.mjs.map +1 -0
  33. package/dist/native/core/index.js +486 -0
  34. package/dist/native/core/index.js.map +1 -0
  35. package/dist/native/core/index.mjs +475 -0
  36. package/dist/native/core/index.mjs.map +1 -0
  37. package/dist/native/debug/index.js +451 -0
  38. package/dist/native/debug/index.js.map +1 -0
  39. package/dist/native/debug/index.mjs +449 -0
  40. package/dist/native/debug/index.mjs.map +1 -0
  41. package/dist/native/index.js +2274 -0
  42. package/dist/native/index.js.map +1 -0
  43. package/dist/native/index.mjs +2246 -0
  44. package/dist/native/index.mjs.map +1 -0
  45. package/dist/native/react/index.js +1401 -0
  46. package/dist/native/react/index.js.map +1 -0
  47. package/dist/native/react/index.mjs +1389 -0
  48. package/dist/native/react/index.mjs.map +1 -0
  49. package/dist/native/server/index.js +415 -0
  50. package/dist/native/server/index.js.map +1 -0
  51. package/dist/native/server/index.mjs +410 -0
  52. package/dist/native/server/index.mjs.map +1 -0
  53. package/dist/react/index.d.mts +20 -6
  54. package/dist/react/index.d.ts +20 -6
  55. package/dist/react/index.js +629 -14
  56. package/dist/react/index.js.map +1 -1
  57. package/dist/react/index.mjs +629 -14
  58. package/dist/react/index.mjs.map +1 -1
  59. package/dist/{registry-CT6BVVKr.d.mts → registry-BKLEm-yk.d.ts} +29 -14
  60. package/dist/{registry-D4mQ01B3.d.ts → registry-BmZgyCz8.d.mts} +29 -14
  61. package/dist/render-log/index.d.mts +1 -1
  62. package/dist/render-log/index.d.ts +1 -1
  63. package/dist/server/express.d.mts +36 -0
  64. package/dist/server/express.d.ts +36 -0
  65. package/dist/server/express.js +196 -0
  66. package/dist/server/express.js.map +1 -0
  67. package/dist/server/express.mjs +192 -0
  68. package/dist/server/express.mjs.map +1 -0
  69. package/dist/server/handlers.d.mts +93 -0
  70. package/dist/server/handlers.d.ts +93 -0
  71. package/dist/server/handlers.js +4278 -0
  72. package/dist/server/handlers.js.map +1 -0
  73. package/dist/server/handlers.mjs +4275 -0
  74. package/dist/server/handlers.mjs.map +1 -0
  75. package/dist/server/index.d.mts +10 -0
  76. package/dist/server/index.d.ts +10 -0
  77. package/dist/server/index.js +5352 -0
  78. package/dist/server/index.js.map +1 -0
  79. package/dist/server/index.mjs +5337 -0
  80. package/dist/server/index.mjs.map +1 -0
  81. package/dist/server/nextjs.d.mts +126 -0
  82. package/dist/server/nextjs.d.ts +126 -0
  83. package/dist/server/nextjs.js +287 -0
  84. package/dist/server/nextjs.js.map +1 -0
  85. package/dist/server/nextjs.mjs +282 -0
  86. package/dist/server/nextjs.mjs.map +1 -0
  87. package/dist/server/standalone.d.mts +6 -0
  88. package/dist/server/standalone.d.ts +6 -0
  89. package/dist/server/standalone.js +719 -0
  90. package/dist/server/standalone.js.map +1 -0
  91. package/dist/server/standalone.mjs +715 -0
  92. package/dist/server/standalone.mjs.map +1 -0
  93. package/dist/standalone-BURj8J3G.d.ts +212 -0
  94. package/dist/standalone-Dwmel29d.d.mts +212 -0
  95. package/dist/swc-plugin/index.d.mts +79 -0
  96. package/dist/swc-plugin/index.d.ts +79 -0
  97. package/dist/swc-plugin/index.js +15 -0
  98. package/dist/swc-plugin/index.js.map +1 -0
  99. package/dist/swc-plugin/index.mjs +9 -0
  100. package/dist/swc-plugin/index.mjs.map +1 -0
  101. package/dist/types-B5Q0GVo0.d.mts +646 -0
  102. package/dist/{types-DdJD9yw5.d.mts → types-B7J7noLK.d.mts} +1 -1
  103. package/dist/{types-BDkXy5si.d.ts → types-BkNRILUa.d.ts} +1 -1
  104. package/dist/types-CEQLnFMv.d.mts +156 -0
  105. package/dist/types-CHnlwiTK.d.ts +156 -0
  106. package/dist/types-DfPqwU-i.d.ts +646 -0
  107. package/dist/{types-BpvpStn3.d.mts → types-jKVgTI6_.d.mts} +364 -160
  108. package/dist/{types-BpvpStn3.d.ts → types-jKVgTI6_.d.ts} +364 -160
  109. package/package.json +111 -3
  110. package/swc-plugin-wasm/ui_bridge_swc_plugin.wasm +0 -0
  111. package/dist/websocket-client-B2LC9CYc.d.mts +0 -124
  112. package/dist/websocket-client-DupH0X7B.d.ts +0 -124
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * UI Bridge Core Types
3
3
  *
4
- * Defines the fundamental types used throughout the UI Bridge framework.
4
+ * Defines the fundamental types used throughout the UI Bridge framework,
5
+ * plus ui-bridge-specific types (WebSocket protocol, accessibility, extended workflow types).
5
6
  */
6
7
  /**
7
8
  * Element identification using multiple strategies
@@ -108,7 +109,19 @@ interface RegisteredElement {
108
109
  registeredAt: number;
109
110
  /** Whether this element is currently mounted */
110
111
  mounted: boolean;
112
+ /** Alternative names for natural language matching */
113
+ aliases?: string[];
114
+ /** Human-readable description for AI agents */
115
+ description?: string;
116
+ /** Semantic type (more descriptive than ElementType) */
117
+ semanticType?: string;
118
+ /** Purpose of the element */
119
+ purpose?: string;
111
120
  }
121
+ /**
122
+ * Generic state getter function
123
+ */
124
+ type StateGetter<T = unknown> = () => T;
112
125
  /**
113
126
  * Component action definition
114
127
  */
@@ -142,6 +155,10 @@ interface RegisteredComponent {
142
155
  registeredAt: number;
143
156
  /** Whether this component is currently mounted */
144
157
  mounted: boolean;
158
+ /** State getter function */
159
+ getState?: StateGetter<Record<string, unknown>>;
160
+ /** Computed properties getter function */
161
+ getComputed?: () => Record<string, unknown>;
145
162
  }
146
163
  /**
147
164
  * Workflow step types
@@ -244,6 +261,25 @@ interface WorkflowStep {
244
261
  /** Log configuration (type: 'log') */
245
262
  logConfig?: LogConfig;
246
263
  }
264
+ /**
265
+ * Extended workflow step with additional branch/loop/extract support
266
+ */
267
+ interface ExtendedWorkflowStep extends WorkflowStep {
268
+ /** Branch condition (type: 'branch') */
269
+ branchCondition?: BranchCondition;
270
+ /** Steps to execute if branch condition is true */
271
+ thenSteps?: ExtendedWorkflowStep[];
272
+ /** Steps to execute if branch condition is false */
273
+ elseSteps?: ExtendedWorkflowStep[];
274
+ /** Loop configuration (type: 'loop') */
275
+ loopConfig?: LoopConfig;
276
+ /** Steps to execute in loop */
277
+ loopSteps?: ExtendedWorkflowStep[];
278
+ /** Extract configuration (type: 'extract') */
279
+ extractConfig?: ExtractConfig;
280
+ /** Log configuration (type: 'log') */
281
+ logConfig?: LogConfig;
282
+ }
247
283
  /**
248
284
  * Workflow definition
249
285
  */
@@ -325,6 +361,67 @@ interface ActionResponse {
325
361
  /** Timestamp when the action completed */
326
362
  timestamp: number;
327
363
  }
364
+ /**
365
+ * Machine-readable error codes for action failures
366
+ */
367
+ type ActionErrorCode = 'ELEMENT_NOT_FOUND' | 'ELEMENT_NOT_VISIBLE' | 'ELEMENT_NOT_ENABLED' | 'ELEMENT_NOT_INTERACTABLE' | 'ACTION_TIMEOUT' | 'ACTION_REJECTED' | 'STATE_NOT_REACHED' | 'NETWORK_ERROR' | 'PARSE_ERROR' | 'VALIDATION_ERROR' | 'AMBIGUOUS_MATCH' | 'LOW_CONFIDENCE' | 'UNSUPPORTED_ACTION' | 'UNKNOWN_ERROR';
368
+ /**
369
+ * Partial element match found during search
370
+ */
371
+ interface PartialMatch {
372
+ /** Element ID of the partial match */
373
+ elementId: string;
374
+ /** Match confidence score (0-1) */
375
+ confidence: number;
376
+ /** Reason for partial match */
377
+ reason: string;
378
+ /** Type of match */
379
+ type: string;
380
+ /** Description of the match */
381
+ description?: string;
382
+ }
383
+ /**
384
+ * Suggested recovery action
385
+ */
386
+ interface RecoveryAction {
387
+ /** Human-readable suggestion */
388
+ suggestion: string;
389
+ /** Optional command to execute */
390
+ command?: string;
391
+ /** Confidence score (0-1) */
392
+ confidence: number;
393
+ /** Whether the original action can be retried */
394
+ retryable: boolean;
395
+ }
396
+ /**
397
+ * Structured error details for action failures
398
+ */
399
+ interface ActionFailureDetails {
400
+ /** Machine-readable error code */
401
+ errorCode: ActionErrorCode;
402
+ /** Human-readable error message */
403
+ message: string;
404
+ /** Element ID that was targeted */
405
+ elementId?: string;
406
+ /** CSS selectors that were tried */
407
+ selectorsTried?: string[];
408
+ /** Partial matches found during element search */
409
+ partialMatches?: PartialMatch[];
410
+ /** Element state at time of failure */
411
+ elementState?: ElementState;
412
+ /** Screenshot context (base64 or URL) */
413
+ screenshotContext?: string;
414
+ /** Suggested recovery actions */
415
+ suggestedActions: RecoveryAction[];
416
+ /** Whether retrying is recommended */
417
+ retryRecommended: boolean;
418
+ /** Additional context */
419
+ context?: Record<string, unknown>;
420
+ /** Duration of the action in milliseconds */
421
+ durationMs?: number;
422
+ /** Timeout that was configured in milliseconds */
423
+ timeoutMs?: number;
424
+ }
328
425
  /**
329
426
  * Snapshot of the entire UI bridge state
330
427
  */
@@ -357,6 +454,22 @@ interface BridgeSnapshot {
357
454
  stepCount: number;
358
455
  }>;
359
456
  }
457
+ /**
458
+ * Event types emitted by the bridge
459
+ */
460
+ type BridgeEventType = 'element:registered' | 'element:unregistered' | 'element:stateChanged' | 'component:registered' | 'component:unregistered' | 'action:started' | 'action:completed' | 'action:failed' | 'workflow:started' | 'workflow:stepCompleted' | 'workflow:completed' | 'workflow:failed' | 'render:snapshot' | 'error';
461
+ /**
462
+ * Event payload structure
463
+ */
464
+ interface BridgeEvent<T = unknown> {
465
+ type: BridgeEventType;
466
+ timestamp: number;
467
+ data: T;
468
+ }
469
+ /**
470
+ * Event listener function
471
+ */
472
+ type BridgeEventListener<T = unknown> = (event: BridgeEvent<T>) => void;
360
473
  /**
361
474
  * UI Bridge feature flags
362
475
  */
@@ -388,21 +501,161 @@ interface UIBridgeConfig {
388
501
  verbose?: boolean;
389
502
  }
390
503
  /**
391
- * Event types emitted by the bridge
504
+ * Computed property definition
392
505
  */
393
- type BridgeEventType = 'element:registered' | 'element:unregistered' | 'element:stateChanged' | 'component:registered' | 'component:unregistered' | 'action:started' | 'action:completed' | 'action:failed' | 'workflow:started' | 'workflow:stepCompleted' | 'workflow:completed' | 'workflow:failed' | 'render:snapshot' | 'error';
506
+ interface ComputedProperty<T = unknown> {
507
+ /** Getter function for the computed value */
508
+ getter: () => T;
509
+ /** Description of what the computed property represents */
510
+ description?: string;
511
+ }
394
512
  /**
395
- * Event payload structure
513
+ * Response from getting component state
396
514
  */
397
- interface BridgeEvent<T = unknown> {
398
- type: BridgeEventType;
515
+ interface ComponentStateResponse {
516
+ /** Current state values */
517
+ state: Record<string, unknown>;
518
+ /** Current computed property values */
519
+ computed: Record<string, unknown>;
520
+ /** Timestamp when the state was captured */
399
521
  timestamp: number;
400
- data: T;
401
522
  }
402
523
  /**
403
- * Event listener function
524
+ * UI State definition
525
+ *
526
+ * Represents a distinct state in the UI (e.g., "LoginForm", "Dashboard", "Modal").
527
+ * States can be active or inactive, and can block other states from activating.
404
528
  */
405
- type BridgeEventListener<T = unknown> = (event: BridgeEvent<T>) => void;
529
+ interface UIState {
530
+ /** Unique state identifier */
531
+ id: string;
532
+ /** Human-readable name */
533
+ name: string;
534
+ /** Element IDs belonging to this state */
535
+ elements: string[];
536
+ /** Optional function to detect if state is active */
537
+ activeWhen?: () => boolean;
538
+ /** If true, blocks other state activations (modal behavior) */
539
+ blocking?: boolean;
540
+ /** Specific state IDs this state blocks */
541
+ blocks?: string[];
542
+ /** State group membership */
543
+ group?: string;
544
+ /** Cost for pathfinding (default: 1.0) */
545
+ pathCost?: number;
546
+ /** Custom metadata */
547
+ metadata?: Record<string, unknown>;
548
+ }
549
+ /**
550
+ * State group - states that activate/deactivate atomically
551
+ *
552
+ * When a group is activated, all its states are activated together.
553
+ * When deactivated, all states are deactivated together.
554
+ */
555
+ interface UIStateGroup {
556
+ /** Unique group identifier */
557
+ id: string;
558
+ /** Human-readable name */
559
+ name: string;
560
+ /** State IDs belonging to this group */
561
+ states: string[];
562
+ }
563
+ /**
564
+ * State transition definition
565
+ *
566
+ * Defines how to move from one set of states to another,
567
+ * including any actions to execute during the transition.
568
+ */
569
+ interface UITransition {
570
+ /** Unique transition identifier */
571
+ id: string;
572
+ /** Human-readable name */
573
+ name: string;
574
+ /** Precondition: at least one must be active */
575
+ fromStates: string[];
576
+ /** States to activate */
577
+ activateStates: string[];
578
+ /** States to deactivate */
579
+ exitStates: string[];
580
+ /** Groups to activate */
581
+ activateGroups?: string[];
582
+ /** Groups to deactivate */
583
+ exitGroups?: string[];
584
+ /** Actions to execute during transition */
585
+ actions?: WorkflowStep[];
586
+ /** Cost for pathfinding */
587
+ pathCost?: number;
588
+ /** Whether source states remain visible during transition */
589
+ staysVisible?: boolean;
590
+ }
591
+ /**
592
+ * Path result from pathfinding
593
+ *
594
+ * Returned when searching for a path to target states.
595
+ */
596
+ interface PathResult {
597
+ /** Whether a path was found */
598
+ found: boolean;
599
+ /** Transition IDs in order to reach target */
600
+ transitions: string[];
601
+ /** Total cost of the path */
602
+ totalCost: number;
603
+ /** Target state IDs */
604
+ targetStates: string[];
605
+ /** Estimated number of steps */
606
+ estimatedSteps: number;
607
+ }
608
+ /**
609
+ * Transition execution result
610
+ */
611
+ interface TransitionResult {
612
+ /** Whether the transition succeeded */
613
+ success: boolean;
614
+ /** States that were activated */
615
+ activatedStates: string[];
616
+ /** States that were deactivated */
617
+ deactivatedStates: string[];
618
+ /** Error message if failed */
619
+ error?: string;
620
+ /** Phase where failure occurred (if any) */
621
+ failedPhase?: string;
622
+ /** Duration of the transition in milliseconds */
623
+ durationMs: number;
624
+ }
625
+ /**
626
+ * Navigation result
627
+ *
628
+ * Returned after navigating to target states via pathfinding.
629
+ */
630
+ interface NavigationResult {
631
+ /** Whether navigation succeeded */
632
+ success: boolean;
633
+ /** The path that was followed */
634
+ path: PathResult;
635
+ /** Transitions that were executed */
636
+ executedTransitions: string[];
637
+ /** Final active states after navigation */
638
+ finalActiveStates: string[];
639
+ /** Error message if failed */
640
+ error?: string;
641
+ /** Duration of the navigation in milliseconds */
642
+ durationMs: number;
643
+ }
644
+ /**
645
+ * State manager snapshot
646
+ */
647
+ interface StateSnapshot {
648
+ /** Timestamp of the snapshot */
649
+ timestamp: number;
650
+ /** Currently active state IDs */
651
+ activeStates: string[];
652
+ /** All registered states */
653
+ states: UIState[];
654
+ /** All registered state groups */
655
+ groups: UIStateGroup[];
656
+ /** All registered transitions */
657
+ transitions: UITransition[];
658
+ }
406
659
  /**
407
660
  * WebSocket message types from client to server
408
661
  */
@@ -428,11 +681,8 @@ interface WSMessageBase {
428
681
  interface WSSubscribeMessage extends WSMessageBase {
429
682
  type: 'subscribe';
430
683
  payload: {
431
- /** Event types to subscribe to (empty = all events) */
432
684
  events?: BridgeEventType[];
433
- /** Filter events by element ID */
434
685
  elementIds?: string[];
435
- /** Filter events by component ID */
436
686
  componentIds?: string[];
437
687
  };
438
688
  }
@@ -442,7 +692,6 @@ interface WSSubscribeMessage extends WSMessageBase {
442
692
  interface WSUnsubscribeMessage extends WSMessageBase {
443
693
  type: 'unsubscribe';
444
694
  payload: {
445
- /** Event types to unsubscribe from (empty = all) */
446
695
  events?: BridgeEventType[];
447
696
  };
448
697
  }
@@ -464,7 +713,7 @@ interface WSFindMessage extends WSMessageBase {
464
713
  };
465
714
  }
466
715
  /**
467
- * Client message: Discover elements
716
+ * Client message: Discover elements (deprecated)
468
717
  * @deprecated Use WSFindMessage instead
469
718
  */
470
719
  interface WSDiscoverMessage extends WSMessageBase {
@@ -498,7 +747,11 @@ interface WSExecuteActionMessage extends WSMessageBase {
498
747
  type: 'executeAction';
499
748
  payload: {
500
749
  elementId: string;
501
- action: ActionRequest;
750
+ action: {
751
+ action: string;
752
+ params?: Record<string, unknown>;
753
+ waitOptions?: WaitOptions;
754
+ };
502
755
  };
503
756
  }
504
757
  /**
@@ -520,7 +773,6 @@ interface WSExecuteWorkflowMessage extends WSMessageBase {
520
773
  payload: {
521
774
  workflowId: string;
522
775
  params?: Record<string, unknown>;
523
- /** Stream progress updates */
524
776
  streamProgress?: boolean;
525
777
  };
526
778
  }
@@ -534,11 +786,8 @@ type WSClientMessage = WSSubscribeMessage | WSUnsubscribeMessage | WSPingMessage
534
786
  interface WSWelcomeMessage extends WSMessageBase {
535
787
  type: 'welcome';
536
788
  payload: {
537
- /** Server version */
538
789
  version: string;
539
- /** Available features */
540
790
  features: UIBridgeFeatures;
541
- /** Client ID assigned by server */
542
791
  clientId: string;
543
792
  };
544
793
  }
@@ -554,7 +803,6 @@ interface WSPongMessage extends WSMessageBase {
554
803
  interface WSSubscribedMessage extends WSMessageBase {
555
804
  type: 'subscribed';
556
805
  payload: {
557
- /** Events now subscribed to */
558
806
  events: BridgeEventType[];
559
807
  };
560
808
  }
@@ -564,7 +812,6 @@ interface WSSubscribedMessage extends WSMessageBase {
564
812
  interface WSUnsubscribedMessage extends WSMessageBase {
565
813
  type: 'unsubscribed';
566
814
  payload: {
567
- /** Events unsubscribed from */
568
815
  events: BridgeEventType[];
569
816
  };
570
817
  }
@@ -580,7 +827,6 @@ interface WSEventMessage extends WSMessageBase {
580
827
  */
581
828
  interface WSResponseMessage<T = unknown> extends WSMessageBase {
582
829
  type: 'response';
583
- /** ID of the request this responds to */
584
830
  requestId: string;
585
831
  payload: {
586
832
  success: boolean;
@@ -593,7 +839,6 @@ interface WSResponseMessage<T = unknown> extends WSMessageBase {
593
839
  */
594
840
  interface WSErrorMessage extends WSMessageBase {
595
841
  type: 'error';
596
- /** ID of the request that caused the error (if applicable) */
597
842
  requestId?: string;
598
843
  payload: {
599
844
  code: string;
@@ -606,23 +851,17 @@ interface WSErrorMessage extends WSMessageBase {
606
851
  */
607
852
  interface WSWorkflowProgressMessage extends WSMessageBase {
608
853
  type: 'workflowProgress';
609
- /** ID of the workflow execution request */
610
854
  requestId: string;
611
855
  payload: {
612
856
  workflowId: string;
613
- /** Current step index (0-based) */
614
857
  currentStep: number;
615
- /** Total number of steps */
616
858
  totalSteps: number;
617
- /** Current step info */
618
859
  step: {
619
860
  id: string;
620
- type: WorkflowStep['type'];
861
+ type: string;
621
862
  status: 'pending' | 'running' | 'completed' | 'failed';
622
863
  };
623
- /** Result of the current step (if completed) */
624
864
  stepResult?: unknown;
625
- /** Error (if failed) */
626
865
  error?: string;
627
866
  };
628
867
  }
@@ -663,140 +902,105 @@ interface WSSubscriptionOptions {
663
902
  componentIds?: string[];
664
903
  }
665
904
  /**
666
- * UI State definition
667
- *
668
- * Represents a distinct state in the UI (e.g., "LoginForm", "Dashboard", "Modal").
669
- * States can be active or inactive, and can block other states from activating.
670
- */
671
- interface UIState {
672
- /** Unique state identifier */
673
- id: string;
674
- /** Human-readable name */
675
- name: string;
676
- /** Element IDs belonging to this state */
677
- elements: string[];
678
- /** Optional function to detect if state is active */
679
- activeWhen?: () => boolean;
680
- /** If true, blocks other state activations (modal behavior) */
681
- blocking?: boolean;
682
- /** Specific state IDs this state blocks */
683
- blocks?: string[];
684
- /** State group membership */
685
- group?: string;
686
- /** Cost for pathfinding (default: 1.0) */
687
- pathCost?: number;
688
- /** Custom metadata */
689
- metadata?: Record<string, unknown>;
690
- }
691
- /**
692
- * State group - states that activate/deactivate atomically
693
- *
694
- * When a group is activated, all its states are activated together.
695
- * When deactivated, all states are deactivated together.
696
- */
697
- interface UIStateGroup {
698
- /** Unique group identifier */
699
- id: string;
700
- /** Human-readable name */
701
- name: string;
702
- /** State IDs belonging to this group */
703
- states: string[];
704
- }
705
- /**
706
- * State transition definition
707
- *
708
- * Defines how to move from one set of states to another,
709
- * including any actions to execute during the transition.
710
- */
711
- interface UITransition {
712
- /** Unique transition identifier */
905
+ * ARIA checked state (can be boolean or 'mixed' for indeterminate)
906
+ */
907
+ type AriaCheckedState = boolean | 'mixed';
908
+ /**
909
+ * Accessibility information for a UI element
910
+ */
911
+ interface ElementAccessibility {
912
+ /** The element's computed role (explicit or implicit) */
913
+ role: string;
914
+ /** Computed accessible name following ARIA name computation */
915
+ accessibleName?: string;
916
+ /** Computed accessible description */
917
+ accessibleDescription?: string;
918
+ /** Value of aria-label attribute */
919
+ ariaLabel?: string;
920
+ /** Value of aria-labelledby attribute */
921
+ ariaLabelledBy?: string;
922
+ /** Value of aria-describedby attribute */
923
+ ariaDescribedBy?: string;
924
+ /** Whether element is expanded (for expandable elements) */
925
+ ariaExpanded?: boolean;
926
+ /** Whether element is selected (for selectable elements) */
927
+ ariaSelected?: boolean;
928
+ /** Checked state (for checkboxes, can be true/false/'mixed') */
929
+ ariaChecked?: AriaCheckedState;
930
+ /** Whether element is hidden from accessibility tree */
931
+ ariaHidden?: boolean;
932
+ /** Whether element is disabled via aria-disabled */
933
+ ariaDisabled?: boolean;
934
+ /** Whether element is required (for form inputs) */
935
+ ariaRequired?: boolean;
936
+ /** Current aria-live value for live regions */
937
+ ariaLive?: 'off' | 'polite' | 'assertive';
938
+ /** Tab index value */
939
+ tabIndex: number;
940
+ /** Whether element is in the tab order (tabindex >= 0 or naturally focusable) */
941
+ isInTabOrder: boolean;
942
+ /** Whether element can receive keyboard focus */
943
+ isKeyboardAccessible: boolean;
944
+ /** The implicit role based on element type (before explicit role override) */
945
+ implicitRole?: string;
946
+ /** Whether element has an explicit role attribute */
947
+ hasExplicitRole: boolean;
948
+ }
949
+ /**
950
+ * WCAG conformance level
951
+ */
952
+ type WCAGLevel = 'A' | 'AA' | 'AAA';
953
+ /**
954
+ * Accessibility issue severity
955
+ */
956
+ type AccessibilitySeverity = 'critical' | 'serious' | 'moderate' | 'minor';
957
+ /**
958
+ * An accessibility issue found during validation
959
+ */
960
+ interface AccessibilityIssue {
961
+ /** Unique identifier for this issue instance */
713
962
  id: string;
714
- /** Human-readable name */
715
- name: string;
716
- /** Precondition: at least one must be active */
717
- fromStates: string[];
718
- /** States to activate */
719
- activateStates: string[];
720
- /** States to deactivate */
721
- exitStates: string[];
722
- /** Groups to activate */
723
- activateGroups?: string[];
724
- /** Groups to deactivate */
725
- exitGroups?: string[];
726
- /** Actions to execute during transition */
727
- actions?: WorkflowStep[];
728
- /** Cost for pathfinding */
729
- pathCost?: number;
730
- /** Whether source states remain visible during transition */
731
- staysVisible?: boolean;
732
- }
733
- /**
734
- * Path result from pathfinding
735
- *
736
- * Returned when searching for a path to target states.
737
- */
738
- interface PathResult {
739
- /** Whether a path was found */
740
- found: boolean;
741
- /** Transition IDs in order to reach target */
742
- transitions: string[];
743
- /** Total cost of the path */
744
- totalCost: number;
745
- /** Target state IDs */
746
- targetStates: string[];
747
- /** Estimated number of steps */
748
- estimatedSteps: number;
749
- }
750
- /**
751
- * Transition execution result
752
- */
753
- interface TransitionResult {
754
- /** Whether the transition succeeded */
755
- success: boolean;
756
- /** States that were activated */
757
- activatedStates: string[];
758
- /** States that were deactivated */
759
- deactivatedStates: string[];
760
- /** Error message if failed */
761
- error?: string;
762
- /** Phase where failure occurred (if any) */
763
- failedPhase?: string;
764
- /** Duration of the transition in milliseconds */
765
- durationMs: number;
766
- }
767
- /**
768
- * Navigation result
769
- *
770
- * Returned after navigating to target states via pathfinding.
771
- */
772
- interface NavigationResult {
773
- /** Whether navigation succeeded */
774
- success: boolean;
775
- /** The path that was followed */
776
- path: PathResult;
777
- /** Transitions that were executed */
778
- executedTransitions: string[];
779
- /** Final active states after navigation */
780
- finalActiveStates: string[];
781
- /** Error message if failed */
782
- error?: string;
783
- /** Duration of the navigation in milliseconds */
784
- durationMs: number;
963
+ /** The WCAG success criterion this issue relates to (e.g., "4.1.2") */
964
+ wcagCriterion: string;
965
+ /** How severe this issue is */
966
+ severity: AccessibilitySeverity;
967
+ /** WCAG conformance level this criterion belongs to */
968
+ level: WCAGLevel;
969
+ /** Human-readable description of the issue */
970
+ message: string;
971
+ /** ID of the element with the issue */
972
+ elementId: string;
973
+ /** Selector to find the element */
974
+ elementSelector?: string;
975
+ /** Suggested fix for the issue */
976
+ suggestion: string;
977
+ /** The rule ID that detected this issue */
978
+ ruleId: string;
785
979
  }
786
980
  /**
787
- * State manager snapshot
981
+ * Accessibility validation report
788
982
  */
789
- interface StateSnapshot {
790
- /** Timestamp of the snapshot */
983
+ interface AccessibilityReport {
984
+ /** When the validation was performed */
791
985
  timestamp: number;
792
- /** Currently active state IDs */
793
- activeStates: string[];
794
- /** All registered states */
795
- states: UIState[];
796
- /** All registered state groups */
797
- groups: UIStateGroup[];
798
- /** All registered transitions */
799
- transitions: UITransition[];
986
+ /** URL of the page that was validated */
987
+ url: string;
988
+ /** Number of elements that were scanned */
989
+ elementsScanned: number;
990
+ /** All issues found during validation */
991
+ issues: AccessibilityIssue[];
992
+ /** Number of checks that passed */
993
+ passedCount: number;
994
+ /** Number of checks that failed */
995
+ failedCount: number;
996
+ /** Whether the page meets WCAG 2.1 Level A */
997
+ meetsWCAG_A: boolean;
998
+ /** Whether the page meets WCAG 2.1 Level AA */
999
+ meetsWCAG_AA: boolean;
1000
+ /** Human-readable summary of the validation */
1001
+ summary: string;
1002
+ /** Duration of the validation in milliseconds */
1003
+ durationMs: number;
800
1004
  }
801
1005
 
802
- export type { WSWorkflowProgressMessage as $, ActionHandler as A, BranchCondition as B, ComponentAction as C, WSFindMessage as D, ElementIdentifier as E, WSGetElementMessage as F, WSGetSnapshotMessage as G, WSMessageBase as H, WSPingMessage as I, WSPongMessage as J, WSResponseMessage as K, LogConfig as L, WSServerMessage as M, NavigationResult as N, WSServerMessageType as O, PathResult as P, WSSubscribeMessage as Q, RegisteredComponent as R, StandardAction as S, TransitionResult as T, UIBridgeConfig as U, WSSubscribedMessage as V, WSClientConfig as W, WSSubscriptionOptions as X, WSUnsubscribeMessage as Y, WSUnsubscribedMessage as Z, WSWelcomeMessage as _, ActionRequest as a, WaitOptions as a0, Workflow as a1, WorkflowStep as a2, WorkflowStepType as a3, ActionResponse as b, BridgeEvent as c, BridgeEventListener as d, BridgeEventType as e, BridgeSnapshot as f, CustomAction as g, ElementState as h, ElementType as i, ExtractConfig as j, LoopConfig as k, RegisteredElement as l, StateSnapshot as m, UIBridgeFeatures as n, UIState as o, UIStateGroup as p, UITransition as q, WSClientMessage as r, WSClientMessageType as s, WSConnectionState as t, WSDiscoverMessage as u, WSErrorMessage as v, WSEventMessage as w, WSExecuteActionMessage as x, WSExecuteComponentActionMessage as y, WSExecuteWorkflowMessage as z };
1006
+ export type { WSGetElementMessage as $, AccessibilityIssue as A, BranchCondition as B, ComponentAction as C, UIBridgeFeatures as D, ElementAccessibility as E, UIState as F, UIStateGroup as G, UITransition as H, WSClientConfig as I, WSClientMessage as J, WSClientMessageType as K, LogConfig as L, WSConnectionState as M, NavigationResult as N, WSDiscoverMessage as O, PartialMatch as P, WSErrorMessage as Q, RecoveryAction as R, StandardAction as S, TransitionResult as T, UIBridgeConfig as U, WSEventMessage as V, WCAGLevel as W, WSExecuteActionMessage as X, WSExecuteComponentActionMessage as Y, WSExecuteWorkflowMessage as Z, WSFindMessage as _, AccessibilityReport as a, WSGetSnapshotMessage as a0, WSMessageBase as a1, WSPingMessage as a2, WSPongMessage as a3, WSResponseMessage as a4, WSServerMessage as a5, WSServerMessageType as a6, WSSubscribeMessage as a7, WSSubscribedMessage as a8, WSSubscriptionOptions as a9, WSUnsubscribeMessage as aa, WSUnsubscribedMessage as ab, WSWelcomeMessage as ac, WSWorkflowProgressMessage as ad, WaitOptions as ae, Workflow as af, WorkflowStep as ag, WorkflowStepType as ah, AccessibilitySeverity as b, ActionErrorCode as c, ActionFailureDetails as d, ActionHandler as e, ActionRequest as f, ActionResponse as g, AriaCheckedState as h, BridgeEvent as i, BridgeEventListener as j, BridgeEventType as k, BridgeSnapshot as l, ComponentStateResponse as m, ComputedProperty as n, CustomAction as o, ElementIdentifier as p, ElementState as q, ElementType as r, ExtendedWorkflowStep as s, ExtractConfig as t, LoopConfig as u, PathResult as v, RegisteredComponent as w, RegisteredElement as x, StateGetter as y, StateSnapshot as z };