@celljs/ta-web 4.42.0 → 4.44.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-window.js +2 -2
- package/esm/browser/apps/web-apps.d.ts +4 -0
- package/esm/browser/apps/web-apps.js +14 -3
- package/esm/browser/assistant/assistant-chat-list.js +2 -1
- package/esm/browser/assistant/assistant-extension.js +16 -2
- package/esm/browser/assistant/assistant-protocol.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-source.js +3 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-util.js +5 -0
- package/esm/browser/assistant/assistant.d.ts +3 -0
- package/esm/browser/assistant/assistant.js +26 -2
- package/esm/browser/assistant/ta-hearing.d.ts +85 -0
- package/esm/browser/assistant/ta-hearing.js +272 -0
- package/esm/browser/components/app-shell-hooks.d.ts +2 -1
- package/esm/browser/components/app-shell-hooks.js +4 -3
- package/esm/browser/components/app-shell-state.js +2 -2
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/board.js +9 -1
- package/esm/browser/components/chat-list-row.js +4 -4
- package/esm/browser/components/chat-list-util.d.ts +2 -2
- package/esm/browser/components/clipboard-link-host.d.ts +2 -0
- package/esm/browser/components/clipboard-link-host.js +27 -0
- package/esm/browser/components/cloud-network.js +1 -1
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-host.d.ts +4 -1
- package/esm/browser/components/custom-host.js +8 -2
- package/esm/browser/components/custom-provider-advanced.js +8 -8
- package/esm/browser/components/custom-provider-view.js +12 -12
- package/esm/browser/components/earlier-messages.d.ts +4 -1
- package/esm/browser/components/earlier-messages.js +5 -2
- package/esm/browser/components/empty-state.d.ts +2 -1
- package/esm/browser/components/empty-state.js +6 -2
- package/esm/browser/components/folder-picker.js +2 -2
- package/esm/browser/components/gallery.js +8 -9
- package/esm/browser/components/hearing-host.d.ts +5 -0
- package/esm/browser/components/hearing-host.js +58 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/link-dialog.js +4 -0
- package/esm/browser/components/loading.d.ts +3 -2
- package/esm/browser/components/loading.js +7 -3
- package/esm/browser/components/markdown.d.ts +3 -1
- package/esm/browser/components/markdown.js +10 -5
- package/esm/browser/components/media.d.ts +10 -4
- package/esm/browser/components/media.js +60 -14
- package/esm/browser/components/message-list.js +2 -1
- package/esm/browser/components/message-steps.js +8 -5
- package/esm/browser/components/people-picker.d.ts +17 -0
- package/esm/browser/components/people-picker.js +129 -0
- package/esm/browser/components/relay-view.js +1 -1
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +2 -1
- package/esm/browser/components/settings-parts.js +25 -3
- package/esm/browser/components/share-dialog.d.ts +2 -2
- package/esm/browser/components/share-dialog.js +7 -4
- package/esm/browser/components/share-friends.d.ts +18 -2
- package/esm/browser/components/share-friends.js +64 -13
- package/esm/browser/components/share-item-sheet.d.ts +12 -0
- package/esm/browser/components/share-item-sheet.js +39 -0
- package/esm/browser/components/share-sheet.d.ts +12 -4
- package/esm/browser/components/share-sheet.js +15 -6
- package/esm/browser/components/sign-in-setup.js +4 -4
- package/esm/browser/components/trusted-domains.js +1 -1
- package/esm/browser/components/view-room.d.ts +25 -0
- package/esm/browser/components/view-room.js +136 -0
- package/esm/browser/components/voice-services.js +6 -6
- package/esm/browser/device/device-protocol.d.ts +9 -6
- package/esm/browser/device/device-protocol.js +7 -4
- package/esm/browser/device/launch-screen.d.ts +11 -1
- package/esm/browser/device/launch-screen.js +22 -4
- package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
- package/esm/browser/extension/share-sheet-compat.js +12 -2
- package/esm/browser/extension/web-api-chats.d.ts +23 -0
- package/esm/browser/extension/web-api-code.d.ts +11 -0
- package/esm/browser/extension/web-api-components.d.ts +8 -1
- package/esm/browser/extension/web-api-contributions.d.ts +30 -1
- package/esm/browser/extension/web-api-desktop.d.ts +2 -1
- package/esm/browser/extension/web-api-file-views.d.ts +38 -0
- package/esm/browser/extension/web-api-file-views.js +2 -0
- package/esm/browser/extension/web-api-host.d.ts +47 -0
- package/esm/browser/extension/web-api-host.js +3 -0
- package/esm/browser/extension/web-api-menus.d.ts +46 -0
- package/esm/browser/extension/web-api-partners.d.ts +58 -1
- package/esm/browser/extension/web-api-skins.d.ts +95 -0
- package/esm/browser/extension/web-api-skins.js +2 -0
- package/esm/browser/extension/web-api-spec.js +9 -0
- package/esm/browser/extension/web-extension-api.d.ts +13 -34
- package/esm/browser/extension/web-extension-context.d.ts +2 -8
- package/esm/browser/extension/web-extension-context.js +15 -39
- package/esm/browser/extension/web-extension-marks.d.ts +10 -0
- package/esm/browser/extension/web-extension-marks.js +29 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +13 -1
- package/esm/browser/extension/web-extension-protocol.js +4 -0
- package/esm/browser/extension/web-extension-run.d.ts +16 -2
- package/esm/browser/extension/web-extension-run.js +80 -0
- package/esm/browser/extension/web-extensions-running.d.ts +5 -1
- package/esm/browser/extension/web-extensions-running.js +16 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -1
- package/esm/browser/extension/web-extensions.js +3 -0
- package/esm/browser/extension/web-home.js +3 -1
- package/esm/browser/extension/web-host-values.d.ts +66 -0
- package/esm/browser/extension/web-host-values.js +191 -0
- package/esm/browser/extension/web-hosts.d.ts +7 -2
- package/esm/browser/extension/web-hosts.js +16 -4
- package/esm/browser/extension/web-share-ui.d.ts +7 -0
- package/esm/browser/extension/web-share-ui.js +20 -0
- package/esm/browser/extension/web-share.d.ts +18 -0
- package/esm/browser/extension/web-share.js +42 -0
- package/esm/browser/i18n/en/assistant.d.ts +4 -0
- package/esm/browser/i18n/en/assistant.js +4 -0
- package/esm/browser/i18n/en/chat.d.ts +10 -0
- package/esm/browser/i18n/en/chat.js +10 -0
- package/esm/browser/i18n/en/common.d.ts +15 -0
- package/esm/browser/i18n/en/common.js +15 -0
- package/esm/browser/i18n/en/discover.d.ts +11 -1
- package/esm/browser/i18n/en/discover.js +11 -1
- package/esm/browser/i18n/en/settings.d.ts +10 -0
- package/esm/browser/i18n/en/settings.js +10 -0
- package/esm/browser/i18n/ja/assistant.js +4 -0
- package/esm/browser/i18n/ja/chat.js +10 -0
- package/esm/browser/i18n/ja/common.js +15 -0
- package/esm/browser/i18n/ja/discover.js +11 -1
- package/esm/browser/i18n/ja/settings.js +10 -0
- package/esm/browser/i18n/locales.d.ts +51 -2
- package/esm/browser/i18n/messages.d.ts +50 -1
- package/esm/browser/i18n/zh/assistant.js +4 -0
- package/esm/browser/i18n/zh/chat.js +10 -0
- package/esm/browser/i18n/zh/common.js +15 -0
- package/esm/browser/i18n/zh/discover.js +11 -1
- package/esm/browser/i18n/zh/settings.js +10 -0
- package/esm/browser/i18n/zh-tw/assistant.js +4 -0
- package/esm/browser/i18n/zh-tw/chat.js +10 -0
- package/esm/browser/i18n/zh-tw/common.js +15 -0
- package/esm/browser/i18n/zh-tw/discover.js +11 -1
- package/esm/browser/i18n/zh-tw/settings.js +10 -0
- package/esm/browser/launch-art/art-palette.d.ts +41 -0
- package/esm/browser/launch-art/art-palette.js +72 -0
- package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
- package/esm/browser/launch-art/cyclic-automaton.js +176 -0
- package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
- package/esm/browser/launch-art/fractal-tree.js +48 -0
- package/esm/browser/launch-art/launch-art.d.ts +98 -0
- package/esm/browser/launch-art/launch-art.js +420 -0
- package/esm/browser/launch-art/launch-sky.d.ts +66 -0
- package/esm/browser/launch-art/launch-sky.js +153 -0
- package/esm/browser/links/clipboard-links.d.ts +85 -0
- package/esm/browser/links/clipboard-links.js +261 -0
- package/esm/browser/links/link-text.d.ts +29 -0
- package/esm/browser/links/link-text.js +97 -0
- package/esm/browser/links/links-protocol.d.ts +12 -1
- package/esm/browser/links/links.d.ts +8 -2
- package/esm/browser/links/links.js +33 -3
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/partners/group-picker.js +23 -29
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-senses.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +26 -0
- package/esm/browser/settings/settings-protocol.js +11 -0
- package/esm/browser/settings/settings.d.ts +4 -1
- package/esm/browser/settings/settings.js +16 -3
- package/esm/browser/skin/skin-layer.d.ts +8 -0
- package/esm/browser/skin/skin-layer.js +118 -0
- package/esm/browser/skin/skin-util.d.ts +40 -0
- package/esm/browser/skin/skin-util.js +120 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +10 -6
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +28 -15
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +5 -4
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +2 -5
- package/esm/browser/style/forms.d.ts +5 -0
- package/esm/browser/style/forms.js +65 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +14 -24
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -6
- package/esm/browser/style/skins.d.ts +9 -0
- package/esm/browser/style/skins.js +107 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +8 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style.js +4 -0
- package/esm/browser/util/fresh-rows.d.ts +21 -0
- package/esm/browser/util/fresh-rows.js +36 -0
- package/esm/browser/util/process.d.ts +12 -22
- package/esm/browser/util/process.js +49 -39
- package/esm/browser/util/voice.d.ts +18 -0
- package/esm/browser/util/voice.js +111 -3
- package/esm/browser/workbench-protocol.d.ts +2 -0
- package/esm/browser/workbench-services.d.ts +2 -0
- package/esm/browser/workbench-services.js +5 -0
- package/esm/browser/workbench.js +5 -0
- package/lib/browser/apps/app-window.js +2 -2
- package/lib/browser/apps/web-apps.d.ts +4 -0
- package/lib/browser/apps/web-apps.js +14 -3
- package/lib/browser/assistant/assistant-chat-list.js +2 -1
- package/lib/browser/assistant/assistant-extension.js +15 -1
- package/lib/browser/assistant/assistant-protocol.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-source.js +3 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-util.js +5 -0
- package/lib/browser/assistant/assistant.d.ts +3 -0
- package/lib/browser/assistant/assistant.js +26 -2
- package/lib/browser/assistant/ta-hearing.d.ts +86 -0
- package/lib/browser/assistant/ta-hearing.js +277 -0
- package/lib/browser/components/app-shell-hooks.d.ts +2 -1
- package/lib/browser/components/app-shell-hooks.js +4 -3
- package/lib/browser/components/app-shell-state.js +2 -2
- package/lib/browser/components/auth-view.js +1 -1
- package/lib/browser/components/board.js +9 -1
- package/lib/browser/components/chat-list-row.js +4 -4
- package/lib/browser/components/chat-list-util.d.ts +2 -2
- package/lib/browser/components/clipboard-link-host.d.ts +3 -0
- package/lib/browser/components/clipboard-link-host.js +63 -0
- package/lib/browser/components/cloud-network.js +1 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-host.d.ts +4 -1
- package/lib/browser/components/custom-host.js +8 -2
- package/lib/browser/components/custom-provider-advanced.js +8 -8
- package/lib/browser/components/custom-provider-view.js +12 -12
- package/lib/browser/components/earlier-messages.d.ts +4 -1
- package/lib/browser/components/earlier-messages.js +5 -2
- package/lib/browser/components/empty-state.d.ts +2 -1
- package/lib/browser/components/empty-state.js +6 -2
- package/lib/browser/components/folder-picker.js +2 -2
- package/lib/browser/components/gallery.js +7 -8
- package/lib/browser/components/hearing-host.d.ts +6 -0
- package/lib/browser/components/hearing-host.js +94 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/link-dialog.js +4 -0
- package/lib/browser/components/loading.d.ts +3 -2
- package/lib/browser/components/loading.js +7 -3
- package/lib/browser/components/markdown.d.ts +3 -1
- package/lib/browser/components/markdown.js +9 -4
- package/lib/browser/components/media.d.ts +10 -4
- package/lib/browser/components/media.js +61 -14
- package/lib/browser/components/message-list.js +2 -1
- package/lib/browser/components/message-steps.js +8 -5
- package/lib/browser/components/people-picker.d.ts +18 -0
- package/lib/browser/components/people-picker.js +166 -0
- package/lib/browser/components/relay-view.js +1 -1
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +2 -1
- package/lib/browser/components/settings-parts.js +23 -1
- package/lib/browser/components/share-dialog.d.ts +2 -2
- package/lib/browser/components/share-dialog.js +7 -4
- package/lib/browser/components/share-friends.d.ts +18 -2
- package/lib/browser/components/share-friends.js +67 -13
- package/lib/browser/components/share-item-sheet.d.ts +13 -0
- package/lib/browser/components/share-item-sheet.js +75 -0
- package/lib/browser/components/share-sheet.d.ts +12 -4
- package/lib/browser/components/share-sheet.js +14 -4
- package/lib/browser/components/sign-in-setup.js +4 -4
- package/lib/browser/components/trusted-domains.js +1 -1
- package/lib/browser/components/view-room.d.ts +26 -0
- package/lib/browser/components/view-room.js +173 -0
- package/lib/browser/components/voice-services.js +6 -6
- package/lib/browser/device/device-protocol.d.ts +9 -6
- package/lib/browser/device/device-protocol.js +7 -4
- package/lib/browser/device/launch-screen.d.ts +11 -1
- package/lib/browser/device/launch-screen.js +22 -4
- package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
- package/lib/browser/extension/share-sheet-compat.js +13 -2
- package/lib/browser/extension/web-api-chats.d.ts +23 -0
- package/lib/browser/extension/web-api-code.d.ts +11 -0
- package/lib/browser/extension/web-api-components.d.ts +8 -1
- package/lib/browser/extension/web-api-contributions.d.ts +30 -1
- package/lib/browser/extension/web-api-desktop.d.ts +2 -1
- package/lib/browser/extension/web-api-file-views.d.ts +39 -0
- package/lib/browser/extension/web-api-file-views.js +3 -0
- package/lib/browser/extension/web-api-host.d.ts +48 -0
- package/lib/browser/extension/web-api-host.js +4 -0
- package/lib/browser/extension/web-api-menus.d.ts +46 -0
- package/lib/browser/extension/web-api-partners.d.ts +58 -1
- package/lib/browser/extension/web-api-skins.d.ts +96 -0
- package/lib/browser/extension/web-api-skins.js +3 -0
- package/lib/browser/extension/web-api-spec.js +9 -0
- package/lib/browser/extension/web-extension-api.d.ts +13 -34
- package/lib/browser/extension/web-extension-context.d.ts +2 -8
- package/lib/browser/extension/web-extension-context.js +15 -39
- package/lib/browser/extension/web-extension-marks.d.ts +11 -0
- package/lib/browser/extension/web-extension-marks.js +65 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +13 -1
- package/lib/browser/extension/web-extension-protocol.js +4 -0
- package/lib/browser/extension/web-extension-run.d.ts +16 -2
- package/lib/browser/extension/web-extension-run.js +80 -0
- package/lib/browser/extension/web-extensions-running.d.ts +5 -1
- package/lib/browser/extension/web-extensions-running.js +16 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -1
- package/lib/browser/extension/web-extensions.js +3 -0
- package/lib/browser/extension/web-home.js +3 -1
- package/lib/browser/extension/web-host-values.d.ts +67 -0
- package/lib/browser/extension/web-host-values.js +229 -0
- package/lib/browser/extension/web-hosts.d.ts +7 -2
- package/lib/browser/extension/web-hosts.js +16 -4
- package/lib/browser/extension/web-share-ui.d.ts +8 -0
- package/lib/browser/extension/web-share-ui.js +56 -0
- package/lib/browser/extension/web-share.d.ts +19 -0
- package/lib/browser/extension/web-share.js +45 -0
- package/lib/browser/i18n/en/assistant.d.ts +4 -0
- package/lib/browser/i18n/en/assistant.js +4 -0
- package/lib/browser/i18n/en/chat.d.ts +10 -0
- package/lib/browser/i18n/en/chat.js +10 -0
- package/lib/browser/i18n/en/common.d.ts +15 -0
- package/lib/browser/i18n/en/common.js +15 -0
- package/lib/browser/i18n/en/discover.d.ts +11 -1
- package/lib/browser/i18n/en/discover.js +11 -1
- package/lib/browser/i18n/en/settings.d.ts +10 -0
- package/lib/browser/i18n/en/settings.js +10 -0
- package/lib/browser/i18n/ja/assistant.js +4 -0
- package/lib/browser/i18n/ja/chat.js +10 -0
- package/lib/browser/i18n/ja/common.js +15 -0
- package/lib/browser/i18n/ja/discover.js +11 -1
- package/lib/browser/i18n/ja/settings.js +10 -0
- package/lib/browser/i18n/locales.d.ts +51 -2
- package/lib/browser/i18n/messages.d.ts +50 -1
- package/lib/browser/i18n/zh/assistant.js +4 -0
- package/lib/browser/i18n/zh/chat.js +10 -0
- package/lib/browser/i18n/zh/common.js +15 -0
- package/lib/browser/i18n/zh/discover.js +11 -1
- package/lib/browser/i18n/zh/settings.js +10 -0
- package/lib/browser/i18n/zh-tw/assistant.js +4 -0
- package/lib/browser/i18n/zh-tw/chat.js +10 -0
- package/lib/browser/i18n/zh-tw/common.js +15 -0
- package/lib/browser/i18n/zh-tw/discover.js +11 -1
- package/lib/browser/i18n/zh-tw/settings.js +10 -0
- package/lib/browser/launch-art/art-palette.d.ts +42 -0
- package/lib/browser/launch-art/art-palette.js +76 -0
- package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
- package/lib/browser/launch-art/cyclic-automaton.js +180 -0
- package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
- package/lib/browser/launch-art/fractal-tree.js +52 -0
- package/lib/browser/launch-art/launch-art.d.ts +99 -0
- package/lib/browser/launch-art/launch-art.js +424 -0
- package/lib/browser/launch-art/launch-sky.d.ts +67 -0
- package/lib/browser/launch-art/launch-sky.js +157 -0
- package/lib/browser/links/clipboard-links.d.ts +86 -0
- package/lib/browser/links/clipboard-links.js +266 -0
- package/lib/browser/links/link-text.d.ts +30 -0
- package/lib/browser/links/link-text.js +100 -0
- package/lib/browser/links/links-protocol.d.ts +12 -1
- package/lib/browser/links/links.d.ts +8 -2
- package/lib/browser/links/links.js +33 -3
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/partners/group-picker.js +23 -29
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-senses.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +26 -0
- package/lib/browser/settings/settings-protocol.js +12 -1
- package/lib/browser/settings/settings.d.ts +4 -1
- package/lib/browser/settings/settings.js +16 -3
- package/lib/browser/skin/skin-layer.d.ts +9 -0
- package/lib/browser/skin/skin-layer.js +154 -0
- package/lib/browser/skin/skin-util.d.ts +41 -0
- package/lib/browser/skin/skin-util.js +123 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +10 -6
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +28 -15
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +5 -4
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +2 -5
- package/lib/browser/style/forms.d.ts +6 -0
- package/lib/browser/style/forms.js +68 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +14 -24
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -6
- package/lib/browser/style/skins.d.ts +10 -0
- package/lib/browser/style/skins.js +110 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +8 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style.js +4 -0
- package/lib/browser/util/fresh-rows.d.ts +22 -0
- package/lib/browser/util/fresh-rows.js +40 -0
- package/lib/browser/util/process.d.ts +12 -22
- package/lib/browser/util/process.js +49 -40
- package/lib/browser/util/voice.d.ts +18 -0
- package/lib/browser/util/voice.js +111 -3
- package/lib/browser/workbench-protocol.d.ts +2 -0
- package/lib/browser/workbench-services.d.ts +2 -0
- package/lib/browser/workbench-services.js +5 -0
- package/lib/browser/workbench.js +5 -0
- package/package.json +8 -8
- package/public/launch.svg +3 -3
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LaunchSky = void 0;
|
|
4
|
+
const cyclic_automaton_1 = require("./cyclic-automaton");
|
|
5
|
+
/**
|
|
6
|
+
* The sky of the launch picture, without the page: a cyclic automaton over the sky of `public/launch.svg` (360 by 640,
|
|
7
|
+
* the planet's rim at y 400), the clock of the eras its colours go through, and the strokes painted along its wave fronts.
|
|
8
|
+
* It goes on from where the last launch left it (`kept`): each launch moves the clock on by PER_LAUNCH and the
|
|
9
|
+
* automaton by FIRST_STEPS, so no two launches open on the same sky.
|
|
10
|
+
*/
|
|
11
|
+
class LaunchSky {
|
|
12
|
+
constructor(kept, random = Math.random) {
|
|
13
|
+
this.random = random;
|
|
14
|
+
/** Each stroke: where it is (x, y), where it was a frame ago (px, py), how long it has left, its pick (0 to 1) and tone (0, 1 or 2). */
|
|
15
|
+
this.x = new Float32Array(LaunchSky.STROKES);
|
|
16
|
+
this.y = new Float32Array(LaunchSky.STROKES);
|
|
17
|
+
this.px = new Float32Array(LaunchSky.STROKES);
|
|
18
|
+
this.py = new Float32Array(LaunchSky.STROKES);
|
|
19
|
+
this.life = new Float32Array(LaunchSky.STROKES);
|
|
20
|
+
this.pick = new Float32Array(LaunchSky.STROKES);
|
|
21
|
+
this.tone = new Uint8Array(LaunchSky.STROKES);
|
|
22
|
+
this.waiting = 0;
|
|
23
|
+
const { COLS, ROWS, STATES } = LaunchSky;
|
|
24
|
+
const automaton = kept && cyclic_automaton_1.CyclicAutomaton.decode(COLS, ROWS, kept.cells, STATES);
|
|
25
|
+
if (automaton && kept) {
|
|
26
|
+
this.automaton = automaton;
|
|
27
|
+
this.clock = kept.clock + LaunchSky.PER_LAUNCH;
|
|
28
|
+
this.launches = kept.launches + 1;
|
|
29
|
+
this.automaton.plant(random() * COLS, random() * ROWS * 0.8, 5, random() < 0.5 ? -1 : 1);
|
|
30
|
+
for (let step = 0; step < LaunchSky.FIRST_STEPS; step++) {
|
|
31
|
+
if (this.automaton.step() === 0) {
|
|
32
|
+
this.automaton = LaunchSky.seed(random);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.automaton = LaunchSky.seed(random);
|
|
39
|
+
this.clock = random() * 200;
|
|
40
|
+
this.launches = 1;
|
|
41
|
+
}
|
|
42
|
+
for (let index = 0; index < LaunchSky.STROKES; index++) {
|
|
43
|
+
this.spawn(index);
|
|
44
|
+
this.life[index] *= random();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static seed(random) {
|
|
48
|
+
return cyclic_automaton_1.CyclicAutomaton.spirals(LaunchSky.COLS, LaunchSky.ROWS, 5 + Math.floor(random() * 3), random, LaunchSky.STATES);
|
|
49
|
+
}
|
|
50
|
+
/** The height of the planet's rim at `x`. */
|
|
51
|
+
static rim(x) {
|
|
52
|
+
const { PLANET } = LaunchSky;
|
|
53
|
+
const dx = Math.min(PLANET.r, Math.abs(x - PLANET.x));
|
|
54
|
+
return PLANET.y - Math.sqrt(PLANET.r * PLANET.r - dx * dx);
|
|
55
|
+
}
|
|
56
|
+
static parse(text) {
|
|
57
|
+
try {
|
|
58
|
+
const kept = JSON.parse(text !== null && text !== void 0 ? text : 'null');
|
|
59
|
+
return typeof (kept === null || kept === void 0 ? void 0 : kept.cells) === 'string' && Number.isFinite(kept.clock) && Number.isInteger(kept.launches) ? kept : undefined;
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
kept() {
|
|
66
|
+
return { cells: this.automaton.encode(), clock: this.clock, launches: this.launches };
|
|
67
|
+
}
|
|
68
|
+
/** `seconds` on: the clock, and the automaton a step every STEP (at most two a frame; a frozen sky is sown again). */
|
|
69
|
+
advance(seconds) {
|
|
70
|
+
this.clock += seconds;
|
|
71
|
+
this.waiting += seconds;
|
|
72
|
+
for (let steps = 0; this.waiting >= LaunchSky.STEP && steps < 2; steps++) {
|
|
73
|
+
this.waiting -= LaunchSky.STEP;
|
|
74
|
+
if (this.automaton.step() === 0) {
|
|
75
|
+
const fresh = LaunchSky.seed(this.random);
|
|
76
|
+
this.automaton.cells.set(fresh.cells);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
this.waiting = Math.min(this.waiting, LaunchSky.STEP);
|
|
80
|
+
}
|
|
81
|
+
/** A new whirl where a finger touched the sky, `x`, `y` in the units of the picture; whether it was the sky. */
|
|
82
|
+
plant(x, y) {
|
|
83
|
+
if (x < 0 || x > 360 || y < 0 || y > LaunchSky.rim(x)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
this.automaton.plant(x / LaunchSky.CELL, y / LaunchSky.CELL, 6, this.random() < 0.5 ? -1 : 1);
|
|
87
|
+
for (let index = 0; index < LaunchSky.STROKES; index += 8) {
|
|
88
|
+
this.x[index] = this.px[index] = x + (this.random() - 0.5) * 40;
|
|
89
|
+
this.y[index] = this.py[index] = Math.min(LaunchSky.rim(x) - 2, y + (this.random() - 0.5) * 40);
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
/** Every stroke `seconds` on along the fronts at the pace of `brush`, pushed by `stir` near it; those gone are laid anew. */
|
|
94
|
+
move(seconds, brush, stir) {
|
|
95
|
+
const { CELL } = LaunchSky;
|
|
96
|
+
const speed = 26 * brush.speed;
|
|
97
|
+
for (let index = 0; index < LaunchSky.STROKES; index++) {
|
|
98
|
+
const x = this.x[index];
|
|
99
|
+
const y = this.y[index];
|
|
100
|
+
let [fx, fy] = this.automaton.flow(x / CELL, y / CELL);
|
|
101
|
+
const strength = Math.hypot(fx, fy);
|
|
102
|
+
if (strength < 0.3) {
|
|
103
|
+
// Where the phases lie flat, a stroke runs on as it ran.
|
|
104
|
+
const dx = x - this.px[index];
|
|
105
|
+
const dy = y - this.py[index];
|
|
106
|
+
const ran = Math.hypot(dx, dy) || 1;
|
|
107
|
+
fx = fx + (dx / ran) * (1 - strength);
|
|
108
|
+
fy = fy + (dy / ran) * (1 - strength);
|
|
109
|
+
}
|
|
110
|
+
let vx = fx * speed;
|
|
111
|
+
let vy = fy * speed;
|
|
112
|
+
if (stir) {
|
|
113
|
+
const near = Math.exp(-((x - stir.x) ** 2 + (y - stir.y) ** 2) / 1800);
|
|
114
|
+
vx += stir.vx * near;
|
|
115
|
+
vy += stir.vy * near;
|
|
116
|
+
}
|
|
117
|
+
this.px[index] = x;
|
|
118
|
+
this.py[index] = y;
|
|
119
|
+
this.x[index] = x + vx * seconds;
|
|
120
|
+
this.y[index] = y + vy * seconds;
|
|
121
|
+
this.life[index] -= seconds;
|
|
122
|
+
if (this.life[index] <= 0 || this.x[index] < -4 || this.x[index] > 364 || this.y[index] < -4 || this.y[index] > LaunchSky.rim(this.x[index])) {
|
|
123
|
+
this.spawn(index);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** The phase of the automaton under a stroke. */
|
|
128
|
+
phase(index) {
|
|
129
|
+
return this.automaton.phase(this.x[index] / LaunchSky.CELL, this.y[index] / LaunchSky.CELL);
|
|
130
|
+
}
|
|
131
|
+
spawn(index) {
|
|
132
|
+
const x = this.random() * 360;
|
|
133
|
+
const y = this.random() * (LaunchSky.rim(x) - 3);
|
|
134
|
+
const heading = this.random() * Math.PI * 2;
|
|
135
|
+
this.x[index] = x;
|
|
136
|
+
this.y[index] = y;
|
|
137
|
+
// A frame back along a heading of its own: a stroke laid where the phases lie flat runs on that way.
|
|
138
|
+
this.px[index] = x - Math.cos(heading) * 0.01;
|
|
139
|
+
this.py[index] = y - Math.sin(heading) * 0.01;
|
|
140
|
+
this.life[index] = 1.2 + this.random() * 1.8;
|
|
141
|
+
this.pick[index] = this.random();
|
|
142
|
+
this.tone[index] = Math.floor(this.random() * 3);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.LaunchSky = LaunchSky;
|
|
146
|
+
LaunchSky.COLS = 48;
|
|
147
|
+
LaunchSky.ROWS = 55;
|
|
148
|
+
LaunchSky.STATES = 8;
|
|
149
|
+
/** The side of a cell, in the units of the picture. */
|
|
150
|
+
LaunchSky.CELL = 7.5;
|
|
151
|
+
/** Seconds between two steps of the automaton. */
|
|
152
|
+
LaunchSky.STEP = 0.12;
|
|
153
|
+
LaunchSky.PER_LAUNCH = 8;
|
|
154
|
+
LaunchSky.FIRST_STEPS = 24;
|
|
155
|
+
LaunchSky.STROKES = 900;
|
|
156
|
+
LaunchSky.PLANET = { x: 180, y: 1040, r: 640 };
|
|
157
|
+
//# sourceMappingURL=launch-sky.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { MessageId } from '../i18n/messages';
|
|
2
|
+
import type { TaNotices } from '../notices/notices-protocol';
|
|
3
|
+
import { type FoundLink } from './link-text';
|
|
4
|
+
/** What ClipboardLinks uses of the page. */
|
|
5
|
+
export interface ClipboardLinksHost {
|
|
6
|
+
/** The links of Ta in a text (TaLinks.find). */
|
|
7
|
+
find(text: string): FoundLink[];
|
|
8
|
+
/** Opens a link of Ta, as a box for a link does (TaLinks.open with `onlyTa`). */
|
|
9
|
+
open(url: string): void;
|
|
10
|
+
/** Hears the links opened, wherever from (TaLinks.onOpen). */
|
|
11
|
+
onOpen(listener: (url: string) => void): () => void;
|
|
12
|
+
notices: TaNotices;
|
|
13
|
+
say(id: MessageId, values?: Record<string, string | number>): string;
|
|
14
|
+
/** The setting `clipboardLinks`. */
|
|
15
|
+
enabled(): boolean;
|
|
16
|
+
}
|
|
17
|
+
type From = 'clipboard' | 'paste';
|
|
18
|
+
/**
|
|
19
|
+
* The links of Ta offered once (docs/design/ta-links.md 7): kept by a hash of each, never the link, whose fragment holds
|
|
20
|
+
* its key; the newest {@link SeenLinks.MAX}, in the storage of the device.
|
|
21
|
+
*/
|
|
22
|
+
export declare class SeenLinks {
|
|
23
|
+
protected readonly storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined;
|
|
24
|
+
static readonly KEY = "ta-links-seen";
|
|
25
|
+
static readonly MAX = 200;
|
|
26
|
+
protected readonly hashes: string[];
|
|
27
|
+
protected readonly set: Set<string>;
|
|
28
|
+
constructor(storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined);
|
|
29
|
+
has(url: string): boolean;
|
|
30
|
+
add(urls: readonly string[]): void;
|
|
31
|
+
/** FNV-1a of 32 bits: no link can be read back from it. */
|
|
32
|
+
static hash(text: string): string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Links of Ta the user copied, offered where they are rather than pasted into a box (docs/design/ta-links.md 7): when Ta
|
|
36
|
+
* comes back to the front, and in whatever the user pastes into Ta, a link of Ta not offered before shows as a notice
|
|
37
|
+
* with what it is and Open, which opens it as every link of Ta opens (asking first wherever it would do something).
|
|
38
|
+
*
|
|
39
|
+
* Cheap and quiet: nothing runs on a timer; the clipboard is read when the page comes to the front, at most once a
|
|
40
|
+
* second, and only where it may be read without asking the user (Ta Desktop; a browser that was allowed; the Ta app of
|
|
41
|
+
* Android, when it changed). The Ta app of iOS looks at nothing as Ta comes back: iOS tells without asking only that some
|
|
42
|
+
* web link is there, any link copied on the phone or on a Mac near it, so it offers a link of Ta when pasted, as a
|
|
43
|
+
* browser does. A text read is looked through once (LinkText); what the user copied in Ta itself is never offered back.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ClipboardLinks {
|
|
46
|
+
protected readonly host: ClipboardLinksHost;
|
|
47
|
+
protected readonly seen: SeenLinks;
|
|
48
|
+
static readonly THROTTLE_MS = 1000;
|
|
49
|
+
/** A link pasted into a box for links opens there: offered only when the box did not open it by then. */
|
|
50
|
+
static readonly PASTE_WAIT_MS = 600;
|
|
51
|
+
static readonly KEY = "ta-clipboard-links";
|
|
52
|
+
/** Buttons of a notice, side by side. */
|
|
53
|
+
static readonly MAX_ACTIONS = 3;
|
|
54
|
+
protected ready: boolean;
|
|
55
|
+
protected lastCheck: number;
|
|
56
|
+
protected lastText: string;
|
|
57
|
+
protected readable: boolean;
|
|
58
|
+
protected readonly opened: Set<string>;
|
|
59
|
+
constructor(host: ClipboardLinksHost, seen?: SeenLinks);
|
|
60
|
+
/** Listens; the function it gives stops. */
|
|
61
|
+
start(scope?: Window & typeof globalThis): () => void;
|
|
62
|
+
/** The extensions loaded, whose openers tell links of Ta apart: the clipboard is looked at now, then as Ta comes back. */
|
|
63
|
+
loaded(scope?: Window & typeof globalThis): void;
|
|
64
|
+
/** Ta came to the front: what was copied meanwhile, where it may be read without asking. */
|
|
65
|
+
check(scope?: Window & typeof globalThis): void;
|
|
66
|
+
/** A text of the clipboard or pasted: its links of Ta not offered before, offered now. */
|
|
67
|
+
take(text: string, from: From): void;
|
|
68
|
+
protected fresh(text: string): FoundLink[];
|
|
69
|
+
/** Pasted into any box of Ta: offered, unless the box opened it (a box for links). */
|
|
70
|
+
protected pasted(text: string): void;
|
|
71
|
+
/** Copied in Ta: never offered back, and the app of Android counts the clipboard as seen. */
|
|
72
|
+
protected mine(text: string, scope: Window & typeof globalThis): void;
|
|
73
|
+
/** One notice: the words the link came with and what it is, and Open; for several, a button each. */
|
|
74
|
+
protected offer(found: readonly FoundLink[], from: From): void;
|
|
75
|
+
/** A button of several: its kind, or its words where two are of one kind. */
|
|
76
|
+
static label(link: FoundLink, index: number, all: readonly FoundLink[]): string;
|
|
77
|
+
/** Whether the page may read the clipboard without asking: as the permission says, which Ta Desktop grants. */
|
|
78
|
+
protected watchPermission(scope: Window & typeof globalThis): Promise<void>;
|
|
79
|
+
/** Copies of the page (Copy buttons) are its own: what they copy is never offered back. */
|
|
80
|
+
protected wrapWrite(scope: Window & typeof globalThis): () => void;
|
|
81
|
+
/** What a copy or a cut takes: the selection of a box, or of the page. */
|
|
82
|
+
static selected(scope: Window & typeof globalThis, target: EventTarget | null): string;
|
|
83
|
+
static storage(): Storage | undefined;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=clipboard-links.d.ts.map
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClipboardLinks = exports.SeenLinks = void 0;
|
|
4
|
+
const link_text_1 = require("./link-text");
|
|
5
|
+
/**
|
|
6
|
+
* The links of Ta offered once (docs/design/ta-links.md 7): kept by a hash of each, never the link, whose fragment holds
|
|
7
|
+
* its key; the newest {@link SeenLinks.MAX}, in the storage of the device.
|
|
8
|
+
*/
|
|
9
|
+
class SeenLinks {
|
|
10
|
+
constructor(storage) {
|
|
11
|
+
var _a;
|
|
12
|
+
this.storage = storage;
|
|
13
|
+
let kept;
|
|
14
|
+
try {
|
|
15
|
+
kept = JSON.parse((_a = storage === null || storage === void 0 ? void 0 : storage.getItem(SeenLinks.KEY)) !== null && _a !== void 0 ? _a : '[]');
|
|
16
|
+
}
|
|
17
|
+
catch (_b) {
|
|
18
|
+
kept = [];
|
|
19
|
+
}
|
|
20
|
+
this.hashes = Array.isArray(kept) ? kept.filter((one) => typeof one === 'string').slice(-SeenLinks.MAX) : [];
|
|
21
|
+
this.set = new Set(this.hashes);
|
|
22
|
+
}
|
|
23
|
+
has(url) {
|
|
24
|
+
return this.set.has(SeenLinks.hash(url));
|
|
25
|
+
}
|
|
26
|
+
add(urls) {
|
|
27
|
+
var _a;
|
|
28
|
+
let changed = false;
|
|
29
|
+
for (const url of urls) {
|
|
30
|
+
const hash = SeenLinks.hash(url);
|
|
31
|
+
if (!this.set.has(hash)) {
|
|
32
|
+
this.set.add(hash);
|
|
33
|
+
this.hashes.push(hash);
|
|
34
|
+
changed = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!changed) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
for (const old of this.hashes.splice(0, Math.max(0, this.hashes.length - SeenLinks.MAX))) {
|
|
41
|
+
this.set.delete(old);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
(_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(SeenLinks.KEY, JSON.stringify(this.hashes));
|
|
45
|
+
}
|
|
46
|
+
catch (_b) {
|
|
47
|
+
// A storage that is full or closed: offered again after a reload, no more.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** FNV-1a of 32 bits: no link can be read back from it. */
|
|
51
|
+
static hash(text) {
|
|
52
|
+
let hash = 0x811c9dc5;
|
|
53
|
+
for (let i = 0; i < text.length; i++) {
|
|
54
|
+
hash ^= text.charCodeAt(i);
|
|
55
|
+
hash = Math.imul(hash, 0x01000193);
|
|
56
|
+
}
|
|
57
|
+
return (hash >>> 0).toString(36);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.SeenLinks = SeenLinks;
|
|
61
|
+
SeenLinks.KEY = 'ta-links-seen';
|
|
62
|
+
SeenLinks.MAX = 200;
|
|
63
|
+
/**
|
|
64
|
+
* Links of Ta the user copied, offered where they are rather than pasted into a box (docs/design/ta-links.md 7): when Ta
|
|
65
|
+
* comes back to the front, and in whatever the user pastes into Ta, a link of Ta not offered before shows as a notice
|
|
66
|
+
* with what it is and Open, which opens it as every link of Ta opens (asking first wherever it would do something).
|
|
67
|
+
*
|
|
68
|
+
* Cheap and quiet: nothing runs on a timer; the clipboard is read when the page comes to the front, at most once a
|
|
69
|
+
* second, and only where it may be read without asking the user (Ta Desktop; a browser that was allowed; the Ta app of
|
|
70
|
+
* Android, when it changed). The Ta app of iOS looks at nothing as Ta comes back: iOS tells without asking only that some
|
|
71
|
+
* web link is there, any link copied on the phone or on a Mac near it, so it offers a link of Ta when pasted, as a
|
|
72
|
+
* browser does. A text read is looked through once (LinkText); what the user copied in Ta itself is never offered back.
|
|
73
|
+
*/
|
|
74
|
+
class ClipboardLinks {
|
|
75
|
+
constructor(host, seen = new SeenLinks(ClipboardLinks.storage())) {
|
|
76
|
+
this.host = host;
|
|
77
|
+
this.seen = seen;
|
|
78
|
+
this.ready = false;
|
|
79
|
+
this.lastCheck = 0;
|
|
80
|
+
this.lastText = '';
|
|
81
|
+
this.readable = false;
|
|
82
|
+
this.opened = new Set();
|
|
83
|
+
}
|
|
84
|
+
/** Listens; the function it gives stops. */
|
|
85
|
+
start(scope = window) {
|
|
86
|
+
const doc = scope.document;
|
|
87
|
+
const check = () => this.check(scope);
|
|
88
|
+
const visible = () => doc.visibilityState === 'visible' && this.check(scope);
|
|
89
|
+
const paste = (event) => { var _a; var _b; return this.pasted((_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain')) !== null && _b !== void 0 ? _b : ''); };
|
|
90
|
+
const copy = (event) => this.mine(ClipboardLinks.selected(scope, event.target), scope);
|
|
91
|
+
scope.addEventListener('focus', check);
|
|
92
|
+
doc.addEventListener('visibilitychange', visible);
|
|
93
|
+
doc.addEventListener('paste', paste, true);
|
|
94
|
+
doc.addEventListener('copy', copy, true);
|
|
95
|
+
doc.addEventListener('cut', copy, true);
|
|
96
|
+
const stopOpen = this.host.onOpen(url => {
|
|
97
|
+
this.opened.add(url);
|
|
98
|
+
this.seen.add([url]);
|
|
99
|
+
});
|
|
100
|
+
const unwrap = this.wrapWrite(scope);
|
|
101
|
+
void this.watchPermission(scope);
|
|
102
|
+
return () => {
|
|
103
|
+
scope.removeEventListener('focus', check);
|
|
104
|
+
doc.removeEventListener('visibilitychange', visible);
|
|
105
|
+
doc.removeEventListener('paste', paste, true);
|
|
106
|
+
doc.removeEventListener('copy', copy, true);
|
|
107
|
+
doc.removeEventListener('cut', copy, true);
|
|
108
|
+
stopOpen();
|
|
109
|
+
unwrap();
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** The extensions loaded, whose openers tell links of Ta apart: the clipboard is looked at now, then as Ta comes back. */
|
|
113
|
+
loaded(scope = window) {
|
|
114
|
+
this.ready = true;
|
|
115
|
+
this.check(scope);
|
|
116
|
+
}
|
|
117
|
+
/** Ta came to the front: what was copied meanwhile, where it may be read without asking. */
|
|
118
|
+
check(scope = window) {
|
|
119
|
+
var _a;
|
|
120
|
+
var _b;
|
|
121
|
+
const now = Date.now();
|
|
122
|
+
if (!this.ready || !this.host.enabled() || scope.document.visibilityState === 'hidden' || now - this.lastCheck < ClipboardLinks.THROTTLE_MS) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.lastCheck = now;
|
|
126
|
+
const native = scope;
|
|
127
|
+
if (native.taClipboardAndroid) {
|
|
128
|
+
this.take((_b = native.taClipboardAndroid.read()) !== null && _b !== void 0 ? _b : '', 'clipboard');
|
|
129
|
+
}
|
|
130
|
+
else if (this.readable && scope.document.hasFocus()) {
|
|
131
|
+
(_a = scope.navigator.clipboard) === null || _a === void 0 ? void 0 : _a.readText().then(text => this.take(text, 'clipboard'), () => undefined);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** A text of the clipboard or pasted: its links of Ta not offered before, offered now. */
|
|
135
|
+
take(text, from) {
|
|
136
|
+
if (!text || text === this.lastText) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.lastText = text;
|
|
140
|
+
const found = this.fresh(text);
|
|
141
|
+
if (found.length) {
|
|
142
|
+
this.seen.add(found.map(link => link.url));
|
|
143
|
+
this.offer(found, from);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
fresh(text) {
|
|
147
|
+
return this.host.find(text).filter(link => !this.seen.has(link.url));
|
|
148
|
+
}
|
|
149
|
+
/** Pasted into any box of Ta: offered, unless the box opened it (a box for links). */
|
|
150
|
+
pasted(text) {
|
|
151
|
+
if (!this.ready || !this.host.enabled() || !text.includes('://')) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const found = this.fresh(text);
|
|
155
|
+
if (!found.length) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this.lastText = text;
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
const left = found.filter(link => !this.opened.has(link.url) && !this.seen.has(link.url));
|
|
161
|
+
this.seen.add(found.map(link => link.url));
|
|
162
|
+
if (left.length) {
|
|
163
|
+
this.offer(left, 'paste');
|
|
164
|
+
}
|
|
165
|
+
}, ClipboardLinks.PASTE_WAIT_MS);
|
|
166
|
+
}
|
|
167
|
+
/** Copied in Ta: never offered back, and the app of Android counts the clipboard as seen. */
|
|
168
|
+
mine(text, scope) {
|
|
169
|
+
if (text) {
|
|
170
|
+
this.lastText = text;
|
|
171
|
+
this.seen.add(link_text_1.LinkText.urls(text));
|
|
172
|
+
}
|
|
173
|
+
const native = scope;
|
|
174
|
+
// Once the clipboard holds it: the copy event comes before.
|
|
175
|
+
setTimeout(() => { var _a; return (_a = native.taClipboardAndroid) === null || _a === void 0 ? void 0 : _a.mine(); }, 50);
|
|
176
|
+
}
|
|
177
|
+
/** One notice: the words the link came with and what it is, and Open; for several, a button each. */
|
|
178
|
+
offer(found, from) {
|
|
179
|
+
var _a;
|
|
180
|
+
const { say, notices } = this.host;
|
|
181
|
+
const open = (link) => ({ label: say('ta.clip.open'), run: () => this.host.open(link.url) });
|
|
182
|
+
if (found.length === 1) {
|
|
183
|
+
const [link] = found;
|
|
184
|
+
notices.notify((_a = link.words) !== null && _a !== void 0 ? _a : say(from === 'paste' ? 'ta.clip.pasteOne' : 'ta.clip.clipboardOne', { kind: link.kind }), {
|
|
185
|
+
level: 'info',
|
|
186
|
+
key: ClipboardLinks.KEY,
|
|
187
|
+
detail: link.words ? say(from === 'paste' ? 'ta.clip.pasteFrom' : 'ta.clip.clipboardFrom', { kind: link.kind }) : undefined,
|
|
188
|
+
action: open(link),
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const shown = found.slice(0, ClipboardLinks.MAX_ACTIONS);
|
|
193
|
+
notices.notify(say(from === 'paste' ? 'ta.clip.pasteMany' : 'ta.clip.clipboardMany', { count: found.length }), {
|
|
194
|
+
level: 'info',
|
|
195
|
+
key: ClipboardLinks.KEY,
|
|
196
|
+
detail: say('ta.clip.pick'),
|
|
197
|
+
actions: shown.map((link, index) => ({ ...open(link), label: ClipboardLinks.label(link, index, shown) })),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** A button of several: its kind, or its words where two are of one kind. */
|
|
201
|
+
static label(link, index, all) {
|
|
202
|
+
if (all.filter(other => other.kind === link.kind).length === 1) {
|
|
203
|
+
return link.kind;
|
|
204
|
+
}
|
|
205
|
+
const words = link.words && link.words.length > 12 ? `${link.words.slice(0, 11)}…` : link.words;
|
|
206
|
+
return words !== null && words !== void 0 ? words : `${link.kind} ${index + 1}`;
|
|
207
|
+
}
|
|
208
|
+
/** Whether the page may read the clipboard without asking: as the permission says, which Ta Desktop grants. */
|
|
209
|
+
async watchPermission(scope) {
|
|
210
|
+
var _a;
|
|
211
|
+
try {
|
|
212
|
+
const status = await ((_a = scope.navigator.permissions) === null || _a === void 0 ? void 0 : _a.query({ name: 'clipboard-read' }));
|
|
213
|
+
if (!status) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.readable = status.state === 'granted';
|
|
217
|
+
status.addEventListener('change', () => {
|
|
218
|
+
this.readable = status.state === 'granted';
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
catch (_b) {
|
|
222
|
+
// A browser without the permission (Safari, Firefox): its clipboard is read on paste only.
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** Copies of the page (Copy buttons) are its own: what they copy is never offered back. */
|
|
226
|
+
wrapWrite(scope) {
|
|
227
|
+
const clipboard = scope.navigator.clipboard;
|
|
228
|
+
const write = clipboard === null || clipboard === void 0 ? void 0 : clipboard.writeText;
|
|
229
|
+
if (!clipboard || typeof write !== 'function') {
|
|
230
|
+
return () => undefined;
|
|
231
|
+
}
|
|
232
|
+
clipboard.writeText = (text) => {
|
|
233
|
+
this.mine(text, scope);
|
|
234
|
+
return write.call(clipboard, text);
|
|
235
|
+
};
|
|
236
|
+
return () => {
|
|
237
|
+
delete clipboard.writeText;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/** What a copy or a cut takes: the selection of a box, or of the page. */
|
|
241
|
+
static selected(scope, target) {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
var _c;
|
|
244
|
+
const box = target;
|
|
245
|
+
if (box && typeof box.value === 'string' && typeof box.selectionStart === 'number' && typeof box.selectionEnd === 'number') {
|
|
246
|
+
return box.value.slice(box.selectionStart, box.selectionEnd);
|
|
247
|
+
}
|
|
248
|
+
return (_c = (_b = (_a = scope.getSelection) === null || _a === void 0 ? void 0 : _a.call(scope)) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '';
|
|
249
|
+
}
|
|
250
|
+
static storage() {
|
|
251
|
+
try {
|
|
252
|
+
return globalThis.localStorage;
|
|
253
|
+
}
|
|
254
|
+
catch (_a) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
exports.ClipboardLinks = ClipboardLinks;
|
|
260
|
+
ClipboardLinks.THROTTLE_MS = 1000;
|
|
261
|
+
/** A link pasted into a box for links opens there: offered only when the box did not open it by then. */
|
|
262
|
+
ClipboardLinks.PASTE_WAIT_MS = 600;
|
|
263
|
+
ClipboardLinks.KEY = 'ta-clipboard-links';
|
|
264
|
+
/** Buttons of a notice, side by side. */
|
|
265
|
+
ClipboardLinks.MAX_ACTIONS = 3;
|
|
266
|
+
//# sourceMappingURL=clipboard-links.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A link of Ta in a text the user copied or pasted (docs/design/ta-links.md 7). */
|
|
2
|
+
export interface FoundLink {
|
|
3
|
+
/** As it opens: the link inside a `ta://open?link=`, else as written. */
|
|
4
|
+
url: string;
|
|
5
|
+
/** What it is, in the words of its opener: "Invite to a group chat". */
|
|
6
|
+
kind: string;
|
|
7
|
+
/** What the one who sent it wrote of it: the words before it on its line, or the line above when it has a line of its own. */
|
|
8
|
+
words?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The links of a text, read once and quickly: a text too long to be a message (a page, a log) is not looked through, nor
|
|
12
|
+
* one without `://`; one pass of a regular expression, and no more than {@link LinkText.MAX_LINKS} links.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace LinkText {
|
|
15
|
+
/** A message with a link or a few is far shorter. */
|
|
16
|
+
const MAX_TEXT = 20000;
|
|
17
|
+
const MAX_LINKS = 8;
|
|
18
|
+
/** The longest words kept of what goes before a link. */
|
|
19
|
+
const MAX_WORDS = 80;
|
|
20
|
+
/** The links of the text, each as it opens (inside `ta://open?link=`), once each, in order. */
|
|
21
|
+
function urls(text: string): string[];
|
|
22
|
+
/** Those links that are of Ta (`describe` names their kind), with the words before each. */
|
|
23
|
+
function find(text: string, describe: (url: string) => string | undefined): FoundLink[];
|
|
24
|
+
/**
|
|
25
|
+
* The words before the link at `index`: of its line, or of the line above when the link begins its line, as a
|
|
26
|
+
* share of Ta is copied (`<what it is>\n<link>`). The label of a Markdown link (`[Join](…)`) when it is one.
|
|
27
|
+
*/
|
|
28
|
+
function wordsBefore(text: string, index: number): string | undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=link-text.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkText = void 0;
|
|
4
|
+
const relay_open_in_ta_1 = require("@celljs/ta-relay/lib/common/relay-open-in-ta");
|
|
5
|
+
/**
|
|
6
|
+
* The links of a text, read once and quickly: a text too long to be a message (a page, a log) is not looked through, nor
|
|
7
|
+
* one without `://`; one pass of a regular expression, and no more than {@link LinkText.MAX_LINKS} links.
|
|
8
|
+
*/
|
|
9
|
+
var LinkText;
|
|
10
|
+
(function (LinkText) {
|
|
11
|
+
/** A message with a link or a few is far shorter. */
|
|
12
|
+
LinkText.MAX_TEXT = 20000;
|
|
13
|
+
LinkText.MAX_LINKS = 8;
|
|
14
|
+
/** The longest words kept of what goes before a link. */
|
|
15
|
+
LinkText.MAX_WORDS = 80;
|
|
16
|
+
// Up to a space, a quote or an angle bracket, or the punctuation of Chinese, which a message writes right after a link.
|
|
17
|
+
const URL = /(?:https?|ta):\/\/[^\s<>"'`,。;!?、()【】《》「」『』]+/gi;
|
|
18
|
+
// What ends a sentence or a bracket rather than the link.
|
|
19
|
+
const TAIL = /[.,;:!?)\]}*~]+$/;
|
|
20
|
+
/** The links of the text, each as it opens (inside `ta://open?link=`), once each, in order. */
|
|
21
|
+
function urls(text) {
|
|
22
|
+
return matches(text).map(match => match.url);
|
|
23
|
+
}
|
|
24
|
+
LinkText.urls = urls;
|
|
25
|
+
/** Those links that are of Ta (`describe` names their kind), with the words before each. */
|
|
26
|
+
function find(text, describe) {
|
|
27
|
+
const found = [];
|
|
28
|
+
for (const { url, index } of matches(text)) {
|
|
29
|
+
const kind = describe(url);
|
|
30
|
+
if (kind) {
|
|
31
|
+
const words = wordsBefore(text, index);
|
|
32
|
+
found.push(words ? { url, kind, words } : { url, kind });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return found;
|
|
36
|
+
}
|
|
37
|
+
LinkText.find = find;
|
|
38
|
+
function matches(text) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
if (!text || text.length > LinkText.MAX_TEXT || !text.includes('://')) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
const found = [];
|
|
45
|
+
for (const match of text.matchAll(URL)) {
|
|
46
|
+
const written = match[0].replace(TAIL, '');
|
|
47
|
+
const url = (_a = relay_open_in_ta_1.RelayOpenInTa.inner(written)) !== null && _a !== void 0 ? _a : written;
|
|
48
|
+
if (url.length > 12 && !seen.has(url)) {
|
|
49
|
+
seen.add(url);
|
|
50
|
+
found.push({ url, index: (_b = match.index) !== null && _b !== void 0 ? _b : 0 });
|
|
51
|
+
if (found.length >= LinkText.MAX_LINKS) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return found;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The words before the link at `index`: of its line, or of the line above when the link begins its line, as a
|
|
60
|
+
* share of Ta is copied (`<what it is>\n<link>`). The label of a Markdown link (`[Join](…)`) when it is one.
|
|
61
|
+
*/
|
|
62
|
+
function wordsBefore(text, index) {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
const before = text.slice(Math.max(0, index - 400), index);
|
|
65
|
+
const lines = before.split(/\r?\n/);
|
|
66
|
+
let line = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
67
|
+
const label = /\[([^\]\n]+)\]\($/.exec(line);
|
|
68
|
+
if (label) {
|
|
69
|
+
return clip(label[1]);
|
|
70
|
+
}
|
|
71
|
+
if (!clean(line)) {
|
|
72
|
+
line = (_b = [...lines].reverse().find(one => clean(one))) !== null && _b !== void 0 ? _b : '';
|
|
73
|
+
// The line above is the words of this link only when it holds no link of its own.
|
|
74
|
+
if (line.includes('://')) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Of this line, what comes after the link before it.
|
|
80
|
+
line = (_c = line.split(/\S*:\/\/\S*/).pop()) !== null && _c !== void 0 ? _c : '';
|
|
81
|
+
}
|
|
82
|
+
return clip(clean(line));
|
|
83
|
+
}
|
|
84
|
+
LinkText.wordsBefore = wordsBefore;
|
|
85
|
+
/** Without the marks of a list, a quote or a heading, nor the colon or dash that leads to the link. */
|
|
86
|
+
function clean(line) {
|
|
87
|
+
return line
|
|
88
|
+
.replace(/^\s*(?:[-*+>#]+|\d+[.)、])\s*/, '')
|
|
89
|
+
.replace(/[\s::—\-–>→|]+$/, '')
|
|
90
|
+
.trim();
|
|
91
|
+
}
|
|
92
|
+
function clip(words) {
|
|
93
|
+
const trimmed = words.trim();
|
|
94
|
+
if (!trimmed) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return trimmed.length > LinkText.MAX_WORDS ? `${trimmed.slice(0, LinkText.MAX_WORDS - 1)}…` : trimmed;
|
|
98
|
+
}
|
|
99
|
+
})(LinkText || (exports.LinkText = LinkText = {}));
|
|
100
|
+
//# sourceMappingURL=link-text.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LinkTarget } from '../util/link';
|
|
2
|
+
import type { FoundLink } from './link-text';
|
|
2
3
|
export declare const TaLinks: unique symbol;
|
|
3
4
|
/** A page of the web to open outside of Ta, waiting for the user to say so. */
|
|
4
5
|
export interface ExternalLinkRequest {
|
|
@@ -42,8 +43,18 @@ export interface OpenLinkOptions {
|
|
|
42
43
|
export interface TaLinks {
|
|
43
44
|
readonly state: LinksState;
|
|
44
45
|
subscribe(listener: (state: LinksState) => void): () => void;
|
|
45
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Whether it opened it, or asked the user to; false only for one that is not of Ta, with `onlyTa`. A text with words
|
|
48
|
+
* besides (`Join my group chat on Ta:\n<link>`, as shares of Ta are copied) opens its first link of Ta.
|
|
49
|
+
*/
|
|
46
50
|
open(target: LinkTarget, options?: OpenLinkOptions): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* The links of Ta in a text the user copied or pasted, each with what it is (its opener says, without opening it) and
|
|
53
|
+
* the words written before it; none in a text of no link of Ta (docs/design/ta-links.md 7).
|
|
54
|
+
*/
|
|
55
|
+
find(text: string): FoundLink[];
|
|
56
|
+
/** Hears each link of the web opened, wherever it came from: one opened is not offered from the clipboard again. */
|
|
57
|
+
onOpen(listener: (url: string) => void): () => void;
|
|
47
58
|
/** Shows the conversation of a session file as the lists open it; false when no conversation has it (WebExtensionAPI.openChat). */
|
|
48
59
|
openConversation(file: string): Promise<boolean>;
|
|
49
60
|
/** The answer to the question shown. */
|