@qontinui/ui-bridge-native 0.5.1 → 0.6.2

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.
@@ -4,14 +4,33 @@
4
4
  * Register a native element with UI Bridge for control and observation.
5
5
  */
6
6
  import type { NativeElementType, NativeStandardAction, NativeCustomAction, NativeElementState, NativeElementIdentifier, RegisteredNativeElement, NativeElementRef } from '../core/types';
7
+ type AnyHandler = (...args: any[]) => any;
7
8
  /**
8
- * useUIElement options
9
+ * A press handler for `button`/`pressable` types. Matches the loose RN
10
+ * `Pressable` `onPress` shape (no required argument), so consumers can pass
11
+ * either a no-arg callback or one that consumes the gesture event.
9
12
  */
10
- export interface UseUIElementOptions {
13
+ export type PressHandler = (event?: unknown) => void;
14
+ /**
15
+ * Element types that require a press handler at registration. The TS
16
+ * signature on `useUIElement` rejects these types unless `handlers.onPress`
17
+ * is provided in options.
18
+ *
19
+ * Picked from the action-executor in `control/action-executor.ts` — the
20
+ * `press` action looks up `props.onPress` (or `onPressIn` /
21
+ * `onResponderRelease`); registering a button without one is a guaranteed
22
+ * dead-button per the 2026-05-20 manual-test session.
23
+ */
24
+ export type PressNeedingNativeElementType = 'button' | 'pressable';
25
+ /**
26
+ * Base options for `useUIElement`. The discriminated union below layers
27
+ * `handlers` requirements on top of this — see {@link UseUIElementOptions}.
28
+ */
29
+ export interface UseUIElementOptionsBase<T extends NativeElementType = NativeElementType> {
11
30
  /** Unique identifier for the element */
12
31
  id: string;
13
32
  /** Element type (defaults to 'custom') */
14
- type?: NativeElementType;
33
+ type?: T;
15
34
  /** Human-readable label */
16
35
  label?: string;
17
36
  /** Override available actions */
@@ -32,10 +51,24 @@ export interface UseUIElementOptions {
32
51
  focused?: unknown;
33
52
  disabled?: unknown;
34
53
  };
54
+ }
55
+ /**
56
+ * Options shape for press-needing types — `handlers.onPress` is REQUIRED.
57
+ * Registering a `button`/`pressable` without an `onPress` produces a
58
+ * "No press handler found on element" error when the bridge fires
59
+ * `POST /control/element/:id/action {"action":"press"}`. Phase 1 of plan
60
+ * `2026-05-20-manual-test-remediation` makes that a compile-time error.
61
+ *
62
+ * Consumers that wire `onPress` lazily (e.g. computed from props during
63
+ * render) should use {@link useUIElementWithProps} + `captureProps({ onPress })`
64
+ * instead. The runtime guard in this hook also warns once per id when
65
+ * `onPress` never reaches the registry.
66
+ */
67
+ export interface UseUIElementOptionsHandlersRequired<T extends PressNeedingNativeElementType = PressNeedingNativeElementType> extends UseUIElementOptionsBase<T> {
35
68
  /**
36
69
  * Handler props to auto-register with the bridge for action execution.
37
- * When provided, the bridge can invoke these handlers via press/type/toggle actions
38
- * without the component needing a separate useEffect + updateElementProps call.
70
+ * For `button`/`pressable`, `onPress` is required — UI Bridge invokes it
71
+ * when a `press` action is dispatched.
39
72
  *
40
73
  * @example
41
74
  * ```tsx
@@ -46,8 +79,32 @@ export interface UseUIElementOptions {
46
79
  * });
47
80
  * ```
48
81
  */
49
- handlers?: Record<string, ((...args: any[]) => any) | undefined>;
82
+ handlers: {
83
+ /** Required — UI Bridge invokes this on `press`/`click` actions. */
84
+ onPress: PressHandler;
85
+ /** Additional handlers (`onLongPress`, `onPressIn`, etc.) */
86
+ [key: string]: AnyHandler | undefined;
87
+ };
88
+ }
89
+ /**
90
+ * Options shape for non-press-needing types — `handlers` is optional.
91
+ * Applies to `input`, `text`, `view`, `list`, etc. — anything where a
92
+ * missing `onPress` doesn't indicate a dead button.
93
+ */
94
+ export interface UseUIElementOptionsHandlersOptional<T extends NativeElementType = NativeElementType> extends UseUIElementOptionsBase<T> {
95
+ /**
96
+ * Handler props to auto-register with the bridge for action execution.
97
+ * Optional for non-press-needing types.
98
+ */
99
+ handlers?: Record<string, AnyHandler | undefined>;
50
100
  }
101
+ /**
102
+ * useUIElement options — discriminated union over element type.
103
+ *
104
+ * For `type: 'button' | 'pressable'`, `handlers.onPress` is required.
105
+ * For all other types, `handlers` is optional.
106
+ */
107
+ export type UseUIElementOptions<T extends NativeElementType = NativeElementType> = T extends PressNeedingNativeElementType ? UseUIElementOptionsHandlersRequired<T> : UseUIElementOptionsHandlersOptional<T>;
51
108
  /**
52
109
  * Bridge props to spread onto the component
53
110
  */
@@ -96,35 +153,27 @@ export interface UseUIElementReturn {
96
153
  focused?: unknown;
97
154
  disabled?: unknown;
98
155
  }) => void;
156
+ /**
157
+ * Re-publish the element's label (and the mirrored `accessibilityLabel` /
158
+ * `testId` so spec-check and a11y stay in sync). Idempotent — no-op when
159
+ * the new label equals the current registered value.
160
+ *
161
+ * Labels passed via `useUIElement({ id, label })` are captured ONCE at
162
+ * registration; if the source state changes (e.g. a tab's active suffix,
163
+ * or a list's "N events" count), the registry would otherwise hold the
164
+ * mount-time label forever. Call `updateLabel(...)` from a `useEffect`
165
+ * (or directly from a handler) to keep the registry in sync.
166
+ *
167
+ * @example
168
+ * ```tsx
169
+ * const label = `${events.length} events`;
170
+ * const { updateLabel } = useUIElement({ id: 'events-list', label, type: 'list' });
171
+ * useEffect(() => { updateLabel(label); }, [label, updateLabel]);
172
+ * ```
173
+ */
174
+ updateLabel: (newLabel: string) => void;
99
175
  }
100
- /**
101
- * useUIElement hook for React Native
102
- *
103
- * Registers a native element with UI Bridge for programmatic control.
104
- *
105
- * @example
106
- * ```tsx
107
- * function SubmitButton() {
108
- * const { ref, onLayout, bridgeProps, trigger } = useUIElement({
109
- * id: 'submit-btn',
110
- * type: 'button',
111
- * label: 'Submit Form',
112
- * });
113
- *
114
- * return (
115
- * <Pressable
116
- * ref={ref}
117
- * onLayout={onLayout}
118
- * {...bridgeProps}
119
- * onPress={() => handleSubmit()}
120
- * >
121
- * <Text>Submit</Text>
122
- * </Pressable>
123
- * );
124
- * }
125
- * ```
126
- */
127
- export declare function useUIElement(options: UseUIElementOptions): UseUIElementReturn;
176
+ export declare function useUIElement<T extends NativeElementType = NativeElementType>(options: UseUIElementOptions<T>): UseUIElementReturn;
128
177
  /**
129
178
  * useUIElementWithProps hook
130
179
  *
@@ -158,5 +207,13 @@ export interface UseUIElementWithPropsReturn extends UseUIElementReturn {
158
207
  /** Capture props for action execution */
159
208
  captureProps: (props: Record<string, unknown>) => void;
160
209
  }
161
- export declare function useUIElementWithProps(options: UseUIElementOptions): UseUIElementWithPropsReturn;
210
+ /**
211
+ * Loose options for `useUIElementWithProps` — `handlers` is optional for ALL
212
+ * element types because the consumer will later call `captureProps({ onPress,
213
+ * ... })` from the render body. The runtime warning in {@link useUIElement}
214
+ * still backstops the "captured but never called with onPress" case.
215
+ */
216
+ export type UseUIElementWithPropsOptions<T extends NativeElementType = NativeElementType> = UseUIElementOptionsHandlersOptional<T>;
217
+ export declare function useUIElementWithProps<T extends NativeElementType = NativeElementType>(options: UseUIElementWithPropsOptions<T>): UseUIElementWithPropsReturn;
218
+ export {};
162
219
  //# sourceMappingURL=useUIElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUIElement.d.ts","sourceRoot":"","sources":["../../src/react/useUIElement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AA2DvB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACjC,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACnD,iDAAiD;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;I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AQ,EAAE,oBAAoB,EAC9B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,oBAAoB,CAEtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG"}
@@ -141,6 +141,31 @@ var UI_BRIDGE_NATIVE_ROUTES = {
141
141
  path: "/ui-bridge/ai/fill-form",
142
142
  description: "Fill multiple input elements in a single call"
143
143
  },
144
+ // AI helpers (NOT_SUPPORTED stubs) — these endpoints exist on the runner-side
145
+ // UI Bridge surface but have no analog on mobile React Native. The mobile
146
+ // bridge registers explicit stubs so callers get a structured NOT_SUPPORTED
147
+ // envelope instead of a confusing HTTP 404. The mobile bridge's snapshot +
148
+ // `/control/find` already cover what an operator would reach for these for.
149
+ AI_FORMS: {
150
+ method: "GET",
151
+ path: "/ui-bridge/ai/forms",
152
+ description: "Discover forms (runner-only; mobile returns NOT_SUPPORTED)"
153
+ },
154
+ AI_IDLE_STATUS: {
155
+ method: "GET",
156
+ path: "/ui-bridge/ai/idle-status",
157
+ description: "Get page-idle signal (runner-only; mobile returns NOT_SUPPORTED)"
158
+ },
159
+ AI_CHANGE_BUFFER_ENABLE: {
160
+ method: "POST",
161
+ path: "/ui-bridge/ai/change-buffer/enable",
162
+ description: "Enable DOM change buffer (runner-only; mobile returns NOT_SUPPORTED)"
163
+ },
164
+ AI_WAIT_FOR_ELEMENT: {
165
+ method: "POST",
166
+ path: "/ui-bridge/ai/wait-for-element",
167
+ description: "Wait for element predicate via HTTP (runner-only; mobile returns NOT_SUPPORTED \u2014 use WS waitForElement instead)"
168
+ },
144
169
  // Test hooks — drive ModalDetector state from outside the React tree
145
170
  // (gated by `features.testHooks`). Mirrors `pushModal` / `dismissModal`
146
171
  // calls that components normally make in-process.
