@qontinui/ui-bridge-native 0.1.5 → 0.2.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 (45) hide show
  1. package/dist/control/index.d.mts +9 -5
  2. package/dist/control/index.d.ts +9 -5
  3. package/dist/control/index.js +75 -12
  4. package/dist/control/index.js.map +1 -1
  5. package/dist/control/index.mjs +75 -12
  6. package/dist/control/index.mjs.map +1 -1
  7. package/dist/core/index.d.mts +3 -3
  8. package/dist/core/index.d.ts +3 -3
  9. package/dist/core/index.js +69 -1
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.mjs +69 -1
  12. package/dist/core/index.mjs.map +1 -1
  13. package/dist/debug/index.js.map +1 -1
  14. package/dist/debug/index.mjs.map +1 -1
  15. package/dist/design/index.d.mts +1 -1
  16. package/dist/design/index.d.ts +1 -1
  17. package/dist/{http-server-D7uVANBU.d.mts → http-server-DCdR8WlL.d.mts} +3 -3
  18. package/dist/{http-server-B7KudcYJ.d.ts → http-server-Dj3grQW4.d.ts} +3 -3
  19. package/dist/index.d.mts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +498 -16
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +493 -17
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/react/index.d.mts +5 -5
  26. package/dist/react/index.d.ts +5 -5
  27. package/dist/react/index.js +504 -16
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/react/index.mjs +502 -17
  30. package/dist/react/index.mjs.map +1 -1
  31. package/dist/{registry-DhbGbl9c.d.mts → registry-Cahd8Gn2.d.mts} +16 -1
  32. package/dist/{registry-B8A_EoxS.d.ts → registry-z-3WJsxp.d.ts} +16 -1
  33. package/dist/server/index.d.mts +5 -5
  34. package/dist/server/index.d.ts +5 -5
  35. package/dist/server/index.js +102 -1
  36. package/dist/server/index.js.map +1 -1
  37. package/dist/server/index.mjs +102 -1
  38. package/dist/server/index.mjs.map +1 -1
  39. package/dist/{types-Bcj7ji97.d.mts → types-DAfCeWXc.d.mts} +22 -2
  40. package/dist/{types-BPNuYxDx.d.mts → types-Oz13YLZq.d.mts} +95 -1
  41. package/dist/{types-BPNuYxDx.d.ts → types-Oz13YLZq.d.ts} +95 -1
  42. package/dist/{types-BCYWwyVy.d.ts → types-ajakyp-l.d.ts} +22 -2
  43. package/dist/{useUIBridge-CDZbWxII.d.ts → useUIBridgeToast-D32KXyL1.d.ts} +154 -5
  44. package/dist/{useUIBridge-DfIEq9EQ.d.mts → useUIBridgeToast-GmT1TzUe.d.mts} +154 -5
  45. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { W as WaitOptions, N as NativeActionRequest, d as NativeActionResponse, l as NativeFindRequest, m as NativeFindResponse, j as NativeElementState } from './types-BPNuYxDx.mjs';
1
+ import { W as WaitOptions, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse, k as NativeElementState } from './types-Oz13YLZq.mjs';
2
2
 
3
3
  /**
4
4
  * UI Bridge Native Control Types
@@ -72,6 +72,22 @@ interface WaitResult {
72
72
  /** Error message if failed */
73
73
  error?: string;
74
74
  }
75
+ /**
76
+ * Action event emitted after executeAction completes (success or failure).
77
+ */
78
+ interface NativeActionEvent {
79
+ elementId: string;
80
+ action: string;
81
+ params?: unknown;
82
+ success: boolean;
83
+ error?: string;
84
+ /** ms since epoch when the executor finished the action */
85
+ timestamp: number;
86
+ /** request id propagated from ControlActionRequest, if any */
87
+ requestId?: string;
88
+ durationMs: number;
89
+ }
90
+ type NativeActionListener = (event: NativeActionEvent) => void;
75
91
  /**
76
92
  * Native action executor interface
77
93
  */
