@qontinui/ui-bridge-native 0.2.0 → 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 (43) hide show
  1. package/dist/{useUIBridgeToast-GmT1TzUe.d.mts → StateAnnotation-D8reaRcS.d.mts} +42 -7
  2. package/dist/{useUIBridgeToast-D32KXyL1.d.ts → StateAnnotation-WmK1YjwP.d.ts} +42 -7
  3. package/dist/control/index.d.mts +4 -4
  4. package/dist/control/index.d.ts +4 -4
  5. package/dist/core/index.d.mts +3 -3
  6. package/dist/core/index.d.ts +3 -3
  7. package/dist/core/index.js +39 -1
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +39 -1
  10. package/dist/core/index.mjs.map +1 -1
  11. package/dist/debug/index.js +2 -2
  12. package/dist/debug/index.js.map +1 -1
  13. package/dist/debug/index.mjs +2 -2
  14. package/dist/debug/index.mjs.map +1 -1
  15. package/dist/design/index.d.mts +1 -1
  16. package/dist/design/index.d.ts +1 -1
  17. package/dist/{http-server-DCdR8WlL.d.mts → http-server-D2U1k48d.d.mts} +89 -8
  18. package/dist/{http-server-Dj3grQW4.d.ts → http-server-ck8clUsZ.d.ts} +89 -8
  19. package/dist/index.d.mts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +372 -39
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +372 -41
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/react/index.d.mts +5 -5
  26. package/dist/react/index.d.ts +5 -5
  27. package/dist/react/index.js +354 -39
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/react/index.mjs +354 -41
  30. package/dist/react/index.mjs.map +1 -1
  31. package/dist/{registry-Cahd8Gn2.d.mts → registry-BxXaxmsT.d.ts} +24 -1
  32. package/dist/{registry-z-3WJsxp.d.ts → registry-KdUW_koV.d.mts} +24 -1
  33. package/dist/server/index.d.mts +5 -5
  34. package/dist/server/index.d.ts +5 -5
  35. package/dist/server/index.js +272 -16
  36. package/dist/server/index.js.map +1 -1
  37. package/dist/server/index.mjs +272 -16
  38. package/dist/server/index.mjs.map +1 -1
  39. package/dist/{types-Oz13YLZq.d.mts → types-BwdPNpII.d.mts} +52 -4
  40. package/dist/{types-Oz13YLZq.d.ts → types-BwdPNpII.d.ts} +52 -4
  41. package/dist/{types-ajakyp-l.d.ts → types-DCEv5qb6.d.ts} +1 -1
  42. package/dist/{types-DAfCeWXc.d.mts → types-DjB0zJJH.d.mts} +1 -1
  43. package/package.json +2 -2
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1 from 'react';
3
- import { p as NativeModalInfo, s as NativeSnapshotModalContext, f as NativeCapturedToast, t as NativeSnapshotToastContext, u as NativeSnapshotUndoContext, x as NativeUIBridgeFeatures, w as NativeUIBridgeConfig, y as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, l as NativeElementType, v as NativeStandardAction, h as NativeCustomAction, k as NativeElementState, j as NativeElementRef, i as NativeElementIdentifier, z as Workflow, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse } from './types-Oz13YLZq.mjs';
4
- import { a as NativeUIBridgeRegistry } from './registry-Cahd8Gn2.mjs';
5
- import { N as NativeActionExecutor } from './types-DAfCeWXc.mjs';
6
- import { i as NativeUIBridgeServer, m as ServerAdapter, l as RouteProvider } from './http-server-DCdR8WlL.mjs';
2
+ import React$1, { ReactNode, ReactElement } from 'react';
3
+ import { p as NativeModalInfo, t as NativeSnapshotModalContext, f as NativeCapturedToast, u as NativeSnapshotToastContext, v as NativeSnapshotUndoContext, y as NativeUIBridgeFeatures, x as NativeUIBridgeConfig, z as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, k as NativeElementState, j as NativeElementRef, i as NativeElementIdentifier, E as Workflow, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse } from './types-BwdPNpII.mjs';
4
+ import { a as NativeUIBridgeRegistry } from './registry-KdUW_koV.mjs';
5
+ import { N as NativeActionExecutor } from './types-DjB0zJJH.mjs';
6
+ import { l as NativeUIBridgeServer, p as ServerAdapter, o as RouteProvider } from './http-server-D2U1k48d.mjs';
7
7
 
8
8
  /**
9
9
  * Cloud Relay Client — WebSocket tunnel from mobile device to backend
@@ -72,7 +72,13 @@ declare class ModalDetector {
72
72
  /** Map preserves O(1) idempotent replace by id; ordering comes from detectedAt. */
73
73
  private modals;
74
74
  pushModal(modal: ModalPushInput): void;
75
- dismissModal(id: string): void;
75
+ /**
76
+ * Remove a modal from the stack. Returns `true` if a modal with that id
77
+ * was actually deleted, `false` if nothing matched (idempotent so repeated
78
+ * calls don't throw, but callers — e.g. the HTTP test-hook endpoint — can
79
+ * surface the miss to clients).
80
+ */
81
+ dismissModal(id: string): boolean;
76
82
  getSnapshotModalContext(): NativeSnapshotModalContext;
77
83
  getActive(): NativeModalInfo[];
78
84
  clear(): void;
@@ -717,4 +723,33 @@ declare function useToastRecorder(): {
717
723
  dismissToast: (id: string) => void;
718
724
  };
719
725
 
720
- export { type ActionRecord as A, useUIBridgeNativeRequired as B, CloudRelayClient as C, type DeclaredUndoState as D, useUIBridgeRequired as E, useUIBridgeToast as F, useUIComponent as G, useUIComponentAction as H, useUIElement as I, useUIElementWithProps as J, ModalDetector as M, ToastCapture as T, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, type ModalPushInput as e, type ToastCaptureConfig as f, type ToastRecordInput as g, type ToastRecorderInput as h, UIBridgeNativeProvider as i, type UIBridgeNativeProviderProps as j, type UIBridgeProps as k, UndoTracker as l, type UndoTrackerConfig as m, type UseUIBridgeModalOptions as n, type UseUIBridgeReturn as o, type UseUIBridgeToastOptions as p, type UseUIComponentOptions as q, type UseUIComponentReturn as r, type UseUIElementOptions as s, type UseUIElementReturn as t, type UseUIElementWithPropsReturn as u, useToastRecorder as v, useUIBridge as w, useUIBridgeModal as x, useUIBridgeNative as y, useUIBridgeNativeOptional as z };
726
+ interface StateAnnotationRequiredElement {
727
+ role?: string;
728
+ text?: string;
729
+ testID?: string;
730
+ [key: string]: unknown;
731
+ }
732
+ interface StateProps {
733
+ id: string;
734
+ name?: string;
735
+ description?: string;
736
+ requiredElements?: StateAnnotationRequiredElement[];
737
+ blocking?: boolean;
738
+ children?: ReactNode;
739
+ [key: string]: unknown;
740
+ }
741
+ declare function State(props: StateProps): ReactElement;
742
+ interface TransitionToProps {
743
+ id: string;
744
+ name?: string;
745
+ fromStates?: string[];
746
+ activateStates?: string[];
747
+ exitStates?: string[];
748
+ effect?: string;
749
+ description?: string;
750
+ children?: ReactNode;
751
+ [key: string]: unknown;
752
+ }
753
+ declare function TransitionTo(props: TransitionToProps): ReactElement;
754
+
755
+ export { type ActionRecord as A, useUIBridge as B, CloudRelayClient as C, type DeclaredUndoState as D, useUIBridgeModal as E, useUIBridgeNative as F, useUIBridgeNativeOptional as G, useUIBridgeNativeRequired as H, useUIBridgeRequired as I, useUIBridgeToast as J, useUIComponent as K, useUIComponentAction as L, ModalDetector as M, useUIElement as N, useUIElementWithProps as O, State as S, ToastCapture as T, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, type ModalPushInput as e, type StateAnnotationRequiredElement as f, type StateProps as g, type ToastCaptureConfig as h, type ToastRecordInput as i, type ToastRecorderInput as j, TransitionTo as k, type TransitionToProps as l, UIBridgeNativeProvider as m, type UIBridgeNativeProviderProps as n, type UIBridgeProps as o, UndoTracker as p, type UndoTrackerConfig as q, type UseUIBridgeModalOptions as r, type UseUIBridgeReturn as s, type UseUIBridgeToastOptions as t, type UseUIComponentOptions as u, type UseUIComponentReturn as v, type UseUIElementOptions as w, type UseUIElementReturn as x, type UseUIElementWithPropsReturn as y, useToastRecorder as z };
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1 from 'react';
3
- import { p as NativeModalInfo, s as NativeSnapshotModalContext, f as NativeCapturedToast, t as NativeSnapshotToastContext, u as NativeSnapshotUndoContext, x as NativeUIBridgeFeatures, w as NativeUIBridgeConfig, y as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, l as NativeElementType, v as NativeStandardAction, h as NativeCustomAction, k as NativeElementState, j as NativeElementRef, i as NativeElementIdentifier, z as Workflow, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse } from './types-Oz13YLZq.js';
4
- import { a as NativeUIBridgeRegistry } from './registry-z-3WJsxp.js';
5
- import { N as NativeActionExecutor } from './types-ajakyp-l.js';
6
- import { i as NativeUIBridgeServer, m as ServerAdapter, l as RouteProvider } from './http-server-Dj3grQW4.js';
2
+ import React$1, { ReactNode, ReactElement } from 'react';
3
+ import { p as NativeModalInfo, t as NativeSnapshotModalContext, f as NativeCapturedToast, u as NativeSnapshotToastContext, v as NativeSnapshotUndoContext, y as NativeUIBridgeFeatures, x as NativeUIBridgeConfig, z as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, k as NativeElementState, j as NativeElementRef, i as NativeElementIdentifier, E as Workflow, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse } from './types-BwdPNpII.js';
4
+ import { a as NativeUIBridgeRegistry } from './registry-BxXaxmsT.js';
5
+ import { N as NativeActionExecutor } from './types-DCEv5qb6.js';
6
+ import { l as NativeUIBridgeServer, p as ServerAdapter, o as RouteProvider } from './http-server-ck8clUsZ.js';
7
7
 
8
8
  /**
9
9
  * Cloud Relay Client — WebSocket tunnel from mobile device to backend
@@ -72,7 +72,13 @@ declare class ModalDetector {
72
72
  /** Map preserves O(1) idempotent replace by id; ordering comes from detectedAt. */
73
73
  private modals;
74
74
  pushModal(modal: ModalPushInput): void;
75
- dismissModal(id: string): void;
75
+ /**
76
+ * Remove a modal from the stack. Returns `true` if a modal with that id
77
+ * was actually deleted, `false` if nothing matched (idempotent so repeated
78
+ * calls don't throw, but callers — e.g. the HTTP test-hook endpoint — can
79
+ * surface the miss to clients).
80
+ */
81
+ dismissModal(id: string): boolean;
76
82
  getSnapshotModalContext(): NativeSnapshotModalContext;
77
83
  getActive(): NativeModalInfo[];
78
84
  clear(): void;
@@ -717,4 +723,33 @@ declare function useToastRecorder(): {
717
723
  dismissToast: (id: string) => void;
718
724
  };
719
725
 
720
- export { type ActionRecord as A, useUIBridgeNativeRequired as B, CloudRelayClient as C, type DeclaredUndoState as D, useUIBridgeRequired as E, useUIBridgeToast as F, useUIComponent as G, useUIComponentAction as H, useUIElement as I, useUIElementWithProps as J, ModalDetector as M, ToastCapture as T, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, type ModalPushInput as e, type ToastCaptureConfig as f, type ToastRecordInput as g, type ToastRecorderInput as h, UIBridgeNativeProvider as i, type UIBridgeNativeProviderProps as j, type UIBridgeProps as k, UndoTracker as l, type UndoTrackerConfig as m, type UseUIBridgeModalOptions as n, type UseUIBridgeReturn as o, type UseUIBridgeToastOptions as p, type UseUIComponentOptions as q, type UseUIComponentReturn as r, type UseUIElementOptions as s, type UseUIElementReturn as t, type UseUIElementWithPropsReturn as u, useToastRecorder as v, useUIBridge as w, useUIBridgeModal as x, useUIBridgeNative as y, useUIBridgeNativeOptional as z };
726
+ interface StateAnnotationRequiredElement {
727
+ role?: string;
728
+ text?: string;
729
+ testID?: string;
730
+ [key: string]: unknown;
731
+ }
732
+ interface StateProps {
733
+ id: string;
734
+ name?: string;
735
+ description?: string;
736
+ requiredElements?: StateAnnotationRequiredElement[];
737
+ blocking?: boolean;
738
+ children?: ReactNode;
739
+ [key: string]: unknown;
740
+ }
741
+ declare function State(props: StateProps): ReactElement;
742
+ interface TransitionToProps {
743
+ id: string;
744
+ name?: string;
745
+ fromStates?: string[];
746
+ activateStates?: string[];
747
+ exitStates?: string[];
748
+ effect?: string;
749
+ description?: string;
750
+ children?: ReactNode;
751
+ [key: string]: unknown;
752
+ }
753
+ declare function TransitionTo(props: TransitionToProps): ReactElement;
754
+
755
+ export { type ActionRecord as A, useUIBridge as B, CloudRelayClient as C, type DeclaredUndoState as D, useUIBridgeModal as E, useUIBridgeNative as F, useUIBridgeNativeOptional as G, useUIBridgeNativeRequired as H, useUIBridgeRequired as I, useUIBridgeToast as J, useUIComponent as K, useUIComponentAction as L, ModalDetector as M, useUIElement as N, useUIElementWithProps as O, State as S, ToastCapture as T, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, type ModalPushInput as e, type StateAnnotationRequiredElement as f, type StateProps as g, type ToastCaptureConfig as h, type ToastRecordInput as i, type ToastRecorderInput as j, TransitionTo as k, type TransitionToProps as l, UIBridgeNativeProvider as m, type UIBridgeNativeProviderProps as n, type UIBridgeProps as o, UndoTracker as p, type UndoTrackerConfig as q, type UseUIBridgeModalOptions as r, type UseUIBridgeReturn as s, type UseUIBridgeToastOptions as t, type UseUIComponentOptions as u, type UseUIComponentReturn as v, type UseUIElementOptions as w, type UseUIElementReturn as x, type UseUIElementWithPropsReturn as y, useToastRecorder as z };
@@ -1,7 +1,7 @@
1
- import { N as NativeActionExecutor, f as NativeActionListener, C as ControlActionRequest, a as ControlActionResponse, b as ComponentActionRequest, c as ComponentActionResponse, W as WaitResult } from '../types-DAfCeWXc.mjs';
2
- export { A as ActionExecutionOptions, g as NativeActionEvent, h as PageNavigateRequest, e as PageNavigationResponse, P as PressActionParams, S as ScrollActionParams, d as SwipeActionParams, T as TypeActionParams } from '../types-DAfCeWXc.mjs';
3
- import { a as NativeUIBridgeRegistry } from '../registry-Cahd8Gn2.mjs';
4
- import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-Oz13YLZq.mjs';
1
+ import { N as NativeActionExecutor, f as NativeActionListener, C as ControlActionRequest, a as ControlActionResponse, b as ComponentActionRequest, c as ComponentActionResponse, W as WaitResult } from '../types-DjB0zJJH.mjs';
2
+ export { A as ActionExecutionOptions, g as NativeActionEvent, h as PageNavigateRequest, e as PageNavigationResponse, P as PressActionParams, S as ScrollActionParams, d as SwipeActionParams, T as TypeActionParams } from '../types-DjB0zJJH.mjs';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-KdUW_koV.mjs';
4
+ import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-BwdPNpII.mjs';
5
5
 
6
6
  /**
7
7
  * Native Action Executor
@@ -1,7 +1,7 @@
1
- import { N as NativeActionExecutor, f as NativeActionListener, C as ControlActionRequest, a as ControlActionResponse, b as ComponentActionRequest, c as ComponentActionResponse, W as WaitResult } from '../types-ajakyp-l.js';
2
- export { A as ActionExecutionOptions, g as NativeActionEvent, h as PageNavigateRequest, e as PageNavigationResponse, P as PressActionParams, S as ScrollActionParams, d as SwipeActionParams, T as TypeActionParams } from '../types-ajakyp-l.js';
3
- import { a as NativeUIBridgeRegistry } from '../registry-z-3WJsxp.js';
4
- import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-Oz13YLZq.js';
1
+ import { N as NativeActionExecutor, f as NativeActionListener, C as ControlActionRequest, a as ControlActionResponse, b as ComponentActionRequest, c as ComponentActionResponse, W as WaitResult } from '../types-DCEv5qb6.js';
2
+ export { A as ActionExecutionOptions, g as NativeActionEvent, h as PageNavigateRequest, e as PageNavigationResponse, P as PressActionParams, S as ScrollActionParams, d as SwipeActionParams, T as TypeActionParams } from '../types-DCEv5qb6.js';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-BxXaxmsT.js';
4
+ import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-BwdPNpII.js';
5
5
 
6
6
  /**
7
7
  * Native Action Executor
@@ -1,6 +1,6 @@
1
- import { i as NativeElementIdentifier, y as RegisteredNativeElement } from '../types-Oz13YLZq.mjs';
2
- export { A as ActionHandler, B as BridgeEvent, a as BridgeEventListener, b as BridgeEventType, C as ComponentAction, c as CustomAction, D as DiscoveredNativeElement, N as NativeActionRequest, d as NativeActionResponse, e as NativeBridgeSnapshot, f as NativeCapturedToast, g as NativeComponentAction, h as NativeCustomAction, j as NativeElementRef, k as NativeElementState, l as NativeElementType, m as NativeFindRequest, n as NativeFindResponse, o as NativeLayout, p as NativeModalInfo, q as NativeSnapshotEnricher, r as NativeSnapshotEnrichers, s as NativeSnapshotModalContext, t as NativeSnapshotToastContext, u as NativeSnapshotUndoContext, v as NativeStandardAction, w as NativeUIBridgeConfig, x as NativeUIBridgeFeatures, R as RegisteredNativeComponent, W as WaitOptions, z as Workflow, E as WorkflowStep, F as WorkflowStepType } from '../types-Oz13YLZq.mjs';
3
- export { N as NativeRegistryConfig, a as NativeUIBridgeRegistry, R as RegisterComponentOptions, b as RegisterElementOptions, e as extractHandlerNames, g as getGlobalRegistry, r as resetGlobalRegistry, s as setGlobalRegistry } from '../registry-Cahd8Gn2.mjs';
1
+ import { i as NativeElementIdentifier, z as RegisteredNativeElement } from '../types-BwdPNpII.mjs';
2
+ export { A as ActionHandler, B as BridgeEvent, a as BridgeEventListener, b as BridgeEventType, C as ComponentAction, c as CustomAction, D as DiscoveredNativeElement, N as NativeActionRequest, d as NativeActionResponse, e as NativeBridgeSnapshot, f as NativeCapturedToast, g as NativeComponentAction, h as NativeCustomAction, j as NativeElementRef, k as NativeElementState, l as NativeElementType, m as NativeFindRequest, n as NativeFindResponse, o as NativeLayout, H as NativeModalDetectorLike, p as NativeModalInfo, q as NativeRegistrationCoverage, r as NativeSnapshotEnricher, s as NativeSnapshotEnrichers, t as NativeSnapshotModalContext, u as NativeSnapshotToastContext, v as NativeSnapshotUndoContext, w as NativeStandardAction, x as NativeUIBridgeConfig, y as NativeUIBridgeFeatures, R as RegisteredNativeComponent, W as WaitOptions, E as Workflow, F as WorkflowStep, G as WorkflowStepType } from '../types-BwdPNpII.mjs';
3
+ export { N as NativeRegistryConfig, a as NativeUIBridgeRegistry, R as RegisterComponentOptions, b as RegisterElementOptions, e as extractHandlerNames, g as getGlobalRegistry, r as resetGlobalRegistry, s as setGlobalRegistry } from '../registry-KdUW_koV.mjs';
4
4
 
5
5
  /**
6
6
  * Native Element Identifier
@@ -1,6 +1,6 @@
1
- import { i as NativeElementIdentifier, y as RegisteredNativeElement } from '../types-Oz13YLZq.js';
2
- export { A as ActionHandler, B as BridgeEvent, a as BridgeEventListener, b as BridgeEventType, C as ComponentAction, c as CustomAction, D as DiscoveredNativeElement, N as NativeActionRequest, d as NativeActionResponse, e as NativeBridgeSnapshot, f as NativeCapturedToast, g as NativeComponentAction, h as NativeCustomAction, j as NativeElementRef, k as NativeElementState, l as NativeElementType, m as NativeFindRequest, n as NativeFindResponse, o as NativeLayout, p as NativeModalInfo, q as NativeSnapshotEnricher, r as NativeSnapshotEnrichers, s as NativeSnapshotModalContext, t as NativeSnapshotToastContext, u as NativeSnapshotUndoContext, v as NativeStandardAction, w as NativeUIBridgeConfig, x as NativeUIBridgeFeatures, R as RegisteredNativeComponent, W as WaitOptions, z as Workflow, E as WorkflowStep, F as WorkflowStepType } from '../types-Oz13YLZq.js';
3
- export { N as NativeRegistryConfig, a as NativeUIBridgeRegistry, R as RegisterComponentOptions, b as RegisterElementOptions, e as extractHandlerNames, g as getGlobalRegistry, r as resetGlobalRegistry, s as setGlobalRegistry } from '../registry-z-3WJsxp.js';
1
+ import { i as NativeElementIdentifier, z as RegisteredNativeElement } from '../types-BwdPNpII.js';
2
+ export { A as ActionHandler, B as BridgeEvent, a as BridgeEventListener, b as BridgeEventType, C as ComponentAction, c as CustomAction, D as DiscoveredNativeElement, N as NativeActionRequest, d as NativeActionResponse, e as NativeBridgeSnapshot, f as NativeCapturedToast, g as NativeComponentAction, h as NativeCustomAction, j as NativeElementRef, k as NativeElementState, l as NativeElementType, m as NativeFindRequest, n as NativeFindResponse, o as NativeLayout, H as NativeModalDetectorLike, p as NativeModalInfo, q as NativeRegistrationCoverage, r as NativeSnapshotEnricher, s as NativeSnapshotEnrichers, t as NativeSnapshotModalContext, u as NativeSnapshotToastContext, v as NativeSnapshotUndoContext, w as NativeStandardAction, x as NativeUIBridgeConfig, y as NativeUIBridgeFeatures, R as RegisteredNativeComponent, W as WaitOptions, E as Workflow, F as WorkflowStep, G as WorkflowStepType } from '../types-BwdPNpII.js';
3
+ export { N as NativeRegistryConfig, a as NativeUIBridgeRegistry, R as RegisterComponentOptions, b as RegisterElementOptions, e as extractHandlerNames, g as getGlobalRegistry, r as resetGlobalRegistry, s as setGlobalRegistry } from '../registry-BxXaxmsT.js';
4
4
 
5
5
  /**
6
6
  * Native Element Identifier
@@ -46,6 +46,13 @@ var NativeUIBridgeRegistry = class {
46
46
  this.eventListeners = /* @__PURE__ */ new Map();
