@qontinui/ui-bridge-native 0.3.2 → 0.5.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 (112) 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 +60 -4
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +61 -5
  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 +163 -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 +60 -4
  46. package/dist/react/index.js.map +1 -1
  47. package/dist/react/index.mjs +61 -5
  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 +269 -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/index.js +51 -1
  70. package/dist/server/index.js.map +1 -1
  71. package/dist/server/index.mjs +51 -1
  72. package/dist/server/index.mjs.map +1 -1
  73. package/dist/server/observability.d.ts +55 -0
  74. package/dist/server/observability.d.ts.map +1 -0
  75. package/dist/server/types.d.ts +377 -0
  76. package/dist/server/types.d.ts.map +1 -0
  77. package/dist/server/ws-connection.d.ts +48 -0
  78. package/dist/server/ws-connection.d.ts.map +1 -0
  79. package/dist/server/ws-event-bridge.d.ts +113 -0
  80. package/dist/server/ws-event-bridge.d.ts.map +1 -0
  81. package/dist/server/ws-protocol.d.ts +48 -0
  82. package/dist/server/ws-protocol.d.ts.map +1 -0
  83. package/dist/server/ws-types.d.ts +65 -0
  84. package/dist/server/ws-types.d.ts.map +1 -0
  85. package/dist/toast/index.d.ts +2 -0
  86. package/dist/toast/index.d.ts.map +1 -0
  87. package/dist/toast/toast-capture.d.ts +27 -0
  88. package/dist/toast/toast-capture.d.ts.map +1 -0
  89. package/dist/transport/CloudRelayClient.d.ts +51 -0
  90. package/dist/transport/CloudRelayClient.d.ts.map +1 -0
  91. package/dist/transport/DeviceAnnouncer.d.ts +75 -0
  92. package/dist/transport/DeviceAnnouncer.d.ts.map +1 -0
  93. package/dist/transport/index.d.ts +3 -0
  94. package/dist/transport/index.d.ts.map +1 -0
  95. package/dist/transport/logger.d.ts +23 -0
  96. package/dist/transport/logger.d.ts.map +1 -0
  97. package/dist/undo/index.d.ts +3 -0
  98. package/dist/undo/index.d.ts.map +1 -0
  99. package/dist/undo/undo-tracker.d.ts +59 -0
  100. package/dist/undo/undo-tracker.d.ts.map +1 -0
  101. package/package.json +3 -3
  102. package/dist/StateAnnotation--zm0Jfqj.d.ts +0 -755
  103. package/dist/StateAnnotation-BgFoVWFy.d.mts +0 -755
  104. package/dist/core/index.d.mts +0 -46
  105. package/dist/design-types-BHr6Q1FX.d.ts +0 -205
  106. package/dist/http-server--550eD1F.d.mts +0 -805
  107. package/dist/http-server-C9NaNBEP.d.ts +0 -805
  108. package/dist/index.d.mts +0 -89
  109. package/dist/registry-B5JadBN9.d.mts +0 -300
  110. package/dist/server/index.d.mts +0 -178
  111. package/dist/types-B0XA4vOF.d.mts +0 -197
  112. package/dist/types-CGVut7mc.d.ts +0 -567