@@ -92,6 +108,8 @@ interface NativeActionExecutor {
92
108
  * Wait for element conditions
93
109
  */
94
110
  waitForElement(elementId: string, options: WaitOptions): Promise<WaitResult>;
111
+ /** Subscribe to action events. Returns an unsubscribe function. */
112
+ onActionExecuted(listener: NativeActionListener): () => void;
95
113
  }
96
114
  /**
97
115
  * Page navigation request
@@ -132,6 +150,8 @@ interface TypeActionParams {
132
150
  delay?: number;
133
151
  /** Clear existing text first */
134
152
  clearFirst?: boolean;
153
+ /** Alias for `clearFirst` matching the runner UI Bridge convention. */
154
+ clear?: boolean;
135
155
  }
136
156
  /**
137
157
  * Scroll action params
@@ -174,4 +194,4 @@ interface PressActionParams {
174
194
  duration?: number;
175
195
  }
176
196
 
177
- export type { ActionExecutionOptions as A, ControlActionRequest as C, NativeActionExecutor as N, PressActionParams as P, ScrollActionParams as S, TypeActionParams as T, WaitResult as W, ControlActionResponse as a, ComponentActionRequest as b, ComponentActionResponse as c, SwipeActionParams as d, PageNavigationResponse as e, PageNavigateRequest as f };
197
+ export type { ActionExecutionOptions as A, ControlActionRequest as C, NativeActionExecutor as N, PressActionParams as P, ScrollActionParams as S, TypeActionParams as T, WaitResult as W, ControlActionResponse as a, ComponentActionRequest as b, ComponentActionResponse as c, SwipeActionParams as d, PageNavigationResponse as e, NativeActionListener as f, NativeActionEvent as g, PageNavigateRequest as h };
@@ -306,7 +306,101 @@ interface NativeBridgeSnapshot {
306
306
  currentRoute?: string | null;
307
307
  /** Current route segments (if a RouteProvider is configured) */
308
308
  segments?: string[];
309
+ /** Modal/sheet/drawer context (populated when a modalDetector enricher is registered) */
310
+ modalStack?: NativeSnapshotModalContext;
311
+ /** Toast/snackbar context (populated when a toastCapture enricher is registered) */
312
+ toasts?: NativeSnapshotToastContext;
313
+ /** Undo/redo context (populated when an undoTracker enricher is registered) */
314
+ undoRedo?: NativeSnapshotUndoContext;
309
315
  }
