@qontinui/ui-bridge-native 0.1.6 → 0.2.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 (98) hide show
  1. package/dist/control/{action-executor.d.ts → index.d.mts} +14 -6
  2. package/dist/control/index.d.ts +95 -5
  3. package/dist/control/index.js +74 -11
  4. package/dist/control/index.js.map +1 -1
  5. package/dist/control/index.mjs +74 -11
  6. package/dist/control/index.mjs.map +1 -1
  7. package/dist/core/index.d.mts +46 -0
  8. package/dist/core/index.d.ts +43 -6
  9. package/dist/core/index.js +108 -2
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.mjs +108 -2
  12. package/dist/core/index.mjs.map +1 -1
  13. package/dist/debug/{inspector.d.ts → index.d.mts} +6 -3
  14. package/dist/debug/index.d.ts +44 -4
  15. package/dist/debug/index.js +2 -2
  16. package/dist/debug/index.js.map +1 -1
  17. package/dist/debug/index.mjs +2 -2
  18. package/dist/debug/index.mjs.map +1 -1
  19. package/dist/design/{design-inspector-native.d.ts → index.d.mts} +11 -7
  20. package/dist/design/index.d.ts +60 -5
  21. package/dist/{design/design-types.d.ts → design-types-BHr6Q1FX.d.mts} +11 -10
  22. package/dist/design-types-BHr6Q1FX.d.ts +205 -0
  23. package/dist/http-server-D2U1k48d.d.mts +703 -0
  24. package/dist/http-server-ck8clUsZ.d.ts +703 -0
  25. package/dist/index.d.mts +89 -0
  26. package/dist/index.d.ts +86 -28
  27. package/dist/index.js +754 -50
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +749 -51
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/react/{useAutoRegister.d.ts → index.d.mts} +15 -7
  32. package/dist/react/index.d.ts +69 -8
  33. package/dist/react/index.js +733 -50
  34. package/dist/react/index.js.map +1 -1
  35. package/dist/react/index.mjs +731 -51
  36. package/dist/react/index.mjs.map +1 -1
  37. package/dist/{core/registry.d.ts → registry-BxXaxmsT.d.ts} +51 -10
  38. package/dist/registry-KdUW_koV.d.mts +253 -0
  39. package/dist/server/index.d.mts +119 -0
  40. package/dist/server/index.d.ts +117 -13
  41. package/dist/server/index.js +272 -16
  42. package/dist/server/index.js.map +1 -1
  43. package/dist/server/index.mjs +272 -16
  44. package/dist/server/index.mjs.map +1 -1
  45. package/dist/{core/types.d.ts → types-BwdPNpII.d.mts} +172 -30
  46. package/dist/types-BwdPNpII.d.ts +525 -0
  47. package/dist/{control/types.d.ts → types-DCEv5qb6.d.ts} +36 -15
  48. package/dist/types-DjB0zJJH.d.mts +197 -0
  49. package/dist/useUIBridgeToast-BPIEbsEc.d.mts +726 -0
  50. package/dist/useUIBridgeToast-DD13oF3k.d.ts +726 -0
  51. package/package.json +2 -2
  52. package/dist/control/action-executor.d.ts.map +0 -1
  53. package/dist/control/index.d.ts.map +0 -1
  54. package/dist/control/types.d.ts.map +0 -1
  55. package/dist/core/element-identifier.d.ts +0 -41
  56. package/dist/core/element-identifier.d.ts.map +0 -1
  57. package/dist/core/index.d.ts.map +0 -1
  58. package/dist/core/registry.d.ts.map +0 -1
  59. package/dist/core/types.d.ts.map +0 -1
  60. package/dist/debug/index.d.ts.map +0 -1
  61. package/dist/debug/inspector.d.ts.map +0 -1
  62. package/dist/design/design-inspector-native.d.ts.map +0 -1
  63. package/dist/design/design-types.d.ts.map +0 -1
  64. package/dist/design/index.d.ts.map +0 -1
  65. package/dist/index.d.ts.map +0 -1
  66. package/dist/react/UIBridgeNativeProvider.d.ts +0 -147
  67. package/dist/react/UIBridgeNativeProvider.d.ts.map +0 -1
  68. package/dist/react/index.d.ts.map +0 -1
  69. package/dist/react/useAutoRegister.d.ts.map +0 -1
  70. package/dist/react/useUIBridge.d.ts +0 -103
  71. package/dist/react/useUIBridge.d.ts.map +0 -1
  72. package/dist/react/useUIComponent.d.ts +0 -112
  73. package/dist/react/useUIComponent.d.ts.map +0 -1
  74. package/dist/react/useUIElement.d.ts +0 -162
  75. package/dist/react/useUIElement.d.ts.map +0 -1
  76. package/dist/server/design-handlers.d.ts +0 -47
  77. package/dist/server/design-handlers.d.ts.map +0 -1
  78. package/dist/server/handlers.d.ts +0 -20
  79. package/dist/server/handlers.d.ts.map +0 -1
  80. package/dist/server/http-server.d.ts +0 -247
  81. package/dist/server/http-server.d.ts.map +0 -1
  82. package/dist/server/index.d.ts.map +0 -1
  83. package/dist/server/types.d.ts +0 -200
  84. package/dist/server/types.d.ts.map +0 -1
  85. package/dist/server/ws-connection.d.ts +0 -48
  86. package/dist/server/ws-connection.d.ts.map +0 -1
  87. package/dist/server/ws-event-bridge.d.ts +0 -113
  88. package/dist/server/ws-event-bridge.d.ts.map +0 -1
  89. package/dist/server/ws-protocol.d.ts +0 -48
  90. package/dist/server/ws-protocol.d.ts.map +0 -1
  91. package/dist/server/ws-types.d.ts +0 -65
  92. package/dist/server/ws-types.d.ts.map +0 -1
  93. package/dist/transport/CloudRelayClient.d.ts +0 -51
  94. package/dist/transport/CloudRelayClient.d.ts.map +0 -1
  95. package/dist/transport/DeviceAnnouncer.d.ts +0 -75
  96. package/dist/transport/DeviceAnnouncer.d.ts.map +0 -1
  97. package/dist/transport/index.d.ts +0 -3
  98. package/dist/transport/index.d.ts.map +0 -1
