@celljs/ta-web 4.34.0 → 4.35.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/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/app-icon.d.ts +23 -0
- package/esm/browser/apps/app-icon.js +98 -0
- package/esm/browser/apps/app-settings.d.ts +6 -0
- package/esm/browser/apps/app-settings.js +67 -0
- package/esm/browser/apps/app-window-util.d.ts +23 -0
- package/esm/browser/apps/app-window-util.js +27 -0
- package/esm/browser/apps/app-window.d.ts +9 -0
- package/esm/browser/apps/app-window.js +90 -0
- package/esm/browser/apps/web-apps.d.ts +29 -0
- package/esm/browser/apps/web-apps.js +57 -0
- package/esm/browser/assistant/call-keeper.d.ts +2 -5
- package/esm/browser/assistant/call-keeper.js +7 -11
- package/esm/browser/components/access-settings.d.ts +6 -0
- package/esm/browser/components/access-settings.js +52 -0
- package/esm/browser/components/app-root.d.ts +6 -0
- package/esm/browser/components/app-root.js +34 -0
- package/esm/browser/components/app-view.d.ts +8 -2
- package/esm/browser/components/app-view.js +1 -25
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/settings-more.js +6 -0
- package/esm/browser/device/screen-awake.d.ts +16 -0
- package/esm/browser/device/screen-awake.js +37 -0
- package/esm/browser/device/sheet-swipe.js +4 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-access.d.ts +16 -0
- package/esm/browser/extension/web-access.js +75 -0
- package/esm/browser/extension/web-api-desktop.d.ts +23 -0
- package/esm/browser/extension/web-api-spec.d.ts +70 -0
- package/esm/browser/extension/web-api-spec.js +223 -0
- package/esm/browser/extension/web-extension-api.d.ts +6 -0
- package/esm/browser/extension/web-extension-context.js +11 -2
- package/esm/browser/extension/web-extension-run.d.ts +6 -1
- package/esm/browser/extension/web-extension-run.js +25 -0
- package/esm/browser/extension/web-extensions-running.d.ts +18 -1
- package/esm/browser/extension/web-extensions-running.js +102 -9
- package/esm/browser/extension/web-pages.d.ts +5 -0
- package/esm/browser/extension/web-pages.js +3 -0
- package/esm/browser/i18n/en/common.d.ts +1 -0
- package/esm/browser/i18n/en/common.js +1 -0
- package/esm/browser/i18n/en/discover.d.ts +11 -0
- package/esm/browser/i18n/en/discover.js +11 -0
- package/esm/browser/i18n/en/settings.d.ts +28 -0
- package/esm/browser/i18n/en/settings.js +28 -0
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/ja/discover.js +11 -0
- package/esm/browser/i18n/ja/settings.js +28 -0
- package/esm/browser/i18n/locales.d.ts +41 -3
- package/esm/browser/i18n/messages.d.ts +40 -2
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh/discover.js +11 -0
- package/esm/browser/i18n/zh/settings.js +28 -0
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/i18n/zh-tw/discover.js +11 -0
- package/esm/browser/i18n/zh-tw/settings.js +28 -0
- package/esm/browser/index.d.ts +1 -0
- package/esm/browser/index.js +1 -0
- package/esm/browser/notices/notices.js +1 -0
- package/esm/browser/sandbox/channel/channel.d.ts +56 -0
- package/esm/browser/sandbox/channel/channel.js +124 -0
- package/esm/browser/sandbox/channel/codec.d.ts +80 -0
- package/esm/browser/sandbox/channel/codec.js +251 -0
- package/esm/browser/sandbox/hook-host.d.ts +23 -0
- package/esm/browser/sandbox/hook-host.js +61 -0
- package/esm/browser/sandbox/isolated-host.d.ts +105 -0
- package/esm/browser/sandbox/isolated-host.js +395 -0
- package/esm/browser/sandbox/remote/remote-copy.d.ts +56 -0
- package/esm/browser/sandbox/remote/remote-copy.js +302 -0
- package/esm/browser/sandbox/remote/remote-mirror.d.ts +61 -0
- package/esm/browser/sandbox/remote/remote-mirror.js +341 -0
- package/esm/browser/sandbox/remote/remote-protocol.d.ts +79 -0
- package/esm/browser/sandbox/remote/remote-protocol.js +54 -0
- package/esm/browser/sandbox/remote/remote-styles.d.ts +10 -0
- package/esm/browser/sandbox/remote/remote-styles.js +113 -0
- package/esm/browser/sandbox/remote-root.d.ts +11 -0
- package/esm/browser/sandbox/remote-root.js +81 -0
- package/esm/browser/sandbox/runtime/frame-api.d.ts +28 -0
- package/esm/browser/sandbox/runtime/frame-api.js +147 -0
- package/esm/browser/sandbox/runtime/frame-features.d.ts +6 -0
- package/esm/browser/sandbox/runtime/frame-features.js +50 -0
- package/esm/browser/sandbox/runtime/frame-parts.d.ts +36 -0
- package/esm/browser/sandbox/runtime/frame-parts.js +69 -0
- package/esm/browser/sandbox/runtime/frame-roots.d.ts +26 -0
- package/esm/browser/sandbox/runtime/frame-roots.js +76 -0
- package/esm/browser/sandbox/runtime/frame-store.d.ts +9 -0
- package/esm/browser/sandbox/runtime/frame-store.js +18 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.d.ts +11 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.js +45 -0
- package/esm/browser/sandbox/sandbox-features.d.ts +25 -0
- package/esm/browser/sandbox/sandbox-features.js +32 -0
- package/esm/browser/sandbox/sandbox-frame.d.ts +21 -0
- package/esm/browser/sandbox/sandbox-frame.js +75 -0
- package/esm/browser/sandbox/sandbox-guards.d.ts +19 -0
- package/esm/browser/sandbox/sandbox-guards.js +74 -0
- package/esm/browser/sandbox/sandbox-protocol.d.ts +57 -0
- package/esm/browser/sandbox/sandbox-protocol.js +49 -0
- package/esm/browser/sandbox/sandbox-runtime-code.d.ts +1 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +3 -0
- package/esm/browser/sandbox/web-sandbox.d.ts +28 -0
- package/esm/browser/sandbox/web-sandbox.js +44 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +5 -0
- package/esm/browser/style/tints.d.ts +2 -0
- package/esm/browser/style/tints.js +10 -0
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/view.js +1 -1
- package/lib/browser/apps/app-icon.d.ts +24 -0
- package/lib/browser/apps/app-icon.js +134 -0
- package/lib/browser/apps/app-settings.d.ts +7 -0
- package/lib/browser/apps/app-settings.js +103 -0
- package/lib/browser/apps/app-window-util.d.ts +24 -0
- package/lib/browser/apps/app-window-util.js +30 -0
- package/lib/browser/apps/app-window.d.ts +10 -0
- package/lib/browser/apps/app-window.js +126 -0
- package/lib/browser/apps/web-apps.d.ts +30 -0
- package/lib/browser/apps/web-apps.js +61 -0
- package/lib/browser/assistant/call-keeper.d.ts +2 -5
- package/lib/browser/assistant/call-keeper.js +6 -10
- package/lib/browser/components/access-settings.d.ts +7 -0
- package/lib/browser/components/access-settings.js +88 -0
- package/lib/browser/components/app-root.d.ts +7 -0
- package/lib/browser/components/app-root.js +70 -0
- package/lib/browser/components/app-view.d.ts +8 -2
- package/lib/browser/components/app-view.js +1 -25
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/settings-more.js +6 -0
- package/lib/browser/device/screen-awake.d.ts +16 -0
- package/lib/browser/device/screen-awake.js +39 -1
- package/lib/browser/device/sheet-swipe.js +4 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-access.d.ts +17 -0
- package/lib/browser/extension/web-access.js +78 -0
- package/lib/browser/extension/web-api-desktop.d.ts +23 -0
- package/lib/browser/extension/web-api-spec.d.ts +71 -0
- package/lib/browser/extension/web-api-spec.js +226 -0
- package/lib/browser/extension/web-extension-api.d.ts +6 -0
- package/lib/browser/extension/web-extension-context.js +11 -2
- package/lib/browser/extension/web-extension-run.d.ts +6 -1
- package/lib/browser/extension/web-extension-run.js +25 -0
- package/lib/browser/extension/web-extensions-running.d.ts +18 -1
- package/lib/browser/extension/web-extensions-running.js +102 -9
- package/lib/browser/extension/web-pages.d.ts +5 -0
- package/lib/browser/extension/web-pages.js +3 -0
- package/lib/browser/i18n/en/common.d.ts +1 -0
- package/lib/browser/i18n/en/common.js +1 -0
- package/lib/browser/i18n/en/discover.d.ts +11 -0
- package/lib/browser/i18n/en/discover.js +11 -0
- package/lib/browser/i18n/en/settings.d.ts +28 -0
- package/lib/browser/i18n/en/settings.js +28 -0
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/ja/discover.js +11 -0
- package/lib/browser/i18n/ja/settings.js +28 -0
- package/lib/browser/i18n/locales.d.ts +41 -3
- package/lib/browser/i18n/messages.d.ts +40 -2
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh/discover.js +11 -0
- package/lib/browser/i18n/zh/settings.js +28 -0
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/i18n/zh-tw/discover.js +11 -0
- package/lib/browser/i18n/zh-tw/settings.js +28 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.js +1 -0
- package/lib/browser/notices/notices.js +1 -0
- package/lib/browser/sandbox/channel/channel.d.ts +57 -0
- package/lib/browser/sandbox/channel/channel.js +128 -0
- package/lib/browser/sandbox/channel/codec.d.ts +81 -0
- package/lib/browser/sandbox/channel/codec.js +256 -0
- package/lib/browser/sandbox/hook-host.d.ts +24 -0
- package/lib/browser/sandbox/hook-host.js +98 -0
- package/lib/browser/sandbox/isolated-host.d.ts +106 -0
- package/lib/browser/sandbox/isolated-host.js +432 -0
- package/lib/browser/sandbox/remote/remote-copy.d.ts +57 -0
- package/lib/browser/sandbox/remote/remote-copy.js +306 -0
- package/lib/browser/sandbox/remote/remote-mirror.d.ts +62 -0
- package/lib/browser/sandbox/remote/remote-mirror.js +345 -0
- package/lib/browser/sandbox/remote/remote-protocol.d.ts +80 -0
- package/lib/browser/sandbox/remote/remote-protocol.js +57 -0
- package/lib/browser/sandbox/remote/remote-styles.d.ts +11 -0
- package/lib/browser/sandbox/remote/remote-styles.js +116 -0
- package/lib/browser/sandbox/remote-root.d.ts +12 -0
- package/lib/browser/sandbox/remote-root.js +117 -0
- package/lib/browser/sandbox/runtime/frame-api.d.ts +29 -0
- package/lib/browser/sandbox/runtime/frame-api.js +183 -0
- package/lib/browser/sandbox/runtime/frame-features.d.ts +7 -0
- package/lib/browser/sandbox/runtime/frame-features.js +53 -0
- package/lib/browser/sandbox/runtime/frame-parts.d.ts +37 -0
- package/lib/browser/sandbox/runtime/frame-parts.js +106 -0
- package/lib/browser/sandbox/runtime/frame-roots.d.ts +27 -0
- package/lib/browser/sandbox/runtime/frame-roots.js +113 -0
- package/lib/browser/sandbox/runtime/frame-store.d.ts +10 -0
- package/lib/browser/sandbox/runtime/frame-store.js +22 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.d.ts +12 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.js +47 -0
- package/lib/browser/sandbox/sandbox-features.d.ts +26 -0
- package/lib/browser/sandbox/sandbox-features.js +35 -0
- package/lib/browser/sandbox/sandbox-frame.d.ts +22 -0
- package/lib/browser/sandbox/sandbox-frame.js +79 -0
- package/lib/browser/sandbox/sandbox-guards.d.ts +20 -0
- package/lib/browser/sandbox/sandbox-guards.js +77 -0
- package/lib/browser/sandbox/sandbox-protocol.d.ts +58 -0
- package/lib/browser/sandbox/sandbox-protocol.js +52 -0
- package/lib/browser/sandbox/sandbox-runtime-code.d.ts +2 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +6 -0
- package/lib/browser/sandbox/web-sandbox.d.ts +29 -0
- package/lib/browser/sandbox/web-sandbox.js +47 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +5 -0
- package/lib/browser/style/tints.d.ts +2 -0
- package/lib/browser/style/tints.js +10 -0
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -21,5 +21,21 @@ export declare class ScreenAwake {
|
|
|
21
21
|
protected bridge(): ScreenAwakeBridge | undefined;
|
|
22
22
|
protected wakeLock(on: boolean): void;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Keeps the device awake for the page while any holds it (a call, a meeting written down): the screen stays on, and
|
|
26
|
+
* Ta Desktop keeps the display awake and the page unthrottled and does not restart under it (DesktopUtil.calling).
|
|
27
|
+
* One for the page, so that one letting go does not let the screen lock under another.
|
|
28
|
+
*/
|
|
29
|
+
export declare class KeepAwake {
|
|
30
|
+
protected readonly screen: Pick<ScreenAwake, 'set'>;
|
|
31
|
+
protected readonly desktop: () => ((active: boolean) => void) | undefined;
|
|
32
|
+
protected static instance?: KeepAwake;
|
|
33
|
+
protected holds: number;
|
|
34
|
+
static get shared(): KeepAwake;
|
|
35
|
+
constructor(screen?: Pick<ScreenAwake, 'set'>, desktop?: () => ((active: boolean) => void) | undefined);
|
|
36
|
+
/** Holds it till the function it returns is called (again calls do nothing). */
|
|
37
|
+
hold(): () => void;
|
|
38
|
+
protected set(on: boolean): void;
|
|
39
|
+
}
|
|
24
40
|
export {};
|
|
25
41
|
//# sourceMappingURL=screen-awake.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScreenAwake = void 0;
|
|
3
|
+
exports.KeepAwake = exports.ScreenAwake = void 0;
|
|
4
4
|
const desktop_1 = require("../util/desktop");
|
|
5
5
|
/**
|
|
6
6
|
* Keeps the screen of the device on while a call goes on, as a messenger does: a phone left alone locks after a
|
|
@@ -60,4 +60,42 @@ class ScreenAwake {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.ScreenAwake = ScreenAwake;
|
|
63
|
+
/**
|
|
64
|
+
* Keeps the device awake for the page while any holds it (a call, a meeting written down): the screen stays on, and
|
|
65
|
+
* Ta Desktop keeps the display awake and the page unthrottled and does not restart under it (DesktopUtil.calling).
|
|
66
|
+
* One for the page, so that one letting go does not let the screen lock under another.
|
|
67
|
+
*/
|
|
68
|
+
class KeepAwake {
|
|
69
|
+
static get shared() {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = KeepAwake.instance) !== null && _a !== void 0 ? _a : (KeepAwake.instance = new KeepAwake());
|
|
72
|
+
return KeepAwake.instance;
|
|
73
|
+
}
|
|
74
|
+
constructor(screen = new ScreenAwake(), desktop = () => desktop_1.DesktopUtil.calling()) {
|
|
75
|
+
this.screen = screen;
|
|
76
|
+
this.desktop = desktop;
|
|
77
|
+
this.holds = 0;
|
|
78
|
+
}
|
|
79
|
+
/** Holds it till the function it returns is called (again calls do nothing). */
|
|
80
|
+
hold() {
|
|
81
|
+
let held = true;
|
|
82
|
+
if (this.holds++ === 0) {
|
|
83
|
+
this.set(true);
|
|
84
|
+
}
|
|
85
|
+
return () => {
|
|
86
|
+
if (held) {
|
|
87
|
+
held = false;
|
|
88
|
+
if (--this.holds === 0) {
|
|
89
|
+
this.set(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
set(on) {
|
|
95
|
+
var _a;
|
|
96
|
+
(_a = this.desktop()) === null || _a === void 0 ? void 0 : _a(on);
|
|
97
|
+
this.screen.set(on);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.KeepAwake = KeepAwake;
|
|
63
101
|
//# sourceMappingURL=screen-awake.js.map
|
|
@@ -93,6 +93,10 @@ class TouchSources {
|
|
|
93
93
|
this.listened.delete(key);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
// A frame apart (a game of a reply, an extension in a sandbox) has no document to reach: WebKit says so as an error.
|
|
97
|
+
if (frame.hasAttribute('sandbox') && !frame.sandbox.contains('allow-same-origin')) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
96
100
|
let doc = null;
|
|
97
101
|
try {
|
|
98
102
|
doc = frame.contentDocument;
|
|
@@ -6,6 +6,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
6
6
|
exports.WEB_ICONS = Object.freeze({
|
|
7
7
|
AlarmClock: lucide_react_1.AlarmClock,
|
|
8
8
|
Aperture: lucide_react_1.Aperture,
|
|
9
|
+
AppWindow: lucide_react_1.AppWindow,
|
|
9
10
|
Archive: lucide_react_1.Archive,
|
|
10
11
|
ArrowDown: lucide_react_1.ArrowDown,
|
|
11
12
|
ArrowLeft: lucide_react_1.ArrowLeft,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TaExtensionAccess, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { MessageId } from '../i18n/messages';
|
|
3
|
+
import type { WebExtensionAPI } from './web-extension-api';
|
|
4
|
+
export declare namespace WebAccessUtil {
|
|
5
|
+
/**
|
|
6
|
+
* What an extension may run with: a built-in, or from a ta serve older than access, all; one of a package, what the
|
|
7
|
+
* user allowed of this version of it; undefined while they have not (it waits to be allowed).
|
|
8
|
+
*/
|
|
9
|
+
function granted(info: TaWebExtensionInfo | undefined): TaExtensionAccess | undefined;
|
|
10
|
+
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
11
|
+
function source(info: TaWebExtensionInfo, say: (id: MessageId) => string): string;
|
|
12
|
+
/** The API as far as `granted` reaches (WEB_API_SPEC): what is beyond it throws, saying what to ask for. */
|
|
13
|
+
function limit(api: WebExtensionAPI, granted: TaExtensionAccess, name: string): WebExtensionAPI;
|
|
14
|
+
/** Why a member is not there: what the extension has, what the member needs, and how to ask for it. */
|
|
15
|
+
function refusal(name: string, granted: TaExtensionAccess, path: string, need: TaExtensionAccess): string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=web-access.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebAccessUtil = void 0;
|
|
4
|
+
// Of its own module: the runtime of the sandbox bundles this file (sandbox/runtime), without the rest of the protocol.
|
|
5
|
+
const package_protocol_1 = require("@celljs/ta-protocol/lib/common/package-protocol");
|
|
6
|
+
const web_api_spec_1 = require("./web-api-spec");
|
|
7
|
+
var WebAccessUtil;
|
|
8
|
+
(function (WebAccessUtil) {
|
|
9
|
+
/**
|
|
10
|
+
* What an extension may run with: a built-in, or from a ta serve older than access, all; one of a package, what the
|
|
11
|
+
* user allowed of this version of it; undefined while they have not (it waits to be allowed).
|
|
12
|
+
*/
|
|
13
|
+
function granted(info) {
|
|
14
|
+
if (!info || info.access === undefined) {
|
|
15
|
+
return 'full';
|
|
16
|
+
}
|
|
17
|
+
return info.granted;
|
|
18
|
+
}
|
|
19
|
+
WebAccessUtil.granted = granted;
|
|
20
|
+
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
21
|
+
function source(info, say) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (((_a = info.temporary) === null || _a === void 0 ? void 0 : _a.from) === 'link') {
|
|
24
|
+
return say('ta.access.fromLink');
|
|
25
|
+
}
|
|
26
|
+
if (((_b = info.temporary) === null || _b === void 0 ? void 0 : _b.from) === 'market') {
|
|
27
|
+
return say('ta.access.fromMarket');
|
|
28
|
+
}
|
|
29
|
+
return info.source;
|
|
30
|
+
}
|
|
31
|
+
WebAccessUtil.source = source;
|
|
32
|
+
/** The API as far as `granted` reaches (WEB_API_SPEC): what is beyond it throws, saying what to ask for. */
|
|
33
|
+
function limit(api, granted, name) {
|
|
34
|
+
return granted === 'full' ? api : only(api, web_api_spec_1.WEB_API_SPEC, granted, name, '');
|
|
35
|
+
}
|
|
36
|
+
WebAccessUtil.limit = limit;
|
|
37
|
+
/** Why a member is not there: what the extension has, what the member needs, and how to ask for it. */
|
|
38
|
+
function refusal(name, granted, path, need) {
|
|
39
|
+
return `The web extension ${name} has ${granted} access; pi.${path} needs ${need}: declare "pi": { "access": "${need}" } in its package.json.`;
|
|
40
|
+
}
|
|
41
|
+
WebAccessUtil.refusal = refusal;
|
|
42
|
+
function only(whole, spec, granted, name, prefix) {
|
|
43
|
+
const part = {};
|
|
44
|
+
for (const [key, entry] of Object.entries(spec)) {
|
|
45
|
+
const descriptor = Object.getOwnPropertyDescriptor(whole, key);
|
|
46
|
+
if (!package_protocol_1.TaExtensionAccessUtil.reaches(granted, entry.access)) {
|
|
47
|
+
Object.defineProperty(part, key, {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get() {
|
|
50
|
+
throw new Error(refusal(name, granted, prefix + key, entry.access));
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else if (entry.form === 'group' && descriptor) {
|
|
55
|
+
// As far as it reaches too, the same object while the API gives the same one.
|
|
56
|
+
let cut;
|
|
57
|
+
Object.defineProperty(part, key, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get() {
|
|
60
|
+
const from = whole[key];
|
|
61
|
+
if (!from || typeof from !== 'object') {
|
|
62
|
+
return from;
|
|
63
|
+
}
|
|
64
|
+
if ((cut === null || cut === void 0 ? void 0 : cut.from) !== from) {
|
|
65
|
+
cut = { from, part: only(from, entry.members, granted, name, `${prefix}${key}.`) };
|
|
66
|
+
}
|
|
67
|
+
return cut.part;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else if (descriptor) {
|
|
72
|
+
Object.defineProperty(part, key, descriptor);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return part;
|
|
76
|
+
}
|
|
77
|
+
})(WebAccessUtil || (exports.WebAccessUtil = WebAccessUtil = {}));
|
|
78
|
+
//# sourceMappingURL=web-access.js.map
|
|
@@ -13,6 +13,11 @@ export interface WebDeviceUI {
|
|
|
13
13
|
* `download` saves it. Newer than some Ta apps.
|
|
14
14
|
*/
|
|
15
15
|
readonly saveFile?: (file: Blob, name: string) => Promise<WebFileSaved>;
|
|
16
|
+
/**
|
|
17
|
+
* Pages installed as apps of the computer, each with a window, a name and an icon of its own (Launchpad, the Dock, the
|
|
18
|
+
* Start menu): in Ta Desktop only, `pi.ui.apps?.…`. An extension installs, opens and removes only pages of its own.
|
|
19
|
+
*/
|
|
20
|
+
readonly apps?: WebApps;
|
|
16
21
|
}
|
|
17
22
|
export interface WebDesktop {
|
|
18
23
|
/** Node's `process.platform` of the machine (`darwin`, `win32`, `linux`): what its file manager is called. */
|
|
@@ -68,4 +73,22 @@ export interface WebFileDrag {
|
|
|
68
73
|
/** Their absolute paths inside their machine. */
|
|
69
74
|
paths(files: WebDraggedFiles): string[];
|
|
70
75
|
}
|
|
76
|
+
/** A page installed as an app of the computer (WebApps). */
|
|
77
|
+
export interface WebInstalledApp {
|
|
78
|
+
/** The id of the page, as `ui.showView` takes it. */
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
installedAt: number;
|
|
82
|
+
}
|
|
83
|
+
/** The pages installed as apps of the computer (WebExtensionUI.apps, docs/design/ta-install-as-app.md). */
|
|
84
|
+
export interface WebApps {
|
|
85
|
+
/** Whether a page may be installed now: the user lets pages be installed (Settings, Extensions). */
|
|
86
|
+
readonly installable: boolean;
|
|
87
|
+
list(): Promise<WebInstalledApp[]>;
|
|
88
|
+
/** Installs the page (its title and its icon, as the launcher shows it) and opens its window; again, to name it anew. */
|
|
89
|
+
install(id: string): Promise<void>;
|
|
90
|
+
remove(id: string): Promise<void>;
|
|
91
|
+
/** Its window in front, opened when it is not. */
|
|
92
|
+
open(id: string): Promise<void>;
|
|
93
|
+
}
|
|
71
94
|
//# sourceMappingURL=web-api-desktop.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { TaExtensionAccess } from '@celljs/ta-protocol';
|
|
2
|
+
import type { WebExtensionAPI, WebExtensionUI } from './web-extension-api';
|
|
3
|
+
/**
|
|
4
|
+
* Where the components and the labels are in what crosses (docs/design/ta-extension-access.md 3.2): `C` a component,
|
|
5
|
+
* drawn where the page shows it; `L` a label, a string or a function read at once into one; `X` what the page would
|
|
6
|
+
* read without waiting and cannot from a sandbox, left out; or the fields of an object. Any other function is a
|
|
7
|
+
* callback, its result a promise; data is cloned as it is (a Blob too).
|
|
8
|
+
*/
|
|
9
|
+
export type WebApiShape = 'C' | 'L' | 'X' | WebApiFields;
|
|
10
|
+
export interface WebApiFields {
|
|
11
|
+
readonly fields?: Readonly<Record<string, WebApiShape>>;
|
|
12
|
+
/** Of every item of an array. */
|
|
13
|
+
readonly each?: WebApiShape;
|
|
14
|
+
/** Methods the page reads without waiting (`items()`): read where the extension runs, again whenever its `subscribe` says. */
|
|
15
|
+
readonly live?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* How a member of the API crosses to an extension in a sandbox (3.2): `call` an async function; `fire` one that returns
|
|
19
|
+
* nothing; `hold` one that returns how to stop; `hook` a React hook whose value is data; `value` a property and `read`
|
|
20
|
+
* a method of no arguments, data both, read again as the page changes; `component` one of Ta, `components` a record of
|
|
21
|
+
* them; `group` an object of members of their own; `local` given by the sandbox itself; `page` only in the page, which is
|
|
22
|
+
* why it needs full access.
|
|
23
|
+
*/
|
|
24
|
+
export type WebApiForm = WebApiEntry['form'];
|
|
25
|
+
export type WebApiEntry = {
|
|
26
|
+
readonly form: 'page';
|
|
27
|
+
readonly access: 'full';
|
|
28
|
+
} | {
|
|
29
|
+
readonly form: 'local' | 'value' | 'read' | 'component' | 'components';
|
|
30
|
+
readonly access: TaExtensionAccess;
|
|
31
|
+
} | {
|
|
32
|
+
readonly form: 'fire' | 'hold';
|
|
33
|
+
readonly access: TaExtensionAccess;
|
|
34
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
35
|
+
}
|
|
36
|
+
/** `url`: it resolves with an address of the page, which a sandbox cannot load: what it holds crosses, a `blob:` there. */
|
|
37
|
+
| {
|
|
38
|
+
readonly form: 'call';
|
|
39
|
+
readonly access: TaExtensionAccess;
|
|
40
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
41
|
+
readonly returns?: 'url';
|
|
42
|
+
}
|
|
43
|
+
/** `peek`: a hook of no arguments, read before the extension starts, so that its first render has its value. */
|
|
44
|
+
| {
|
|
45
|
+
readonly form: 'hook';
|
|
46
|
+
readonly access: TaExtensionAccess;
|
|
47
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
48
|
+
readonly peek?: true;
|
|
49
|
+
} | {
|
|
50
|
+
readonly form: 'group';
|
|
51
|
+
readonly access: TaExtensionAccess;
|
|
52
|
+
readonly members: Readonly<Record<string, WebApiEntry>>;
|
|
53
|
+
};
|
|
54
|
+
/** An entry for every member: a member added to the API without one does not compile. */
|
|
55
|
+
export type WebApiSpec<T> = {
|
|
56
|
+
readonly [K in keyof Required<T>]: WebApiEntry;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What each member of `pi.ui` needs and how it crosses. `browser`: what any page draws and asks. `app`: what Ta does
|
|
60
|
+
* for the extension as an app, in sight of the user. `full`: the computer, the conversations, the people, the other
|
|
61
|
+
* extensions, and what only the page can give (a page object, an element, an engine).
|
|
62
|
+
*/
|
|
63
|
+
export declare const WEB_UI_SPEC: WebApiSpec<WebExtensionUI>;
|
|
64
|
+
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
65
|
+
export declare const WEB_API_SPEC: WebApiSpec<WebExtensionAPI>;
|
|
66
|
+
/** A member of the API by its path (`ui.voice.speak`), and every member with its path. */
|
|
67
|
+
export declare namespace WebApiSpecUtil {
|
|
68
|
+
function find(path: string): WebApiEntry | undefined;
|
|
69
|
+
function each(visit: (path: string, entry: WebApiEntry) => void, members?: Readonly<Record<string, WebApiEntry>>, prefix?: string): void;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=web-api-spec.d.ts.map
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebApiSpecUtil = exports.WEB_API_SPEC = exports.WEB_UI_SPEC = void 0;
|
|
4
|
+
const B = 'browser';
|
|
5
|
+
const A = 'app';
|
|
6
|
+
const page = { form: 'page', access: 'full' };
|
|
7
|
+
const local = (access) => ({ form: 'local', access });
|
|
8
|
+
const value = (access) => ({ form: 'value', access });
|
|
9
|
+
const read = (access) => ({ form: 'read', access });
|
|
10
|
+
const component = (access) => ({ form: 'component', access });
|
|
11
|
+
const call = (access, args) => ({ form: 'call', access, ...(args ? { args } : {}) });
|
|
12
|
+
const fire = (access, args) => ({ form: 'fire', access, ...(args ? { args } : {}) });
|
|
13
|
+
const hold = (access, args) => ({ form: 'hold', access, ...(args ? { args } : {}) });
|
|
14
|
+
const hook = (access, args) => ({ form: 'hook', access, ...(args ? { args } : {}) });
|
|
15
|
+
const peek = (access) => ({ form: 'hook', access, peek: true });
|
|
16
|
+
const group = (access, members) => ({ form: 'group', access, members });
|
|
17
|
+
/** A view, an editor tab: its components, its labels, and what the page reads of it without waiting. */
|
|
18
|
+
const VIEW = { fields: { title: 'L', render: 'C', head: 'C', mark: 'C', icon: 'C' }, live: ['menu', 'preview', 'busy'] };
|
|
19
|
+
const EDITOR = { fields: { title: 'L', tooltip: 'L', icon: 'C', render: 'C' } };
|
|
20
|
+
const SETTINGS = {
|
|
21
|
+
fields: {
|
|
22
|
+
title: 'L',
|
|
23
|
+
icon: 'C',
|
|
24
|
+
rows: { each: { fields: { label: 'L', search: 'L', description: 'L', render: 'C' } } },
|
|
25
|
+
signIn: { fields: { hint: 'L' } },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const STORAGE = {
|
|
29
|
+
get: call(B),
|
|
30
|
+
set: call(B),
|
|
31
|
+
onChange: hold(B),
|
|
32
|
+
directory: page,
|
|
33
|
+
};
|
|
34
|
+
const APPS = {
|
|
35
|
+
installable: value(A),
|
|
36
|
+
list: call(A),
|
|
37
|
+
install: call(A),
|
|
38
|
+
remove: call(A),
|
|
39
|
+
open: call(A),
|
|
40
|
+
};
|
|
41
|
+
const VOICE = {
|
|
42
|
+
canListen: read(A),
|
|
43
|
+
canSpeak: read(A),
|
|
44
|
+
speak: fire(A),
|
|
45
|
+
hush: fire(A),
|
|
46
|
+
transcribe: call(A),
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* What each member of `pi.ui` needs and how it crosses. `browser`: what any page draws and asks. `app`: what Ta does
|
|
50
|
+
* for the extension as an app, in sight of the user. `full`: the computer, the conversations, the people, the other
|
|
51
|
+
* extensions, and what only the page can give (a page object, an element, an engine).
|
|
52
|
+
*/
|
|
53
|
+
exports.WEB_UI_SPEC = {
|
|
54
|
+
confirm: call(B),
|
|
55
|
+
input: call(B),
|
|
56
|
+
editor: call(B),
|
|
57
|
+
theme: value(B),
|
|
58
|
+
language: value(B),
|
|
59
|
+
supportsWebview: value(B),
|
|
60
|
+
doubleInChats: value(B),
|
|
61
|
+
useDevice: peek(B),
|
|
62
|
+
showView: call(B),
|
|
63
|
+
showChats: fire(B),
|
|
64
|
+
custom: hold(B, ['C']),
|
|
65
|
+
openEditor: fire(B, [EDITOR]),
|
|
66
|
+
closeEditor: fire(B),
|
|
67
|
+
pinEditor: fire(B),
|
|
68
|
+
setEditorDirty: fire(B),
|
|
69
|
+
EditorActions: component(B),
|
|
70
|
+
Avatar: component(B),
|
|
71
|
+
Face: component(B),
|
|
72
|
+
GroupFace: component(B),
|
|
73
|
+
icons: { form: 'components', access: B },
|
|
74
|
+
CodeEditor: component(B),
|
|
75
|
+
DiffEditor: component(B),
|
|
76
|
+
FullScreen: component(B),
|
|
77
|
+
Stack: component(B),
|
|
78
|
+
Markdown: component(B),
|
|
79
|
+
Empty: component(B),
|
|
80
|
+
Loading: component(B),
|
|
81
|
+
Skeleton: component(B),
|
|
82
|
+
useBusy: local(B),
|
|
83
|
+
useBackLayer: hook(B),
|
|
84
|
+
Switch: component(B),
|
|
85
|
+
HostTag: component(B),
|
|
86
|
+
SwipeRow: component(B),
|
|
87
|
+
SelectCheck: component(B),
|
|
88
|
+
SelectBar: component(B),
|
|
89
|
+
TaskIcon: component(B),
|
|
90
|
+
Picture: component(B),
|
|
91
|
+
PictureCards: component(B),
|
|
92
|
+
ImageViewer: component(B),
|
|
93
|
+
ChatImages: component(B),
|
|
94
|
+
QrCode: component(B),
|
|
95
|
+
Dialog: component(B),
|
|
96
|
+
setWidget: fire(A, [null, 'C', { fields: { title: 'L' } }]),
|
|
97
|
+
notify: fire(A),
|
|
98
|
+
notifySession: fire(A),
|
|
99
|
+
usePages: peek(A),
|
|
100
|
+
scanCode: call(A),
|
|
101
|
+
scan: call(A),
|
|
102
|
+
saveFile: call(A),
|
|
103
|
+
shareExtension: fire(A),
|
|
104
|
+
stopExtension: fire(A),
|
|
105
|
+
forgetPage: fire(A),
|
|
106
|
+
useView: hook(A),
|
|
107
|
+
useScreenPart: hook(A),
|
|
108
|
+
useHomeShown: peek(A),
|
|
109
|
+
useActiveEditor: peek(A),
|
|
110
|
+
HoldToTalk: component(A),
|
|
111
|
+
voice: group(A, VOICE),
|
|
112
|
+
keepAwake: hold(A),
|
|
113
|
+
apps: group(A, APPS),
|
|
114
|
+
// An element, a node to draw, an answer at once, an engine: only in the page.
|
|
115
|
+
useContextMenu: page,
|
|
116
|
+
attachMenu: page,
|
|
117
|
+
useChatScroll: page,
|
|
118
|
+
fileDrag: page,
|
|
119
|
+
addToComposer: page,
|
|
120
|
+
Game: page,
|
|
121
|
+
Game3D: page,
|
|
122
|
+
// The computer, the conversations, the people, the other extensions.
|
|
123
|
+
useRoomAddons: page,
|
|
124
|
+
fileMenu: page,
|
|
125
|
+
pinChat: page,
|
|
126
|
+
desktop: page,
|
|
127
|
+
debugWebview: page,
|
|
128
|
+
useCwd: page,
|
|
129
|
+
useSessionId: page,
|
|
130
|
+
useSessions: page,
|
|
131
|
+
useSavedSessions: page,
|
|
132
|
+
useAsks: page,
|
|
133
|
+
answer: page,
|
|
134
|
+
screen: page,
|
|
135
|
+
openShared: page,
|
|
136
|
+
connect: page,
|
|
137
|
+
useTasks: page,
|
|
138
|
+
removeTasks: page,
|
|
139
|
+
createTerminal: page,
|
|
140
|
+
Composer: page,
|
|
141
|
+
Conversation: page,
|
|
142
|
+
ShareSheet: page,
|
|
143
|
+
FolderPicker: page,
|
|
144
|
+
ModelPicker: page,
|
|
145
|
+
useHomeItems: page,
|
|
146
|
+
openHome: page,
|
|
147
|
+
startGroup: page,
|
|
148
|
+
openPartner: page,
|
|
149
|
+
};
|
|
150
|
+
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
151
|
+
exports.WEB_API_SPEC = {
|
|
152
|
+
React: local(B),
|
|
153
|
+
ui: group(B, exports.WEB_UI_SPEC),
|
|
154
|
+
storage: group(B, STORAGE),
|
|
155
|
+
fileUrl: { form: 'call', access: B, returns: 'url' },
|
|
156
|
+
openLink: call(B),
|
|
157
|
+
registerView: fire(B, [null, VIEW]),
|
|
158
|
+
registerMessageRenderer: fire(B, [null, 'C']),
|
|
159
|
+
registerCodeRenderer: fire(A, [null, 'C', { fields: { spoken: 'X' } }]),
|
|
160
|
+
registerAvatar: fire(A, ['C']),
|
|
161
|
+
registerHomeItems: fire(A, [{ live: ['items'] }]),
|
|
162
|
+
registerTasks: fire(A, [{ live: ['tasks'] }]),
|
|
163
|
+
registerSettings: fire(A, [SETTINGS]),
|
|
164
|
+
reloadExtensions: call(A),
|
|
165
|
+
// Drawn or answered at once, frame by frame: only in the page.
|
|
166
|
+
registerCallPartner: page,
|
|
167
|
+
registerCallMouth: page,
|
|
168
|
+
registerCallMoves: page,
|
|
169
|
+
registerChatIcon: page,
|
|
170
|
+
registerChatTag: page,
|
|
171
|
+
registerInitiative: page,
|
|
172
|
+
registerTool: page,
|
|
173
|
+
registerToolRenderer: page,
|
|
174
|
+
registerComposerAddon: page,
|
|
175
|
+
registerRoomAddon: page,
|
|
176
|
+
registerOpener: page,
|
|
177
|
+
registerSearch: page,
|
|
178
|
+
registerPartners: page,
|
|
179
|
+
registerSessionMenu: page,
|
|
180
|
+
registerFileMenu: page,
|
|
181
|
+
on: page,
|
|
182
|
+
sendUserMessage: page,
|
|
183
|
+
switchSession: page,
|
|
184
|
+
openChat: page,
|
|
185
|
+
callHost: page,
|
|
186
|
+
openTemporary: page,
|
|
187
|
+
onRoomEvent: page,
|
|
188
|
+
onTerminalData: page,
|
|
189
|
+
server: page,
|
|
190
|
+
workspace: page,
|
|
191
|
+
terminals: page,
|
|
192
|
+
packages: page,
|
|
193
|
+
files: page,
|
|
194
|
+
remote: page,
|
|
195
|
+
screenShare: page,
|
|
196
|
+
onScreenShareEvent: page,
|
|
197
|
+
settings: page,
|
|
198
|
+
rooms: page,
|
|
199
|
+
};
|
|
200
|
+
/** A member of the API by its path (`ui.voice.speak`), and every member with its path. */
|
|
201
|
+
var WebApiSpecUtil;
|
|
202
|
+
(function (WebApiSpecUtil) {
|
|
203
|
+
function find(path) {
|
|
204
|
+
let members = exports.WEB_API_SPEC;
|
|
205
|
+
let found;
|
|
206
|
+
for (const key of path.split('.')) {
|
|
207
|
+
found = Object.keys(members).includes(key) ? members[key] : undefined;
|
|
208
|
+
if (!found) {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
members = found.form === 'group' ? found.members : {};
|
|
212
|
+
}
|
|
213
|
+
return found;
|
|
214
|
+
}
|
|
215
|
+
WebApiSpecUtil.find = find;
|
|
216
|
+
function each(visit, members = exports.WEB_API_SPEC, prefix = '') {
|
|
217
|
+
for (const [key, entry] of Object.entries(members)) {
|
|
218
|
+
visit(prefix + key, entry);
|
|
219
|
+
if (entry.form === 'group') {
|
|
220
|
+
each(visit, entry.members, `${prefix}${key}.`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
WebApiSpecUtil.each = each;
|
|
225
|
+
})(WebApiSpecUtil || (exports.WebApiSpecUtil = WebApiSpecUtil = {}));
|
|
226
|
+
//# sourceMappingURL=web-api-spec.js.map
|
|
@@ -480,6 +480,12 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI,
|
|
|
480
480
|
readonly HoldToTalk: React.ComponentType<WebHoldToTalkProps>;
|
|
481
481
|
/** Listening and reading aloud as the conversations of the page do: its recognizer, the voice of the settings. */
|
|
482
482
|
readonly voice: WebVoice;
|
|
483
|
+
/**
|
|
484
|
+
* Keeps the device awake till the function it returns is called, as a call does: the screen does not lock (locked,
|
|
485
|
+
* a phone stops hearing), and Ta Desktop keeps the display on and does not restart. For what listens long (a
|
|
486
|
+
* meeting written down); let it go when it stops. Newer than some Ta apps: `pi.ui.keepAwake?.()`.
|
|
487
|
+
*/
|
|
488
|
+
readonly keepAwake?: () => () => void;
|
|
483
489
|
/** As the conversations show it; `inline`: in a line; `send`, `answer`: a group chat's, for taps in cards (newer). */
|
|
484
490
|
readonly Markdown: React.ComponentType<{
|
|
485
491
|
text: string;
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.WebExtensionContext = void 0;
|
|
37
37
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
|
+
const web_apps_1 = require("../apps/web-apps");
|
|
39
40
|
const task_views_1 = require("../assistant/task-views");
|
|
40
41
|
const web_voice_1 = require("../assistant/web-voice");
|
|
41
42
|
const busy_1 = require("../components/busy");
|
|
@@ -73,6 +74,7 @@ const back_stack_1 = require("../device/back-stack");
|
|
|
73
74
|
const code_scan_1 = require("../device/code-scan");
|
|
74
75
|
const device_1 = require("../device/device");
|
|
75
76
|
const file_save_1 = require("../device/file-save");
|
|
77
|
+
const screen_awake_1 = require("../device/screen-awake");
|
|
76
78
|
const drafts_protocol_1 = require("../drafts/drafts-protocol");
|
|
77
79
|
const game_view_1 = require("../game/game-view");
|
|
78
80
|
const messages_1 = require("../i18n/messages");
|
|
@@ -82,6 +84,7 @@ const web_terminal_1 = require("../terminal/web-terminal");
|
|
|
82
84
|
const desktop_1 = require("../util/desktop");
|
|
83
85
|
const file_drag_1 = require("../util/file-drag");
|
|
84
86
|
const icons_1 = require("./icons");
|
|
87
|
+
const web_access_1 = require("./web-access");
|
|
85
88
|
const web_extension_protocol_1 = require("./web-extension-protocol");
|
|
86
89
|
const web_extension_run_1 = require("./web-extension-run");
|
|
87
90
|
const web_home_1 = require("./web-home");
|
|
@@ -167,6 +170,7 @@ class WebExtensionContext {
|
|
|
167
170
|
return props => this.composer({ ...props, draft: props.draft === undefined ? undefined : drafts_protocol_1.DraftPlaces.extension(name, props.draft) });
|
|
168
171
|
}
|
|
169
172
|
create(run) {
|
|
173
|
+
var _a;
|
|
170
174
|
const { host } = this;
|
|
171
175
|
const { workbench, files } = host;
|
|
172
176
|
const register = (change) => {
|
|
@@ -184,7 +188,7 @@ class WebExtensionContext {
|
|
|
184
188
|
let server;
|
|
185
189
|
/** Listens while the extension runs, what it hears guarded as all it runs. */
|
|
186
190
|
const hear = (on, listener) => web_extension_run_1.WebExtensionRunUtil.track(run, () => on((...args) => host.guard(run, () => listener(...args))));
|
|
187
|
-
|
|
191
|
+
const api = {
|
|
188
192
|
React,
|
|
189
193
|
get server() {
|
|
190
194
|
if ((server === null || server === void 0 ? void 0 : server.of) !== workbench.server) {
|
|
@@ -292,6 +296,8 @@ class WebExtensionContext {
|
|
|
292
296
|
callHost: (method, ...params) => live(() => workbench.packages.callPackageHost(run.loaded.name, method, params)),
|
|
293
297
|
reloadExtensions: () => live(() => host.extensions.reloadPackages()),
|
|
294
298
|
};
|
|
299
|
+
// As far as the user allowed this version of its package (docs/design/ta-extension-access.md); only an allowed one starts.
|
|
300
|
+
return web_access_1.WebAccessUtil.limit(api, (_a = web_access_1.WebAccessUtil.granted(run.loaded.info)) !== null && _a !== void 0 ? _a : 'browser', run.loaded.name);
|
|
295
301
|
}
|
|
296
302
|
ui(run, register) {
|
|
297
303
|
const { host } = this;
|
|
@@ -453,7 +459,10 @@ class WebExtensionContext {
|
|
|
453
459
|
GroupFace: face_1.GroupFace,
|
|
454
460
|
Composer: this.composerOf(run),
|
|
455
461
|
HoldToTalk: this.holdToTalk,
|
|
456
|
-
voice: this.voice,
|
|
462
|
+
voice: web_extension_run_1.WebExtensionRunUtil.voice(run, this.voice),
|
|
463
|
+
// Let go as the extension stops, whether or not it did; nothing held once stopped.
|
|
464
|
+
keepAwake: () => web_extension_run_1.WebExtensionRunUtil.track(run, () => screen_awake_1.KeepAwake.shared.hold()),
|
|
465
|
+
apps: web_apps_1.TaWebApps.of({ pages: () => host.extensions.pages(), settings, notices, fallbackIcon: icons_1.WEB_ICONS.Puzzle }),
|
|
457
466
|
Markdown: markdown_1.Markdown,
|
|
458
467
|
Conversation: conversation_view_1.ConversationView,
|
|
459
468
|
useChatScroll: (sent, key) => (0, conversation_scroll_hooks_1.useConversationScroll)(sent, { sentTo: 'bottom', key }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api';
|
|
3
|
+
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -60,6 +60,11 @@ export declare namespace WebExtensionRunUtil {
|
|
|
60
60
|
function clear(run: WebExtensionRun): void;
|
|
61
61
|
/** Subscribes for the extension: undone when it stops, or by the function returned. */
|
|
62
62
|
function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
65
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
66
|
+
*/
|
|
67
|
+
function voice(run: WebExtensionRun, voice: WebVoice): WebVoice;
|
|
63
68
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
64
69
|
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
65
70
|
}
|
|
@@ -75,6 +75,31 @@ var WebExtensionRunUtil;
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
WebExtensionRunUtil.track = track;
|
|
78
|
+
/**
|
|
79
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
80
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
81
|
+
*/
|
|
82
|
+
function voice(run, voice) {
|
|
83
|
+
return {
|
|
84
|
+
...voice,
|
|
85
|
+
transcribe: async (listener) => {
|
|
86
|
+
const transcribing = run.stopped ? undefined : await voice.transcribe(listener);
|
|
87
|
+
if (!transcribing || run.stopped) {
|
|
88
|
+
transcribing === null || transcribing === void 0 ? void 0 : transcribing.stop();
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
let stopped = false;
|
|
92
|
+
const stop = () => {
|
|
93
|
+
if (!stopped) {
|
|
94
|
+
stopped = true;
|
|
95
|
+
transcribing.stop();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return { service: transcribing.service, stop: track(run, () => stop) };
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
WebExtensionRunUtil.voice = voice;
|
|
78
103
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
79
104
|
function collect(runs, onOpen) {
|
|
80
105
|
var _a;
|