@qontinui/ui-bridge-native 0.3.2 → 0.4.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 (108) hide show
  1. package/dist/control/{index.d.mts → action-executor.d.ts} +6 -10
  2. package/dist/control/action-executor.d.ts.map +1 -0
  3. package/dist/control/index.d.ts +5 -95
  4. package/dist/control/index.d.ts.map +1 -0
  5. package/dist/{types-CjEKTDYT.d.ts → control/types.d.ts} +17 -20
  6. package/dist/control/types.d.ts.map +1 -0
  7. package/dist/core/element-identifier.d.ts +41 -0
  8. package/dist/core/element-identifier.d.ts.map +1 -0
  9. package/dist/core/index.d.ts +6 -43
  10. package/dist/core/index.d.ts.map +1 -0
  11. package/dist/{registry-pAUpQq2O.d.ts → core/registry.d.ts} +10 -13
  12. package/dist/core/registry.d.ts.map +1 -0
  13. package/dist/{types-CGVut7mc.d.mts → core/types.d.ts} +41 -41
  14. package/dist/core/types.d.ts.map +1 -0
  15. package/dist/debug/index.d.ts +4 -44
  16. package/dist/debug/index.d.ts.map +1 -0
  17. package/dist/debug/index.js +1 -1
  18. package/dist/debug/index.js.map +1 -1
  19. package/dist/debug/index.mjs +2 -2
  20. package/dist/debug/index.mjs.map +1 -1
  21. package/dist/debug/{index.d.mts → inspector.d.ts} +3 -6
  22. package/dist/debug/inspector.d.ts.map +1 -0
  23. package/dist/design/{index.d.mts → design-inspector-native.d.ts} +7 -11
  24. package/dist/design/design-inspector-native.d.ts.map +1 -0
  25. package/dist/{design-types-BHr6Q1FX.d.mts → design/design-types.d.ts} +10 -11
  26. package/dist/design/design-types.d.ts.map +1 -0
  27. package/dist/design/index.d.ts +5 -60
  28. package/dist/design/index.d.ts.map +1 -0
  29. package/dist/index.d.ts +37 -86
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +3 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +4 -4
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/modal/index.d.ts +2 -0
  36. package/dist/modal/index.d.ts.map +1 -0
  37. package/dist/modal/modal-detector.d.ts +29 -0
  38. package/dist/modal/modal-detector.d.ts.map +1 -0
  39. package/dist/react/StateAnnotation.d.ts +30 -0
  40. package/dist/react/StateAnnotation.d.ts.map +1 -0
  41. package/dist/react/UIBridgeNativeProvider.d.ts +156 -0
  42. package/dist/react/UIBridgeNativeProvider.d.ts.map +1 -0
  43. package/dist/react/index.d.ts +14 -69
  44. package/dist/react/index.d.ts.map +1 -0
  45. package/dist/react/index.js +3 -3
  46. package/dist/react/index.js.map +1 -1
  47. package/dist/react/index.mjs +4 -4
  48. package/dist/react/index.mjs.map +1 -1
  49. package/dist/react/{index.d.mts → useAutoRegister.d.ts} +7 -15
  50. package/dist/react/useAutoRegister.d.ts.map +1 -0
  51. package/dist/react/useUIBridge.d.ts +103 -0
  52. package/dist/react/useUIBridge.d.ts.map +1 -0
  53. package/dist/react/useUIBridgeModal.d.ts +14 -0
  54. package/dist/react/useUIBridgeModal.d.ts.map +1 -0
  55. package/dist/react/useUIBridgeToast.d.ts +25 -0
  56. package/dist/react/useUIBridgeToast.d.ts.map +1 -0
  57. package/dist/react/useUIComponent.d.ts +112 -0
  58. package/dist/react/useUIComponent.d.ts.map +1 -0
  59. package/dist/react/useUIElement.d.ts +162 -0
  60. package/dist/react/useUIElement.d.ts.map +1 -0
  61. package/dist/server/design-handlers.d.ts +47 -0
  62. package/dist/server/design-handlers.d.ts.map +1 -0
  63. package/dist/server/handlers.d.ts +25 -0
  64. package/dist/server/handlers.d.ts.map +1 -0
  65. package/dist/server/http-server.d.ts +262 -0
  66. package/dist/server/http-server.d.ts.map +1 -0
  67. package/dist/server/index.d.ts +14 -176
  68. package/dist/server/index.d.ts.map +1 -0
  69. package/dist/server/observability.d.ts +55 -0
  70. package/dist/server/observability.d.ts.map +1 -0
  71. package/dist/server/types.d.ts +368 -0
  72. package/dist/server/types.d.ts.map +1 -0
  73. package/dist/server/ws-connection.d.ts +48 -0
  74. package/dist/server/ws-connection.d.ts.map +1 -0
  75. package/dist/server/ws-event-bridge.d.ts +113 -0
  76. package/dist/server/ws-event-bridge.d.ts.map +1 -0
  77. package/dist/server/ws-protocol.d.ts +48 -0
  78. package/dist/server/ws-protocol.d.ts.map +1 -0
  79. package/dist/server/ws-types.d.ts +65 -0
  80. package/dist/server/ws-types.d.ts.map +1 -0
  81. package/dist/toast/index.d.ts +2 -0
  82. package/dist/toast/index.d.ts.map +1 -0
  83. package/dist/toast/toast-capture.d.ts +27 -0
  84. package/dist/toast/toast-capture.d.ts.map +1 -0
  85. package/dist/transport/CloudRelayClient.d.ts +51 -0
  86. package/dist/transport/CloudRelayClient.d.ts.map +1 -0
  87. package/dist/transport/DeviceAnnouncer.d.ts +75 -0
  88. package/dist/transport/DeviceAnnouncer.d.ts.map +1 -0
  89. package/dist/transport/index.d.ts +3 -0
  90. package/dist/transport/index.d.ts.map +1 -0
  91. package/dist/transport/logger.d.ts +23 -0
  92. package/dist/transport/logger.d.ts.map +1 -0
  93. package/dist/undo/index.d.ts +3 -0
  94. package/dist/undo/index.d.ts.map +1 -0
  95. package/dist/undo/undo-tracker.d.ts +59 -0
  96. package/dist/undo/undo-tracker.d.ts.map +1 -0
  97. package/package.json +3 -3
  98. package/dist/StateAnnotation--zm0Jfqj.d.ts +0 -755
  99. package/dist/StateAnnotation-BgFoVWFy.d.mts +0 -755
  100. package/dist/core/index.d.mts +0 -46
  101. package/dist/design-types-BHr6Q1FX.d.ts +0 -205
  102. package/dist/http-server--550eD1F.d.mts +0 -805
  103. package/dist/http-server-C9NaNBEP.d.ts +0 -805
  104. package/dist/index.d.mts +0 -89
  105. package/dist/registry-B5JadBN9.d.mts +0 -300
  106. package/dist/server/index.d.mts +0 -178
  107. package/dist/types-B0XA4vOF.d.mts +0 -197
  108. package/dist/types-CGVut7mc.d.ts +0 -567
