@celljs/ta-web 4.9.0 → 4.10.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 +4 -3
- package/README.md +4 -3
- package/esm/browser/assistant/assistant-chat-list.js +8 -2
- package/esm/browser/assistant/assistant-extension.d.ts +8 -1
- package/esm/browser/assistant/assistant-extension.js +33 -5
- package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
- package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-source.js +2 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
- package/esm/browser/assistant/assistant-task-util.js +13 -3
- package/esm/browser/assistant/assistant-tasks.js +3 -2
- package/esm/browser/assistant/assistant-view.js +81 -56
- package/esm/browser/assistant/assistant.d.ts +30 -1
- package/esm/browser/assistant/assistant.js +89 -6
- package/esm/browser/assistant/task-views.d.ts +40 -6
- package/esm/browser/assistant/task-views.js +73 -21
- package/esm/browser/avatar/dino-avatar.d.ts +3 -4
- package/esm/browser/avatar/dino-avatar.js +4 -178
- package/esm/browser/avatar/dino-face.d.ts +19 -0
- package/esm/browser/avatar/dino-face.js +142 -0
- package/esm/browser/avatar/dino-geometry.d.ts +11 -0
- package/esm/browser/avatar/dino-geometry.js +38 -0
- package/esm/browser/avatar/dino-kinds.d.ts +15 -0
- package/esm/browser/avatar/dino-kinds.js +544 -0
- package/esm/browser/avatar/dino-motion.js +1 -1
- package/esm/browser/avatar/dino-shape.d.ts +80 -0
- package/esm/browser/avatar/dino-shape.js +113 -0
- package/esm/browser/avatar/dino-species.d.ts +1 -61
- package/esm/browser/avatar/dino-species.js +2 -653
- package/esm/browser/chat/chat-packages.d.ts +39 -0
- package/esm/browser/chat/chat-packages.js +70 -0
- package/esm/browser/chat/chat-protocol.d.ts +23 -1
- package/esm/browser/chat/chat-stores.d.ts +59 -0
- package/esm/browser/chat/chat-stores.js +121 -0
- package/esm/browser/chat/chat-util.d.ts +17 -0
- package/esm/browser/chat/chat-util.js +61 -0
- package/esm/browser/chat/chat-view.js +33 -12
- package/esm/browser/chat/chat.d.ts +31 -39
- package/esm/browser/chat/chat.js +226 -175
- package/esm/browser/components/access-view.js +1 -1
- package/esm/browser/components/account-menu.js +1 -1
- package/esm/browser/components/app-nav.d.ts +6 -3
- package/esm/browser/components/app-nav.js +19 -10
- package/esm/browser/components/app-shell-hooks.d.ts +47 -0
- package/esm/browser/components/app-shell-hooks.js +169 -0
- package/esm/browser/components/app-view.js +81 -172
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/chat-list.d.ts +20 -2
- package/esm/browser/components/chat-list.js +138 -22
- package/esm/browser/components/composer-box.d.ts +5 -5
- package/esm/browser/components/composer-box.js +111 -4
- package/esm/browser/components/composer.d.ts +7 -0
- package/esm/browser/components/composer.js +22 -14
- package/esm/browser/components/connection-bar.js +50 -17
- package/esm/browser/components/context-menu.d.ts +30 -4
- package/esm/browser/components/context-menu.js +199 -37
- package/esm/browser/components/conversation-scroll.d.ts +129 -6
- package/esm/browser/components/conversation-scroll.js +429 -109
- package/esm/browser/components/dino.js +1 -1
- package/esm/browser/components/earlier-messages.d.ts +2 -1
- package/esm/browser/components/earlier-messages.js +2 -17
- package/esm/browser/components/editor-area.d.ts +3 -1
- package/esm/browser/components/editor-area.js +6 -5
- package/esm/browser/components/empty-pictures.d.ts +0 -2
- package/esm/browser/components/empty-pictures.js +0 -16
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +30 -9
- package/esm/browser/components/held-talk.d.ts +28 -0
- package/esm/browser/components/held-talk.js +76 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +1 -1
- package/esm/browser/components/icon.d.ts +2 -2
- package/esm/browser/components/icon.js +5 -6
- package/esm/browser/components/image-viewer.d.ts +124 -0
- package/esm/browser/components/image-viewer.js +397 -0
- package/esm/browser/components/lightbox.d.ts +11 -0
- package/esm/browser/components/lightbox.js +24 -0
- package/esm/browser/components/markdown.d.ts +6 -2
- package/esm/browser/components/markdown.js +24 -10
- package/esm/browser/components/media.js +1 -10
- package/esm/browser/components/message-footer.d.ts +16 -2
- package/esm/browser/components/message-footer.js +29 -12
- package/esm/browser/components/message-list.d.ts +24 -3
- package/esm/browser/components/message-list.js +149 -20
- package/esm/browser/components/message-menu.d.ts +3 -1
- package/esm/browser/components/message-menu.js +18 -3
- package/esm/browser/components/nav-places.d.ts +16 -1
- package/esm/browser/components/nav-places.js +12 -3
- package/esm/browser/components/phone-shell.d.ts +4 -1
- package/esm/browser/components/phone-shell.js +3 -1
- package/esm/browser/components/run-status.js +3 -3
- package/esm/browser/components/select-bar.d.ts +9 -0
- package/esm/browser/components/select-bar.js +24 -0
- package/esm/browser/components/session-settings.d.ts +6 -0
- package/esm/browser/components/session-settings.js +14 -1
- package/esm/browser/components/session-view.js +8 -4
- package/esm/browser/components/settings-choices.d.ts +35 -0
- package/esm/browser/components/settings-choices.js +117 -0
- package/esm/browser/components/settings-parts.d.ts +21 -0
- package/esm/browser/components/settings-parts.js +323 -0
- package/esm/browser/components/settings-view.d.ts +0 -6
- package/esm/browser/components/settings-view.js +4 -406
- package/esm/browser/components/swipe-row.d.ts +2 -2
- package/esm/browser/components/swipe-row.js +7 -3
- package/esm/browser/components/tool-view.js +14 -12
- package/esm/browser/components/voice-button.d.ts +1 -1
- package/esm/browser/components/voice-button.js +1 -1
- package/esm/browser/components/voice-talk.d.ts +43 -0
- package/esm/browser/components/voice-talk.js +222 -0
- package/esm/browser/components/workbench-view.js +1 -1
- package/esm/browser/device/device.d.ts +3 -0
- package/esm/browser/device/device.js +11 -1
- package/esm/browser/device/hold.d.ts +42 -0
- package/esm/browser/device/hold.js +136 -0
- package/esm/browser/device/launch-screen.d.ts +1 -1
- package/esm/browser/device/launch-screen.js +1 -1
- package/esm/browser/device/long-press.d.ts +2 -0
- package/esm/browser/device/long-press.js +16 -1
- package/esm/browser/device/pull-down.d.ts +4 -2
- package/esm/browser/device/pull-down.js +64 -76
- package/esm/browser/device/row-swipe.d.ts +35 -10
- package/esm/browser/device/row-swipe.js +149 -71
- package/esm/browser/device/shake-undo.d.ts +16 -0
- package/esm/browser/device/shake-undo.js +59 -0
- package/esm/browser/device/sheet-swipe.d.ts +118 -18
- package/esm/browser/device/sheet-swipe.js +406 -107
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-extension-api.d.ts +135 -2
- package/esm/browser/extension/web-extension-code.d.ts +6 -0
- package/esm/browser/extension/web-extension-code.js +24 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
- package/esm/browser/extension/web-extension-protocol.js +8 -0
- package/esm/browser/extension/web-extensions.d.ts +14 -1
- package/esm/browser/extension/web-extensions.js +128 -24
- package/esm/browser/extension/web-tasks.d.ts +9 -1
- package/esm/browser/extension/web-tasks.js +24 -0
- package/esm/browser/files/files-protocol.d.ts +25 -0
- package/esm/browser/files/files-protocol.js +2 -0
- package/esm/browser/files/files.d.ts +35 -0
- package/esm/browser/files/files.js +119 -0
- package/esm/browser/hooks.d.ts +3 -1
- package/esm/browser/hooks.js +8 -0
- package/esm/browser/i18n/locales.d.ts +29 -2
- package/esm/browser/i18n/messages.d.ts +28 -1
- package/esm/browser/i18n/messages.js +58 -4
- package/esm/browser/index.d.ts +6 -0
- package/esm/browser/index.js +6 -0
- package/esm/browser/notices/notices-protocol.d.ts +9 -1
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +20 -10
- package/esm/browser/offline/device-values.d.ts +55 -0
- package/esm/browser/offline/device-values.js +142 -0
- package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
- package/esm/browser/offline/kept-chats-protocol.js +2 -0
- package/esm/browser/offline/kept-chats.d.ts +47 -0
- package/esm/browser/offline/kept-chats.js +146 -0
- package/esm/browser/offline/offline-reads.d.ts +44 -0
- package/esm/browser/offline/offline-reads.js +107 -0
- 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 +57 -17
- package/esm/browser/style/device.js +43 -4
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +67 -15
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +47 -3
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +2 -0
- package/esm/browser/util/frame.d.ts +5 -4
- package/esm/browser/util/frame.js +5 -4
- package/esm/browser/util/markdown.d.ts +18 -1
- package/esm/browser/util/markdown.js +119 -5
- package/esm/browser/util/process.d.ts +21 -0
- package/esm/browser/util/process.js +45 -1
- package/esm/browser/util/voice.d.ts +5 -2
- package/esm/browser/util/voice.js +6 -3
- package/esm/browser/util/zoom.d.ts +46 -0
- package/esm/browser/util/zoom.js +96 -0
- package/esm/browser/workbench-calls.d.ts +59 -0
- package/esm/browser/workbench-calls.js +141 -0
- package/esm/browser/workbench-protocol.d.ts +5 -1
- package/esm/browser/workbench-util.d.ts +68 -0
- package/esm/browser/workbench-util.js +145 -0
- package/esm/browser/workbench.d.ts +15 -42
- package/esm/browser/workbench.js +53 -167
- package/lib/browser/assistant/assistant-chat-list.js +8 -2
- package/lib/browser/assistant/assistant-extension.d.ts +8 -1
- package/lib/browser/assistant/assistant-extension.js +33 -5
- package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
- package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-source.js +2 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
- package/lib/browser/assistant/assistant-task-util.js +13 -3
- package/lib/browser/assistant/assistant-tasks.js +2 -1
- package/lib/browser/assistant/assistant-view.js +78 -53
- package/lib/browser/assistant/assistant.d.ts +30 -1
- package/lib/browser/assistant/assistant.js +89 -6
- package/lib/browser/assistant/task-views.d.ts +40 -6
- package/lib/browser/assistant/task-views.js +74 -21
- package/lib/browser/avatar/dino-avatar.d.ts +3 -4
- package/lib/browser/avatar/dino-avatar.js +27 -202
- package/lib/browser/avatar/dino-face.d.ts +20 -0
- package/lib/browser/avatar/dino-face.js +148 -0
- package/lib/browser/avatar/dino-geometry.d.ts +12 -0
- package/lib/browser/avatar/dino-geometry.js +47 -0
- package/lib/browser/avatar/dino-kinds.d.ts +16 -0
- package/lib/browser/avatar/dino-kinds.js +547 -0
- package/lib/browser/avatar/dino-motion.js +2 -2
- package/lib/browser/avatar/dino-shape.d.ts +81 -0
- package/lib/browser/avatar/dino-shape.js +126 -0
- package/lib/browser/avatar/dino-species.d.ts +1 -61
- package/lib/browser/avatar/dino-species.js +34 -687
- package/lib/browser/chat/chat-packages.d.ts +40 -0
- package/lib/browser/chat/chat-packages.js +74 -0
- package/lib/browser/chat/chat-protocol.d.ts +23 -1
- package/lib/browser/chat/chat-stores.d.ts +60 -0
- package/lib/browser/chat/chat-stores.js +125 -0
- package/lib/browser/chat/chat-util.d.ts +18 -0
- package/lib/browser/chat/chat-util.js +64 -0
- package/lib/browser/chat/chat-view.js +33 -12
- package/lib/browser/chat/chat.d.ts +31 -39
- package/lib/browser/chat/chat.js +227 -176
- package/lib/browser/components/access-view.js +2 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/app-nav.d.ts +6 -3
- package/lib/browser/components/app-nav.js +17 -8
- package/lib/browser/components/app-shell-hooks.d.ts +48 -0
- package/lib/browser/components/app-shell-hooks.js +211 -0
- package/lib/browser/components/app-view.js +89 -180
- package/lib/browser/components/auth-view.js +3 -3
- package/lib/browser/components/chat-list.d.ts +20 -2
- package/lib/browser/components/chat-list.js +137 -21
- package/lib/browser/components/composer-box.d.ts +5 -5
- package/lib/browser/components/composer-box.js +111 -4
- package/lib/browser/components/composer.d.ts +7 -0
- package/lib/browser/components/composer.js +22 -14
- package/lib/browser/components/connection-bar.js +48 -15
- package/lib/browser/components/context-menu.d.ts +30 -4
- package/lib/browser/components/context-menu.js +198 -36
- package/lib/browser/components/conversation-scroll.d.ts +129 -6
- package/lib/browser/components/conversation-scroll.js +431 -110
- package/lib/browser/components/dino.js +3 -3
- package/lib/browser/components/earlier-messages.d.ts +2 -1
- package/lib/browser/components/earlier-messages.js +2 -17
- package/lib/browser/components/editor-area.d.ts +3 -1
- package/lib/browser/components/editor-area.js +5 -4
- package/lib/browser/components/empty-pictures.d.ts +0 -2
- package/lib/browser/components/empty-pictures.js +0 -17
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +30 -9
- package/lib/browser/components/held-talk.d.ts +29 -0
- package/lib/browser/components/held-talk.js +79 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +5 -5
- package/lib/browser/components/icon.d.ts +2 -2
- package/lib/browser/components/icon.js +7 -6
- package/lib/browser/components/image-viewer.d.ts +125 -0
- package/lib/browser/components/image-viewer.js +435 -0
- package/lib/browser/components/lightbox.d.ts +12 -0
- package/lib/browser/components/lightbox.js +60 -0
- package/lib/browser/components/markdown.d.ts +6 -2
- package/lib/browser/components/markdown.js +24 -10
- package/lib/browser/components/media.js +2 -11
- package/lib/browser/components/message-footer.d.ts +16 -2
- package/lib/browser/components/message-footer.js +31 -12
- package/lib/browser/components/message-list.d.ts +24 -3
- package/lib/browser/components/message-list.js +146 -16
- package/lib/browser/components/message-menu.d.ts +3 -1
- package/lib/browser/components/message-menu.js +17 -2
- package/lib/browser/components/nav-places.d.ts +16 -1
- package/lib/browser/components/nav-places.js +13 -3
- package/lib/browser/components/phone-shell.d.ts +4 -1
- package/lib/browser/components/phone-shell.js +3 -1
- package/lib/browser/components/run-status.js +3 -3
- package/lib/browser/components/select-bar.d.ts +10 -0
- package/lib/browser/components/select-bar.js +61 -0
- package/lib/browser/components/session-settings.d.ts +6 -0
- package/lib/browser/components/session-settings.js +14 -1
- package/lib/browser/components/session-view.js +7 -3
- package/lib/browser/components/settings-choices.d.ts +36 -0
- package/lib/browser/components/settings-choices.js +156 -0
- package/lib/browser/components/settings-parts.d.ts +22 -0
- package/lib/browser/components/settings-parts.js +359 -0
- package/lib/browser/components/settings-view.d.ts +0 -6
- package/lib/browser/components/settings-view.js +2 -405
- package/lib/browser/components/swipe-row.d.ts +2 -2
- package/lib/browser/components/swipe-row.js +7 -3
- package/lib/browser/components/tool-view.js +14 -12
- package/lib/browser/components/voice-button.d.ts +1 -1
- package/lib/browser/components/voice-button.js +1 -1
- package/lib/browser/components/voice-talk.d.ts +44 -0
- package/lib/browser/components/voice-talk.js +260 -0
- package/lib/browser/components/workbench-view.js +3 -3
- package/lib/browser/device/device.d.ts +3 -0
- package/lib/browser/device/device.js +11 -1
- package/lib/browser/device/hold.d.ts +43 -0
- package/lib/browser/device/hold.js +173 -0
- package/lib/browser/device/launch-screen.d.ts +1 -1
- package/lib/browser/device/launch-screen.js +1 -1
- package/lib/browser/device/long-press.d.ts +2 -0
- package/lib/browser/device/long-press.js +16 -1
- package/lib/browser/device/pull-down.d.ts +4 -2
- package/lib/browser/device/pull-down.js +63 -75
- package/lib/browser/device/row-swipe.d.ts +35 -10
- package/lib/browser/device/row-swipe.js +148 -70
- package/lib/browser/device/shake-undo.d.ts +17 -0
- package/lib/browser/device/shake-undo.js +63 -0
- package/lib/browser/device/sheet-swipe.d.ts +118 -18
- package/lib/browser/device/sheet-swipe.js +410 -108
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +135 -2
- package/lib/browser/extension/web-extension-code.d.ts +6 -0
- package/lib/browser/extension/web-extension-code.js +24 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
- package/lib/browser/extension/web-extension-protocol.js +9 -1
- package/lib/browser/extension/web-extensions.d.ts +14 -1
- package/lib/browser/extension/web-extensions.js +125 -21
- package/lib/browser/extension/web-tasks.d.ts +9 -1
- package/lib/browser/extension/web-tasks.js +24 -0
- package/lib/browser/files/files-protocol.d.ts +26 -0
- package/lib/browser/files/files-protocol.js +5 -0
- package/lib/browser/files/files.d.ts +36 -0
- package/lib/browser/files/files.js +122 -0
- package/lib/browser/hooks.d.ts +3 -1
- package/lib/browser/hooks.js +9 -0
- package/lib/browser/i18n/locales.d.ts +29 -2
- package/lib/browser/i18n/messages.d.ts +28 -1
- package/lib/browser/i18n/messages.js +58 -4
- package/lib/browser/index.d.ts +6 -0
- package/lib/browser/index.js +6 -0
- package/lib/browser/notices/notices-protocol.d.ts +9 -1
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +20 -10
- package/lib/browser/offline/device-values.d.ts +56 -0
- package/lib/browser/offline/device-values.js +148 -0
- package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
- package/lib/browser/offline/kept-chats-protocol.js +5 -0
- package/lib/browser/offline/kept-chats.d.ts +48 -0
- package/lib/browser/offline/kept-chats.js +149 -0
- package/lib/browser/offline/offline-reads.d.ts +45 -0
- package/lib/browser/offline/offline-reads.js +111 -0
- 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 +57 -17
- package/lib/browser/style/device.js +43 -4
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +67 -15
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +47 -3
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +2 -0
- package/lib/browser/util/frame.d.ts +5 -4
- package/lib/browser/util/frame.js +5 -4
- package/lib/browser/util/markdown.d.ts +18 -1
- package/lib/browser/util/markdown.js +119 -5
- package/lib/browser/util/process.d.ts +21 -0
- package/lib/browser/util/process.js +46 -2
- package/lib/browser/util/voice.d.ts +5 -2
- package/lib/browser/util/voice.js +6 -3
- package/lib/browser/util/zoom.d.ts +47 -0
- package/lib/browser/util/zoom.js +99 -0
- package/lib/browser/workbench-calls.d.ts +60 -0
- package/lib/browser/workbench-calls.js +145 -0
- package/lib/browser/workbench-protocol.d.ts +5 -1
- package/lib/browser/workbench-util.d.ts +69 -0
- package/lib/browser/workbench-util.js +151 -0
- package/lib/browser/workbench.d.ts +15 -42
- package/lib/browser/workbench.js +74 -189
- package/package.json +10 -10
- package/public/launch.svg +46 -42
|
@@ -47,23 +47,28 @@ const core_1 = require("@celljs/core");
|
|
|
47
47
|
const React = __importStar(require("react"));
|
|
48
48
|
const code_editor_1 = require("../components/code-editor");
|
|
49
49
|
const context_menu_1 = require("../components/context-menu");
|
|
50
|
+
const conversation_scroll_1 = require("../components/conversation-scroll");
|
|
50
51
|
const diff_editor_1 = require("../components/diff-editor");
|
|
51
52
|
const empty_state_1 = require("../components/empty-state");
|
|
52
53
|
const folder_picker_1 = require("../components/folder-picker");
|
|
53
54
|
const host_tag_1 = require("../components/host-tag");
|
|
55
|
+
const image_viewer_1 = require("../components/image-viewer");
|
|
54
56
|
const list_skeleton_1 = require("../components/list-skeleton");
|
|
55
57
|
const markdown_1 = require("../components/markdown");
|
|
56
58
|
const model_picker_1 = require("../components/model-picker");
|
|
57
59
|
const nav_places_1 = require("../components/nav-places");
|
|
58
60
|
const picture_1 = require("../components/picture");
|
|
59
61
|
const qr_view_1 = require("../components/qr-view");
|
|
62
|
+
const select_bar_1 = require("../components/select-bar");
|
|
60
63
|
const swipe_row_1 = require("../components/swipe-row");
|
|
61
64
|
const ta_avatar_1 = require("../components/ta-avatar");
|
|
62
65
|
const web_composer_1 = require("../components/web-composer");
|
|
63
66
|
const web_dialog_1 = require("../components/web-dialog");
|
|
64
67
|
const device_1 = require("../device/device");
|
|
65
68
|
const scanner_1 = require("../device/scanner");
|
|
69
|
+
const files_protocol_1 = require("../files/files-protocol");
|
|
66
70
|
const messages_1 = require("../i18n/messages");
|
|
71
|
+
const use_t_1 = require("../i18n/use-t");
|
|
67
72
|
const links_protocol_1 = require("../links/links-protocol");
|
|
68
73
|
const notices_protocol_1 = require("../notices/notices-protocol");
|
|
69
74
|
const settings_protocol_1 = require("../settings/settings-protocol");
|
|
@@ -93,6 +98,7 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
93
98
|
views: [],
|
|
94
99
|
widgets: [],
|
|
95
100
|
composerAddons: [],
|
|
101
|
+
settingsSections: [],
|
|
96
102
|
renderers: {},
|
|
97
103
|
avatars: {},
|
|
98
104
|
tools: [],
|
|
@@ -101,6 +107,7 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
101
107
|
focus: 0,
|
|
102
108
|
page: '',
|
|
103
109
|
pageShown: 0,
|
|
110
|
+
conversationShown: true,
|
|
104
111
|
onOpen: [],
|
|
105
112
|
kept: [],
|
|
106
113
|
usage: {},
|
|
@@ -111,6 +118,8 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
111
118
|
this.refreshing = Promise.resolve(false);
|
|
112
119
|
/** The tabs of before are open again: from now on, what is open is kept. */
|
|
113
120
|
this.restored = false;
|
|
121
|
+
/** The extensions of the list of the last time have started (startKept), once. */
|
|
122
|
+
this.keptStarted = false;
|
|
114
123
|
this.sharing = new web_sharing_1.WebSharing({
|
|
115
124
|
language: () => this.settings.state.language,
|
|
116
125
|
notices: () => this.notices,
|
|
@@ -383,6 +392,11 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
383
392
|
this.update({ cwd: conversation === null || conversation === void 0 ? void 0 : conversation.cwd, sessionId: conversation === null || conversation === void 0 ? void 0 : conversation.sessionId });
|
|
384
393
|
}
|
|
385
394
|
}
|
|
395
|
+
setConversationShown(shown) {
|
|
396
|
+
if (this.current.conversationShown !== shown) {
|
|
397
|
+
this.update({ conversationShown: shown });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
386
400
|
setSessionSwitcher(switcher) {
|
|
387
401
|
this.switcher = switcher;
|
|
388
402
|
}
|
|
@@ -411,34 +425,81 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
411
425
|
if (changed) {
|
|
412
426
|
this.publish();
|
|
413
427
|
}
|
|
428
|
+
const host = this.workbench.state.host;
|
|
429
|
+
const listing = this.workbench.packages.listWebExtensions();
|
|
430
|
+
// Answered below; until then those of the last time start.
|
|
431
|
+
listing.catch(() => undefined);
|
|
432
|
+
changed = (await this.startKept(host)) || changed;
|
|
433
|
+
const listed = await listing;
|
|
434
|
+
if (host) {
|
|
435
|
+
this.code.keepList(host, listed);
|
|
436
|
+
}
|
|
414
437
|
// A built-in package turned off stays in the list, for its switch in the settings.
|
|
415
|
-
const infos =
|
|
416
|
-
const
|
|
417
|
-
this.code.keepOnly(
|
|
418
|
-
const stopped = this.stopUnless(run => {
|
|
419
|
-
const keep = !run.loaded.info || (hashes.has(run.loaded.id) && hashes.get(run.loaded.id) === run.hash);
|
|
420
|
-
if (!keep) {
|
|
421
|
-
this.onDemand.stopped(run.loaded.id);
|
|
422
|
-
}
|
|
423
|
-
return keep;
|
|
424
|
-
});
|
|
438
|
+
const infos = listed.filter(info => info.enabled !== false);
|
|
439
|
+
const fresh = new Map(infos.map(info => [info.id, info]));
|
|
440
|
+
this.code.keepOnly(infos.map(info => info.hash));
|
|
425
441
|
// Those started on open wait to be opened (ta-launcher.md).
|
|
426
442
|
this.onDemand.set(infos.filter(info => info.activation === 'open'));
|
|
427
443
|
// Fetched together, started in the order of the list: the order of their views stays the same.
|
|
428
|
-
const
|
|
429
|
-
const loads = await Promise.all(
|
|
430
|
-
|
|
444
|
+
const starting = infos.filter(info => { var _a; return ((_a = this.running.get(info.id)) === null || _a === void 0 ? void 0 : _a.hash) !== info.hash && info.activation !== 'open'; });
|
|
445
|
+
const loads = await Promise.all(starting.map(info => this.loadPackage(info)));
|
|
446
|
+
// Stopped only now, just before the new code starts: the views of the old one stay drawn until the next
|
|
447
|
+
// publish, and stopped while the new code is read (after an update, over the relay) they would show
|
|
448
|
+
// without the styles it took away.
|
|
449
|
+
const stopped = this.stopUnless(run => {
|
|
450
|
+
if (!run.loaded.info) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
const info = fresh.get(run.loaded.id);
|
|
454
|
+
if (info && info.hash === run.hash) {
|
|
455
|
+
// Started from the list of the last time: what else it says is of now.
|
|
456
|
+
run.loaded = { ...run.loaded, info };
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
this.onDemand.stopped(run.loaded.id);
|
|
460
|
+
return false;
|
|
461
|
+
});
|
|
462
|
+
for (const [index, info] of starting.entries()) {
|
|
431
463
|
this.startPackage(info, loads[index]);
|
|
432
464
|
}
|
|
433
465
|
this.placeholders = undefined;
|
|
434
466
|
// The list of those started on open may have changed too.
|
|
435
467
|
this.publish();
|
|
436
|
-
changed = changed || stopped ||
|
|
468
|
+
changed = changed || stopped || starting.length > 0;
|
|
437
469
|
if (!this.restored) {
|
|
438
470
|
await this.restoreTabs();
|
|
439
471
|
}
|
|
440
472
|
return changed;
|
|
441
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* The first time, before the computer has answered: the extensions of its list of the last time whose code
|
|
476
|
+
* this browser keeps. What they read goes with the first calls of the page, not a round trip after the list
|
|
477
|
+
* (a phone over the relay waited for it before its double's list could show). The list then keeps those
|
|
478
|
+
* still the same and stops the others.
|
|
479
|
+
*/
|
|
480
|
+
async startKept(host) {
|
|
481
|
+
if (this.keptStarted || !host) {
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
this.keptStarted = true;
|
|
485
|
+
const infos = this.code.list(host).filter(info => info.enabled !== false && info.activation !== 'open' && !this.running.has(info.id));
|
|
486
|
+
const loads = await Promise.all(infos.map(info => {
|
|
487
|
+
const code = this.code.get(info.hash);
|
|
488
|
+
return code === undefined ? undefined : web_view_util_1.WebExtensionUtil.load(code).catch(() => undefined);
|
|
489
|
+
}));
|
|
490
|
+
let started = false;
|
|
491
|
+
for (const [index, info] of infos.entries()) {
|
|
492
|
+
const factory = loads[index];
|
|
493
|
+
if (factory && !this.running.has(info.id)) {
|
|
494
|
+
this.start({ id: info.id, name: info.name, info }, factory, info.hash);
|
|
495
|
+
started = true;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (started) {
|
|
499
|
+
this.publish();
|
|
500
|
+
}
|
|
501
|
+
return started;
|
|
502
|
+
}
|
|
442
503
|
/** The tools open before, behind what is shown; the tab shown before, once it is open again. */
|
|
443
504
|
async restoreTabs() {
|
|
444
505
|
const kept = await this.persisted.load(web_view_util_1.WebViewUtil.TABS);
|
|
@@ -591,12 +652,13 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
591
652
|
taskSources: [],
|
|
592
653
|
searches: [],
|
|
593
654
|
composerAddons: [],
|
|
655
|
+
settingsSections: [],
|
|
594
656
|
handlers: [],
|
|
595
657
|
unsubscribes: [],
|
|
596
658
|
};
|
|
597
659
|
}
|
|
598
660
|
api(run) {
|
|
599
|
-
const { workbench, settings } = this;
|
|
661
|
+
const { workbench, settings, taFiles } = this;
|
|
600
662
|
const subscribe = (listener) => this.subscribe(listener);
|
|
601
663
|
const register = (change) => {
|
|
602
664
|
if (!run.stopped) {
|
|
@@ -620,6 +682,9 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
620
682
|
get packages() {
|
|
621
683
|
return workbench.packages;
|
|
622
684
|
},
|
|
685
|
+
get files() {
|
|
686
|
+
return taFiles;
|
|
687
|
+
},
|
|
623
688
|
get remote() {
|
|
624
689
|
return workbench.remote;
|
|
625
690
|
},
|
|
@@ -660,11 +725,18 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
660
725
|
},
|
|
661
726
|
useCwd: () => {
|
|
662
727
|
var _a;
|
|
663
|
-
|
|
664
|
-
const
|
|
728
|
+
// The conversation's while it is in front; with a page, the settings or nothing in front, the default directory.
|
|
729
|
+
const shown = () => web_extension_protocol_1.WebCwdUtil.shown(this.current);
|
|
730
|
+
const cwd = React.useSyncExternalStore(subscribe, shown, shown);
|
|
731
|
+
const server = () => { var _a; return (_a = workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd; };
|
|
732
|
+
const fallback = React.useSyncExternalStore(listener => workbench.subscribe(listener), server, server);
|
|
665
733
|
return (_a = cwd !== null && cwd !== void 0 ? cwd : fallback) !== null && _a !== void 0 ? _a : '.';
|
|
666
734
|
},
|
|
667
735
|
useSessionId: () => React.useSyncExternalStore(subscribe, () => this.current.sessionId),
|
|
736
|
+
useSessions: () => {
|
|
737
|
+
const sessions = () => workbench.state.sessions;
|
|
738
|
+
return React.useSyncExternalStore(listener => workbench.subscribe(listener), sessions, sessions);
|
|
739
|
+
},
|
|
668
740
|
useDevice: device_1.useDevice,
|
|
669
741
|
showView: id => (run.stopped ? Promise.resolve(false) : this.showView(id)),
|
|
670
742
|
usePages: () => {
|
|
@@ -679,12 +751,14 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
679
751
|
.flatMap((section, index) => [...(index > 0 ? ['-'] : []), ...section])), [open]);
|
|
680
752
|
return [menu, openSections];
|
|
681
753
|
},
|
|
754
|
+
attachMenu: context_menu_1.ContextMenuUtil.attach,
|
|
682
755
|
scanCode: scanner_1.Scanner.available() ? instructions => scanner_1.Scanner.scan(instructions, (0, messages_1.message)(settings.state.language, 'ta.cancel')) : undefined,
|
|
683
756
|
stopExtension: name => !run.stopped && this.stopExtension(name),
|
|
684
757
|
shareExtension: target => !run.stopped && this.share(target),
|
|
685
758
|
openShared: text => (run.stopped ? Promise.resolve(false) : this.openShared(text)),
|
|
686
759
|
forgetPage: id => !run.stopped && this.forgetPage(id),
|
|
687
760
|
useTasks: () => React.useSyncExternalStore(this.tasks.subscribe, this.tasks.tasks, this.tasks.tasks),
|
|
761
|
+
removeTasks: tasks => (run.stopped ? Promise.resolve(false) : web_tasks_1.WebTaskUtil.remove(tasks, this.notices, (0, use_t_1.translator)(settings.state.language))),
|
|
688
762
|
useView: id => {
|
|
689
763
|
const find = () => this.current.views.find(candidate => candidate.id === id);
|
|
690
764
|
const isShown = () => this.isShown(id);
|
|
@@ -692,7 +766,24 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
692
766
|
const shown = React.useSyncExternalStore(subscribe, isShown, isShown);
|
|
693
767
|
// The title is read again in another language: a string, so that the same words stay the same value.
|
|
694
768
|
const title = view ? web_extension_protocol_1.WebLabelUtil.text(view.title) : undefined;
|
|
695
|
-
|
|
769
|
+
// The preview as one string, so that the same line stays the same value.
|
|
770
|
+
const watch = React.useCallback((listener) => { var _a; var _b; return (_b = (_a = view === null || view === void 0 ? void 0 : view.subscribePreview) === null || _a === void 0 ? void 0 : _a.call(view, listener)) !== null && _b !== void 0 ? _b : (() => undefined); }, [view]);
|
|
771
|
+
const read = () => {
|
|
772
|
+
var _a;
|
|
773
|
+
const preview = (_a = view === null || view === void 0 ? void 0 : view.preview) === null || _a === void 0 ? void 0 : _a.call(view);
|
|
774
|
+
return preview ? `${preview.at}\n${preview.text}` : '';
|
|
775
|
+
};
|
|
776
|
+
const line = React.useSyncExternalStore(watch, read, read);
|
|
777
|
+
const isBusy = () => { var _a; return !!((_a = view === null || view === void 0 ? void 0 : view.busy) === null || _a === void 0 ? void 0 : _a.call(view)); };
|
|
778
|
+
const busy = React.useSyncExternalStore(watch, isBusy, isBusy);
|
|
779
|
+
return React.useMemo(() => {
|
|
780
|
+
if (!view || title === undefined) {
|
|
781
|
+
return undefined;
|
|
782
|
+
}
|
|
783
|
+
const cut = line.indexOf('\n');
|
|
784
|
+
const preview = line ? { at: Number(line.slice(0, cut)), text: line.slice(cut + 1) } : undefined;
|
|
785
|
+
return { title, location: view.location, shown, menu: view.menu, preview, busy };
|
|
786
|
+
}, [view, title, shown, line, busy]);
|
|
696
787
|
},
|
|
697
788
|
Avatar: ta_avatar_1.TaAvatar,
|
|
698
789
|
icons: icons_1.WEB_ICONS,
|
|
@@ -706,12 +797,16 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
706
797
|
},
|
|
707
798
|
Composer: this.composer,
|
|
708
799
|
Markdown: markdown_1.Markdown,
|
|
800
|
+
useChatScroll: (sent, key) => (0, conversation_scroll_1.useConversationScroll)(sent, { sentTo: 'bottom', key }),
|
|
709
801
|
Empty: empty_state_1.EmptyState,
|
|
710
802
|
Skeleton: list_skeleton_1.ListSkeleton,
|
|
711
803
|
HostTag: host_tag_1.HostTag,
|
|
712
804
|
SwipeRow: swipe_row_1.SwipeRow,
|
|
805
|
+
SelectCheck: select_bar_1.SelectCheck,
|
|
806
|
+
SelectBar: select_bar_1.SelectBar,
|
|
713
807
|
Picture: picture_1.Picture,
|
|
714
808
|
PictureCards: picture_1.PictureCards,
|
|
809
|
+
ImageViewer: image_viewer_1.ImageViewer,
|
|
715
810
|
QrCode: qr_view_1.QrView,
|
|
716
811
|
Dialog: web_dialog_1.WebDialog,
|
|
717
812
|
FolderPicker: this.folderPicker,
|
|
@@ -738,6 +833,7 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
738
833
|
registerTasks: source => register(() => run.taskSources.push(source)),
|
|
739
834
|
registerSearch: source => register(() => run.searches.push(source)),
|
|
740
835
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
836
|
+
registerSettings: section => register(() => run.settingsSections.push(section)),
|
|
741
837
|
registerOpener: opener => register(() => run.openers.push(async (link) => {
|
|
742
838
|
// An opener that fails, or of an extension that stopped, leaves the link to the next one.
|
|
743
839
|
try {
|
|
@@ -822,18 +918,21 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
822
918
|
}
|
|
823
919
|
}
|
|
824
920
|
this.tasks.setSources(runs.flatMap(run => run.taskSources.map(source => ({ extension: run.loaded.name, source }))));
|
|
825
|
-
const views = runs.flatMap(run => [...run.views].map(([name, view]) => { var _a; var
|
|
921
|
+
const views = runs.flatMap(run => [...run.views].map(([name, view]) => { var _a, _b, _c, _d; var _e, _f; return ({
|
|
826
922
|
id: `${run.loaded.name}/${name}`,
|
|
827
923
|
extension: run.loaded.id,
|
|
828
924
|
title: view.title,
|
|
829
925
|
component: view.render,
|
|
830
926
|
icon: view.icon,
|
|
831
|
-
location: (
|
|
832
|
-
order: (
|
|
927
|
+
location: (_e = view.location) !== null && _e !== void 0 ? _e : 'page',
|
|
928
|
+
order: (_f = view.order) !== null && _f !== void 0 ? _f : DEFAULT_ORDER,
|
|
833
929
|
head: view.head,
|
|
834
930
|
pages: view.pages,
|
|
835
931
|
discover: view.discover,
|
|
836
932
|
menu: (_a = view.menu) === null || _a === void 0 ? void 0 : _a.bind(view),
|
|
933
|
+
preview: (_b = view.preview) === null || _b === void 0 ? void 0 : _b.bind(view),
|
|
934
|
+
busy: (_c = view.busy) === null || _c === void 0 ? void 0 : _c.bind(view),
|
|
935
|
+
subscribePreview: (_d = view.subscribe) === null || _d === void 0 ? void 0 : _d.bind(view),
|
|
837
936
|
...(this.onDemand.has(run.loaded.id) ? { onOpen: true } : {}),
|
|
838
937
|
}); }));
|
|
839
938
|
if (this.placeholders) {
|
|
@@ -854,6 +953,7 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
854
953
|
component,
|
|
855
954
|
}); })),
|
|
856
955
|
composerAddons: runs.flatMap(run => run.composerAddons.map((addon, index) => ({ id: `${run.loaded.id}/${index}`, extension: run.loaded.id, addon }))),
|
|
956
|
+
settingsSections: runs.flatMap(run => run.settingsSections.map((section, index) => ({ id: `${run.loaded.id}/${index}`, extension: run.loaded.id, section }))),
|
|
857
957
|
renderers,
|
|
858
958
|
avatars,
|
|
859
959
|
tools,
|
|
@@ -879,6 +979,10 @@ __decorate([
|
|
|
879
979
|
(0, core_1.Autowired)(settings_protocol_1.TaSettings),
|
|
880
980
|
__metadata("design:type", Object)
|
|
881
981
|
], TaWebExtensionsImpl.prototype, "settings", void 0);
|
|
982
|
+
__decorate([
|
|
983
|
+
(0, core_1.Autowired)(files_protocol_1.TaFiles),
|
|
984
|
+
__metadata("design:type", Object)
|
|
985
|
+
], TaWebExtensionsImpl.prototype, "taFiles", void 0);
|
|
882
986
|
__decorate([
|
|
883
987
|
(0, core_1.Autowired)({ id: links_protocol_1.TaLinks, detached: true }),
|
|
884
988
|
__metadata("design:type", Object)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Translate } from '../i18n/use-t';
|
|
2
|
+
import type { TaNotices } from '../notices/notices-protocol';
|
|
3
|
+
import type { WebTask, WebTaskEntry, WebTaskRemoval, WebTaskSource } from './web-extension-api';
|
|
2
4
|
/** A source of tasks and the extension that registered it. */
|
|
3
5
|
export interface WebTaskSourceEntry {
|
|
4
6
|
/** The name of the extension: `assistant`, `@celljs/ta-channels`. */
|
|
@@ -18,6 +20,12 @@ export declare namespace WebTaskUtil {
|
|
|
18
20
|
function groups(tasks: readonly WebTaskEntry[]): WebTaskGroups;
|
|
19
21
|
/** `12s`, `3m 05s`, `1h 02m`: from its start to its end, or to now. */
|
|
20
22
|
function elapsed(task: Pick<WebTask, 'startedAt' | 'endedAt'>, now: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Deletes those that can be (`remove`) once the user agrees: asked once, with the title of one or the count
|
|
25
|
+
* of many, and what deleting them does (their `removeHint`s, each once). Each failure is a notice; the
|
|
26
|
+
* others go on. Whether the user agreed.
|
|
27
|
+
*/
|
|
28
|
+
function remove(tasks: readonly WebTaskRemoval[], notices: Pick<TaNotices, 'confirm' | 'error'>, t: Translate): Promise<boolean>;
|
|
21
29
|
/** The tasks handed out from a conversation (its session file) in a span of time: those a turn of it started. */
|
|
22
30
|
function startedIn(tasks: readonly WebTaskEntry[], origin: string | undefined, from: number, until: number): WebTaskEntry[];
|
|
23
31
|
}
|
|
@@ -35,6 +35,30 @@ var WebTaskUtil;
|
|
|
35
35
|
return `${Math.floor(minutes / 60)}h ${String(minutes % 60).padStart(2, '0')}m`;
|
|
36
36
|
}
|
|
37
37
|
WebTaskUtil.elapsed = elapsed;
|
|
38
|
+
/**
|
|
39
|
+
* Deletes those that can be (`remove`) once the user agrees: asked once, with the title of one or the count
|
|
40
|
+
* of many, and what deleting them does (their `removeHint`s, each once). Each failure is a notice; the
|
|
41
|
+
* others go on. Whether the user agreed.
|
|
42
|
+
*/
|
|
43
|
+
async function remove(tasks, notices, t) {
|
|
44
|
+
const removable = tasks.filter(task => task.remove);
|
|
45
|
+
if (removable.length === 0) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const hints = [...new Set(removable.map(task => { var _a; return (_a = task.removeHint) === null || _a === void 0 ? void 0 : _a.trim(); }).filter(Boolean))];
|
|
49
|
+
const agreed = await notices.confirm({
|
|
50
|
+
title: removable.length === 1 ? t('ta.task.removeTitle', { title: removable[0].title }) : t('ta.tasks.removeTitle', { count: removable.length }),
|
|
51
|
+
message: hints.join('\n') || undefined,
|
|
52
|
+
confirmLabel: t('ta.task.remove'),
|
|
53
|
+
danger: true,
|
|
54
|
+
});
|
|
55
|
+
if (!agreed) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
await Promise.all(removable.map(task => { var _a; return (_a = task.remove) === null || _a === void 0 ? void 0 : _a.call(task).catch(error => void notices.error(error)); }));
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
WebTaskUtil.remove = remove;
|
|
38
62
|
/** The tasks handed out from a conversation (its session file) in a span of time: those a turn of it started. */
|
|
39
63
|
function startedIn(tasks, origin, from, until) {
|
|
40
64
|
if (!origin) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const TaFiles: unique symbol;
|
|
2
|
+
/** The bytes of a file, as the page shows them: its type as ta serve answers it, and the bytes themselves. */
|
|
3
|
+
export interface TaFileBytes {
|
|
4
|
+
type: string;
|
|
5
|
+
size: number;
|
|
6
|
+
data: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The bytes of the files of the workspace, for a page that cannot load them by their URL
|
|
10
|
+
* (`TaWorkspaceServer.fileUrl`): behind a relay, and in the app on a phone, only the calls on the WebSocket
|
|
11
|
+
* reach ta serve, so `/api/files` is not there to load. Through a relay they come sealed, end to end, on a
|
|
12
|
+
* channel of their own (RelayFiles of @celljs/ta-relay): the relay reads neither the request nor the bytes.
|
|
13
|
+
*/
|
|
14
|
+
export interface TaFiles {
|
|
15
|
+
/** Whether the page itself can load what `fileUrl` gives: false through a relay, and in the app on a phone. */
|
|
16
|
+
readonly byUrl: boolean;
|
|
17
|
+
/** The bytes of a file of `url` — what `workspace.fileUrl` gave, or a path beside it. */
|
|
18
|
+
read(url: string): Promise<TaFileBytes>;
|
|
19
|
+
/**
|
|
20
|
+
* A URL the page can load for a file of `url`: that one where ta serve serves the page, and a `blob:`
|
|
21
|
+
* made from its bytes where it does not. Made once for each file, and let go of when it is no longer
|
|
22
|
+
* among those shown (the page draws one again by asking).
|
|
23
|
+
*/
|
|
24
|
+
loadable(url: string): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=files-protocol.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RelayFiles, type RelayPairing } from '@celljs/ta-relay';
|
|
2
|
+
import type { Credential } from '../workbench-protocol';
|
|
3
|
+
import { TaWorkbench } from '../workbench-protocol';
|
|
4
|
+
import { type TaFileBytes, TaFiles } from './files-protocol';
|
|
5
|
+
/**
|
|
6
|
+
* The files of the workspace: loaded by their URL from ta serve when the page is served by it, and read
|
|
7
|
+
* through the relay — sealed end to end, on a channel of their own — when it is not (a phone, the app).
|
|
8
|
+
*/
|
|
9
|
+
export declare class TaFilesImpl implements TaFiles {
|
|
10
|
+
protected readonly workbench: TaWorkbench;
|
|
11
|
+
/** The channel of the computer in use, kept open for the page; another computer has another. */
|
|
12
|
+
protected relay?: {
|
|
13
|
+
key: string;
|
|
14
|
+
files: RelayFiles;
|
|
15
|
+
};
|
|
16
|
+
/** The URLs made from the bytes of files, by the URL of the file: a picture shown again is not read again. */
|
|
17
|
+
protected readonly made: Map<string, {
|
|
18
|
+
made: Promise<string>;
|
|
19
|
+
size: number;
|
|
20
|
+
}>;
|
|
21
|
+
protected held: number;
|
|
22
|
+
/** The computer the URLs made are of: those of another say nothing of its files. */
|
|
23
|
+
protected of?: string;
|
|
24
|
+
get byUrl(): boolean;
|
|
25
|
+
read(url: string): Promise<TaFileBytes>;
|
|
26
|
+
loadable(url: string): Promise<string>;
|
|
27
|
+
protected credential(): Credential | undefined;
|
|
28
|
+
protected pairing(): RelayPairing;
|
|
29
|
+
protected relayed(pairing: RelayPairing): RelayFiles;
|
|
30
|
+
/** Another computer: what was made of the files of the one before says nothing of its own. */
|
|
31
|
+
protected keep(): void;
|
|
32
|
+
protected forget(): void;
|
|
33
|
+
/** The URLs made stay within {@link MADE_MAX_BYTES}: the ones made first go, and are made again when shown. */
|
|
34
|
+
protected trim(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaFilesImpl = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const ta_relay_1 = require("@celljs/ta-relay");
|
|
15
|
+
const workbench_protocol_1 = require("../workbench-protocol");
|
|
16
|
+
const files_protocol_1 = require("./files-protocol");
|
|
17
|
+
/** What the URLs made from bytes take at most: a conversation of pictures is looked at for a while, then read again. */
|
|
18
|
+
const MADE_MAX_BYTES = 48 * 1024 * 1024;
|
|
19
|
+
/**
|
|
20
|
+
* The files of the workspace: loaded by their URL from ta serve when the page is served by it, and read
|
|
21
|
+
* through the relay — sealed end to end, on a channel of their own — when it is not (a phone, the app).
|
|
22
|
+
*/
|
|
23
|
+
let TaFilesImpl = class TaFilesImpl {
|
|
24
|
+
constructor() {
|
|
25
|
+
/** The URLs made from the bytes of files, by the URL of the file: a picture shown again is not read again. */
|
|
26
|
+
this.made = new Map();
|
|
27
|
+
this.held = 0;
|
|
28
|
+
}
|
|
29
|
+
get byUrl() {
|
|
30
|
+
const credential = this.credential();
|
|
31
|
+
return !credential || !('pairing' in credential);
|
|
32
|
+
}
|
|
33
|
+
async read(url) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (this.byUrl) {
|
|
36
|
+
const response = await fetch(url, { cache: 'no-cache' });
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`The file is not there (${response.status}).`);
|
|
39
|
+
}
|
|
40
|
+
const data = new Uint8Array(await response.arrayBuffer());
|
|
41
|
+
return { type: (_a = response.headers.get('content-type')) !== null && _a !== void 0 ? _a : 'application/octet-stream', size: data.length, data };
|
|
42
|
+
}
|
|
43
|
+
return this.relayed(this.pairing()).get(url);
|
|
44
|
+
}
|
|
45
|
+
async loadable(url) {
|
|
46
|
+
if (this.byUrl) {
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
this.keep();
|
|
50
|
+
const known = this.made.get(url);
|
|
51
|
+
if (known) {
|
|
52
|
+
return known.made;
|
|
53
|
+
}
|
|
54
|
+
const file = await this.read(url);
|
|
55
|
+
// Two frames asked for the same picture: the one that comes first is kept.
|
|
56
|
+
const again = this.made.get(url);
|
|
57
|
+
if (again) {
|
|
58
|
+
return again.made;
|
|
59
|
+
}
|
|
60
|
+
const created = URL.createObjectURL(new Blob([file.data], { type: file.type }));
|
|
61
|
+
this.made.set(url, { made: Promise.resolve(created), size: file.data.length });
|
|
62
|
+
this.held += file.data.length;
|
|
63
|
+
this.trim();
|
|
64
|
+
return created;
|
|
65
|
+
}
|
|
66
|
+
credential() {
|
|
67
|
+
var _a;
|
|
68
|
+
const state = this.workbench.state;
|
|
69
|
+
return (_a = state.hosts.find(host => host.id === state.host)) === null || _a === void 0 ? void 0 : _a.credential;
|
|
70
|
+
}
|
|
71
|
+
pairing() {
|
|
72
|
+
const credential = this.credential();
|
|
73
|
+
const pairing = credential && 'pairing' in credential ? credential.pairing : undefined;
|
|
74
|
+
if (!pairing) {
|
|
75
|
+
throw new Error('This page is not signed in to a computer through a relay.');
|
|
76
|
+
}
|
|
77
|
+
return pairing;
|
|
78
|
+
}
|
|
79
|
+
relayed(pairing) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const key = `${pairing.relay} ${pairing.host} ${pairing.device} ${pairing.key}`;
|
|
82
|
+
if (((_a = this.relay) === null || _a === void 0 ? void 0 : _a.key) !== key) {
|
|
83
|
+
(_b = this.relay) === null || _b === void 0 ? void 0 : _b.files.close();
|
|
84
|
+
this.relay = { key, files: new ta_relay_1.RelayFiles(pairing) };
|
|
85
|
+
}
|
|
86
|
+
return this.relay.files;
|
|
87
|
+
}
|
|
88
|
+
/** Another computer: what was made of the files of the one before says nothing of its own. */
|
|
89
|
+
keep() {
|
|
90
|
+
const host = this.workbench.state.host;
|
|
91
|
+
if (host === this.of) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.forget();
|
|
95
|
+
this.of = host;
|
|
96
|
+
}
|
|
97
|
+
forget() {
|
|
98
|
+
for (const entry of this.made.values()) {
|
|
99
|
+
entry.made.then(url => URL.revokeObjectURL(url), () => undefined);
|
|
100
|
+
}
|
|
101
|
+
this.made.clear();
|
|
102
|
+
this.held = 0;
|
|
103
|
+
}
|
|
104
|
+
/** The URLs made stay within {@link MADE_MAX_BYTES}: the ones made first go, and are made again when shown. */
|
|
105
|
+
trim() {
|
|
106
|
+
while (this.held > MADE_MAX_BYTES && this.made.size > 1) {
|
|
107
|
+
const [key, entry] = this.made.entries().next().value;
|
|
108
|
+
this.made.delete(key);
|
|
109
|
+
this.held -= entry.size;
|
|
110
|
+
entry.made.then(url => URL.revokeObjectURL(url), () => undefined);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.TaFilesImpl = TaFilesImpl;
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, core_1.Autowired)(workbench_protocol_1.TaWorkbench),
|
|
117
|
+
__metadata("design:type", Object)
|
|
118
|
+
], TaFilesImpl.prototype, "workbench", void 0);
|
|
119
|
+
exports.TaFilesImpl = TaFilesImpl = __decorate([
|
|
120
|
+
(0, core_1.Component)(files_protocol_1.TaFiles)
|
|
121
|
+
], TaFilesImpl);
|
|
122
|
+
//# sourceMappingURL=files.js.map
|
package/lib/browser/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SessionState, SessionStore } from '@celljs/ta-client';
|
|
2
2
|
import type { TaSettingsServer } from '@celljs/ta-protocol';
|
|
3
|
-
import type { WebTaskEntry } from './extension/web-extension-api';
|
|
3
|
+
import type { WebTaskEntry, WebTaskRemoval } from './extension/web-extension-api';
|
|
4
4
|
import { TaWebExtensions, type WebExtensionsState } from './extension/web-extension-protocol';
|
|
5
5
|
import { type LinksState, TaLinks } from './links/links-protocol';
|
|
6
6
|
import { type NoticesState, TaNotices } from './notices/notices-protocol';
|
|
@@ -19,6 +19,8 @@ export declare function useOpenLink(cwd: string | undefined): (target: LinkTarge
|
|
|
19
19
|
export declare function useWebExtensions(): [WebExtensionsState, TaWebExtensions];
|
|
20
20
|
/** The tasks of every web extension, the double's too: only a change of them draws again. */
|
|
21
21
|
export declare function useTasks(): readonly WebTaskEntry[];
|
|
22
|
+
/** Deletes tasks once the user agrees, asked once for all (WebTaskUtil.remove, `ui.removeTasks` of web extensions): whether they agreed. */
|
|
23
|
+
export declare function useRemoveTasks(): (tasks: readonly WebTaskRemoval[]) => Promise<boolean>;
|
|
22
24
|
/** A value of the page kept at its tier (TaState), and how to change it. `spec` should be one object for the value, not made again each render. */
|
|
23
25
|
export declare function usePersisted<T>(spec: StateSpec<T>): [T, (value: T | ((previous: T) => T)) => void];
|
|
24
26
|
/** The state of a session, drawn at most once a frame while a model streams. */
|
package/lib/browser/hooks.js
CHANGED
|
@@ -41,12 +41,15 @@ exports.useLinks = useLinks;
|
|
|
41
41
|
exports.useOpenLink = useOpenLink;
|
|
42
42
|
exports.useWebExtensions = useWebExtensions;
|
|
43
43
|
exports.useTasks = useTasks;
|
|
44
|
+
exports.useRemoveTasks = useRemoveTasks;
|
|
44
45
|
exports.usePersisted = usePersisted;
|
|
45
46
|
exports.useSessionState = useSessionState;
|
|
46
47
|
exports.useSettingsServer = useSettingsServer;
|
|
47
48
|
const react_1 = require("@celljs/react");
|
|
48
49
|
const React = __importStar(require("react"));
|
|
49
50
|
const web_extension_protocol_1 = require("./extension/web-extension-protocol");
|
|
51
|
+
const web_tasks_1 = require("./extension/web-tasks");
|
|
52
|
+
const use_t_1 = require("./i18n/use-t");
|
|
50
53
|
const links_protocol_1 = require("./links/links-protocol");
|
|
51
54
|
const notices_protocol_1 = require("./notices/notices-protocol");
|
|
52
55
|
const pwa_protocol_1 = require("./pwa/pwa-protocol");
|
|
@@ -94,6 +97,12 @@ function useTasks() {
|
|
|
94
97
|
const { tasks } = (0, react_1.useInject)(web_extension_protocol_1.TaWebExtensions);
|
|
95
98
|
return React.useSyncExternalStore(tasks.subscribe, tasks.tasks, tasks.tasks);
|
|
96
99
|
}
|
|
100
|
+
/** Deletes tasks once the user agrees, asked once for all (WebTaskUtil.remove, `ui.removeTasks` of web extensions): whether they agreed. */
|
|
101
|
+
function useRemoveTasks() {
|
|
102
|
+
const notices = (0, react_1.useInject)(notices_protocol_1.TaNotices);
|
|
103
|
+
const t = (0, use_t_1.useT)();
|
|
104
|
+
return React.useCallback(tasks => web_tasks_1.WebTaskUtil.remove(tasks, notices, t), [notices, t]);
|
|
105
|
+
}
|
|
97
106
|
/** A value of the page kept at its tier (TaState), and how to change it. `spec` should be one object for the value, not made again each render. */
|
|
98
107
|
function usePersisted(spec) {
|
|
99
108
|
const state = (0, react_1.useInject)(state_protocol_1.TaState);
|