@celljs/ta-web 4.16.0 → 4.17.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/assistant/assistant-ask-book.d.ts +35 -0
- package/esm/browser/assistant/assistant-ask-book.js +96 -0
- package/esm/browser/assistant/assistant-conversation.d.ts +110 -0
- package/esm/browser/assistant/assistant-conversation.js +351 -0
- package/esm/browser/assistant/assistant-export.js +6 -7
- package/esm/browser/assistant/assistant-extension.d.ts +3 -2
- package/esm/browser/assistant/assistant-extension.js +57 -4
- package/esm/browser/assistant/assistant-protocol.d.ts +17 -2
- package/esm/browser/assistant/assistant-role.d.ts +22 -4
- package/esm/browser/assistant/assistant-role.js +29 -7
- package/esm/browser/assistant/assistant-state.d.ts +5 -1
- package/esm/browser/assistant/assistant-state.js +11 -0
- package/esm/browser/assistant/assistant-task-source.js +7 -1
- package/esm/browser/assistant/assistant-task-util.d.ts +19 -7
- package/esm/browser/assistant/assistant-task-util.js +73 -20
- package/esm/browser/assistant/assistant-tasks.d.ts +0 -7
- package/esm/browser/assistant/assistant-tasks.js +0 -2
- package/esm/browser/assistant/assistant-thread.d.ts +22 -0
- package/esm/browser/assistant/assistant-thread.js +108 -0
- package/esm/browser/assistant/assistant-view.js +77 -126
- package/esm/browser/assistant/assistant.d.ts +33 -105
- package/esm/browser/assistant/assistant.js +103 -356
- package/esm/browser/assistant/chat-task-source.d.ts +58 -0
- package/esm/browser/assistant/chat-task-source.js +107 -0
- package/esm/browser/assistant/read-aloud.d.ts +34 -0
- package/esm/browser/assistant/read-aloud.js +98 -0
- package/esm/browser/assistant/realtime-voice.d.ts +77 -0
- package/esm/browser/assistant/realtime-voice.js +320 -0
- package/esm/browser/assistant/task-views.d.ts +2 -3
- package/esm/browser/assistant/task-views.js +20 -16
- package/esm/browser/assistant/voice-call-bar.d.ts +60 -0
- package/esm/browser/assistant/voice-call-bar.js +260 -0
- package/esm/browser/assistant/voice-call.d.ts +175 -0
- package/esm/browser/assistant/voice-call.js +366 -0
- package/esm/browser/chat/chat-shown.d.ts +78 -0
- package/esm/browser/chat/chat-shown.js +262 -0
- package/esm/browser/chat/chat-view.js +2 -1
- package/esm/browser/chat/chat.d.ts +4 -68
- package/esm/browser/chat/chat.js +5 -253
- package/esm/browser/chat/draft-model.d.ts +1 -1
- 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 +3 -1
- package/esm/browser/components/app-nav.js +7 -7
- package/esm/browser/components/app-shell-hooks.d.ts +11 -2
- package/esm/browser/components/app-shell-hooks.js +25 -4
- package/esm/browser/components/app-shell-state.d.ts +80 -0
- package/esm/browser/components/app-shell-state.js +466 -0
- package/esm/browser/components/app-view.js +121 -333
- package/esm/browser/components/asks-badge.d.ts +6 -2
- package/esm/browser/components/asks-badge.js +7 -3
- package/esm/browser/components/auth-pictures.d.ts +2 -2
- package/esm/browser/components/auth-pictures.js +13 -1
- package/esm/browser/components/auth-view.d.ts +4 -3
- package/esm/browser/components/auth-view.js +54 -5
- package/esm/browser/components/chat-asks.d.ts +2 -0
- package/esm/browser/components/chat-asks.js +8 -0
- package/esm/browser/components/chat-busy.d.ts +32 -0
- package/esm/browser/components/chat-busy.js +49 -0
- package/esm/browser/components/chat-icon.d.ts +6 -0
- package/esm/browser/components/chat-icon.js +17 -1
- package/esm/browser/components/chat-list-row.d.ts +84 -0
- package/esm/browser/components/chat-list-row.js +198 -0
- package/esm/browser/components/chat-list-util.d.ts +166 -0
- package/esm/browser/components/chat-list-util.js +335 -0
- package/esm/browser/components/chat-list.d.ts +9 -148
- package/esm/browser/components/chat-list.js +277 -513
- package/esm/browser/components/chat-seen.js +1 -0
- package/esm/browser/components/composer-addon-util.d.ts +1 -1
- package/esm/browser/components/composer-addons.d.ts +1 -1
- package/esm/browser/components/composer-attachments.d.ts +11 -0
- package/esm/browser/components/composer-attachments.js +27 -0
- package/esm/browser/components/composer-box-hooks.d.ts +9 -0
- package/esm/browser/components/composer-box-hooks.js +138 -0
- package/esm/browser/components/composer-box-protocol.d.ts +108 -0
- package/esm/browser/components/composer-box-protocol.js +2 -0
- package/esm/browser/components/composer-box.d.ts +1 -95
- package/esm/browser/components/composer-box.js +49 -156
- package/esm/browser/components/composer-target.d.ts +21 -0
- package/esm/browser/components/composer-target.js +43 -0
- package/esm/browser/components/composer.d.ts +7 -1
- package/esm/browser/components/composer.js +13 -9
- package/esm/browser/components/context-menu.js +4 -0
- package/esm/browser/components/conversation-find.d.ts +27 -0
- package/esm/browser/components/conversation-find.js +151 -0
- package/esm/browser/components/conversation-scroll-hooks.js +2 -1
- package/esm/browser/components/conversation-scroll-util.d.ts +73 -0
- package/esm/browser/components/conversation-scroll-util.js +80 -0
- package/esm/browser/components/conversation-scroll.d.ts +1 -35
- package/esm/browser/components/conversation-scroll.js +2 -81
- package/esm/browser/components/conversation-view.d.ts +8 -0
- package/esm/browser/components/conversation-view.js +41 -0
- package/esm/browser/components/discover-view.d.ts +3 -2
- package/esm/browser/components/discover-view.js +31 -26
- package/esm/browser/components/dismiss.js +2 -0
- package/esm/browser/components/earlier-messages.d.ts +2 -0
- package/esm/browser/components/earlier-messages.js +2 -1
- package/esm/browser/components/folder-picker.d.ts +7 -0
- package/esm/browser/components/folder-picker.js +89 -19
- package/esm/browser/components/gallery.d.ts +1 -1
- package/esm/browser/components/gallery.js +57 -14
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +3 -1
- package/esm/browser/components/image-menu.d.ts +11 -0
- package/esm/browser/components/image-menu.js +29 -0
- package/esm/browser/components/image-viewer.d.ts +3 -2
- package/esm/browser/components/image-viewer.js +29 -4
- package/esm/browser/components/lightbox.js +2 -0
- package/esm/browser/components/link-dialog.js +2 -0
- package/esm/browser/components/list-rows.d.ts +3 -1
- package/esm/browser/components/list-rows.js +2 -1
- package/esm/browser/components/markdown.js +5 -0
- package/esm/browser/components/media.d.ts +2 -0
- package/esm/browser/components/media.js +16 -1
- package/esm/browser/components/message-actions.d.ts +1 -1
- package/esm/browser/components/message-actions.js +9 -0
- package/esm/browser/components/message-footer.d.ts +3 -1
- package/esm/browser/components/message-footer.js +3 -2
- package/esm/browser/components/message-images.d.ts +41 -0
- package/esm/browser/components/message-images.js +120 -0
- package/esm/browser/components/message-list.d.ts +4 -100
- package/esm/browser/components/message-list.js +10 -447
- package/esm/browser/components/message-menu.js +4 -0
- package/esm/browser/components/message-steps.d.ts +21 -0
- package/esm/browser/components/message-steps.js +182 -0
- package/esm/browser/components/message-user.d.ts +54 -0
- package/esm/browser/components/message-user.js +169 -0
- package/esm/browser/components/model-picker.d.ts +1 -1
- package/esm/browser/components/model-picker.js +2 -0
- package/esm/browser/components/moved-notice.d.ts +14 -0
- package/esm/browser/components/moved-notice.js +60 -0
- package/esm/browser/components/nav-places.d.ts +12 -1
- package/esm/browser/components/nav-places.js +10 -2
- package/esm/browser/components/notice-center.js +36 -1
- package/esm/browser/components/notice-face.js +2 -1
- package/esm/browser/components/phone-shell.d.ts +4 -3
- package/esm/browser/components/phone-shell.js +60 -68
- package/esm/browser/components/plus-menu.d.ts +1 -1
- package/esm/browser/components/relay-services.d.ts +6 -1
- package/esm/browser/components/relay-services.js +109 -2
- package/esm/browser/components/relay-view.js +2 -0
- package/esm/browser/components/remote-hosts.d.ts +10 -0
- package/esm/browser/components/remote-hosts.js +7 -6
- package/esm/browser/components/remote-prompts.js +2 -0
- package/esm/browser/components/scan-screen.js +7 -0
- package/esm/browser/components/screen-navigator-util.d.ts +28 -0
- package/esm/browser/components/screen-navigator-util.js +33 -0
- package/esm/browser/components/screen-navigator.d.ts +30 -0
- package/esm/browser/components/screen-navigator.js +47 -0
- package/esm/browser/components/session-settings.d.ts +1 -1
- package/esm/browser/components/session-view.js +157 -7
- package/esm/browser/components/settings-choices.d.ts +6 -0
- package/esm/browser/components/settings-choices.js +8 -0
- package/esm/browser/components/settings-more.d.ts +7 -0
- package/esm/browser/components/settings-more.js +263 -0
- package/esm/browser/components/settings-parts.d.ts +8 -3
- package/esm/browser/components/settings-parts.js +31 -249
- package/esm/browser/components/settings-view.js +43 -15
- package/esm/browser/components/stop-times.js +1 -0
- package/esm/browser/components/surface-flyout.js +2 -0
- package/esm/browser/components/unseen-drop.d.ts +10 -4
- package/esm/browser/components/unseen-drop.js +9 -8
- package/esm/browser/components/use-seen-chats.js +1 -1
- package/esm/browser/components/voice-services.d.ts +6 -0
- package/esm/browser/components/voice-services.js +137 -0
- package/esm/browser/components/voice-talk.d.ts +23 -6
- package/esm/browser/components/voice-talk.js +46 -11
- package/esm/browser/components/web-composer.d.ts +1 -1
- package/esm/browser/components/web-composer.js +2 -2
- package/esm/browser/components/web-dialog.js +2 -0
- package/esm/browser/device/back-stack.d.ts +89 -11
- package/esm/browser/device/back-stack.js +200 -29
- package/esm/browser/device/device-protocol.d.ts +1 -1
- package/esm/browser/device/device-protocol.js +1 -1
- package/esm/browser/device/own-gestures.d.ts +1 -1
- package/esm/browser/device/pull-down.js +3 -1
- package/esm/browser/device/row-swipe.js +3 -1
- package/esm/browser/device/sheet-swipe.d.ts +1 -179
- package/esm/browser/device/sheet-swipe.js +3 -433
- package/esm/browser/device/swipe-finger.d.ts +31 -0
- package/esm/browser/device/swipe-finger.js +83 -0
- package/esm/browser/device/swipe-settle.d.ts +52 -0
- package/esm/browser/device/swipe-settle.js +170 -0
- package/esm/browser/device/swipe-util.d.ts +97 -0
- package/esm/browser/device/swipe-util.js +183 -0
- package/esm/browser/drafts/drafts-protocol.d.ts +58 -0
- package/esm/browser/drafts/drafts-protocol.js +75 -0
- package/esm/browser/drafts/drafts.d.ts +21 -0
- package/esm/browser/drafts/drafts.js +91 -0
- package/esm/browser/drafts/use-composer-draft.d.ts +20 -0
- package/esm/browser/drafts/use-composer-draft.js +108 -0
- package/esm/browser/extension/icons.js +3 -1
- package/esm/browser/extension/web-api-components.d.ts +13 -0
- package/esm/browser/extension/web-api-contributions.d.ts +125 -0
- package/esm/browser/extension/web-extension-api.d.ts +88 -5
- package/esm/browser/extension/web-extension-context.d.ts +5 -0
- package/esm/browser/extension/web-extension-context.js +60 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +19 -1
- package/esm/browser/extension/web-extension-protocol.js +3 -0
- package/esm/browser/extension/web-extension-run.d.ts +5 -2
- package/esm/browser/extension/web-extension-run.js +13 -1
- package/esm/browser/extension/web-extensions-running.d.ts +93 -0
- package/esm/browser/extension/web-extensions-running.js +339 -0
- package/esm/browser/extension/web-extensions.d.ts +6 -82
- package/esm/browser/extension/web-extensions.js +10 -319
- package/esm/browser/extension/web-pages.js +1 -0
- package/esm/browser/extension/web-session-notices.js +6 -1
- package/esm/browser/extension/web-tasks.d.ts +2 -0
- package/esm/browser/extension/web-tasks.js +6 -0
- package/esm/browser/extension/web-view-util.d.ts +2 -1
- package/esm/browser/extension/web-view-util.js +4 -1
- package/esm/browser/gateway/console-parts.d.ts +1 -11
- package/esm/browser/gateway/console-parts.js +38 -128
- package/esm/browser/gateway/console-tenant.js +2 -1
- package/esm/browser/gateway/console-trend.d.ts +11 -0
- package/esm/browser/gateway/console-trend.js +115 -0
- package/esm/browser/gateway/console-view.js +39 -1
- package/esm/browser/i18n/locales.d.ts +143 -6
- package/esm/browser/i18n/messages-ja.js +144 -7
- package/esm/browser/i18n/messages-zh-tw.js +144 -7
- package/esm/browser/i18n/messages.d.ts +140 -3
- package/esm/browser/i18n/messages.js +288 -14
- package/esm/browser/index.d.ts +17 -0
- package/esm/browser/index.js +17 -0
- package/esm/browser/notices/notices-protocol.d.ts +12 -0
- package/esm/browser/notices/notices.js +7 -4
- package/esm/browser/offline/device-values.d.ts +2 -0
- package/esm/browser/offline/device-values.js +6 -1
- package/esm/browser/screen/page-answers.d.ts +42 -0
- package/esm/browser/screen/page-answers.js +89 -0
- package/esm/browser/screen/screen-protocol.d.ts +112 -0
- package/esm/browser/screen/screen-protocol.js +45 -0
- package/esm/browser/screen/screen.d.ts +20 -0
- package/esm/browser/screen/screen.js +122 -0
- package/esm/browser/screen/use-screen-part.d.ts +6 -0
- package/esm/browser/screen/use-screen-part.js +14 -0
- package/esm/browser/settings/settings-protocol.d.ts +5 -1
- package/esm/browser/settings/settings-protocol.js +6 -2
- package/esm/browser/share/shared-extensions.d.ts +29 -0
- package/esm/browser/share/shared-extensions.js +145 -0
- package/esm/browser/share/shared-link.d.ts +11 -0
- package/esm/browser/share/shared-link.js +38 -0
- package/esm/browser/share/shared-page.d.ts +5 -0
- package/esm/browser/share/shared-page.js +137 -0
- package/esm/browser/state/state-protocol.d.ts +14 -0
- package/esm/browser/state/state-protocol.js +18 -0
- package/esm/browser/state/state.d.ts +10 -2
- package/esm/browser/state/state.js +19 -3
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +4 -0
- package/esm/browser/style/chat-list.d.ts +2 -0
- package/esm/browser/style/chat-list.js +153 -0
- package/esm/browser/style/conversation-column.d.ts +2 -0
- package/esm/browser/style/conversation-column.js +250 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +24 -8
- package/esm/browser/style/dialogs.d.ts +2 -0
- package/esm/browser/style/dialogs.js +163 -0
- package/esm/browser/style/layout.d.ts +2 -2
- package/esm/browser/style/layout.js +1 -525
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +9 -3
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +6 -2
- package/esm/browser/style/shared.d.ts +2 -0
- package/esm/browser/style/shared.js +23 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +47 -0
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +13 -8
- package/esm/browser/style.js +8 -0
- package/esm/browser/util/gallery.d.ts +24 -2
- package/esm/browser/util/gallery.js +82 -2
- package/esm/browser/util/image-copy.d.ts +16 -0
- package/esm/browser/util/image-copy.js +57 -0
- package/esm/browser/util/message.d.ts +5 -0
- package/esm/browser/util/message.js +14 -0
- package/esm/browser/util/process.d.ts +6 -2
- package/esm/browser/util/process.js +6 -2
- package/esm/browser/util/spoken.d.ts +24 -0
- package/esm/browser/util/spoken.js +83 -0
- package/esm/browser/util/transcript.d.ts +22 -0
- package/esm/browser/util/transcript.js +46 -0
- package/esm/browser/util/voice.d.ts +5 -1
- package/esm/browser/util/voice.js +6 -1
- package/esm/browser/workbench-hosts.d.ts +36 -0
- package/esm/browser/workbench-hosts.js +120 -0
- package/esm/browser/workbench-lists.d.ts +33 -0
- package/esm/browser/workbench-lists.js +128 -0
- package/esm/browser/workbench-protocol.d.ts +14 -1
- package/esm/browser/workbench-services.d.ts +49 -0
- package/esm/browser/workbench-services.js +120 -0
- package/esm/browser/workbench-util.d.ts +1 -1
- package/esm/browser/workbench.d.ts +6 -89
- package/esm/browser/workbench.js +26 -336
- package/lib/browser/assistant/assistant-ask-book.d.ts +36 -0
- package/lib/browser/assistant/assistant-ask-book.js +100 -0
- package/lib/browser/assistant/assistant-conversation.d.ts +111 -0
- package/lib/browser/assistant/assistant-conversation.js +355 -0
- package/lib/browser/assistant/assistant-export.js +6 -7
- package/lib/browser/assistant/assistant-extension.d.ts +3 -2
- package/lib/browser/assistant/assistant-extension.js +55 -2
- package/lib/browser/assistant/assistant-protocol.d.ts +17 -2
- package/lib/browser/assistant/assistant-role.d.ts +22 -4
- package/lib/browser/assistant/assistant-role.js +30 -8
- package/lib/browser/assistant/assistant-state.d.ts +5 -1
- package/lib/browser/assistant/assistant-state.js +11 -0
- package/lib/browser/assistant/assistant-task-source.js +7 -1
- package/lib/browser/assistant/assistant-task-util.d.ts +19 -7
- package/lib/browser/assistant/assistant-task-util.js +73 -20
- package/lib/browser/assistant/assistant-tasks.d.ts +0 -7
- package/lib/browser/assistant/assistant-tasks.js +1 -3
- package/lib/browser/assistant/assistant-thread.d.ts +23 -0
- package/lib/browser/assistant/assistant-thread.js +144 -0
- package/lib/browser/assistant/assistant-view.js +74 -123
- package/lib/browser/assistant/assistant.d.ts +33 -105
- package/lib/browser/assistant/assistant.js +100 -353
- package/lib/browser/assistant/chat-task-source.d.ts +59 -0
- package/lib/browser/assistant/chat-task-source.js +111 -0
- package/lib/browser/assistant/read-aloud.d.ts +35 -0
- package/lib/browser/assistant/read-aloud.js +102 -0
- package/lib/browser/assistant/realtime-voice.d.ts +78 -0
- package/lib/browser/assistant/realtime-voice.js +324 -0
- package/lib/browser/assistant/task-views.d.ts +2 -3
- package/lib/browser/assistant/task-views.js +19 -15
- package/lib/browser/assistant/voice-call-bar.d.ts +61 -0
- package/lib/browser/assistant/voice-call-bar.js +306 -0
- package/lib/browser/assistant/voice-call.d.ts +176 -0
- package/lib/browser/assistant/voice-call.js +370 -0
- package/lib/browser/chat/chat-shown.d.ts +79 -0
- package/lib/browser/chat/chat-shown.js +266 -0
- package/lib/browser/chat/chat-view.js +2 -1
- package/lib/browser/chat/chat.d.ts +4 -68
- package/lib/browser/chat/chat.js +3 -251
- package/lib/browser/chat/draft-model.d.ts +1 -1
- package/lib/browser/components/access-view.js +2 -2
- package/lib/browser/components/account-menu.js +1 -1
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +7 -7
- package/lib/browser/components/app-shell-hooks.d.ts +11 -2
- package/lib/browser/components/app-shell-hooks.js +26 -5
- package/lib/browser/components/app-shell-state.d.ts +81 -0
- package/lib/browser/components/app-shell-state.js +502 -0
- package/lib/browser/components/app-view.js +114 -326
- package/lib/browser/components/asks-badge.d.ts +6 -2
- package/lib/browser/components/asks-badge.js +7 -3
- package/lib/browser/components/auth-pictures.d.ts +2 -2
- package/lib/browser/components/auth-pictures.js +13 -1
- package/lib/browser/components/auth-view.d.ts +4 -3
- package/lib/browser/components/auth-view.js +53 -4
- package/lib/browser/components/chat-asks.d.ts +2 -0
- package/lib/browser/components/chat-asks.js +8 -0
- package/lib/browser/components/chat-busy.d.ts +33 -0
- package/lib/browser/components/chat-busy.js +52 -0
- package/lib/browser/components/chat-icon.d.ts +6 -0
- package/lib/browser/components/chat-icon.js +17 -1
- package/lib/browser/components/chat-list-row.d.ts +85 -0
- package/lib/browser/components/chat-list-row.js +236 -0
- package/lib/browser/components/chat-list-util.d.ts +167 -0
- package/lib/browser/components/chat-list-util.js +338 -0
- package/lib/browser/components/chat-list.d.ts +9 -148
- package/lib/browser/components/chat-list.js +294 -532
- package/lib/browser/components/chat-seen.js +1 -0
- package/lib/browser/components/composer-addon-util.d.ts +1 -1
- package/lib/browser/components/composer-addons.d.ts +1 -1
- package/lib/browser/components/composer-attachments.d.ts +12 -0
- package/lib/browser/components/composer-attachments.js +64 -0
- package/lib/browser/components/composer-box-hooks.d.ts +10 -0
- package/lib/browser/components/composer-box-hooks.js +178 -0
- package/lib/browser/components/composer-box-protocol.d.ts +109 -0
- package/lib/browser/components/composer-box-protocol.js +3 -0
- package/lib/browser/components/composer-box.d.ts +1 -95
- package/lib/browser/components/composer-box.js +51 -159
- package/lib/browser/components/composer-target.d.ts +22 -0
- package/lib/browser/components/composer-target.js +46 -0
- package/lib/browser/components/composer.d.ts +7 -1
- package/lib/browser/components/composer.js +15 -11
- package/lib/browser/components/context-menu.js +4 -0
- package/lib/browser/components/conversation-find.d.ts +28 -0
- package/lib/browser/components/conversation-find.js +188 -0
- package/lib/browser/components/conversation-scroll-hooks.js +3 -2
- package/lib/browser/components/conversation-scroll-util.d.ts +73 -0
- package/lib/browser/components/conversation-scroll-util.js +85 -1
- package/lib/browser/components/conversation-scroll.d.ts +1 -35
- package/lib/browser/components/conversation-scroll.js +20 -100
- package/lib/browser/components/conversation-view.d.ts +9 -0
- package/lib/browser/components/conversation-view.js +77 -0
- package/lib/browser/components/discover-view.d.ts +3 -2
- package/lib/browser/components/discover-view.js +30 -25
- package/lib/browser/components/dismiss.js +2 -0
- package/lib/browser/components/earlier-messages.d.ts +2 -0
- package/lib/browser/components/earlier-messages.js +2 -1
- package/lib/browser/components/folder-picker.d.ts +7 -0
- package/lib/browser/components/folder-picker.js +88 -18
- package/lib/browser/components/gallery.d.ts +1 -1
- package/lib/browser/components/gallery.js +56 -13
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +4 -2
- package/lib/browser/components/image-menu.d.ts +12 -0
- package/lib/browser/components/image-menu.js +65 -0
- package/lib/browser/components/image-viewer.d.ts +3 -2
- package/lib/browser/components/image-viewer.js +28 -3
- package/lib/browser/components/lightbox.js +2 -0
- package/lib/browser/components/link-dialog.js +2 -0
- package/lib/browser/components/list-rows.d.ts +3 -1
- package/lib/browser/components/list-rows.js +2 -1
- package/lib/browser/components/markdown.js +5 -0
- package/lib/browser/components/media.d.ts +2 -0
- package/lib/browser/components/media.js +17 -1
- package/lib/browser/components/message-actions.d.ts +1 -1
- package/lib/browser/components/message-actions.js +9 -0
- package/lib/browser/components/message-footer.d.ts +3 -1
- package/lib/browser/components/message-footer.js +2 -1
- package/lib/browser/components/message-images.d.ts +42 -0
- package/lib/browser/components/message-images.js +157 -0
- package/lib/browser/components/message-list.d.ts +4 -100
- package/lib/browser/components/message-list.js +11 -455
- package/lib/browser/components/message-menu.js +4 -0
- package/lib/browser/components/message-steps.d.ts +22 -0
- package/lib/browser/components/message-steps.js +218 -0
- package/lib/browser/components/message-user.d.ts +55 -0
- package/lib/browser/components/message-user.js +211 -0
- package/lib/browser/components/model-picker.d.ts +1 -1
- package/lib/browser/components/model-picker.js +2 -0
- package/lib/browser/components/moved-notice.d.ts +15 -0
- package/lib/browser/components/moved-notice.js +96 -0
- package/lib/browser/components/nav-places.d.ts +12 -1
- package/lib/browser/components/nav-places.js +12 -3
- package/lib/browser/components/notice-center.js +35 -0
- package/lib/browser/components/notice-face.js +7 -6
- package/lib/browser/components/phone-shell.d.ts +4 -3
- package/lib/browser/components/phone-shell.js +59 -67
- package/lib/browser/components/plus-menu.d.ts +1 -1
- package/lib/browser/components/relay-services.d.ts +6 -1
- package/lib/browser/components/relay-services.js +107 -0
- package/lib/browser/components/relay-view.js +2 -0
- package/lib/browser/components/remote-hosts.d.ts +10 -0
- package/lib/browser/components/remote-hosts.js +8 -6
- package/lib/browser/components/remote-prompts.js +2 -0
- package/lib/browser/components/scan-screen.js +7 -0
- package/lib/browser/components/screen-navigator-util.d.ts +29 -0
- package/lib/browser/components/screen-navigator-util.js +36 -0
- package/lib/browser/components/screen-navigator.d.ts +31 -0
- package/lib/browser/components/screen-navigator.js +83 -0
- package/lib/browser/components/session-settings.d.ts +1 -1
- package/lib/browser/components/session-view.js +157 -7
- package/lib/browser/components/settings-choices.d.ts +7 -1
- package/lib/browser/components/settings-choices.js +9 -1
- package/lib/browser/components/settings-more.d.ts +8 -0
- package/lib/browser/components/settings-more.js +299 -0
- package/lib/browser/components/settings-parts.d.ts +8 -3
- package/lib/browser/components/settings-parts.js +27 -245
- package/lib/browser/components/settings-view.js +43 -15
- package/lib/browser/components/stop-times.js +1 -0
- package/lib/browser/components/surface-flyout.js +2 -0
- package/lib/browser/components/unseen-drop.d.ts +10 -4
- package/lib/browser/components/unseen-drop.js +9 -8
- package/lib/browser/components/use-seen-chats.js +2 -2
- package/lib/browser/components/voice-services.d.ts +7 -0
- package/lib/browser/components/voice-services.js +173 -0
- package/lib/browser/components/voice-talk.d.ts +23 -6
- package/lib/browser/components/voice-talk.js +45 -10
- package/lib/browser/components/web-composer.d.ts +1 -1
- package/lib/browser/components/web-composer.js +2 -2
- package/lib/browser/components/web-dialog.js +2 -0
- package/lib/browser/device/back-stack.d.ts +89 -11
- package/lib/browser/device/back-stack.js +205 -31
- package/lib/browser/device/device-protocol.d.ts +1 -1
- package/lib/browser/device/device-protocol.js +1 -1
- package/lib/browser/device/own-gestures.d.ts +1 -1
- package/lib/browser/device/pull-down.js +8 -6
- package/lib/browser/device/row-swipe.js +11 -9
- package/lib/browser/device/sheet-swipe.d.ts +1 -179
- package/lib/browser/device/sheet-swipe.js +16 -452
- package/lib/browser/device/swipe-finger.d.ts +32 -0
- package/lib/browser/device/swipe-finger.js +87 -0
- package/lib/browser/device/swipe-settle.d.ts +53 -0
- package/lib/browser/device/swipe-settle.js +176 -0
- package/lib/browser/device/swipe-util.d.ts +98 -0
- package/lib/browser/device/swipe-util.js +187 -0
- package/lib/browser/drafts/drafts-protocol.d.ts +59 -0
- package/lib/browser/drafts/drafts-protocol.js +78 -0
- package/lib/browser/drafts/drafts.d.ts +22 -0
- package/lib/browser/drafts/drafts.js +94 -0
- package/lib/browser/drafts/use-composer-draft.d.ts +21 -0
- package/lib/browser/drafts/use-composer-draft.js +146 -0
- package/lib/browser/extension/icons.js +2 -0
- package/lib/browser/extension/web-api-components.d.ts +13 -0
- package/lib/browser/extension/web-api-contributions.d.ts +125 -0
- package/lib/browser/extension/web-extension-api.d.ts +88 -5
- package/lib/browser/extension/web-extension-context.d.ts +5 -0
- package/lib/browser/extension/web-extension-context.js +62 -9
- package/lib/browser/extension/web-extension-protocol.d.ts +19 -1
- package/lib/browser/extension/web-extension-protocol.js +3 -0
- package/lib/browser/extension/web-extension-run.d.ts +5 -2
- package/lib/browser/extension/web-extension-run.js +13 -1
- package/lib/browser/extension/web-extensions-running.d.ts +94 -0
- package/lib/browser/extension/web-extensions-running.js +343 -0
- package/lib/browser/extension/web-extensions.d.ts +6 -82
- package/lib/browser/extension/web-extensions.js +7 -316
- package/lib/browser/extension/web-pages.js +1 -0
- package/lib/browser/extension/web-session-notices.js +8 -3
- package/lib/browser/extension/web-tasks.d.ts +2 -0
- package/lib/browser/extension/web-tasks.js +6 -0
- package/lib/browser/extension/web-view-util.d.ts +2 -1
- package/lib/browser/extension/web-view-util.js +4 -1
- package/lib/browser/gateway/console-parts.d.ts +1 -11
- package/lib/browser/gateway/console-parts.js +38 -129
- package/lib/browser/gateway/console-tenant.js +2 -1
- package/lib/browser/gateway/console-trend.d.ts +12 -0
- package/lib/browser/gateway/console-trend.js +151 -0
- package/lib/browser/gateway/console-view.js +39 -1
- package/lib/browser/i18n/locales.d.ts +143 -6
- package/lib/browser/i18n/messages-ja.js +144 -7
- package/lib/browser/i18n/messages-zh-tw.js +144 -7
- package/lib/browser/i18n/messages.d.ts +140 -3
- package/lib/browser/i18n/messages.js +288 -14
- package/lib/browser/index.d.ts +17 -0
- package/lib/browser/index.js +17 -0
- package/lib/browser/notices/notices-protocol.d.ts +12 -0
- package/lib/browser/notices/notices.js +7 -4
- package/lib/browser/offline/device-values.d.ts +2 -0
- package/lib/browser/offline/device-values.js +6 -1
- package/lib/browser/screen/page-answers.d.ts +43 -0
- package/lib/browser/screen/page-answers.js +93 -0
- package/lib/browser/screen/screen-protocol.d.ts +113 -0
- package/lib/browser/screen/screen-protocol.js +48 -0
- package/lib/browser/screen/screen.d.ts +21 -0
- package/lib/browser/screen/screen.js +125 -0
- package/lib/browser/screen/use-screen-part.d.ts +7 -0
- package/lib/browser/screen/use-screen-part.js +50 -0
- package/lib/browser/settings/settings-protocol.d.ts +5 -1
- package/lib/browser/settings/settings-protocol.js +5 -1
- package/lib/browser/share/shared-extensions.d.ts +30 -0
- package/lib/browser/share/shared-extensions.js +181 -0
- package/lib/browser/share/shared-link.d.ts +12 -0
- package/lib/browser/share/shared-link.js +41 -0
- package/lib/browser/share/shared-page.d.ts +6 -0
- package/lib/browser/share/shared-page.js +173 -0
- package/lib/browser/state/state-protocol.d.ts +14 -0
- package/lib/browser/state/state-protocol.js +20 -1
- package/lib/browser/state/state.d.ts +10 -2
- package/lib/browser/state/state.js +18 -2
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +4 -0
- package/lib/browser/style/chat-list.d.ts +3 -0
- package/lib/browser/style/chat-list.js +156 -0
- package/lib/browser/style/conversation-column.d.ts +3 -0
- package/lib/browser/style/conversation-column.js +253 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +24 -8
- package/lib/browser/style/dialogs.d.ts +3 -0
- package/lib/browser/style/dialogs.js +166 -0
- package/lib/browser/style/layout.d.ts +2 -2
- package/lib/browser/style/layout.js +1 -525
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +9 -3
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +7 -3
- package/lib/browser/style/shared.d.ts +3 -0
- package/lib/browser/style/shared.js +26 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +47 -0
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +13 -8
- package/lib/browser/style.js +8 -0
- package/lib/browser/util/gallery.d.ts +24 -2
- package/lib/browser/util/gallery.js +82 -2
- package/lib/browser/util/image-copy.d.ts +17 -0
- package/lib/browser/util/image-copy.js +60 -0
- package/lib/browser/util/message.d.ts +5 -0
- package/lib/browser/util/message.js +14 -0
- package/lib/browser/util/process.d.ts +6 -2
- package/lib/browser/util/process.js +6 -2
- package/lib/browser/util/spoken.d.ts +25 -0
- package/lib/browser/util/spoken.js +86 -0
- package/lib/browser/util/transcript.d.ts +23 -0
- package/lib/browser/util/transcript.js +49 -0
- package/lib/browser/util/voice.d.ts +5 -1
- package/lib/browser/util/voice.js +6 -1
- package/lib/browser/workbench-hosts.d.ts +37 -0
- package/lib/browser/workbench-hosts.js +124 -0
- package/lib/browser/workbench-lists.d.ts +34 -0
- package/lib/browser/workbench-lists.js +132 -0
- package/lib/browser/workbench-protocol.d.ts +14 -1
- package/lib/browser/workbench-services.d.ts +50 -0
- package/lib/browser/workbench-services.js +124 -0
- package/lib/browser/workbench-util.d.ts +1 -1
- package/lib/browser/workbench.d.ts +6 -89
- package/lib/browser/workbench.js +23 -333
- package/package.json +7 -7
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SwipeMotion } from './swipe-util';
|
|
2
|
+
/** What an element let go goes to: a transform, an opacity. */
|
|
3
|
+
export interface SettleTarget {
|
|
4
|
+
element: HTMLElement | null | undefined;
|
|
5
|
+
transform?: string;
|
|
6
|
+
opacity?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The elements a finger moves, then lets go (SwipeMotion): while it moves them their styles do not slide
|
|
10
|
+
* them; let go, they slide on to where they rest with transitions of their own, and only once they are there,
|
|
11
|
+
* and the state has them there too (`ready`), they are their styles' again. So the slide starts in the frame
|
|
12
|
+
* the finger lets go, before the page draws what the state changed (which may take a while: a long
|
|
13
|
+
* conversation), and never jumps if it takes longer than the slide. A finger that takes one of them again, or
|
|
14
|
+
* another swipe that moves it, stops it where it is now.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SwipeSettle {
|
|
17
|
+
/** How long it waits for the state, past the slide, before giving the elements back anyway. */
|
|
18
|
+
static readonly READY_MS = 1000;
|
|
19
|
+
protected readonly elements: Set<HTMLElement>;
|
|
20
|
+
protected timer?: ReturnType<typeof setTimeout>;
|
|
21
|
+
protected done?: () => void;
|
|
22
|
+
/** Whether some of its elements are still its own: moved, or sliding on. */
|
|
23
|
+
get busy(): boolean;
|
|
24
|
+
/** A finger moves these: each stops where it is, whatever slid it, and its style no longer slides it. */
|
|
25
|
+
hold(elements: (HTMLElement | null | undefined)[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Let go, each slides on to its target as `motion` says; once there and `ready()`, they are their styles'
|
|
28
|
+
* again and `done` runs.
|
|
29
|
+
*/
|
|
30
|
+
run(motion: SwipeMotion, targets: SettleTarget[], ready: () => boolean, done?: () => void): void;
|
|
31
|
+
/** They are their styles' again at once, where those say they rest, without sliding there. */
|
|
32
|
+
finish(): void;
|
|
33
|
+
/** They are their styles' again from where they are now: the styles slide them on to where they rest. */
|
|
34
|
+
release(): void;
|
|
35
|
+
protected giveBack(slide: boolean): void;
|
|
36
|
+
protected static clean(element: HTMLElement, holder: SwipeSettle): void;
|
|
37
|
+
/** Takes `element` from the settle that has it, stopped where it is. */
|
|
38
|
+
protected take(element: HTMLElement): void;
|
|
39
|
+
/** What slides stops where it is now. */
|
|
40
|
+
protected freeze(element: HTMLElement): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What a swipe let go changes in the state of the page, once the frame it was let go in is drawn and its slide
|
|
44
|
+
* set off (FrameUtil.painted), or after a while where frames are not drawn (a page out of sight); only if it
|
|
45
|
+
* changes something: the workbench is put away by the same call that brings it out.
|
|
46
|
+
*/
|
|
47
|
+
export declare function afterLetGo(open: boolean, current: () => {
|
|
48
|
+
open: boolean;
|
|
49
|
+
setOpen(open: boolean): void;
|
|
50
|
+
}): void;
|
|
51
|
+
/** Where `element` is moved along `axis` now, by its transform: wherever a style or a slide has it. */
|
|
52
|
+
export declare function translated(element: HTMLElement, axis?: 'x' | 'y'): number;
|
|
53
|
+
//# sourceMappingURL=swipe-settle.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwipeSettle = void 0;
|
|
4
|
+
exports.afterLetGo = afterLetGo;
|
|
5
|
+
exports.translated = translated;
|
|
6
|
+
const frame_1 = require("../util/frame");
|
|
7
|
+
/** The settle that holds an element now: one at a time, so that a finger that takes it stops whatever slid it. */
|
|
8
|
+
const holders = new WeakMap();
|
|
9
|
+
/**
|
|
10
|
+
* The elements a finger moves, then lets go (SwipeMotion): while it moves them their styles do not slide
|
|
11
|
+
* them; let go, they slide on to where they rest with transitions of their own, and only once they are there,
|
|
12
|
+
* and the state has them there too (`ready`), they are their styles' again. So the slide starts in the frame
|
|
13
|
+
* the finger lets go, before the page draws what the state changed (which may take a while: a long
|
|
14
|
+
* conversation), and never jumps if it takes longer than the slide. A finger that takes one of them again, or
|
|
15
|
+
* another swipe that moves it, stops it where it is now.
|
|
16
|
+
*/
|
|
17
|
+
class SwipeSettle {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.elements = new Set();
|
|
20
|
+
}
|
|
21
|
+
/** Whether some of its elements are still its own: moved, or sliding on. */
|
|
22
|
+
get busy() {
|
|
23
|
+
return this.elements.size > 0;
|
|
24
|
+
}
|
|
25
|
+
/** A finger moves these: each stops where it is, whatever slid it, and its style no longer slides it. */
|
|
26
|
+
hold(elements) {
|
|
27
|
+
clearTimeout(this.timer);
|
|
28
|
+
this.done = undefined;
|
|
29
|
+
for (const element of elements) {
|
|
30
|
+
if (element) {
|
|
31
|
+
this.take(element);
|
|
32
|
+
element.style.transition = 'none';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Let go, each slides on to its target as `motion` says; once there and `ready()`, they are their styles'
|
|
38
|
+
* again and `done` runs.
|
|
39
|
+
*/
|
|
40
|
+
run(motion, targets, ready, done) {
|
|
41
|
+
clearTimeout(this.timer);
|
|
42
|
+
const transition = motion.ms > 0 ? `transform ${motion.ms}ms ${motion.easing}, opacity ${motion.ms}ms ${motion.easing}` : 'none';
|
|
43
|
+
for (const { element, transform, opacity } of targets) {
|
|
44
|
+
if (!element) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
this.take(element);
|
|
48
|
+
element.style.transition = transition;
|
|
49
|
+
if (transform !== undefined) {
|
|
50
|
+
element.style.transform = transform;
|
|
51
|
+
}
|
|
52
|
+
if (opacity !== undefined) {
|
|
53
|
+
element.style.opacity = String(opacity);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
this.done = done;
|
|
57
|
+
const until = Date.now() + motion.ms + SwipeSettle.READY_MS;
|
|
58
|
+
const check = () => {
|
|
59
|
+
if (ready() || Date.now() > until) {
|
|
60
|
+
this.finish();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.timer = setTimeout(check, 32);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
this.timer = setTimeout(check, motion.ms + 16);
|
|
67
|
+
}
|
|
68
|
+
/** They are their styles' again at once, where those say they rest, without sliding there. */
|
|
69
|
+
finish() {
|
|
70
|
+
this.giveBack(false);
|
|
71
|
+
}
|
|
72
|
+
/** They are their styles' again from where they are now: the styles slide them on to where they rest. */
|
|
73
|
+
release() {
|
|
74
|
+
this.giveBack(true);
|
|
75
|
+
}
|
|
76
|
+
giveBack(slide) {
|
|
77
|
+
clearTimeout(this.timer);
|
|
78
|
+
const elements = [...this.elements];
|
|
79
|
+
this.elements.clear();
|
|
80
|
+
const done = this.done;
|
|
81
|
+
this.done = undefined;
|
|
82
|
+
if (slide) {
|
|
83
|
+
for (const element of elements) {
|
|
84
|
+
this.freeze(element);
|
|
85
|
+
}
|
|
86
|
+
// Where they are now is where the styles slide them from.
|
|
87
|
+
if (elements.length) {
|
|
88
|
+
void getComputedStyle(elements[0]).transform;
|
|
89
|
+
}
|
|
90
|
+
done === null || done === void 0 ? void 0 : done();
|
|
91
|
+
for (const element of elements) {
|
|
92
|
+
SwipeSettle.clean(element, this);
|
|
93
|
+
element.style.removeProperty('transition');
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
for (const element of elements) {
|
|
98
|
+
element.style.transition = 'none';
|
|
99
|
+
SwipeSettle.clean(element, this);
|
|
100
|
+
}
|
|
101
|
+
done === null || done === void 0 ? void 0 : done();
|
|
102
|
+
// Where they rest is drawn with no transition, then theirs are the styles' again.
|
|
103
|
+
if (elements.length) {
|
|
104
|
+
void getComputedStyle(elements[0]).transform;
|
|
105
|
+
}
|
|
106
|
+
for (const element of elements) {
|
|
107
|
+
element.style.removeProperty('transition');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
static clean(element, holder) {
|
|
111
|
+
if (holders.get(element) === holder) {
|
|
112
|
+
holders.delete(element);
|
|
113
|
+
}
|
|
114
|
+
element.style.removeProperty('transform');
|
|
115
|
+
element.style.removeProperty('opacity');
|
|
116
|
+
element.style.removeProperty('visibility');
|
|
117
|
+
}
|
|
118
|
+
/** Takes `element` from the settle that has it, stopped where it is. */
|
|
119
|
+
take(element) {
|
|
120
|
+
const holder = holders.get(element);
|
|
121
|
+
if (holder && holder !== this) {
|
|
122
|
+
holder.elements.delete(element);
|
|
123
|
+
}
|
|
124
|
+
if (holder) {
|
|
125
|
+
this.freeze(element);
|
|
126
|
+
}
|
|
127
|
+
holders.set(element, this);
|
|
128
|
+
this.elements.add(element);
|
|
129
|
+
}
|
|
130
|
+
/** What slides stops where it is now. */
|
|
131
|
+
freeze(element) {
|
|
132
|
+
const transition = element.style.transition;
|
|
133
|
+
if (!transition || transition === 'none') {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const style = getComputedStyle(element);
|
|
137
|
+
if (element.style.transform) {
|
|
138
|
+
element.style.transform = style.transform;
|
|
139
|
+
}
|
|
140
|
+
if (element.style.opacity) {
|
|
141
|
+
element.style.opacity = style.opacity;
|
|
142
|
+
}
|
|
143
|
+
element.style.transition = 'none';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.SwipeSettle = SwipeSettle;
|
|
147
|
+
/** How long it waits for the state, past the slide, before giving the elements back anyway. */
|
|
148
|
+
SwipeSettle.READY_MS = 1000;
|
|
149
|
+
/**
|
|
150
|
+
* What a swipe let go changes in the state of the page, once the frame it was let go in is drawn and its slide
|
|
151
|
+
* set off (FrameUtil.painted), or after a while where frames are not drawn (a page out of sight); only if it
|
|
152
|
+
* changes something: the workbench is put away by the same call that brings it out.
|
|
153
|
+
*/
|
|
154
|
+
function afterLetGo(open, current) {
|
|
155
|
+
let called = false;
|
|
156
|
+
const call = () => {
|
|
157
|
+
if (!called) {
|
|
158
|
+
called = true;
|
|
159
|
+
if (current().open !== open) {
|
|
160
|
+
current().setOpen(open);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
void frame_1.FrameUtil.painted().then(call);
|
|
165
|
+
setTimeout(call, 100);
|
|
166
|
+
}
|
|
167
|
+
/** Where `element` is moved along `axis` now, by its transform: wherever a style or a slide has it. */
|
|
168
|
+
function translated(element, axis = 'x') {
|
|
169
|
+
const transform = getComputedStyle(element).transform;
|
|
170
|
+
if (!transform || transform === 'none') {
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
const matrix = new DOMMatrixReadOnly(transform);
|
|
174
|
+
return axis === 'x' ? matrix.m41 : matrix.m42;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=swipe-settle.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** Where and when a finger was. */
|
|
2
|
+
export interface TouchPoint {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
t: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A sheet the finger slides, as in the apps of a phone: the navigation drawer from the left, the screen of a
|
|
9
|
+
* conversation and the workbench from the right. `side` is where it comes from; `opensFrom` and `closesFrom`
|
|
10
|
+
* where a swipe may start: the edge the finger moves away from (the left edge for a swipe to the right, the
|
|
11
|
+
* back of iOS), anywhere, or never.
|
|
12
|
+
*/
|
|
13
|
+
export interface SheetSwipe {
|
|
14
|
+
side: 'left' | 'right';
|
|
15
|
+
opensFrom: 'edge' | 'anywhere' | 'never';
|
|
16
|
+
closesFrom: 'edge' | 'anywhere' | 'never';
|
|
17
|
+
}
|
|
18
|
+
/** It follows the finger and, let go, ends where it was flicked to, or the nearer side. Pure, for the tests. */
|
|
19
|
+
export declare namespace SwipeUtil {
|
|
20
|
+
/** A swipe from an edge starts this close to it: the rest of the page scrolls and selects. */
|
|
21
|
+
const EDGE_PX = 24;
|
|
22
|
+
/** How far the finger moves before the swipe is told from a scroll. */
|
|
23
|
+
const SLOP_PX = 10;
|
|
24
|
+
/** A flick: faster than this, in pixels a millisecond, it goes the way it was flicked whatever the distance. */
|
|
25
|
+
const FLICK = 0.4;
|
|
26
|
+
/** How it slides on, let go: the curve of the sheets of iOS, as the styles slide them (style/phone.ts). */
|
|
27
|
+
const CURVE = "cubic-bezier(0.32, 0.72, 0, 1)";
|
|
28
|
+
/** The quickest it slides on, however fast it was flicked. */
|
|
29
|
+
const SHORTEST_MS = 120;
|
|
30
|
+
/** The speed of the finger let go is that of its last moves, this long. */
|
|
31
|
+
const VELOCITY_MS = 80;
|
|
32
|
+
/** 1 when the finger moves right to bring the sheet out, -1 when left. */
|
|
33
|
+
function outward(sheet: SheetSwipe): 1 | -1;
|
|
34
|
+
/** Whether a touch at `start` may move the sheet, on a screen `width` wide. */
|
|
35
|
+
function starts(sheet: SheetSwipe, start: TouchPoint, open: boolean, width: number): boolean;
|
|
36
|
+
/** Whether the move so far is the sheet's (more sideways than down, the right way); undefined until it is told. */
|
|
37
|
+
function claims(sheet: SheetSwipe, start: TouchPoint, now: TouchPoint, open: boolean): boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the sheet takes the move so far: undefined while it is not told yet (a finger that sets off
|
|
40
|
+
* slowly moves a pixel or two a move, and is waited for), false when it is not the sheet's or what is under
|
|
41
|
+
* the finger scrolls sideways (`sideways`, asked only then: a tap or a scroll never reads the styles).
|
|
42
|
+
*/
|
|
43
|
+
function takes(sheet: SheetSwipe, start: TouchPoint, now: TouchPoint, open: boolean, sideways: () => boolean): boolean | undefined;
|
|
44
|
+
/** Where the sheet rests away: `∓width`, on its side; out, it rests at 0. */
|
|
45
|
+
function away(sheet: SheetSwipe, width: number): number;
|
|
46
|
+
/** Where the sheet is, between 0 (out) and away, when the finger moved `dx` from where it took it (`from`). */
|
|
47
|
+
function position(sheet: SheetSwipe, from: number, dx: number, width: number): number;
|
|
48
|
+
/** Whether it ends out, let go at `x` at `speed` (pixels a millisecond, SwipeVelocity): the way it was flicked, or the nearer side. */
|
|
49
|
+
function settle(sheet: SheetSwipe, x: number, width: number, speed: number): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* How long it slides on to where it rests, `distance` away (signed), let go at `speed`, where the curves of
|
|
52
|
+
* `linear()` are not (SwipeSpring): on CURVE, as fast at first as the finger was; `longest` (the style's)
|
|
53
|
+
* when the finger was slow, or going the other way.
|
|
54
|
+
*/
|
|
55
|
+
function duration(distance: number, speed: number, longest: number): number;
|
|
56
|
+
/** Whether the page draws the curves of `linear()` (iOS 17.2, Chrome 113 on): a spring then, else CURVE. */
|
|
57
|
+
const springs: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* How what the finger let go at `from` at `speed` slides on to `to`, never past `bounds`: a spring that starts at
|
|
60
|
+
* the speed of the finger where the page draws it (SwipeSpring), else CURVE for `duration`. `longest` is how long
|
|
61
|
+
* its style slides it.
|
|
62
|
+
*/
|
|
63
|
+
function motion(from: number, to: number, speed: number, longest: number, bounds?: [number, number]): SwipeMotion;
|
|
64
|
+
}
|
|
65
|
+
/** How something let go slides on: for `ms`, on `easing`. */
|
|
66
|
+
export interface SwipeMotion {
|
|
67
|
+
ms: number;
|
|
68
|
+
easing: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What a finger lets go slides on as on a spring, as the sheets of iOS: at the speed the finger had, slowing
|
|
72
|
+
* down to where it rests, never past it; going the other way, it goes on a little that way first, as far as it
|
|
73
|
+
* may. A sheet let go near where it rests settles there quickly, one let go far away takes its time. Drawn by
|
|
74
|
+
* the compositor as a CSS transition, its curve a `linear()` of the spring's points. Pure, for the tests.
|
|
75
|
+
*/
|
|
76
|
+
export declare namespace SwipeSpring {
|
|
77
|
+
/** How stiff, for what its style slides in `longest` ms: ω = STIFFNESS / longest, 95% of the way in about 0.6 × longest from rest. */
|
|
78
|
+
const STIFFNESS = 8;
|
|
79
|
+
/** It rests once nearer than this, in pixels. */
|
|
80
|
+
const REST_PX = 0.5;
|
|
81
|
+
/** How far it still is from where it rests, of the way, after `t` ms: critically damped, at `speed` (of the way a millisecond) at first. */
|
|
82
|
+
function left(t: number, omega: number, speed: number): number;
|
|
83
|
+
function motion(from: number, to: number, speed: number, longest: number, bounds?: [number, number]): SwipeMotion;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The speed of a finger along x, in pixels a millisecond, of its last moves (SwipeUtil.VELOCITY_MS): let go
|
|
87
|
+
* after a slow drag and a flick it is the flick's, held still a moment it is none.
|
|
88
|
+
*/
|
|
89
|
+
export declare class SwipeVelocity {
|
|
90
|
+
protected readonly axis: 'x' | 'y';
|
|
91
|
+
protected points: TouchPoint[];
|
|
92
|
+
/** Along `x` by default; `y` for what the finger pulls down. */
|
|
93
|
+
constructor(axis?: 'x' | 'y');
|
|
94
|
+
start(point: TouchPoint): void;
|
|
95
|
+
add(point: TouchPoint): void;
|
|
96
|
+
get speed(): number;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=swipe-util.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwipeVelocity = exports.SwipeSpring = exports.SwipeUtil = void 0;
|
|
4
|
+
const device_protocol_1 = require("./device-protocol");
|
|
5
|
+
/** It follows the finger and, let go, ends where it was flicked to, or the nearer side. Pure, for the tests. */
|
|
6
|
+
var SwipeUtil;
|
|
7
|
+
(function (SwipeUtil) {
|
|
8
|
+
/** A swipe from an edge starts this close to it: the rest of the page scrolls and selects. */
|
|
9
|
+
SwipeUtil.EDGE_PX = 24;
|
|
10
|
+
/** How far the finger moves before the swipe is told from a scroll. */
|
|
11
|
+
SwipeUtil.SLOP_PX = 10;
|
|
12
|
+
/** A flick: faster than this, in pixels a millisecond, it goes the way it was flicked whatever the distance. */
|
|
13
|
+
SwipeUtil.FLICK = 0.4;
|
|
14
|
+
/** How it slides on, let go: the curve of the sheets of iOS, as the styles slide them (style/phone.ts). */
|
|
15
|
+
SwipeUtil.CURVE = device_protocol_1.DeviceMotion.SHEET_CURVE;
|
|
16
|
+
/** How much faster than on average CURVE starts: the slope of its first control point (0.72 / 0.32). */
|
|
17
|
+
const CURVE_START = 0.72 / 0.32;
|
|
18
|
+
/** The quickest it slides on, however fast it was flicked. */
|
|
19
|
+
SwipeUtil.SHORTEST_MS = 120;
|
|
20
|
+
/** The speed of the finger let go is that of its last moves, this long. */
|
|
21
|
+
SwipeUtil.VELOCITY_MS = 80;
|
|
22
|
+
/** 1 when the finger moves right to bring the sheet out, -1 when left. */
|
|
23
|
+
function outward(sheet) {
|
|
24
|
+
return sheet.side === 'left' ? 1 : -1;
|
|
25
|
+
}
|
|
26
|
+
SwipeUtil.outward = outward;
|
|
27
|
+
/** The way the finger moves now: out while it is away, back while it is out. */
|
|
28
|
+
function way(sheet, open) {
|
|
29
|
+
return open ? -outward(sheet) : outward(sheet);
|
|
30
|
+
}
|
|
31
|
+
/** Whether a touch at `start` may move the sheet, on a screen `width` wide. */
|
|
32
|
+
function starts(sheet, start, open, width) {
|
|
33
|
+
const from = open ? sheet.closesFrom : sheet.opensFrom;
|
|
34
|
+
if (from !== 'edge') {
|
|
35
|
+
return from === 'anywhere';
|
|
36
|
+
}
|
|
37
|
+
return way(sheet, open) > 0 ? start.x <= SwipeUtil.EDGE_PX : start.x >= width - SwipeUtil.EDGE_PX;
|
|
38
|
+
}
|
|
39
|
+
SwipeUtil.starts = starts;
|
|
40
|
+
/** Whether the move so far is the sheet's (more sideways than down, the right way); undefined until it is told. */
|
|
41
|
+
function claims(sheet, start, now, open) {
|
|
42
|
+
const dx = now.x - start.x;
|
|
43
|
+
const dy = now.y - start.y;
|
|
44
|
+
if (Math.hypot(dx, dy) < SwipeUtil.SLOP_PX) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return Math.abs(dx) > Math.abs(dy) * 1.2 && dx * way(sheet, open) > 0;
|
|
48
|
+
}
|
|
49
|
+
SwipeUtil.claims = claims;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the sheet takes the move so far: undefined while it is not told yet (a finger that sets off
|
|
52
|
+
* slowly moves a pixel or two a move, and is waited for), false when it is not the sheet's or what is under
|
|
53
|
+
* the finger scrolls sideways (`sideways`, asked only then: a tap or a scroll never reads the styles).
|
|
54
|
+
*/
|
|
55
|
+
function takes(sheet, start, now, open, sideways) {
|
|
56
|
+
const claimed = claims(sheet, start, now, open);
|
|
57
|
+
return claimed === undefined ? undefined : claimed && !sideways();
|
|
58
|
+
}
|
|
59
|
+
SwipeUtil.takes = takes;
|
|
60
|
+
/** Where the sheet rests away: `∓width`, on its side; out, it rests at 0. */
|
|
61
|
+
function away(sheet, width) {
|
|
62
|
+
return -outward(sheet) * width;
|
|
63
|
+
}
|
|
64
|
+
SwipeUtil.away = away;
|
|
65
|
+
/** Where the sheet is, between 0 (out) and away, when the finger moved `dx` from where it took it (`from`). */
|
|
66
|
+
function position(sheet, from, dx, width) {
|
|
67
|
+
const rest = away(sheet, width);
|
|
68
|
+
return Math.min(Math.max(rest, 0), Math.max(Math.min(rest, 0), from + dx));
|
|
69
|
+
}
|
|
70
|
+
SwipeUtil.position = position;
|
|
71
|
+
/** Whether it ends out, let go at `x` at `speed` (pixels a millisecond, SwipeVelocity): the way it was flicked, or the nearer side. */
|
|
72
|
+
function settle(sheet, x, width, speed) {
|
|
73
|
+
if (Math.abs(speed) > SwipeUtil.FLICK) {
|
|
74
|
+
return speed * outward(sheet) > 0;
|
|
75
|
+
}
|
|
76
|
+
return Math.abs(x) < width / 2;
|
|
77
|
+
}
|
|
78
|
+
SwipeUtil.settle = settle;
|
|
79
|
+
/**
|
|
80
|
+
* How long it slides on to where it rests, `distance` away (signed), let go at `speed`, where the curves of
|
|
81
|
+
* `linear()` are not (SwipeSpring): on CURVE, as fast at first as the finger was; `longest` (the style's)
|
|
82
|
+
* when the finger was slow, or going the other way.
|
|
83
|
+
*/
|
|
84
|
+
function duration(distance, speed, longest) {
|
|
85
|
+
const toward = Math.sign(distance) * speed;
|
|
86
|
+
if (toward <= 0 || distance === 0) {
|
|
87
|
+
return longest;
|
|
88
|
+
}
|
|
89
|
+
return Math.round(Math.min(longest, Math.max(SwipeUtil.SHORTEST_MS, (CURVE_START * Math.abs(distance)) / toward)));
|
|
90
|
+
}
|
|
91
|
+
SwipeUtil.duration = duration;
|
|
92
|
+
/** Whether the page draws the curves of `linear()` (iOS 17.2, Chrome 113 on): a spring then, else CURVE. */
|
|
93
|
+
SwipeUtil.springs = (() => {
|
|
94
|
+
try {
|
|
95
|
+
return typeof CSS !== 'undefined' && CSS.supports('transition-timing-function', 'linear(0, 1)');
|
|
96
|
+
}
|
|
97
|
+
catch (_a) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
/**
|
|
102
|
+
* How what the finger let go at `from` at `speed` slides on to `to`, never past `bounds`: a spring that starts at
|
|
103
|
+
* the speed of the finger where the page draws it (SwipeSpring), else CURVE for `duration`. `longest` is how long
|
|
104
|
+
* its style slides it.
|
|
105
|
+
*/
|
|
106
|
+
function motion(from, to, speed, longest, bounds = [-Infinity, Infinity]) {
|
|
107
|
+
if (SwipeUtil.springs) {
|
|
108
|
+
return SwipeSpring.motion(from, to, speed, longest, bounds);
|
|
109
|
+
}
|
|
110
|
+
return { ms: Math.abs(to - from) < SwipeSpring.REST_PX ? 0 : duration(to - from, speed, longest), easing: SwipeUtil.CURVE };
|
|
111
|
+
}
|
|
112
|
+
SwipeUtil.motion = motion;
|
|
113
|
+
})(SwipeUtil || (exports.SwipeUtil = SwipeUtil = {}));
|
|
114
|
+
/**
|
|
115
|
+
* What a finger lets go slides on as on a spring, as the sheets of iOS: at the speed the finger had, slowing
|
|
116
|
+
* down to where it rests, never past it; going the other way, it goes on a little that way first, as far as it
|
|
117
|
+
* may. A sheet let go near where it rests settles there quickly, one let go far away takes its time. Drawn by
|
|
118
|
+
* the compositor as a CSS transition, its curve a `linear()` of the spring's points. Pure, for the tests.
|
|
119
|
+
*/
|
|
120
|
+
var SwipeSpring;
|
|
121
|
+
(function (SwipeSpring) {
|
|
122
|
+
/** How stiff, for what its style slides in `longest` ms: ω = STIFFNESS / longest, 95% of the way in about 0.6 × longest from rest. */
|
|
123
|
+
SwipeSpring.STIFFNESS = 8;
|
|
124
|
+
/** It rests once nearer than this, in pixels. */
|
|
125
|
+
SwipeSpring.REST_PX = 0.5;
|
|
126
|
+
/** A point of its curve this often, in milliseconds. */
|
|
127
|
+
const STEP_MS = 12;
|
|
128
|
+
/** How far it still is from where it rests, of the way, after `t` ms: critically damped, at `speed` (of the way a millisecond) at first. */
|
|
129
|
+
function left(t, omega, speed) {
|
|
130
|
+
return (1 + (omega - speed) * t) * Math.exp(-omega * t);
|
|
131
|
+
}
|
|
132
|
+
SwipeSpring.left = left;
|
|
133
|
+
function motion(from, to, speed, longest, bounds = [-Infinity, Infinity]) {
|
|
134
|
+
const distance = to - from;
|
|
135
|
+
const span = Math.abs(distance);
|
|
136
|
+
if (span < SwipeSpring.REST_PX) {
|
|
137
|
+
return { ms: 0, easing: 'linear' };
|
|
138
|
+
}
|
|
139
|
+
const toward = (Math.sign(distance) * speed) / span;
|
|
140
|
+
// Flicked faster than the spring goes, it is stiffer: it goes on at the finger's speed, and never past where it rests.
|
|
141
|
+
const omega = Math.max(SwipeSpring.STIFFNESS / longest, toward);
|
|
142
|
+
let ms = STEP_MS;
|
|
143
|
+
while (ms < longest * 2 && Math.abs(left(ms, omega, toward)) * span > SwipeSpring.REST_PX) {
|
|
144
|
+
ms += 4;
|
|
145
|
+
}
|
|
146
|
+
// The other way, it goes on only as far as it may.
|
|
147
|
+
const behind = distance > 0 ? from - bounds[0] : bounds[1] - from;
|
|
148
|
+
const lowest = -Math.max(0, behind) / span;
|
|
149
|
+
const count = Math.max(8, Math.ceil(ms / STEP_MS));
|
|
150
|
+
const points = [];
|
|
151
|
+
for (let i = 0; i <= count; i++) {
|
|
152
|
+
const progress = i === count ? 1 : Math.max(lowest, 1 - left((ms * i) / count, omega, toward));
|
|
153
|
+
points.push(String(Math.round(progress * 1000) / 1000));
|
|
154
|
+
}
|
|
155
|
+
return { ms, easing: `linear(${points.join(', ')})` };
|
|
156
|
+
}
|
|
157
|
+
SwipeSpring.motion = motion;
|
|
158
|
+
})(SwipeSpring || (exports.SwipeSpring = SwipeSpring = {}));
|
|
159
|
+
/**
|
|
160
|
+
* The speed of a finger along x, in pixels a millisecond, of its last moves (SwipeUtil.VELOCITY_MS): let go
|
|
161
|
+
* after a slow drag and a flick it is the flick's, held still a moment it is none.
|
|
162
|
+
*/
|
|
163
|
+
class SwipeVelocity {
|
|
164
|
+
/** Along `x` by default; `y` for what the finger pulls down. */
|
|
165
|
+
constructor(axis = 'x') {
|
|
166
|
+
this.axis = axis;
|
|
167
|
+
this.points = [];
|
|
168
|
+
}
|
|
169
|
+
start(point) {
|
|
170
|
+
this.points = [point];
|
|
171
|
+
}
|
|
172
|
+
add(point) {
|
|
173
|
+
this.points.push(point);
|
|
174
|
+
const since = point.t - SwipeUtil.VELOCITY_MS;
|
|
175
|
+
while (this.points.length > 2 && this.points[1].t <= since) {
|
|
176
|
+
this.points.shift();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
get speed() {
|
|
180
|
+
const first = this.points[0];
|
|
181
|
+
const last = this.points[this.points.length - 1];
|
|
182
|
+
const ms = last && first ? last.t - first.t : 0;
|
|
183
|
+
return ms > 0 ? (last[this.axis] - first[this.axis]) / ms : 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.SwipeVelocity = SwipeVelocity;
|
|
187
|
+
//# sourceMappingURL=swipe-util.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { StateSpec } from '../state/state-protocol';
|
|
2
|
+
import type { ComposerImage } from '../util/composer';
|
|
3
|
+
export declare const TaDrafts: unique symbol;
|
|
4
|
+
/** What was typed in a message box and not sent: kept on this device, by the place of the box. */
|
|
5
|
+
export interface ComposerDraft {
|
|
6
|
+
text: string;
|
|
7
|
+
/** When it was last changed: the oldest go first beyond DraftsUtil.MAX. */
|
|
8
|
+
at: number;
|
|
9
|
+
/** How many images it has; they are kept apart (DeviceValues), being large. */
|
|
10
|
+
images?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The drafts of the message boxes, as WeChat keeps what was typed in a chat: a box shows again what it held
|
|
14
|
+
* when it went away (another conversation opened, the page loaded again, Ta restarted), until it is sent. Kept on
|
|
15
|
+
* this device (a box is typed in on one at a time), apart for each computer, as the conversations are.
|
|
16
|
+
*/
|
|
17
|
+
export interface TaDrafts {
|
|
18
|
+
/** What this device keeps for a place, at once. */
|
|
19
|
+
get(place: string): ComposerDraft | undefined;
|
|
20
|
+
/** Every draft of the computer in use, by place: the same object until one changes. */
|
|
21
|
+
all(): Readonly<Record<string, ComposerDraft>>;
|
|
22
|
+
/**
|
|
23
|
+
* Keeps what a box holds for its place: nothing in it (only spaces) takes the draft away. `images` undefined
|
|
24
|
+
* leaves those kept as they are (the box is still reading them back).
|
|
25
|
+
*/
|
|
26
|
+
keep(place: string, text: string, images?: ComposerImage[]): void;
|
|
27
|
+
/** The images kept for a place. */
|
|
28
|
+
images(place: string): Promise<ComposerImage[]>;
|
|
29
|
+
/** A draft changed. */
|
|
30
|
+
subscribe(listener: () => void): () => void;
|
|
31
|
+
}
|
|
32
|
+
/** The places of the boxes of the page; an extension's are apart from the page's and from each other's. */
|
|
33
|
+
export declare namespace DraftPlaces {
|
|
34
|
+
/** The box of a new conversation. */
|
|
35
|
+
const NEW = "new";
|
|
36
|
+
/** The double's. */
|
|
37
|
+
const DOUBLE = "double";
|
|
38
|
+
/** The box of a conversation, by its file: the same before and after Ta restarts. */
|
|
39
|
+
function chat(sessionFile: string): string;
|
|
40
|
+
/** A box of a web extension, `pi.ui.Composer` with `draft`. */
|
|
41
|
+
function extension(name: string, draft: string): string;
|
|
42
|
+
}
|
|
43
|
+
export declare namespace DraftsUtil {
|
|
44
|
+
/** Drafts kept for a computer, at most. */
|
|
45
|
+
const MAX = 100;
|
|
46
|
+
/** What is typed goes to the device this long after the last key, and at once when the box goes away or the page hides. */
|
|
47
|
+
const WRITE_MS = 250;
|
|
48
|
+
/** Where the drafts of a computer are kept: `ta.drafts|<host>` of the device. */
|
|
49
|
+
function spec(host: string | undefined): StateSpec<Record<string, ComposerDraft>>;
|
|
50
|
+
function parse(value: unknown): Record<string, ComposerDraft> | undefined;
|
|
51
|
+
/** The drafts with one of a place set, or taken away; the oldest beyond `max` are let go, and said. */
|
|
52
|
+
function put(drafts: Readonly<Record<string, ComposerDraft>>, place: string, draft: ComposerDraft | undefined, max?: number): {
|
|
53
|
+
drafts: Record<string, ComposerDraft>;
|
|
54
|
+
dropped: string[];
|
|
55
|
+
};
|
|
56
|
+
/** What a row of a list says of a draft: its text on one line. */
|
|
57
|
+
function preview(draft: ComposerDraft): string;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=drafts-protocol.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DraftsUtil = exports.DraftPlaces = exports.TaDrafts = void 0;
|
|
4
|
+
exports.TaDrafts = Symbol('TaDrafts');
|
|
5
|
+
/** The places of the boxes of the page; an extension's are apart from the page's and from each other's. */
|
|
6
|
+
var DraftPlaces;
|
|
7
|
+
(function (DraftPlaces) {
|
|
8
|
+
/** The box of a new conversation. */
|
|
9
|
+
DraftPlaces.NEW = 'new';
|
|
10
|
+
/** The double's. */
|
|
11
|
+
DraftPlaces.DOUBLE = 'double';
|
|
12
|
+
/** The box of a conversation, by its file: the same before and after Ta restarts. */
|
|
13
|
+
function chat(sessionFile) {
|
|
14
|
+
return `chat:${sessionFile}`;
|
|
15
|
+
}
|
|
16
|
+
DraftPlaces.chat = chat;
|
|
17
|
+
/** A box of a web extension, `pi.ui.Composer` with `draft`. */
|
|
18
|
+
function extension(name, draft) {
|
|
19
|
+
return `ext:${name}:${draft}`;
|
|
20
|
+
}
|
|
21
|
+
DraftPlaces.extension = extension;
|
|
22
|
+
})(DraftPlaces || (exports.DraftPlaces = DraftPlaces = {}));
|
|
23
|
+
var DraftsUtil;
|
|
24
|
+
(function (DraftsUtil) {
|
|
25
|
+
/** Drafts kept for a computer, at most. */
|
|
26
|
+
DraftsUtil.MAX = 100;
|
|
27
|
+
/** What is typed goes to the device this long after the last key, and at once when the box goes away or the page hides. */
|
|
28
|
+
DraftsUtil.WRITE_MS = 250;
|
|
29
|
+
const specs = new Map();
|
|
30
|
+
/** Where the drafts of a computer are kept: `ta.drafts|<host>` of the device. */
|
|
31
|
+
function spec(host) {
|
|
32
|
+
const key = `drafts|${host !== null && host !== void 0 ? host : ''}`;
|
|
33
|
+
let found = specs.get(key);
|
|
34
|
+
if (!found) {
|
|
35
|
+
found = { key, tier: 'device', initial: {}, parse };
|
|
36
|
+
specs.set(key, found);
|
|
37
|
+
}
|
|
38
|
+
return found;
|
|
39
|
+
}
|
|
40
|
+
DraftsUtil.spec = spec;
|
|
41
|
+
function parse(value) {
|
|
42
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const drafts = {};
|
|
46
|
+
for (const [place, draft] of Object.entries(value)) {
|
|
47
|
+
if (draft && typeof draft.text === 'string' && typeof draft.at === 'number') {
|
|
48
|
+
drafts[place] = { text: draft.text, at: draft.at, ...(typeof draft.images === 'number' && draft.images > 0 ? { images: draft.images } : {}) };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return drafts;
|
|
52
|
+
}
|
|
53
|
+
DraftsUtil.parse = parse;
|
|
54
|
+
/** The drafts with one of a place set, or taken away; the oldest beyond `max` are let go, and said. */
|
|
55
|
+
function put(drafts, place, draft, max = DraftsUtil.MAX) {
|
|
56
|
+
const next = { ...drafts };
|
|
57
|
+
delete next[place];
|
|
58
|
+
if (draft) {
|
|
59
|
+
next[place] = draft;
|
|
60
|
+
}
|
|
61
|
+
const places = Object.keys(next);
|
|
62
|
+
if (places.length <= max) {
|
|
63
|
+
return { drafts: next, dropped: [] };
|
|
64
|
+
}
|
|
65
|
+
const dropped = places.sort((a, b) => next[a].at - next[b].at).slice(0, places.length - max);
|
|
66
|
+
for (const old of dropped) {
|
|
67
|
+
delete next[old];
|
|
68
|
+
}
|
|
69
|
+
return { drafts: next, dropped };
|
|
70
|
+
}
|
|
71
|
+
DraftsUtil.put = put;
|
|
72
|
+
/** What a row of a list says of a draft: its text on one line. */
|
|
73
|
+
function preview(draft) {
|
|
74
|
+
return draft.text.replace(/\s+/g, ' ').trim();
|
|
75
|
+
}
|
|
76
|
+
DraftsUtil.preview = preview;
|
|
77
|
+
})(DraftsUtil || (exports.DraftsUtil = DraftsUtil = {}));
|
|
78
|
+
//# sourceMappingURL=drafts-protocol.js.map
|