47
47
  this.enrichers = {};
48
48
  this.snapshotExtras = /* @__PURE__ */ new Map();
49
+ /**
50
+ * Sticky flag: flips `true` the first time any element is registered and
51
+ * stays `true` even after elements are unregistered. Lets agents distinguish
52
+ * "this route never wired any elements" from "this route registered then
53
+ * unmounted".
54
+ */
55
+ this.everHadRegistrations = false;
49
56
  this.config = config;
50
57
  }
51
58
  // ============================================================================
@@ -58,6 +65,16 @@ var NativeUIBridgeRegistry = class {
58
65
  setEnrichers(e) {
59
66
  this.enrichers = { ...this.enrichers, ...e };
60
67
  }
68
+ /**
69
+ * Read-only accessor for the canonical enrichers slot. Returned object is
70
+ * the live reference, so callers can detect "no detector wired" via
71
+ * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP
72
+ * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need
73
+ * to drive the ModalDetector directly without re-instantiating it.
74
+ */
75
+ getEnrichers() {
76
+ return this.enrichers;
77
+ }
61
78
  /**
62
79
  * Register a custom snapshot enricher. The returned object will be
63
80
  * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
@@ -137,6 +154,7 @@ var NativeUIBridgeRegistry = class {
137
154
  stateStyles
138
155
  };
139
156
  this.elements.set(id, registered);
157
+ this.everHadRegistrations = true;
140
158
  this.emit("element:registered", { id, type, label });
141
159
  if (this.config.verbose) {
142
160
  console.log(`[ui-bridge-native] Registered element: ${id} (${type})`);
@@ -464,7 +482,8 @@ var NativeUIBridgeRegistry = class {
464
482
  stepCount: w.steps.length
465
483
  })),
466
484
  currentRoute: routeInfo?.currentRoute ?? null,
467
- segments: routeInfo?.segments
485
+ segments: routeInfo?.segments,
486
+ registration: this.getRegistrationCoverage()
468
487
  };
469
488
  if (this.enrichers.modalDetector) {
470
489
  try {
@@ -520,6 +539,25 @@ var NativeUIBridgeRegistry = class {
520
539
  workflows: this.workflows.size
521
540
  };
522
541
  }
542
+ /**
543
+ * Compute registration coverage metadata for the current registry state.
544
+ *
545
+ * Groups currently-registered elements by `registrationRoute`, bucketing
546
+ * elements without a route under `'?'`. `everHadRegistrations` is sticky —
547
+ * once true, it stays true for the lifetime of the registry instance.
548
+ */
549
+ getRegistrationCoverage() {
550
+ const byRoute = {};
551
+ for (const element of this.elements.values()) {
552
+ const key = element.registrationRoute == null || element.registrationRoute === "" ? "?" : element.registrationRoute;
553
+ byRoute[key] = (byRoute[key] ?? 0) + 1;
554
+ }
555
+ return {
556
+ totalRegistered: this.elements.size,
557
+ everHadRegistrations: this.everHadRegistrations,
558
+ byRoute
559
+ };
560
+ }
523
561
  /**
524
562
  * Clear all registrations
525
563
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/registry.ts","../../src/core/element-identifier.ts"],"names":[],"mappings":";;;AA4EO,SAAS,oBAAoB,KAAA,EAA2C;AAC7E,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,OAAO,MAAA,CAAO,IA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,IAAI,YAAY,CAAA,CAAA,CAAA;AAAA,EAC1B;AACA,EAAA,OAAO,IAAA;AACT;AAKO,SAAS,cAAc,QAAA,EAA4D;AACxF,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,KAAA,CAAM,YAAY,CAAA;AAC9C,EAAA,MAAM,QAAQ,UAAA,GAAa,QAAA,CAAS,WAAW,CAAC,CAAA,EAAG,EAAE,CAAA,GAAI,MAAA;AACzD,EAAA,MAAM,gBAAA,GAAmB,QAAA,CAAS,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAA;AACxD,EAAA,MAAM,aAAa,gBAAA,CAAiB,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AAE7D,EAAA,OAAO,EAAE,YAAY,KAAA,EAAM;AAC7B;AAKO,SAAS,iBAAA,CACd,YACA,QAAA,EACS;AACT,EAAA,IAAI,QAAA,CAAS,IAAA,IAAQ,UAAA,CAAW,IAAA,KAAS,SAAS,IAAA,EAAM;AACtD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,QAAA,CAAS,MAAA,IAAU,UAAA,CAAW,MAAA,KAAW,SAAS,MAAA,EAAQ;AAC5D,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IACE,QAAA,CAAS,kBAAA,IACT,UAAA,CAAW,kBAAA,KAAuB,SAAS,kBAAA,EAC3C;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,QAAA,CAAS,QAAA,IAAY,UAAA,CAAW,QAAA,KAAa,SAAS,QAAA,EAAU;AAClE,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT","file":"index.js","sourcesContent":["/**\n * Native Element and Component Registry\n *\n * Central registry for all UI elements and components registered with UI Bridge Native.\n * Adapted from ui-bridge for React Native environments.\n */\n\nimport type {\n RegisteredNativeElement,\n RegisteredNativeComponent,\n NativeElementState,\n NativeElementType,\n NativeStandardAction,\n NativeCustomAction,\n NativeBridgeSnapshot,\n NativeElementIdentifier,\n NativeElementRef,\n NativeSnapshotEnrichers,\n NativeSnapshotEnricher,\n Workflow,\n BridgeEvent,\n BridgeEventType,\n BridgeEventListener,\n} from './types';\n\n/**\n * Options for registering an element\n */\nexport interface RegisterElementOptions {\n type?: NativeElementType;\n label?: string;\n actions?: NativeStandardAction[];\n customActions?: Record<string, NativeCustomAction>;\n props?: Record<string, unknown>;\n treePath?: string;\n testId?: string;\n accessibilityLabel?: string;\n /** Route path where the element was registered (for page-scoped filtering) */\n registrationRoute?: string | null;\n /** Flattened RN style (from StyleSheet.flatten) for design review */\n flatStyle?: Record<string, unknown>;\n /** State-specific style overrides for design review */\n stateStyles?: {\n pressed?: Record<string, unknown>;\n focused?: Record<string, unknown>;\n disabled?: Record<string, unknown>;\n };\n}\n\n/**\n * Options for registering a component\n */\nexport interface RegisterComponentOptions {\n name: string;\n description?: string;\n actions?: Array<{\n id: string;\n label?: string;\n description?: string;\n handler: (params?: unknown) => unknown | Promise<unknown>;\n }>;\n elementIds?: string[];\n}\n\n/**\n * Registry configuration\n */\nexport interface NativeRegistryConfig {\n verbose?: boolean;\n onEvent?: BridgeEventListener;\n}\n\n/**\n * Extract handler function names from an element's props.\n * Returns names of props whose values are functions (e.g. ['onPress', 'onChangeText']).\n */\nexport function extractHandlerNames(props?: Record<string, unknown>): string[] {\n if (!props) return [];\n return Object.keys(props).filter((k) => typeof props[k] === 'function');\n}\n\n/**\n * Infer available actions based on element type\n */\nfunction inferActions(type: NativeElementType): NativeStandardAction[] {\n const baseActions: NativeStandardAction[] = ['focus', 'blur'];\n\n switch (type) {\n case 'button':\n case 'touchable':\n case 'pressable':\n return [...baseActions, 'click', 'press', 'longPress', 'doubleTap'];\n case 'input':\n return [...baseActions, 'click', 'press', 'type', 'clear'];\n case 'text':\n return [...baseActions, 'click', 'press', 'longPress'];\n case 'view':\n return [...baseActions, 'click', 'press'];\n case 'scroll':\n return [...baseActions, 'scroll', 'swipe'];\n case 'list':\n return [...baseActions, 'scroll', 'swipe'];\n case 'listItem':\n return [...baseActions, 'click', 'press', 'longPress', 'swipe'];\n case 'switch':\n case 'checkbox':\n return [...baseActions, 'click', 'press', 'toggle'];\n case 'radio':\n return [...baseActions, 'click', 'press'];\n case 'image':\n return [...baseActions, 'click', 'press', 'longPress'];\n case 'modal':\n return ['focus', 'blur'];\n case 'custom':\n default:\n return [...baseActions, 'click', 'press'];\n }\n}\n\n/**\n * Native UI Bridge Registry\n *\n * Manages registration and lookup of native UI elements and components.\n */\nexport class NativeUIBridgeRegistry {\n private elements = new Map<string, RegisteredNativeElement>();\n private components = new Map<string, RegisteredNativeComponent>();\n private workflows = new Map<string, Workflow>();\n private eventListeners = new Map<BridgeEventType, Set<BridgeEventListener>>();\n private config: NativeRegistryConfig;\n private enrichers: NativeSnapshotEnrichers = {};\n private snapshotExtras = new Map<string, NativeSnapshotEnricher>();\n\n constructor(config: NativeRegistryConfig = {}) {\n this.config = config;\n }\n\n // ============================================================================\n // Snapshot Enricher Slots\n // ============================================================================\n\n /**\n * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling\n * with a partial set merges into existing slots instead of clobbering them.\n */\n setEnrichers(e: Partial<NativeSnapshotEnrichers>): void {\n this.enrichers = { ...this.enrichers, ...e };\n }\n\n /**\n * Register a custom snapshot enricher. The returned object will be\n * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid\n * clobbering canonical fields. Returns a disposer.\n */\n registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void {\n this.snapshotExtras.set(name, fn);\n return () => this.unregisterSnapshotEnricher(name);\n }\n\n /** Remove a custom snapshot enricher by name */\n unregisterSnapshotEnricher(name: string): void {\n this.snapshotExtras.delete(name);\n }\n\n // ============================================================================\n // Element Management\n // ============================================================================\n\n /**\n * Register a native element\n */\n registerElement(\n id: string,\n ref: React.RefObject<NativeElementRef>,\n options: RegisterElementOptions = {}\n ): RegisteredNativeElement {\n const {\n type = 'custom',\n label,\n actions = inferActions(type),\n customActions,\n props,\n treePath = id,\n testId,\n accessibilityLabel,\n registrationRoute,\n flatStyle,\n stateStyles,\n } = options;\n\n // Create state getter\n const getState = (): NativeElementState => {\n const element = ref.current;\n if (!element) {\n return {\n mounted: false,\n visible: false,\n enabled: false,\n focused: false,\n layout: null,\n };\n }\n\n // State is populated by the element during onLayout\n // Here we return the stored state from the element's metadata\n const stored = this.elements.get(id);\n if (stored && stored.getState !== getState) {\n return stored.getState();\n }\n\n return {\n mounted: true,\n visible: true,\n enabled: true,\n focused: false,\n layout: null,\n };\n };\n\n // Create identifier getter\n const getIdentifier = (): NativeElementIdentifier => ({\n uiId: id,\n testId: testId || id,\n accessibilityLabel,\n treePath,\n });\n\n const registered: RegisteredNativeElement = {\n id,\n ref,\n type,\n label,\n actions,\n customActions,\n props,\n getState,\n getIdentifier,\n registeredAt: Date.now(),\n mounted: true,\n registrationRoute: registrationRoute ?? null,\n flatStyle,\n stateStyles,\n };\n\n this.elements.set(id, registered);\n\n this.emit('element:registered', { id, type, label });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered element: ${id} (${type})`);\n }\n\n // Seed a sensible initial state so elements are immediately visible in snapshots\n // even before onLayout fires. Layout-measuring code can overwrite this later.\n this.updateElementState(id, {\n mounted: true,\n visible: true,\n enabled: true,\n focused: false,\n layout: null,\n });\n\n return registered;\n }\n\n /**\n * Unregister an element\n */\n unregisterElement(id: string): void {\n const element = this.elements.get(id);\n if (element) {\n this.elements.delete(id);\n this.emit('element:unregistered', { id });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Unregistered element: ${id}`);\n }\n }\n }\n\n /**\n * Get a registered element\n */\n getElement(id: string): RegisteredNativeElement | undefined {\n return this.elements.get(id);\n }\n\n /**\n * Get all registered elements\n */\n getAllElements(): RegisteredNativeElement[] {\n return Array.from(this.elements.values());\n }\n\n /**\n * Get all registered elements that are visible and have a layout\n */\n getVisibleElements(): RegisteredNativeElement[] {\n return this.getAllElements().filter((e) => {\n const state = e.getState();\n return state.visible && state.layout !== null;\n });\n }\n\n /**\n * Get elements registered on a specific route (for page-scoped filtering)\n */\n getElementsForRoute(route: string): RegisteredNativeElement[] {\n return this.getAllElements().filter((e) => e.registrationRoute === route);\n }\n\n /**\n * Mark elements registered on a route as off-screen (visible: false, layout: null).\n *\n * Use this when a screen loses focus but stays mounted — common in React Navigation\n * tab navigators where inactive tabs remain in the tree. Without this call, stale\n * `layout` data lingers in snapshots and makes off-screen elements look rendered.\n *\n * Does NOT unregister the elements — they stay registered so the user's next visit\n * re-measures them via `onLayout` without re-mount cost. Elements without a\n * `registrationRoute` (app-wide registrations) are untouched.\n */\n markRouteOffscreen(route: string): void {\n // Guard against accidental global wipes. Elements registered without a\n // route have `registrationRoute: null` — passing null/empty here would\n // match every globally-registered element and erase their layouts.\n if (route == null || route === '') {\n if (this.config.verbose) {\n console.warn(\n `[ui-bridge-native] markRouteOffscreen called with null/empty route — ignoring`\n );\n }\n return;\n }\n let cleared = 0;\n for (const element of this.elements.values()) {\n if (element.registrationRoute === route) {\n this.updateElementState(element.id, {\n visible: false,\n layout: null,\n });\n cleared++;\n }\n }\n if (this.config.verbose && cleared > 0) {\n console.log(`[ui-bridge-native] Marked ${cleared} elements offscreen for route: ${route}`);\n }\n }\n\n /**\n * Update element state\n */\n updateElementState(id: string, state: Partial<NativeElementState>): void {\n const element = this.elements.get(id);\n if (element) {\n // Create a new getState that includes the updated state\n const currentState = element.getState();\n const newState = { ...currentState, ...state };\n\n const updated: RegisteredNativeElement = {\n ...element,\n getState: () => newState,\n };\n\n this.elements.set(id, updated);\n this.emit('element:stateChanged', { id, state: newState });\n }\n }\n\n /**\n * Update element props (for action execution)\n */\n updateElementProps(id: string, props: Record<string, unknown>): void {\n const element = this.elements.get(id);\n if (element) {\n const updated: RegisteredNativeElement = {\n ...element,\n props: { ...element.props, ...props },\n };\n this.elements.set(id, updated);\n }\n }\n\n /**\n * Update element style for design review\n */\n updateElementStyle(\n id: string,\n flatStyle: Record<string, unknown>,\n stateStyles?: {\n pressed?: Record<string, unknown>;\n focused?: Record<string, unknown>;\n disabled?: Record<string, unknown>;\n }\n ): void {\n const element = this.elements.get(id);\n if (element) {\n const updated: RegisteredNativeElement = {\n ...element,\n flatStyle,\n ...(stateStyles !== undefined ? { stateStyles } : {}),\n };\n this.elements.set(id, updated);\n }\n }\n\n /**\n * Get element style for design review\n */\n getElementStyle(id: string): Record<string, unknown> | null {\n const element = this.elements.get(id);\n return element?.flatStyle ?? null;\n }\n\n /**\n * Find element by testID\n */\n findByTestId(testId: string): RegisteredNativeElement | undefined {\n for (const element of this.elements.values()) {\n const identifier = element.getIdentifier();\n if (identifier.testId === testId) {\n return element;\n }\n }\n return undefined;\n }\n\n /**\n * Find elements by type\n */\n findByType(type: NativeElementType): RegisteredNativeElement[] {\n return Array.from(this.elements.values()).filter((e) => e.type === type);\n }\n\n // ============================================================================\n // Component Management\n // ============================================================================\n\n /**\n * Register a component\n */\n registerComponent(id: string, options: RegisterComponentOptions): RegisteredNativeComponent {\n const { name, description, actions = [], elementIds } = options;\n\n const registered: RegisteredNativeComponent = {\n id,\n name,\n description,\n actions: actions.map((a) => ({\n id: a.id,\n label: a.label,\n description: a.description,\n handler: a.handler,\n })),\n elementIds,\n registeredAt: Date.now(),\n mounted: true,\n };\n\n this.components.set(id, registered);\n\n this.emit('component:registered', { id, name });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered component: ${id} (${name})`);\n }\n\n return registered;\n }\n\n /**\n * Unregister a component\n */\n unregisterComponent(id: string): void {\n const component = this.components.get(id);\n if (component) {\n this.components.delete(id);\n this.emit('component:unregistered', { id });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Unregistered component: ${id}`);\n }\n }\n }\n\n /**\n * Get a registered component\n */\n getComponent(id: string): RegisteredNativeComponent | undefined {\n return this.components.get(id);\n }\n\n /**\n * Get all registered components\n */\n getAllComponents(): RegisteredNativeComponent[] {\n return Array.from(this.components.values());\n }\n\n // ============================================================================\n // Workflow Management\n // ============================================================================\n\n /**\n * Register a workflow\n */\n registerWorkflow(workflow: Workflow): void {\n this.workflows.set(workflow.id, workflow);\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered workflow: ${workflow.id}`);\n }\n }\n\n /**\n * Unregister a workflow\n */\n unregisterWorkflow(id: string): void {\n this.workflows.delete(id);\n }\n\n /**\n * Get a workflow\n */\n getWorkflow(id: string): Workflow | undefined {\n return this.workflows.get(id);\n }\n\n /**\n * Get all workflows\n */\n getAllWorkflows(): Workflow[] {\n return Array.from(this.workflows.values());\n }\n\n // ============================================================================\n // Event System\n // ============================================================================\n\n /**\n * Subscribe to events\n */\n on<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): () => void {\n if (!this.eventListeners.has(type)) {\n this.eventListeners.set(type, new Set());\n }\n this.eventListeners.get(type)!.add(listener as BridgeEventListener);\n\n // Return unsubscribe function\n return () => this.off(type, listener);\n }\n\n /**\n * Unsubscribe from events\n */\n off<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): void {\n this.eventListeners.get(type)?.delete(listener as BridgeEventListener);\n }\n\n /**\n * Emit an event\n */\n emit(type: BridgeEventType, data: unknown): void {\n const event: BridgeEvent = {\n type,\n timestamp: Date.now(),\n data,\n };\n\n // Notify listeners\n const listeners = this.eventListeners.get(type);\n if (listeners) {\n for (const listener of listeners) {\n try {\n listener(event);\n } catch (error) {\n console.error(`[ui-bridge-native] Event listener error:`, error);\n }\n }\n }\n\n // Notify global handler\n if (this.config.onEvent) {\n try {\n this.config.onEvent(event);\n } catch (error) {\n console.error(`[ui-bridge-native] Global event handler error:`, error);\n }\n }\n }\n\n // ============================================================================\n // Snapshots\n // ============================================================================\n\n /**\n * Create a snapshot of the current state\n */\n createSnapshot(\n routeInfo?: {\n currentRoute?: string | null;\n segments?: string[];\n },\n options?: { visibleOnly?: boolean; currentRouteOnly?: boolean }\n ): NativeBridgeSnapshot {\n let elements = options?.visibleOnly ? this.getVisibleElements() : this.getAllElements();\n\n // Filter to only elements registered on the current route\n if (options?.currentRouteOnly && routeInfo?.currentRoute) {\n const currentRoute = routeInfo.currentRoute;\n elements = elements.filter((e) => e.registrationRoute === currentRoute);\n }\n\n const snapshot: NativeBridgeSnapshot = {\n timestamp: Date.now(),\n elements: elements.map((e) => {\n const handlers = extractHandlerNames(e.props);\n return {\n id: e.id,\n type: e.type,\n label: e.label,\n identifier: e.getIdentifier(),\n state: e.getState(),\n actions: e.actions,\n customActions: e.customActions ? Object.keys(e.customActions) : undefined,\n registeredHandlers: handlers.length > 0 ? handlers : undefined,\n registrationRoute: e.registrationRoute,\n };\n }),\n components: this.getAllComponents().map((c) => ({\n id: c.id,\n name: c.name,\n description: c.description,\n actions: c.actions.map((a) => a.id),\n elementIds: c.elementIds,\n })),\n workflows: this.getAllWorkflows().map((w) => ({\n id: w.id,\n name: w.name,\n description: w.description,\n stepCount: w.steps.length,\n })),\n currentRoute: routeInfo?.currentRoute ?? null,\n segments: routeInfo?.segments,\n };\n\n // Canonical enrichers — each in its own try/catch so a misbehaving tracker\n // can never break the rest of the snapshot.\n if (this.enrichers.modalDetector) {\n try {\n snapshot.modalStack = this.enrichers.modalDetector.getSnapshotModalContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] modalDetector enricher threw:`, error);\n }\n }\n }\n if (this.enrichers.toastCapture) {\n try {\n snapshot.toasts = this.enrichers.toastCapture.getSnapshotToastContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] toastCapture enricher threw:`, error);\n }\n }\n }\n if (this.enrichers.undoTracker) {\n try {\n snapshot.undoRedo = this.enrichers.undoTracker.getSnapshotUndoContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] undoTracker enricher threw:`, error);\n }\n }\n }\n\n // Custom enrichers — keys assign-merged onto the snapshot\n if (this.snapshotExtras.size > 0) {\n const ctx = { elements, currentRoute: routeInfo?.currentRoute ?? null };\n for (const [name, fn] of this.snapshotExtras) {\n try {\n const extra = fn(ctx);\n if (extra && typeof extra === 'object') {\n Object.assign(snapshot, extra);\n }\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] snapshot enricher \"${name}\" threw:`, error);\n }\n }\n }\n }\n\n return snapshot;\n }\n\n /**\n * Get registry statistics\n */\n getStats(): { elements: number; components: number; workflows: number } {\n return {\n elements: this.elements.size,\n components: this.components.size,\n workflows: this.workflows.size,\n };\n }\n\n /**\n * Clear all registrations\n */\n clear(): void {\n this.elements.clear();\n this.components.clear();\n this.workflows.clear();\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registry cleared`);\n }\n }\n}\n\n// ============================================================================\n// Global Registry\n// ============================================================================\n\nlet globalRegistry: NativeUIBridgeRegistry | null = null;\n\n/**\n * Set the global registry\n */\nexport function setGlobalRegistry(registry: NativeUIBridgeRegistry): void {\n globalRegistry = registry;\n}\n\n/**\n * Get the global registry\n */\nexport function getGlobalRegistry(): NativeUIBridgeRegistry | null {\n return globalRegistry;\n}\n\n/**\n * Reset the global registry\n */\nexport function resetGlobalRegistry(): void {\n globalRegistry?.clear();\n globalRegistry = null;\n}\n","/**\n * Native Element Identifier\n *\n * Utilities for identifying and finding native elements.\n * In React Native, we use testID, accessibilityLabel, and tree paths\n * instead of XPath/CSS selectors.\n */\n\nimport type { NativeElementIdentifier, RegisteredNativeElement } from './types';\nimport { getGlobalRegistry } from './registry';\n\n/**\n * Create an element identifier for a native element\n */\nexport function createNativeElementIdentifier(\n id: string,\n options: {\n testId?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n treePath?: string;\n } = {}\n): NativeElementIdentifier {\n return {\n uiId: id,\n testId: options.testId || id,\n accessibilityLabel: options.accessibilityLabel,\n accessibilityHint: options.accessibilityHint,\n treePath: options.treePath || id,\n };\n}\n\n/**\n * Find an element by its identifier in the global registry\n */\nexport function findElementByIdentifier(\n identifier: string | NativeElementIdentifier\n): RegisteredNativeElement | null {\n const registry = getGlobalRegistry();\n if (!registry) return null;\n\n // If string, try different lookup strategies\n if (typeof identifier === 'string') {\n // Try direct ID lookup\n const byId = registry.getElement(identifier);\n if (byId) return byId;\n\n // Try testID lookup\n const byTestId = registry.findByTestId(identifier);\n if (byTestId) return byTestId;\n\n // Try pattern matching\n return findByPattern(registry, identifier);\n }\n\n // If identifier object, try each strategy\n if (identifier.uiId) {\n const byId = registry.getElement(identifier.uiId);\n if (byId) return byId;\n }\n\n if (identifier.testId) {\n const byTestId = registry.findByTestId(identifier.testId);\n if (byTestId) return byTestId;\n }\n\n return null;\n}\n\n/**\n * Find element by pattern (supports wildcards)\n */\nfunction findByPattern(\n registry: ReturnType<typeof getGlobalRegistry>,\n pattern: string\n): RegisteredNativeElement | null {\n if (!registry) return null;\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special chars\n .replace(/\\*/g, '.*') // Convert * to .*\n .replace(/\\?/g, '.'); // Convert ? to .\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n // Match against testId\n if (identifier.testId && regex.test(identifier.testId)) {\n return element;\n }\n\n // Match against uiId\n if (identifier.uiId && regex.test(identifier.uiId)) {\n return element;\n }\n\n // Match against treePath\n if (identifier.treePath && regex.test(identifier.treePath)) {\n return element;\n }\n\n // Match against accessibilityLabel\n if (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel)) {\n return element;\n }\n }\n\n return null;\n}\n\n/**\n * Find all elements matching a pattern\n */\nexport function findAllByPattern(pattern: string): RegisteredNativeElement[] {\n const registry = getGlobalRegistry();\n if (!registry) return [];\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/\\?/g, '.');\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n const results: RegisteredNativeElement[] = [];\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n if (\n (identifier.testId && regex.test(identifier.testId)) ||\n (identifier.uiId && regex.test(identifier.uiId)) ||\n (identifier.treePath && regex.test(identifier.treePath)) ||\n (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel))\n ) {\n results.push(element);\n }\n }\n\n return results;\n}\n\n/**\n * Build a tree path for an element based on its position in the component tree\n */\nexport function buildTreePath(componentPath: string[], elementIndex?: number): string {\n let path = componentPath.join('/');\n if (elementIndex !== undefined) {\n path += `[${elementIndex}]`;\n }\n return path;\n}\n\n/**\n * Parse a tree path into its components\n */\nexport function parseTreePath(treePath: string): { components: string[]; index?: number } {\n const indexMatch = treePath.match(/\\[(\\d+)\\]$/);\n const index = indexMatch ? parseInt(indexMatch[1], 10) : undefined;\n const pathWithoutIndex = treePath.replace(/\\[\\d+\\]$/, '');\n const components = pathWithoutIndex.split('/').filter(Boolean);\n\n return { components, index };\n}\n\n/**\n * Check if an identifier matches criteria\n */\nexport function matchesIdentifier(\n identifier: NativeElementIdentifier,\n criteria: Partial<NativeElementIdentifier>\n): boolean {\n if (criteria.uiId && identifier.uiId !== criteria.uiId) {\n return false;\n }\n if (criteria.testId && identifier.testId !== criteria.testId) {\n return false;\n }\n if (\n criteria.accessibilityLabel &&\n identifier.accessibilityLabel !== criteria.accessibilityLabel\n ) {\n return false;\n }\n if (criteria.treePath && identifier.treePath !== criteria.treePath) {\n return false;\n }\n return true;\n}\n"]}
1
+ {"version":3,"sources":["../../src/core/registry.ts","../../src/core/element-identifier.ts"],"names":[],"mappings":";;;AA6EO,SAAS,oBAAoB,KAAA,EAA2C;AAC7E,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,OAAO,KAAA,CAAM,CAAC,CAAA,KAAM,UAAU,CAAA;AACxE;AAKA,SAAS,aAAa,IAAA,EA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AAA,IAAI,QAAA,CAAS,IAAA,IAAQ,UAAA,CAAW,IAAA,KAAS,SAAS,IAAA,EAAM;AACtD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,QAAA,CAAS,MAAA,IAAU,UAAA,CAAW,MAAA,KAAW,SAAS,MAAA,EAAQ;AAC5D,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IACE,QAAA,CAAS,kBAAA,IACT,UAAA,CAAW,kBAAA,KAAuB,SAAS,kBAAA,EAC3C;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,QAAA,CAAS,QAAA,IAAY,UAAA,CAAW,QAAA,KAAa,SAAS,QAAA,EAAU;AAClE,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT","file":"index.js","sourcesContent":["/**\n * Native Element and Component Registry\n *\n * Central registry for all UI elements and components registered with UI Bridge Native.\n * Adapted from ui-bridge for React Native environments.\n */\n\nimport type {\n RegisteredNativeElement,\n RegisteredNativeComponent,\n NativeElementState,\n NativeElementType,\n NativeStandardAction,\n NativeCustomAction,\n NativeBridgeSnapshot,\n NativeElementIdentifier,\n NativeElementRef,\n NativeRegistrationCoverage,\n NativeSnapshotEnrichers,\n NativeSnapshotEnricher,\n Workflow,\n BridgeEvent,\n BridgeEventType,\n BridgeEventListener,\n} from './types';\n\n/**\n * Options for registering an element\n */\nexport interface RegisterElementOptions {\n type?: NativeElementType;\n label?: string;\n actions?: NativeStandardAction[];\n customActions?: Record<string, NativeCustomAction>;\n props?: Record<string, unknown>;\n treePath?: string;\n testId?: string;\n accessibilityLabel?: string;\n /** Route path where the element was registered (for page-scoped filtering) */\n registrationRoute?: string | null;\n /** Flattened RN style (from StyleSheet.flatten) for design review */\n flatStyle?: Record<string, unknown>;\n /** State-specific style overrides for design review */\n stateStyles?: {\n pressed?: Record<string, unknown>;\n focused?: Record<string, unknown>;\n disabled?: Record<string, unknown>;\n };\n}\n\n/**\n * Options for registering a component\n */\nexport interface RegisterComponentOptions {\n name: string;\n description?: string;\n actions?: Array<{\n id: string;\n label?: string;\n description?: string;\n handler: (params?: unknown) => unknown | Promise<unknown>;\n }>;\n elementIds?: string[];\n}\n\n/**\n * Registry configuration\n */\nexport interface NativeRegistryConfig {\n verbose?: boolean;\n onEvent?: BridgeEventListener;\n}\n\n/**\n * Extract handler function names from an element's props.\n * Returns names of props whose values are functions (e.g. ['onPress', 'onChangeText']).\n */\nexport function extractHandlerNames(props?: Record<string, unknown>): string[] {\n if (!props) return [];\n return Object.keys(props).filter((k) => typeof props[k] === 'function');\n}\n\n/**\n * Infer available actions based on element type\n */\nfunction inferActions(type: NativeElementType): NativeStandardAction[] {\n const baseActions: NativeStandardAction[] = ['focus', 'blur'];\n\n switch (type) {\n case 'button':\n case 'touchable':\n case 'pressable':\n return [...baseActions, 'click', 'press', 'longPress', 'doubleTap'];\n case 'input':\n return [...baseActions, 'click', 'press', 'type', 'clear'];\n case 'text':\n return [...baseActions, 'click', 'press', 'longPress'];\n case 'view':\n return [...baseActions, 'click', 'press'];\n case 'scroll':\n return [...baseActions, 'scroll', 'swipe'];\n case 'list':\n return [...baseActions, 'scroll', 'swipe'];\n case 'listItem':\n return [...baseActions, 'click', 'press', 'longPress', 'swipe'];\n case 'switch':\n case 'checkbox':\n return [...baseActions, 'click', 'press', 'toggle'];\n case 'radio':\n return [...baseActions, 'click', 'press'];\n case 'image':\n return [...baseActions, 'click', 'press', 'longPress'];\n case 'modal':\n return ['focus', 'blur'];\n case 'custom':\n default:\n return [...baseActions, 'click', 'press'];\n }\n}\n\n/**\n * Native UI Bridge Registry\n *\n * Manages registration and lookup of native UI elements and components.\n */\nexport class NativeUIBridgeRegistry {\n private elements = new Map<string, RegisteredNativeElement>();\n private components = new Map<string, RegisteredNativeComponent>();\n private workflows = new Map<string, Workflow>();\n private eventListeners = new Map<BridgeEventType, Set<BridgeEventListener>>();\n private config: NativeRegistryConfig;\n private enrichers: NativeSnapshotEnrichers = {};\n private snapshotExtras = new Map<string, NativeSnapshotEnricher>();\n /**\n * Sticky flag: flips `true` the first time any element is registered and\n * stays `true` even after elements are unregistered. Lets agents distinguish\n * \"this route never wired any elements\" from \"this route registered then\n * unmounted\".\n */\n private everHadRegistrations = false;\n\n constructor(config: NativeRegistryConfig = {}) {\n this.config = config;\n }\n\n // ============================================================================\n // Snapshot Enricher Slots\n // ============================================================================\n\n /**\n * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling\n * with a partial set merges into existing slots instead of clobbering them.\n */\n setEnrichers(e: Partial<NativeSnapshotEnrichers>): void {\n this.enrichers = { ...this.enrichers, ...e };\n }\n\n /**\n * Read-only accessor for the canonical enrichers slot. Returned object is\n * the live reference, so callers can detect \"no detector wired\" via\n * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP\n * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need\n * to drive the ModalDetector directly without re-instantiating it.\n */\n getEnrichers(): Readonly<NativeSnapshotEnrichers> {\n return this.enrichers;\n }\n\n /**\n * Register a custom snapshot enricher. The returned object will be\n * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid\n * clobbering canonical fields. Returns a disposer.\n */\n registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void {\n this.snapshotExtras.set(name, fn);\n return () => this.unregisterSnapshotEnricher(name);\n }\n\n /** Remove a custom snapshot enricher by name */\n unregisterSnapshotEnricher(name: string): void {\n this.snapshotExtras.delete(name);\n }\n\n // ============================================================================\n // Element Management\n // ============================================================================\n\n /**\n * Register a native element\n */\n registerElement(\n id: string,\n ref: React.RefObject<NativeElementRef>,\n options: RegisterElementOptions = {}\n ): RegisteredNativeElement {\n const {\n type = 'custom',\n label,\n actions = inferActions(type),\n customActions,\n props,\n treePath = id,\n testId,\n accessibilityLabel,\n registrationRoute,\n flatStyle,\n stateStyles,\n } = options;\n\n // Create state getter\n const getState = (): NativeElementState => {\n const element = ref.current;\n if (!element) {\n return {\n mounted: false,\n visible: false,\n enabled: false,\n focused: false,\n layout: null,\n };\n }\n\n // State is populated by the element during onLayout\n // Here we return the stored state from the element's metadata\n const stored = this.elements.get(id);\n if (stored && stored.getState !== getState) {\n return stored.getState();\n }\n\n return {\n mounted: true,\n visible: true,\n enabled: true,\n focused: false,\n layout: null,\n };\n };\n\n // Create identifier getter\n const getIdentifier = (): NativeElementIdentifier => ({\n uiId: id,\n testId: testId || id,\n accessibilityLabel,\n treePath,\n });\n\n const registered: RegisteredNativeElement = {\n id,\n ref,\n type,\n label,\n actions,\n customActions,\n props,\n getState,\n getIdentifier,\n registeredAt: Date.now(),\n mounted: true,\n registrationRoute: registrationRoute ?? null,\n flatStyle,\n stateStyles,\n };\n\n this.elements.set(id, registered);\n this.everHadRegistrations = true;\n\n this.emit('element:registered', { id, type, label });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered element: ${id} (${type})`);\n }\n\n // Seed a sensible initial state so elements are immediately visible in snapshots\n // even before onLayout fires. Layout-measuring code can overwrite this later.\n this.updateElementState(id, {\n mounted: true,\n visible: true,\n enabled: true,\n focused: false,\n layout: null,\n });\n\n return registered;\n }\n\n /**\n * Unregister an element\n */\n unregisterElement(id: string): void {\n const element = this.elements.get(id);\n if (element) {\n this.elements.delete(id);\n this.emit('element:unregistered', { id });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Unregistered element: ${id}`);\n }\n }\n }\n\n /**\n * Get a registered element\n */\n getElement(id: string): RegisteredNativeElement | undefined {\n return this.elements.get(id);\n }\n\n /**\n * Get all registered elements\n */\n getAllElements(): RegisteredNativeElement[] {\n return Array.from(this.elements.values());\n }\n\n /**\n * Get all registered elements that are visible and have a layout\n */\n getVisibleElements(): RegisteredNativeElement[] {\n return this.getAllElements().filter((e) => {\n const state = e.getState();\n return state.visible && state.layout !== null;\n });\n }\n\n /**\n * Get elements registered on a specific route (for page-scoped filtering)\n */\n getElementsForRoute(route: string): RegisteredNativeElement[] {\n return this.getAllElements().filter((e) => e.registrationRoute === route);\n }\n\n /**\n * Mark elements registered on a route as off-screen (visible: false, layout: null).\n *\n * Use this when a screen loses focus but stays mounted — common in React Navigation\n * tab navigators where inactive tabs remain in the tree. Without this call, stale\n * `layout` data lingers in snapshots and makes off-screen elements look rendered.\n *\n * Does NOT unregister the elements — they stay registered so the user's next visit\n * re-measures them via `onLayout` without re-mount cost. Elements without a\n * `registrationRoute` (app-wide registrations) are untouched.\n */\n markRouteOffscreen(route: string): void {\n // Guard against accidental global wipes. Elements registered without a\n // route have `registrationRoute: null` — passing null/empty here would\n // match every globally-registered element and erase their layouts.\n if (route == null || route === '') {\n if (this.config.verbose) {\n console.warn(\n `[ui-bridge-native] markRouteOffscreen called with null/empty route — ignoring`\n );\n }\n return;\n }\n let cleared = 0;\n for (const element of this.elements.values()) {\n if (element.registrationRoute === route) {\n this.updateElementState(element.id, {\n visible: false,\n layout: null,\n });\n cleared++;\n }\n }\n if (this.config.verbose && cleared > 0) {\n console.log(`[ui-bridge-native] Marked ${cleared} elements offscreen for route: ${route}`);\n }\n }\n\n /**\n * Update element state\n */\n updateElementState(id: string, state: Partial<NativeElementState>): void {\n const element = this.elements.get(id);\n if (element) {\n // Create a new getState that includes the updated state\n const currentState = element.getState();\n const newState = { ...currentState, ...state };\n\n const updated: RegisteredNativeElement = {\n ...element,\n getState: () => newState,\n };\n\n this.elements.set(id, updated);\n this.emit('element:stateChanged', { id, state: newState });\n }\n }\n\n /**\n * Update element props (for action execution)\n */\n updateElementProps(id: string, props: Record<string, unknown>): void {\n const element = this.elements.get(id);\n if (element) {\n const updated: RegisteredNativeElement = {\n ...element,\n props: { ...element.props, ...props },\n };\n this.elements.set(id, updated);\n }\n }\n\n /**\n * Update element style for design review\n */\n updateElementStyle(\n id: string,\n flatStyle: Record<string, unknown>,\n stateStyles?: {\n pressed?: Record<string, unknown>;\n focused?: Record<string, unknown>;\n disabled?: Record<string, unknown>;\n }\n ): void {\n const element = this.elements.get(id);\n if (element) {\n const updated: RegisteredNativeElement = {\n ...element,\n flatStyle,\n ...(stateStyles !== undefined ? { stateStyles } : {}),\n };\n this.elements.set(id, updated);\n }\n }\n\n /**\n * Get element style for design review\n */\n getElementStyle(id: string): Record<string, unknown> | null {\n const element = this.elements.get(id);\n return element?.flatStyle ?? null;\n }\n\n /**\n * Find element by testID\n */\n findByTestId(testId: string): RegisteredNativeElement | undefined {\n for (const element of this.elements.values()) {\n const identifier = element.getIdentifier();\n if (identifier.testId === testId) {\n return element;\n }\n }\n return undefined;\n }\n\n /**\n * Find elements by type\n */\n findByType(type: NativeElementType): RegisteredNativeElement[] {\n return Array.from(this.elements.values()).filter((e) => e.type === type);\n }\n\n // ============================================================================\n // Component Management\n // ============================================================================\n\n /**\n * Register a component\n */\n registerComponent(id: string, options: RegisterComponentOptions): RegisteredNativeComponent {\n const { name, description, actions = [], elementIds } = options;\n\n const registered: RegisteredNativeComponent = {\n id,\n name,\n description,\n actions: actions.map((a) => ({\n id: a.id,\n label: a.label,\n description: a.description,\n handler: a.handler,\n })),\n elementIds,\n registeredAt: Date.now(),\n mounted: true,\n };\n\n this.components.set(id, registered);\n\n this.emit('component:registered', { id, name });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered component: ${id} (${name})`);\n }\n\n return registered;\n }\n\n /**\n * Unregister a component\n */\n unregisterComponent(id: string): void {\n const component = this.components.get(id);\n if (component) {\n this.components.delete(id);\n this.emit('component:unregistered', { id });\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Unregistered component: ${id}`);\n }\n }\n }\n\n /**\n * Get a registered component\n */\n getComponent(id: string): RegisteredNativeComponent | undefined {\n return this.components.get(id);\n }\n\n /**\n * Get all registered components\n */\n getAllComponents(): RegisteredNativeComponent[] {\n return Array.from(this.components.values());\n }\n\n // ============================================================================\n // Workflow Management\n // ============================================================================\n\n /**\n * Register a workflow\n */\n registerWorkflow(workflow: Workflow): void {\n this.workflows.set(workflow.id, workflow);\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registered workflow: ${workflow.id}`);\n }\n }\n\n /**\n * Unregister a workflow\n */\n unregisterWorkflow(id: string): void {\n this.workflows.delete(id);\n }\n\n /**\n * Get a workflow\n */\n getWorkflow(id: string): Workflow | undefined {\n return this.workflows.get(id);\n }\n\n /**\n * Get all workflows\n */\n getAllWorkflows(): Workflow[] {\n return Array.from(this.workflows.values());\n }\n\n // ============================================================================\n // Event System\n // ============================================================================\n\n /**\n * Subscribe to events\n */\n on<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): () => void {\n if (!this.eventListeners.has(type)) {\n this.eventListeners.set(type, new Set());\n }\n this.eventListeners.get(type)!.add(listener as BridgeEventListener);\n\n // Return unsubscribe function\n return () => this.off(type, listener);\n }\n\n /**\n * Unsubscribe from events\n */\n off<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): void {\n this.eventListeners.get(type)?.delete(listener as BridgeEventListener);\n }\n\n /**\n * Emit an event\n */\n emit(type: BridgeEventType, data: unknown): void {\n const event: BridgeEvent = {\n type,\n timestamp: Date.now(),\n data,\n };\n\n // Notify listeners\n const listeners = this.eventListeners.get(type);\n if (listeners) {\n for (const listener of listeners) {\n try {\n listener(event);\n } catch (error) {\n console.error(`[ui-bridge-native] Event listener error:`, error);\n }\n }\n }\n\n // Notify global handler\n if (this.config.onEvent) {\n try {\n this.config.onEvent(event);\n } catch (error) {\n console.error(`[ui-bridge-native] Global event handler error:`, error);\n }\n }\n }\n\n // ============================================================================\n // Snapshots\n // ============================================================================\n\n /**\n * Create a snapshot of the current state\n */\n createSnapshot(\n routeInfo?: {\n currentRoute?: string | null;\n segments?: string[];\n },\n options?: { visibleOnly?: boolean; currentRouteOnly?: boolean }\n ): NativeBridgeSnapshot {\n let elements = options?.visibleOnly ? this.getVisibleElements() : this.getAllElements();\n\n // Filter to only elements registered on the current route\n if (options?.currentRouteOnly && routeInfo?.currentRoute) {\n const currentRoute = routeInfo.currentRoute;\n elements = elements.filter((e) => e.registrationRoute === currentRoute);\n }\n\n const snapshot: NativeBridgeSnapshot = {\n timestamp: Date.now(),\n elements: elements.map((e) => {\n const handlers = extractHandlerNames(e.props);\n return {\n id: e.id,\n type: e.type,\n label: e.label,\n identifier: e.getIdentifier(),\n state: e.getState(),\n actions: e.actions,\n customActions: e.customActions ? Object.keys(e.customActions) : undefined,\n registeredHandlers: handlers.length > 0 ? handlers : undefined,\n registrationRoute: e.registrationRoute,\n };\n }),\n components: this.getAllComponents().map((c) => ({\n id: c.id,\n name: c.name,\n description: c.description,\n actions: c.actions.map((a) => a.id),\n elementIds: c.elementIds,\n })),\n workflows: this.getAllWorkflows().map((w) => ({\n id: w.id,\n name: w.name,\n description: w.description,\n stepCount: w.steps.length,\n })),\n currentRoute: routeInfo?.currentRoute ?? null,\n segments: routeInfo?.segments,\n registration: this.getRegistrationCoverage(),\n };\n\n // Canonical enrichers — each in its own try/catch so a misbehaving tracker\n // can never break the rest of the snapshot.\n if (this.enrichers.modalDetector) {\n try {\n snapshot.modalStack = this.enrichers.modalDetector.getSnapshotModalContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] modalDetector enricher threw:`, error);\n }\n }\n }\n if (this.enrichers.toastCapture) {\n try {\n snapshot.toasts = this.enrichers.toastCapture.getSnapshotToastContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] toastCapture enricher threw:`, error);\n }\n }\n }\n if (this.enrichers.undoTracker) {\n try {\n snapshot.undoRedo = this.enrichers.undoTracker.getSnapshotUndoContext();\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] undoTracker enricher threw:`, error);\n }\n }\n }\n\n // Custom enrichers — keys assign-merged onto the snapshot\n if (this.snapshotExtras.size > 0) {\n const ctx = { elements, currentRoute: routeInfo?.currentRoute ?? null };\n for (const [name, fn] of this.snapshotExtras) {\n try {\n const extra = fn(ctx);\n if (extra && typeof extra === 'object') {\n Object.assign(snapshot, extra);\n }\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] snapshot enricher \"${name}\" threw:`, error);\n }\n }\n }\n }\n\n return snapshot;\n }\n\n /**\n * Get registry statistics\n */\n getStats(): { elements: number; components: number; workflows: number } {\n return {\n elements: this.elements.size,\n components: this.components.size,\n workflows: this.workflows.size,\n };\n }\n\n /**\n * Compute registration coverage metadata for the current registry state.\n *\n * Groups currently-registered elements by `registrationRoute`, bucketing\n * elements without a route under `'?'`. `everHadRegistrations` is sticky —\n * once true, it stays true for the lifetime of the registry instance.\n */\n getRegistrationCoverage(): NativeRegistrationCoverage {\n const byRoute: Record<string, number> = {};\n for (const element of this.elements.values()) {\n const key =\n element.registrationRoute == null || element.registrationRoute === ''\n ? '?'\n : element.registrationRoute;\n byRoute[key] = (byRoute[key] ?? 0) + 1;\n }\n return {\n totalRegistered: this.elements.size,\n everHadRegistrations: this.everHadRegistrations,\n byRoute,\n };\n }\n\n /**\n * Clear all registrations\n */\n clear(): void {\n this.elements.clear();\n this.components.clear();\n this.workflows.clear();\n\n if (this.config.verbose) {\n console.log(`[ui-bridge-native] Registry cleared`);\n }\n }\n}\n\n// ============================================================================\n// Global Registry\n// ============================================================================\n\nlet globalRegistry: NativeUIBridgeRegistry | null = null;\n\n/**\n * Set the global registry\n */\nexport function setGlobalRegistry(registry: NativeUIBridgeRegistry): void {\n globalRegistry = registry;\n}\n\n/**\n * Get the global registry\n */\nexport function getGlobalRegistry(): NativeUIBridgeRegistry | null {\n return globalRegistry;\n}\n\n/**\n * Reset the global registry\n */\nexport function resetGlobalRegistry(): void {\n globalRegistry?.clear();\n globalRegistry = null;\n}\n","/**\n * Native Element Identifier\n *\n * Utilities for identifying and finding native elements.\n * In React Native, we use testID, accessibilityLabel, and tree paths\n * instead of XPath/CSS selectors.\n */\n\nimport type { NativeElementIdentifier, RegisteredNativeElement } from './types';\nimport { getGlobalRegistry } from './registry';\n\n/**\n * Create an element identifier for a native element\n */\nexport function createNativeElementIdentifier(\n id: string,\n options: {\n testId?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n treePath?: string;\n } = {}\n): NativeElementIdentifier {\n return {\n uiId: id,\n testId: options.testId || id,\n accessibilityLabel: options.accessibilityLabel,\n accessibilityHint: options.accessibilityHint,\n treePath: options.treePath || id,\n };\n}\n\n/**\n * Find an element by its identifier in the global registry\n */\nexport function findElementByIdentifier(\n identifier: string | NativeElementIdentifier\n): RegisteredNativeElement | null {\n const registry = getGlobalRegistry();\n if (!registry) return null;\n\n // If string, try different lookup strategies\n if (typeof identifier === 'string') {\n // Try direct ID lookup\n const byId = registry.getElement(identifier);\n if (byId) return byId;\n\n // Try testID lookup\n const byTestId = registry.findByTestId(identifier);\n if (byTestId) return byTestId;\n\n // Try pattern matching\n return findByPattern(registry, identifier);\n }\n\n // If identifier object, try each strategy\n if (identifier.uiId) {\n const byId = registry.getElement(identifier.uiId);\n if (byId) return byId;\n }\n\n if (identifier.testId) {\n const byTestId = registry.findByTestId(identifier.testId);\n if (byTestId) return byTestId;\n }\n\n return null;\n}\n\n/**\n * Find element by pattern (supports wildcards)\n */\nfunction findByPattern(\n registry: ReturnType<typeof getGlobalRegistry>,\n pattern: string\n): RegisteredNativeElement | null {\n if (!registry) return null;\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special chars\n .replace(/\\*/g, '.*') // Convert * to .*\n .replace(/\\?/g, '.'); // Convert ? to .\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n // Match against testId\n if (identifier.testId && regex.test(identifier.testId)) {\n return element;\n }\n\n // Match against uiId\n if (identifier.uiId && regex.test(identifier.uiId)) {\n return element;\n }\n\n // Match against treePath\n if (identifier.treePath && regex.test(identifier.treePath)) {\n return element;\n }\n\n // Match against accessibilityLabel\n if (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel)) {\n return element;\n }\n }\n\n return null;\n}\n\n/**\n * Find all elements matching a pattern\n */\nexport function findAllByPattern(pattern: string): RegisteredNativeElement[] {\n const registry = getGlobalRegistry();\n if (!registry) return [];\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/\\?/g, '.');\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n const results: RegisteredNativeElement[] = [];\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n if (\n (identifier.testId && regex.test(identifier.testId)) ||\n (identifier.uiId && regex.test(identifier.uiId)) ||\n (identifier.treePath && regex.test(identifier.treePath)) ||\n (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel))\n ) {\n results.push(element);\n }\n }\n\n return results;\n}\n\n/**\n * Build a tree path for an element based on its position in the component tree\n */\nexport function buildTreePath(componentPath: string[], elementIndex?: number): string {\n let path = componentPath.join('/');\n if (elementIndex !== undefined) {\n path += `[${elementIndex}]`;\n }\n return path;\n}\n\n/**\n * Parse a tree path into its components\n */\nexport function parseTreePath(treePath: string): { components: string[]; index?: number } {\n const indexMatch = treePath.match(/\\[(\\d+)\\]$/);\n const index = indexMatch ? parseInt(indexMatch[1], 10) : undefined;\n const pathWithoutIndex = treePath.replace(/\\[\\d+\\]$/, '');\n const components = pathWithoutIndex.split('/').filter(Boolean);\n\n return { components, index };\n}\n\n/**\n * Check if an identifier matches criteria\n */\nexport function matchesIdentifier(\n identifier: NativeElementIdentifier,\n criteria: Partial<NativeElementIdentifier>\n): boolean {\n if (criteria.uiId && identifier.uiId !== criteria.uiId) {\n return false;\n }\n if (criteria.testId && identifier.testId !== criteria.testId) {\n return false;\n }\n if (\n criteria.accessibilityLabel &&\n identifier.accessibilityLabel !== criteria.accessibilityLabel\n ) {\n return false;\n }\n if (criteria.treePath && identifier.treePath !== criteria.treePath) {\n return false;\n }\n return true;\n}\n"]}
@@ -44,6 +44,13 @@ var NativeUIBridgeRegistry = class {
44
44
  this.eventListeners = /* @__PURE__ */ new Map();
45
45
  this.enrichers = {};
46
46
  this.snapshotExtras = /* @__PURE__ */ new Map();
47
+ /**
48
+ * Sticky flag: flips `true` the first time any element is registered and
49
+ * stays `true` even after elements are unregistered. Lets agents distinguish
50
+ * "this route never wired any elements" from "this route registered then
51
+ * unmounted".
52
+ */
53
+ this.everHadRegistrations = false;
47
54
  this.config = config;
48
55
  }
49
56
  // ============================================================================
@@ -56,6 +63,16 @@ var NativeUIBridgeRegistry = class {
56
63
  setEnrichers(e) {
57
64
  this.enrichers = { ...this.enrichers, ...e };
58
65
  }
66
+ /**
67
+ * Read-only accessor for the canonical enrichers slot. Returned object is
68
+ * the live reference, so callers can detect "no detector wired" via
69
+ * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP
70
+ * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need
71
+ * to drive the ModalDetector directly without re-instantiating it.
72
+ */
73
+ getEnrichers() {
74
+ return this.enrichers;
75
+ }
59
76
  /**
60
77
  * Register a custom snapshot enricher. The returned object will be
61
78
  * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
@@ -135,6 +152,7 @@ var NativeUIBridgeRegistry = class {
135
152
  stateStyles
136
153
  };
137
154
  this.elements.set(id, registered);
155
+ this.everHadRegistrations = true;
138
156
  this.emit("element:registered", { id, type, label });
139
157
  if (this.config.verbose) {
140
158
  console.log(`[ui-bridge-native] Registered element: ${id} (${type})`);
@@ -462,7 +480,8 @@ var NativeUIBridgeRegistry = class {
462
480
  stepCount: w.steps.length
463
481
  })),
464
482
  currentRoute: routeInfo?.currentRoute ?? null,
465
- segments: routeInfo?.segments
483
+ segments: routeInfo?.segments,
484
+ registration: this.getRegistrationCoverage()
466
485
  };
467
486
  if (this.enrichers.modalDetector) {
468
487
  try {
@@ -518,6 +537,25 @@ var NativeUIBridgeRegistry = class {
518
537
  workflows: this.workflows.size
519
538
  };
520
539
  }
540
+ /**
541
+ * Compute registration coverage metadata for the current registry state.
542
+ *
543
+ * Groups currently-registered elements by `registrationRoute`, bucketing
544
+ * elements without a route under `'?'`. `everHadRegistrations` is sticky —
545
+ * once true, it stays true for the lifetime of the registry instance.
546
+ */
547
+ getRegistrationCoverage() {
548
+ const byRoute = {};
549
+ for (const element of this.elements.values()) {
550
+ const key = element.registrationRoute == null || element.registrationRoute === "" ? "?" : element.registrationRoute;
551
+ byRoute[key] = (byRoute[key] ?? 0) + 1;
552
+ }
553
+ return {
554
+ totalRegistered: this.elements.size,
555
+ everHadRegistrations: this.everHadRegistrations,
556
+ byRoute
557
+ };
558
+ }
521
559
  /**
522
560
  * Clear all registrations
523
561
  */