@qontinui/ui-bridge-native 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{useUIBridgeToast-DD13oF3k.d.ts → StateAnnotation--zm0Jfqj.d.ts} +35 -6
  2. package/dist/{useUIBridgeToast-BPIEbsEc.d.mts → StateAnnotation-BgFoVWFy.d.mts} +35 -6
  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 +89 -6
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +89 -6
  10. package/dist/core/index.mjs.map +1 -1
  11. package/dist/design/index.d.mts +1 -1
  12. package/dist/design/index.d.ts +1 -1
  13. package/dist/{http-server-D2U1k48d.d.mts → http-server--550eD1F.d.mts} +106 -4
  14. package/dist/{http-server-ck8clUsZ.d.ts → http-server-C9NaNBEP.d.ts} +106 -4
  15. package/dist/index.d.mts +5 -5
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +584 -49
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +584 -51
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/react/index.d.mts +5 -5
  22. package/dist/react/index.d.ts +5 -5
  23. package/dist/react/index.js +584 -49
  24. package/dist/react/index.js.map +1 -1
  25. package/dist/react/index.mjs +584 -51
  26. package/dist/react/index.mjs.map +1 -1
  27. package/dist/{registry-KdUW_koV.d.mts → registry-B5JadBN9.d.mts} +49 -2
  28. package/dist/{registry-BxXaxmsT.d.ts → registry-pAUpQq2O.d.ts} +49 -2
  29. package/dist/server/index.d.mts +65 -6
  30. package/dist/server/index.d.ts +65 -6
  31. package/dist/server/index.js +438 -2
  32. package/dist/server/index.js.map +1 -1
  33. package/dist/server/index.mjs +437 -3
  34. package/dist/server/index.mjs.map +1 -1
  35. package/dist/{types-DjB0zJJH.d.mts → types-B0XA4vOF.d.mts} +1 -1
  36. package/dist/{types-BwdPNpII.d.mts → types-CGVut7mc.d.mts} +43 -1
  37. package/dist/{types-BwdPNpII.d.ts → types-CGVut7mc.d.ts} +43 -1
  38. package/dist/{types-DCEv5qb6.d.ts → types-CjEKTDYT.d.ts} +1 -1
  39. package/package.json +1 -1
@@ -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, 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';
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-CGVut7mc.js';
4
+ import { a as NativeUIBridgeRegistry } from './registry-pAUpQq2O.js';
5
+ import { N as NativeActionExecutor } from './types-CjEKTDYT.js';
6
+ import { l as NativeUIBridgeServer, p as ServerAdapter, o as RouteProvider } from './http-server-C9NaNBEP.js';
7
7
 
8
8
  /**
9
9
  * Cloud Relay Client — WebSocket tunnel from mobile device to backend
@@ -723,4 +723,33 @@ declare function useToastRecorder(): {
723
723
  dismissToast: (id: string) => void;
724
724
  };
725
725
 
726
- 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, 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';
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-CGVut7mc.mjs';
4
+ import { a as NativeUIBridgeRegistry } from './registry-B5JadBN9.mjs';
5
+ import { N as NativeActionExecutor } from './types-B0XA4vOF.mjs';
6
+ import { l as NativeUIBridgeServer, p as ServerAdapter, o as RouteProvider } from './http-server--550eD1F.mjs';
7
7
 
8
8
  /**
9
9
  * Cloud Relay Client — WebSocket tunnel from mobile device to backend
@@ -723,4 +723,33 @@ declare function useToastRecorder(): {
723
723
  dismissToast: (id: string) => void;
724
724
  };
725
725
 
726
- 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-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';
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-B0XA4vOF.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-B0XA4vOF.mjs';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-B5JadBN9.mjs';
4
+ import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-CGVut7mc.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-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';
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-CjEKTDYT.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-CjEKTDYT.js';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-pAUpQq2O.js';
4
+ import { m as NativeFindRequest, n as NativeFindResponse, W as WaitOptions } from '../types-CGVut7mc.js';
5
5
 
6
6
  /**
7
7
  * Native Action Executor
@@ -1,6 +1,6 @@
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';
1
+ import { i as NativeElementIdentifier, z as RegisteredNativeElement } from '../types-CGVut7mc.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, H as NativeAppInfo, 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, J as NativeModalDetectorLike, p as NativeModalInfo, q as NativeRegistrationCoverage, I as NativeRouteProviderLike, 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-CGVut7mc.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-B5JadBN9.mjs';
4
4
 
5
5
  /**
6
6
  * Native Element Identifier
@@ -1,6 +1,6 @@
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';
1
+ import { i as NativeElementIdentifier, z as RegisteredNativeElement } from '../types-CGVut7mc.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, H as NativeAppInfo, 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, J as NativeModalDetectorLike, p as NativeModalInfo, q as NativeRegistrationCoverage, I as NativeRouteProviderLike, 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-CGVut7mc.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-pAUpQq2O.js';
4
4
 
5
5
  /**
6
6
  * Native Element Identifier
@@ -46,6 +46,29 @@ var NativeUIBridgeRegistry = class {
46
46
  this.eventListeners = /* @__PURE__ */ new Map();