@@ -0,0 +1,2 @@
1
+ export { ModalDetector } from './modal-detector';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { NativeModalInfo, NativeSnapshotModalContext } from '../core/types';
2
+ export interface ModalPushInput {
3
+ id: string;
4
+ title?: string;
5
+ type?: NativeModalInfo['type'];
6
+ blocking?: boolean;
7
+ dismissible?: boolean;
8
+ }
9
+ /**
10
+ * Declarative modal store. Components/hooks call pushModal/dismissModal directly
11
+ * — there is no DOM/tree scanner. The detector is the single source of truth for
12
+ * the snapshot's modalStack context.
13
+ */
14
+ export declare class ModalDetector {
15
+ /** Map preserves O(1) idempotent replace by id; ordering comes from detectedAt. */
16
+ private modals;
17
+ pushModal(modal: ModalPushInput): void;
18
+ /**
19
+ * Remove a modal from the stack. Returns `true` if a modal with that id
20
+ * was actually deleted, `false` if nothing matched (idempotent so repeated
21
+ * calls don't throw, but callers — e.g. the HTTP test-hook endpoint — can
22
+ * surface the miss to clients).
23
+ */
24
+ dismissModal(id: string): boolean;
25
+ getSnapshotModalContext(): NativeSnapshotModalContext;
26
+ getActive(): NativeModalInfo[];
27
+ clear(): void;
28
+ }
29
+ //# sourceMappingURL=modal-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal-detector.d.ts","sourceRoot":"","sources":["../../src/modal/modal-detector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAEjF,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,aAAa;IACxB,mFAAmF;IACnF,OAAO,CAAC,MAAM,CAAsC;IAEpD,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IActC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIjC,uBAAuB,IAAI,0BAA0B;IAarD,SAAS,IAAI,eAAe,EAAE;IAI9B,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,30 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export interface StateAnnotationRequiredElement {
3
+ role?: string;
4
+ text?: string;
5
+ testID?: string;
6
+ [key: string]: unknown;
7
+ }
8
+ export interface StateProps {
9
+ id: string;
10
+ name?: string;
11
+ description?: string;
12
+ requiredElements?: StateAnnotationRequiredElement[];
13
+ blocking?: boolean;
14
+ children?: ReactNode;
15
+ [key: string]: unknown;
16
+ }
17
+ export declare function State(props: StateProps): ReactElement;
18
+ export interface TransitionToProps {
19
+ id: string;
20
+ name?: string;
21
+ fromStates?: string[];
22
+ activateStates?: string[];
23
+ exitStates?: string[];
24
+ effect?: string;
25
+ description?: string;
26
+ children?: ReactNode;
27
+ [key: string]: unknown;
28
+ }
29
+ export declare function TransitionTo(props: TransitionToProps): ReactElement;
30
+ //# sourceMappingURL=StateAnnotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StateAnnotation.d.ts","sourceRoot":"","sources":["../../src/react/StateAnnotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,8BAA8B;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,8BAA8B,EAAE,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAErD;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAEnE"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * UI Bridge Native Provider
3
+ *
4
+ * React context provider for UI Bridge Native functionality.
5
+ */
6
+ import React from 'react';
7
+ import type { NativeUIBridgeFeatures, NativeUIBridgeConfig, RegisteredNativeElement, RegisteredNativeComponent, NativeBridgeSnapshot, BridgeEventType, BridgeEventListener } from '../core/types';
8
+ import { NativeUIBridgeRegistry } from '../core/registry';
9
+ import type { NativeActionExecutor } from '../control/types';
10
+ import { type ServerAdapter } from '../server/http-server';
11
+ import type { RouteProvider, KeepAwakeProvider } from '../server/types';
12
+ import { type CloudRelayConfig } from '../transport/CloudRelayClient';
13
+ import { ModalDetector } from '../modal/modal-detector';
14
+ import { ToastCapture } from '../toast/toast-capture';
15
+ import { UndoTracker } from '../undo/undo-tracker';
16
+ /**
17
+ * UI Bridge Native context value
18
+ */
19
+ export interface UIBridgeNativeContextValue {
20
+ /** Feature flags */
21
+ features: NativeUIBridgeFeatures;
22
+ /** Configuration */
23
+ config: NativeUIBridgeConfig;
24
+ /** Element registry */
25
+ registry: NativeUIBridgeRegistry;
26
+ /** Action executor */
27
+ executor: NativeActionExecutor;
28
+ /** Modal stack tracker (declarative pushModal/dismissModal) */
29
+ modalDetector: ModalDetector;
30
+ /** Toast/snackbar tracker (declarative recordToast/dismissToast) */
31
+ toastCapture: ToastCapture;
32
+ /** Undo/redo action-correlation tracker */
33
+ undoTracker: UndoTracker;
34
+ /** Get all registered elements */
35
+ getElements: () => RegisteredNativeElement[];
36
+ /** Get all registered components */
37
+ getComponents: () => RegisteredNativeComponent[];
38
+ /** Create a snapshot */
39
+ createSnapshot: () => NativeBridgeSnapshot;
40
+ /** Subscribe to events */
41
+ on: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => () => void;
42
+ /** Unsubscribe from events */
43
+ off: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => void;
44
+ /** Whether the provider is initialized */
45
+ initialized: boolean;
46
+ /** Server running status */
47
+ serverRunning: boolean;
48
+ /** Start the HTTP server */
49
+ startServer: () => Promise<void>;
50
+ /** Stop the HTTP server */
51
+ stopServer: () => void;
52
+ /** Get the current navigation route (if a RouteProvider is configured) */
53
+ getCurrentRoute: () => string | null;
54
+ }
55
+ /**
56
+ * UI Bridge Native provider props
57
+ */
58
+ export interface UIBridgeNativeProviderProps {
59
+ /** Child components */
60
+ children: React.ReactNode;
61
+ /** Feature flags */
62
+ features?: NativeUIBridgeFeatures;
63
+ /** Configuration */
64
+ config?: NativeUIBridgeConfig;
65
+ /** Event handler */
66
+ onEvent?: BridgeEventListener;
67
+ /**
68
+ * A ServerAdapter instance for the HTTP server.
69
+ * The app is responsible for creating this using its preferred native TCP/HTTP library.
70
+ * @see ServerAdapter interface in server/http-server.ts
71
+ */
72
+ serverAdapter?: ServerAdapter;
73
+ /**
74
+ * Navigation provider for programmatic route navigation via UI Bridge.
75
+ * Pass Expo Router's push/back functions to enable `control/page/navigate`.
76
+ */
77
+ navigationProvider?: {
78
+ navigate: (url: string) => void;
79
+ back?: () => void;
80
+ };
81
+ /**
82
+ * Screenshot provider for native screen capture via UI Bridge.
83
+ * Pass a function that captures the current screen as base64 PNG.
84
+ */
85
+ screenshotProvider?: {
86
+ capture: () => Promise<{
87
+ base64: string;
88
+ width: number;
89
+ height: number;
90
+ }>;
91
+ };
92
+ /**
93
+ * Keep-awake provider for native screen-wake control via UI Bridge.
94
+ * Pass expo-keep-awake's activateKeepAwakeAsync/deactivateKeepAwake (wrapped
95
+ * to the request/release shape) so an external runner never loses the device
96
+ * to a screen lock. The SDK never imports expo-keep-awake directly.
97
+ */
98
+ keepAwakeProvider?: KeepAwakeProvider;
99
+ /**
100
+ * Route provider for exposing the current navigation route in snapshots.
101
+ * Wire this to Expo Router's `usePathname()` / `useSegments()` via a module-level ref.
102
+ */
103
+ routeProvider?: RouteProvider;
104
+ /**
105
+ * Configuration for the cloud relay tunnel (enables remote device verification
106
+ * when USB/LAN are not available). Omit `uiBridgeServer` — the provider wires
107
+ * that automatically after the server starts.
108
+ */
109
+ cloudRelayConfig?: Omit<CloudRelayConfig, 'uiBridgeServer'>;
110
+ /**
111
+ * Enable mDNS advertisement so that runners on the same LAN can discover this
112
+ * device automatically (requires react-native-zeroconf).
113
+ */
114
+ enableMdnsAnnounce?: boolean;
115
+ /**
116
+ * Stable device identifier used for mDNS TXT records and cloud relay
117
+ * registration. Typically sourced from expo-device or a UUID stored in
118
+ * AsyncStorage.
119
+ */
120
+ deviceId?: string;
121
+ }
122
+ /**
123
+ * UI Bridge Native Provider
124
+ *
125
+ * Provides UI Bridge Native context to child components.
126
+ *
127
+ * @example
128
+ * ```tsx
129
+ * // app/_layout.tsx
130
+ * import { UIBridgeNativeProvider } from 'ui-bridge-native';
131
+ *
132
+ * export default function RootLayout() {
133
+ * return (
134
+ * <UIBridgeNativeProvider
135
+ * features={{ server: __DEV__, debug: __DEV__ }}
136
+ * config={{ serverPort: 8087 }}
137
+ * >
138
+ * <Stack>{children}</Stack>
139
+ * </UIBridgeNativeProvider>
140
+ * );
141
+ * }
142
+ * ```
143
+ */
144
+ export declare function UIBridgeNativeProvider({ children, features, config, onEvent, serverAdapter, navigationProvider, screenshotProvider, keepAwakeProvider, routeProvider, cloudRelayConfig, enableMdnsAnnounce, deviceId, }: UIBridgeNativeProviderProps): import("react/jsx-runtime").JSX.Element;
145
+ /**
146
+ * useUIBridgeNative hook
147
+ *
148
+ * Access the UI Bridge Native context. Throws if used outside provider.
149
+ */
150
+ export declare function useUIBridgeNative(): UIBridgeNativeContextValue;
151
+ /**
152
+ * useUIBridgeNativeOptional hook
153
+ *
154
+ * Access the UI Bridge Native context, returning null if outside provider.
155
+ */
156
+ export declare function useUIBridgeNativeOptional(): UIBridgeNativeContextValue | null;
157
+ /**
158
+ * useUIBridgeNativeRequired hook
159
+ *
160
+ * Alias for useUIBridgeNative (throws if outside provider).
161
+ */
162
+ export declare const useUIBridgeNativeRequired: typeof useUIBridgeNative;
163
+ //# sourceMappingURL=UIBridgeNativeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIBridgeNativeProvider.d.ts","sourceRoot":"","sources":["../../src/react/UIBridgeNativeProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAA0C,MAAM,kBAAkB,CAAC;AAElG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MA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;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAa,EACb,MAAW,EACX,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,QAAQ,GACT,EAAE,2BAA2B,2CA4X7B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,0BAA0B,GAAG,IAAI,CAE7E;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0BAAoB,CAAC"}
@@ -1,72 +1,17 @@
1
- export { b as ComponentActionDef, c as ComponentActionRequest, d as ComponentActionResponse, S as State, f as StateAnnotationRequiredElement, g as StateProps, j as ToastRecorderInput, k as TransitionTo, l as TransitionToProps, U as UIBridgeNativeContextValue, m as UIBridgeNativeProvider, n as UIBridgeNativeProviderProps, o as UIBridgeProps, 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--zm0Jfqj.js';
2
- import { j as NativeElementRef } from '../types-CGVut7mc.js';
3
- import { b as RegisterElementOptions } from '../registry-pAUpQq2O.js';
4
- import 'react/jsx-runtime';
5
- import 'react';
6
- import '../types-CjEKTDYT.js';
7
- import '../http-server-C9NaNBEP.js';
8
- import '../design-types-BHr6Q1FX.js';
9
-
10
1
  /**
11
- * useAutoRegister Hook for React Native
2
+ * UI Bridge Native - React
12
3
  *
13
- * Enables automatic registration of interactive React Native components.
14
- * Unlike the web version, this doesn't use MutationObserver (no DOM).
15
- * Instead, it provides a simple API for components to register themselves.
16
- *
17
- * For comprehensive coverage in React Native, components should:
18
- * 1. Use this hook at the app root to enable the registry
19
- * 2. Use useUIElement on interactive components (or wrap with Pressable/TouchableOpacity)
20
- */
21
-
22
- /**
23
- * Options for auto-registration in React Native
24
- */
25
- interface NativeAutoRegisterOptions {
26
- /** Enable auto-registration (default: true in dev mode) */
27
- enabled?: boolean;
28
- /** Callback when element is registered */
29
- onRegister?: (id: string) => void;
30
- /** Callback when element is unregistered */
31
- onUnregister?: (id: string) => void;
32
- }
33
- /**
34
- * Handle returned by useAutoRegister for programmatic registration
35
- */
36
- interface NativeAutoRegisterHandle {
37
- /** Register an element programmatically */
38
- register: (id: string, ref: React.RefObject<NativeElementRef>, options?: RegisterElementOptions) => void;
39
- /** Unregister an element programmatically */
40
- unregister: (id: string) => void;
41
- /** Check if auto-registration is enabled */
42
- isEnabled: boolean;
43
- }
44
- /**
45
- * Hook for enabling automatic element registration in React Native.
46
- *
47
- * Since React Native doesn't have a DOM to observe, this hook provides
48
- * a handle for programmatic registration. For most use cases, you should
49
- * use useUIElement directly on interactive components.
50
- *
51
- * @example
52
- * ```tsx
53
- * function App() {
54
- * const autoRegister = useAutoRegister({ enabled: __DEV__ });
55
- *
56
- * // Programmatic registration (rare use case)
57
- * useEffect(() => {
58
- * autoRegister.register('custom-element', {
59
- * type: 'button',
60
- * label: 'Custom Button',
61
- * });
62
- *
63
- * return () => autoRegister.unregister('custom-element');
64
- * }, []);
65
- *
66
- * return <YourApp />;
67
- * }
68
- * ```
4
+ * React hooks and provider for React Native.
69
5
  */
70
- declare function useAutoRegister(options?: NativeAutoRegisterOptions): NativeAutoRegisterHandle;
71
-
72
- export { type NativeAutoRegisterHandle, type NativeAutoRegisterOptions, useAutoRegister };
6
+ export * from './UIBridgeNativeProvider';
7
+ export * from './useUIElement';
8
+ export * from './useUIComponent';
9
+ export * from './useUIBridge';
10
+ export * from './useAutoRegister';
11
+ export { useUIBridgeModal } from './useUIBridgeModal';
12
+ export type { UseUIBridgeModalOptions } from './useUIBridgeModal';
13
+ export { useUIBridgeToast, useToastRecorder } from './useUIBridgeToast';
14
+ export type { UseUIBridgeToastOptions, ToastRecorderInput } from './useUIBridgeToast';
15
+ export { State, TransitionTo } from './StateAnnotation';
16
+ export type { StateProps, TransitionToProps, StateAnnotationRequiredElement } from './StateAnnotation';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -2168,6 +2168,14 @@ function createServerHandlers(registry, executor, config) {
2168
2168
  "NOT_SUPPORTED"
2169
2169
  );
2170
2170
  },