@@ -0,0 +1,726 @@
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';
7
+
8
+ /**
9
+ * Cloud Relay Client — WebSocket tunnel from mobile device to backend
10
+ *
11
+ * Maintains a persistent WebSocket connection to the qontinui.io backend.
12
+ * Receives tunneled HTTP requests from runners, calls the local NativeUIBridgeServer,
13
+ * and sends responses back through the tunnel.
14
+ */
15
+
16
+ interface CloudRelayConfig {
17
+ /** WebSocket URL for the device bridge endpoint */
18
+ relayUrl: string;
19
+ /** Stable device identifier */
20
+ deviceId: string;
21
+ /** Authentication token */
22
+ authToken: string;
23
+ /** Reference to the local UI Bridge server for processing requests */
24
+ uiBridgeServer: NativeUIBridgeServer;
25
+ }
26
+ /**
27
+ * Manages a WebSocket tunnel from the mobile device to the qontinui.io backend.
28
+ *
29
+ * When a runner sends an HTTP request to a cloud device it is serialised as a
30
+ * `TunnelRequest` JSON frame by the backend and forwarded here. This client
31
+ * deserializes it, calls `NativeUIBridgeServer.handleRequest()` directly
32
+ * (avoiding loopback TCP overhead), and sends the `TunnelResponse` back.
33
+ */
34
+ declare class CloudRelayClient {
35
+ private ws;
36
+ private config;
37
+ private reconnectDelay;
38
+ private maxReconnectDelay;
39
+ private stopped;
40
+ private _isConnected;
41
+ private reconnectTimer;
42
+ constructor(config: CloudRelayConfig);
43
+ /** Whether the relay WebSocket is currently connected */
44
+ get isConnected(): boolean;
45
+ /** Connect to the relay and start processing tunneled requests. */
46
+ start(): void;
47
+ /** Disconnect and stop reconnecting. */
48
+ stop(): void;
49
+ private connect;
50
+ private onMessage;
51
+ /**
52
+ * Process a tunneled HTTP request by calling the local NativeUIBridgeServer
53
+ * directly (no loopback TCP involved).
54
+ */
55
+ private handleTunneledRequest;
56
+ private scheduleReconnect;
57
+ }
58
+
59
+ interface ModalPushInput {
60
+ id: string;
61
+ title?: string;
62
+ type?: NativeModalInfo['type'];
63
+ blocking?: boolean;
64
+ dismissible?: boolean;
65
+ }
66
+ /**
67
+ * Declarative modal store. Components/hooks call pushModal/dismissModal directly
68
+ * — there is no DOM/tree scanner. The detector is the single source of truth for
69
+ * the snapshot's modalStack context.
70
+ */
71
+ declare class ModalDetector {
72
+ /** Map preserves O(1) idempotent replace by id; ordering comes from detectedAt. */
73
+ private modals;
74
+ pushModal(modal: ModalPushInput): void;
75
+ /**
76
+ * Remove a modal from the stack. Returns `true` if a modal with that id
77
+ * was actually deleted, `false` if nothing matched (idempotent so repeated
78
+ * calls don't throw, but callers — e.g. the HTTP test-hook endpoint — can
79
+ * surface the miss to clients).
80
+ */
81
+ dismissModal(id: string): boolean;
82
+ getSnapshotModalContext(): NativeSnapshotModalContext;
83
+ getActive(): NativeModalInfo[];
84
+ clear(): void;
85
+ }
86
+
87
+ interface ToastRecordInput {
88
+ id: string;
89
+ message: string;
90
+ level?: NativeCapturedToast['level'];
91
+ appearedAt?: number;
92
+ }
93
+ interface ToastCaptureConfig {
94
+ maxRecent?: number;
95
+ }
96
+ /**
97
+ * Declarative toast/snackbar tracker. Components call recordToast/dismissToast
98
+ * directly — there is no DOM/tree scanner. The active map plus a fixed-size
99
+ * recent ring buffer feed the snapshot's toasts context.
100
+ */
101
+ declare class ToastCapture {
102
+ private active;
103
+ private recent;
104
+ private totalCaptured;
105
+ private maxRecent;
106
+ constructor(config?: ToastCaptureConfig);
107
+ recordToast(toast: ToastRecordInput): void;
108
+ dismissToast(id: string): void;
109
+ getSnapshotToastContext(): NativeSnapshotToastContext;
110
+ clear(): void;
111
+ }
112
+
113
+ /**
114
+ * A single bridge action recorded for undo correlation. Action-correlation
115
+ * only — RN has no DOM/execCommand probe, so we rely on developer
116
+ * declaration plus this rolling history of recent actions.
117
+ */
118
+ interface ActionRecord {
119
+ id: string;
120
+ type: string;
121
+ targetId?: string;
122
+ description?: string;
123
+ timestamp: number;
124
+ /** Default true — set false for actions that aren't reversible (e.g. navigation, network calls) */
125
+ reversible?: boolean;
126
+ }
127
+ /**
128
+ * Developer-declared undo/redo state. When set, this is authoritative and
129
+ * overrides any heuristic inference from action history.
130
+ */
131
+ interface DeclaredUndoState {
132
+ canUndo: boolean;
133
+ canRedo: boolean;
134
+ undoDescription?: string;
135
+ redoDescription?: string;
136
+ undoDepth?: number;
137
+ redoDepth?: number;
138
+ }
139
+ interface UndoTrackerConfig {
140
+ maxHistory?: number;
141
+ }
142
+ /**
143
+ * Action-correlation undo tracker for React Native.
144
+ *
145
+ * Maintains a rolling buffer of recent actions and a developer-declared
146
+ * undo state slot. The declared state is authoritative when set; otherwise
147
+ * we infer `canUndo` from whether any reversible action has been recorded.
148
+ * `executeUndo`/`executeRedo` are placeholders pending an IPC path through
149
+ * ui-bridge-native to the runner's `/control/undo`.
150
+ */
151
+ declare class UndoTracker {
152
+ private readonly maxHistory;
153
+ private actions;
154
+ private declaredState;
155
+ constructor(config?: UndoTrackerConfig);
156
+ recordAction(record: ActionRecord): void;
157
+ setDeclaredState(state: DeclaredUndoState): void;
158
+ getActionHistory(): ActionRecord[];
159
+ getSnapshotUndoContext(): NativeSnapshotUndoContext;
160
+ executeUndo(): {
161
+ ok: boolean;
162
+ reason?: string;
163
+ };
164
+ executeRedo(): {
165
+ ok: boolean;
166
+ reason?: string;
167
+ };
168
+ clear(): void;
169
+ }
170
+
171
+ /**
172
+ * UI Bridge Native context value
173
+ */
174
+ interface UIBridgeNativeContextValue {
175
+ /** Feature flags */
176
+ features: NativeUIBridgeFeatures;
177
+ /** Configuration */
178
+ config: NativeUIBridgeConfig;
179
+ /** Element registry */
180
+ registry: NativeUIBridgeRegistry;
181
+ /** Action executor */
182
+ executor: NativeActionExecutor;
183
+ /** Modal stack tracker (declarative pushModal/dismissModal) */
184
+ modalDetector: ModalDetector;
185
+ /** Toast/snackbar tracker (declarative recordToast/dismissToast) */
186
+ toastCapture: ToastCapture;
187
+ /** Undo/redo action-correlation tracker */
188
+ undoTracker: UndoTracker;
189
+ /** Get all registered elements */
190
+ getElements: () => RegisteredNativeElement[];
191
+ /** Get all registered components */
192
+ getComponents: () => RegisteredNativeComponent[];
193
+ /** Create a snapshot */
194
+ createSnapshot: () => NativeBridgeSnapshot;
195
+ /** Subscribe to events */
196
+ on: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => () => void;
197
+ /** Unsubscribe from events */
198
+ off: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => void;
199
+ /** Whether the provider is initialized */
200
+ initialized: boolean;
201
+ /** Server running status */
202
+ serverRunning: boolean;
203
+ /** Start the HTTP server */
204
+ startServer: () => Promise<void>;
205
+ /** Stop the HTTP server */
206
+ stopServer: () => void;
207
+ /** Get the current navigation route (if a RouteProvider is configured) */
208
+ getCurrentRoute: () => string | null;
209
+ }
210
+ /**
211
+ * UI Bridge Native provider props
212
+ */
213
+ interface UIBridgeNativeProviderProps {
214
+ /** Child components */
215
+ children: React$1.ReactNode;
216
+ /** Feature flags */
217
+ features?: NativeUIBridgeFeatures;
218
+ /** Configuration */
219
+ config?: NativeUIBridgeConfig;
220
+ /** Event handler */
221
+ onEvent?: BridgeEventListener;
222
+ /**
223
+ * A ServerAdapter instance for the HTTP server.
224
+ * The app is responsible for creating this using its preferred native TCP/HTTP library.
225
+ * @see ServerAdapter interface in server/http-server.ts
226
+ */
227
+ serverAdapter?: ServerAdapter;
228
+ /**
229
+ * Navigation provider for programmatic route navigation via UI Bridge.
230
+ * Pass Expo Router's push/back functions to enable `control/page/navigate`.
231
+ */
232
+ navigationProvider?: {
233
+ navigate: (url: string) => void;
234
+ back?: () => void;
235
+ };
236
+ /**
237
+ * Screenshot provider for native screen capture via UI Bridge.
238
+ * Pass a function that captures the current screen as base64 PNG.
239
+ */
240
+ screenshotProvider?: {
241
+ capture: () => Promise<{
242
+ base64: string;
243
+ width: number;
244
+ height: number;
245
+ }>;
246
+ };
247
+ /**
248
+ * Route provider for exposing the current navigation route in snapshots.
249
+ * Wire this to Expo Router's `usePathname()` / `useSegments()` via a module-level ref.
250
+ */
251
+ routeProvider?: RouteProvider;
252
+ /**
253
+ * Configuration for the cloud relay tunnel (enables remote device verification
254
+ * when USB/LAN are not available). Omit `uiBridgeServer` — the provider wires
255
+ * that automatically after the server starts.
256
+ */
257
+ cloudRelayConfig?: Omit<CloudRelayConfig, 'uiBridgeServer'>;
258
+ /**
259
+ * Enable mDNS advertisement so that runners on the same LAN can discover this
260
+ * device automatically (requires react-native-zeroconf).
261
+ */
262
+ enableMdnsAnnounce?: boolean;
263
+ /**
264
+ * Stable device identifier used for mDNS TXT records and cloud relay
265
+ * registration. Typically sourced from expo-device or a UUID stored in
266
+ * AsyncStorage.
267
+ */
268
+ deviceId?: string;
269
+ }
270
+ /**
271
+ * UI Bridge Native Provider
272
+ *
273
+ * Provides UI Bridge Native context to child components.
274
+ *
275
+ * @example
276
+ * ```tsx
277
+ * // app/_layout.tsx
278
+ * import { UIBridgeNativeProvider } from 'ui-bridge-native';
279
+ *
280
+ * export default function RootLayout() {
281
+ * return (
282
+ * <UIBridgeNativeProvider
283
+ * features={{ server: __DEV__, debug: __DEV__ }}
284
+ * config={{ serverPort: 8087 }}
285
+ * >
286
+ * <Stack>{children}</Stack>
287
+ * </UIBridgeNativeProvider>
288
+ * );
289
+ * }
290
+ * ```
291
+ */
292
+ declare function UIBridgeNativeProvider({ children, features, config, onEvent, serverAdapter, navigationProvider, screenshotProvider, routeProvider, cloudRelayConfig, enableMdnsAnnounce, deviceId, }: UIBridgeNativeProviderProps): react_jsx_runtime.JSX.Element;
293
+ /**
294
+ * useUIBridgeNative hook
295
+ *
296
+ * Access the UI Bridge Native context. Throws if used outside provider.
297
+ */
298
+ declare function useUIBridgeNative(): UIBridgeNativeContextValue;
299
+ /**
300
+ * useUIBridgeNativeOptional hook
301
+ *
302
+ * Access the UI Bridge Native context, returning null if outside provider.
303
+ */
304
+ declare function useUIBridgeNativeOptional(): UIBridgeNativeContextValue | null;
305
+ /**
306
+ * useUIBridgeNativeRequired hook
307
+ *
308
+ * Alias for useUIBridgeNative (throws if outside provider).
309
+ */
310
+ declare const useUIBridgeNativeRequired: typeof useUIBridgeNative;
311
+
312
+ /**
313
+ * useUIElement Hook for React Native
314
+ *
315
+ * Register a native element with UI Bridge for control and observation.
316
+ */
317
+
318
+ /**
319
+ * useUIElement options
320
+ */
321
+ interface UseUIElementOptions {
322
+ /** Unique identifier for the element */
323
+ id: string;
324
+ /** Element type (defaults to 'custom') */
325
+ type?: NativeElementType;
326
+ /** Human-readable label */
327
+ label?: string;
328
+ /** Override available actions */
329
+ actions?: NativeStandardAction[];
330
+ /** Custom actions */
331
+ customActions?: Record<string, NativeCustomAction>;
332
+ /** Whether to automatically register on mount */
333
+ autoRegister?: boolean;
334
+ /** Callback when state changes */
335
+ onStateChange?: (state: NativeElementState) => void;
336
+ /** Parent component path for tree path generation */
337
+ parentPath?: string;
338
+ /** RN style prop — will be flattened for design review */
339
+ style?: unknown;
340
+ /** State-specific style overrides for design review (pressed, focused, disabled) */
341
+ stateStyles?: {
342
+ pressed?: unknown;
343
+ focused?: unknown;
344
+ disabled?: unknown;
345
+ };
346
+ /**
347
+ * Handler props to auto-register with the bridge for action execution.
348
+ * When provided, the bridge can invoke these handlers via press/type/toggle actions
349
+ * without the component needing a separate useEffect + updateElementProps call.
350
+ *
351
+ * @example
352
+ * ```tsx
353
+ * const { ref, onLayout, bridgeProps } = useUIElement({
354
+ * id: 'my-button',
355
+ * type: 'pressable',
356
+ * handlers: { onPress: handlePress },
357
+ * });
358
+ * ```
359
+ */
360
+ handlers?: Record<string, ((...args: any[]) => any) | undefined>;
361
+ }
362
+ /**
363
+ * Bridge props to spread onto the component
364
+ */
365
+ interface UIBridgeProps {
366
+ /** Test ID for automation */
367
+ testID: string;
368
+ /** Accessibility label */
369
+ accessibilityLabel?: string;
370
+ }
371
+ /**
372
+ * useUIElement return value
373
+ */
374
+ interface UseUIElementReturn {
375
+ /** Ref to attach to the element */
376
+ ref: React.RefObject<NativeElementRef>;
377
+ /** onLayout handler to spread onto the element - uses generic type for RN version compatibility */
378
+ onLayout: (event: {
379
+ nativeEvent: {
380
+ layout: {
381
+ x: number;
382
+ y: number;
383
+ width: number;
384
+ height: number;
385
+ };
386
+ };
387
+ }) => void;
388
+ /** Props to spread onto the element for identification */
389
+ bridgeProps: UIBridgeProps;
390
+ /** Whether the element is registered */
391
+ registered: boolean;
392
+ /** Get current state */
393
+ getState: () => NativeElementState | null;
394
+ /** Get element identifier */
395
+ getIdentifier: () => NativeElementIdentifier | null;
396
+ /** Trigger an action on this element */
397
+ trigger: (action: NativeStandardAction | string, params?: Record<string, unknown>) => Promise<void>;
398
+ /** Manually register the element */
399
+ register: () => void;
400
+ /** Manually unregister the element */
401
+ unregister: () => void;
402
+ /** The registered element info */
403
+ registeredElement: RegisteredNativeElement | null;
404
+ /** Update style for design review (flattens and stores in registry) */
405
+ updateStyle: (style: unknown, stateStyles?: {
406
+ pressed?: unknown;
407
+ focused?: unknown;
408
+ disabled?: unknown;
409
+ }) => void;
410
+ }
411
+ /**
412
+ * useUIElement hook for React Native
413
+ *
414
+ * Registers a native element with UI Bridge for programmatic control.
415
+ *
416
+ * @example
417
+ * ```tsx
418
+ * function SubmitButton() {
419
+ * const { ref, onLayout, bridgeProps, trigger } = useUIElement({
420
+ * id: 'submit-btn',
421
+ * type: 'button',
422
+ * label: 'Submit Form',
423
+ * });
424
+ *
425
+ * return (
426
+ * <Pressable
427
+ * ref={ref}
428
+ * onLayout={onLayout}
429
+ * {...bridgeProps}
430
+ * onPress={() => handleSubmit()}
431
+ * >
432
+ * <Text>Submit</Text>
433
+ * </Pressable>
434
+ * );
435
+ * }
436
+ * ```
437
+ */
438
+ declare function useUIElement(options: UseUIElementOptions): UseUIElementReturn;
439
+ /**
440
+ * useUIElementWithProps hook
441
+ *
442
+ * Extended version that also captures component props for action execution.
443
+ * Useful when you need the bridge to be able to call onPress, onChangeText, etc.
444
+ *
445
+ * @example
446
+ * ```tsx
447
+ * function TextInputField({ onChangeText, value }) {
448
+ * const { ref, onLayout, bridgeProps, captureProps } = useUIElementWithProps({
449
+ * id: 'email-input',
450
+ * type: 'input',
451
+ * });
452
+ *
453
+ * // Capture props so bridge can call onChangeText
454
+ * captureProps({ onChangeText, value });
455
+ *
456
+ * return (
457
+ * <TextInput
458
+ * ref={ref}
459
+ * onLayout={onLayout}
460
+ * {...bridgeProps}
461
+ * value={value}
462
+ * onChangeText={onChangeText}
463
+ * />
464
+ * );
465
+ * }
466
+ * ```
467
+ */
468
+ interface UseUIElementWithPropsReturn extends UseUIElementReturn {
469
+ /** Capture props for action execution */
470
+ captureProps: (props: Record<string, unknown>) => void;
471
+ }
472
+ declare function useUIElementWithProps(options: UseUIElementOptions): UseUIElementWithPropsReturn;
473
+
474
+ /**
475
+ * useUIComponent Hook for React Native
476
+ *
477
+ * Register a component with UI Bridge for component-level actions.
478
+ */
479
+
480
+ /**
481
+ * Action definition for useUIComponent
482
+ */
483
+ interface ComponentActionDef<TParams = unknown, TResult = unknown> {
484
+ /** Action identifier */
485
+ id: string;
486
+ /** Human-readable label */
487
+ label?: string;
488
+ /** Description */
489
+ description?: string;
490
+ /** Handler function */
491
+ handler: (params?: TParams) => TResult | Promise<TResult>;
492
+ }
493
+ /**
494
+ * useUIComponent options
495
+ */
496
+ interface UseUIComponentOptions {
497
+ /** Unique identifier for the component */
498
+ id: string;
499
+ /** Human-readable name */
500
+ name: string;
501
+ /** Description */
502
+ description?: string;
503
+ /** Actions available on this component */
504
+ actions?: ComponentActionDef[];
505
+ /** Child element IDs owned by this component */
506
+ elementIds?: string[];
507
+ /** Whether to automatically register on mount */
508
+ autoRegister?: boolean;
509
+ }
510
+ /**
511
+ * useUIComponent return value
512
+ */
513
+ interface UseUIComponentReturn {
514
+ /** Whether the component is registered */
515
+ registered: boolean;
516
+ /** Execute an action on this component */
517
+ executeAction: <TParams = unknown, TResult = unknown>(actionId: string, params?: TParams) => Promise<TResult>;
518
+ /** Manually register the component */
519
+ register: () => void;
520
+ /** Manually unregister the component */
521
+ unregister: () => void;
522
+ /** Update actions dynamically */
523
+ updateActions: (actions: ComponentActionDef[]) => void;
524
+ /** Add an element ID to this component */
525
+ addElement: (elementId: string) => void;
526
+ /** Remove an element ID from this component */
527
+ removeElement: (elementId: string) => void;
528
+ /** The registered component info */
529
+ registeredComponent: RegisteredNativeComponent | null;
530
+ }
531
+ /**
532
+ * useUIComponent hook for React Native
533
+ *
534
+ * Registers a component with UI Bridge for component-level control.
535
+ * Components can expose high-level actions that may orchestrate multiple element interactions.
536
+ *
537
+ * @example
538
+ * ```tsx
539
+ * function LoginForm() {
540
+ * const [email, setEmail] = useState('');
541
+ * const [password, setPassword] = useState('');
542
+ *
543
+ * useUIComponent({
544
+ * id: 'login-form',
545
+ * name: 'Login Form',
546
+ * actions: [
547
+ * {
548
+ * id: 'login',
549
+ * label: 'Submit Login',
550
+ * handler: async ({ email, password }) => {
551
+ * setEmail(email);
552
+ * setPassword(password);
553
+ * await submitLogin();
554
+ * },
555
+ * },
556
+ * {
557
+ * id: 'clear',
558
+ * label: 'Clear Form',
559
+ * handler: () => {
560
+ * setEmail('');
561
+ * setPassword('');
562
+ * },
563
+ * },
564
+ * ],
565
+ * });
566
+ *
567
+ * return (
568
+ * <View>
569
+ * <TextInput value={email} onChangeText={setEmail} />
570
+ * <TextInput value={password} onChangeText={setPassword} secureTextEntry />
571
+ * <Button title="Login" onPress={handleSubmit} />
572
+ * </View>
573
+ * );
574
+ * }
575
+ * ```
576
+ */
577
+ declare function useUIComponent(options: UseUIComponentOptions): UseUIComponentReturn;
578
+ /**
579
+ * useUIComponentAction hook
580
+ *
581
+ * Create a stable action handler that can be used with useUIComponent.
582
+ * Useful for memoizing action handlers.
583
+ */
584
+ declare function useUIComponentAction<TParams = unknown, TResult = unknown>(handler: (params?: TParams) => TResult | Promise<TResult>, deps: React.DependencyList): (params?: TParams) => TResult | Promise<TResult>;
585
+
586
+ /**
587
+ * useUIBridge Hook for React Native
588
+ *
589
+ * Provides a simplified interface for common UI Bridge operations.
590
+ */
591
+
592
+ /**
593
+ * Component action request
594
+ */
595
+ interface ComponentActionRequest {
596
+ /** Action ID */
597
+ action: string;
598
+ /** Action parameters */
599
+ params?: Record<string, unknown>;
600
+ }
601
+ /**
602
+ * Component action response
603
+ */
604
+ interface ComponentActionResponse {
605
+ /** Whether the action succeeded */
606
+ success: boolean;
607
+ /** Result of the action */
608
+ result?: unknown;
609
+ /** Error message if failed */
610
+ error?: string;
611
+ /** Duration in milliseconds */
612
+ durationMs: number;
613
+ /** Timestamp */
614
+ timestamp: number;
615
+ }
616
+ /**
617
+ * useUIBridge return type
618
+ */
619
+ interface UseUIBridgeReturn {
620
+ /** Whether UI Bridge is available */
621
+ available: boolean;
622
+ /** Whether UI Bridge is initialized */
623
+ initialized: boolean;
624
+ /** All registered elements */
625
+ elements: RegisteredNativeElement[];
626
+ /** All registered components */
627
+ components: RegisteredNativeComponent[];
628
+ /** All registered workflows */
629
+ workflows: Workflow[];
630
+ /** Create a snapshot of the current state */
631
+ createSnapshot: () => NativeBridgeSnapshot;
632
+ /** Execute an action on an element */
633
+ executeAction: (elementId: string, request: NativeActionRequest) => Promise<NativeActionResponse>;
634
+ /** Execute a component action */
635
+ executeComponentAction: (componentId: string, request: ComponentActionRequest) => Promise<ComponentActionResponse>;
636
+ /** Find elements */
637
+ find: (request?: NativeFindRequest) => Promise<NativeFindResponse>;
638
+ /** Get an element by ID */
639
+ getElement: (id: string) => RegisteredNativeElement | undefined;
640
+ /** Get a component by ID */
641
+ getComponent: (id: string) => RegisteredNativeComponent | undefined;
642
+ /** Get element state by ID */
643
+ getElementState: (id: string) => ReturnType<RegisteredNativeElement['getState']> | null;
644
+ /** Register a workflow */
645
+ registerWorkflow: (workflow: Workflow) => void;
646
+ /** Unregister a workflow */
647
+ unregisterWorkflow: (id: string) => void;
648
+ }
649
+ /**
650
+ * useUIBridge hook
651
+ *
652
+ * Provides a simplified interface for accessing UI Bridge functionality.
653
+ *
654
+ * @example
655
+ * ```tsx
656
+ * function MyComponent() {
657
+ * const { available, elements, executeAction, find } = useUIBridge();
658
+ *
659
+ * if (!available) {
660
+ * return <Text>UI Bridge not available</Text>;
661
+ * }
662
+ *
663
+ * const handlePress = async () => {
664
+ * // Find all buttons
665
+ * const result = await find({ types: ['button'] });
666
+ * console.log('Found buttons:', result.elements);
667
+ *
668
+ * // Execute action on specific element
669
+ * await executeAction('submit-btn', { action: 'press' });
670
+ * };
671
+ *
672
+ * return (
673
+ * <View>
674
+ * <Text>Elements: {elements.length}</Text>
675
+ * <Button title="Press" onPress={handlePress} />
676
+ * </View>
677
+ * );
678
+ * }
679
+ * ```
680
+ */
681
+ declare function useUIBridge(): UseUIBridgeReturn;
682
+ /**
683
+ * useUIBridgeRequired hook
684
+ *
685
+ * Same as useUIBridge but throws if not available.
686
+ */
687
+ declare function useUIBridgeRequired(): UseUIBridgeReturn;
688
+
689
+ interface UseUIBridgeModalOptions {
690
+ id: string;
691
+ title?: string;
692
+ type?: NativeModalInfo['type'];
693
+ blocking?: boolean;
694
+ dismissible?: boolean;
695
+ }
696
+ /**
697
+ * Declarative hook: while mounted, registers a modal entry on the active
698
+ * stack so UI Bridge snapshots reflect that a modal is open.
699
+ */
700
+ declare function useUIBridgeModal(opts: UseUIBridgeModalOptions): void;
701
+
702
+ interface UseUIBridgeToastOptions {
703
+ id: string;
704
+ message: string;
705
+ level?: NativeCapturedToast['level'];
706
+ }
707
+ /**
708
+ * Declarative hook: while mounted, surfaces a toast via the snapshot enricher.
709
+ * Best for explicit-lifecycle toast components.
710
+ */
711
+ declare function useUIBridgeToast(opts: UseUIBridgeToastOptions): void;
712
+ interface ToastRecorderInput {
713
+ id: string;
714
+ message: string;
715
+ level?: NativeCapturedToast['level'];
716
+ }
717
+ /**
718
+ * Imperative hook: returns a `recordToast` callback for code that fires
719
+ * toasts outside React (catch blocks, library callbacks, etc.).
720
+ */
721
+ declare function useToastRecorder(): {
722
+ recordToast: (toast: ToastRecorderInput) => void;
723
+ dismissToast: (id: string) => void;
724
+ };
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 };