47
47
  this.enrichers = {};
48
48
  this.snapshotExtras = /* @__PURE__ */ new Map();
49
+ /**
50
+ * App identification metadata (appId/appName/appType/framework). Set via
51
+ * `setAppInfo` — typically wired in the server constructor from the
52
+ * `NativeUIBridgeConfig` the host passes to `UIBridgeNativeProvider`.
53
+ *
54
+ * When set, `createSnapshot` includes it on the resulting snapshot so
55
+ * agents can identify the app from snapshot bytes alone (parity with the
56
+ * `uiBridge` block on the `health` response). Snapshots created before
57
+ * this is wired simply omit the field.
58
+ */
59
+ this.appInfo = null;
60
+ /**
61
+ * Optional route provider. When set, `createSnapshot` reads
62
+ * `currentRoute`/`segments` from it whenever the caller does not pass an
63
+ * explicit `routeInfo` argument. This lets the default `getSnapshot` HTTP
64
+ * handler — which has no direct reference to the `NativeUIBridgeServer`
65
+ * instance — still emit a populated `currentRoute` field.
66
+ *
67
+ * Wired by `NativeUIBridgeServer.setRouteProvider`, which forwards the
68
+ * provider into the registry alongside the per-handler overrides it
69
+ * already installs.
70
+ */
71
+ this.routeProvider = null;
49
72
  /**
50
73
  * Sticky flag: flips `true` the first time any element is registered and
51
74
  * stays `true` even after elements are unregistered. Lets agents distinguish
@@ -56,6 +79,34 @@ var NativeUIBridgeRegistry = class {
56
79
  this.config = config;
57
80
  }
58
81
  // ============================================================================
82
+ // App Info & Route Provider
83
+ // ============================================================================
84
+ /**
85
+ * Set the app identification metadata returned alongside snapshots.
86
+ * Idempotent — re-calling with the same shape is a no-op.
87
+ * Pass `null` (or omit a previous call) to clear.
88
+ */
89
+ setAppInfo(info) {
90
+ this.appInfo = info ?? null;
91
+ }
92
+ /** Read-only accessor for the registered app info, if any. */
93
+ getAppInfo() {
94
+ return this.appInfo;
95
+ }
96
+ /**
97
+ * Set a route provider whose `getCurrentRoute`/`getSegments` are read by
98
+ * `createSnapshot` when no explicit `routeInfo` argument is supplied.
99
+ *
100
+ * Call with `null` to detach (e.g. when the host swaps providers on HMR).
101
+ */
102
+ setRouteProvider(provider) {
103
+ this.routeProvider = provider ?? null;
104
+ }
105
+ /** Read-only accessor for the registered route provider, if any. */
106
+ getRouteProvider() {
107
+ return this.routeProvider;
108
+ }
109
+ // ============================================================================
59
110
  // Snapshot Enricher Slots
60
111
  // ============================================================================
61
112
  /**
@@ -444,12 +495,41 @@ var NativeUIBridgeRegistry = class {
444
495
  // Snapshots
445
496
  // ============================================================================
446
497
  /**
447
- * Create a snapshot of the current state
498
+ * Create a snapshot of the current state.
499
+ *
500
+ * Route resolution: `routeInfo` wins when provided. Otherwise — and this
501
+ * is the path the default `getSnapshot` HTTP handler takes — we fall back
502
+ * to the registered `routeProvider`. This means callers that never wire a
503
+ * server-level override (the bare-server / cloud-relay path) still get a
504
+ * populated `currentRoute` field as long as `setRouteProvider` was called
505
+ * on the registry.
448
506
  */
