@celljs/ta-web 4.34.0 → 4.36.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/assistant-thread.js +2 -2
- package/esm/browser/assistant/call-keeper.d.ts +2 -5
- package/esm/browser/assistant/call-keeper.js +7 -11
- package/esm/browser/assistant/mic-capture.d.ts +34 -0
- package/esm/browser/assistant/mic-capture.js +87 -0
- package/esm/browser/assistant/realtime-voice.d.ts +2 -2
- package/esm/browser/assistant/realtime-voice.js +6 -15
- 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/board.d.ts +2 -2
- package/esm/browser/components/board.js +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box-hooks.d.ts +12 -0
- package/esm/browser/components/composer-box-hooks.js +12 -0
- package/esm/browser/components/composer-box-protocol.d.ts +12 -1
- package/esm/browser/components/composer-box.js +14 -11
- package/esm/browser/components/composer.js +69 -3
- package/esm/browser/components/extension-settings.d.ts +7 -0
- package/esm/browser/components/extension-settings.js +32 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +3 -3
- package/esm/browser/components/message-steps.js +3 -3
- package/esm/browser/components/phone-shell.d.ts +2 -2
- package/esm/browser/components/request-error.d.ts +9 -0
- package/esm/browser/components/request-error.js +21 -0
- package/esm/browser/components/settings-more.js +13 -24
- package/esm/browser/components/storage-settings.d.ts +17 -0
- package/esm/browser/components/storage-settings.js +145 -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-contributions.d.ts +6 -7
- 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 +225 -0
- package/esm/browser/extension/web-api-targets.d.ts +11 -0
- package/esm/browser/extension/web-api-targets.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +11 -1
- package/esm/browser/extension/web-extension-context.d.ts +3 -2
- package/esm/browser/extension/web-extension-context.js +22 -17
- package/esm/browser/extension/web-extension-run.d.ts +8 -1
- package/esm/browser/extension/web-extension-run.js +37 -0
- package/esm/browser/extension/web-extensions-running.d.ts +20 -1
- package/esm/browser/extension/web-extensions-running.js +107 -9
- package/esm/browser/extension/web-extensions.js +1 -0
- package/esm/browser/extension/web-pages.d.ts +5 -0
- package/esm/browser/extension/web-pages.js +3 -0
- package/esm/browser/game/game-control.d.ts +6 -0
- package/esm/browser/game/game-control.js +28 -0
- package/esm/browser/game/game-host.d.ts +9 -2
- package/esm/browser/game/game-host.js +5 -1
- package/esm/browser/game/game-protocol.d.ts +8 -0
- package/esm/browser/game/game-runner.d.ts +7 -1
- package/esm/browser/game/game-runner.js +24 -2
- package/esm/browser/game/game-target.d.ts +22 -0
- package/esm/browser/game/game-target.js +84 -0
- package/esm/browser/game/game-util.d.ts +2 -0
- package/esm/browser/game/game-util.js +2 -0
- package/esm/browser/game/game-view.d.ts +5 -2
- package/esm/browser/game/game-view.js +4 -4
- package/esm/browser/game/game3d-protocol.d.ts +3 -1
- package/esm/browser/game/game3d-runner.d.ts +6 -1
- package/esm/browser/game/game3d-runner.js +26 -2
- package/esm/browser/i18n/en/chat.d.ts +4 -0
- package/esm/browser/i18n/en/chat.js +4 -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 +43 -0
- package/esm/browser/i18n/en/settings.js +43 -0
- package/esm/browser/i18n/ja/chat.js +4 -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 +43 -0
- package/esm/browser/i18n/locales.d.ts +60 -3
- package/esm/browser/i18n/messages.d.ts +59 -2
- package/esm/browser/i18n/zh/chat.js +4 -0
- 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 +43 -0
- package/esm/browser/i18n/zh-tw/chat.js +4 -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 +43 -0
- package/esm/browser/index.d.ts +3 -0
- package/esm/browser/index.js +3 -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 +57 -0
- package/esm/browser/sandbox/remote/remote-copy.js +318 -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/agent-settings.js +5 -1
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +4 -0
- package/esm/browser/style/tints.d.ts +2 -0
- package/esm/browser/style/tints.js +10 -0
- package/esm/browser/targets/targets-protocol.d.ts +54 -0
- package/esm/browser/targets/targets-protocol.js +34 -0
- package/esm/browser/targets/targets.d.ts +13 -0
- package/esm/browser/targets/targets.js +64 -0
- package/esm/browser/util/composer.d.ts +4 -2
- package/esm/browser/util/composer.js +7 -1
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/util/message.d.ts +6 -0
- package/esm/browser/util/message.js +21 -0
- package/esm/browser/util/process.d.ts +1 -0
- package/esm/browser/util/process.js +6 -1
- package/esm/browser/util/progress.d.ts +2 -1
- package/esm/browser/util/progress.js +2 -11
- 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/assistant-thread.js +2 -2
- package/lib/browser/assistant/call-keeper.d.ts +2 -5
- package/lib/browser/assistant/call-keeper.js +6 -10
- package/lib/browser/assistant/mic-capture.d.ts +35 -0
- package/lib/browser/assistant/mic-capture.js +91 -0
- package/lib/browser/assistant/realtime-voice.d.ts +2 -2
- package/lib/browser/assistant/realtime-voice.js +6 -15
- 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/board.d.ts +2 -2
- package/lib/browser/components/board.js +2 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box-hooks.d.ts +12 -0
- package/lib/browser/components/composer-box-hooks.js +13 -0
- package/lib/browser/components/composer-box-protocol.d.ts +12 -1
- package/lib/browser/components/composer-box.js +13 -10
- package/lib/browser/components/composer.js +69 -3
- package/lib/browser/components/extension-settings.d.ts +8 -0
- package/lib/browser/components/extension-settings.js +69 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +3 -3
- package/lib/browser/components/message-steps.js +3 -3
- package/lib/browser/components/phone-shell.d.ts +2 -2
- package/lib/browser/components/request-error.d.ts +10 -0
- package/lib/browser/components/request-error.js +57 -0
- package/lib/browser/components/settings-more.js +12 -23
- package/lib/browser/components/storage-settings.d.ts +18 -0
- package/lib/browser/components/storage-settings.js +182 -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-contributions.d.ts +6 -7
- 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 +228 -0
- package/lib/browser/extension/web-api-targets.d.ts +12 -0
- package/lib/browser/extension/web-api-targets.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +11 -1
- package/lib/browser/extension/web-extension-context.d.ts +3 -2
- package/lib/browser/extension/web-extension-context.js +22 -17
- package/lib/browser/extension/web-extension-run.d.ts +8 -1
- package/lib/browser/extension/web-extension-run.js +37 -0
- package/lib/browser/extension/web-extensions-running.d.ts +20 -1
- package/lib/browser/extension/web-extensions-running.js +107 -9
- package/lib/browser/extension/web-extensions.js +1 -0
- package/lib/browser/extension/web-pages.d.ts +5 -0
- package/lib/browser/extension/web-pages.js +3 -0
- package/lib/browser/game/game-control.d.ts +6 -0
- package/lib/browser/game/game-control.js +28 -0
- package/lib/browser/game/game-host.d.ts +9 -2
- package/lib/browser/game/game-host.js +5 -1
- package/lib/browser/game/game-protocol.d.ts +8 -0
- package/lib/browser/game/game-runner.d.ts +7 -1
- package/lib/browser/game/game-runner.js +24 -2
- package/lib/browser/game/game-target.d.ts +23 -0
- package/lib/browser/game/game-target.js +87 -0
- package/lib/browser/game/game-util.d.ts +2 -0
- package/lib/browser/game/game-util.js +2 -0
- package/lib/browser/game/game-view.d.ts +5 -2
- package/lib/browser/game/game-view.js +4 -4
- package/lib/browser/game/game3d-protocol.d.ts +3 -1
- package/lib/browser/game/game3d-runner.d.ts +6 -1
- package/lib/browser/game/game3d-runner.js +26 -2
- package/lib/browser/i18n/en/chat.d.ts +4 -0
- package/lib/browser/i18n/en/chat.js +4 -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 +43 -0
- package/lib/browser/i18n/en/settings.js +43 -0
- package/lib/browser/i18n/ja/chat.js +4 -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 +43 -0
- package/lib/browser/i18n/locales.d.ts +60 -3
- package/lib/browser/i18n/messages.d.ts +59 -2
- package/lib/browser/i18n/zh/chat.js +4 -0
- 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 +43 -0
- package/lib/browser/i18n/zh-tw/chat.js +4 -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 +43 -0
- package/lib/browser/index.d.ts +3 -0
- package/lib/browser/index.js +3 -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 +58 -0
- package/lib/browser/sandbox/remote/remote-copy.js +322 -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/agent-settings.js +5 -1
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +4 -0
- package/lib/browser/style/tints.d.ts +2 -0
- package/lib/browser/style/tints.js +10 -0
- package/lib/browser/targets/targets-protocol.d.ts +55 -0
- package/lib/browser/targets/targets-protocol.js +37 -0
- package/lib/browser/targets/targets.d.ts +14 -0
- package/lib/browser/targets/targets.js +67 -0
- package/lib/browser/util/composer.d.ts +4 -2
- package/lib/browser/util/composer.js +7 -1
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/util/message.d.ts +6 -0
- package/lib/browser/util/message.js +21 -0
- package/lib/browser/util/process.d.ts +1 -0
- package/lib/browser/util/process.js +6 -1
- package/lib/browser/util/progress.d.ts +2 -1
- package/lib/browser/util/progress.js +2 -11
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { TaLanguageUtil, TaStorageUtil } from '@celljs/ta-protocol';
|
|
2
|
+
import { HardDrive, Trash2 } from 'lucide-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useNotices, useSettingsServer } from '../hooks.js';
|
|
5
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
6
|
+
import { useBusy } from './busy.js';
|
|
7
|
+
import { extensionRows } from './extension-settings.js';
|
|
8
|
+
import { IconButton } from './icon.js';
|
|
9
|
+
import { Row, row } from './settings-controls.js';
|
|
10
|
+
export var StorageSettingsUtil;
|
|
11
|
+
(function (StorageSettingsUtil) {
|
|
12
|
+
/** 512 KB, 300 MB, 1.2 GB: as a person reads what a store takes. */
|
|
13
|
+
function size(bytes) {
|
|
14
|
+
if (bytes < 1024 * 1024) {
|
|
15
|
+
return `${Math.max(bytes > 0 ? 1 : 0, Math.round(bytes / 1024))} KB`;
|
|
16
|
+
}
|
|
17
|
+
if (bytes < 1024 ** 3) {
|
|
18
|
+
return `${Math.round(bytes / 1024 ** 2)} MB`;
|
|
19
|
+
}
|
|
20
|
+
return `${(bytes / 1024 ** 3).toFixed(bytes < 10 * 1024 ** 3 ? 1 : 0)} GB`;
|
|
21
|
+
}
|
|
22
|
+
StorageSettingsUtil.size = size;
|
|
23
|
+
/** A limit of megabytes as chosen: 500 MB, 2 GB. */
|
|
24
|
+
function megabytes(mb) {
|
|
25
|
+
return mb >= 1024 && mb % 1024 === 0 ? `${mb / 1024} GB` : `${mb} MB`;
|
|
26
|
+
}
|
|
27
|
+
StorageSettingsUtil.megabytes = megabytes;
|
|
28
|
+
/** What all the stores take, those whose usage was read. */
|
|
29
|
+
function total(stores) {
|
|
30
|
+
return stores.reduce((sum, store) => { var _a; return sum + ((_a = store.bytes) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
31
|
+
}
|
|
32
|
+
StorageSettingsUtil.total = total;
|
|
33
|
+
})(StorageSettingsUtil || (StorageSettingsUtil = {}));
|
|
34
|
+
/** The stores of ta serve (TaSettingsServer.listStorage): undefined while read, null from a Ta service of before. */
|
|
35
|
+
function useStores() {
|
|
36
|
+
const server = useSettingsServer();
|
|
37
|
+
const [, notices] = useNotices();
|
|
38
|
+
const [stores, setStores] = React.useState();
|
|
39
|
+
const read = React.useCallback(() => {
|
|
40
|
+
Promise.resolve()
|
|
41
|
+
.then(() => (server.listStorage ? server.listStorage() : null))
|
|
42
|
+
.then(setStores, () => setStores(null));
|
|
43
|
+
}, [server]);
|
|
44
|
+
React.useEffect(read, [read]);
|
|
45
|
+
const setLimit = async (store, kind, value) => {
|
|
46
|
+
var _a;
|
|
47
|
+
// The default again is no setting of the user's: it follows the default if that changes.
|
|
48
|
+
const next = await ((_a = server.setStorageLimits) === null || _a === void 0 ? void 0 : _a.call(server, store.id, { [kind]: value === store.defaults[kind] ? null : value }));
|
|
49
|
+
if (next) {
|
|
50
|
+
setStores(all => all === null || all === void 0 ? void 0 : all.map(each => (each.id === next.id ? next : each)));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const clear = async (store) => {
|
|
54
|
+
var _a;
|
|
55
|
+
var _b;
|
|
56
|
+
const freed = (_b = (await ((_a = server.clearStorage) === null || _a === void 0 ? void 0 : _a.call(server, store.id)))) !== null && _b !== void 0 ? _b : 0;
|
|
57
|
+
read();
|
|
58
|
+
return freed;
|
|
59
|
+
};
|
|
60
|
+
return { stores, setLimit, clear, notices };
|
|
61
|
+
}
|
|
62
|
+
/** A limit of a store as a choice of its own words: "Keep 30 days", "Keep all". */
|
|
63
|
+
function LimitSelect({ store, kind, onChange }) {
|
|
64
|
+
var _a;
|
|
65
|
+
const t = useT();
|
|
66
|
+
const [busy, setBusy] = React.useState(false);
|
|
67
|
+
const value = (_a = store.limits[kind]) !== null && _a !== void 0 ? _a : 0;
|
|
68
|
+
const list = TaStorageUtil.choices(kind === 'keepDays' ? store.choices.days : store.choices.mb, value);
|
|
69
|
+
const label = (n) => kind === 'keepDays'
|
|
70
|
+
? n
|
|
71
|
+
? t('ta.storage.keep', { days: n })
|
|
72
|
+
: t('ta.storage.keepAll')
|
|
73
|
+
: n
|
|
74
|
+
? t('ta.storage.max', { size: StorageSettingsUtil.megabytes(n) })
|
|
75
|
+
: t('ta.storage.maxNone');
|
|
76
|
+
return (React.createElement("select", { className: "ta-input ta-select ta-storage-select", "aria-label": t(kind === 'keepDays' ? 'ta.storage.keepLabel' : 'ta.storage.maxLabel'), value: value, disabled: busy, onChange: event => {
|
|
77
|
+
setBusy(true);
|
|
78
|
+
void onChange(Number(event.target.value)).finally(() => setBusy(false));
|
|
79
|
+
} }, list.map(n => (React.createElement("option", { key: n, value: n }, label(n))))));
|
|
80
|
+
}
|
|
81
|
+
/** Clears a store, once the user said so; busy while it runs. */
|
|
82
|
+
function ClearButton({ label, onClear }) {
|
|
83
|
+
const [busy, run] = useBusy();
|
|
84
|
+
return React.createElement(IconButton, { icon: Trash2, label: label, busy: busy, onClick: () => void run(onClear) });
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Settings → Storage (docs/design/ta-storage.md): what Ta and its packages keep on this computer, each store with what it
|
|
88
|
+
* takes, the limits it is kept to (days, size) as the user sets them, and clearing it; the rows of extensions that are a
|
|
89
|
+
* detail of a store (WebSettingsSection.storage) under it, those of a store not listed at the end.
|
|
90
|
+
*/
|
|
91
|
+
export function useStorageSection(details) {
|
|
92
|
+
const t = useT();
|
|
93
|
+
const language = useLanguage();
|
|
94
|
+
const { stores, setLimit, clear, notices } = useStores();
|
|
95
|
+
if (stores === null && details.length === 0) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const words = (text) => TaLanguageUtil.pick(language, text);
|
|
99
|
+
const failed = (error) => {
|
|
100
|
+
notices.error(error);
|
|
101
|
+
};
|
|
102
|
+
const onClear = async (store) => {
|
|
103
|
+
const name = words(store.title);
|
|
104
|
+
const sure = await notices.confirm({
|
|
105
|
+
title: t('ta.storage.clearConfirm', { name }),
|
|
106
|
+
message: store.hint && words(store.hint),
|
|
107
|
+
confirmLabel: t('ta.storage.clear'),
|
|
108
|
+
danger: true,
|
|
109
|
+
});
|
|
110
|
+
if (!sure) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
notices.notify(t('ta.storage.freed', { size: StorageSettingsUtil.size(await clear(store)) }), { level: 'success' });
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
failed(error);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const storeRow = (store) => {
|
|
121
|
+
const title = words(store.title);
|
|
122
|
+
const hint = store.hint && words(store.hint);
|
|
123
|
+
const usage = store.bytes === undefined ? undefined : t('ta.storage.usage', { size: StorageSettingsUtil.size(store.bytes) });
|
|
124
|
+
const kinds = ['keepDays', 'maxMB'].filter(kind => store.defaults[kind] !== undefined);
|
|
125
|
+
return row(`storage:${store.id}`, [title, hint, t('ta.storage.title')], React.createElement(Row, { label: title, description: [usage, hint].filter(Boolean).join(' · ') },
|
|
126
|
+
kinds.map(kind => (React.createElement(LimitSelect, { key: kind, store: store, kind: kind, onChange: value => setLimit(store, kind, value).catch(failed) }))),
|
|
127
|
+
store.clearable && React.createElement(ClearButton, { label: t('ta.storage.clear'), onClear: () => onClear(store) })));
|
|
128
|
+
};
|
|
129
|
+
const listed = new Set((stores !== null && stores !== void 0 ? stores : []).map(store => store.id));
|
|
130
|
+
const rows = stores
|
|
131
|
+
? [
|
|
132
|
+
row('storage', [t('ta.storage.title'), t('ta.storage.hint'), 'storage', 'disk'], React.createElement(Row, { label: t('ta.storage.total', { size: StorageSettingsUtil.size(StorageSettingsUtil.total(stores)) }), description: t('ta.storage.hint') })),
|
|
133
|
+
...stores.flatMap(store => [storeRow(store), ...details.filter(entry => entry.section.storage === store.id).flatMap(extensionRows)]),
|
|
134
|
+
]
|
|
135
|
+
: [];
|
|
136
|
+
return {
|
|
137
|
+
id: 'storage',
|
|
138
|
+
title: t('ta.storage.title'),
|
|
139
|
+
icon: HardDrive,
|
|
140
|
+
// Last of General but for the keys and About.
|
|
141
|
+
order: 800,
|
|
142
|
+
rows: [...rows, ...(stores === undefined ? [] : details.filter(entry => { var _a; return !listed.has((_a = entry.section.storage) !== null && _a !== void 0 ? _a : ''); }).flatMap(extensionRows))],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=storage-settings.js.map
|
|
@@ -21,4 +21,20 @@ 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 {};
|
|
@@ -56,4 +56,41 @@ export class ScreenAwake {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Keeps the device awake for the page while any holds it (a call, a meeting written down): the screen stays on, and
|
|
61
|
+
* Ta Desktop keeps the display awake and the page unthrottled and does not restart under it (DesktopUtil.calling).
|
|
62
|
+
* One for the page, so that one letting go does not let the screen lock under another.
|
|
63
|
+
*/
|
|
64
|
+
export class KeepAwake {
|
|
65
|
+
static get shared() {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = KeepAwake.instance) !== null && _a !== void 0 ? _a : (KeepAwake.instance = new KeepAwake());
|
|
68
|
+
return KeepAwake.instance;
|
|
69
|
+
}
|
|
70
|
+
constructor(screen = new ScreenAwake(), desktop = () => DesktopUtil.calling()) {
|
|
71
|
+
this.screen = screen;
|
|
72
|
+
this.desktop = desktop;
|
|
73
|
+
this.holds = 0;
|
|
74
|
+
}
|
|
75
|
+
/** Holds it till the function it returns is called (again calls do nothing). */
|
|
76
|
+
hold() {
|
|
77
|
+
let held = true;
|
|
78
|
+
if (this.holds++ === 0) {
|
|
79
|
+
this.set(true);
|
|
80
|
+
}
|
|
81
|
+
return () => {
|
|
82
|
+
if (held) {
|
|
83
|
+
held = false;
|
|
84
|
+
if (--this.holds === 0) {
|
|
85
|
+
this.set(false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
set(on) {
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = this.desktop()) === null || _a === void 0 ? void 0 : _a(on);
|
|
93
|
+
this.screen.set(on);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
59
96
|
//# sourceMappingURL=screen-awake.js.map
|
|
@@ -57,6 +57,10 @@ class TouchSources {
|
|
|
57
57
|
this.listened.delete(key);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
// A frame apart (a game of a reply, an extension in a sandbox) has no document to reach: WebKit says so as an error.
|
|
61
|
+
if (frame.hasAttribute('sandbox') && !frame.sandbox.contains('allow-same-origin')) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
60
64
|
let doc = null;
|
|
61
65
|
try {
|
|
62
66
|
doc = frame.contentDocument;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, Aperture, AppWindow, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlarmClock,
|
|
5
5
|
Aperture,
|
|
6
|
+
AppWindow,
|
|
6
7
|
Archive,
|
|
7
8
|
ArrowDown,
|
|
8
9
|
ArrowLeft,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TaExtensionAccess, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { MessageId } from '../i18n/messages.js';
|
|
3
|
+
import type { WebExtensionAPI } from './web-extension-api.js';
|
|
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
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Of its own module: the runtime of the sandbox bundles this file (sandbox/runtime), without the rest of the protocol.
|
|
2
|
+
import { TaExtensionAccessUtil } from '@celljs/ta-protocol/lib/common/package-protocol';
|
|
3
|
+
import { WEB_API_SPEC } from './web-api-spec.js';
|
|
4
|
+
export var WebAccessUtil;
|
|
5
|
+
(function (WebAccessUtil) {
|
|
6
|
+
/**
|
|
7
|
+
* What an extension may run with: a built-in, or from a ta serve older than access, all; one of a package, what the
|
|
8
|
+
* user allowed of this version of it; undefined while they have not (it waits to be allowed).
|
|
9
|
+
*/
|
|
10
|
+
function granted(info) {
|
|
11
|
+
if (!info || info.access === undefined) {
|
|
12
|
+
return 'full';
|
|
13
|
+
}
|
|
14
|
+
return info.granted;
|
|
15
|
+
}
|
|
16
|
+
WebAccessUtil.granted = granted;
|
|
17
|
+
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
18
|
+
function source(info, say) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if (((_a = info.temporary) === null || _a === void 0 ? void 0 : _a.from) === 'link') {
|
|
21
|
+
return say('ta.access.fromLink');
|
|
22
|
+
}
|
|
23
|
+
if (((_b = info.temporary) === null || _b === void 0 ? void 0 : _b.from) === 'market') {
|
|
24
|
+
return say('ta.access.fromMarket');
|
|
25
|
+
}
|
|
26
|
+
return info.source;
|
|
27
|
+
}
|
|
28
|
+
WebAccessUtil.source = source;
|
|
29
|
+
/** The API as far as `granted` reaches (WEB_API_SPEC): what is beyond it throws, saying what to ask for. */
|
|
30
|
+
function limit(api, granted, name) {
|
|
31
|
+
return granted === 'full' ? api : only(api, WEB_API_SPEC, granted, name, '');
|
|
32
|
+
}
|
|
33
|
+
WebAccessUtil.limit = limit;
|
|
34
|
+
/** Why a member is not there: what the extension has, what the member needs, and how to ask for it. */
|
|
35
|
+
function refusal(name, granted, path, need) {
|
|
36
|
+
return `The web extension ${name} has ${granted} access; pi.${path} needs ${need}: declare "pi": { "access": "${need}" } in its package.json.`;
|
|
37
|
+
}
|
|
38
|
+
WebAccessUtil.refusal = refusal;
|
|
39
|
+
function only(whole, spec, granted, name, prefix) {
|
|
40
|
+
const part = {};
|
|
41
|
+
for (const [key, entry] of Object.entries(spec)) {
|
|
42
|
+
const descriptor = Object.getOwnPropertyDescriptor(whole, key);
|
|
43
|
+
if (!TaExtensionAccessUtil.reaches(granted, entry.access)) {
|
|
44
|
+
Object.defineProperty(part, key, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get() {
|
|
47
|
+
throw new Error(refusal(name, granted, prefix + key, entry.access));
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if (entry.form === 'group' && descriptor) {
|
|
52
|
+
// As far as it reaches too, the same object while the API gives the same one.
|
|
53
|
+
let cut;
|
|
54
|
+
Object.defineProperty(part, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get() {
|
|
57
|
+
const from = whole[key];
|
|
58
|
+
if (!from || typeof from !== 'object') {
|
|
59
|
+
return from;
|
|
60
|
+
}
|
|
61
|
+
if ((cut === null || cut === void 0 ? void 0 : cut.from) !== from) {
|
|
62
|
+
cut = { from, part: only(from, entry.members, granted, name, `${prefix}${key}.`) };
|
|
63
|
+
}
|
|
64
|
+
return cut.part;
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else if (descriptor) {
|
|
69
|
+
Object.defineProperty(part, key, descriptor);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return part;
|
|
73
|
+
}
|
|
74
|
+
})(WebAccessUtil || (WebAccessUtil = {}));
|
|
75
|
+
//# sourceMappingURL=web-access.js.map
|
|
@@ -35,11 +35,13 @@ export interface WebSettingsSection {
|
|
|
35
35
|
/** Smaller first among those of extensions in its group, then as registered; default 100 (negative: before Ta's). */
|
|
36
36
|
order?: number;
|
|
37
37
|
rows: WebSettingRow[];
|
|
38
|
+
/** A store of Settings → Storage (TaStorageInfo.id): its rows show under it there; older Ta apps list it as a section. */
|
|
39
|
+
storage?: string;
|
|
38
40
|
/**
|
|
39
41
|
* Models without signing in to a service (coding agents to install): the first page, which asks to sign in, shows the
|
|
40
42
|
* section as a card beside accounts and API keys, `hint` under its title naming examples as theirs do
|
|
41
|
-
* (`CodeBuddy · Codex`); picked, its rows are there, and the page goes on by itself once Ta has models.
|
|
42
|
-
*
|
|
43
|
+
* (`CodeBuddy · Codex`); picked, its rows are there, and the page goes on by itself once Ta has models. Newer than
|
|
44
|
+
* some Ta apps, which do not show it there.
|
|
43
45
|
*/
|
|
44
46
|
signIn?: {
|
|
45
47
|
hint: WebLabel;
|
|
@@ -148,16 +150,13 @@ export interface WebView {
|
|
|
148
150
|
* chats. `panel`: a tool of the workbench beside the conversation, as the explorer or the terminal
|
|
149
151
|
* of an IDE: its `+` and its empty state list it, and it opens as one of its tabs. `launcher`: a
|
|
150
152
|
* section of what a phone pulls down over its first tab (a button of the rail elsewhere), as Recent and
|
|
151
|
-
* Mine. `board`: a card of the board a phone brings
|
|
153
|
+
* Mine. `board`: a card of the board a phone brings in from the left with a swipe to the right over its first tab (a
|
|
152
154
|
* button of the rail elsewhere), which the user takes off, puts back and orders (ta-launcher.md).
|
|
153
155
|
*/
|
|
154
156
|
location?: WebViewLocation;
|
|
155
157
|
/** Smaller first among those of its location; default 100. */
|
|
156
158
|
order?: number;
|
|
157
|
-
/**
|
|
158
|
-
* A page: its … where a list shows it (the sidebar view that leads to it), in sections set apart by
|
|
159
|
-
* a line; read each time the menu opens, so it can say what holds now.
|
|
160
|
-
*/
|
|
159
|
+
/** A page: its … where a list shows it (the sidebar view that leads to it), in sections set apart by a line; read as it opens. */
|
|
161
160
|
menu?(): WebMenuItem[][];
|
|
162
161
|
/**
|
|
163
162
|
* Its top bar, in place of the title: for a sidebar view, the row above it (a search, a button
|
|
@@ -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,3 +73,21 @@ 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
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { TaExtensionAccess } from '@celljs/ta-protocol';
|
|
2
|
+
import type { WebExtensionAPI, WebExtensionUI } from './web-extension-api.js';
|
|
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
|
+
}
|