@qontinui/ui-bridge-native 0.1.6 → 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 (94) 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 +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/{inspector.d.ts → index.d.mts} +6 -3
  14. package/dist/debug/index.d.ts +44 -4
  15. package/dist/debug/index.js.map +1 -1
  16. package/dist/debug/index.mjs.map +1 -1
  17. package/dist/design/{design-inspector-native.d.ts → index.d.mts} +11 -7
  18. package/dist/design/index.d.ts +60 -5
  19. package/dist/{design/design-types.d.ts → design-types-BHr6Q1FX.d.mts} +11 -10
  20. package/dist/design-types-BHr6Q1FX.d.ts +205 -0
  21. package/dist/http-server-DCdR8WlL.d.mts +622 -0
  22. package/dist/http-server-Dj3grQW4.d.ts +622 -0
  23. package/dist/index.d.mts +89 -0
  24. package/dist/index.d.ts +86 -28
  25. package/dist/index.js +391 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +386 -13
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/react/{useAutoRegister.d.ts → index.d.mts} +15 -7
  30. package/dist/react/index.d.ts +69 -8
  31. package/dist/react/index.js +388 -12
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/react/index.mjs +386 -13
  34. package/dist/react/index.mjs.map +1 -1
  35. package/dist/registry-Cahd8Gn2.d.mts +230 -0
  36. package/dist/{core/registry.d.ts → registry-z-3WJsxp.d.ts} +28 -10
  37. package/dist/server/index.d.mts +119 -0
  38. package/dist/server/index.d.ts +117 -13
  39. package/dist/server/index.js.map +1 -1
  40. package/dist/server/index.mjs.map +1 -1
  41. package/dist/types-DAfCeWXc.d.mts +197 -0
  42. package/dist/{core/types.d.ts → types-Oz13YLZq.d.mts} +124 -30
  43. package/dist/types-Oz13YLZq.d.ts +477 -0
  44. package/dist/{control/types.d.ts → types-ajakyp-l.d.ts} +36 -15
  45. package/dist/useUIBridgeToast-D32KXyL1.d.ts +720 -0
  46. package/dist/useUIBridgeToast-GmT1TzUe.d.mts +720 -0
  47. package/package.json +1 -1
  48. package/dist/control/action-executor.d.ts.map +0 -1
  49. package/dist/control/index.d.ts.map +0 -1
  50. package/dist/control/types.d.ts.map +0 -1
  51. package/dist/core/element-identifier.d.ts +0 -41
  52. package/dist/core/element-identifier.d.ts.map +0 -1
  53. package/dist/core/index.d.ts.map +0 -1
  54. package/dist/core/registry.d.ts.map +0 -1
  55. package/dist/core/types.d.ts.map +0 -1
  56. package/dist/debug/index.d.ts.map +0 -1
  57. package/dist/debug/inspector.d.ts.map +0 -1
  58. package/dist/design/design-inspector-native.d.ts.map +0 -1
  59. package/dist/design/design-types.d.ts.map +0 -1
  60. package/dist/design/index.d.ts.map +0 -1
  61. package/dist/index.d.ts.map +0 -1
  62. package/dist/react/UIBridgeNativeProvider.d.ts +0 -147
  63. package/dist/react/UIBridgeNativeProvider.d.ts.map +0 -1
  64. package/dist/react/index.d.ts.map +0 -1
  65. package/dist/react/useAutoRegister.d.ts.map +0 -1
  66. package/dist/react/useUIBridge.d.ts +0 -103
  67. package/dist/react/useUIBridge.d.ts.map +0 -1
  68. package/dist/react/useUIComponent.d.ts +0 -112
  69. package/dist/react/useUIComponent.d.ts.map +0 -1
  70. package/dist/react/useUIElement.d.ts +0 -162
  71. package/dist/react/useUIElement.d.ts.map +0 -1
  72. package/dist/server/design-handlers.d.ts +0 -47
  73. package/dist/server/design-handlers.d.ts.map +0 -1
  74. package/dist/server/handlers.d.ts +0 -20
  75. package/dist/server/handlers.d.ts.map +0 -1
  76. package/dist/server/http-server.d.ts +0 -247
  77. package/dist/server/http-server.d.ts.map +0 -1
  78. package/dist/server/index.d.ts.map +0 -1
  79. package/dist/server/types.d.ts +0 -200
  80. package/dist/server/types.d.ts.map +0 -1
  81. package/dist/server/ws-connection.d.ts +0 -48
  82. package/dist/server/ws-connection.d.ts.map +0 -1
  83. package/dist/server/ws-event-bridge.d.ts +0 -113
  84. package/dist/server/ws-event-bridge.d.ts.map +0 -1
  85. package/dist/server/ws-protocol.d.ts +0 -48
  86. package/dist/server/ws-protocol.d.ts.map +0 -1
  87. package/dist/server/ws-types.d.ts +0 -65
  88. package/dist/server/ws-types.d.ts.map +0 -1
  89. package/dist/transport/CloudRelayClient.d.ts +0 -51
  90. package/dist/transport/CloudRelayClient.d.ts.map +0 -1
  91. package/dist/transport/DeviceAnnouncer.d.ts +0 -75
  92. package/dist/transport/DeviceAnnouncer.d.ts.map +0 -1
  93. package/dist/transport/index.d.ts +0 -3
  94. package/dist/transport/index.d.ts.map +0 -1