449
507
  createSnapshot(routeInfo, options) {
508
+ const resolvedRoute = (() => {
509
+ if (routeInfo !== void 0) {
510
+ return {
511
+ currentRoute: routeInfo.currentRoute ?? null,
512
+ segments: routeInfo.segments
513
+ };
514
+ }
515
+ if (this.routeProvider) {
516
+ try {
517
+ return {
518
+ currentRoute: this.routeProvider.getCurrentRoute() ?? null,
519
+ segments: this.routeProvider.getSegments?.()
520
+ };
521
+ } catch (error) {
522
+ if (this.config.verbose) {
523
+ console.warn(`[ui-bridge-native] routeProvider getCurrentRoute threw:`, error);
524
+ }
525
+ return { currentRoute: null, segments: void 0 };
526
+ }
527
+ }
528
+ return { currentRoute: null, segments: void 0 };
529
+ })();
450
530
  let elements = options?.visibleOnly ? this.getVisibleElements() : this.getAllElements();
451
- if (options?.currentRouteOnly && routeInfo?.currentRoute) {
452
- const currentRoute = routeInfo.currentRoute;
531
+ if (options?.currentRouteOnly && resolvedRoute.currentRoute) {
532
+ const currentRoute = resolvedRoute.currentRoute;
453
533
  elements = elements.filter((e) => e.registrationRoute === currentRoute);
454
534
  }
455
535
  const snapshot = {
@@ -481,10 +561,13 @@ var NativeUIBridgeRegistry = class {
481
561
  description: w.description,
482
562
  stepCount: w.steps.length
483
563
  })),
484
- currentRoute: routeInfo?.currentRoute ?? null,
485
- segments: routeInfo?.segments,
564
+ currentRoute: resolvedRoute.currentRoute,
565
+ segments: resolvedRoute.segments,
486
566
  registration: this.getRegistrationCoverage()
487
567
  };