package/dist/index.d.mts DELETED
@@ -1,89 +0,0 @@
1
- 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, i as NativeElementIdentifier, j as NativeElementRef, k as NativeElementState, l as NativeElementType, m as NativeFindRequest, n as NativeFindResponse, o as NativeLayout, 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, z as RegisteredNativeElement, W as WaitOptions, E as Workflow, F as WorkflowStep, G as WorkflowStepType } from './types-CGVut7mc.mjs';
2
- 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';
3
- export { buildTreePath, createNativeElementIdentifier, findAllByPattern, findElementByIdentifier, matchesIdentifier, parseTreePath } from './core/index.mjs';
4
- export { A as ActionRecord, C as CloudRelayClient, a as CloudRelayConfig, b as ComponentActionDef, c as ComponentActionRequest, d as ComponentActionResponse, D as DeclaredUndoState, M as ModalDetector, e as ModalPushInput, S as State, f as StateAnnotationRequiredElement, g as StateProps, T as ToastCapture, h as ToastCaptureConfig, i as ToastRecordInput, j as ToastRecorderInput, k as TransitionTo, l as TransitionToProps, U as UIBridgeNativeContextValue, m as UIBridgeNativeProvider, n as UIBridgeNativeProviderProps, o as UIBridgeProps, p as UndoTracker, q as UndoTrackerConfig, r as UseUIBridgeModalOptions, s as UseUIBridgeReturn, t as UseUIBridgeToastOptions, u as UseUIComponentOptions, v as UseUIComponentReturn, w as UseUIElementOptions, x as UseUIElementReturn, y as UseUIElementWithPropsReturn, z as useToastRecorder, B as useUIBridge, E as useUIBridgeModal, F as useUIBridgeNative, G as useUIBridgeNativeOptional, H as useUIBridgeNativeRequired, I as useUIBridgeRequired, J as useUIBridgeToast, K as useUIComponent, L as useUIComponentAction, N as useUIElement, O as useUIElementWithProps } from './StateAnnotation-BgFoVWFy.mjs';
5
- export { A as ActionExecutionOptions, C as ControlActionRequest, a as ControlActionResponse, b as ControlComponentActionRequest, c as ControlComponentActionResponse, N as NativeActionExecutor, P as PressActionParams, S as ScrollActionParams, d as SwipeActionParams, T as TypeActionParams, W as WaitResult } from './types-B0XA4vOF.mjs';
6
- export { DefaultNativeActionExecutor, createNativeActionExecutor } from './control/index.mjs';
7
- export { A as APIResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, e as HandlerContext, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, N as NativeServerConfig, k as NativeServerHandlers, l as NativeUIBridgeServer, m as NavigationProvider, R as RequestHandler, n as RouteDefinition, o as RouteProvider, S as ScreenshotProvider, p as ServerAdapter, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, q as WebSocketEventBridge, r as WebSocketMessageHandler, s as WebSocketServerAdapter, t as createNativeServer } from './http-server--550eD1F.mjs';
8
- export { NativeDesignHandlers, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers } from './server/index.mjs';
9
- export { E as ElementDesignData, a as ExtendedComputedStyles, F as FlattenedNativeStyle, N as NativeInteractionStateName, b as NativeStateStyles, P as PseudoElementStyles, R as ResponsiveSnapshot, S as StateStyles, c as StyleDiff } from './design-types-BHr6Q1FX.mjs';
10
- export { captureNativeResponsiveSnapshot, captureNativeStateVariations, getNativeElementDesignData, mapNativeStyleToExtended } from './design/index.mjs';
11
- export { UIBridgeInspector, UIBridgeInspectorProps } from './debug/index.mjs';
12
- import 'react/jsx-runtime';
13
- import 'react';
14
-
15
- /**
16
- * Device Announcer — mDNS + Cloud registration for physical device discovery
17
- *
18
- * Announces the UI Bridge service on the local network via mDNS (when
19
- * react-native-zeroconf is available) and optionally registers with the
20
- * cloud relay backend.
21
- */
22
- interface AnnouncerConfig {
23
- /** Stable device identifier */
24
- deviceId: string;
25
- /** App bundle/package ID */
26
- appId: string;
27
- /** UI Bridge server port (default 8087) */
28
- port?: number;
29
- /** Cloud relay WebSocket URL for registration */
30
- cloudRelayUrl?: string;
31
- /** Auth token for cloud relay */
32
- cloudToken?: string;
33
- /** UI Bridge SDK version */
34
- version?: string;
35
- }
36
- interface DeviceAnnouncerState {
37
- mdnsActive: boolean;
38
- cloudConnected: boolean;
39
- }
40
- /** Minimal interface for the react-native-zeroconf Zeroconf instance */
41
- interface ZeroconfService {
42
- publishService(type: string, protocol: string, domain: string, name: string, port: number, txtRecord: Record<string, string>): void;
43
- unpublishService(name: string): void;
44
- }
45
- /**
46
- * Announces the UI Bridge server on the local network (mDNS) and optionally
47
- * registers with the qontinui.io cloud relay for remote discovery.
48
- */
49
- declare class DeviceAnnouncer {
50
- private config;
51
- private state;
52
- private cloudWs;
53
- private reconnectTimer;
54
- private reconnectDelay;
55
- private stopped;
56
- /** Zeroconf instance, set when mDNS is successfully started */
57
- private zeroconf;
58
- /** Rotated pairing token for mDNS TXT records */
59
- private pairingToken;
60
- constructor(config: AnnouncerConfig);
61
- /**
62
- * Start mDNS advertisement.
63
- *
64
- * The consumer must pass the `Zeroconf` constructor (from `react-native-zeroconf`)
65
- * explicitly; otherwise this is a no-op.
66
- *
67
- * Rationale: Metro's `require()` throws an uncatchable module-load error if the
68
- * bundle doesn't include the named package. That error escapes async try/catch
69
- * boundaries and crashes the app. We avoid it by never calling `require()`
70
- * ourselves — the consumer imports the package when they know it's installed.
71
- *
72
- * @param ZeroconfCtor - constructor from `import Zeroconf from 'react-native-zeroconf'`
73
- */
74
- startMdnsAdvertise(ZeroconfCtor?: new () => ZeroconfService): Promise<void>;
75
- /**
76
- * Connect to the cloud relay WebSocket and send a device_register message.
77
- *
78
- * Reconnects automatically with exponential backoff (2 s → 60 s) if the
79
- * connection drops.
80
- */
81
- connectCloudRelay(): Promise<void>;
82
- /** Stop all advertising and registration. */
83
- stop(): Promise<void>;
84
- /** Return a copy of the current announcer state. */
85
- getState(): DeviceAnnouncerState;
86
- private scheduleReconnect;
87
- }
88
-
89
- export { type AnnouncerConfig, DeviceAnnouncer, type DeviceAnnouncerState };
@@ -1,300 +0,0 @@
1
- import { a as BridgeEventListener, H as NativeAppInfo, I as NativeRouteProviderLike, s as NativeSnapshotEnrichers, r as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, z as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, E as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot, q as NativeRegistrationCoverage } from './types-CGVut7mc.mjs';
2
-
3
- /**
4
- * Native Element and Component Registry
5
- *
6
- * Central registry for all UI elements and components registered with UI Bridge Native.
7
- * Adapted from ui-bridge for React Native environments.
8
- */
9
-
10
- /**
11
- * Options for registering an element
12
- */
13
- interface RegisterElementOptions {
14
- type?: NativeElementType;
15
- label?: string;
16
- actions?: NativeStandardAction[];
17
- customActions?: Record<string, NativeCustomAction>;
18
- props?: Record<string, unknown>;
19
- treePath?: string;
20
- testId?: string;
21
- accessibilityLabel?: string;
22
- /** Route path where the element was registered (for page-scoped filtering) */
23
- registrationRoute?: string | null;
24
- /** Flattened RN style (from StyleSheet.flatten) for design review */
25
- flatStyle?: Record<string, unknown>;
26
- /** State-specific style overrides for design review */
27
- stateStyles?: {
28
- pressed?: Record<string, unknown>;
29
- focused?: Record<string, unknown>;
30
- disabled?: Record<string, unknown>;
31
- };
32
- }
33
- /**
34
- * Options for registering a component
35
- */
36
- interface RegisterComponentOptions {
37
- name: string;
38
- description?: string;
39
- actions?: Array<{
40
- id: string;
41
- label?: string;
42
- description?: string;
43
- handler: (params?: unknown) => unknown | Promise<unknown>;
44
- }>;
45
- elementIds?: string[];
46
- }
47
- /**
48
- * Registry configuration
49
- */
50
- interface NativeRegistryConfig {
51
- verbose?: boolean;
52
- onEvent?: BridgeEventListener;
53
- }
54
- /**
55
- * Extract handler function names from an element's props.
56
- * Returns names of props whose values are functions (e.g. ['onPress', 'onChangeText']).
57
- */
58
- declare function extractHandlerNames(props?: Record<string, unknown>): string[];
59
- /**
60
- * Native UI Bridge Registry
61
- *
62
- * Manages registration and lookup of native UI elements and components.
63
- */
64
- declare class NativeUIBridgeRegistry {
65
- private elements;
66
- private components;
67
- private workflows;
68
- private eventListeners;
69
- private config;
70
- private enrichers;
71
- private snapshotExtras;
72
- /**
73
- * App identification metadata (appId/appName/appType/framework). Set via
74
- * `setAppInfo` — typically wired in the server constructor from the
75
- * `NativeUIBridgeConfig` the host passes to `UIBridgeNativeProvider`.
76
- *
77
- * When set, `createSnapshot` includes it on the resulting snapshot so
78
- * agents can identify the app from snapshot bytes alone (parity with the
79
- * `uiBridge` block on the `health` response). Snapshots created before
80
- * this is wired simply omit the field.
81
- */
82
- private appInfo;
83
- /**
84
- * Optional route provider. When set, `createSnapshot` reads
85
- * `currentRoute`/`segments` from it whenever the caller does not pass an
86
- * explicit `routeInfo` argument. This lets the default `getSnapshot` HTTP
87
- * handler — which has no direct reference to the `NativeUIBridgeServer`
88
- * instance — still emit a populated `currentRoute` field.
89
- *
90
- * Wired by `NativeUIBridgeServer.setRouteProvider`, which forwards the
91
- * provider into the registry alongside the per-handler overrides it
92
- * already installs.
93
- */
94
- private routeProvider;
95
- /**
96
- * Sticky flag: flips `true` the first time any element is registered and
97
- * stays `true` even after elements are unregistered. Lets agents distinguish
98
- * "this route never wired any elements" from "this route registered then
99
- * unmounted".
100
- */
101
- private everHadRegistrations;
102
- constructor(config?: NativeRegistryConfig);
103
- /**
104
- * Set the app identification metadata returned alongside snapshots.
105
- * Idempotent — re-calling with the same shape is a no-op.
106
- * Pass `null` (or omit a previous call) to clear.
107
- */
108
- setAppInfo(info: NativeAppInfo | null | undefined): void;
109
- /** Read-only accessor for the registered app info, if any. */
110
- getAppInfo(): NativeAppInfo | null;
111
- /**
112
- * Set a route provider whose `getCurrentRoute`/`getSegments` are read by
113
- * `createSnapshot` when no explicit `routeInfo` argument is supplied.
114
- *
115
- * Call with `null` to detach (e.g. when the host swaps providers on HMR).
116
- */
117
- setRouteProvider(provider: NativeRouteProviderLike | null | undefined): void;
118
- /** Read-only accessor for the registered route provider, if any. */
119
- getRouteProvider(): NativeRouteProviderLike | null;
120
- /**
121
- * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
122
- * with a partial set merges into existing slots instead of clobbering them.
123
- */
124
- setEnrichers(e: Partial<NativeSnapshotEnrichers>): void;
125
- /**
126
- * Read-only accessor for the canonical enrichers slot. Returned object is
127
- * the live reference, so callers can detect "no detector wired" via
128
- * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP
129
- * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need
130
- * to drive the ModalDetector directly without re-instantiating it.
131
- */
132
- getEnrichers(): Readonly<NativeSnapshotEnrichers>;
133
- /**
134
- * Register a custom snapshot enricher. The returned object will be
135
- * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
136
- * clobbering canonical fields. Returns a disposer.
137
- */
138
- registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void;
139
- /** Remove a custom snapshot enricher by name */
140
- unregisterSnapshotEnricher(name: string): void;
141
- /**
142
- * Register a native element
143
- */
144
- registerElement(id: string, ref: React.RefObject<NativeElementRef>, options?: RegisterElementOptions): RegisteredNativeElement;
145
- /**
146
- * Unregister an element
147
- */
148
- unregisterElement(id: string): void;
149
- /**
150
- * Get a registered element
151
- */
152
- getElement(id: string): RegisteredNativeElement | undefined;
153
- /**
154
- * Get all registered elements
155
- */
156
- getAllElements(): RegisteredNativeElement[];
157
- /**
158
- * Get all registered elements that are visible and have a layout
159
- */
160
- getVisibleElements(): RegisteredNativeElement[];
161
- /**
162
- * Get elements registered on a specific route (for page-scoped filtering)
163
- */
164
- getElementsForRoute(route: string): RegisteredNativeElement[];
165
- /**
166
- * Mark elements registered on a route as off-screen (visible: false, layout: null).
167
- *
168
- * Use this when a screen loses focus but stays mounted — common in React Navigation
169
- * tab navigators where inactive tabs remain in the tree. Without this call, stale
170
- * `layout` data lingers in snapshots and makes off-screen elements look rendered.
171
- *
172
- * Does NOT unregister the elements — they stay registered so the user's next visit
173
- * re-measures them via `onLayout` without re-mount cost. Elements without a
174
- * `registrationRoute` (app-wide registrations) are untouched.
175
- */
176
- markRouteOffscreen(route: string): void;
177
- /**
178
- * Update element state
179
- */
180
- updateElementState(id: string, state: Partial<NativeElementState>): void;
181
- /**
182
- * Update element props (for action execution)
183
- */
184
- updateElementProps(id: string, props: Record<string, unknown>): void;
185
- /**
186
- * Update element style for design review
187
- */
188
- updateElementStyle(id: string, flatStyle: Record<string, unknown>, stateStyles?: {
189
- pressed?: Record<string, unknown>;
190
- focused?: Record<string, unknown>;
191
- disabled?: Record<string, unknown>;
192
- }): void;
193
- /**
194
- * Get element style for design review
195
- */
196
- getElementStyle(id: string): Record<string, unknown> | null;
197
- /**
198
- * Find element by testID
199
- */
200
- findByTestId(testId: string): RegisteredNativeElement | undefined;
201
- /**
202
- * Find elements by type
203
- */
204
- findByType(type: NativeElementType): RegisteredNativeElement[];
205
- /**
206
- * Register a component
207
- */
208
- registerComponent(id: string, options: RegisterComponentOptions): RegisteredNativeComponent;
209
- /**
210
- * Unregister a component
211
- */
212
- unregisterComponent(id: string): void;
213
- /**
214
- * Get a registered component
215
- */
216
- getComponent(id: string): RegisteredNativeComponent | undefined;
217
- /**
218
- * Get all registered components
219
- */
220
- getAllComponents(): RegisteredNativeComponent[];
221
- /**
222
- * Register a workflow
223
- */
224
- registerWorkflow(workflow: Workflow): void;
225
- /**
226
- * Unregister a workflow
227
- */
228
- unregisterWorkflow(id: string): void;
229
- /**
230
- * Get a workflow
231
- */
232
- getWorkflow(id: string): Workflow | undefined;
233
- /**
234
- * Get all workflows
235
- */
236
- getAllWorkflows(): Workflow[];
237
- /**
238
- * Subscribe to events
239
- */
240
- on<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): () => void;
241
- /**
242
- * Unsubscribe from events
243
- */
244
- off<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): void;
245
- /**
246
- * Emit an event
247
- */
248
- emit(type: BridgeEventType, data: unknown): void;
249
- /**
250
- * Create a snapshot of the current state.
251
- *
252
- * Route resolution: `routeInfo` wins when provided. Otherwise — and this
253
- * is the path the default `getSnapshot` HTTP handler takes — we fall back
254
- * to the registered `routeProvider`. This means callers that never wire a
255
- * server-level override (the bare-server / cloud-relay path) still get a
256
- * populated `currentRoute` field as long as `setRouteProvider` was called
257
- * on the registry.
258
- */
259
- createSnapshot(routeInfo?: {
260
- currentRoute?: string | null;
261
- segments?: string[];
262
- }, options?: {
263
- visibleOnly?: boolean;
264
- currentRouteOnly?: boolean;
265
- }): NativeBridgeSnapshot;
266
- /**
267
- * Get registry statistics
268
- */
269
- getStats(): {
270
- elements: number;
271
- components: number;
272
- workflows: number;
273
- };
274
- /**
275
- * Compute registration coverage metadata for the current registry state.
276
- *
277
- * Groups currently-registered elements by `registrationRoute`, bucketing
278
- * elements without a route under `'?'`. `everHadRegistrations` is sticky —
279
- * once true, it stays true for the lifetime of the registry instance.
280
- */
281
- getRegistrationCoverage(): NativeRegistrationCoverage;
282
- /**
283
- * Clear all registrations
284
- */
285
- clear(): void;
286
- }
287
- /**
288
- * Set the global registry
289
- */
290
- declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
291
- /**
292
- * Get the global registry
293
- */
294
- declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
295
- /**
296
- * Reset the global registry
297
- */
298
- declare function resetGlobalRegistry(): void;
299
-
300
- export { type NativeRegistryConfig as N, type RegisterComponentOptions as R, NativeUIBridgeRegistry as a, type RegisterElementOptions as b, extractHandlerNames as e, getGlobalRegistry as g, resetGlobalRegistry as r, setGlobalRegistry as s };
@@ -1,178 +0,0 @@
1
- import { C as ConsoleErrorEntry, u as NetworkRequestEntry, k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server--550eD1F.mjs';
2
- export { v as ConsoleErrorsResponse, D as DismissModalResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse, w as JsonRpcClientMessage, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, x as JsonRpcServerMessage, y as JsonRpcSubscribe, z as JsonRpcUnsubscribe, N as NativeServerConfig, l as NativeUIBridgeServer, m as NavigationProvider, B as NetworkRequestsResponse, P as PushModalRequest, E as PushModalResponse, R as RequestHandler, n as RouteDefinition, o as RouteProvider, S as ScreenshotProvider, p as ServerAdapter, T as TapAtRequest, G as TapAtResponse, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, q as WebSocketEventBridge, r as WebSocketMessageHandler, s as WebSocketServerAdapter, t as createNativeServer, I as isBatchRequest, K as isSubscribe, L as isUnsubscribe } from '../http-server--550eD1F.mjs';
3
- import { a as NativeUIBridgeRegistry } from '../registry-B5JadBN9.mjs';
4
- import { N as NativeActionExecutor } from '../types-B0XA4vOF.mjs';
5
- import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.mjs';
6
- import '../types-CGVut7mc.mjs';
7
-
8
- /**
9
- * UI Bridge Native — observability ring buffers.
10
- *
11
- * Two small last-N buffers backing the `/control/console-errors` and
12
- * `/sdk/network-requests` endpoints. Each buffer monkey-patches the relevant
13
- * global on `install()` and restores the original on `uninstall()`, so they
14
- * can be installed/torn-down with the server's lifecycle.
15
- *
16
- * Both buffers are gated behind `features.testHooks` by the caller (see
17
- * NativeUIBridgeServer). Production builds default to `testHooks: false`,
18
- * so these patches never run on real users' devices.
19
- *
20
- * Implementation notes:
21
- * - Buffers default to capacity 100 entries and drop oldest on overflow.
22
- * - Patches are idempotent: `install()` is a no-op when already installed;
23
- * `uninstall()` is a no-op when not installed.
24
- * - Patches only restore the *original* function captured at install time;
25
- * if other code wraps `console.error` / `fetch` between install and
26
- * uninstall, those wrappers will be lost. Acceptable for test hooks.
27
- */
28
-
29
- declare class ConsoleErrorBuffer {
30
- private buffer;
31
- private installed;
32
- private originalError?;
33
- private originalWarn?;
34
- constructor(capacity?: number);
35
- install(): void;
36
- uninstall(): void;
37
- entries(opts?: {
38
- since?: number;
39
- limit?: number;
40
- }): ConsoleErrorEntry[];
41
- size(): number;
42
- clear(): void;
43
- isInstalled(): boolean;
44
- }
45
- declare class NetworkRequestBuffer {
46
- private buffer;
47
- private installed;
48
- private originalFetch?;
49
- private originalXhrOpen?;
50
- private originalXhrSend?;
51
- constructor(capacity?: number);
52
- install(): void;
53
- uninstall(): void;
54
- entries(opts?: {
55
- since?: number;
56
- limit?: number;
57
- }): NetworkRequestEntry[];
58
- size(): number;
59
- clear(): void;
60
- isInstalled(): boolean;
61
- }
62
-
63
- /**
64
- * UI Bridge Native Server Handlers
65
- *
66
- * Request handlers for the HTTP API endpoints.
67
- */
68
-
69
- /**
70
- * Create server handlers
71
- */
72
- declare function createServerHandlers(registry: NativeUIBridgeRegistry, executor: NativeActionExecutor, config?: {
73
- appInfo?: {
74
- appId: string;
75
- appName: string;
76
- appType: string;
77
- framework?: string;
78
- };
79
- /** Optional console-error ring buffer powering `GET /control/console-errors`. */
80
- consoleErrorBuffer?: ConsoleErrorBuffer;
81
- /** Optional network-request ring buffer powering `GET /sdk/network-requests`. */
82
- networkRequestBuffer?: NetworkRequestBuffer;
83
- }): NativeServerHandlers;
84
-
85
- /**
86
- * Pure-JS RFC 6455 WebSocket protocol implementation.
87
- *
88
- * Provides frame encoding/decoding and handshake utilities for running
89
- * a WebSocket server on react-native-tcp-socket without native crypto deps.
90
- */
91
- declare const OPCODE_CONTINUATION = 0;
92
- declare const OPCODE_TEXT = 1;
93
- declare const OPCODE_BINARY = 2;
94
- declare const OPCODE_CLOSE = 8;
95
- declare const OPCODE_PING = 9;
96
- declare const OPCODE_PONG = 10;
97
- interface DecodedFrame {
98
- opcode: number;
99
- fin: boolean;
100
- payload: Uint8Array;
101
- masked: boolean;
102
- }
103
- interface DecodeResult {
104
- frames: DecodedFrame[];
105
- remainder: Uint8Array<any>;
106
- }
107
- /**
108
- * Compute the Sec-WebSocket-Accept value from the client's Sec-WebSocket-Key.
109
- */
110
- declare function computeAcceptKey(clientKey: string): string;
111
- /**
112
- * Build the HTTP 101 Switching Protocols response for a WebSocket upgrade.
113
- */
114
- declare function buildUpgradeResponse(clientKey: string): string;
115
- /** Encode a text message as a WebSocket frame. */
116
- declare function encodeTextFrame(text: string): Uint8Array;
117
- /** Encode a PING frame with optional payload. */
118
- declare function encodePingFrame(payload?: Uint8Array): Uint8Array;
119
- /** Encode a PONG frame with the payload from the PING. */
120
- declare function encodePongFrame(payload: Uint8Array): Uint8Array;
121
- /** Encode a CLOSE frame with optional status code and reason. */
122
- declare function encodeCloseFrame(code?: number, reason?: string): Uint8Array;
123
- /**
124
- * Decode one or more WebSocket frames from a byte buffer.
125
- * Returns decoded frames and any unconsumed bytes (for partial frames).
126
- */
127
- declare function decodeFrames(buffer: Uint8Array): DecodeResult;
128
- /**
129
- * Decode a text payload from a Uint8Array.
130
- */
131
- declare function decodeTextPayload(payload: Uint8Array): string;
132
-
133
- /**
134
- * UI Bridge Native Design Review Handlers
135
- *
136
- * HTTP handlers for the 8 design review endpoints.
137
- * Maps registered element styles to the web SDK's design data format.
138
- */
139
-
140
- /**
141
- * Design handler interface (subset of NativeServerHandlers)
142
- */
143
- interface NativeDesignHandlers {
144
- getElementStyles: (ctx: HandlerContext) => Promise<APIResponse<ElementDesignData>>;
145
- getElementStateStyles: (ctx: HandlerContext) => Promise<APIResponse<{
146
- elementId: string;
147
- stateStyles: StateStyles[];
148
- }>>;
149
- getDesignSnapshot: (ctx: HandlerContext) => Promise<APIResponse<{
150
- elements: ElementDesignData[];
151
- timestamp: number;
152
- }>>;
153
- getResponsiveSnapshots: (ctx: HandlerContext) => Promise<APIResponse<ResponsiveSnapshot[]>>;
154
- runDesignAudit: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
155
- loadStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
156
- loaded: boolean;
157
- }>>;
158
- getStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
159
- clearStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
160
- cleared: boolean;
161
- }>>;
162
- evaluateQuality: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
163
- getQualityContexts: (ctx: HandlerContext) => Promise<APIResponse<Array<{
164
- name: string;
165
- description: string;
166
- }>>>;
167
- saveBaseline: (ctx: HandlerContext) => Promise<APIResponse<{
168
- saved: boolean;
169
- elementCount: number;
170
- }>>;
171
- diffBaseline: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
172
- }
173
- /**
174
- * Create design review handlers.
175
- */
176
- declare function createDesignHandlers(registry: NativeUIBridgeRegistry): NativeDesignHandlers;
177
-
178
- export { APIResponse, ConsoleErrorBuffer, ConsoleErrorEntry, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, NetworkRequestBuffer, NetworkRequestEntry, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };