@qontinui/ui-bridge-native 0.6.12 → 0.6.14
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.
- package/README.md +36 -16
- package/dist/control/action-executor.d.ts +42 -2
- package/dist/control/action-executor.d.ts.map +1 -1
- package/dist/control/index.js +723 -4
- package/dist/control/index.js.map +1 -1
- package/dist/control/index.mjs +723 -5
- package/dist/control/index.mjs.map +1 -1
- package/dist/control/types.d.ts +82 -1
- package/dist/control/types.d.ts.map +1 -1
- package/dist/core/abortable.d.ts +151 -0
- package/dist/core/abortable.d.ts.map +1 -0
- package/dist/core/action-effect.d.ts +74 -0
- package/dist/core/action-effect.d.ts.map +1 -0
- package/dist/core/element-actions.d.ts +38 -0
- package/dist/core/element-actions.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +756 -15
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +738 -16
- package/dist/core/index.mjs.map +1 -1
- package/dist/core/param-schema.d.ts +282 -0
- package/dist/core/param-schema.d.ts.map +1 -0
- package/dist/core/registry.d.ts +272 -2
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/types.d.ts +231 -32
- package/dist/core/types.d.ts.map +1 -1
- package/dist/debug/index.js.map +1 -1
- package/dist/debug/index.mjs.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1568 -135
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1550 -136
- package/dist/index.mjs.map +1 -1
- package/dist/react/UIBridgeNativeProvider.d.ts +18 -24
- package/dist/react/UIBridgeNativeProvider.d.ts.map +1 -1
- package/dist/react/index.js +1385 -130
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +1385 -130
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/useUIBridge.d.ts +19 -22
- package/dist/react/useUIBridge.d.ts.map +1 -1
- package/dist/react/useUIComponent.d.ts +113 -8
- package/dist/react/useUIComponent.d.ts.map +1 -1
- package/dist/react/useUIElement.d.ts +34 -8
- package/dist/react/useUIElement.d.ts.map +1 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/http-server.d.ts +15 -2
- package/dist/server/http-server.d.ts.map +1 -1
- package/dist/server/index.js +345 -43
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +345 -44
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/observability.d.ts +40 -0
- package/dist/server/observability.d.ts.map +1 -1
- package/dist/server/types.d.ts +57 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/transport/CloudRelayClient.d.ts.map +1 -1
- package/dist/transport/DeviceAnnouncer.d.ts +35 -7
- package/dist/transport/DeviceAnnouncer.d.ts.map +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/relay-logging.d.ts +50 -0
- package/dist/transport/relay-logging.d.ts.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@ UI Bridge framework for React Native applications. Enables AI-driven UI automati
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install ui-bridge-native
|
|
8
|
+
npm install @qontinui/ui-bridge-native
|
|
9
9
|
# or
|
|
10
|
-
yarn add ui-bridge-native
|
|
10
|
+
yarn add @qontinui/ui-bridge-native
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
@@ -16,7 +16,7 @@ yarn add ui-bridge-native
|
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
// app/_layout.tsx or App.tsx
|
|
19
|
-
import { UIBridgeNativeProvider } from 'ui-bridge-native';
|
|
19
|
+
import { UIBridgeNativeProvider } from '@qontinui/ui-bridge-native';
|
|
20
20
|
|
|
21
21
|
export default function RootLayout() {
|
|
22
22
|
return (
|
|
@@ -33,7 +33,7 @@ export default function RootLayout() {
|
|
|
33
33
|
### 2. Use hooks in your components
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
import { useUIElement } from 'ui-bridge-native';
|
|
36
|
+
import { useUIElement } from '@qontinui/ui-bridge-native';
|
|
37
37
|
|
|
38
38
|
function SubmitButton({ onPress }) {
|
|
39
39
|
const { ref, onLayout, bridgeProps } = useUIElement({
|
|
@@ -180,6 +180,7 @@ await executeAction('submit-button', { action: 'press' });
|
|
|
180
180
|
- `focus` - Focus element
|
|
181
181
|
- `blur` - Blur element
|
|
182
182
|
- `scroll` - Scroll
|
|
183
|
+
- `scrollIntoView` - Scroll the element's declared `scrollAncestorId` container (vertical ScrollView / FlatList) so the element is on screen; advertised only on elements that declare one
|
|
183
184
|
- `swipe` - Swipe gesture
|
|
184
185
|
- `toggle` - Toggle switch/checkbox
|
|
185
186
|
|
|
@@ -196,16 +197,35 @@ The package includes an embedded HTTP server for external control. Configure wit
|
|
|
196
197
|
|
|
197
198
|
### API Endpoints
|
|
198
199
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
200
|
+
The bridge serves **56** method+path pairs. Two of them tell you about the other
|
|
201
|
+
54, so this README does not try to be the list — it went stale at 7 rows while
|
|
202
|
+
the surface grew, and a partial table read as a complete one is worse than no
|
|
203
|
+
table:
|
|
204
|
+
|
|
205
|
+
| Method | Path | Description |
|
|
206
|
+
| ------ | --------------------- | ------------------------------------------------------------ |
|
|
207
|
+
| GET | `/ui-bridge/_routes` | Every mounted route as `{method, path}` — ask the live server |
|
|
208
|
+
| GET | `/ui-bridge/_help` | The same list plus per-handler descriptions, actions and tips |
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
curl -s http://localhost:8087/ui-bridge/_routes | jq '.data.routes'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Statically, the same contract is the exported `UI_BRIDGE_NATIVE_ROUTES`:
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import { UI_BRIDGE_NATIVE_ROUTES } from '@qontinui/ui-bridge-native';
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Entries carrying `requiresTestHooks: true` are mounted only when the server
|
|
221
|
+
config sets `testHooks`; a production build answers those with a plain 404.
|
|
222
|
+
`route-table-parity.test.ts` pins the exported table against `_routes` in both
|
|
223
|
+
directions, and separately at `testHooks: false`, so neither can drift from the
|
|
224
|
+
router.
|
|
225
|
+
|
|
226
|
+
A wrong verb on a path the bridge does publish answers **405** with an `Allow`
|
|
227
|
+
header naming the verbs it accepts (and the same verbs in the JSON envelope's
|
|
228
|
+
`error`); a path it does not publish answers **404**.
|
|
209
229
|
|
|
210
230
|
### Custom Server Adapter
|
|
211
231
|
|
|
@@ -219,7 +239,7 @@ The HTTP server requires a platform-specific adapter. See [documentation](./docs
|
|
|
219
239
|
Built-in visual inspector for development:
|
|
220
240
|
|
|
221
241
|
```tsx
|
|
222
|
-
import { UIBridgeInspector } from 'ui-bridge-native/debug';
|
|
242
|
+
import { UIBridgeInspector } from '@qontinui/ui-bridge-native/debug';
|
|
223
243
|
|
|
224
244
|
function App() {
|
|
225
245
|
return (
|
|
@@ -236,7 +256,7 @@ function App() {
|
|
|
236
256
|
Full TypeScript support included. Import types as needed:
|
|
237
257
|
|
|
238
258
|
```tsx
|
|
239
|
-
import type { NativeElementState, NativeElementType, UseUIElementOptions } from 'ui-bridge-native';
|
|
259
|
+
import type { NativeElementState, NativeElementType, UseUIElementOptions } from '@qontinui/ui-bridge-native';
|
|
240
260
|
```
|
|
241
261
|
|
|
242
262
|
## License
|
|
@@ -7,7 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { NativeUIBridgeRegistry } from '../core/registry';
|
|
9
9
|
import type { NativeFindRequest, NativeFindResponse, WaitOptions } from '../core/types';
|
|
10
|
-
import type { ControlActionRequest, ControlActionResponse, ComponentActionRequest, ComponentActionResponse, WaitResult, NativeActionExecutor, NativeActionListener } from './types';
|
|
10
|
+
import type { ControlActionRequest, ControlActionResponse, ComponentActionRequest, ComponentActionResponse, ComponentActionInvokeOptions, WaitResult, NativeActionExecutor, NativeActionListener } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* An action failure that carries a machine-readable code of its own, so the
|
|
13
|
+
* HTTP handler can report it as that code instead of the generic
|
|
14
|
+
* `ACTION_FAILED`. Used for `NOT_SUPPORTED` — "this element cannot do that",
|
|
15
|
+
* which a caller must not retry with a different request shape.
|
|
16
|
+
*/
|
|
17
|
+
export declare class NativeActionError extends Error {
|
|
18
|
+
readonly code: string;
|
|
19
|
+
constructor(message: string, code: string);
|
|
20
|
+
}
|
|
11
21
|
/**
|
|
12
22
|
* Default native action executor implementation
|
|
13
23
|
*/
|
|
@@ -73,6 +83,36 @@ export declare class DefaultNativeActionExecutor implements NativeActionExecutor
|
|
|
73
83
|
* Perform scroll action
|
|
74
84
|
*/
|
|
75
85
|
private performScroll;
|
|
86
|
+
/**
|
|
87
|
+
* Perform scrollIntoView: scroll the element's DECLARED scroll container so
|
|
88
|
+
* the element sits `padding` dp below the top of its viewport.
|
|
89
|
+
*
|
|
90
|
+
* The container comes from `scrollAncestorId` and nowhere else — the
|
|
91
|
+
* registry keeps no parent chain (`RegisterElementOptions.scrollAncestorId`),
|
|
92
|
+
* so there is no "nearest ScrollView" to find. Nothing here tracks a
|
|
93
|
+
* ScrollView's content offset either (`performScroll` only fakes an
|
|
94
|
+
* `onScroll` event), so the target is measured CONTENT-relative with
|
|
95
|
+
* `measureLayout` against the container's inner content view: stateless,
|
|
96
|
+
* and immune to a stale-offset race.
|
|
97
|
+
*
|
|
98
|
+
* Result shape mirrors the web executor's `scrollIntoView`
|
|
99
|
+
* (`@qontinui/ui-bridge` `control/action-executor.ts`):
|
|
100
|
+
* `{ alreadyVisible, scrolled }`, short-circuiting when the element is
|
|
101
|
+
* already fully inside its clip region. "Fully visible" is only claimed when
|
|
102
|
+
* it is MEASURED — a page-space rect for the element and a known,
|
|
103
|
+
* non-empty clip (window ∩ declared container), both measured at call
|
|
104
|
+
* time. Anything unknown scrolls.
|
|
105
|
+
*
|
|
106
|
+
* Containers: a ScrollView, or a VirtualizedList (FlatList / SectionList)
|
|
107
|
+
* unwrapped through `getNativeScrollRef()` / `getScrollResponder()`.
|
|
108
|
+
* Vertical only — a `horizontal` container is NOT_SUPPORTED. The action
|
|
109
|
+
* returns once `scrollTo` is dispatched; positions settle on the next frame.
|
|
110
|
+
*
|
|
111
|
+
* Prerequisites are checked BEFORE the visibility short-circuit, so whether
|
|
112
|
+
* the element supports the action does not depend on where it happens to be
|
|
113
|
+
* on screen. Each missing prerequisite is a `NOT_SUPPORTED` failure.
|
|
114
|
+
*/
|
|
115
|
+
private performScrollIntoView;
|
|
76
116
|
/**
|
|
77
117
|
* Perform swipe action
|
|
78
118
|
*/
|
|
@@ -88,7 +128,7 @@ export declare class DefaultNativeActionExecutor implements NativeActionExecutor
|
|
|
88
128
|
/**
|
|
89
129
|
* Execute a component action
|
|
90
130
|
*/
|
|
91
|
-
executeComponentAction(componentId: string, request: ComponentActionRequest): Promise<ComponentActionResponse>;
|
|
131
|
+
executeComponentAction(componentId: string, request: ComponentActionRequest, options?: ComponentActionInvokeOptions): Promise<ComponentActionResponse>;
|
|
92
132
|
/**
|
|
93
133
|
* Find elements
|
|
94
134
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-executor.d.ts","sourceRoot":"","sources":["../../src/control/action-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EAElB,WAAW,EACZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"action-executor.d.ts","sourceRoot":"","sources":["../../src/control/action-executor.ts"],"names":[],"mappings":"AAAA;;;;;;G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