2171
+ // Keep-awake (stub — apps should override via setKeepAwakeProvider, which
2172
+ // the provider wires when a keepAwakeProvider prop is supplied)
2173
+ keepAwake: async () => {
2174
+ return error2(
2175
+ "keep-awake not configured. Provide a keepAwakeProvider to UIBridgeNativeProvider.",
2176
+ "NOT_SUPPORTED"
2177
+ );
2178
+ },
2171
2179
  // Meta / Introspection (stub — server constructor overrides with real route table)
2172
2180
  getMethods: async () => {
2173
2181
  return error2("Methods introspection not configured", "NOT_SUPPORTED");
@@ -2841,6 +2849,12 @@ var WS_ROUTES = [
2841
2849
  httpMethods: ["POST"],
2842
2850
  requiresTestHooks: true
2843
2851
  },
2852
+ {
2853
+ pattern: "control/keep-awake",
2854
+ handler: "keepAwake",
2855
+ httpMethods: ["POST"],
2856
+ requiresTestHooks: true
2857
+ },
2844
2858
  // Observability — last-N console errors + network requests. testHooks-gated
2845
2859
  // because patching `console.error` / `fetch` is invasive in production.
2846
2860
  {
@@ -2893,7 +2907,8 @@ var HANDLER_DESCRIPTIONS = {
2893
2907
  getConsoleErrors: "TEST HOOK \u2014 last-N console.error/console.warn entries; ?since=<ms>&limit=<n>",
2894
2908
  getNetworkRequests: "TEST HOOK \u2014 last-N fetch/XHR entries with status + duration; ?since=<ms>&limit=<n>",
2895
2909
  pushModal: "TEST HOOK \u2014 push a modal onto the snapshot.modalStack via the registry ModalDetector",
2896
- dismissModal: "TEST HOOK \u2014 dismiss a modal by id from the snapshot.modalStack via the registry ModalDetector"
2910
+ dismissModal: "TEST HOOK \u2014 dismiss a modal by id from the snapshot.modalStack via the registry ModalDetector",
2911
+ keepAwake: "TEST HOOK \u2014 keep the device screen awake via the injected keepAwakeProvider: body { enabled: boolean, durationMs?: number }"
2897
2912
  };
2898
2913
  var ACTION_REFERENCE = [
2899
2914
  { name: "press", aliases: ["click"], params: "PressActionParams (optional position)" },
@@ -3161,6 +3176,35 @@ var NativeUIBridgeServer = class {
3161
3176
  }
3162
3177
  };
3163
3178
  }
3179
+ /**
3180
+ * Set a keep-awake provider for native screen-wake control.
3181
+ * This enables `control/keep-awake` and arms the auto-arm hook in
3182
+ * handleRequest (every request keeps the screen alive for 60s).
3183
+ */
3184
+ setKeepAwakeProvider(provider) {
3185
+ this.keepAwakeProvider = provider;
3186
+ this.handlers.keepAwake = async (ctx) => {
3187
+ const { enabled, durationMs } = ctx.body ?? {};
3188
+ if (typeof enabled !== "boolean") {
3189
+ return {
3190
+ success: false,
3191
+ error: "enabled must be boolean",
3192
+ code: "INVALID_REQUEST",
3193
+ timestamp: Date.now()
3194
+ };
3195
+ }
3196
+ if (enabled) {
3197
+ provider.request("ui-bridge", typeof durationMs === "number" ? durationMs : void 0);
3198
+ } else {
3199
+ provider.release("ui-bridge");
3200
+ }
3201
+ return {
3202
+ success: true,
3203
+ data: { enabled, durationMs: typeof durationMs === "number" ? durationMs : null },
3204
+ timestamp: Date.now()
3205
+ };
3206
+ };
3207
+ }
3164
3208
  /**
3165
3209
  * Start the HTTP server
3166
3210
  */
@@ -3753,6 +3797,12 @@ var NativeUIBridgeServer = class {
3753
3797
  if (request.method === "OPTIONS") {
3754
3798
  return { status: 204, headers, body: "" };
3755
3799
  }
3800
+ if (this.config.testHooks === true && this.keepAwakeProvider) {
3801
+ try {
3802
+ this.keepAwakeProvider.request("auto-arm", 6e4);
3803
+ } catch {
3804
+ }
3805
+ }
3756
3806
  try {
3757
3807
  const response = await this.routeRequest(request);
3758
3808
  return {
@@ -4653,6 +4703,7 @@ function UIBridgeNativeProvider({
4653
4703
  serverAdapter,
4654
4704
  navigationProvider,
4655
4705
  screenshotProvider,
4706
+ keepAwakeProvider,
4656
4707
  routeProvider,
4657
4708
  cloudRelayConfig,
4658
4709
  enableMdnsAnnounce,
@@ -4707,6 +4758,9 @@ function UIBridgeNativeProvider({
4707
4758
  if (screenshotProvider) {
4708
4759
  server.setScreenshotProvider(screenshotProvider);
4709
4760
  }
4761
+ if (keepAwakeProvider) {
4762
+ server.setKeepAwakeProvider(keepAwakeProvider);
4763
+ }
4710
4764
  if (routeProvider) {
4711
4765
  server.setRouteProvider(routeProvider);
4712
4766
  }
@@ -4760,6 +4814,7 @@ function UIBridgeNativeProvider({
4760
4814
  serverAdapter,
4761
4815
  navigationProvider,
4762
4816
  screenshotProvider,
4817
+ keepAwakeProvider,
4763
4818
  routeProvider
4764
4819
  ]);
4765
4820
  const stopServer = react.useCallback(() => {
@@ -4793,6 +4848,7 @@ function UIBridgeNativeProvider({
4793
4848
  });
4794
4849
  if (navigationProvider) bareServer.setNavigationProvider(navigationProvider);
4795
4850
  if (screenshotProvider) bareServer.setScreenshotProvider(screenshotProvider);
4851
+ if (keepAwakeProvider) bareServer.setKeepAwakeProvider(keepAwakeProvider);
4796
4852
  if (routeProvider) bareServer.setRouteProvider(routeProvider);
4797
4853
  serverRef.current = bareServer;
4798
4854
  } catch (err) {
@@ -4937,17 +4993,17 @@ function UIBridgeNativeProvider({
4937
4993
  getCurrentRoute
4938
4994
  ]
4939
4995
  );
4940
- return /* @__PURE__ */ jsxRuntime.jsx(UIBridgeNativeContext.Provider, { value: contextValue, children });
4996
+ return /* @__PURE__ */ jsxRuntime.jsx(UIBridgeNativeContext, { value: contextValue, children });
4941
4997
  }
4942
4998
  function useUIBridgeNative() {
4943
- const context = react.useContext(UIBridgeNativeContext);
4999
+ const context = react.use(UIBridgeNativeContext);
4944
5000
  if (!context) {
4945
5001
  throw new Error("useUIBridgeNative must be used within a UIBridgeNativeProvider");
4946
5002
  }
4947
5003
  return context;
4948
5004
  }
4949
5005
  function useUIBridgeNativeOptional() {
4950
- return react.useContext(UIBridgeNativeContext);
5006
+ return react.use(UIBridgeNativeContext);
4951
5007
  }
4952
5008
  var useUIBridgeNativeRequired = useUIBridgeNative;
4953
5009
  function flattenStyle(style) {