@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
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VoiceTalkUtil = void 0;
|
|
37
|
+
exports.useVoiceTalk = useVoiceTalk;
|
|
38
|
+
exports.VoiceTalkOverlay = VoiceTalkOverlay;
|
|
39
|
+
const lucide_react_1 = require("lucide-react");
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const react_dom_1 = require("react-dom");
|
|
42
|
+
const hold_1 = require("../device/hold");
|
|
43
|
+
const use_t_1 = require("../i18n/use-t");
|
|
44
|
+
const voice_1 = require("../util/voice");
|
|
45
|
+
const icon_1 = require("./icon");
|
|
46
|
+
var VoiceTalkUtil;
|
|
47
|
+
(function (VoiceTalkUtil) {
|
|
48
|
+
/** How long a talk lasts for the words to count: shorter, a finger slipped on the box and nothing is given. */
|
|
49
|
+
VoiceTalkUtil.SHORT_MS = 600;
|
|
50
|
+
/** How long the end of a talk waits for recognition to say it ended before it ends anyway. */
|
|
51
|
+
VoiceTalkUtil.SETTLE_MS = 1500;
|
|
52
|
+
/** How long "too short" stays before the page comes back. */
|
|
53
|
+
VoiceTalkUtil.SHORT_NOTICE_MS = 700;
|
|
54
|
+
/** How long the overlay takes to fade out. */
|
|
55
|
+
VoiceTalkUtil.LEAVE_MS = 160;
|
|
56
|
+
/** What a talk gives; none when it was too short to be meant, or when nothing was heard. */
|
|
57
|
+
function given(words, heldMs) {
|
|
58
|
+
const text = words.trim();
|
|
59
|
+
return text && heldMs >= VoiceTalkUtil.SHORT_MS ? text : undefined;
|
|
60
|
+
}
|
|
61
|
+
VoiceTalkUtil.given = given;
|
|
62
|
+
/** The zone of the overlay under a point (`data-talk-zone`): the bottom, where the finger starts, sends. */
|
|
63
|
+
function zone(element) {
|
|
64
|
+
var _a;
|
|
65
|
+
const zone = (_a = element === null || element === void 0 ? void 0 : element.closest('[data-talk-zone]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-talk-zone');
|
|
66
|
+
return zone === 'cancel' || zone === 'edit' ? zone : 'send';
|
|
67
|
+
}
|
|
68
|
+
VoiceTalkUtil.zone = zone;
|
|
69
|
+
})(VoiceTalkUtil || (exports.VoiceTalkUtil = VoiceTalkUtil = {}));
|
|
70
|
+
const IDLE = { phase: 'idle', words: '', zone: 'send' };
|
|
71
|
+
/**
|
|
72
|
+
* A conversation by voice as WeChat's: a finger held on the message box (or on an entry of the navigation) dims the
|
|
73
|
+
* page and a green bubble listens, the words coming as they are said. Let go on the bottom, they are sent; slid
|
|
74
|
+
* over 取消 they are dropped, over 编辑 they stay in the box to be read over. A talk too short to be meant, which a
|
|
75
|
+
* wrong touch is, says so and gives nothing, as one where nothing was heard does.
|
|
76
|
+
*/
|
|
77
|
+
function useVoiceTalk(onGive, onError) {
|
|
78
|
+
const t = (0, use_t_1.useT)();
|
|
79
|
+
const language = (0, use_t_1.useLanguage)();
|
|
80
|
+
const [state, setState] = React.useState(IDLE);
|
|
81
|
+
// The phase as the finger and recognition find it, between renders.
|
|
82
|
+
const phase = React.useRef('idle');
|
|
83
|
+
const listening = React.useRef(undefined);
|
|
84
|
+
const heard = React.useRef('');
|
|
85
|
+
const since = React.useRef(0);
|
|
86
|
+
const held = React.useRef(0);
|
|
87
|
+
const zone = React.useRef('send');
|
|
88
|
+
/** Recognition ended while the finger was still down (a long silence): what it heard waits for the finger. */
|
|
89
|
+
const ended = React.useRef(false);
|
|
90
|
+
const timer = React.useRef(undefined);
|
|
91
|
+
// Recognition and the finger outlive a render: always to what the box is now.
|
|
92
|
+
const give = React.useRef(onGive);
|
|
93
|
+
give.current = onGive;
|
|
94
|
+
const fail = React.useRef(onError);
|
|
95
|
+
fail.current = onError;
|
|
96
|
+
// The box goes as it listens (another conversation, another page): what was said is not given to it.
|
|
97
|
+
React.useEffect(() => () => {
|
|
98
|
+
clearTimeout(timer.current);
|
|
99
|
+
const session = listening.current;
|
|
100
|
+
listening.current = undefined;
|
|
101
|
+
session === null || session === void 0 ? void 0 : session.stop();
|
|
102
|
+
}, []);
|
|
103
|
+
const go = (next, more) => {
|
|
104
|
+
phase.current = next;
|
|
105
|
+
setState(current => ({ ...current, ...more, phase: next }));
|
|
106
|
+
};
|
|
107
|
+
const later = (ms, then) => {
|
|
108
|
+
clearTimeout(timer.current);
|
|
109
|
+
timer.current = setTimeout(then, ms);
|
|
110
|
+
};
|
|
111
|
+
/** Stops listening, whatever it heard after. */
|
|
112
|
+
const quiet = () => {
|
|
113
|
+
const session = listening.current;
|
|
114
|
+
listening.current = undefined;
|
|
115
|
+
session === null || session === void 0 ? void 0 : session.stop();
|
|
116
|
+
};
|
|
117
|
+
/** The page comes back, the overlay fading out. */
|
|
118
|
+
const leave = () => {
|
|
119
|
+
quiet();
|
|
120
|
+
go('leaving');
|
|
121
|
+
later(VoiceTalkUtil.LEAVE_MS, () => {
|
|
122
|
+
phase.current = 'idle';
|
|
123
|
+
setState(IDLE);
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
/** The finger let go off 取消 and recognition said its last: the words go as the place it let go says. */
|
|
127
|
+
const deliver = () => {
|
|
128
|
+
const text = VoiceTalkUtil.given(heard.current, held.current);
|
|
129
|
+
const where = zone.current;
|
|
130
|
+
leave();
|
|
131
|
+
if (text && where !== 'cancel') {
|
|
132
|
+
give.current(text, where);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const start = () => {
|
|
136
|
+
if (phase.current === 'listening' || phase.current === 'released') {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
clearTimeout(timer.current);
|
|
140
|
+
since.current = Date.now();
|
|
141
|
+
held.current = 0;
|
|
142
|
+
heard.current = '';
|
|
143
|
+
zone.current = 'send';
|
|
144
|
+
ended.current = false;
|
|
145
|
+
// What a talk ended or dropped before still says it ended (onerror, then onend): not to the next one.
|
|
146
|
+
let session;
|
|
147
|
+
session = voice_1.Voice.listen(language, words => {
|
|
148
|
+
if (listening.current === session) {
|
|
149
|
+
heard.current = words;
|
|
150
|
+
setState(current => ({ ...current, words }));
|
|
151
|
+
}
|
|
152
|
+
}, failure => {
|
|
153
|
+
if (listening.current !== session) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (failure) {
|
|
157
|
+
fail.current(new Error(t(voice_1.Voice.denied(failure) ? 'ta.composer.voiceDenied' : 'ta.composer.voiceFailed', { error: failure })));
|
|
158
|
+
leave();
|
|
159
|
+
}
|
|
160
|
+
else if (phase.current === 'released') {
|
|
161
|
+
listening.current = undefined;
|
|
162
|
+
deliver();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
ended.current = true;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
// A finger held goes on past a pause: it stops when it lets go.
|
|
169
|
+
true);
|
|
170
|
+
if (session) {
|
|
171
|
+
listening.current = session;
|
|
172
|
+
go('listening', { words: '', zone: 'send' });
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const point = (x, y) => {
|
|
176
|
+
if (phase.current !== 'listening') {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const next = VoiceTalkUtil.zone(document.elementFromPoint(x, y));
|
|
180
|
+
if (next !== zone.current) {
|
|
181
|
+
zone.current = next;
|
|
182
|
+
setState(current => ({ ...current, zone: next }));
|
|
183
|
+
if (next !== 'send') {
|
|
184
|
+
hold_1.HeldUtil.tick();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const release = () => {
|
|
189
|
+
var _a;
|
|
190
|
+
if (phase.current !== 'listening') {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
held.current = Date.now() - since.current;
|
|
194
|
+
if (zone.current === 'cancel') {
|
|
195
|
+
leave();
|
|
196
|
+
}
|
|
197
|
+
else if (held.current < VoiceTalkUtil.SHORT_MS) {
|
|
198
|
+
// Too short to be meant: said so for a moment, and nothing is given.
|
|
199
|
+
quiet();
|
|
200
|
+
go('short');
|
|
201
|
+
later(VoiceTalkUtil.SHORT_NOTICE_MS, leave);
|
|
202
|
+
}
|
|
203
|
+
else if (ended.current) {
|
|
204
|
+
listening.current = undefined;
|
|
205
|
+
deliver();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
go('released');
|
|
209
|
+
(_a = listening.current) === null || _a === void 0 ? void 0 : _a.stop();
|
|
210
|
+
// Recognition that does not say it ended would leave the page dimmed: the talk ends with what was heard.
|
|
211
|
+
later(VoiceTalkUtil.SETTLE_MS, () => phase.current === 'released' && deliver());
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const cancel = () => {
|
|
215
|
+
if (phase.current !== 'idle' && phase.current !== 'leaving') {
|
|
216
|
+
leave();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
return { ...state, active: state.phase === 'listening' || state.phase === 'released', start, point, release, cancel };
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* What a talk shows, over the whole page (above the keyboard): the page dimmed, a green bubble with the words as
|
|
223
|
+
* they come, 取消 and 编辑 to slide the finger onto, and the bottom it starts on, which says what letting go does.
|
|
224
|
+
*/
|
|
225
|
+
function VoiceTalkOverlay({ talk }) {
|
|
226
|
+
const t = (0, use_t_1.useT)();
|
|
227
|
+
const { phase, cancel } = talk;
|
|
228
|
+
const listening = phase === 'listening';
|
|
229
|
+
React.useEffect(() => {
|
|
230
|
+
if (!listening) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const onKey = (event) => event.key === 'Escape' && cancel();
|
|
234
|
+
document.addEventListener('keydown', onKey);
|
|
235
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
236
|
+
}, [listening, cancel]);
|
|
237
|
+
if (phase === 'idle') {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
const short = phase === 'short';
|
|
241
|
+
const hint = listening ? t(talk.zone === 'cancel' ? 'ta.talk.releaseCancel' : talk.zone === 'edit' ? 'ta.talk.releaseEdit' : 'ta.talk.releaseSend') : '';
|
|
242
|
+
return (0, react_dom_1.createPortal)(React.createElement("div", { className: `ta-talk ta-talk-${talk.zone} ta-talk-${phase}`, role: "dialog", "aria-modal": "true", "aria-label": t('ta.talk.listening') },
|
|
243
|
+
React.createElement("div", { className: "ta-talk-bubble", "aria-live": "polite" }, short ? (React.createElement("p", { className: "ta-talk-words" }, t('ta.talk.tooShort'))) : talk.words ? (React.createElement("p", { className: "ta-talk-words" }, talk.words)) : (React.createElement("span", { className: "ta-wave", "aria-hidden": "true" },
|
|
244
|
+
React.createElement("i", null),
|
|
245
|
+
React.createElement("i", null),
|
|
246
|
+
React.createElement("i", null),
|
|
247
|
+
React.createElement("i", null)))),
|
|
248
|
+
React.createElement("div", { className: "ta-talk-zones", "aria-hidden": !listening },
|
|
249
|
+
React.createElement("div", { className: `ta-talk-zone${talk.zone === 'cancel' ? ' ta-on' : ''}`, "data-talk-zone": "cancel" },
|
|
250
|
+
React.createElement("span", { className: "ta-talk-zone-label" }, t('ta.cancel')),
|
|
251
|
+
React.createElement("span", { className: "ta-talk-zone-circle" },
|
|
252
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 26 }))),
|
|
253
|
+
React.createElement("div", { className: `ta-talk-zone${talk.zone === 'edit' ? ' ta-on' : ''}`, "data-talk-zone": "edit" },
|
|
254
|
+
React.createElement("span", { className: "ta-talk-zone-label" }, t('ta.talk.edit')),
|
|
255
|
+
React.createElement("span", { className: "ta-talk-zone-circle" },
|
|
256
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.PenLine, size: 24 })))),
|
|
257
|
+
React.createElement("div", { className: "ta-talk-base" },
|
|
258
|
+
React.createElement("span", { className: "ta-talk-hint" }, hint))), document.body);
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=voice-talk.js.map
|
|
@@ -41,7 +41,7 @@ const scanner_1 = require("../device/scanner");
|
|
|
41
41
|
const hooks_1 = require("../hooks");
|
|
42
42
|
const use_t_1 = require("../i18n/use-t");
|
|
43
43
|
const style_1 = require("../style");
|
|
44
|
-
const
|
|
44
|
+
const workbench_util_1 = require("../workbench-util");
|
|
45
45
|
const dino_1 = require("./dino");
|
|
46
46
|
const host_view_1 = require("./host-view");
|
|
47
47
|
const sign_in_accounts_1 = require("./sign-in-accounts");
|
|
@@ -87,7 +87,7 @@ function useDocument() {
|
|
|
87
87
|
*/
|
|
88
88
|
function SignIn({ error }) {
|
|
89
89
|
const t = (0, use_t_1.useT)();
|
|
90
|
-
const app =
|
|
90
|
+
const app = workbench_util_1.WorkbenchUtil.isApp();
|
|
91
91
|
const way = scanner_1.Scanner.available() ? 'scan' : app ? 'pair' : 'serve';
|
|
92
92
|
// The ta serve of this page may take accounts (GitHub, Google, WeChat...); the app has none of its own.
|
|
93
93
|
const { providers, outcome } = (0, sign_in_accounts_1.useSignInWays)(!app);
|
|
@@ -103,7 +103,7 @@ function SignIn({ error }) {
|
|
|
103
103
|
? 'ta.hosts.scanHint'
|
|
104
104
|
: way === 'pair'
|
|
105
105
|
? 'ta.signin.pairHint'
|
|
106
|
-
:
|
|
106
|
+
: workbench_util_1.WorkbenchUtil.elsewhere(undefined)
|
|
107
107
|
? 'ta.signin.hintRemote'
|
|
108
108
|
: 'ta.signin.hint')),
|
|
109
109
|
!accounts && React.createElement(sign_in_picture_1.ConnectPicture, { way: way }),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type DeviceLayout, type DeviceState } from './device-protocol';
|
|
3
3
|
import { type NewLineBridge } from './new-line';
|
|
4
|
+
import { type ShakeUndoBridge } from './shake-undo';
|
|
4
5
|
/** What the observer reads of the browser; tests give their own. */
|
|
5
6
|
export interface DeviceEnvironment {
|
|
6
7
|
matchMedia(query: string): {
|
|
@@ -33,6 +34,8 @@ export interface DeviceEnvironment {
|
|
|
33
34
|
readonly keyboard?: (listener: (height: number) => void) => void;
|
|
34
35
|
/** The edit menu of the app on iOS, which offers New Line in the message box (new-line.ts); none elsewhere. */
|
|
35
36
|
readonly newLine?: NewLineBridge;
|
|
37
|
+
/** Shake to Undo of the app on iOS, offered only while a field has text (shake-undo.ts); none elsewhere. */
|
|
38
|
+
readonly shakeUndo?: ShakeUndoBridge;
|
|
36
39
|
}
|
|
37
40
|
export declare namespace DeviceUtil {
|
|
38
41
|
/** Where the page is not in a browser (tests, the server). */
|
|
@@ -42,6 +42,7 @@ const device_protocol_1 = require("./device-protocol");
|
|
|
42
42
|
const field_dismiss_1 = require("./field-dismiss");
|
|
43
43
|
const long_press_1 = require("./long-press");
|
|
44
44
|
const new_line_1 = require("./new-line");
|
|
45
|
+
const shake_undo_1 = require("./shake-undo");
|
|
45
46
|
/** How much of the height the keyboard has to take before it counts as open: more than the bars of a browser. */
|
|
46
47
|
const KEYBOARD_PX = 80;
|
|
47
48
|
var DeviceUtil;
|
|
@@ -134,6 +135,9 @@ class DeviceObserver {
|
|
|
134
135
|
if (env.newLine) {
|
|
135
136
|
(0, new_line_1.startNewLine)(env.document, env.newLine);
|
|
136
137
|
}
|
|
138
|
+
if (env.shakeUndo) {
|
|
139
|
+
(0, shake_undo_1.startShakeUndo)(env.document, env.shakeUndo);
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
142
|
if (env.keyboard) {
|
|
139
143
|
env.keyboard(height => this.moveKeyboard(height));
|
|
@@ -234,9 +238,15 @@ function browser() {
|
|
|
234
238
|
root: document.documentElement,
|
|
235
239
|
native: nativeBridge(),
|
|
236
240
|
keyboard: nativeKeyboard(),
|
|
237
|
-
newLine: (
|
|
241
|
+
newLine: (_a = messageHandlers()) === null || _a === void 0 ? void 0 : _a.taEditing,
|
|
242
|
+
shakeUndo: (_b = messageHandlers()) === null || _b === void 0 ? void 0 : _b.taUndo,
|
|
238
243
|
};
|
|
239
244
|
}
|
|
245
|
+
/** What the Ta app on iOS listens to from the page (TaBridgeViewController of apps/ta-mobile); none elsewhere. */
|
|
246
|
+
function messageHandlers() {
|
|
247
|
+
var _a;
|
|
248
|
+
return (_a = window.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers;
|
|
249
|
+
}
|
|
240
250
|
/** One plugin of the Ta app (Capacitor), when the app has it; none in a browser, or in an app built before it. */
|
|
241
251
|
function nativePlugin(name) {
|
|
242
252
|
var _a;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a held finger does, as the talk button of a phone's chat: it starts once the finger has been kept still
|
|
4
|
+
* for PRESS_MS, follows the finger while it stays, and ends when it lets go.
|
|
5
|
+
*/
|
|
6
|
+
export interface Hold {
|
|
7
|
+
/** Whether a press is the hold's (a field, a button of its own are not); every press is, without it. */
|
|
8
|
+
accepts?(event: React.PointerEvent): boolean;
|
|
9
|
+
start(): void;
|
|
10
|
+
/** Where the finger is while it is held, in the coordinates of the page. */
|
|
11
|
+
move?(x: number, y: number): void;
|
|
12
|
+
/** The finger let go. */
|
|
13
|
+
end(): void;
|
|
14
|
+
/** The system took the finger (a gesture of its own, a call): nothing is given. */
|
|
15
|
+
cancel(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What an element takes of the pointer, for the hold it has. `data-held` takes the panning of a finger from the
|
|
19
|
+
* browser (style/device.ts): it decides that as the finger lands, too early for a hold, and a pan it began takes
|
|
20
|
+
* the finger from the page (pointercancel) as soon as it slides toward 取消.
|
|
21
|
+
*/
|
|
22
|
+
export interface HeldProps {
|
|
23
|
+
onPointerDown?(event: React.PointerEvent): void;
|
|
24
|
+
onContextMenu?(event: React.MouseEvent): void;
|
|
25
|
+
'data-held'?: '';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Something done while an element is held. A press that moves first scrolls, and one let go before PRESS_MS
|
|
29
|
+
* starts nothing, so that a tap stays a tap. Once held, the finger is the hold's until it lets go: the page does
|
|
30
|
+
* not scroll under it, the system's menu and selection do not come, the click of the finger let go is not a tap
|
|
31
|
+
* of what was under it, and the hold outlives the element (a tab bar that a page slides over).
|
|
32
|
+
*/
|
|
33
|
+
export declare function useHeld(): (hold: Hold | undefined) => HeldProps;
|
|
34
|
+
export declare namespace HeldUtil {
|
|
35
|
+
/** A light tap of the haptic engine as a held finger comes onto something (取消, 编辑): the app's, or a phone's. */
|
|
36
|
+
function tick(): void;
|
|
37
|
+
/**
|
|
38
|
+
* The click that follows a finger let go after a hold: not a tap of what was under it. A browser that sends
|
|
39
|
+
* none (a long press is no tap to it) leaves the next press its own.
|
|
40
|
+
*/
|
|
41
|
+
function swallowClick(): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=hold.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.HeldUtil = void 0;
|
|
37
|
+
exports.useHeld = useHeld;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const device_1 = require("./device");
|
|
40
|
+
const long_press_1 = require("./long-press");
|
|
41
|
+
/**
|
|
42
|
+
* Something done while an element is held. A press that moves first scrolls, and one let go before PRESS_MS
|
|
43
|
+
* starts nothing, so that a tap stays a tap. Once held, the finger is the hold's until it lets go: the page does
|
|
44
|
+
* not scroll under it, the system's menu and selection do not come, the click of the finger let go is not a tap
|
|
45
|
+
* of what was under it, and the hold outlives the element (a tab bar that a page slides over).
|
|
46
|
+
*/
|
|
47
|
+
function useHeld() {
|
|
48
|
+
const current = React.useRef(undefined);
|
|
49
|
+
// Gone before it held, the press is nothing; once held, it ends when the finger lets go.
|
|
50
|
+
React.useEffect(() => () => {
|
|
51
|
+
const press = current.current;
|
|
52
|
+
if (press && !press.held) {
|
|
53
|
+
clearTimeout(press.timer);
|
|
54
|
+
press.off();
|
|
55
|
+
current.current = undefined;
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
return React.useCallback((hold) => {
|
|
59
|
+
if (!hold) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
'data-held': '',
|
|
64
|
+
onPointerDown: event => {
|
|
65
|
+
if (current.current || !event.isPrimary || event.button !== 0 || (hold.accepts && !hold.accepts(event))) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const from = { x: event.clientX, y: event.clientY };
|
|
69
|
+
const finish = (how) => {
|
|
70
|
+
if (current.current !== press) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
current.current = undefined;
|
|
74
|
+
clearTimeout(press.timer);
|
|
75
|
+
press.off();
|
|
76
|
+
if (!press.held || how === 'none') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
HeldUtil.swallowClick();
|
|
80
|
+
if (how === 'end') {
|
|
81
|
+
hold.end();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
hold.cancel();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const onUp = () => finish('end');
|
|
88
|
+
const onCancel = () => finish('cancel');
|
|
89
|
+
const onMove = (moved) => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (press.held) {
|
|
92
|
+
(_a = hold.move) === null || _a === void 0 ? void 0 : _a.call(hold, moved.clientX, moved.clientY);
|
|
93
|
+
}
|
|
94
|
+
else if (long_press_1.LongPressUtil.moved(from, moved)) {
|
|
95
|
+
finish('none');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
// Held, the finger drags nothing: no scroll, which would take it from the hold (pointercancel).
|
|
99
|
+
const onTouchMove = (touch) => press.held && touch.cancelable && touch.preventDefault();
|
|
100
|
+
const onSelect = (select) => press.held && select.preventDefault();
|
|
101
|
+
const press = {
|
|
102
|
+
hold,
|
|
103
|
+
held: false,
|
|
104
|
+
timer: setTimeout(() => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
press.held = true;
|
|
107
|
+
(_a = document.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
108
|
+
hold.start();
|
|
109
|
+
(_b = hold.move) === null || _b === void 0 ? void 0 : _b.call(hold, from.x, from.y);
|
|
110
|
+
}, long_press_1.LongPressUtil.PRESS_MS),
|
|
111
|
+
off: () => {
|
|
112
|
+
document.removeEventListener('pointerup', onUp);
|
|
113
|
+
document.removeEventListener('pointercancel', onCancel);
|
|
114
|
+
document.removeEventListener('pointermove', onMove);
|
|
115
|
+
document.removeEventListener('touchmove', onTouchMove);
|
|
116
|
+
document.removeEventListener('selectstart', onSelect, true);
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
current.current = press;
|
|
120
|
+
document.addEventListener('pointerup', onUp);
|
|
121
|
+
document.addEventListener('pointercancel', onCancel);
|
|
122
|
+
document.addEventListener('pointermove', onMove);
|
|
123
|
+
document.addEventListener('touchmove', onTouchMove, { passive: false });
|
|
124
|
+
document.addEventListener('selectstart', onSelect, true);
|
|
125
|
+
},
|
|
126
|
+
// The long press of a finger (the system's, or startLongPress's) is the hold's: no menu. Taken, it is
|
|
127
|
+
// also what gives the light tap of the haptic engine in the app. A right click is the browser's.
|
|
128
|
+
onContextMenu: event => {
|
|
129
|
+
if (current.current) {
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}, []);
|
|
135
|
+
}
|
|
136
|
+
var HeldUtil;
|
|
137
|
+
(function (HeldUtil) {
|
|
138
|
+
/** A light tap of the haptic engine as a held finger comes onto something (取消, 编辑): the app's, or a phone's. */
|
|
139
|
+
function tick() {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
const haptics = (0, device_1.nativePlugin)('Haptics');
|
|
142
|
+
if (haptics) {
|
|
143
|
+
haptics('impact', { style: 'LIGHT' }).catch(() => undefined);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
(_b = (_a = globalThis.navigator) === null || _a === void 0 ? void 0 : _a.vibrate) === null || _b === void 0 ? void 0 : _b.call(_a, 8);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
HeldUtil.tick = tick;
|
|
150
|
+
/**
|
|
151
|
+
* The click that follows a finger let go after a hold: not a tap of what was under it. A browser that sends
|
|
152
|
+
* none (a long press is no tap to it) leaves the next press its own.
|
|
153
|
+
*/
|
|
154
|
+
function swallowClick() {
|
|
155
|
+
const until = Date.now() + long_press_1.LongPressUtil.CLICK_GUARD_MS;
|
|
156
|
+
const off = () => {
|
|
157
|
+
document.removeEventListener('click', swallow, true);
|
|
158
|
+
document.removeEventListener('pointerdown', off, true);
|
|
159
|
+
};
|
|
160
|
+
const swallow = (event) => {
|
|
161
|
+
off();
|
|
162
|
+
if (Date.now() < until) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
event.stopPropagation();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
document.addEventListener('click', swallow, true);
|
|
168
|
+
document.addEventListener('pointerdown', off, true);
|
|
169
|
+
setTimeout(off, long_press_1.LongPressUtil.CLICK_GUARD_MS);
|
|
170
|
+
}
|
|
171
|
+
HeldUtil.swallowClick = swallowClick;
|
|
172
|
+
})(HeldUtil || (exports.HeldUtil = HeldUtil = {}));
|
|
173
|
+
//# sourceMappingURL=hold.js.map
|
|
@@ -17,7 +17,7 @@ export interface LaunchEnvironment {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class LaunchScreen {
|
|
19
19
|
protected readonly env: LaunchEnvironment;
|
|
20
|
-
static readonly MAX =
|
|
20
|
+
static readonly MAX = 2000;
|
|
21
21
|
static readonly FADE = 320;
|
|
22
22
|
protected done: boolean;
|
|
23
23
|
protected stops: (() => void)[];
|
|
@@ -11,6 +11,8 @@ export declare namespace LongPressUtil {
|
|
|
11
11
|
const MOVE_PX = 10;
|
|
12
12
|
/** After a menu opened, the click of the finger let go is not a tap of what was under it. */
|
|
13
13
|
const CLICK_GUARD_MS = 800;
|
|
14
|
+
/** What the finger of a long press that opened a menu pressed, while it is still down. */
|
|
15
|
+
function held(): Element | undefined;
|
|
14
16
|
function moved(from: {
|
|
15
17
|
x: number;
|
|
16
18
|
y: number;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LongPressUtil = void 0;
|
|
4
4
|
exports.startLongPress = startLongPress;
|
|
5
|
+
/** What a long press that opened a menu pressed, while the finger is still down: it may slide onto an entry (ContextMenuUtil.attach). */
|
|
6
|
+
let holding;
|
|
5
7
|
/**
|
|
6
8
|
* A long press as the right click of a finger: what a right click opens (the menus of tabs, files, chats,
|
|
7
9
|
* messages) opens under a held finger too, as in the apps of a phone. iOS fires no `contextmenu` on a long
|
|
@@ -15,6 +17,11 @@ var LongPressUtil;
|
|
|
15
17
|
LongPressUtil.MOVE_PX = 10;
|
|
16
18
|
/** After a menu opened, the click of the finger let go is not a tap of what was under it. */
|
|
17
19
|
LongPressUtil.CLICK_GUARD_MS = 800;
|
|
20
|
+
/** What the finger of a long press that opened a menu pressed, while it is still down. */
|
|
21
|
+
function held() {
|
|
22
|
+
return holding;
|
|
23
|
+
}
|
|
24
|
+
LongPressUtil.held = held;
|
|
18
25
|
function moved(from, to) {
|
|
19
26
|
return Math.hypot(to.x - from.x, to.y - from.y) > LongPressUtil.MOVE_PX;
|
|
20
27
|
}
|
|
@@ -41,6 +48,7 @@ function startLongPress(doc, native) {
|
|
|
41
48
|
const end = () => {
|
|
42
49
|
var _a;
|
|
43
50
|
cancel();
|
|
51
|
+
holding = undefined;
|
|
44
52
|
if (taken) {
|
|
45
53
|
taken = false;
|
|
46
54
|
(_a = doc.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
@@ -65,6 +73,8 @@ function startLongPress(doc, native) {
|
|
|
65
73
|
return;
|
|
66
74
|
}
|
|
67
75
|
sent = true;
|
|
76
|
+
// Before the menu renders, which may be before dispatchEvent returns.
|
|
77
|
+
holding = current.target;
|
|
68
78
|
const event = new MouseEvent('contextmenu', { bubbles: true, cancelable: true, composed: true, clientX: current.x, clientY: current.y, button: 2 });
|
|
69
79
|
current.target.dispatchEvent(event);
|
|
70
80
|
if (event.defaultPrevented) {
|
|
@@ -74,11 +84,15 @@ function startLongPress(doc, native) {
|
|
|
74
84
|
(_a = doc.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
75
85
|
native === null || native === void 0 ? void 0 : native('Haptics', 'impact', { style: 'LIGHT' }).catch(() => undefined);
|
|
76
86
|
}
|
|
87
|
+
else {
|
|
88
|
+
holding = undefined;
|
|
89
|
+
}
|
|
77
90
|
};
|
|
78
91
|
const onStart = (event) => {
|
|
79
92
|
cancel();
|
|
80
93
|
sent = false;
|
|
81
94
|
taken = false;
|
|
95
|
+
holding = undefined;
|
|
82
96
|
const touch = event.touches[0];
|
|
83
97
|
const target = event.target instanceof Element ? event.target : null;
|
|
84
98
|
if (event.touches.length !== 1 || !touch || !target || LongPressUtil.native(target)) {
|
|
@@ -107,7 +121,8 @@ function startLongPress(doc, native) {
|
|
|
107
121
|
}
|
|
108
122
|
};
|
|
109
123
|
const onClick = (event) => {
|
|
110
|
-
|
|
124
|
+
// The click of the finger let go; not an entry the finger slid onto, which the menu clicks.
|
|
125
|
+
if (event.isTrusted && Date.now() < guardUntil) {
|
|
111
126
|
guardUntil = 0;
|
|
112
127
|
event.preventDefault();
|
|
113
128
|
event.stopImmediatePropagation();
|
|
@@ -40,8 +40,10 @@ export interface PullDownOptions {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Lets a finger pull the launcher down over the first tab while `enabled`. As useSheetSwipe: transforms and
|
|
43
|
-
* opacities only,
|
|
44
|
-
*
|
|
43
|
+
* opacities only, the listener that may hold a move back there only for a touch that may be a pull, the finger
|
|
44
|
+
* followed on what it touched (SwipeFinger), and let go it slides on at once as on a spring (SwipeSettle), the
|
|
45
|
+
* state following. A pull down is decided on the first move (iOS lets a scroll that started go on), only at
|
|
46
|
+
* the top of the list.
|
|
45
47
|
*/
|
|
46
48
|
export declare function usePullDown(options: PullDownOptions): void;
|
|
47
49
|
//# sourceMappingURL=pull-down.d.ts.map
|