316
+ /** A single detected modal-like surface (modal, sheet, drawer, popover, alert) */
317
+ interface NativeModalInfo {
318
+ id: string;
319
+ title?: string;
320
+ type: 'modal' | 'sheet' | 'drawer' | 'popover' | 'alertdialog' | 'dialog';
321
+ /** Whether the modal blocks interaction with the underlying UI */
322
+ blocking: boolean;
323
+ /** Whether it can be dismissed by the user (backdrop tap, swipe, esc, etc.) */
324
+ dismissible: boolean;
325
+ detectedAt: number;
326
+ }
327
+ /**
328
+ * Modal context attached to a snapshot. Field names match the web SDK's
329
+ * `SnapshotModalContext` so external agents can write transport-agnostic checks
330
+ * like `snapshot.modalStack?.hasBlockingModal`.
331
+ */
332
+ interface NativeSnapshotModalContext {
333
+ modals: NativeModalInfo[];
334
+ topModal?: NativeModalInfo;
335
+ hasBlockingModal: boolean;
336
+ count: number;
337
+ }
338
+ /** A captured toast/snackbar */
339
+ interface NativeCapturedToast {
340
+ id: string;
341
+ message: string;
342
+ level: 'info' | 'success' | 'warning' | 'error' | 'loading' | 'unknown';
343
+ appearedAt: number;
344
+ dismissedAt?: number;
345
+ visible: boolean;
346
+ /** Total duration in ms (lifetime so far if still visible, total if dismissed) */
347
+ durationMs: number;
348
+ }
349
+ /** Toast context attached to a snapshot */
350
+ interface NativeSnapshotToastContext {
351
+ /** Toasts currently on screen */
352
+ active: NativeCapturedToast[];
353
+ /** Recently-dismissed toasts retained by the capture buffer (most recent first) */
354
+ recent: NativeCapturedToast[];
355
+ /** Total number of toasts ever captured by this tracker */
356
+ totalCaptured: number;
357
+ }
358
+ /**
359
+ * Undo/redo context attached to a snapshot. Mirrors the web SDK's
360
+ * `SnapshotUndoContext` minus DOM-only fields — RN has no `document.execCommand`
361
+ * or selectors, so the native variant relies entirely on developer declaration.
362
+ */
363
+ interface NativeSnapshotUndoContext {
364
+ /** Whether undo appears to be available */
365
+ canUndo: boolean;
366
+ /** Whether redo appears to be available */
367
+ canRedo: boolean;
368
+ /** Description of what undo would reverse */
369
+ undoDescription?: string;
370
+ /** Description of what redo would restore */
371
+ redoDescription?: string;
372
+ /** Undo stack depth (if known) */
373
+ undoDepth?: number;
374
+ /** Redo stack depth (if known) */
375
+ redoDepth?: number;
376
+ /** Human-readable summary for AI */
377
+ summary: string;
378
+ }
379
+ /**
380
+ * Canonical enricher slot. Each tracker exposes a `getSnapshot*Context()` method
381
+ * that the registry calls during `createSnapshot`. NavigationTracker is intentionally
382
+ * NOT here — route info already flows through `currentRoute` / `segments`.
383
+ */
384
+ interface NativeSnapshotEnrichers {
385
+ modalDetector?: {
386
+ getSnapshotModalContext(): NativeSnapshotModalContext;
387
+ };
388
+ toastCapture?: {
389
+ getSnapshotToastContext(): NativeSnapshotToastContext;
390
+ };
391
+ undoTracker?: {
392
+ getSnapshotUndoContext(): NativeSnapshotUndoContext;
393
+ };
394
+ }
395
+ /**
396
+ * Pluggable snapshot enricher: receives base context and returns extra fields
397
+ * that get `Object.assign`ed onto the snapshot. Used for ad-hoc/custom trackers
398
+ * (e.g. runner sidebar tabs) without growing the canonical enricher set.
399
+ */
400
+ type NativeSnapshotEnricher = (ctx: {
401
+ elements: RegisteredNativeElement[];
402
+ currentRoute: string | null;
403
+ }) => Record<string, unknown>;
310
404
  /**
311
405
  * UI Bridge Native feature flags
312
406
  */
@@ -380,4 +474,4 @@ interface NativeFindResponse {
380
474
  timestamp: number;
381
475
  }
382
476
 
383
- export type { ActionHandler as A, BridgeEvent as B, ComponentAction as C, DiscoveredNativeElement as D, NativeActionRequest as N, RegisteredNativeComponent as R, WaitOptions as W, BridgeEventListener as a, BridgeEventType as b, CustomAction as c, NativeActionResponse as d, NativeBridgeSnapshot as e, NativeComponentAction as f, NativeCustomAction as g, NativeElementIdentifier as h, NativeElementRef as i, NativeElementState as j, NativeElementType as k, NativeFindRequest as l, NativeFindResponse as m, NativeLayout as n, NativeStandardAction as o, NativeUIBridgeConfig as p, NativeUIBridgeFeatures as q, RegisteredNativeElement as r, Workflow as s, WorkflowStep as t, WorkflowStepType as u };
477
+ export type { ActionHandler as A, BridgeEvent as B, ComponentAction as C, DiscoveredNativeElement as D, WorkflowStep as E, WorkflowStepType as F, NativeActionRequest as N, RegisteredNativeComponent as R, WaitOptions as W, BridgeEventListener as a, BridgeEventType as b, CustomAction as c, NativeActionResponse as d, NativeBridgeSnapshot as e, NativeCapturedToast as f, NativeComponentAction as g, NativeCustomAction as h, NativeElementIdentifier as i, NativeElementRef as j, NativeElementState as k, NativeElementType as l, NativeFindRequest as m, NativeFindResponse as n, NativeLayout as o, NativeModalInfo as p, NativeSnapshotEnricher as q, NativeSnapshotEnrichers as r, NativeSnapshotModalContext as s, NativeSnapshotToastContext as t, NativeSnapshotUndoContext as u, NativeStandardAction as v, NativeUIBridgeConfig as w, NativeUIBridgeFeatures as x, RegisteredNativeElement as y, Workflow as z };
@@ -306,7 +306,101 @@ interface NativeBridgeSnapshot {
306
306
  currentRoute?: string | null;
307
307
  /** Current route segments (if a RouteProvider is configured) */
308
308
  segments?: string[];
309
+ /** Modal/sheet/drawer context (populated when a modalDetector enricher is registered) */
310
+ modalStack?: NativeSnapshotModalContext;
311
+ /** Toast/snackbar context (populated when a toastCapture enricher is registered) */
312
+ toasts?: NativeSnapshotToastContext;
313
+ /** Undo/redo context (populated when an undoTracker enricher is registered) */
314
+ undoRedo?: NativeSnapshotUndoContext;
309
315
  }
