@celljs/ta-web 4.33.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/assistant-thread.js +3 -1
- package/esm/browser/assistant/assistant-view.js +8 -4
- 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/context-act.d.ts +4 -0
- package/esm/browser/components/context-act.js +8 -0
- package/esm/browser/components/context-line.d.ts +19 -0
- package/esm/browser/components/context-line.js +71 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +12 -6
- package/esm/browser/components/message-steps.js +1 -1
- package/esm/browser/components/session-settings.d.ts +8 -4
- package/esm/browser/components/session-settings.js +10 -5
- package/esm/browser/components/session-view.js +12 -8
- 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/chat.d.ts +16 -2
- package/esm/browser/i18n/en/chat.js +16 -2
- 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 +54 -0
- package/esm/browser/i18n/en/settings.js +57 -3
- package/esm/browser/i18n/en/tools.d.ts +1 -0
- package/esm/browser/i18n/en/tools.js +1 -0
- package/esm/browser/i18n/ja/chat.js +16 -2
- 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 +57 -3
- package/esm/browser/i18n/ja/tools.js +1 -0
- package/esm/browser/i18n/locales.d.ts +84 -5
- package/esm/browser/i18n/messages.d.ts +83 -4
- package/esm/browser/i18n/zh/chat.js +16 -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 +57 -3
- package/esm/browser/i18n/zh/tools.js +1 -0
- package/esm/browser/i18n/zh-tw/chat.js +16 -2
- 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 +57 -3
- package/esm/browser/i18n/zh-tw/tools.js +1 -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/agent-settings.js +12 -2
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +20 -1
- 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/context-view.d.ts +16 -0
- package/esm/browser/util/context-view.js +42 -0
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/util/progress.d.ts +4 -0
- package/esm/browser/util/progress.js +9 -3
- 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 +3 -1
- package/lib/browser/assistant/assistant-view.js +8 -4
- 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/context-act.d.ts +5 -0
- package/lib/browser/components/context-act.js +44 -0
- package/lib/browser/components/context-line.d.ts +20 -0
- package/lib/browser/components/context-line.js +109 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +12 -6
- package/lib/browser/components/message-steps.js +1 -1
- package/lib/browser/components/session-settings.d.ts +8 -4
- package/lib/browser/components/session-settings.js +10 -5
- package/lib/browser/components/session-view.js +12 -8
- 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/chat.d.ts +16 -2
- package/lib/browser/i18n/en/chat.js +16 -2
- 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 +54 -0
- package/lib/browser/i18n/en/settings.js +57 -3
- package/lib/browser/i18n/en/tools.d.ts +1 -0
- package/lib/browser/i18n/en/tools.js +1 -0
- package/lib/browser/i18n/ja/chat.js +16 -2
- 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 +57 -3
- package/lib/browser/i18n/ja/tools.js +1 -0
- package/lib/browser/i18n/locales.d.ts +84 -5
- package/lib/browser/i18n/messages.d.ts +83 -4
- package/lib/browser/i18n/zh/chat.js +16 -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 +57 -3
- package/lib/browser/i18n/zh/tools.js +1 -0
- package/lib/browser/i18n/zh-tw/chat.js +16 -2
- 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 +57 -3
- package/lib/browser/i18n/zh-tw/tools.js +1 -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/agent-settings.js +12 -2
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +20 -1
- 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/context-view.d.ts +17 -0
- package/lib/browser/util/context-view.js +45 -0
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/util/progress.d.ts +4 -0
- package/lib/browser/util/progress.js +9 -3
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -3,7 +3,35 @@ export type DesktopFeature = 'webview' | 'debugWebview' | 'showItemInFolder' | '
|
|
|
3
3
|
/** It lets the page open the window of a video call (window.open('about:blank', 'ta-video-call')). */
|
|
4
4
|
| 'callWindow'
|
|
5
5
|
/** It pins the window of a video call above every window, or not (callWindowPin). */
|
|
6
|
-
| 'callWindowPin'
|
|
6
|
+
| 'callWindowPin'
|
|
7
|
+
/** It installs pages as apps of the computer, each with a window of its own (docs/design/ta-install-as-app.md). */
|
|
8
|
+
| 'apps';
|
|
9
|
+
/** A page installed as an app of the computer. */
|
|
10
|
+
export interface DesktopApp {
|
|
11
|
+
/** The id of the page, as `ui.showView` takes it. */
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
installedAt: number;
|
|
15
|
+
}
|
|
16
|
+
/** What the page sends to install a page: its name, and its icon, PNGs of 1024 and of 256 pixels (AppIcon). */
|
|
17
|
+
export interface DesktopAppInstall {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
png: Uint8Array;
|
|
21
|
+
small: Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
/** The pages installed as apps of the computer, by Ta Desktop (desktop-apps.ts of apps/ta-desktop). */
|
|
24
|
+
export interface DesktopApps {
|
|
25
|
+
list(): Promise<DesktopApp[]>;
|
|
26
|
+
/** `problem`: its entry of the system could not be written; the app is kept, and opens all the same. */
|
|
27
|
+
install(app: DesktopAppInstall): Promise<DesktopApp & {
|
|
28
|
+
problem?: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** Its entry and icon gone, its window closed. */
|
|
31
|
+
remove(id: string): Promise<void>;
|
|
32
|
+
/** Its window in front, opened when it is not. */
|
|
33
|
+
open(id: string): Promise<void>;
|
|
34
|
+
}
|
|
7
35
|
/** The file manager of the system, from Ta Desktop: {@link WebDesktop} of the extension API. */
|
|
8
36
|
export interface DesktopFileManager {
|
|
9
37
|
/** Node's `process.platform` of the machine: what the file manager is called there. */
|
|
@@ -88,6 +116,8 @@ export declare namespace DesktopUtil {
|
|
|
88
116
|
* `pinned` is given; it keeps the choice for the next call. None outside Ta Desktop, nor in an older one.
|
|
89
117
|
*/
|
|
90
118
|
function callWindowPin(scope?: object): ((pinned?: boolean) => Promise<boolean>) | undefined;
|
|
119
|
+
/** The pages installed as apps, where Ta Desktop installs them. */
|
|
120
|
+
function apps(scope?: object): DesktopApps | undefined;
|
|
91
121
|
function browserData(scope?: object): DesktopBrowserData | undefined;
|
|
92
122
|
/** `debugWebview` of Ta Desktop; `undefined` elsewhere. */
|
|
93
123
|
function debugWebview(scope?: object): DebugWebview | undefined;
|
|
@@ -52,6 +52,26 @@ export var DesktopUtil;
|
|
|
52
52
|
return has('callWindowPin', scope) && typeof pin === 'function' ? async (pinned) => (await pin(pinned)) === true : undefined;
|
|
53
53
|
}
|
|
54
54
|
DesktopUtil.callWindowPin = callWindowPin;
|
|
55
|
+
/** The pages installed as apps, where Ta Desktop installs them. */
|
|
56
|
+
function apps(scope = globalThis) {
|
|
57
|
+
var _a;
|
|
58
|
+
var _b;
|
|
59
|
+
const { list, install, remove, open } = (_b = (_a = scope.taDesktop) === null || _a === void 0 ? void 0 : _a.apps) !== null && _b !== void 0 ? _b : {};
|
|
60
|
+
if (!has('apps', scope) || typeof list !== 'function' || typeof install !== 'function' || typeof remove !== 'function' || typeof open !== 'function') {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return Object.freeze({
|
|
64
|
+
list: async () => { var _a; return (_a = (await list())) !== null && _a !== void 0 ? _a : []; },
|
|
65
|
+
install: async (app) => (await install(app)),
|
|
66
|
+
remove: async (id) => {
|
|
67
|
+
await remove(id);
|
|
68
|
+
},
|
|
69
|
+
open: async (id) => {
|
|
70
|
+
await open(id);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
DesktopUtil.apps = apps;
|
|
55
75
|
function browserData(scope = globalThis) {
|
|
56
76
|
var _a;
|
|
57
77
|
const data = (_a = scope.taDesktop) === null || _a === void 0 ? void 0 : _a.browserData;
|
|
@@ -25,6 +25,10 @@ export type Phase = {
|
|
|
25
25
|
} | {
|
|
26
26
|
kind: 'compacting';
|
|
27
27
|
}
|
|
28
|
+
/** Ta turns the context over with a handoff (docs/design/ta-context.md 5.5). */
|
|
29
|
+
| {
|
|
30
|
+
kind: 'renewing';
|
|
31
|
+
}
|
|
28
32
|
/** `error`: what the provider said, for a reason without a word of its own. */
|
|
29
33
|
| {
|
|
30
34
|
kind: 'retrying';
|
|
@@ -37,6 +37,8 @@ export var ProgressUtil;
|
|
|
37
37
|
return t('ta.mood.attention');
|
|
38
38
|
case 'compacting':
|
|
39
39
|
return t('ta.progress.compacting');
|
|
40
|
+
case 'renewing':
|
|
41
|
+
return t('ta.progress.renewing');
|
|
40
42
|
case 'retrying': {
|
|
41
43
|
const error = phase.reason === 'error' ? ProgressUtil.brief(phase.error) : '';
|
|
42
44
|
const reason = error || t(`ta.progress.retry.${phase.reason}`);
|
|
@@ -50,10 +52,14 @@ export var ProgressUtil;
|
|
|
50
52
|
ProgressUtil.text = text;
|
|
51
53
|
/** What ta does now, the most pressing first: a question for the user, then pi's own work, then the model's. */
|
|
52
54
|
function phase(state, renderers) {
|
|
53
|
-
var _a
|
|
55
|
+
var _a;
|
|
56
|
+
var _b, _c;
|
|
54
57
|
if (state.pendingUi.length > 0) {
|
|
55
58
|
return { kind: 'attention' };
|
|
56
59
|
}
|
|
60
|
+
if ((_a = state.context) === null || _a === void 0 ? void 0 : _a.renewing) {
|
|
61
|
+
return { kind: 'renewing' };
|
|
62
|
+
}
|
|
57
63
|
if (state.compacting) {
|
|
58
64
|
return { kind: 'compacting' };
|
|
59
65
|
}
|
|
@@ -69,7 +75,7 @@ export var ProgressUtil;
|
|
|
69
75
|
}
|
|
70
76
|
const run = ToolUtil.current(state.tools);
|
|
71
77
|
if (run) {
|
|
72
|
-
return { kind: 'tool', summary: ToolUtil.summary(run.toolName, (
|
|
78
|
+
return { kind: 'tool', summary: ToolUtil.summary(run.toolName, (_b = run.args) !== null && _b !== void 0 ? _b : {}, renderers) };
|
|
73
79
|
}
|
|
74
80
|
const last = state.messages[state.messages.length - 1];
|
|
75
81
|
if (role(last) !== 'assistant' || last.stopReason === 'toolUse') {
|
|
@@ -84,7 +90,7 @@ export var ProgressUtil;
|
|
|
84
90
|
case 'text':
|
|
85
91
|
return { kind: 'writing' };
|
|
86
92
|
case 'toolCall':
|
|
87
|
-
return { kind: 'calling', tool: (
|
|
93
|
+
return { kind: 'calling', tool: (_c = block.name) !== null && _c !== void 0 ? _c : '' };
|
|
88
94
|
default:
|
|
89
95
|
return { kind: 'waiting' };
|
|
90
96
|
}
|
package/esm/browser/view.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { View } from '@celljs/react';
|
|
8
|
-
import { AppView } from './components/app-
|
|
8
|
+
import { AppView } from './components/app-root.js';
|
|
9
9
|
/** ta on the web: the conversations, and what the web extensions of packages add. */
|
|
10
10
|
let TaAppPage = class TaAppPage {
|
|
11
11
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WebIcon } from '../extension/web-extension-api';
|
|
2
|
+
/** The colours of the icon of an app, in CSS: the tile of the launcher in the light theme, a little deeper at its foot. */
|
|
3
|
+
export interface AppIconColors {
|
|
4
|
+
top: string;
|
|
5
|
+
bottom: string;
|
|
6
|
+
ink: string;
|
|
7
|
+
edge: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The icon of a page installed as an app (docs/design/ta-install-as-app.md): its tile of the launcher (the glyph of the
|
|
11
|
+
* page in its tint, TintUtil) on the grid of the icons of macOS, a rounded square of 824 in 1024 with room for its shadow,
|
|
12
|
+
* which reads as well in the Start menu and the menus of Linux.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace AppIcon {
|
|
15
|
+
const SIZE = 1024;
|
|
16
|
+
/** The most an ICO of Windows holds. */
|
|
17
|
+
const SMALL = 256;
|
|
18
|
+
function colors(tint: number): AppIconColors;
|
|
19
|
+
/** The glyph in an SVG of its own, its strokes in `ink`: drawn by React in a detached element, as the page draws it. */
|
|
20
|
+
function svg(Glyph: WebIcon, ink: string, size: number): string | undefined;
|
|
21
|
+
/** The icon as a PNG of `size` pixels; `fallback` drawn when the page's own glyph draws nothing (one of a sandbox). */
|
|
22
|
+
function draw(Glyph: WebIcon, fallback: WebIcon, tint: number, size?: number): Promise<Uint8Array>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=app-icon.d.ts.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AppIcon = void 0;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const react_dom_1 = require("react-dom");
|
|
39
|
+
const client_1 = require("react-dom/client");
|
|
40
|
+
const tints_1 = require("../style/tints");
|
|
41
|
+
/**
|
|
42
|
+
* The icon of a page installed as an app (docs/design/ta-install-as-app.md): its tile of the launcher (the glyph of the
|
|
43
|
+
* page in its tint, TintUtil) on the grid of the icons of macOS, a rounded square of 824 in 1024 with room for its shadow,
|
|
44
|
+
* which reads as well in the Start menu and the menus of Linux.
|
|
45
|
+
*/
|
|
46
|
+
var AppIcon;
|
|
47
|
+
(function (AppIcon) {
|
|
48
|
+
AppIcon.SIZE = 1024;
|
|
49
|
+
/** The most an ICO of Windows holds. */
|
|
50
|
+
AppIcon.SMALL = 256;
|
|
51
|
+
/** The square and its corners, in a canvas of SIZE. */
|
|
52
|
+
const BODY = { at: 100, size: 824, radius: 185 };
|
|
53
|
+
/** How much of the square the glyph takes. */
|
|
54
|
+
const GLYPH = 0.5;
|
|
55
|
+
function colors(tint) {
|
|
56
|
+
const { tile, ink } = tints_1.TintUtil.tint(tints_1.TintUtil.FACES[tint % tints_1.TintUtil.FACES.length], 'light');
|
|
57
|
+
return {
|
|
58
|
+
top: tints_1.TintUtil.css({ ...tile, l: 0.985, c: tile.c * 2 }),
|
|
59
|
+
bottom: tints_1.TintUtil.css({ ...tile, l: 0.92, c: tile.c * 3 }),
|
|
60
|
+
ink: tints_1.TintUtil.css(ink),
|
|
61
|
+
edge: tints_1.TintUtil.css({ ...ink, l: 0.5, c: ink.c * 0.4 }),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
AppIcon.colors = colors;
|
|
65
|
+
/** The glyph in an SVG of its own, its strokes in `ink`: drawn by React in a detached element, as the page draws it. */
|
|
66
|
+
function svg(Glyph, ink, size) {
|
|
67
|
+
const holder = document.createElement('div');
|
|
68
|
+
const root = (0, client_1.createRoot)(holder);
|
|
69
|
+
try {
|
|
70
|
+
(0, react_dom_1.flushSync)(() => root.render(React.createElement(Glyph, { size, strokeWidth: 1.6 })));
|
|
71
|
+
const drawn = holder.querySelector('svg');
|
|
72
|
+
if (!drawn) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
drawn.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
76
|
+
drawn.setAttribute('width', String(size));
|
|
77
|
+
drawn.setAttribute('height', String(size));
|
|
78
|
+
drawn.setAttribute('color', ink);
|
|
79
|
+
return drawn.outerHTML.replace(/currentColor/g, ink);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
root.unmount();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
AppIcon.svg = svg;
|
|
86
|
+
/** The icon as a PNG of `size` pixels; `fallback` drawn when the page's own glyph draws nothing (one of a sandbox). */
|
|
87
|
+
async function draw(Glyph, fallback, tint, size = AppIcon.SIZE) {
|
|
88
|
+
var _a;
|
|
89
|
+
const { top, bottom, ink, edge } = colors(tint);
|
|
90
|
+
const canvas = document.createElement('canvas');
|
|
91
|
+
canvas.width = size;
|
|
92
|
+
canvas.height = size;
|
|
93
|
+
const context = canvas.getContext('2d');
|
|
94
|
+
if (!context) {
|
|
95
|
+
throw new Error('This page cannot draw an icon.');
|
|
96
|
+
}
|
|
97
|
+
context.scale(size / AppIcon.SIZE, size / AppIcon.SIZE);
|
|
98
|
+
const { at, size: body, radius } = BODY;
|
|
99
|
+
context.save();
|
|
100
|
+
context.shadowColor = 'rgba(0, 0, 0, 0.22)';
|
|
101
|
+
context.shadowBlur = 28;
|
|
102
|
+
context.shadowOffsetY = 12;
|
|
103
|
+
const fill = context.createLinearGradient(0, at, 0, at + body);
|
|
104
|
+
fill.addColorStop(0, top);
|
|
105
|
+
fill.addColorStop(1, bottom);
|
|
106
|
+
context.fillStyle = fill;
|
|
107
|
+
context.beginPath();
|
|
108
|
+
context.roundRect(at, at, body, body, radius);
|
|
109
|
+
context.fill();
|
|
110
|
+
context.restore();
|
|
111
|
+
context.strokeStyle = edge;
|
|
112
|
+
context.globalAlpha = 0.12;
|
|
113
|
+
context.lineWidth = 3;
|
|
114
|
+
context.beginPath();
|
|
115
|
+
context.roundRect(at + 1.5, at + 1.5, body - 3, body - 3, radius - 1.5);
|
|
116
|
+
context.stroke();
|
|
117
|
+
context.globalAlpha = 1;
|
|
118
|
+
const glyph = Math.round(body * GLYPH);
|
|
119
|
+
const text = (_a = svg(Glyph, ink, glyph)) !== null && _a !== void 0 ? _a : svg(fallback, ink, glyph);
|
|
120
|
+
if (text) {
|
|
121
|
+
const image = new Image();
|
|
122
|
+
image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(text)}`;
|
|
123
|
+
await image.decode();
|
|
124
|
+
context.drawImage(image, at + (body - glyph) / 2, at + (body - glyph) / 2, glyph, glyph);
|
|
125
|
+
}
|
|
126
|
+
const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
|
|
127
|
+
if (!blob) {
|
|
128
|
+
throw new Error('This page cannot draw an icon.');
|
|
129
|
+
}
|
|
130
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
131
|
+
}
|
|
132
|
+
AppIcon.draw = draw;
|
|
133
|
+
})(AppIcon || (exports.AppIcon = AppIcon = {}));
|
|
134
|
+
//# sourceMappingURL=app-icon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RowEntry } from '../components/settings-controls';
|
|
2
|
+
/**
|
|
3
|
+
* The rows of Settings, Extensions, for pages installed as apps (docs/design/ta-install-as-app.md 1): the switch of this
|
|
4
|
+
* device, and those installed, each to open or remove. None where Ta Desktop does not install them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAppRows(): RowEntry[];
|
|
7
|
+
//# sourceMappingURL=app-settings.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.useAppRows = useAppRows;
|
|
37
|
+
const lucide_react_1 = require("lucide-react");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const busy_1 = require("../components/busy");
|
|
40
|
+
const icon_1 = require("../components/icon");
|
|
41
|
+
const settings_controls_1 = require("../components/settings-controls");
|
|
42
|
+
const hooks_1 = require("../hooks");
|
|
43
|
+
const use_t_1 = require("../i18n/use-t");
|
|
44
|
+
const desktop_1 = require("../util/desktop");
|
|
45
|
+
/** The pages installed as apps, read again as the window comes back (one removed from its own window meanwhile). */
|
|
46
|
+
function useInstalledApps() {
|
|
47
|
+
const desktop = React.useMemo(() => desktop_1.DesktopUtil.apps(), []);
|
|
48
|
+
const [apps, setApps] = React.useState([]);
|
|
49
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
50
|
+
const read = React.useCallback(() => {
|
|
51
|
+
desktop === null || desktop === void 0 ? void 0 : desktop.list().then(setApps, () => undefined);
|
|
52
|
+
}, [desktop]);
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
read();
|
|
55
|
+
window.addEventListener('focus', read);
|
|
56
|
+
return () => window.removeEventListener('focus', read);
|
|
57
|
+
}, [read]);
|
|
58
|
+
const remove = React.useCallback(async (id) => {
|
|
59
|
+
try {
|
|
60
|
+
await (desktop === null || desktop === void 0 ? void 0 : desktop.remove(id));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
notices.error(error);
|
|
64
|
+
}
|
|
65
|
+
read();
|
|
66
|
+
}, [desktop, notices, read]);
|
|
67
|
+
return [apps, remove];
|
|
68
|
+
}
|
|
69
|
+
/** Open of an app installed, turning while it runs. */
|
|
70
|
+
function OpenButton({ open }) {
|
|
71
|
+
const t = (0, use_t_1.useT)();
|
|
72
|
+
const [busy, run] = (0, busy_1.useBusy)();
|
|
73
|
+
return (React.createElement("button", { type: "button", className: busy ? 'ta-button ta-busy' : 'ta-button', "aria-busy": busy || undefined, onClick: () => void run(open) },
|
|
74
|
+
t('ta.apps.open'),
|
|
75
|
+
React.createElement(busy_1.BusyMark, { busy: busy })));
|
|
76
|
+
}
|
|
77
|
+
/** Remove of an app installed, turning while it runs. */
|
|
78
|
+
function RemoveButton({ remove }) {
|
|
79
|
+
const t = (0, use_t_1.useT)();
|
|
80
|
+
const [busy, run] = (0, busy_1.useBusy)();
|
|
81
|
+
return React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.apps.remove'), busy: busy, onClick: () => void run(remove) });
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The rows of Settings, Extensions, for pages installed as apps (docs/design/ta-install-as-app.md 1): the switch of this
|
|
85
|
+
* device, and those installed, each to open or remove. None where Ta Desktop does not install them.
|
|
86
|
+
*/
|
|
87
|
+
function useAppRows() {
|
|
88
|
+
const t = (0, use_t_1.useT)();
|
|
89
|
+
const [{ settings }, store] = (0, hooks_1.useSettings)();
|
|
90
|
+
const [apps, remove] = useInstalledApps();
|
|
91
|
+
const desktop = React.useMemo(() => desktop_1.DesktopUtil.apps(), []);
|
|
92
|
+
if (!desktop) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
(0, settings_controls_1.row)('install-apps', [t('ta.settings.installApps'), t('ta.settings.installAppsDescription')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.installApps'), description: t('ta.settings.installAppsDescription') },
|
|
97
|
+
React.createElement(settings_controls_1.Switch, { label: t('ta.settings.installApps'), checked: settings.installApps, onChange: on => store.update({ installApps: on }) }))),
|
|
98
|
+
...apps.map(app => (0, settings_controls_1.row)(`app:${app.id}`, [app.name, t('ta.settings.apps')], React.createElement(settings_controls_1.Row, { icon: lucide_react_1.AppWindow, label: app.name, description: t('ta.settings.apps') },
|
|
99
|
+
React.createElement(OpenButton, { open: () => desktop.open(app.id) }),
|
|
100
|
+
React.createElement(RemoveButton, { remove: () => remove(app.id) })))),
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=app-settings.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** What the window of an app needs to know of the page it shows, pure, for the tests. */
|
|
2
|
+
export declare namespace AppWindowUtil {
|
|
3
|
+
/** How long an extension that is starting (one in a sandbox registers its views late) may take before its page is taken for gone. */
|
|
4
|
+
const START_MS = 10000;
|
|
5
|
+
/** The page a window of Ta Desktop shows alone, installed as an app: `?app=<page id>` of its address. */
|
|
6
|
+
function id(search?: string): string | undefined;
|
|
7
|
+
/** Whether a view is the page of the app: that id, or a page of the extension the id names. */
|
|
8
|
+
function shows(id: string, view: string): boolean;
|
|
9
|
+
/** Whether the page is there to show: a page view of it, or the extension started on open it names. */
|
|
10
|
+
function known(id: string, views: readonly {
|
|
11
|
+
id: string;
|
|
12
|
+
location: string;
|
|
13
|
+
}[], onOpen: readonly {
|
|
14
|
+
info: {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
}[]): boolean;
|
|
18
|
+
/** Whether the extension of the page runs, its views maybe still on their way. */
|
|
19
|
+
function starting(id: string, extensions: readonly {
|
|
20
|
+
name: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}[]): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=app-window-util.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppWindowUtil = void 0;
|
|
4
|
+
/** What the window of an app needs to know of the page it shows, pure, for the tests. */
|
|
5
|
+
var AppWindowUtil;
|
|
6
|
+
(function (AppWindowUtil) {
|
|
7
|
+
/** How long an extension that is starting (one in a sandbox registers its views late) may take before its page is taken for gone. */
|
|
8
|
+
AppWindowUtil.START_MS = 10000;
|
|
9
|
+
/** The page a window of Ta Desktop shows alone, installed as an app: `?app=<page id>` of its address. */
|
|
10
|
+
function id(search = typeof location === 'undefined' ? '' : location.search) {
|
|
11
|
+
return new URLSearchParams(search).get('app') || undefined;
|
|
12
|
+
}
|
|
13
|
+
AppWindowUtil.id = id;
|
|
14
|
+
/** Whether a view is the page of the app: that id, or a page of the extension the id names. */
|
|
15
|
+
function shows(id, view) {
|
|
16
|
+
return view === id || view.startsWith(`${id}/`);
|
|
17
|
+
}
|
|
18
|
+
AppWindowUtil.shows = shows;
|
|
19
|
+
/** Whether the page is there to show: a page view of it, or the extension started on open it names. */
|
|
20
|
+
function known(id, views, onOpen) {
|
|
21
|
+
return views.some(view => view.location === 'page' && shows(id, view.id)) || onOpen.some(entry => entry.info.name === id);
|
|
22
|
+
}
|
|
23
|
+
AppWindowUtil.known = known;
|
|
24
|
+
/** Whether the extension of the page runs, its views maybe still on their way. */
|
|
25
|
+
function starting(id, extensions) {
|
|
26
|
+
return extensions.some(extension => !extension.error && shows(extension.name, id));
|
|
27
|
+
}
|
|
28
|
+
AppWindowUtil.starting = starting;
|
|
29
|
+
})(AppWindowUtil || (exports.AppWindowUtil = AppWindowUtil = {}));
|
|
30
|
+
//# sourceMappingURL=app-window-util.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The window of a page installed as an app (docs/design/ta-install-as-app.md 2): the web client connected as in the main
|
|
4
|
+
* window, with its extensions loaded, showing that page alone; the notices, dialogs and sharing of the page over it. No
|
|
5
|
+
* conversation, no navigation: what the page opens of those opens in the main window.
|
|
6
|
+
*/
|
|
7
|
+
export declare function AppWindow({ id }: {
|
|
8
|
+
id: string;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=app-window.d.ts.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AppWindow = AppWindow;
|
|
37
|
+
const react_1 = require("@celljs/react");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const app_contexts_1 = require("../components/app-contexts");
|
|
40
|
+
const app_nav_1 = require("../components/app-nav");
|
|
41
|
+
const app_shell_hooks_1 = require("../components/app-shell-hooks");
|
|
42
|
+
const custom_host_1 = require("../components/custom-host");
|
|
43
|
+
const empty_state_1 = require("../components/empty-state");
|
|
44
|
+
const link_dialog_1 = require("../components/link-dialog");
|
|
45
|
+
const loading_1 = require("../components/loading");
|
|
46
|
+
const notice_center_1 = require("../components/notice-center");
|
|
47
|
+
const remote_prompts_1 = require("../components/remote-prompts");
|
|
48
|
+
const share_dialog_1 = require("../components/share-dialog");
|
|
49
|
+
const workbench_view_1 = require("../components/workbench-view");
|
|
50
|
+
const files_protocol_1 = require("../files/files-protocol");
|
|
51
|
+
const hooks_1 = require("../hooks");
|
|
52
|
+
const use_t_1 = require("../i18n/use-t");
|
|
53
|
+
const desktop_1 = require("../util/desktop");
|
|
54
|
+
const thumbnail_1 = require("../util/thumbnail");
|
|
55
|
+
const app_window_util_1 = require("./app-window-util");
|
|
56
|
+
/**
|
|
57
|
+
* The window of a page installed as an app (docs/design/ta-install-as-app.md 2): the web client connected as in the main
|
|
58
|
+
* window, with its extensions loaded, showing that page alone; the notices, dialogs and sharing of the page over it. No
|
|
59
|
+
* conversation, no navigation: what the page opens of those opens in the main window.
|
|
60
|
+
*/
|
|
61
|
+
function AppWindow({ id }) {
|
|
62
|
+
const t = (0, use_t_1.useT)();
|
|
63
|
+
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
64
|
+
const [extensions, host] = (0, hooks_1.useWebExtensions)();
|
|
65
|
+
const [{ theme }] = (0, hooks_1.useSettings)();
|
|
66
|
+
const files = (0, react_1.useInject)(files_protocol_1.TaFiles);
|
|
67
|
+
const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await bench.workspace.fileUrl(path), box)), [bench, files]);
|
|
68
|
+
const openLink = (0, hooks_1.useOpenLink)(undefined);
|
|
69
|
+
const online = workbench.status === 'online';
|
|
70
|
+
// Offline, its extension starts from the code this device kept, as in the main window.
|
|
71
|
+
const reachable = online || workbench.status === 'offline';
|
|
72
|
+
(0, workbench_view_1.useDocument)();
|
|
73
|
+
(0, app_shell_hooks_1.useRefresh)(online);
|
|
74
|
+
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
void bench.start();
|
|
77
|
+
}, [bench]);
|
|
78
|
+
// The list of extensions read once: the page is there, or on its way, or gone.
|
|
79
|
+
const [listed, setListed] = React.useState(false);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!reachable) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
let live = true;
|
|
85
|
+
void host
|
|
86
|
+
.refresh()
|
|
87
|
+
.catch(() => undefined)
|
|
88
|
+
.then(() => live && setListed(true));
|
|
89
|
+
return () => {
|
|
90
|
+
live = false;
|
|
91
|
+
};
|
|
92
|
+
}, [reachable, host]);
|
|
93
|
+
const page = extensions.page;
|
|
94
|
+
// Its page alone (one of its extension, for an id that is the extension's name), never what the tab showed before.
|
|
95
|
+
const ours = app_window_util_1.AppWindowUtil.shows(id, page);
|
|
96
|
+
const known = app_window_util_1.AppWindowUtil.known(id, extensions.views, extensions.onOpen);
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
if (listed && known && !ours) {
|
|
99
|
+
void host.showView(id);
|
|
100
|
+
}
|
|
101
|
+
}, [listed, known, ours, host, id]);
|
|
102
|
+
const [late, setLate] = React.useState(false);
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
if (!listed) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const timer = setTimeout(() => setLate(true), app_window_util_1.AppWindowUtil.START_MS);
|
|
108
|
+
return () => clearTimeout(timer);
|
|
109
|
+
}, [listed]);
|
|
110
|
+
const gone = listed && !known && (late || !app_window_util_1.AppWindowUtil.starting(id, extensions.extensions));
|
|
111
|
+
if (workbench.status === 'signed-out') {
|
|
112
|
+
return workbench.leaving ? React.createElement("div", { className: "ta-signin" }) : React.createElement(workbench_view_1.SignIn, { error: workbench.error });
|
|
113
|
+
}
|
|
114
|
+
const view = ours ? extensions.views.find(candidate => candidate.id === page && candidate.location === 'page') : undefined;
|
|
115
|
+
const remove = () => { var _a; return void ((_a = desktop_1.DesktopUtil.apps()) === null || _a === void 0 ? void 0 : _a.remove(id)); };
|
|
116
|
+
return (React.createElement(app_contexts_1.AppContexts, { fileUrl: fileUrl, openLink: openLink },
|
|
117
|
+
React.createElement("div", { className: "ta-app ta-app-alone" },
|
|
118
|
+
React.createElement("main", { className: "ta-main" }, view ? (React.createElement(app_nav_1.PageView, { view: view })) : gone ? (React.createElement(empty_state_1.EmptyState, { title: t('ta.apps.gone'), hint: t('ta.apps.goneHint') },
|
|
119
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: remove }, t('ta.apps.remove')))) : (React.createElement(loading_1.Loading, null))),
|
|
120
|
+
React.createElement(notice_center_1.NoticeCenter, null),
|
|
121
|
+
React.createElement(link_dialog_1.LinkDialog, null),
|
|
122
|
+
React.createElement(remote_prompts_1.RemotePrompts, null),
|
|
123
|
+
React.createElement(share_dialog_1.ShareHost, null),
|
|
124
|
+
React.createElement(custom_host_1.CustomHost, null))));
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=app-window.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WebApps, WebIcon, WebInstalledApp } from '../extension/web-extension-api';
|
|
2
|
+
import type { WebPageInfo } from '../extension/web-pages';
|
|
3
|
+
import type { TaNotices } from '../notices/notices-protocol';
|
|
4
|
+
import type { TaSettings } from '../settings/settings-protocol';
|
|
5
|
+
import { type DesktopApps } from '../util/desktop';
|
|
6
|
+
/** What installing a page reads of the page: its pages as the launcher lists them, the settings, where it tells. */
|
|
7
|
+
export interface WebAppsHost {
|
|
8
|
+
pages(): readonly WebPageInfo[];
|
|
9
|
+
readonly settings: TaSettings;
|
|
10
|
+
readonly notices: TaNotices;
|
|
11
|
+
/** Drawn for a page without a glyph of its own, or one a sandbox draws. */
|
|
12
|
+
readonly fallbackIcon: WebIcon;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `ui.apps` (docs/design/ta-install-as-app.md 2): a page installed with the title and the tile the launcher shows it
|
|
16
|
+
* with, through Ta Desktop (DesktopUtil.apps), which knows pages by id, name and icon alone.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TaWebApps implements WebApps {
|
|
19
|
+
protected readonly desktop: DesktopApps;
|
|
20
|
+
protected readonly host: WebAppsHost;
|
|
21
|
+
constructor(desktop: DesktopApps, host: WebAppsHost);
|
|
22
|
+
/** Where Ta Desktop installs pages as apps; none elsewhere. */
|
|
23
|
+
static of(host: WebAppsHost): TaWebApps | undefined;
|
|
24
|
+
get installable(): boolean;
|
|
25
|
+
list(): Promise<WebInstalledApp[]>;
|
|
26
|
+
install(id: string): Promise<void>;
|
|
27
|
+
remove(id: string): Promise<void>;
|
|
28
|
+
open(id: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=web-apps.d.ts.map
|