@@ -0,0 +1,230 @@
1
+ import { a as BridgeEventListener, r as NativeSnapshotEnrichers, q as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, v as NativeStandardAction, h as NativeCustomAction, y as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, z as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot } from './types-Oz13YLZq.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
+ constructor(config?: NativeRegistryConfig);
73
+ /**
74
+ * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
75
+ * with a partial set merges into existing slots instead of clobbering them.
76
+ */
77
+ setEnrichers(e: Partial<NativeSnapshotEnrichers>): void;
78
+ /**
79
+ * Register a custom snapshot enricher. The returned object will be
80
+ * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
81
+ * clobbering canonical fields. Returns a disposer.
82
+ */
83
+ registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void;
84
+ /** Remove a custom snapshot enricher by name */
85
+ unregisterSnapshotEnricher(name: string): void;
86
+ /**
87
+ * Register a native element
88
+ */
89
+ registerElement(id: string, ref: React.RefObject<NativeElementRef>, options?: RegisterElementOptions): RegisteredNativeElement;
90
+ /**
91
+ * Unregister an element
92
+ */
93
+ unregisterElement(id: string): void;
94
+ /**
95
+ * Get a registered element
96
+ */
97
+ getElement(id: string): RegisteredNativeElement | undefined;
98
+ /**
99
+ * Get all registered elements
100
+ */
101
+ getAllElements(): RegisteredNativeElement[];
102
+ /**
103
+ * Get all registered elements that are visible and have a layout
104
+ */
105
+ getVisibleElements(): RegisteredNativeElement[];
106
+ /**
107
+ * Get elements registered on a specific route (for page-scoped filtering)
108
+ */
109
+ getElementsForRoute(route: string): RegisteredNativeElement[];
110
+ /**
111
+ * Mark elements registered on a route as off-screen (visible: false, layout: null).
112
+ *
113
+ * Use this when a screen loses focus but stays mounted — common in React Navigation
114
+ * tab navigators where inactive tabs remain in the tree. Without this call, stale
115
+ * `layout` data lingers in snapshots and makes off-screen elements look rendered.
116
+ *
117
+ * Does NOT unregister the elements — they stay registered so the user's next visit
118
+ * re-measures them via `onLayout` without re-mount cost. Elements without a
119
+ * `registrationRoute` (app-wide registrations) are untouched.
120
+ */
121
+ markRouteOffscreen(route: string): void;
122
+ /**
123
+ * Update element state
124
+ */
125
+ updateElementState(id: string, state: Partial<NativeElementState>): void;
126
+ /**
127
+ * Update element props (for action execution)
128
+ */
129
+ updateElementProps(id: string, props: Record<string, unknown>): void;
130
+ /**
131
+ * Update element style for design review
132
+ */
133
+ updateElementStyle(id: string, flatStyle: Record<string, unknown>, stateStyles?: {
134
+ pressed?: Record<string, unknown>;
135
+ focused?: Record<string, unknown>;
136
+ disabled?: Record<string, unknown>;
137
+ }): void;
138
+ /**
139
+ * Get element style for design review
140
+ */
141
+ getElementStyle(id: string): Record<string, unknown> | null;
142
+ /**
143
+ * Find element by testID
144
+ */
145
+ findByTestId(testId: string): RegisteredNativeElement | undefined;
146
+ /**
147
+ * Find elements by type
148
+ */
149
+ findByType(type: NativeElementType): RegisteredNativeElement[];
150
+ /**
151
+ * Register a component
152
+ */
153
+ registerComponent(id: string, options: RegisterComponentOptions): RegisteredNativeComponent;
154
+ /**
155
+ * Unregister a component
156
+ */
157
+ unregisterComponent(id: string): void;
158
+ /**
159
+ * Get a registered component
160
+ */
161
+ getComponent(id: string): RegisteredNativeComponent | undefined;
162
+ /**
163
+ * Get all registered components
164
+ */
165
+ getAllComponents(): RegisteredNativeComponent[];
166
+ /**
167
+ * Register a workflow
168
+ */
169
+ registerWorkflow(workflow: Workflow): void;
170
+ /**
171
+ * Unregister a workflow
172
+ */
173
+ unregisterWorkflow(id: string): void;
174
+ /**
175
+ * Get a workflow
176
+ */
177
+ getWorkflow(id: string): Workflow | undefined;
178
+ /**
179
+ * Get all workflows
180
+ */
181
+ getAllWorkflows(): Workflow[];
182
+ /**
183
+ * Subscribe to events
184
+ */
185
+ on<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): () => void;
186
+ /**
187
+ * Unsubscribe from events
188
+ */
189
+ off<T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>): void;
190
+ /**
191
+ * Emit an event
192
+ */
193
+ emit(type: BridgeEventType, data: unknown): void;
194
+ /**
195
+ * Create a snapshot of the current state
196
+ */
197
+ createSnapshot(routeInfo?: {
198
+ currentRoute?: string | null;
199
+ segments?: string[];
200
+ }, options?: {
201
+ visibleOnly?: boolean;
202
+ currentRouteOnly?: boolean;
203
+ }): NativeBridgeSnapshot;
204
+ /**
205
+ * Get registry statistics
206
+ */
207
+ getStats(): {
208
+ elements: number;
209
+ components: number;
210
+ workflows: number;
211
+ };
212
+ /**
213
+ * Clear all registrations
214
+ */
215
+ clear(): void;
216
+ }
217
+ /**
218
+ * Set the global registry
219
+ */
220
+ declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
221
+ /**
222
+ * Get the global registry
223
+ */
224
+ declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
225
+ /**
226
+ * Reset the global registry
227
+ */
228
+ declare function resetGlobalRegistry(): void;
229
+
230
+ export { type NativeRegistryConfig as N, type RegisterComponentOptions as R, NativeUIBridgeRegistry as a, type RegisterElementOptions as b, extractHandlerNames as e, getGlobalRegistry as g, resetGlobalRegistry as r, setGlobalRegistry as s };
@@ -1,14 +1,16 @@
1
+ import { a as BridgeEventListener, r as NativeSnapshotEnrichers, q as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, v as NativeStandardAction, h as NativeCustomAction, y as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, z as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot } from './types-Oz13YLZq.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,34 @@ 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;
68
72
  constructor(config?: NativeRegistryConfig);
