@qontinui/ui-bridge 0.2.0 → 0.3.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 (108) hide show
  1. package/dist/ai/index.d.mts +4 -4
  2. package/dist/ai/index.d.ts +4 -4
  3. package/dist/babel-plugin/index.js +515 -0
  4. package/dist/babel-plugin/index.js.map +1 -0
  5. package/dist/babel-plugin/index.mjs +499 -0
  6. package/dist/babel-plugin/index.mjs.map +1 -0
  7. package/dist/control/index.d.mts +5 -5
  8. package/dist/control/index.d.ts +5 -5
  9. package/dist/core/index.d.mts +115 -44
  10. package/dist/core/index.d.ts +115 -44
  11. package/dist/core/index.js +0 -1560
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/index.mjs +1 -1549
  14. package/dist/core/index.mjs.map +1 -1
  15. package/dist/debug/index.d.mts +3 -3
  16. package/dist/debug/index.d.ts +3 -3
  17. package/dist/index.d.mts +7 -8
  18. package/dist/index.d.ts +7 -8
  19. package/dist/index.js +859 -873
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +860 -862
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/{metrics-C9XRi_mL.d.ts → metrics-BfiT_rhZ.d.ts} +2 -2
  24. package/dist/{metrics-NC3csD0R.d.mts → metrics-DTA2bwG7.d.mts} +2 -2
  25. package/dist/native/control/index.js +453 -0
  26. package/dist/native/control/index.js.map +1 -0
  27. package/dist/native/control/index.mjs +450 -0
  28. package/dist/native/control/index.mjs.map +1 -0
  29. package/dist/native/core/index.js +486 -0
  30. package/dist/native/core/index.js.map +1 -0
  31. package/dist/native/core/index.mjs +475 -0
  32. package/dist/native/core/index.mjs.map +1 -0
  33. package/dist/native/debug/index.js +451 -0
  34. package/dist/native/debug/index.js.map +1 -0
  35. package/dist/native/debug/index.mjs +449 -0
  36. package/dist/native/debug/index.mjs.map +1 -0
  37. package/dist/native/index.js +2274 -0
  38. package/dist/native/index.js.map +1 -0
  39. package/dist/native/index.mjs +2246 -0
  40. package/dist/native/index.mjs.map +1 -0
  41. package/dist/native/react/index.js +1401 -0
  42. package/dist/native/react/index.js.map +1 -0
  43. package/dist/native/react/index.mjs +1389 -0
  44. package/dist/native/react/index.mjs.map +1 -0
  45. package/dist/native/server/index.js +415 -0
  46. package/dist/native/server/index.js.map +1 -0
  47. package/dist/native/server/index.mjs +410 -0
  48. package/dist/native/server/index.mjs.map +1 -0
  49. package/dist/react/index.d.mts +20 -7
  50. package/dist/react/index.d.ts +20 -7
  51. package/dist/react/index.js +42 -4
  52. package/dist/react/index.js.map +1 -1
  53. package/dist/react/index.mjs +42 -4
  54. package/dist/react/index.mjs.map +1 -1
  55. package/dist/{registry-CIEDjbQ9.d.ts → registry-BKLEm-yk.d.ts} +9 -15
  56. package/dist/{registry-SsSDq46X.d.mts → registry-BmZgyCz8.d.mts} +9 -15
  57. package/dist/render-log/index.d.mts +1 -1
  58. package/dist/render-log/index.d.ts +1 -1
  59. package/dist/server/express.d.mts +36 -0
  60. package/dist/server/express.d.ts +36 -0
  61. package/dist/server/express.js +196 -0
  62. package/dist/server/express.js.map +1 -0
  63. package/dist/server/express.mjs +192 -0
  64. package/dist/server/express.mjs.map +1 -0
  65. package/dist/server/handlers.d.mts +93 -0
  66. package/dist/server/handlers.d.ts +93 -0
  67. package/dist/server/handlers.js +4278 -0
  68. package/dist/server/handlers.js.map +1 -0
  69. package/dist/server/handlers.mjs +4275 -0
  70. package/dist/server/handlers.mjs.map +1 -0
  71. package/dist/server/index.d.mts +10 -0
  72. package/dist/server/index.d.ts +10 -0
  73. package/dist/server/index.js +5352 -0
  74. package/dist/server/index.js.map +1 -0
  75. package/dist/server/index.mjs +5337 -0
  76. package/dist/server/index.mjs.map +1 -0
  77. package/dist/server/nextjs.d.mts +126 -0
  78. package/dist/server/nextjs.d.ts +126 -0
  79. package/dist/server/nextjs.js +287 -0
  80. package/dist/server/nextjs.js.map +1 -0
  81. package/dist/server/nextjs.mjs +282 -0
  82. package/dist/server/nextjs.mjs.map +1 -0
  83. package/dist/server/standalone.d.mts +6 -0
  84. package/dist/server/standalone.d.ts +6 -0
  85. package/dist/server/standalone.js +719 -0
  86. package/dist/server/standalone.js.map +1 -0
  87. package/dist/server/standalone.mjs +715 -0
  88. package/dist/server/standalone.mjs.map +1 -0
  89. package/dist/standalone-BURj8J3G.d.ts +212 -0
  90. package/dist/standalone-Dwmel29d.d.mts +212 -0
  91. package/dist/swc-plugin/index.d.mts +79 -0
  92. package/dist/swc-plugin/index.d.ts +79 -0
  93. package/dist/swc-plugin/index.js +15 -0
  94. package/dist/swc-plugin/index.js.map +1 -0
  95. package/dist/swc-plugin/index.mjs +9 -0
  96. package/dist/swc-plugin/index.mjs.map +1 -0
  97. package/dist/{types-CFT3Dnx4.d.mts → types-B5Q0GVo0.d.mts} +115 -3
  98. package/dist/{types-Dr6tH-bm.d.mts → types-B7J7noLK.d.mts} +1 -1
  99. package/dist/{types-oCTrRxSw.d.ts → types-BkNRILUa.d.ts} +1 -1
  100. package/dist/types-CEQLnFMv.d.mts +156 -0
  101. package/dist/types-CHnlwiTK.d.ts +156 -0
  102. package/dist/{types-BvCfFuEV.d.ts → types-DfPqwU-i.d.ts} +115 -3
  103. package/dist/{types-CPMbN_Iw.d.mts → types-jKVgTI6_.d.mts} +356 -160
  104. package/dist/{types-CPMbN_Iw.d.ts → types-jKVgTI6_.d.ts} +356 -160
  105. package/package.json +106 -3
  106. package/swc-plugin-wasm/ui_bridge_swc_plugin.wasm +0 -0
  107. package/dist/websocket-client-CX4QJesI.d.ts +0 -124
  108. package/dist/websocket-client-C_Na0OSp.d.mts +0 -124
