@vidra-dev/sdk 0.5.1 → 0.6.1
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 +43 -0
- package/dist/bridge.d.ts +15 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +16 -0
- package/dist/bridge.js.map +1 -0
- package/dist/client.d.ts +60 -52
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +133 -161
- package/dist/client.js.map +1 -1
- package/dist/generated/app.d.ts +6 -7
- package/dist/generated/app.d.ts.map +1 -1
- package/dist/generated/app.js +4 -11
- package/dist/generated/app.js.map +1 -1
- package/dist/generated/appWindow.d.ts +16 -17
- package/dist/generated/appWindow.d.ts.map +1 -1
- package/dist/generated/appWindow.js +14 -41
- package/dist/generated/appWindow.js.map +1 -1
- package/dist/generated/battery.d.ts +6 -7
- package/dist/generated/battery.d.ts.map +1 -1
- package/dist/generated/battery.js +4 -11
- package/dist/generated/battery.js.map +1 -1
- package/dist/generated/browser.d.ts +5 -6
- package/dist/generated/browser.d.ts.map +1 -1
- package/dist/generated/browser.js +3 -8
- package/dist/generated/browser.js.map +1 -1
- package/dist/generated/clipboard.d.ts +7 -8
- package/dist/generated/clipboard.d.ts.map +1 -1
- package/dist/generated/clipboard.js +5 -14
- package/dist/generated/clipboard.js.map +1 -1
- package/dist/generated/connectivity.d.ts +6 -7
- package/dist/generated/connectivity.d.ts.map +1 -1
- package/dist/generated/connectivity.js +4 -11
- package/dist/generated/connectivity.js.map +1 -1
- package/dist/generated/device.d.ts +6 -7
- package/dist/generated/device.d.ts.map +1 -1
- package/dist/generated/device.js +4 -11
- package/dist/generated/device.js.map +1 -1
- package/dist/generated/dialogs.d.ts +7 -8
- package/dist/generated/dialogs.d.ts.map +1 -1
- package/dist/generated/dialogs.js +5 -14
- package/dist/generated/dialogs.js.map +1 -1
- package/dist/generated/email.d.ts +5 -6
- package/dist/generated/email.d.ts.map +1 -1
- package/dist/generated/email.js +3 -8
- package/dist/generated/email.js.map +1 -1
- package/dist/generated/essentials.d.ts +5 -6
- package/dist/generated/essentials.d.ts.map +1 -1
- package/dist/generated/essentials.js +3 -8
- package/dist/generated/essentials.js.map +1 -1
- package/dist/generated/filePicker.d.ts +6 -7
- package/dist/generated/filePicker.d.ts.map +1 -1
- package/dist/generated/filePicker.js +4 -11
- package/dist/generated/filePicker.js.map +1 -1
- package/dist/generated/filesystem.d.ts +9 -10
- package/dist/generated/filesystem.d.ts.map +1 -1
- package/dist/generated/filesystem.js +7 -20
- package/dist/generated/filesystem.js.map +1 -1
- package/dist/generated/index.d.ts +90 -38
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +40 -40
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/launcher.d.ts +6 -7
- package/dist/generated/launcher.d.ts.map +1 -1
- package/dist/generated/launcher.js +4 -11
- package/dist/generated/launcher.js.map +1 -1
- package/dist/generated/notifications.d.ts +6 -7
- package/dist/generated/notifications.d.ts.map +1 -1
- package/dist/generated/notifications.js +4 -11
- package/dist/generated/notifications.js.map +1 -1
- package/dist/generated/preferences.d.ts +9 -10
- package/dist/generated/preferences.d.ts.map +1 -1
- package/dist/generated/preferences.js +7 -20
- package/dist/generated/preferences.js.map +1 -1
- package/dist/generated/runtime.d.ts +5 -6
- package/dist/generated/runtime.d.ts.map +1 -1
- package/dist/generated/runtime.js +3 -8
- package/dist/generated/runtime.js.map +1 -1
- package/dist/generated/secureStorage.d.ts +8 -9
- package/dist/generated/secureStorage.d.ts.map +1 -1
- package/dist/generated/secureStorage.js +6 -17
- package/dist/generated/secureStorage.js.map +1 -1
- package/dist/generated/share.d.ts +5 -6
- package/dist/generated/share.d.ts.map +1 -1
- package/dist/generated/share.js +3 -8
- package/dist/generated/share.js.map +1 -1
- package/dist/generated/textToSpeech.d.ts +5 -6
- package/dist/generated/textToSpeech.d.ts.map +1 -1
- package/dist/generated/textToSpeech.js +3 -8
- package/dist/generated/textToSpeech.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/transport.d.ts +43 -23
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +71 -54
- package/dist/transport.js.map +1 -1
- package/package.json +1 -1
- package/dist/singleton.d.ts +0 -9
- package/dist/singleton.d.ts.map +0 -1
- package/dist/singleton.js +0 -8
- package/dist/singleton.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/generated/preferences.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/generated/preferences.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,WAAY,WAAW;IACnD,GAAG,SAAS,kBAAkB,KAAG,OAAO,CAAC,oBAAoB,CAAC;IAE9D,GAAG,SAAS,kBAAkB,KAAG,OAAO,CAAC,oBAAoB,CAAC;IAE9D,MAAM,SAAS,qBAAqB,KAAG,OAAO,CAAC,uBAAuB,CAAC;IAEvE,WAAW,SAAS,uBAAuB,KAAG,OAAO,CAAC,yBAAyB,CAAC;IAEhF,KAAK,QAAM,OAAO,CAAC,sBAAsB,CAAC;CAE1C,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
set(args) {
|
|
9
|
-
return this.client.unsafe.invoke("preferences", "set", args);
|
|
10
|
-
}
|
|
11
|
-
remove(args) {
|
|
12
|
-
return this.client.unsafe.invoke("preferences", "remove", args);
|
|
13
|
-
}
|
|
14
|
-
containsKey(args) {
|
|
15
|
-
return this.client.unsafe.invoke("preferences", "containsKey", args);
|
|
16
|
-
}
|
|
17
|
-
clear() {
|
|
18
|
-
return this.client.unsafe.invoke("preferences", "clear");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
export const createPreferences = (bridge) => ({
|
|
2
|
+
get: (args) => bridge.unsafe.invoke("preferences", "get", args),
|
|
3
|
+
set: (args) => bridge.unsafe.invoke("preferences", "set", args),
|
|
4
|
+
remove: (args) => bridge.unsafe.invoke("preferences", "remove", args),
|
|
5
|
+
containsKey: (args) => bridge.unsafe.invoke("preferences", "containsKey", args),
|
|
6
|
+
clear: () => bridge.unsafe.invoke("preferences", "clear"),
|
|
7
|
+
});
|
|
21
8
|
//# sourceMappingURL=preferences.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/generated/preferences.ts"],"names":[],"mappings":"AAwCA,MAAM,
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/generated/preferences.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAE,EAAE,CAAC,CAAC;IACzD,GAAG,EAAE,CAAC,IAAwB,EAAiC,EAAE,CAC/D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC;IAClD,GAAG,EAAE,CAAC,IAAwB,EAAiC,EAAE,CAC/D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC;IAClD,MAAM,EAAE,CAAC,IAA2B,EAAoC,EAAE,CACxE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC;IACrD,WAAW,EAAE,CAAC,IAA6B,EAAsC,EAAE,CACjF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC;IAC1D,KAAK,EAAE,GAAoC,EAAE,CAC3C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC;CAC/C,CAAC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VidraBridge } from "../bridge.js";
|
|
2
2
|
export interface HotReloadedPayload {
|
|
3
3
|
updatedTypes: string[];
|
|
4
4
|
}
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
export declare const createRuntime: (bridge: VidraBridge) => {
|
|
6
|
+
onHotReloaded: (handler: (payload: HotReloadedPayload) => void) => (() => void);
|
|
7
|
+
};
|
|
8
|
+
export type Runtime = ReturnType<typeof createRuntime>;
|
|
10
9
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/generated/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/generated/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,WAAY,WAAW;IAC/C,aAAa,YAAY,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAE7E,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
onHotReloaded(handler) {
|
|
6
|
-
return this.client.unsafe.on("runtime", "hotReloaded", handler);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
export const createRuntime = (bridge) => ({
|
|
2
|
+
onHotReloaded: (handler) => bridge.unsafe.on("runtime", "hotReloaded", handler),
|
|
3
|
+
});
|
|
9
4
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/generated/runtime.ts"],"names":[],"mappings":"AAOA,MAAM,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/generated/runtime.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAmB,EAAE,EAAE,CAAC,CAAC;IACrD,aAAa,EAAE,CAAC,OAA8C,EAAgB,EAAE,CAC9E,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC;CACtD,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VidraBridge } from "../bridge.js";
|
|
2
2
|
export interface SecureStorageGetArgs {
|
|
3
3
|
key: string;
|
|
4
4
|
}
|
|
@@ -21,12 +21,11 @@ export interface SecureStorageSetArgs {
|
|
|
21
21
|
export interface SecureStorageSetResult {
|
|
22
22
|
success: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
24
|
+
export declare const createSecureStorage: (bridge: VidraBridge) => {
|
|
25
|
+
get: (args: SecureStorageGetArgs) => Promise<SecureStorageGetResult>;
|
|
26
|
+
set: (args: SecureStorageSetArgs) => Promise<SecureStorageSetResult>;
|
|
27
|
+
remove: (args: SecureStorageRemoveArgs) => Promise<SecureStorageRemoveResult>;
|
|
28
|
+
removeAll: () => Promise<SecureStorageRemoveAllResult>;
|
|
29
|
+
};
|
|
30
|
+
export type SecureStorage = ReturnType<typeof createSecureStorage>;
|
|
32
31
|
//# sourceMappingURL=secureStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secureStorage.d.ts","sourceRoot":"","sources":["../../src/generated/secureStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"secureStorage.d.ts","sourceRoot":"","sources":["../../src/generated/secureStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,WAAY,WAAW;IACrD,GAAG,SAAS,oBAAoB,KAAG,OAAO,CAAC,sBAAsB,CAAC;IAElE,GAAG,SAAS,oBAAoB,KAAG,OAAO,CAAC,sBAAsB,CAAC;IAElE,MAAM,SAAS,uBAAuB,KAAG,OAAO,CAAC,yBAAyB,CAAC;IAE3E,SAAS,QAAM,OAAO,CAAC,4BAA4B,CAAC;CAEpD,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
set(args) {
|
|
9
|
-
return this.client.unsafe.invoke("secureStorage", "set", args);
|
|
10
|
-
}
|
|
11
|
-
remove(args) {
|
|
12
|
-
return this.client.unsafe.invoke("secureStorage", "remove", args);
|
|
13
|
-
}
|
|
14
|
-
removeAll() {
|
|
15
|
-
return this.client.unsafe.invoke("secureStorage", "removeAll");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
export const createSecureStorage = (bridge) => ({
|
|
2
|
+
get: (args) => bridge.unsafe.invoke("secureStorage", "get", args),
|
|
3
|
+
set: (args) => bridge.unsafe.invoke("secureStorage", "set", args),
|
|
4
|
+
remove: (args) => bridge.unsafe.invoke("secureStorage", "remove", args),
|
|
5
|
+
removeAll: () => bridge.unsafe.invoke("secureStorage", "removeAll"),
|
|
6
|
+
});
|
|
18
7
|
//# sourceMappingURL=secureStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secureStorage.js","sourceRoot":"","sources":["../../src/generated/secureStorage.ts"],"names":[],"mappings":"AAgCA,MAAM,
|
|
1
|
+
{"version":3,"file":"secureStorage.js","sourceRoot":"","sources":["../../src/generated/secureStorage.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAmB,EAAE,EAAE,CAAC,CAAC;IAC3D,GAAG,EAAE,CAAC,IAA0B,EAAmC,EAAE,CACnE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,IAAI,CAAC;IACpD,GAAG,EAAE,CAAC,IAA0B,EAAmC,EAAE,CACnE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,IAAI,CAAC;IACpD,MAAM,EAAE,CAAC,IAA6B,EAAsC,EAAE,CAC5E,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,EAAE,IAAI,CAAC;IACvD,SAAS,EAAE,GAA0C,EAAE,CACrD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC;CACrD,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VidraBridge } from "../bridge.js";
|
|
2
2
|
export interface ShareResult {
|
|
3
3
|
success: boolean;
|
|
4
4
|
}
|
|
@@ -8,9 +8,8 @@ export interface ShareTextArgs {
|
|
|
8
8
|
subject?: string | null;
|
|
9
9
|
uri?: string | null;
|
|
10
10
|
}
|
|
11
|
-
export declare
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
11
|
+
export declare const createShare: (bridge: VidraBridge) => {
|
|
12
|
+
shareText: (args: ShareTextArgs) => Promise<ShareResult>;
|
|
13
|
+
};
|
|
14
|
+
export type Share = ReturnType<typeof createShare>;
|
|
16
15
|
//# sourceMappingURL=share.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/generated/share.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/generated/share.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,WAAY,WAAW;IAC7C,SAAS,SAAS,aAAa,KAAG,OAAO,CAAC,WAAW,CAAC;CAEtD,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/generated/share.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
shareText(args) {
|
|
6
|
-
return this.client.unsafe.invoke("share", "shareText", args);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
export const createShare = (bridge) => ({
|
|
2
|
+
shareText: (args) => bridge.unsafe.invoke("share", "shareText", args),
|
|
3
|
+
});
|
|
9
4
|
//# sourceMappingURL=share.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/generated/share.ts"],"names":[],"mappings":"AAcA,MAAM,
|
|
1
|
+
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/generated/share.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAmB,EAAE,EAAE,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,IAAmB,EAAwB,EAAE,CACvD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC;CACnD,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VidraBridge } from "../bridge.js";
|
|
2
2
|
export interface SpeakArgs {
|
|
3
3
|
text: string;
|
|
4
4
|
pitch?: number | null;
|
|
@@ -7,9 +7,8 @@ export interface SpeakArgs {
|
|
|
7
7
|
export interface SpeakResult {
|
|
8
8
|
success: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
export declare const createTextToSpeech: (bridge: VidraBridge) => {
|
|
11
|
+
speak: (args: SpeakArgs) => Promise<SpeakResult>;
|
|
12
|
+
};
|
|
13
|
+
export type TextToSpeech = ReturnType<typeof createTextToSpeech>;
|
|
15
14
|
//# sourceMappingURL=textToSpeech.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textToSpeech.d.ts","sourceRoot":"","sources":["../../src/generated/textToSpeech.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"textToSpeech.d.ts","sourceRoot":"","sources":["../../src/generated/textToSpeech.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,kBAAkB,WAAY,WAAW;IACpD,KAAK,SAAS,SAAS,KAAG,OAAO,CAAC,WAAW,CAAC;CAE9C,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
speak(args) {
|
|
6
|
-
return this.client.unsafe.invoke("textToSpeech", "speak", args);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
export const createTextToSpeech = (bridge) => ({
|
|
2
|
+
speak: (args) => bridge.unsafe.invoke("textToSpeech", "speak", args),
|
|
3
|
+
});
|
|
9
4
|
//# sourceMappingURL=textToSpeech.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textToSpeech.js","sourceRoot":"","sources":["../../src/generated/textToSpeech.ts"],"names":[],"mappings":"AAaA,MAAM,
|
|
1
|
+
{"version":3,"file":"textToSpeech.js","sourceRoot":"","sources":["../../src/generated/textToSpeech.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,EAAE,CAAC,CAAC;IAC1D,KAAK,EAAE,CAAC,IAAe,EAAwB,EAAE,CAC/C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC;CACtD,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { createBridge, createExpectations, installWindowCallbacks, } from "./client.js";
|
|
2
|
+
export type { BridgeOptions, Expectations, ExpectationScope, HostEntryPoints, UnsafeVidra, VidraBridge, } from "./client.js";
|
|
3
3
|
export type { BridgeRequest, BridgeResponse, BridgeError, BridgeEvent, EventHandler, Capabilities, NativeContractCapabilities, BridgeHandshake, ReverseRequest, ReverseResponse, JsHandler, } from "./types.js";
|
|
4
|
-
export {
|
|
5
|
-
export type { Transport } from "./transport.js";
|
|
6
|
-
export { vidra } from "./
|
|
4
|
+
export { createBrowserFallbackTransport, createCustomSchemeTransport, createNativeMessageTransport, detectTransport, hasNativeMessageChannel, isNativeHost, NATIVE_CHANNEL, } from "./transport.js";
|
|
5
|
+
export type { BrowserFallbackOptions, NativePoster, Transport, TransportDetection, } from "./transport.js";
|
|
6
|
+
export { bridge, expectations, vidra } from "./bridge.js";
|
|
7
|
+
export type { Vidra } from "./bridge.js";
|
|
7
8
|
export * from "./generated/index.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,sBAAsB,EACtB,YAAY,EACZ,SAAS,EACT,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
export { vidra } from "./
|
|
6
|
-
// Re-export generated typed
|
|
1
|
+
export { createBridge, createExpectations, installWindowCallbacks, } from "./client.js";
|
|
2
|
+
export { createBrowserFallbackTransport, createCustomSchemeTransport, createNativeMessageTransport, detectTransport, hasNativeMessageChannel, isNativeHost, NATIVE_CHANNEL, } from "./transport.js";
|
|
3
|
+
// The page's bridge lives in its own module to avoid circular dependencies
|
|
4
|
+
// with the generated barrel.
|
|
5
|
+
export { bridge, expectations, vidra } from "./bridge.js";
|
|
6
|
+
// Re-export generated typed contracts for built-in modules.
|
|
7
7
|
export * from "./generated/index.js";
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAsBrB,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AAOxB,2EAA2E;AAC3E,6BAA6B;AAC7B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAG1D,4DAA4D;AAC5D,cAAc,sBAAsB,CAAC"}
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,54 +1,74 @@
|
|
|
1
|
-
import type { BridgeRequest, ReverseResponse } from "./types.js";
|
|
1
|
+
import type { BridgeRequest, BridgeResponse, ReverseResponse } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Abstraction over the JS→C# transport mechanism.
|
|
4
4
|
* The default implementation uses the custom-scheme navigation approach
|
|
5
5
|
* (`vidra://bridge?payload=...`) which the MAUI WebViewBridge intercepts.
|
|
6
6
|
*/
|
|
7
7
|
export interface Transport {
|
|
8
|
-
send(request: BridgeRequest)
|
|
9
|
-
sendReverse(response: ReverseResponse)
|
|
8
|
+
send: (request: BridgeRequest) => void;
|
|
9
|
+
sendReverse: (response: ReverseResponse) => void;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* The script-message handler name registered by the native host. JS posts to
|
|
13
13
|
* `window.webkit.messageHandlers[NATIVE_CHANNEL]` (WKWebView) or, on Windows,
|
|
14
|
-
* to `window.chrome.webview` (WebView2)
|
|
14
|
+
* to `window.chrome.webview` (WebView2), or directly to
|
|
15
|
+
* `window[NATIVE_CHANNEL]` (Android WebView).
|
|
15
16
|
*/
|
|
16
17
|
export declare const NATIVE_CHANNEL = "vidra";
|
|
17
|
-
interface NativePoster {
|
|
18
|
-
postMessage(message: string)
|
|
18
|
+
export interface NativePoster {
|
|
19
|
+
postMessage: (message: string) => void;
|
|
19
20
|
}
|
|
20
|
-
/** True when a first-class native message channel
|
|
21
|
+
/** True when a first-class native message channel is
|
|
21
22
|
* available. Preferred over the custom-scheme transport because it has no URL
|
|
22
23
|
* length limit, no per-message iframe, and is binary-safe. */
|
|
23
24
|
export declare const hasNativeMessageChannel: () => boolean;
|
|
25
|
+
/** True when the native host has injected its marker before the web content
|
|
26
|
+
* loaded, meaning custom-scheme navigations will be intercepted. */
|
|
27
|
+
export declare const isNativeHost: () => boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Transport that uses the platform's native message channel:
|
|
26
30
|
* - Apple (WKWebView): `window.webkit.messageHandlers.vidra.postMessage(...)`
|
|
27
31
|
* handled by a `WKScriptMessageHandler` on the C# side.
|
|
28
32
|
* - Windows (WebView2): `window.chrome.webview.postMessage(...)` handled by
|
|
29
33
|
* `CoreWebView2.WebMessageReceived` on the C# side.
|
|
34
|
+
* - Android: `window.vidra.postMessage(...)` handled by an
|
|
35
|
+
* origin-scoped AndroidX WebKit message listener on the C# side.
|
|
30
36
|
*
|
|
31
|
-
* Unlike {@link
|
|
32
|
-
* navigation, so large messages (e.g. file contents) are not truncated.
|
|
37
|
+
* Unlike {@link createCustomSchemeTransport}, payloads are not URL-encoded into
|
|
38
|
+
* a navigation, so large messages (e.g. file contents) are not truncated.
|
|
39
|
+
*
|
|
40
|
+
* Throws when no channel is available.
|
|
33
41
|
*/
|
|
34
|
-
export declare
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sendReverse(response: ReverseResponse): void;
|
|
42
|
+
export declare const createNativeMessageTransport: (channel?: NativePoster | undefined) => Transport;
|
|
43
|
+
/**
|
|
44
|
+
* Transport that navigates a hidden iframe to `vidra://bridge?payload=...` or
|
|
45
|
+
* `vidra://reverse?payload=...`, which the MAUI host intercepts.
|
|
46
|
+
*/
|
|
47
|
+
export declare const createCustomSchemeTransport: () => Transport;
|
|
48
|
+
export interface BrowserFallbackOptions {
|
|
49
|
+
/** Receives the synthetic BROWSER_ONLY error response for each request. */
|
|
50
|
+
deliver: (response: BridgeResponse) => void;
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
53
|
* Browser-only stub that immediately resolves with a synthetic response.
|
|
47
54
|
* Enables UI development in a regular browser without the MAUI shell.
|
|
48
55
|
*/
|
|
49
|
-
export declare
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
export declare const createBrowserFallbackTransport: ({ deliver, }: BrowserFallbackOptions) => Transport;
|
|
57
|
+
export interface TransportDetection {
|
|
58
|
+
transport: Transport;
|
|
59
|
+
/**
|
|
60
|
+
* False for the browser fallback: a native channel can become available
|
|
61
|
+
* shortly after load (the WKWebView script-message handler registers just
|
|
62
|
+
* after the page loads), so callers keep re-detecting until a real native
|
|
63
|
+
* transport is found.
|
|
64
|
+
*/
|
|
65
|
+
cacheable: boolean;
|
|
52
66
|
}
|
|
53
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Pick the transport for the current page. Preference order:
|
|
69
|
+
* 1. the native message channel (WKWebView / WebView2 / Android) when present
|
|
70
|
+
* 2. the custom-scheme transport when the host marker is set
|
|
71
|
+
* 3. the browser-only fallback
|
|
72
|
+
*/
|
|
73
|
+
export declare const detectTransport: (deliver: (response: BridgeResponse) => void) => TransportDetection;
|
|
54
74
|
//# sourceMappingURL=transport.d.ts.map
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;CAClD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAQtC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAoBD;;8DAE8D;AAC9D,eAAO,MAAM,uBAAuB,QAAO,OAAwC,CAAC;AAEpF;oEACoE;AACpE,eAAO,MAAM,YAAY,QAAO,OACuB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,aAC9B,YAAY,GAAG,SAAS,KAChC,SAeF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,QAAO,SAc9C,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,OAAO,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B,iBAExC,sBAAsB,KAAG,SAqB1B,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,YACjB,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,KAC1C,kBAQF,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The script-message handler name registered by the native host. JS posts to
|
|
3
3
|
* `window.webkit.messageHandlers[NATIVE_CHANNEL]` (WKWebView) or, on Windows,
|
|
4
|
-
* to `window.chrome.webview` (WebView2)
|
|
4
|
+
* to `window.chrome.webview` (WebView2), or directly to
|
|
5
|
+
* `window[NATIVE_CHANNEL]` (Android WebView).
|
|
5
6
|
*/
|
|
6
7
|
export const NATIVE_CHANNEL = "vidra";
|
|
7
8
|
const appleChannel = () => {
|
|
@@ -12,81 +13,97 @@ const windowsChannel = () => {
|
|
|
12
13
|
const webview = globalThis?.chrome?.webview;
|
|
13
14
|
return webview && typeof webview.postMessage === "function" ? webview : undefined;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
const androidChannel = () => {
|
|
17
|
+
const bridge = globalThis?.[NATIVE_CHANNEL];
|
|
18
|
+
return bridge && typeof bridge.postMessage === "function" ? bridge : undefined;
|
|
19
|
+
};
|
|
20
|
+
const nativeChannel = () => appleChannel() ?? windowsChannel() ?? androidChannel();
|
|
21
|
+
/** True when a first-class native message channel is
|
|
16
22
|
* available. Preferred over the custom-scheme transport because it has no URL
|
|
17
23
|
* length limit, no per-message iframe, and is binary-safe. */
|
|
18
|
-
export const hasNativeMessageChannel = () =>
|
|
24
|
+
export const hasNativeMessageChannel = () => nativeChannel() !== undefined;
|
|
25
|
+
/** True when the native host has injected its marker before the web content
|
|
26
|
+
* loaded, meaning custom-scheme navigations will be intercepted. */
|
|
27
|
+
export const isNativeHost = () => typeof window.__vidra_native !== "undefined";
|
|
19
28
|
/**
|
|
20
29
|
* Transport that uses the platform's native message channel:
|
|
21
30
|
* - Apple (WKWebView): `window.webkit.messageHandlers.vidra.postMessage(...)`
|
|
22
31
|
* handled by a `WKScriptMessageHandler` on the C# side.
|
|
23
32
|
* - Windows (WebView2): `window.chrome.webview.postMessage(...)` handled by
|
|
24
33
|
* `CoreWebView2.WebMessageReceived` on the C# side.
|
|
34
|
+
* - Android: `window.vidra.postMessage(...)` handled by an
|
|
35
|
+
* origin-scoped AndroidX WebKit message listener on the C# side.
|
|
36
|
+
*
|
|
37
|
+
* Unlike {@link createCustomSchemeTransport}, payloads are not URL-encoded into
|
|
38
|
+
* a navigation, so large messages (e.g. file contents) are not truncated.
|
|
25
39
|
*
|
|
26
|
-
*
|
|
27
|
-
* navigation, so large messages (e.g. file contents) are not truncated.
|
|
40
|
+
* Throws when no channel is available.
|
|
28
41
|
*/
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new Error("[vidra] No native message channel is available (expected WKWebView or WebView2).");
|
|
33
|
-
}
|
|
34
|
-
this.channel = channel;
|
|
35
|
-
}
|
|
36
|
-
send(request) {
|
|
37
|
-
this.post({ kind: "request", data: request });
|
|
38
|
-
}
|
|
39
|
-
sendReverse(response) {
|
|
40
|
-
this.post({ kind: "reverse", data: response });
|
|
41
|
-
}
|
|
42
|
-
post(frame) {
|
|
43
|
-
this.channel.postMessage(JSON.stringify(frame));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export class CustomSchemeTransport {
|
|
47
|
-
send(request) {
|
|
48
|
-
const json = JSON.stringify(request);
|
|
49
|
-
const encoded = encodeURIComponent(json);
|
|
50
|
-
const iframe = document.createElement("iframe");
|
|
51
|
-
iframe.style.display = "none";
|
|
52
|
-
iframe.src = `vidra://bridge?payload=${encoded}`;
|
|
53
|
-
document.body.appendChild(iframe);
|
|
54
|
-
setTimeout(() => iframe.remove(), 100);
|
|
42
|
+
export const createNativeMessageTransport = (channel = nativeChannel()) => {
|
|
43
|
+
if (!channel) {
|
|
44
|
+
throw new Error("[vidra] No native message channel is available (expected WKWebView, WebView2, or Android WebView).");
|
|
55
45
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
const post = (frame) => {
|
|
47
|
+
channel.postMessage(JSON.stringify(frame));
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
send: (request) => post({ kind: "request", data: request }),
|
|
51
|
+
sendReverse: (response) => post({ kind: "reverse", data: response }),
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Transport that navigates a hidden iframe to `vidra://bridge?payload=...` or
|
|
56
|
+
* `vidra://reverse?payload=...`, which the MAUI host intercepts.
|
|
57
|
+
*/
|
|
58
|
+
export const createCustomSchemeTransport = () => {
|
|
59
|
+
const navigate = (route, body) => {
|
|
60
|
+
const encoded = encodeURIComponent(JSON.stringify(body));
|
|
59
61
|
const iframe = document.createElement("iframe");
|
|
60
62
|
iframe.style.display = "none";
|
|
61
|
-
iframe.src = `vidra
|
|
63
|
+
iframe.src = `vidra://${route}?payload=${encoded}`;
|
|
62
64
|
document.body.appendChild(iframe);
|
|
63
65
|
setTimeout(() => iframe.remove(), 100);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
send: (request) => navigate("bridge", request),
|
|
69
|
+
sendReverse: (response) => navigate("reverse", response),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
66
72
|
/**
|
|
67
73
|
* Browser-only stub that immediately resolves with a synthetic response.
|
|
68
74
|
* Enables UI development in a regular browser without the MAUI shell.
|
|
69
75
|
*/
|
|
70
|
-
export
|
|
71
|
-
send(request) {
|
|
76
|
+
export const createBrowserFallbackTransport = ({ deliver, }) => ({
|
|
77
|
+
send: (request) => {
|
|
72
78
|
console.warn(`[vidra] No native host detected. Browser stub for: ${request.contract}.${request.member}`, request);
|
|
73
79
|
queueMicrotask(() => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
callback(response);
|
|
85
|
-
}
|
|
80
|
+
deliver({
|
|
81
|
+
id: request.id,
|
|
82
|
+
success: false,
|
|
83
|
+
error: {
|
|
84
|
+
code: "BROWSER_ONLY",
|
|
85
|
+
message: `Native host not available. '${request.contract}.${request.member}' requires the MAUI shell.`,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
86
88
|
});
|
|
87
|
-
}
|
|
88
|
-
sendReverse(
|
|
89
|
+
},
|
|
90
|
+
sendReverse: () => {
|
|
89
91
|
console.warn("[vidra] Reverse RPC is not available in browser-only mode.");
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Pick the transport for the current page. Preference order:
|
|
96
|
+
* 1. the native message channel (WKWebView / WebView2 / Android) when present
|
|
97
|
+
* 2. the custom-scheme transport when the host marker is set
|
|
98
|
+
* 3. the browser-only fallback
|
|
99
|
+
*/
|
|
100
|
+
export const detectTransport = (deliver) => {
|
|
101
|
+
if (hasNativeMessageChannel()) {
|
|
102
|
+
return { transport: createNativeMessageTransport(), cacheable: true };
|
|
90
103
|
}
|
|
91
|
-
|
|
104
|
+
if (isNativeHost()) {
|
|
105
|
+
return { transport: createCustomSchemeTransport(), cacheable: true };
|
|
106
|
+
}
|
|
107
|
+
return { transport: createBrowserFallbackTransport({ deliver }), cacheable: false };
|
|
108
|
+
};
|
|
92
109
|
//# sourceMappingURL=transport.js.map
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAYA
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"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"}
|