@qontinui/ui-bridge-native 0.3.1 → 0.4.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.
- package/dist/control/{index.d.mts → action-executor.d.ts} +6 -10
- package/dist/control/action-executor.d.ts.map +1 -0
- package/dist/control/index.d.ts +5 -95
- package/dist/control/index.d.ts.map +1 -0
- package/dist/{types-CjEKTDYT.d.ts → control/types.d.ts} +17 -20
- package/dist/control/types.d.ts.map +1 -0
- package/dist/core/element-identifier.d.ts +41 -0
- package/dist/core/element-identifier.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -43
- package/dist/core/index.d.ts.map +1 -0
- package/dist/{registry-pAUpQq2O.d.ts → core/registry.d.ts} +10 -13
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/{types-CGVut7mc.d.mts → core/types.d.ts} +41 -41
- package/dist/core/types.d.ts.map +1 -0
- package/dist/debug/index.d.ts +4 -44
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +1 -1
- package/dist/debug/index.js.map +1 -1
- package/dist/debug/index.mjs +2 -2
- package/dist/debug/index.mjs.map +1 -1
- package/dist/debug/{index.d.mts → inspector.d.ts} +3 -6
- package/dist/debug/inspector.d.ts.map +1 -0
- package/dist/design/{index.d.mts → design-inspector-native.d.ts} +7 -11
- package/dist/design/design-inspector-native.d.ts.map +1 -0
- package/dist/{design-types-BHr6Q1FX.d.mts → design/design-types.d.ts} +10 -11
- package/dist/design/design-types.d.ts.map +1 -0
- package/dist/design/index.d.ts +5 -60
- package/dist/design/index.d.ts.map +1 -0
- package/dist/index.d.ts +37 -86
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal/modal-detector.d.ts +29 -0
- package/dist/modal/modal-detector.d.ts.map +1 -0
- package/dist/react/StateAnnotation.d.ts +30 -0
- package/dist/react/StateAnnotation.d.ts.map +1 -0
- package/dist/react/UIBridgeNativeProvider.d.ts +156 -0
- package/dist/react/UIBridgeNativeProvider.d.ts.map +1 -0
- package/dist/react/index.d.ts +14 -69
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +3 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +4 -4
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/{index.d.mts → useAutoRegister.d.ts} +7 -15
- package/dist/react/useAutoRegister.d.ts.map +1 -0
- package/dist/react/useUIBridge.d.ts +103 -0
- package/dist/react/useUIBridge.d.ts.map +1 -0
- package/dist/react/useUIBridgeModal.d.ts +14 -0
- package/dist/react/useUIBridgeModal.d.ts.map +1 -0
- package/dist/react/useUIBridgeToast.d.ts +25 -0
- package/dist/react/useUIBridgeToast.d.ts.map +1 -0
- package/dist/react/useUIComponent.d.ts +112 -0
- package/dist/react/useUIComponent.d.ts.map +1 -0
- package/dist/react/useUIElement.d.ts +162 -0
- package/dist/react/useUIElement.d.ts.map +1 -0
- package/dist/server/design-handlers.d.ts +47 -0
- package/dist/server/design-handlers.d.ts.map +1 -0
- package/dist/server/handlers.d.ts +25 -0
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/http-server.d.ts +262 -0
- package/dist/server/http-server.d.ts.map +1 -0
- package/dist/server/index.d.ts +14 -176
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/observability.d.ts +55 -0
- package/dist/server/observability.d.ts.map +1 -0
- package/dist/server/types.d.ts +368 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/ws-connection.d.ts +48 -0
- package/dist/server/ws-connection.d.ts.map +1 -0
- package/dist/server/ws-event-bridge.d.ts +113 -0
- package/dist/server/ws-event-bridge.d.ts.map +1 -0
- package/dist/server/ws-protocol.d.ts +48 -0
- package/dist/server/ws-protocol.d.ts.map +1 -0
- package/dist/server/ws-types.d.ts +65 -0
- package/dist/server/ws-types.d.ts.map +1 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/toast-capture.d.ts +27 -0
- package/dist/toast/toast-capture.d.ts.map +1 -0
- package/dist/transport/CloudRelayClient.d.ts +51 -0
- package/dist/transport/CloudRelayClient.d.ts.map +1 -0
- package/dist/transport/DeviceAnnouncer.d.ts +75 -0
- package/dist/transport/DeviceAnnouncer.d.ts.map +1 -0
- package/dist/transport/index.d.ts +3 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/logger.d.ts +23 -0
- package/dist/transport/logger.d.ts.map +1 -0
- package/dist/undo/index.d.ts +3 -0
- package/dist/undo/index.d.ts.map +1 -0
- package/dist/undo/undo-tracker.d.ts +59 -0
- package/dist/undo/undo-tracker.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/StateAnnotation--zm0Jfqj.d.ts +0 -755
- package/dist/StateAnnotation-BgFoVWFy.d.mts +0 -755
- package/dist/core/index.d.mts +0 -46
- package/dist/design-types-BHr6Q1FX.d.ts +0 -205
- package/dist/http-server--550eD1F.d.mts +0 -805
- package/dist/http-server-C9NaNBEP.d.ts +0 -805
- package/dist/index.d.mts +0 -89
- package/dist/registry-B5JadBN9.d.mts +0 -300
- package/dist/server/index.d.mts +0 -178
- package/dist/types-B0XA4vOF.d.mts +0 -197
- package/dist/types-CGVut7mc.d.ts +0 -567
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NativeCapturedToast, NativeSnapshotToastContext } from '../core/types';
|
|
2
|
+
export interface ToastRecordInput {
|
|
3
|
+
id: string;
|
|
4
|
+
message: string;
|
|
5
|
+
level?: NativeCapturedToast['level'];
|
|
6
|
+
appearedAt?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastCaptureConfig {
|
|
9
|
+
maxRecent?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Declarative toast/snackbar tracker. Components call recordToast/dismissToast
|
|
13
|
+
* directly — there is no DOM/tree scanner. The active map plus a fixed-size
|
|
14
|
+
* recent ring buffer feed the snapshot's toasts context.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ToastCapture {
|
|
17
|
+
private active;
|
|
18
|
+
private recent;
|
|
19
|
+
private totalCaptured;
|
|
20
|
+
private maxRecent;
|
|
21
|
+
constructor(config?: ToastCaptureConfig);
|
|
22
|
+
recordToast(toast: ToastRecordInput): void;
|
|
23
|
+
dismissToast(id: string): void;
|
|
24
|
+
getSnapshotToastContext(): NativeSnapshotToastContext;
|
|
25
|
+
clear(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=toast-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-capture.d.ts","sourceRoot":"","sources":["../../src/toast/toast-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,GAAE,kBAAuB;IAI3C,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAiB1C,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAmB9B,uBAAuB,IAAI,0BAA0B;IAarD,KAAK,IAAI,IAAI;CAKd"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud Relay Client — WebSocket tunnel from mobile device to backend
|
|
3
|
+
*
|
|
4
|
+
* Maintains a persistent WebSocket connection to the qontinui.io backend.
|
|
5
|
+
* Receives tunneled HTTP requests from runners, calls the local NativeUIBridgeServer,
|
|
6
|
+
* and sends responses back through the tunnel.
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeUIBridgeServer } from '../server/http-server';
|
|
9
|
+
export interface CloudRelayConfig {
|
|
10
|
+
/** WebSocket URL for the device bridge endpoint */
|
|
11
|
+
relayUrl: string;
|
|
12
|
+
/** Stable device identifier */
|
|
13
|
+
deviceId: string;
|
|
14
|
+
/** Authentication token */
|
|
15
|
+
authToken: string;
|
|
16
|
+
/** Reference to the local UI Bridge server for processing requests */
|
|
17
|
+
uiBridgeServer: NativeUIBridgeServer;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Manages a WebSocket tunnel from the mobile device to the qontinui.io backend.
|
|
21
|
+
*
|
|
22
|
+
* When a runner sends an HTTP request to a cloud device it is serialised as a
|
|
23
|
+
* `TunnelRequest` JSON frame by the backend and forwarded here. This client
|
|
24
|
+
* deserializes it, calls `NativeUIBridgeServer.handleRequest()` directly
|
|
25
|
+
* (avoiding loopback TCP overhead), and sends the `TunnelResponse` back.
|
|
26
|
+
*/
|
|
27
|
+
export declare class CloudRelayClient {
|
|
28
|
+
private ws;
|
|
29
|
+
private config;
|
|
30
|
+
private reconnectDelay;
|
|
31
|
+
private maxReconnectDelay;
|
|
32
|
+
private stopped;
|
|
33
|
+
private _isConnected;
|
|
34
|
+
private reconnectTimer;
|
|
35
|
+
constructor(config: CloudRelayConfig);
|
|
36
|
+
/** Whether the relay WebSocket is currently connected */
|
|
37
|
+
get isConnected(): boolean;
|
|
38
|
+
/** Connect to the relay and start processing tunneled requests. */
|
|
39
|
+
start(): void;
|
|
40
|
+
/** Disconnect and stop reconnecting. */
|
|
41
|
+
stop(): void;
|
|
42
|
+
private connect;
|
|
43
|
+
private onMessage;
|
|
44
|
+
/**
|
|
45
|
+
* Process a tunneled HTTP request by calling the local NativeUIBridgeServer
|
|
46
|
+
* directly (no loopback TCP involved).
|
|
47
|
+
*/
|
|
48
|
+
private handleTunneledRequest;
|
|
49
|
+
private scheduleReconnect;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=CloudRelayClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudRelayClient.d.ts","sourceRoot":"","sources":["../../src/transport/CloudRelayClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,cAAc,EAAE,oBAAoB,CAAC;CACtC;AAoBD;;;;;;;GAOG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAA8C;gBAExD,MAAM,EAAE,gBAAgB;IAIpC,yDAAyD;IACzD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAID,mEAAmE;IACnE,KAAK,IAAI,IAAI;IAKb,wCAAwC;IACxC,IAAI,IAAI,IAAI;IAkBZ,OAAO,CAAC,OAAO;YA8CD,SAAS;IAsCvB;;;OAGG;YACW,qBAAqB;IAuCnC,OAAO,CAAC,iBAAiB;CAY1B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Announcer — mDNS + Cloud registration for physical device discovery
|
|
3
|
+
*
|
|
4
|
+
* Announces the UI Bridge service on the local network via mDNS (when
|
|
5
|
+
* react-native-zeroconf is available) and optionally registers with the
|
|
6
|
+
* cloud relay backend.
|
|
7
|
+
*/
|
|
8
|
+
export interface AnnouncerConfig {
|
|
9
|
+
/** Stable device identifier */
|
|
10
|
+
deviceId: string;
|
|
11
|
+
/** App bundle/package ID */
|
|
12
|
+
appId: string;
|
|
13
|
+
/** UI Bridge server port (default 8087) */
|
|
14
|
+
port?: number;
|
|
15
|
+
/** Cloud relay WebSocket URL for registration */
|
|
16
|
+
cloudRelayUrl?: string;
|
|
17
|
+
/** Auth token for cloud relay */
|
|
18
|
+
cloudToken?: string;
|
|
19
|
+
/** UI Bridge SDK version */
|
|
20
|
+
version?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DeviceAnnouncerState {
|
|
23
|
+
mdnsActive: boolean;
|
|
24
|
+
cloudConnected: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Minimal interface for the react-native-zeroconf Zeroconf instance */
|
|
27
|
+
interface ZeroconfService {
|
|
28
|
+
publishService(type: string, protocol: string, domain: string, name: string, port: number, txtRecord: Record<string, string>): void;
|
|
29
|
+
unpublishService(name: string): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Announces the UI Bridge server on the local network (mDNS) and optionally
|
|
33
|
+
* registers with the qontinui.io cloud relay for remote discovery.
|
|
34
|
+
*/
|
|
35
|
+
export declare class DeviceAnnouncer {
|
|
36
|
+
private config;
|
|
37
|
+
private state;
|
|
38
|
+
private cloudWs;
|
|
39
|
+
private reconnectTimer;
|
|
40
|
+
private reconnectDelay;
|
|
41
|
+
private stopped;
|
|
42
|
+
/** Zeroconf instance, set when mDNS is successfully started */
|
|
43
|
+
private zeroconf;
|
|
44
|
+
/** Rotated pairing token for mDNS TXT records */
|
|
45
|
+
private pairingToken;
|
|
46
|
+
constructor(config: AnnouncerConfig);
|
|
47
|
+
/**
|
|
48
|
+
* Start mDNS advertisement.
|
|
49
|
+
*
|
|
50
|
+
* The consumer must pass the `Zeroconf` constructor (from `react-native-zeroconf`)
|
|
51
|
+
* explicitly; otherwise this is a no-op.
|
|
52
|
+
*
|
|
53
|
+
* Rationale: Metro's `require()` throws an uncatchable module-load error if the
|
|
54
|
+
* bundle doesn't include the named package. That error escapes async try/catch
|
|
55
|
+
* boundaries and crashes the app. We avoid it by never calling `require()`
|
|
56
|
+
* ourselves — the consumer imports the package when they know it's installed.
|
|
57
|
+
*
|
|
58
|
+
* @param ZeroconfCtor - constructor from `import Zeroconf from 'react-native-zeroconf'`
|
|
59
|
+
*/
|
|
60
|
+
startMdnsAdvertise(ZeroconfCtor?: new () => ZeroconfService): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Connect to the cloud relay WebSocket and send a device_register message.
|
|
63
|
+
*
|
|
64
|
+
* Reconnects automatically with exponential backoff (2 s → 60 s) if the
|
|
65
|
+
* connection drops.
|
|
66
|
+
*/
|
|
67
|
+
connectCloudRelay(): Promise<void>;
|
|
68
|
+
/** Stop all advertising and registration. */
|
|
69
|
+
stop(): Promise<void>;
|
|
70
|
+
/** Return a copy of the current announcer state. */
|
|
71
|
+
getState(): DeviceAnnouncerState;
|
|
72
|
+
private scheduleReconnect;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=DeviceAnnouncer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceAnnouncer.d.ts","sourceRoot":"","sources":["../../src/transport/DeviceAnnouncer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wEAAwE;AACxE,UAAU,eAAe;IACvB,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,IAAI,CAAC;IACR,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAYD;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA0E;IACxF,OAAO,CAAC,KAAK,CAGX;IACF,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,OAAO,CAAS;IACxB,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAgC;IAChD,iDAAiD;IACjD,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,eAAe;IAOnC;;;;;;;;;;;;OAYG;IACG,kBAAkB,CAAC,YAAY,CAAC,EAAE,UAAU,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BjF;;;;;OAKG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IA4DxC,6CAA6C;IACvC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B3B,oDAAoD;IACpD,QAAQ,IAAI,oBAAoB;IAMhC,OAAO,CAAC,iBAAiB;CAa1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal logger for the UI Bridge Native transport layer.
|
|
3
|
+
*
|
|
4
|
+
* Wraps console so callers go through a single controlled point. Log output
|
|
5
|
+
* can be suppressed globally by setting:
|
|
6
|
+
*
|
|
7
|
+
* import { transportLogger } from './logger';
|
|
8
|
+
* transportLogger.silent = true;
|
|
9
|
+
*
|
|
10
|
+
* In production builds you can also tree-shake the verbose log() calls by
|
|
11
|
+
* checking `__DEV__` in your Metro bundler config, but the silent flag is
|
|
12
|
+
* simpler and works without build-time configuration.
|
|
13
|
+
*/
|
|
14
|
+
export interface TransportLogger {
|
|
15
|
+
log(message: string, ...args: unknown[]): void;
|
|
16
|
+
warn(message: string, ...args: unknown[]): void;
|
|
17
|
+
error(message: string, ...args: unknown[]): void;
|
|
18
|
+
/** Set to true to suppress all log output (warn/error are always emitted). */
|
|
19
|
+
silent: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Shared logger instance for the transport layer. */
|
|
22
|
+
export declare const transportLogger: TransportLogger;
|
|
23
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/transport/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,8EAA8E;IAC9E,MAAM,EAAE,OAAO,CAAC;CACjB;AAmBD,sDAAsD;AACtD,eAAO,MAAM,eAAe,iBAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/undo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { NativeSnapshotUndoContext } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* A single bridge action recorded for undo correlation. Action-correlation
|
|
4
|
+
* only — RN has no DOM/execCommand probe, so we rely on developer
|
|
5
|
+
* declaration plus this rolling history of recent actions.
|
|
6
|
+
*/
|
|
7
|
+
export interface ActionRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
type: string;
|
|
10
|
+
targetId?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
/** Default true — set false for actions that aren't reversible (e.g. navigation, network calls) */
|
|
14
|
+
reversible?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Developer-declared undo/redo state. When set, this is authoritative and
|
|
18
|
+
* overrides any heuristic inference from action history.
|
|
19
|
+
*/
|
|
20
|
+
export interface DeclaredUndoState {
|
|
21
|
+
canUndo: boolean;
|
|
22
|
+
canRedo: boolean;
|
|
23
|
+
undoDescription?: string;
|
|
24
|
+
redoDescription?: string;
|
|
25
|
+
undoDepth?: number;
|
|
26
|
+
redoDepth?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface UndoTrackerConfig {
|
|
29
|
+
maxHistory?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Action-correlation undo tracker for React Native.
|
|
33
|
+
*
|
|
34
|
+
* Maintains a rolling buffer of recent actions and a developer-declared
|
|
35
|
+
* undo state slot. The declared state is authoritative when set; otherwise
|
|
36
|
+
* we infer `canUndo` from whether any reversible action has been recorded.
|
|
37
|
+
* `executeUndo`/`executeRedo` are placeholders pending an IPC path through
|
|
38
|
+
* ui-bridge-native to the runner's `/control/undo`.
|
|
39
|
+
*/
|
|
40
|
+
export declare class UndoTracker {
|
|
41
|
+
private readonly maxHistory;
|
|
42
|
+
private actions;
|
|
43
|
+
private declaredState;
|
|
44
|
+
constructor(config?: UndoTrackerConfig);
|
|
45
|
+
recordAction(record: ActionRecord): void;
|
|
46
|
+
setDeclaredState(state: DeclaredUndoState): void;
|
|
47
|
+
getActionHistory(): ActionRecord[];
|
|
48
|
+
getSnapshotUndoContext(): NativeSnapshotUndoContext;
|
|
49
|
+
executeUndo(): {
|
|
50
|
+
ok: boolean;
|
|
51
|
+
reason?: string;
|
|
52
|
+
};
|
|
53
|
+
executeRedo(): {
|
|
54
|
+
ok: boolean;
|
|
55
|
+
reason?: string;
|
|
56
|
+
};
|
|
57
|
+
clear(): void;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=undo-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo-tracker.d.ts","sourceRoot":"","sources":["../../src/undo/undo-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAuBD;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,aAAa,CAAkC;gBAE3C,MAAM,GAAE,iBAAsB;IAI1C,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAOxC,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAIhD,gBAAgB,IAAI,YAAY,EAAE;IAIlC,sBAAsB,IAAI,yBAAyB;IAkCnD,WAAW,IAAI;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAI/C,WAAW,IAAI;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAI/C,KAAK,IAAI,IAAI;CAId"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qontinui/ui-bridge-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "UI Bridge Framework for React Native - Hooks and providers for UI observation and control in mobile apps",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"README.md"
|
|
48
48
|
],
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "tsup",
|
|
50
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
51
51
|
"dev": "tsup --watch",
|
|
52
52
|
"test": "vitest run",
|
|
53
53
|
"typecheck": "tsc --noEmit",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@qontinui/ui-bridge": ">=0.
|
|
58
|
+
"@qontinui/ui-bridge": ">=0.4.0",
|
|
59
59
|
"react": "^18.0.0 || ^19.0.0",
|
|
60
60
|
"react-native": ">=0.70.0"
|
|
61
61
|
},
|