@@ -847,22 +872,25 @@ function createServerHandlers(registry, executor, config) {
847
872
  getElements: async (ctx) => {
848
873
  const visibleOnly = ctx.query?.visibleOnly === "true" || ctx.body?.visibleOnly === true;
849
874
  const forRoute = ctx.query?.route || ctx.body?.route;
850
- let allElements = visibleOnly ? registry.getVisibleElements() : registry.getAllElements();
875
+ let allElements = visibleOnly ? registry.getMountedVisibleElements() : registry.getAllElements();
851
876
  if (forRoute) {
852
877
  allElements = allElements.filter((e) => e.registrationRoute === forRoute);
853
878
  }
854
879
  const elements = allElements.map((e) => {
855
880
  const handlers = extractHandlerNames(e.props);
881
+ const state = e.getState();
882
+ const visibility = !state.visible ? "hidden" : state.layout !== null ? "visible" : "likely-visible";
856
883
  return {
857
884
  id: e.id,
858
885
  type: e.type,
859
886
  label: e.label,
860
887
  identifier: e.getIdentifier(),
861
- state: e.getState(),
888
+ state,
862
889
  actions: e.actions,
863
890
  customActions: e.customActions ? Object.keys(e.customActions) : void 0,
864
891
  registeredHandlers: handlers.length > 0 ? handlers : void 0,
865
- registrationRoute: e.registrationRoute
892
+ registrationRoute: e.registrationRoute,
893
+ visibility
866
894
  };
867
895
  });
868
896
  return success2({ elements });
@@ -1125,6 +1153,37 @@ function createServerHandlers(registry, executor, config) {
1125
1153
  "NOT_SUPPORTED"
1126
1154
  );
1127
1155
  },
1156
+ // AI helpers — runner-only endpoints that have no React Native analog.
1157
+ //
1158
+ // The mobile bridge mounts explicit NOT_SUPPORTED stubs at the runner's
1159
+ // cheatsheet paths so callers (and the /manual-test skill in particular)
1160
+ // get a structured envelope explaining the gap rather than a confusing
1161
+ // HTTP 404. Each error message names an in-tree mobile replacement so
1162
+ // operators aren't left guessing what to use instead.
1163
+ aiForms: async () => {
1164
+ return error2(
1165
+ 'ai/forms (form discovery) is runner-only; mobile React Native has no DOM to walk. Use GET /ui-bridge/control/snapshot and filter for type === "input" instead.',
1166
+ "NOT_SUPPORTED"
1167
+ );
1168
+ },
1169
+ aiIdleStatus: async () => {
1170
+ return error2(
1171
+ 'ai/idle-status (page-idle signal) is runner-only; mobile React Native has no DOM-mutation / network-idle signals. Use the registry event stream (WS subscribe to "element:registered"/"element:stateChanged") or poll /control/snapshot for stability.',
1172
+ "NOT_SUPPORTED"
1173
+ );
1174
+ },
1175
+ aiChangeBufferEnable: async () => {
1176
+ return error2(
1177
+ 'ai/change-buffer (DOM mutation diff buffer) is runner-only; mobile React Native has no DOM. Use the WS event bridge (subscribe to "element:registered"/"element:unregistered"/"element:stateChanged") for change notifications.',
1178
+ "NOT_SUPPORTED"
1179
+ );
1180
+ },
1181
+ aiWaitForElement: async () => {
1182
+ return error2(
1183
+ 'POST /ai/wait-for-element is runner-only on mobile. Use the WS "waitForElement" JSON-RPC method or "waitForCondition" instead \u2014 same semantics, no HTTP polling overhead.',
1184
+ "NOT_SUPPORTED"
1185
+ );
1186
+ },
1128
1187
  // Meta / Introspection (stub — server constructor overrides with real route table)
1129
1188
  getMethods: async () => {
1130
1189
  return error2("Methods introspection not configured", "NOT_SUPPORTED");
@@ -1780,6 +1839,24 @@ var WS_ROUTES = [
1780
1839
  { pattern: "meta/methods", handler: "getMethods", httpMethods: ["GET"] },
1781
1840
  // AI helpers — mobile parity with the runner's `/ui-bridge/ai/*` family.
1782
1841
  { pattern: "ai/fill-form", handler: "fillForm", httpMethods: ["POST"] },
1842
+ // AI helpers — NOT_SUPPORTED stubs. These endpoints exist on the runner-side
1843
+ // UI Bridge surface (and the /manual-test skill's cheatsheet documents them
1844
+ // as if they're universally available). Mobile React Native has no DOM, so
1845
+ // the mobile bridge mounts explicit stubs so callers get a structured
1846
+ // NOT_SUPPORTED envelope (with a hint pointing at the mobile-native
1847
+ // replacement) instead of a confusing HTTP 404.
1848
+ { pattern: "ai/forms", handler: "aiForms", httpMethods: ["GET"] },
1849
+ { pattern: "ai/idle-status", handler: "aiIdleStatus", httpMethods: ["GET"] },
1850
+ {
1851
+ pattern: "ai/change-buffer/enable",
1852
+ handler: "aiChangeBufferEnable",
1853
+ httpMethods: ["POST"]
1854
+ },
1855
+ {
1856
+ pattern: "ai/wait-for-element",
1857
+ handler: "aiWaitForElement",
1858
+ httpMethods: ["POST"]
1859
+ },
1783
1860
  // Coord-based tap — synthesizes a press at the given screen coords by
1784
1861
  // matching against registered elements' layout rects.
1785
1862
  { pattern: "control/tap", handler: "tapAt", httpMethods: ["POST"] },
@@ -1852,6 +1929,10 @@ var HANDLER_DESCRIPTIONS = {
1852
1929
  diffBaseline: "Diff current UI against a saved baseline",
1853
1930
  getMethods: "List every handler name (legacy introspection)",
1854
1931
  fillForm: "Fill multiple inputs in one call: body { fields: [{elementId, value}] } \u2014 each field dispatches `type` + `clear:true`",
1932
+ aiForms: 'STUB \u2014 runner-only; mobile returns NOT_SUPPORTED. Use /control/snapshot + filter type==="input" instead.',
1933
+ aiIdleStatus: "STUB \u2014 runner-only; mobile returns NOT_SUPPORTED. Subscribe to registry events over WS for change signals.",
1934
+ aiChangeBufferEnable: "STUB \u2014 runner-only; mobile returns NOT_SUPPORTED. Use WS event subscriptions for change notifications.",
1935
+ aiWaitForElement: "STUB \u2014 runner-only; mobile returns NOT_SUPPORTED. Use the WS waitForElement / waitForCondition JSON-RPC methods.",
1855
1936
  tapAt: "Synthesize a press at given screen coords by matching registered element layout rects: body { x, y, action? }",
1856
1937
  getConsoleErrors: "TEST HOOK \u2014 last-N console.error/console.warn entries; ?since=<ms>&limit=<n>",
1857
1938
  getNetworkRequests: "TEST HOOK \u2014 last-N fetch/XHR entries with status + duration; ?since=<ms>&limit=<n>",