316
+ /** A single detected modal-like surface (modal, sheet, drawer, popover, alert) */
317
+ interface NativeModalInfo {
318
+ id: string;
319
+ title?: string;
320
+ type: 'modal' | 'sheet' | 'drawer' | 'popover' | 'alertdialog' | 'dialog';
321
+ /** Whether the modal blocks interaction with the underlying UI */
322
+ blocking: boolean;
323
+ /** Whether it can be dismissed by the user (backdrop tap, swipe, esc, etc.) */
324
+ dismissible: boolean;
325
+ detectedAt: number;
326
+ }
327
+ /**
328
+ * Modal context attached to a snapshot. Field names match the web SDK's
329
+ * `SnapshotModalContext` so external agents can write transport-agnostic checks
330
+ * like `snapshot.modalStack?.hasBlockingModal`.
331
+ */
332
+ interface NativeSnapshotModalContext {
333
+ modals: NativeModalInfo[];
334
+ topModal?: NativeModalInfo;
335
+ hasBlockingModal: boolean;
336
+ count: number;
337
+ }
338
+ /** A captured toast/snackbar */
339
+ interface NativeCapturedToast {
340
+ id: string;
341
+ message: string;
342
+ level: 'info' | 'success' | 'warning' | 'error' | 'loading' | 'unknown';
343
+ appearedAt: number;
344
+ dismissedAt?: number;
345
+ visible: boolean;
346
+ /** Total duration in ms (lifetime so far if still visible, total if dismissed) */
347
+ durationMs: number;
348
+ }
349
+ /** Toast context attached to a snapshot */
350
+ interface NativeSnapshotToastContext {
351
+ /** Toasts currently on screen */
352
+ active: NativeCapturedToast[];
353
+ /** Recently-dismissed toasts retained by the capture buffer (most recent first) */
354
+ recent: NativeCapturedToast[];
355
+ /** Total number of toasts ever captured by this tracker */
356
+ totalCaptured: number;
357
+ }
358
+ /**
359
+ * Undo/redo context attached to a snapshot. Mirrors the web SDK's
360
+ * `SnapshotUndoContext` minus DOM-only fields — RN has no `document.execCommand`
361
+ * or selectors, so the native variant relies entirely on developer declaration.
362
+ */
363
+ interface NativeSnapshotUndoContext {
364
+ /** Whether undo appears to be available */
365
+ canUndo: boolean;
366
+ /** Whether redo appears to be available */
367
+ canRedo: boolean;
368
+ /** Description of what undo would reverse */
369
+ undoDescription?: string;
370
+ /** Description of what redo would restore */
371
+ redoDescription?: string;
372
+ /** Undo stack depth (if known) */
373
+ undoDepth?: number;
374
+ /** Redo stack depth (if known) */
375
+ redoDepth?: number;
376
+ /** Human-readable summary for AI */
377
+ summary: string;
378
+ }
379
+ /**
380
+ * Canonical enricher slot. Each tracker exposes a `getSnapshot*Context()` method
381
+ * that the registry calls during `createSnapshot`. NavigationTracker is intentionally
382
+ * NOT here — route info already flows through `currentRoute` / `segments`.
383
+ */
384
+ interface NativeSnapshotEnrichers {
385
+ modalDetector?: {
386
+ getSnapshotModalContext(): NativeSnapshotModalContext;
387
+ };
388
+ toastCapture?: {
389
+ getSnapshotToastContext(): NativeSnapshotToastContext;
390
+ };
391
+ undoTracker?: {
392
+ getSnapshotUndoContext(): NativeSnapshotUndoContext;
393
+ };
394
+ }
395
+ /**
396
+ * Pluggable snapshot enricher: receives base context and returns extra fields
397
+ * that get `Object.assign`ed onto the snapshot. Used for ad-hoc/custom trackers
398
+ * (e.g. runner sidebar tabs) without growing the canonical enricher set.
399
+ */
400
+ type NativeSnapshotEnricher = (ctx: {
401
+ elements: RegisteredNativeElement[];
402
+ currentRoute: string | null;
403
+ }) => Record<string, unknown>;
310
404
  /**
311
405
  * UI Bridge Native feature flags
312
406
  */
@@ -380,4 +474,4 @@ interface NativeFindResponse {
380
474
  timestamp: number;
381
475
  }
382
476
 
383
- export type { ActionHandler as A, BridgeEvent as B, ComponentAction as C, DiscoveredNativeElement as D, NativeActionRequest as N, RegisteredNativeComponent as R, WaitOptions as W, BridgeEventListener as a, BridgeEventType as b, CustomAction as c, NativeActionResponse as d, NativeBridgeSnapshot as e, NativeComponentAction as f, NativeCustomAction as g, NativeElementIdentifier as h, NativeElementRef as i, NativeElementState as j, NativeElementType as k, NativeFindRequest as l, NativeFindResponse as m, NativeLayout as n, NativeStandardAction as o, NativeUIBridgeConfig as p, NativeUIBridgeFeatures as q, RegisteredNativeElement as r, Workflow as s, WorkflowStep as t, WorkflowStepType as u };
477
+ export type { ActionHandler as A, BridgeEvent as B, ComponentAction as C, DiscoveredNativeElement as D, WorkflowStep as E, WorkflowStepType as F, NativeActionRequest as N, RegisteredNativeComponent as R, WaitOptions as W, BridgeEventListener as a, BridgeEventType as b, CustomAction as c, NativeActionResponse as d, NativeBridgeSnapshot as e, NativeCapturedToast as f, NativeComponentAction as g, NativeCustomAction as h, NativeElementIdentifier as i, NativeElementRef as j, NativeElementState as k, NativeElementType as l, NativeFindRequest as m, NativeFindResponse as n, NativeLayout as o, NativeModalInfo as p, NativeSnapshotEnricher as q, NativeSnapshotEnrichers as r, NativeSnapshotModalContext as s, NativeSnapshotToastContext as t, NativeSnapshotUndoContext as u, NativeStandardAction as v, NativeUIBridgeConfig as w, NativeUIBridgeFeatures as x, RegisteredNativeElement as y, Workflow as z };
@@ -1,4 +1,4 @@
1
- import { W as WaitOptions, N as NativeActionRequest, d as NativeActionResponse, l as NativeFindRequest, m as NativeFindResponse, j as NativeElementState } from './types-BPNuYxDx.js';
1
+ import { W as WaitOptions, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse, k as NativeElementState } from './types-Oz13YLZq.js';
2
2
 
3
3
  /**
4
4
  * UI Bridge Native Control Types
@@ -72,6 +72,22 @@ interface WaitResult {
72
72
  /** Error message if failed */
73
73
  error?: string;
74
74
  }