73
+ /**
74
+ * Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
75
+ * with a partial set merges into existing slots instead of clobbering them.
76
+ */
77
+ setEnrichers(e: Partial<NativeSnapshotEnrichers>): void;
78
+ /**
79
+ * Register a custom snapshot enricher. The returned object will be
80
+ * `Object.assign`ed onto the snapshot, so use unique top-level keys to avoid
81
+ * clobbering canonical fields. Returns a disposer.
82
+ */
83
+ registerSnapshotEnricher(name: string, fn: NativeSnapshotEnricher): () => void;
84
+ /** Remove a custom snapshot enricher by name */
85
+ unregisterSnapshotEnricher(name: string): void;
69
86
  /**
70
87
  * Register a native element
71
88
  */
@@ -200,13 +217,14 @@ export declare class NativeUIBridgeRegistry {
200
217
  /**
201
218
  * Set the global registry
202
219
  */
203
- export declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
220
+ declare function setGlobalRegistry(registry: NativeUIBridgeRegistry): void;
204
221
  /**
205
222
  * Get the global registry
206
223
  */
207
- export declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
224
+ declare function getGlobalRegistry(): NativeUIBridgeRegistry | null;
208
225
  /**
209
226
  * Reset the global registry
210
227
  */
211
- export declare function resetGlobalRegistry(): void;
212
- //# sourceMappingURL=registry.d.ts.map
228
+ declare function resetGlobalRegistry(): void;
229
+
230
+ 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 { h as NativeServerHandlers, b as HandlerContext, A as APIResponse } from '../http-server-DCdR8WlL.mjs';
2
+ export { H as HTTPRequest, a as HTTPResponse, c as HandlerFunction, J as JsonRpcBatchRequest, d as JsonRpcBatchResponse, r as JsonRpcClientMessage, e as JsonRpcEvent, f as JsonRpcRequest, g as JsonRpcResponse, s as JsonRpcServerMessage, t as JsonRpcSubscribe, u as JsonRpcUnsubscribe, N as NativeServerConfig, i as NativeUIBridgeServer, j as NavigationProvider, R as RequestHandler, k as RouteDefinition, l as RouteProvider, S as ScreenshotProvider, m as ServerAdapter, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, n as WebSocketEventBridge, o as WebSocketMessageHandler, p as WebSocketServerAdapter, q as createNativeServer, v as isBatchRequest, w as isSubscribe, x as isUnsubscribe } from '../http-server-DCdR8WlL.mjs';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-Cahd8Gn2.mjs';
4
+ import { N as NativeActionExecutor } from '../types-DAfCeWXc.mjs';
5
+ import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.mjs';
6
+ import '../types-Oz13YLZq.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 { h as NativeServerHandlers, b as HandlerContext, A as APIResponse } from '../http-server-Dj3grQW4.js';
2
+ export { H as HTTPRequest, a as HTTPResponse, c as HandlerFunction, J as JsonRpcBatchRequest, d as JsonRpcBatchResponse, r as JsonRpcClientMessage, e as JsonRpcEvent, f as JsonRpcRequest, g as JsonRpcResponse, s as JsonRpcServerMessage, t as JsonRpcSubscribe, u as JsonRpcUnsubscribe, N as NativeServerConfig, i as NativeUIBridgeServer, j as NavigationProvider, R as RequestHandler, k as RouteDefinition, l as RouteProvider, S as ScreenshotProvider, m as ServerAdapter, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, n as WebSocketEventBridge, o as WebSocketMessageHandler, p as WebSocketServerAdapter, q as createNativeServer, v as isBatchRequest, w as isSubscribe, x as isUnsubscribe } from '../http-server-Dj3grQW4.js';
3
+ import { a as NativeUIBridgeRegistry } from '../registry-z-3WJsxp.js';
4
+ import { N as NativeActionExecutor } from '../types-ajakyp-l.js';
5
+ import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.js';
6
+ import '../types-Oz13YLZq.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 };