568
+ if (this.appInfo) {
569
+ snapshot.appInfo = this.appInfo;
570
+ }
488
571
  if (this.enrichers.modalDetector) {
489
572
  try {
490
573
  snapshot.modalStack = this.enrichers.modalDetector.getSnapshotModalContext();
@@ -513,7 +596,7 @@ var NativeUIBridgeRegistry = class {
513
596
  }
514
597
  }
515
598
  if (this.snapshotExtras.size > 0) {
516
- const ctx = { elements, currentRoute: routeInfo?.currentRoute ?? null };
599
+ const ctx = { elements, currentRoute: resolvedRoute.currentRoute };
517
600
  for (const [name, fn] of this.snapshotExtras) {
518
601
  try {
519
602
  const extra = fn(ctx);
@@ -1 +1 @@
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,EAAiD;AACrE,EAAA,MAAM,WAAA,GAAsC,CAAC,OAAA,EAAS,MAAM,CAAA;AAE5D,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,QAAA;AAAA,IACL,KAAK,WAAA;AAAA,IACL,KAAK,WAAA;AACH,MAAA,OAAO,CAAC,GAAG,WAAA,EAAa,OAAA,EAAS,OAAA,EAAS,aAAa,WAAW,CAAA;AAAA,IACpE,KAAK,OAAA;AACH,MAAA,OAAO,CAAC,GAAG,WAAA,EAAa,OAAA,EAAS,OAAA,EAAS,QAAQ,OAAO,CAAA;AAAA,IAC3D,KAAK,MAAA;AACH,MAAA,OAAO,CAAC,GAAG,WAAA,EAAa,OAAA,EAAS,SAAS,WAAW,CAAA;AAAA,IACvD,KAAK,MAAA;AACH,MAAA,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AO,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"]}
1
+ {"version":3,"sources":["../../src/core/registry.ts","../../src/core/element-identifier.ts"],"names":[],"mappings":";;;AA+EO,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,EAAiD;AACrE,EAAA,MAAM,WAAA,GAAsC,CAAC,OAAA,EAAS,MAAM,CAAA;AAE5D,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,QAAA;AAAA,IACL,KAAK,WAAA;AAAA,IACL,KAAK,WAAA;AACH,MAAA,OAAO,CAAC,GAAG,WAAA,EAAa,OAAA,EAAS,OAAA,EAAS,aAA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KO,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 NativeAppInfo,\n NativeBridgeSnapshot,\n NativeElementIdentifier,\n NativeElementRef,\n NativeRegistrationCoverage,\n NativeRouteProviderLike,\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 * App identification metadata (appId/appName/appType/framework). Set via\n * `setAppInfo` — typically wired in the server constructor from the\n * `NativeUIBridgeConfig` the host passes to `UIBridgeNativeProvider`.\n *\n * When set, `createSnapshot` includes it on the resulting snapshot so\n * agents can identify the app from snapshot bytes alone (parity with the\n * `uiBridge` block on the `health` response). Snapshots created before\n * this is wired simply omit the field.\n */\n private appInfo: NativeAppInfo | null = null;\n /**\n * Optional route provider. When set, `createSnapshot` reads\n * `currentRoute`/`segments` from it whenever the caller does not pass an\n * explicit `routeInfo` argument. This lets the default `getSnapshot` HTTP\n * handler — which has no direct reference to the `NativeUIBridgeServer`\n * instance — still emit a populated `currentRoute` field.\n *\n * Wired by `NativeUIBridgeServer.setRouteProvider`, which forwards the\n * provider into the registry alongside the per-handler overrides it\n * already installs.\n */\n private routeProvider: NativeRouteProviderLike | null = null;\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 // App Info & Route Provider\n // ============================================================================\n\n /**\n * Set the app identification metadata returned alongside snapshots.\n * Idempotent — re-calling with the same shape is a no-op.\n * Pass `null` (or omit a previous call) to clear.\n */\n setAppInfo(info: NativeAppInfo | null | undefined): void {\n this.appInfo = info ?? null;\n }\n\n /** Read-only accessor for the registered app info, if any. */\n getAppInfo(): NativeAppInfo | null {\n return this.appInfo;\n }\n\n /**\n * Set a route provider whose `getCurrentRoute`/`getSegments` are read by\n * `createSnapshot` when no explicit `routeInfo` argument is supplied.\n *\n * Call with `null` to detach (e.g. when the host swaps providers on HMR).\n */\n setRouteProvider(provider: NativeRouteProviderLike | null | undefined): void {\n this.routeProvider = provider ?? null;\n }\n\n /** Read-only accessor for the registered route provider, if any. */\n getRouteProvider(): NativeRouteProviderLike | null {\n return this.routeProvider;\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 * Route resolution: `routeInfo` wins when provided. Otherwise — and this\n * is the path the default `getSnapshot` HTTP handler takes — we fall back\n * to the registered `routeProvider`. This means callers that never wire a\n * server-level override (the bare-server / cloud-relay path) still get a\n * populated `currentRoute` field as long as `setRouteProvider` was called\n * on the registry.\n */\n createSnapshot(\n routeInfo?: {\n currentRoute?: string | null;\n segments?: string[];\n },\n options?: { visibleOnly?: boolean; currentRouteOnly?: boolean }\n ): NativeBridgeSnapshot {\n // Resolve route info: prefer the explicit argument, fall back to a\n // registered route provider. We treat an explicitly-passed `routeInfo`\n // (even if both fields are null/undefined) as \"the caller is in charge\"\n // so server-layer overrides that pass `{currentRoute: null}` keep working.\n const resolvedRoute: { currentRoute: string | null; segments: string[] | undefined } = (() => {\n if (routeInfo !== undefined) {\n return {\n currentRoute: routeInfo.currentRoute ?? null,\n segments: routeInfo.segments,\n };\n }\n if (this.routeProvider) {\n try {\n return {\n currentRoute: this.routeProvider.getCurrentRoute() ?? null,\n segments: this.routeProvider.getSegments?.(),\n };\n } catch (error) {\n if (this.config.verbose) {\n console.warn(`[ui-bridge-native] routeProvider getCurrentRoute threw:`, error);\n }\n return { currentRoute: null, segments: undefined };\n }\n }\n return { currentRoute: null, segments: undefined };\n })();\n\n let elements = options?.visibleOnly ? this.getVisibleElements() : this.getAllElements();\n\n // Filter to only elements registered on the current route\n if (options?.currentRouteOnly && resolvedRoute.currentRoute) {\n const currentRoute = resolvedRoute.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: resolvedRoute.currentRoute,\n segments: resolvedRoute.segments,\n registration: this.getRegistrationCoverage(),\n };\n\n // Include app identification metadata so consumers can identify which\n // app produced this snapshot without a separate health probe.\n if (this.appInfo) {\n snapshot.appInfo = this.appInfo;\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: resolvedRoute.currentRoute };\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"]}