75
+ /**
76
+ * Action event emitted after executeAction completes (success or failure).
77
+ */
78
+ interface NativeActionEvent {
79
+ elementId: string;
80
+ action: string;
81
+ params?: unknown;
82
+ success: boolean;
83
+ error?: string;
84
+ /** ms since epoch when the executor finished the action */
85
+ timestamp: number;
86
+ /** request id propagated from ControlActionRequest, if any */
87
+ requestId?: string;
88
+ durationMs: number;
89
+ }
90
+ type NativeActionListener = (event: NativeActionEvent) => void;
75
91
  /**
76
92
  * Native action executor interface
77
93
  */
@@ -92,6 +108,8 @@ interface NativeActionExecutor {
92
108
  * Wait for element conditions
93
109
  */
94
110
  waitForElement(elementId: string, options: WaitOptions): Promise<WaitResult>;
111
+ /** Subscribe to action events. Returns an unsubscribe function. */
112
+ onActionExecuted(listener: NativeActionListener): () => void;
95
113
  }
96
114
  /**
97
115
  * Page navigation request
@@ -132,6 +150,8 @@ interface TypeActionParams {
132
150
  delay?: number;
133
151
  /** Clear existing text first */
134
152
  clearFirst?: boolean;
153
+ /** Alias for `clearFirst` matching the runner UI Bridge convention. */
154
+ clear?: boolean;
135
155
  }
136
156
  /**
137
157
  * Scroll action params
@@ -174,4 +194,4 @@ interface PressActionParams {
174
194
  duration?: number;
175
195
  }
176
196
 
177
- export type { ActionExecutionOptions as A, ControlActionRequest as C, NativeActionExecutor as N, PressActionParams as P, ScrollActionParams as S, TypeActionParams as T, WaitResult as W, ControlActionResponse as a, ComponentActionRequest as b, ComponentActionResponse as c, SwipeActionParams as d, PageNavigationResponse as e, PageNavigateRequest as f };
197
+ export type { ActionExecutionOptions as A, ControlActionRequest as C, NativeActionExecutor as N, PressActionParams as P, ScrollActionParams as S, TypeActionParams as T, WaitResult as W, ControlActionResponse as a, ComponentActionRequest as b, ComponentActionResponse as c, SwipeActionParams as d, PageNavigationResponse as e, NativeActionListener as f, NativeActionEvent as g, PageNavigateRequest as h };
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1 from 'react';
3
- import { q as NativeUIBridgeFeatures, p as NativeUIBridgeConfig, r as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, k as NativeElementType, o as NativeStandardAction, g as NativeCustomAction, j as NativeElementState, i as NativeElementRef, h as NativeElementIdentifier, s as Workflow, N as NativeActionRequest, d as NativeActionResponse, l as NativeFindRequest, m as NativeFindResponse } from './types-BPNuYxDx.js';
4
- import { a as NativeUIBridgeRegistry } from './registry-B8A_EoxS.js';
5
- import { N as NativeActionExecutor } from './types-BCYWwyVy.js';
6
- import { i as NativeUIBridgeServer, m as ServerAdapter, l as RouteProvider } from './http-server-B7KudcYJ.js';
3
+ import { p as NativeModalInfo, s as NativeSnapshotModalContext, f as NativeCapturedToast, t as NativeSnapshotToastContext, u as NativeSnapshotUndoContext, x as NativeUIBridgeFeatures, w as NativeUIBridgeConfig, y as RegisteredNativeElement, R as RegisteredNativeComponent, e as NativeBridgeSnapshot, b as BridgeEventType, a as BridgeEventListener, l as NativeElementType, v as NativeStandardAction, h as NativeCustomAction, k as NativeElementState, j as NativeElementRef, i as NativeElementIdentifier, z as Workflow, N as NativeActionRequest, d as NativeActionResponse, m as NativeFindRequest, n as NativeFindResponse } from './types-Oz13YLZq.js';
4
+ import { a as NativeUIBridgeRegistry } from './registry-z-3WJsxp.js';
5
+ import { N as NativeActionExecutor } from './types-ajakyp-l.js';
6
+ import { i as NativeUIBridgeServer, m as ServerAdapter, l as RouteProvider } from './http-server-Dj3grQW4.js';
7
7
 
8
8
  /**
9
9
  * Cloud Relay Client — WebSocket tunnel from mobile device to backend
@@ -56,6 +56,112 @@ declare class CloudRelayClient {
56
56
  private scheduleReconnect;
57
57
  }
58
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
+ dismissModal(id: string): void;
76
+ getSnapshotModalContext(): NativeSnapshotModalContext;
77
+ getActive(): NativeModalInfo[];
78
+ clear(): void;
79
+ }
80
+
81
+ interface ToastRecordInput {
82
+ id: string;
83
+ message: string;
84
+ level?: NativeCapturedToast['level'];
85
+ appearedAt?: number;
86
+ }
87
+ interface ToastCaptureConfig {
88
+ maxRecent?: number;
89
+ }
90
+ /**
91
+ * Declarative toast/snackbar tracker. Components call recordToast/dismissToast
92
+ * directly — there is no DOM/tree scanner. The active map plus a fixed-size
93
+ * recent ring buffer feed the snapshot's toasts context.
94
+ */
95
+ declare class ToastCapture {
96
+ private active;
97
+ private recent;
98
+ private totalCaptured;
99
+ private maxRecent;
100
+ constructor(config?: ToastCaptureConfig);
101
+ recordToast(toast: ToastRecordInput): void;
102
+ dismissToast(id: string): void;
103
+ getSnapshotToastContext(): NativeSnapshotToastContext;
104
+ clear(): void;
105
+ }
106
+
107
+ /**
108
+ * A single bridge action recorded for undo correlation. Action-correlation
109
+ * only — RN has no DOM/execCommand probe, so we rely on developer
110
+ * declaration plus this rolling history of recent actions.
111
+ */
112
+ interface ActionRecord {
113
+ id: string;
114
+ type: string;
115
+ targetId?: string;
116
+ description?: string;
117
+ timestamp: number;
118
+ /** Default true — set false for actions that aren't reversible (e.g. navigation, network calls) */
119
+ reversible?: boolean;
120
+ }
121
+ /**
122
+ * Developer-declared undo/redo state. When set, this is authoritative and
123
+ * overrides any heuristic inference from action history.
124
+ */
125
+ interface DeclaredUndoState {
126
+ canUndo: boolean;
127
+ canRedo: boolean;
128
+ undoDescription?: string;
129
+ redoDescription?: string;
130
+ undoDepth?: number;
131
+ redoDepth?: number;
132
+ }
133
+ interface UndoTrackerConfig {
134
+ maxHistory?: number;
135
+ }
136
+ /**
137
+ * Action-correlation undo tracker for React Native.
138
+ *
139
+ * Maintains a rolling buffer of recent actions and a developer-declared
140
+ * undo state slot. The declared state is authoritative when set; otherwise
141
+ * we infer `canUndo` from whether any reversible action has been recorded.
142
+ * `executeUndo`/`executeRedo` are placeholders pending an IPC path through
143
+ * ui-bridge-native to the runner's `/control/undo`.
144
+ */
145
+ declare class UndoTracker {
146
+ private readonly maxHistory;
147
+ private actions;
148
+ private declaredState;
149
+ constructor(config?: UndoTrackerConfig);
150
+ recordAction(record: ActionRecord): void;
151
+ setDeclaredState(state: DeclaredUndoState): void;
152
+ getActionHistory(): ActionRecord[];
153
+ getSnapshotUndoContext(): NativeSnapshotUndoContext;
154
+ executeUndo(): {
155
+ ok: boolean;
156
+ reason?: string;
157
+ };
158
+ executeRedo(): {
159
+ ok: boolean;
160
+ reason?: string;
161
+ };
162
+ clear(): void;
163
+ }
164
+
59
165
  /**
60
166
  * UI Bridge Native context value
61
167
  */
@@ -68,6 +174,12 @@ interface UIBridgeNativeContextValue {
68
174
  registry: NativeUIBridgeRegistry;
69
175
  /** Action executor */
70
176
  executor: NativeActionExecutor;
177
+ /** Modal stack tracker (declarative pushModal/dismissModal) */
178
+ modalDetector: ModalDetector;
179
+ /** Toast/snackbar tracker (declarative recordToast/dismissToast) */
180
+ toastCapture: ToastCapture;
181
+ /** Undo/redo action-correlation tracker */
182
+ undoTracker: UndoTracker;
71
183
  /** Get all registered elements */
72
184
  getElements: () => RegisteredNativeElement[];
73
185
  /** Get all registered components */
@@ -568,4 +680,41 @@ declare function useUIBridge(): UseUIBridgeReturn;
568
680
  */
569
681
  declare function useUIBridgeRequired(): UseUIBridgeReturn;
570
682
 
571
- export { CloudRelayClient as C, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, UIBridgeNativeProvider as e, type UIBridgeNativeProviderProps as f, type UIBridgeProps as g, type UseUIBridgeReturn as h, type UseUIComponentOptions as i, type UseUIComponentReturn as j, type UseUIElementOptions as k, type UseUIElementReturn as l, type UseUIElementWithPropsReturn as m, useUIBridgeNative as n, useUIBridgeNativeOptional as o, useUIBridgeNativeRequired as p, useUIBridgeRequired as q, useUIComponent as r, useUIComponentAction as s, useUIElement as t, useUIBridge as u, useUIElementWithProps as v };
683
+ interface UseUIBridgeModalOptions {
684
+ id: string;
685
+ title?: string;
686
+ type?: NativeModalInfo['type'];
687
+ blocking?: boolean;
688
+ dismissible?: boolean;
689
+ }
690
+ /**
691
+ * Declarative hook: while mounted, registers a modal entry on the active
692
+ * stack so UI Bridge snapshots reflect that a modal is open.
693
+ */
694
+ declare function useUIBridgeModal(opts: UseUIBridgeModalOptions): void;
695
+
696
+ interface UseUIBridgeToastOptions {
697
+ id: string;
698
+ message: string;
699
+ level?: NativeCapturedToast['level'];
700
+ }
701
+ /**
702
+ * Declarative hook: while mounted, surfaces a toast via the snapshot enricher.
703
+ * Best for explicit-lifecycle toast components.
704
+ */
705
+ declare function useUIBridgeToast(opts: UseUIBridgeToastOptions): void;
706
+ interface ToastRecorderInput {
707
+ id: string;
708
+ message: string;
709
+ level?: NativeCapturedToast['level'];
710
+ }
711
+ /**
712
+ * Imperative hook: returns a `recordToast` callback for code that fires
713
+ * toasts outside React (catch blocks, library callbacks, etc.).
714
+ */
715
+ declare function useToastRecorder(): {
716
+ recordToast: (toast: ToastRecorderInput) => void;
717
+ dismissToast: (id: string) => void;
718
+ };
719
+
720
+ export { type ActionRecord as A, useUIBridgeNativeRequired as B, CloudRelayClient as C, type DeclaredUndoState as D, useUIBridgeRequired as E, useUIBridgeToast as F, useUIComponent as G, useUIComponentAction as H, useUIElement as I, useUIElementWithProps as J, ModalDetector as M, ToastCapture as T, type UIBridgeNativeContextValue as U, type CloudRelayConfig as a, type ComponentActionDef as b, type ComponentActionRequest as c, type ComponentActionResponse as d, type ModalPushInput as e, type ToastCaptureConfig as f, type ToastRecordInput as g, type ToastRecorderInput as h, UIBridgeNativeProvider as i, type UIBridgeNativeProviderProps as j, type UIBridgeProps as k, UndoTracker as l, type UndoTrackerConfig as m, type UseUIBridgeModalOptions as n, type UseUIBridgeReturn as o, type UseUIBridgeToastOptions as p, type UseUIComponentOptions as q, type UseUIComponentReturn as r, type UseUIElementOptions as s, type UseUIElementReturn as t, type UseUIElementWithPropsReturn as u, useToastRecorder as v, useUIBridge as w, useUIBridgeModal as x, useUIBridgeNative as y, useUIBridgeNativeOptional as z };