@@ -1,5 +1,5 @@
1
- import { c as BridgeEvent } from './types-CPMbN_Iw.js';
2
- import { c as ControlActionResponse, a as ComponentActionResponse, m as WorkflowStepResult } from './types-oCTrRxSw.js';
1
+ import { i as BridgeEvent } from './types-jKVgTI6_.js';
2
+ import { c as ControlActionResponse, a as ComponentActionResponse, m as WorkflowStepResult } from './types-BkNRILUa.js';
3
3
 
4
4
  /**
5
5
  * Metrics Module
@@ -1,5 +1,5 @@
1
- import { c as BridgeEvent } from './types-CPMbN_Iw.mjs';
2
- import { c as ControlActionResponse, a as ComponentActionResponse, m as WorkflowStepResult } from './types-Dr6tH-bm.mjs';
1
+ import { i as BridgeEvent } from './types-jKVgTI6_.mjs';
2
+ import { c as ControlActionResponse, a as ComponentActionResponse, m as WorkflowStepResult } from './types-B7J7noLK.mjs';
3
3
 
4
4
  /**
5
5
  * Metrics Module
@@ -0,0 +1,453 @@
1
+ 'use strict';
2
+
3
+ // src/native/core/registry.ts
4
+
5
+ // src/native/core/element-identifier.ts
6
+ function findElementByIdentifier(identifier) {
7
+ return null;
8
+ }
9
+
10
+ // src/native/control/action-executor.ts
11
+ var DEFAULT_WAIT_OPTIONS = {
12
+ visible: true,
13
+ enabled: true,
14
+ focused: false,
15
+ state: {},
16
+ timeout: 1e4,
17
+ interval: 100
18
+ };
19
+ function sleep(ms) {
20
+ return new Promise((resolve) => setTimeout(resolve, ms));
21
+ }
22
+ var DefaultNativeActionExecutor = class {
23
+ constructor(registry) {
24
+ this.registry = registry;
25
+ }
26
+ /**
27
+ * Execute an action on an element
28
+ */
29
+ async executeAction(elementId, request) {
30
+ const startTime = Date.now();
31
+ let waitDurationMs = 0;
32
+ try {
33
+ let registered = this.registry.getElement(elementId);
34
+ if (!registered) {
35
+ registered = findElementByIdentifier(elementId) ?? void 0;
36
+ }
37
+ if (!registered) {
38
+ return {
39
+ success: false,
40
+ error: `Element not found: ${elementId}`,
41
+ durationMs: Date.now() - startTime,
42
+ timestamp: Date.now(),
43
+ requestId: request.requestId
44
+ };
45
+ }
46
+ if (request.waitOptions) {
47
+ const waitResult = await this.waitForElementInternal(
48
+ registered.id,
49
+ request.waitOptions
50
+ );
51
+ waitDurationMs = waitResult.waitedMs;
52
+ if (!waitResult.met) {
53
+ return {
54
+ success: false,
55
+ error: waitResult.error || "Wait condition not met",
56
+ durationMs: Date.now() - startTime,
57
+ timestamp: Date.now(),
58
+ requestId: request.requestId,
59
+ waitDurationMs
60
+ };
61
+ }
62
+ }
63
+ const result = await this.performAction(registered, request.action, request.params);
64
+ return {
65
+ success: true,
66
+ elementState: registered.getState(),
67
+ result,
68
+ durationMs: Date.now() - startTime,
69
+ timestamp: Date.now(),
70
+ requestId: request.requestId,
71
+ waitDurationMs
72
+ };
73
+ } catch (error) {
74
+ return {
75
+ success: false,
76
+ error: error instanceof Error ? error.message : String(error),
77
+ stack: error instanceof Error ? error.stack : void 0,
78
+ durationMs: Date.now() - startTime,
79
+ timestamp: Date.now(),
80
+ requestId: request.requestId,
81
+ waitDurationMs
82
+ };
83
+ }
84
+ }
85
+ /**
86
+ * Perform an action on an element
87
+ */
88
+ async performAction(element, action, params) {
89
+ if (!element) {
90
+ throw new Error("Element not found");
91
+ }
92
+ const props = element.props || {};
93
+ if (element.customActions && action in element.customActions) {
94
+ return element.customActions[action].handler(params);
95
+ }
96
+ switch (action) {
97
+ case "press":
98
+ return this.performPress(props, params);
99
+ case "longPress":
100
+ return this.performLongPress(props, params);
101
+ case "doubleTap":
102
+ return this.performDoubleTap(props);
103
+ case "type":
104
+ return this.performType(element, props, params);
105
+ case "clear":
106
+ return this.performClear(element, props);
107
+ case "focus":
108
+ return this.performFocus(element);
109
+ case "blur":
110
+ return this.performBlur(element);
111
+ case "scroll":
112
+ return this.performScroll(props, params);
113
+ case "swipe":
114
+ return this.performSwipe(props, params);
115
+ case "toggle":
116
+ return this.performToggle(props);
117
+ default:
118
+ throw new Error(`Unknown action: ${action}`);
119
+ }
120
+ }
121
+ /**
122
+ * Perform press action
123
+ */
124
+ async performPress(props, params) {
125
+ const handlers = ["onPress", "onPressIn", "onResponderRelease"];
126
+ for (const handler of handlers) {
127
+ if (typeof props[handler] === "function") {
128
+ const event = this.createPressEvent(params);
129
+ props[handler](event);
130
+ return;
131
+ }
132
+ }
133
+ throw new Error("No press handler found on element");
134
+ }
135
+ /**
136
+ * Perform long press action
137
+ */
138
+ async performLongPress(props, params) {
139
+ if (typeof props.onLongPress === "function") {
140
+ const event = this.createPressEvent(params);
141
+ props.onLongPress(event);
142
+ return;
143
+ }
144
+ throw new Error("No long press handler found on element");
145
+ }
146
+ /**
147
+ * Perform double tap action
148
+ */
149
+ async performDoubleTap(props) {
150
+ if (typeof props.onDoubleTap === "function") {
151
+ props.onDoubleTap();
152
+ return;
153
+ }
154
+ if (typeof props.onPress === "function") {
155
+ const event = this.createPressEvent();
156
+ props.onPress(event);
157
+ await sleep(50);
158
+ props.onPress(event);
159
+ return;
160
+ }
161
+ throw new Error("No press handler found for double tap");
162
+ }
163
+ /**
164
+ * Perform type action
165
+ */
166
+ async performType(element, props, params) {
167
+ if (!params?.text) {
168
+ throw new Error("Type action requires text parameter");
169
+ }
170
+ if (params.clearFirst) {
171
+ await this.performClear(element, props);
172
+ }
173
+ if (params.delay && params.delay > 0) {
174
+ const currentValue = element?.getState().value || "";
175
+ for (const char of params.text) {
176
+ const newValue = currentValue + char;
177
+ if (typeof props.onChangeText === "function") {
178
+ props.onChangeText(newValue);
179
+ }
180
+ await sleep(params.delay);
181
+ }
182
+ } else {
183
+ if (typeof props.onChangeText === "function") {
184
+ props.onChangeText(params.text);
185
+ } else if (typeof props.onChange === "function") {
186
+ props.onChange({
187
+ nativeEvent: { text: params.text }
188
+ });
189
+ } else {
190
+ throw new Error("No text change handler found on element");
191
+ }
192
+ }
193
+ if (element) {
194
+ this.registry.updateElementState(element.id, { value: params.text });
195
+ }
196
+ }
197
+ /**
198
+ * Perform clear action
199
+ */
200
+ async performClear(element, props) {
201
+ if (typeof props.onChangeText === "function") {
202
+ props.onChangeText("");
203
+ } else if (typeof props.onChange === "function") {
204
+ props.onChange({
205
+ nativeEvent: { text: "" }
206
+ });
207
+ }
208
+ if (element) {
209
+ this.registry.updateElementState(element.id, { value: "" });
210
+ }
211
+ }
212
+ /**
213
+ * Perform focus action
214
+ */
215
+ async performFocus(element) {
216
+ if (element?.ref.current && "focus" in element.ref.current) {
217
+ element.ref.current.focus();
218
+ }
219
+ if (element) {
220
+ this.registry.updateElementState(element.id, { focused: true });
221
+ }
222
+ }
223
+ /**
224
+ * Perform blur action
225
+ */
226
+ async performBlur(element) {
227
+ if (element?.ref.current && "blur" in element.ref.current) {
228
+ element.ref.current.blur();
229
+ }
230
+ if (element) {
231
+ this.registry.updateElementState(element.id, { focused: false });
232
+ }
233
+ }
234
+ /**
235
+ * Perform scroll action
236
+ */
237
+ async performScroll(props, params) {
238
+ if (typeof props.onScroll === "function") {
239
+ const event = {
240
+ nativeEvent: {
241
+ contentOffset: params?.offset || { x: 0, y: 0 }
242
+ }
243
+ };
244
+ props.onScroll(event);
245
+ }
246
+ }
247
+ /**
248
+ * Perform swipe action
249
+ */
250
+ async performSwipe(props, params) {
251
+ if (!params?.direction) {
252
+ throw new Error("Swipe action requires direction parameter");
253
+ }
254
+ const handlerMap = {
255
+ left: "onSwipeLeft",
256
+ right: "onSwipeRight",
257
+ up: "onSwipeUp",
258
+ down: "onSwipeDown"
259
+ };
260
+ const handler = handlerMap[params.direction];
261
+ if (handler && typeof props[handler] === "function") {
262
+ props[handler]();
263
+ return;
264
+ }
265
+ if (typeof props.onSwipe === "function") {
266
+ props.onSwipe(params.direction);
267
+ }
268
+ }
269
+ /**
270
+ * Perform toggle action
271
+ */
272
+ async performToggle(props) {
273
+ if (typeof props.onValueChange === "function") {
274
+ const currentValue = props.value;
275
+ props.onValueChange(!currentValue);
276
+ return;
277
+ }
278
+ if (typeof props.onPress === "function") {
279
+ props.onPress();
280
+ return;
281
+ }
282
+ throw new Error("No toggle handler found on element");
283
+ }
284
+ /**
285
+ * Create a synthetic press event
286
+ */
287
+ createPressEvent(params) {
288
+ return {
289
+ nativeEvent: {
290
+ locationX: params?.position?.x ?? 0,
291
+ locationY: params?.position?.y ?? 0,
292
+ timestamp: Date.now()
293
+ },
294
+ persist: () => {
295
+ }
296
+ };
297
+ }
298
+ /**
299
+ * Execute a component action
300
+ */
301
+ async executeComponentAction(componentId, request) {
302
+ const startTime = Date.now();
303
+ try {
304
+ const component = this.registry.getComponent(componentId);
305
+ if (!component) {
306
+ return {
307
+ success: false,
308
+ error: `Component not found: ${componentId}`,
309
+ durationMs: Date.now() - startTime,
310
+ timestamp: Date.now(),
311
+ requestId: request.requestId
312
+ };
313
+ }
314
+ const action = component.actions.find((a) => a.id === request.action);
315
+ if (!action) {
316
+ return {
317
+ success: false,
318
+ error: `Action not found: ${request.action}`,
319
+ durationMs: Date.now() - startTime,
320
+ timestamp: Date.now(),
321
+ requestId: request.requestId
322
+ };
323
+ }
324
+ const result = await action.handler(request.params);
325
+ return {
326
+ success: true,
327
+ result,
328
+ durationMs: Date.now() - startTime,
329
+ timestamp: Date.now(),
330
+ requestId: request.requestId
331
+ };
332
+ } catch (error) {
333
+ return {
334
+ success: false,
335
+ error: error instanceof Error ? error.message : String(error),
336
+ stack: error instanceof Error ? error.stack : void 0,
337
+ durationMs: Date.now() - startTime,
338
+ timestamp: Date.now(),
339
+ requestId: request.requestId
340
+ };
341
+ }
342
+ }
343
+ /**
344
+ * Find elements
345
+ */
346
+ async find(request) {
347
+ const startTime = Date.now();
348
+ const allElements = this.registry.getAllElements();
349
+ let filtered = allElements;
350
+ if (request.types && request.types.length > 0) {
351
+ filtered = filtered.filter((e) => request.types.includes(e.type));
352
+ }
353
+ if (request.testIdPattern) {
354
+ const regex = new RegExp(
355
+ request.testIdPattern.replace(/\*/g, ".*").replace(/\?/g, ".")
356
+ );
357
+ filtered = filtered.filter((e) => {
358
+ const identifier = e.getIdentifier();
359
+ return identifier.testId && regex.test(identifier.testId);
360
+ });
361
+ }
362
+ if (request.accessibilityLabelPattern) {
363
+ const regex = new RegExp(
364
+ request.accessibilityLabelPattern.replace(/\*/g, ".*").replace(/\?/g, ".")
365
+ );
366
+ filtered = filtered.filter((e) => {
367
+ const identifier = e.getIdentifier();
368
+ return identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel);
369
+ });
370
+ }
371
+ if (request.visibleOnly) {
372
+ filtered = filtered.filter((e) => e.getState().visible);
373
+ }
374
+ if (request.limit && request.limit > 0) {
375
+ filtered = filtered.slice(0, request.limit);
376
+ }
377
+ const elements = filtered.map((e) => ({
378
+ id: e.id,
379
+ type: e.type,
380
+ identifier: e.getIdentifier(),
381
+ state: e.getState(),
382
+ actions: e.actions,
383
+ label: e.label
384
+ }));
385
+ return {
386
+ elements,
387
+ total: elements.length,
388
+ durationMs: Date.now() - startTime,
389
+ timestamp: Date.now()
390
+ };
391
+ }
392
+ /**
393
+ * Wait for element conditions
394
+ */
395
+ async waitForElement(elementId, options) {
396
+ return this.waitForElementInternal(elementId, options);
397
+ }
398
+ /**
399
+ * Internal wait implementation
400
+ */
401
+ async waitForElementInternal(elementId, options) {
402
+ const opts = { ...DEFAULT_WAIT_OPTIONS, ...options };
403
+ const startTime = Date.now();
404
+ while (Date.now() - startTime < opts.timeout) {
405
+ const element = this.registry.getElement(elementId);
406
+ if (!element) {
407
+ await sleep(opts.interval);
408
+ continue;
409
+ }
410
+ const state = element.getState();
411
+ let conditionsMet = true;
412
+ if (opts.visible && !state.visible) {
413
+ conditionsMet = false;
414
+ }
415
+ if (opts.enabled && !state.enabled) {
416
+ conditionsMet = false;
417
+ }
418
+ if (opts.focused && !state.focused) {
419
+ conditionsMet = false;
420
+ }
421
+ if (opts.state && Object.keys(opts.state).length > 0) {
422
+ const stateRecord = state;
423
+ for (const [key, value] of Object.entries(opts.state)) {
424
+ if (stateRecord[key] !== value) {
425
+ conditionsMet = false;
426
+ break;
427
+ }
428
+ }
429
+ }
430
+ if (conditionsMet) {
431
+ return {
432
+ met: true,
433
+ waitedMs: Date.now() - startTime,
434
+ state
435
+ };
436
+ }
437
+ await sleep(opts.interval);
438
+ }
439
+ return {
440
+ met: false,
441
+ waitedMs: Date.now() - startTime,
442
+ error: `Timeout waiting for conditions on element: ${elementId}`
443
+ };
444
+ }
445
+ };
446
+ function createNativeActionExecutor(registry) {
447
+ return new DefaultNativeActionExecutor(registry);
448
+ }
449
+
450
+ exports.DefaultNativeActionExecutor = DefaultNativeActionExecutor;
451
+ exports.createNativeActionExecutor = createNativeActionExecutor;
452
+ //# sourceMappingURL=index.js.map
453
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/native/core/element-identifier.ts","../../../src/native/control/action-executor.ts"],"names":[],"mappings":";;;;;AAmCO,SAAS,wBACd,UAAA,EACgC;AAEhC,EAAe,OAAO,IAAA;AA4BxB;;;AClCA,IAAM,oBAAA,GAA8C;AAAA,EAClD,OAAA,EAAS,IAAA;AAAA,EACT,OAAA,EAAS,IAAA;AAAA,EACT,OAAA,EAAS,KAAA;AAAA,EACT,OAAO,EAAC;AAAA,EACR,OAAA,EAAS,GAAA;AAAA,EACT,QAAA,EAAU;AACZ,CAAA;AAKA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD;AAKO,IAAM,8BAAN,MAAkE;AAAA,EACvE,YAAoB,QAAA,EAAkC;AAAlC,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAAA,EAAmC;AAAA;AAAA;AAAA;AAAA,EAKvD,MAAM,aAAA,CACJ,SAAA,EACA,OAAA,EACgC;AAChC,IAAA,MAAM,SAAA,GAAY,KAAK,GAAA,EAAI;AAC3B,IAAA,IAAI,cAAA,GAAiB,CAAA;AAErB,IAAA,IAAI;AAEF,MAAA,IAAI,UAAA,GAAa,IAAA,CAAK,QAAA,CAAS,UAAA,CAAW,SAAS,CAAA;AAGnD,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA,UAAA,GAAa,uBAAA,CAAwB,SAAS,CAAA,IAAK,KAAA,CAAA;AAAA,MACrD;AAEA,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA,OAAO;AAAA,UACL,OAAA,EAAS,KAAA;AAAA,UACT,KAAA,EAAO,sBA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KAAK,CAAA,EAAG;AACrD,UAAA,IAAI,WAAA,CAAY,GAAG,CAAA,KAAM,KAAA,EAAO;AAC9B,YAAA,aAAA,GAAgB,KAAA;AAChB,YAAA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,MAAA,IAAI,aAAA,EAAe;AACjB,QAAA,OAAO;AAAA,UACL,GAAA,EAAK,IAAA;AAAA,UACL,QAAA,EAAU,IAAA,CAAK,GAAA,EAAI,GAAI,SAAA;AAAA,UACvB;AAAA,SACF;AAAA,MACF;AAEA,MAAA,MAAM,KAAA,CAAM,KAAK,QAAQ,CAAA;AAAA,IAC3B;AAEA,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,KAAA;AAAA,MACL,QAAA,EAAU,IAAA,CAAK,GAAA,EAAI,GAAI,SAAA;AAAA,MACvB,KAAA,EAAO,8CAA8C,SAAS,CAAA;AAAA,KAChE;AAAA,EACF;AACF;AAKO,SAAS,2BACd,QAAA,EACsB;AACtB,EAAA,OAAO,IAAI,4BAA4B,QAAQ,CAAA;AACjD","file":"index.js","sourcesContent":["/**\n * Native Element Identifier\n *\n * Utilities for identifying and finding native elements.\n * In React Native, we use testID, accessibilityLabel, and tree paths\n * instead of XPath/CSS selectors.\n */\n\nimport type { NativeElementIdentifier, RegisteredNativeElement } from './types';\nimport { getGlobalRegistry } from './registry';\n\n/**\n * Create an element identifier for a native element\n */\nexport function createNativeElementIdentifier(\n id: string,\n options: {\n testId?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n treePath?: string;\n } = {}\n): NativeElementIdentifier {\n return {\n uiId: id,\n testId: options.testId || id,\n accessibilityLabel: options.accessibilityLabel,\n accessibilityHint: options.accessibilityHint,\n treePath: options.treePath || id,\n };\n}\n\n/**\n * Find an element by its identifier in the global registry\n */\nexport function findElementByIdentifier(\n identifier: string | NativeElementIdentifier\n): RegisteredNativeElement | null {\n const registry = getGlobalRegistry();\n if (!registry) return null;\n\n // If string, try different lookup strategies\n if (typeof identifier === 'string') {\n // Try direct ID lookup\n const byId = registry.getElement(identifier);\n if (byId) return byId;\n\n // Try testID lookup\n const byTestId = registry.findByTestId(identifier);\n if (byTestId) return byTestId;\n\n // Try pattern matching\n return findByPattern(registry, identifier);\n }\n\n // If identifier object, try each strategy\n if (identifier.uiId) {\n const byId = registry.getElement(identifier.uiId);\n if (byId) return byId;\n }\n\n if (identifier.testId) {\n const byTestId = registry.findByTestId(identifier.testId);\n if (byTestId) return byTestId;\n }\n\n return null;\n}\n\n/**\n * Find element by pattern (supports wildcards)\n */\nfunction findByPattern(\n registry: ReturnType<typeof getGlobalRegistry>,\n pattern: string\n): RegisteredNativeElement | null {\n if (!registry) return null;\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special chars\n .replace(/\\*/g, '.*') // Convert * to .*\n .replace(/\\?/g, '.'); // Convert ? to .\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n // Match against testId\n if (identifier.testId && regex.test(identifier.testId)) {\n return element;\n }\n\n // Match against uiId\n if (identifier.uiId && regex.test(identifier.uiId)) {\n return element;\n }\n\n // Match against treePath\n if (identifier.treePath && regex.test(identifier.treePath)) {\n return element;\n }\n\n // Match against accessibilityLabel\n if (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel)) {\n return element;\n }\n }\n\n return null;\n}\n\n/**\n * Find all elements matching a pattern\n */\nexport function findAllByPattern(pattern: string): RegisteredNativeElement[] {\n const registry = getGlobalRegistry();\n if (!registry) return [];\n\n // Convert pattern to regex\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/\\?/g, '.');\n\n const regex = new RegExp(`^${regexPattern}$`, 'i');\n const results: RegisteredNativeElement[] = [];\n\n for (const element of registry.getAllElements()) {\n const identifier = element.getIdentifier();\n\n if (\n (identifier.testId && regex.test(identifier.testId)) ||\n (identifier.uiId && regex.test(identifier.uiId)) ||\n (identifier.treePath && regex.test(identifier.treePath)) ||\n (identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel))\n ) {\n results.push(element);\n }\n }\n\n return results;\n}\n\n/**\n * Build a tree path for an element based on its position in the component tree\n */\nexport function buildTreePath(componentPath: string[], elementIndex?: number): string {\n let path = componentPath.join('/');\n if (elementIndex !== undefined) {\n path += `[${elementIndex}]`;\n }\n return path;\n}\n\n/**\n * Parse a tree path into its components\n */\nexport function parseTreePath(treePath: string): { components: string[]; index?: number } {\n const indexMatch = treePath.match(/\\[(\\d+)\\]$/);\n const index = indexMatch ? parseInt(indexMatch[1], 10) : undefined;\n const pathWithoutIndex = treePath.replace(/\\[\\d+\\]$/, '');\n const components = pathWithoutIndex.split('/').filter(Boolean);\n\n return { components, index };\n}\n\n/**\n * Check if an identifier matches criteria\n */\nexport function matchesIdentifier(\n identifier: NativeElementIdentifier,\n criteria: Partial<NativeElementIdentifier>\n): boolean {\n if (criteria.uiId && identifier.uiId !== criteria.uiId) {\n return false;\n }\n if (criteria.testId && identifier.testId !== criteria.testId) {\n return false;\n }\n if (criteria.accessibilityLabel && identifier.accessibilityLabel !== criteria.accessibilityLabel) {\n return false;\n }\n if (criteria.treePath && identifier.treePath !== criteria.treePath) {\n return false;\n }\n return true;\n}\n","/**\n * Native Action Executor\n *\n * Executes actions on registered native elements and components.\n * In React Native, we execute actions by calling prop handlers directly\n * (onPress, onChangeText, etc.) rather than simulating DOM events.\n */\n\nimport type { NativeUIBridgeRegistry } from '../core/registry';\nimport type {\n NativeStandardAction,\n NativeFindRequest,\n NativeFindResponse,\n DiscoveredNativeElement,\n WaitOptions,\n} from '../core/types';\nimport { findElementByIdentifier } from '../core/element-identifier';\nimport type {\n ControlActionRequest,\n ControlActionResponse,\n ComponentActionRequest,\n ComponentActionResponse,\n WaitResult,\n NativeActionExecutor,\n TypeActionParams,\n ScrollActionParams,\n SwipeActionParams,\n PressActionParams,\n} from './types';\n\n/**\n * Default wait options\n */\nconst DEFAULT_WAIT_OPTIONS: Required<WaitOptions> = {\n visible: true,\n enabled: true,\n focused: false,\n state: {},\n timeout: 10000,\n interval: 100,\n};\n\n/**\n * Sleep for a duration\n */\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Default native action executor implementation\n */\nexport class DefaultNativeActionExecutor implements NativeActionExecutor {\n constructor(private registry: NativeUIBridgeRegistry) {}\n\n /**\n * Execute an action on an element\n */\n async executeAction(\n elementId: string,\n request: ControlActionRequest\n ): Promise<ControlActionResponse> {\n const startTime = Date.now();\n let waitDurationMs = 0;\n\n try {\n // Find the element\n let registered = this.registry.getElement(elementId);\n\n // If not in registry, try by identifier\n if (!registered) {\n registered = findElementByIdentifier(elementId) ?? undefined;\n }\n\n if (!registered) {\n return {\n success: false,\n error: `Element not found: ${elementId}`,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n };\n }\n\n // Wait for conditions if specified\n if (request.waitOptions) {\n const waitResult = await this.waitForElementInternal(\n registered.id,\n request.waitOptions\n );\n waitDurationMs = waitResult.waitedMs;\n if (!waitResult.met) {\n return {\n success: false,\n error: waitResult.error || 'Wait condition not met',\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n waitDurationMs,\n };\n }\n }\n\n // Execute the action\n const result = await this.performAction(registered, request.action, request.params);\n\n return {\n success: true,\n elementState: registered.getState(),\n result,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n waitDurationMs,\n };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n waitDurationMs,\n };\n }\n }\n\n /**\n * Perform an action on an element\n */\n private async performAction(\n element: ReturnType<NativeUIBridgeRegistry['getElement']>,\n action: NativeStandardAction | string,\n params?: Record<string, unknown>\n ): Promise<unknown> {\n if (!element) {\n throw new Error('Element not found');\n }\n\n const props = element.props || {};\n\n // Check for custom action first\n if (element.customActions && action in element.customActions) {\n return element.customActions[action].handler(params);\n }\n\n // Execute standard actions\n switch (action) {\n case 'press':\n return this.performPress(props, params as PressActionParams | undefined);\n\n case 'longPress':\n return this.performLongPress(props, params as PressActionParams | undefined);\n\n case 'doubleTap':\n return this.performDoubleTap(props);\n\n case 'type':\n return this.performType(element, props, params as unknown as TypeActionParams);\n\n case 'clear':\n return this.performClear(element, props);\n\n case 'focus':\n return this.performFocus(element);\n\n case 'blur':\n return this.performBlur(element);\n\n case 'scroll':\n return this.performScroll(props, params as ScrollActionParams | undefined);\n\n case 'swipe':\n return this.performSwipe(props, params as unknown as SwipeActionParams);\n\n case 'toggle':\n return this.performToggle(props);\n\n default:\n throw new Error(`Unknown action: ${action}`);\n }\n }\n\n /**\n * Perform press action\n */\n private async performPress(\n props: Record<string, unknown>,\n params?: PressActionParams\n ): Promise<void> {\n // Try different press handlers in order of preference\n const handlers = ['onPress', 'onPressIn', 'onResponderRelease'];\n\n for (const handler of handlers) {\n if (typeof props[handler] === 'function') {\n // Create a synthetic event object\n const event = this.createPressEvent(params);\n (props[handler] as (event: unknown) => void)(event);\n return;\n }\n }\n\n throw new Error('No press handler found on element');\n }\n\n /**\n * Perform long press action\n */\n private async performLongPress(\n props: Record<string, unknown>,\n params?: PressActionParams\n ): Promise<void> {\n if (typeof props.onLongPress === 'function') {\n const event = this.createPressEvent(params);\n (props.onLongPress as (event: unknown) => void)(event);\n return;\n }\n\n throw new Error('No long press handler found on element');\n }\n\n /**\n * Perform double tap action\n */\n private async performDoubleTap(props: Record<string, unknown>): Promise<void> {\n // First try dedicated double tap handler\n if (typeof props.onDoubleTap === 'function') {\n (props.onDoubleTap as () => void)();\n return;\n }\n\n // Fall back to calling press twice\n if (typeof props.onPress === 'function') {\n const event = this.createPressEvent();\n (props.onPress as (event: unknown) => void)(event);\n await sleep(50);\n (props.onPress as (event: unknown) => void)(event);\n return;\n }\n\n throw new Error('No press handler found for double tap');\n }\n\n /**\n * Perform type action\n */\n private async performType(\n element: ReturnType<NativeUIBridgeRegistry['getElement']>,\n props: Record<string, unknown>,\n params: TypeActionParams\n ): Promise<void> {\n if (!params?.text) {\n throw new Error('Type action requires text parameter');\n }\n\n // Clear first if requested\n if (params.clearFirst) {\n await this.performClear(element, props);\n }\n\n // Type character by character if delay specified\n if (params.delay && params.delay > 0) {\n const currentValue = (element?.getState().value || '') as string;\n for (const char of params.text) {\n const newValue = currentValue + char;\n if (typeof props.onChangeText === 'function') {\n (props.onChangeText as (text: string) => void)(newValue);\n }\n await sleep(params.delay);\n }\n } else {\n // Type all at once\n if (typeof props.onChangeText === 'function') {\n (props.onChangeText as (text: string) => void)(params.text);\n } else if (typeof props.onChange === 'function') {\n (props.onChange as (event: { nativeEvent: { text: string } }) => void)({\n nativeEvent: { text: params.text },\n });\n } else {\n throw new Error('No text change handler found on element');\n }\n }\n\n // Update element state\n if (element) {\n this.registry.updateElementState(element.id, { value: params.text });\n }\n }\n\n /**\n * Perform clear action\n */\n private async performClear(\n element: ReturnType<NativeUIBridgeRegistry['getElement']>,\n props: Record<string, unknown>\n ): Promise<void> {\n if (typeof props.onChangeText === 'function') {\n (props.onChangeText as (text: string) => void)('');\n } else if (typeof props.onChange === 'function') {\n (props.onChange as (event: { nativeEvent: { text: string } }) => void)({\n nativeEvent: { text: '' },\n });\n }\n\n // Update element state\n if (element) {\n this.registry.updateElementState(element.id, { value: '' });\n }\n }\n\n /**\n * Perform focus action\n */\n private async performFocus(\n element: ReturnType<NativeUIBridgeRegistry['getElement']>\n ): Promise<void> {\n if (element?.ref.current && 'focus' in element.ref.current) {\n (element.ref.current as { focus: () => void }).focus();\n }\n\n // Update element state\n if (element) {\n this.registry.updateElementState(element.id, { focused: true });\n }\n }\n\n /**\n * Perform blur action\n */\n private async performBlur(\n element: ReturnType<NativeUIBridgeRegistry['getElement']>\n ): Promise<void> {\n if (element?.ref.current && 'blur' in element.ref.current) {\n (element.ref.current as { blur: () => void }).blur();\n }\n\n // Update element state\n if (element) {\n this.registry.updateElementState(element.id, { focused: false });\n }\n }\n\n /**\n * Perform scroll action\n */\n private async performScroll(\n props: Record<string, unknown>,\n params?: ScrollActionParams\n ): Promise<void> {\n if (typeof props.onScroll === 'function') {\n const event = {\n nativeEvent: {\n contentOffset: params?.offset || { x: 0, y: 0 },\n },\n };\n (props.onScroll as (event: unknown) => void)(event);\n }\n }\n\n /**\n * Perform swipe action\n */\n private async performSwipe(\n props: Record<string, unknown>,\n params: SwipeActionParams\n ): Promise<void> {\n if (!params?.direction) {\n throw new Error('Swipe action requires direction parameter');\n }\n\n // Try dedicated swipe handlers\n const handlerMap: Record<string, string> = {\n left: 'onSwipeLeft',\n right: 'onSwipeRight',\n up: 'onSwipeUp',\n down: 'onSwipeDown',\n };\n\n const handler = handlerMap[params.direction];\n if (handler && typeof props[handler] === 'function') {\n (props[handler] as () => void)();\n return;\n }\n\n // Fall back to generic swipe handler\n if (typeof props.onSwipe === 'function') {\n (props.onSwipe as (direction: string) => void)(params.direction);\n }\n }\n\n /**\n * Perform toggle action\n */\n private async performToggle(props: Record<string, unknown>): Promise<void> {\n // For Switch components\n if (typeof props.onValueChange === 'function') {\n const currentValue = props.value as boolean;\n (props.onValueChange as (value: boolean) => void)(!currentValue);\n return;\n }\n\n // Fall back to press\n if (typeof props.onPress === 'function') {\n (props.onPress as () => void)();\n return;\n }\n\n throw new Error('No toggle handler found on element');\n }\n\n /**\n * Create a synthetic press event\n */\n private createPressEvent(params?: PressActionParams): object {\n return {\n nativeEvent: {\n locationX: params?.position?.x ?? 0,\n locationY: params?.position?.y ?? 0,\n timestamp: Date.now(),\n },\n persist: () => {},\n };\n }\n\n /**\n * Execute a component action\n */\n async executeComponentAction(\n componentId: string,\n request: ComponentActionRequest\n ): Promise<ComponentActionResponse> {\n const startTime = Date.now();\n\n try {\n const component = this.registry.getComponent(componentId);\n\n if (!component) {\n return {\n success: false,\n error: `Component not found: ${componentId}`,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n };\n }\n\n // Find the action\n const action = component.actions.find((a) => a.id === request.action);\n\n if (!action) {\n return {\n success: false,\n error: `Action not found: ${request.action}`,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n };\n }\n\n // Execute the action\n const result = await action.handler(request.params);\n\n return {\n success: true,\n result,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n requestId: request.requestId,\n };\n }\n }\n\n /**\n * Find elements\n */\n async find(request: NativeFindRequest): Promise<NativeFindResponse> {\n const startTime = Date.now();\n\n const allElements = this.registry.getAllElements();\n let filtered = allElements;\n\n // Filter by type\n if (request.types && request.types.length > 0) {\n filtered = filtered.filter((e) => request.types!.includes(e.type));\n }\n\n // Filter by testID pattern\n if (request.testIdPattern) {\n const regex = new RegExp(\n request.testIdPattern.replace(/\\*/g, '.*').replace(/\\?/g, '.')\n );\n filtered = filtered.filter((e) => {\n const identifier = e.getIdentifier();\n return identifier.testId && regex.test(identifier.testId);\n });\n }\n\n // Filter by accessibility label pattern\n if (request.accessibilityLabelPattern) {\n const regex = new RegExp(\n request.accessibilityLabelPattern.replace(/\\*/g, '.*').replace(/\\?/g, '.')\n );\n filtered = filtered.filter((e) => {\n const identifier = e.getIdentifier();\n return (\n identifier.accessibilityLabel && regex.test(identifier.accessibilityLabel)\n );\n });\n }\n\n // Filter by visibility\n if (request.visibleOnly) {\n filtered = filtered.filter((e) => e.getState().visible);\n }\n\n // Apply limit\n if (request.limit && request.limit > 0) {\n filtered = filtered.slice(0, request.limit);\n }\n\n // Map to discovered elements\n const elements: DiscoveredNativeElement[] = filtered.map((e) => ({\n id: e.id,\n type: e.type,\n identifier: e.getIdentifier(),\n state: e.getState(),\n actions: e.actions,\n label: e.label,\n }));\n\n return {\n elements,\n total: elements.length,\n durationMs: Date.now() - startTime,\n timestamp: Date.now(),\n };\n }\n\n /**\n * Wait for element conditions\n */\n async waitForElement(elementId: string, options: WaitOptions): Promise<WaitResult> {\n return this.waitForElementInternal(elementId, options);\n }\n\n /**\n * Internal wait implementation\n */\n private async waitForElementInternal(\n elementId: string,\n options: WaitOptions\n ): Promise<WaitResult> {\n const opts = { ...DEFAULT_WAIT_OPTIONS, ...options };\n const startTime = Date.now();\n\n while (Date.now() - startTime < opts.timeout) {\n const element = this.registry.getElement(elementId);\n\n if (!element) {\n await sleep(opts.interval);\n continue;\n }\n\n const state = element.getState();\n\n // Check conditions\n let conditionsMet = true;\n\n if (opts.visible && !state.visible) {\n conditionsMet = false;\n }\n\n if (opts.enabled && !state.enabled) {\n conditionsMet = false;\n }\n\n if (opts.focused && !state.focused) {\n conditionsMet = false;\n }\n\n // Check custom state conditions\n if (opts.state && Object.keys(opts.state).length > 0) {\n const stateRecord = state as unknown as Record<string, unknown>;\n for (const [key, value] of Object.entries(opts.state)) {\n if (stateRecord[key] !== value) {\n conditionsMet = false;\n break;\n }\n }\n }\n\n if (conditionsMet) {\n return {\n met: true,\n waitedMs: Date.now() - startTime,\n state,\n };\n }\n\n await sleep(opts.interval);\n }\n\n return {\n met: false,\n waitedMs: Date.now() - startTime,\n error: `Timeout waiting for conditions on element: ${elementId}`,\n };\n }\n}\n\n/**\n * Create a native action executor\n */\nexport function createNativeActionExecutor(\n registry: NativeUIBridgeRegistry\n): NativeActionExecutor {\n return new DefaultNativeActionExecutor(registry);\n}\n"]}