@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
@@ -1,14 +1,16 @@
1
+ import { a as BridgeEventListener, 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-BwdPNpII.js';
2
+
1
3
  /**
2
4
  * Native Element and Component Registry
3
5
  *
4
6
  * Central registry for all UI elements and components registered with UI Bridge Native.
5
7
  * Adapted from ui-bridge for React Native environments.
6
8
  */
7
- import type { RegisteredNativeElement, RegisteredNativeComponent, NativeElementState, NativeElementType, NativeStandardAction, NativeCustomAction, NativeBridgeSnapshot, NativeElementRef, Workflow, BridgeEventType, BridgeEventListener } from './types';
9
+
8
10
  /**
9
11
  * Options for registering an element
10
12
  */
11
- export interface RegisterElementOptions {
13
+ interface RegisterElementOptions {
12
14
  type?: NativeElementType;
13
15
  label?: string;
14
16
  actions?: NativeStandardAction[];
@@ -31,7 +33,7 @@ export interface RegisterElementOptions {
31
33
  /**
32
34
  * Options for registering a component
33
35
  */
34
- export interface RegisterComponentOptions {
36
+ interface RegisterComponentOptions {
35
37
  name: string;
36
38
  description?: string;
37
39
  actions?: Array<{
@@ -45,7 +47,7 @@ export interface RegisterComponentOptions {
45
47
  /**
46
48
  * Registry configuration
47
49
  */
48
- export interface NativeRegistryConfig {
50
+ interface NativeRegistryConfig {
49
51
  verbose?: boolean;
50
52
  onEvent?: BridgeEventListener;
51
53
  }
@@ -53,19 +55,49 @@ export interface NativeRegistryConfig {
53
55
  * Extract handler function names from an element's props.
54
56
  * Returns names of props whose values are functions (e.g. ['onPress', 'onChangeText']).
55
57
  */
56
- export declare function extractHandlerNames(props?: Record<string, unknown>): string[];
58
+ declare function extractHandlerNames(props?: Record<string, unknown>): string[];
57
59
  /**
58
60
  * Native UI Bridge Registry
59
61
  *
60
62
  * Manages registration and lookup of native UI elements and components.
61
63
  */
62
- export declare class NativeUIBridgeRegistry {
64
+ declare class NativeUIBridgeRegistry {
63
65
  private elements;
64
66
  private components;
65
67
  private workflows;
66
68
  private eventListeners;
67
69
  private config;
70
+ private enrichers;
71
+ private snapshotExtras;
72
+ /**
73
+ * Sticky flag: flips `true` the first time any element is registered and
74
+ * stays `true` even after elements are unregistered. Lets agents distinguish
75
+ * "this route never wired any elements" from "this route registered then
76
+ * unmounted".
77
+ */
78
+ private everHadRegistrations;
68
79
  constructor(config?: NativeRegistryConfig);
80
+ /**
81
+ * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
82
+ * with a partial set merges into existing slots instead of clobbering them.
83
+ */
84
+ setEnrichers(e: Partial<NativeSnapshotEnrichers>): void;
85
+ /**
86
+ * Read-only accessor for the canonical enrichers slot. Returned object is
87
+ * the live reference, so callers can detect "no detector wired" via
88
+ * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP
89
+ * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need
90
+ * to drive the ModalDetector directly without re-instantiating it.
91
+ */
92
+ getEnrichers(): Readonly<NativeSnapshotEnrichers>;
93
+ /**
94
+ * Register a custom snapshot enricher. The returned object will be
95
+ * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
96
+ * clobbering canonical fields. Returns a disposer.
97
+ */
98
+ registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void;
99
+ /** Remove a custom snapshot enricher by name */
100
+ unregisterSnapshotEnricher(name: string): void;
69
101
  /**
70
102
  * Register a native element
71
103
  */
@@ -192,6 +224,14 @@ export declare class NativeUIBridgeRegistry {
192
224
  components: number;
193
225
  workflows: number;
194
226
  };
227
+ /**
228
+ * Compute registration coverage metadata for the current registry state.
229
+ *
230
+ * Groups currently-registered elements by `registrationRoute`, bucketing
231
+ * elements without a route under `'?'`. `everHadRegistrations` is sticky —
232
+ * once true, it stays true for the lifetime of the registry instance.
233
+ */
234
+ getRegistrationCoverage(): NativeRegistrationCoverage;
195
235
  /**
196
236
  * Clear all registrations
197
237
  */
@@ -200,13 +240,14 @@ export declare class NativeUIBridgeRegistry {
200
240
  /**
201
241
  * Set the global registry
202
242
  */
203
- export declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
243
+ declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
204
244
  /**
205
245
  * Get the global registry
206
246
  */
207
- export declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
247
+ declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
208
248
  /**
209
249
  * Reset the global registry
210
250
  */
211
- export declare function resetGlobalRegistry(): void;
212
- //# sourceMappingURL=registry.d.ts.map
251
+ declare function resetGlobalRegistry(): void;
252
+
253
+ 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 };
@@ -0,0 +1,253 @@
1
+ import { a as BridgeEventListener, 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-BwdPNpII.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
+ * Sticky flag: flips `true` the first time any element is registered and
74
+ * stays `true` even after elements are unregistered. Lets agents distinguish
75
+ * "this route never wired any elements" from "this route registered then
76
+ * unmounted".
77
+ */
78
+ private everHadRegistrations;
79
+ constructor(config?: NativeRegistryConfig);
80
+ /**
81
+ * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
82
+ * with a partial set merges into existing slots instead of clobbering them.
83
+ */
84
+ setEnrichers(e: Partial<NativeSnapshotEnrichers>): void;
85
+ /**
86
+ * Read-only accessor for the canonical enrichers slot. Returned object is
87
+ * the live reference, so callers can detect "no detector wired" via
88
+ * `getEnrichers().modalDetector === undefined`. Used by the test-hook HTTP
89
+ * handlers (`control/modal/push`, `control/modal/dismiss/:id`) which need
90
+ * to drive the ModalDetector directly without re-instantiating it.
91
+ */
92
+ getEnrichers(): Readonly<NativeSnapshotEnrichers>;
93
+ /**
94
+ * Register a custom snapshot enricher. The returned object will be
95
+ * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
96
+ * clobbering canonical fields. Returns a disposer.
97
+ */
98
+ registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void;
99
+ /** Remove a custom snapshot enricher by name */
100
+ unregisterSnapshotEnricher(name: string): void;
101
+ /**
102
+ * Register a native element
103
+ */
104
+ registerElement(id: string, ref: React.RefObject<NativeElementRef>, options?: RegisterElementOptions): RegisteredNativeElement;
105
+ /**
106
+ * Unregister an element
107
+ */
108
+ unregisterElement(id: string): void;
109
+ /**
110
+ * Get a registered element
111
+ */
112
+ getElement(id: string): RegisteredNativeElement | undefined;
113
+ /**
114
+ * Get all registered elements
115
+ */
116
+ getAllElements(): RegisteredNativeElement[];
117
+ /**
118
+ * Get all registered elements that are visible and have a layout
119
+ */
120
+ getVisibleElements(): RegisteredNativeElement[];
121
+ /**
122
+ * Get elements registered on a specific route (for page-scoped filtering)
123
+ */
124
+ getElementsForRoute(route: string): RegisteredNativeElement[];
125
+ /**
126
+ * Mark elements registered on a route as off-screen (visible: false, layout: null).
127
+ *
128
+ * Use this when a screen loses focus but stays mounted — common in React Navigation
129
+ * tab navigators where inactive tabs remain in the tree. Without this call, stale
130
+ * `layout` data lingers in snapshots and makes off-screen elements look rendered.
131
+ *
132
+ * Does NOT unregister the elements — they stay registered so the user's next visit
133
+ * re-measures them via `onLayout` without re-mount cost. Elements without a
134
+ * `registrationRoute` (app-wide registrations) are untouched.
135
+ */
136
+ markRouteOffscreen(route: string): void;
137
+ /**
138
+ * Update element state
139
+ */
140
+ updateElementState(id: string, state: Partial<NativeElementState>): void;
141
+ /**
142
+ * Update element props (for action execution)
143
+ */
144
+ updateElementProps(id: string, props: Record<string, unknown>): void;
145
+ /**
146
+ * Update element style for design review
147
+ */
148
+ updateElementStyle(id: string, flatStyle: Record<string, unknown>, stateStyles?: {
149
+ pressed?: Record<string, unknown>;
150
+ focused?: Record<string, unknown>;
151
+ disabled?: Record<string, unknown>;
152
+ }): void;
153
+ /**
154
+ * Get element style for design review
155
+ */
156
+ getElementStyle(id: string): Record<string, unknown> | null;
157
+ /**
158
+ * Find element by testID
159
+ */
160
+ findByTestId(testId: string): RegisteredNativeElement | undefined;
161
+ /**
162
+ * Find elements by type
163
+ */
164
+ findByType(type: NativeElementType): RegisteredNativeElement[];
165
+ /**
166
+ * Register a component
167
+ */
168
+ registerComponent(id: string, options: RegisterComponentOptions): RegisteredNativeComponent;
169
+ /**
170
+ * Unregister a component
171
+ */
172
+ unregisterComponent(id: string): void;
173
+ /**
174
+ * Get a registered component
175
+ */
176
+ getComponent(id: string): RegisteredNativeComponent | undefined;
177
+ /**
178
+ * Get all registered components
179
+ */
180
+ getAllComponents(): RegisteredNativeComponent[];
181
+ /**
182
+ * Register a workflow
183
+ */
184
+ registerWorkflow(workflow: Workflow): void;
185
+ /**
186
+ * Unregister a workflow
187
+ */
188
+ unregisterWorkflow(id: string): void;
189
+ /**
190
+ * Get a workflow
191
+ */
192
+ getWorkflow(id: string): Workflow | undefined;
193
+ /**
194
+ * Get all workflows
195
+ */
196
+ getAllWorkflows(): Workflow[];
197
+ /**
198
+ * Subscribe to events
199
+ */
200
+ on<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): () => void;
201
+ /**
202
+ * Unsubscribe from events
203
+ */
204
+ off<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): void;
205
+ /**
206
+ * Emit an event
207
+ */
208
+ emit(type: BridgeEventType, data: unknown): void;
209
+ /**
210
+ * Create a snapshot of the current state
211
+ */
212
+ createSnapshot(routeInfo?: {
213
+ currentRoute?: string | null;
214
+ segments?: string[];
215
+ }, options?: {
216
+ visibleOnly?: boolean;
217
+ currentRouteOnly?: boolean;
218
+ }): NativeBridgeSnapshot;
219
+ /**
220
+ * Get registry statistics
221
+ */
222
+ getStats(): {
223
+ elements: number;
224
+ components: number;
225
+ workflows: number;
226
+ };
227
+ /**
228
+ * Compute registration coverage metadata for the current registry state.
229
+ *
230
+ * Groups currently-registered elements by `registrationRoute`, bucketing
231
+ * elements without a route under `'?'`. `everHadRegistrations` is sticky —
232
+ * once true, it stays true for the lifetime of the registry instance.
233
+ */
234
+ getRegistrationCoverage(): NativeRegistrationCoverage;
235
+ /**
236
+ * Clear all registrations
237
+ */
238
+ clear(): void;
239
+ }
240
+ /**
241
+ * Set the global registry
242
+ */
243
+ declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
244
+ /**
245
+ * Get the global registry
246
+ */
247
+ declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
248
+ /**
249
+ * Reset the global registry
250
+ */
251
+ declare function resetGlobalRegistry(): void;
252
+
253
+ 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 };
@@ -0,0 +1,119 @@
1
+ import { k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server-D2U1k48d.mjs';
2
+ export { 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, u as JsonRpcClientMessage, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, v as JsonRpcServerMessage, w as JsonRpcSubscribe, x as JsonRpcUnsubscribe, N as NativeServerConfig, l as NativeUIBridgeServer, m as NavigationProvider, P as PushModalRequest, y as PushModalResponse, 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, z as isBatchRequest, B as isSubscribe, C as isUnsubscribe } from '../http-server-D2U1k48d.mjs';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-KdUW_koV.mjs';
4
+ import { N as NativeActionExecutor } from '../types-DjB0zJJH.mjs';
5
+ import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.mjs';
6
+ import '../types-BwdPNpII.mjs';
7
+
8
+ /**
9
+ * UI Bridge Native Server Handlers
10
+ *
11
+ * Request handlers for the HTTP API endpoints.
12
+ */
13
+
14
+ /**
15
+ * Create server handlers
16
+ */
17
+ declare function createServerHandlers(registry: NativeUIBridgeRegistry, executor: NativeActionExecutor, config?: {
18
+ appInfo?: {
19
+ appId: string;
20
+ appName: string;
21
+ appType: string;
22
+ framework?: string;
23
+ };
24
+ }): NativeServerHandlers;
25
+
26
+ /**
27
+ * Pure-JS RFC 6455 WebSocket protocol implementation.
28
+ *
29
+ * Provides frame encoding/decoding and handshake utilities for running
30
+ * a WebSocket server on react-native-tcp-socket without native crypto deps.
31
+ */
32
+ declare const OPCODE_CONTINUATION = 0;
33
+ declare const OPCODE_TEXT = 1;
34
+ declare const OPCODE_BINARY = 2;
35
+ declare const OPCODE_CLOSE = 8;
36
+ declare const OPCODE_PING = 9;
37
+ declare const OPCODE_PONG = 10;
38
+ interface DecodedFrame {
39
+ opcode: number;
40
+ fin: boolean;
41
+ payload: Uint8Array;
42
+ masked: boolean;
43
+ }
44
+ interface DecodeResult {
45
+ frames: DecodedFrame[];
46
+ remainder: Uint8Array<any>;
47
+ }
48
+ /**
49
+ * Compute the Sec-WebSocket-Accept value from the client's Sec-WebSocket-Key.
50
+ */
51
+ declare function computeAcceptKey(clientKey: string): string;
52
+ /**
53
+ * Build the HTTP 101 Switching Protocols response for a WebSocket upgrade.
54
+ */
55
+ declare function buildUpgradeResponse(clientKey: string): string;
56
+ /** Encode a text message as a WebSocket frame. */
57
+ declare function encodeTextFrame(text: string): Uint8Array;
58
+ /** Encode a PING frame with optional payload. */
59
+ declare function encodePingFrame(payload?: Uint8Array): Uint8Array;
60
+ /** Encode a PONG frame with the payload from the PING. */
61
+ declare function encodePongFrame(payload: Uint8Array): Uint8Array;
62
+ /** Encode a CLOSE frame with optional status code and reason. */
63
+ declare function encodeCloseFrame(code?: number, reason?: string): Uint8Array;
64
+ /**
65
+ * Decode one or more WebSocket frames from a byte buffer.
66
+ * Returns decoded frames and any unconsumed bytes (for partial frames).
67
+ */
68
+ declare function decodeFrames(buffer: Uint8Array): DecodeResult;
69
+ /**
70
+ * Decode a text payload from a Uint8Array.
71
+ */
72
+ declare function decodeTextPayload(payload: Uint8Array): string;
73
+
74
+ /**
75
+ * UI Bridge Native Design Review Handlers
76
+ *
77
+ * HTTP handlers for the 8 design review endpoints.
78
+ * Maps registered element styles to the web SDK's design data format.
79
+ */
80
+
81
+ /**
82
+ * Design handler interface (subset of NativeServerHandlers)
83
+ */
84
+ interface NativeDesignHandlers {
85
+ getElementStyles: (ctx: HandlerContext) => Promise<APIResponse<ElementDesignData>>;
86
+ getElementStateStyles: (ctx: HandlerContext) => Promise<APIResponse<{
87
+ elementId: string;
88
+ stateStyles: StateStyles[];
89
+ }>>;
90
+ getDesignSnapshot: (ctx: HandlerContext) => Promise<APIResponse<{
91
+ elements: ElementDesignData[];
92
+ timestamp: number;
93
+ }>>;
94
+ getResponsiveSnapshots: (ctx: HandlerContext) => Promise<APIResponse<ResponsiveSnapshot[]>>;
95
+ runDesignAudit: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
96
+ loadStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
97
+ loaded: boolean;
98
+ }>>;
99
+ getStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
100
+ clearStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
101
+ cleared: boolean;
102
+ }>>;
103
+ evaluateQuality: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
104
+ getQualityContexts: (ctx: HandlerContext) => Promise<APIResponse<Array<{
105
+ name: string;
106
+ description: string;
107
+ }>>>;
108
+ saveBaseline: (ctx: HandlerContext) => Promise<APIResponse<{
109
+ saved: boolean;
110
+ elementCount: number;
111
+ }>>;
112
+ diffBaseline: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
113
+ }
114
+ /**
115
+ * Create design review handlers.
116
+ */
117
+ declare function createDesignHandlers(registry: NativeUIBridgeRegistry): NativeDesignHandlers;
118
+
119
+ export { APIResponse, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };
@@ -1,15 +1,119 @@
1
+ import { k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server-ck8clUsZ.js';
2
+ export { 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, u as JsonRpcClientMessage, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, v as JsonRpcServerMessage, w as JsonRpcSubscribe, x as JsonRpcUnsubscribe, N as NativeServerConfig, l as NativeUIBridgeServer, m as NavigationProvider, P as PushModalRequest, y as PushModalResponse, 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, z as isBatchRequest, B as isSubscribe, C as isUnsubscribe } from '../http-server-ck8clUsZ.js';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-BxXaxmsT.js';
4
+ import { N as NativeActionExecutor } from '../types-DCEv5qb6.js';
5
+ import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.js';
6
+ import '../types-BwdPNpII.js';
7
+
1
8
  /**
2
- * UI Bridge Native - Server
9
+ * UI Bridge Native Server Handlers
3
10
  *
4
- * HTTP and WebSocket server for external control of native apps.
5
- */
6
- export * from './types';
7
- export * from './handlers';
8
- export * from './design-handlers';
9
- export * from './http-server';
10
- export * from './ws-protocol';
11
- export * from './ws-types';
12
- export { WebSocketConnection } from './ws-connection';
13
- export type { WebSocketMessageHandler } from './ws-connection';
14
- export { WebSocketEventBridge } from './ws-event-bridge';
15
- //# sourceMappingURL=index.d.ts.map
11
+ * Request handlers for the HTTP API endpoints.
12
+ */
13
+
14
+ /**
15
+ * Create server handlers
16
+ */
17
+ declare function createServerHandlers(registry: NativeUIBridgeRegistry, executor: NativeActionExecutor, config?: {
18
+ appInfo?: {
19
+ appId: string;
20
+ appName: string;
21
+ appType: string;
22
+ framework?: string;
23
+ };
24
+ }): NativeServerHandlers;
25
+
26
+ /**
27
+ * Pure-JS RFC 6455 WebSocket protocol implementation.
28
+ *
29
+ * Provides frame encoding/decoding and handshake utilities for running
30
+ * a WebSocket server on react-native-tcp-socket without native crypto deps.
31
+ */
32
+ declare const OPCODE_CONTINUATION = 0;
33
+ declare const OPCODE_TEXT = 1;
34
+ declare const OPCODE_BINARY = 2;
35
+ declare const OPCODE_CLOSE = 8;
36
+ declare const OPCODE_PING = 9;
37
+ declare const OPCODE_PONG = 10;
38
+ interface DecodedFrame {
39
+ opcode: number;
40
+ fin: boolean;
41
+ payload: Uint8Array;
42
+ masked: boolean;
43
+ }
44
+ interface DecodeResult {
45
+ frames: DecodedFrame[];
46
+ remainder: Uint8Array<any>;
47
+ }
48
+ /**
49
+ * Compute the Sec-WebSocket-Accept value from the client's Sec-WebSocket-Key.
50
+ */
51
+ declare function computeAcceptKey(clientKey: string): string;
52
+ /**
53
+ * Build the HTTP 101 Switching Protocols response for a WebSocket upgrade.
54
+ */
55
+ declare function buildUpgradeResponse(clientKey: string): string;
56
+ /** Encode a text message as a WebSocket frame. */
57
+ declare function encodeTextFrame(text: string): Uint8Array;
58
+ /** Encode a PING frame with optional payload. */
59
+ declare function encodePingFrame(payload?: Uint8Array): Uint8Array;
60
+ /** Encode a PONG frame with the payload from the PING. */
61
+ declare function encodePongFrame(payload: Uint8Array): Uint8Array;
62
+ /** Encode a CLOSE frame with optional status code and reason. */
63
+ declare function encodeCloseFrame(code?: number, reason?: string): Uint8Array;
64
+ /**
65
+ * Decode one or more WebSocket frames from a byte buffer.
66
+ * Returns decoded frames and any unconsumed bytes (for partial frames).
67
+ */
68
+ declare function decodeFrames(buffer: Uint8Array): DecodeResult;
69
+ /**
70
+ * Decode a text payload from a Uint8Array.
71
+ */
72
+ declare function decodeTextPayload(payload: Uint8Array): string;
73
+
74
+ /**
75
+ * UI Bridge Native Design Review Handlers
76
+ *
77
+ * HTTP handlers for the 8 design review endpoints.
78
+ * Maps registered element styles to the web SDK's design data format.
79
+ */
80
+
81
+ /**
82
+ * Design handler interface (subset of NativeServerHandlers)
83
+ */
84
+ interface NativeDesignHandlers {
85
+ getElementStyles: (ctx: HandlerContext) => Promise<APIResponse<ElementDesignData>>;
86
+ getElementStateStyles: (ctx: HandlerContext) => Promise<APIResponse<{
87
+ elementId: string;
88
+ stateStyles: StateStyles[];
89
+ }>>;
90
+ getDesignSnapshot: (ctx: HandlerContext) => Promise<APIResponse<{
91
+ elements: ElementDesignData[];
92
+ timestamp: number;
93
+ }>>;
94
+ getResponsiveSnapshots: (ctx: HandlerContext) => Promise<APIResponse<ResponsiveSnapshot[]>>;
95
+ runDesignAudit: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
96
+ loadStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
97
+ loaded: boolean;
98
+ }>>;
99
+ getStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
100
+ clearStyleGuide: (ctx: HandlerContext) => Promise<APIResponse<{
101
+ cleared: boolean;
102
+ }>>;
103
+ evaluateQuality: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
104
+ getQualityContexts: (ctx: HandlerContext) => Promise<APIResponse<Array<{
105
+ name: string;
106
+ description: string;
107
+ }>>>;
108
+ saveBaseline: (ctx: HandlerContext) => Promise<APIResponse<{
109
+ saved: boolean;
110
+ elementCount: number;
111
+ }>>;
112
+ diffBaseline: (ctx: HandlerContext) => Promise<APIResponse<unknown>>;
113
+ }
114
+ /**
115
+ * Create design review handlers.
116
+ */
117
+ declare function createDesignHandlers(registry: NativeUIBridgeRegistry): NativeDesignHandlers;
118
+
119
+ export { APIResponse, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };