@celljs/ta-web 4.48.0 → 4.50.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/account/account-side.js +4 -0
- package/esm/browser/account/device-account.d.ts +6 -0
- package/esm/browser/account/device-account.js +20 -5
- package/esm/browser/assistant/assistant-view.js +2 -0
- package/esm/browser/assistant/call-announcing.d.ts +25 -0
- package/esm/browser/assistant/call-announcing.js +32 -0
- package/esm/browser/assistant/call-answering.d.ts +43 -0
- package/esm/browser/assistant/call-answering.js +63 -0
- package/esm/browser/assistant/call-hearing.d.ts +53 -0
- package/esm/browser/assistant/call-hearing.js +98 -0
- package/esm/browser/assistant/call-pausing.d.ts +40 -0
- package/esm/browser/assistant/call-pausing.js +82 -0
- package/esm/browser/assistant/call-reading.d.ts +32 -0
- package/esm/browser/assistant/call-reading.js +35 -0
- package/esm/browser/assistant/call-revoicing.d.ts +33 -0
- package/esm/browser/assistant/call-revoicing.js +68 -0
- package/esm/browser/assistant/call-turns.d.ts +29 -0
- package/esm/browser/assistant/call-turns.js +33 -0
- package/esm/browser/assistant/spoken-answer.d.ts +21 -0
- package/esm/browser/assistant/spoken-answer.js +69 -0
- package/esm/browser/assistant/spoken-call.d.ts +7 -0
- package/esm/browser/assistant/spoken-call.js +16 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/esm/browser/assistant/voice-call.d.ts +47 -43
- package/esm/browser/assistant/voice-call.js +193 -219
- package/esm/browser/chat/chat-view.js +2 -1
- package/esm/browser/components/account-recovery-view.d.ts +11 -0
- package/esm/browser/components/account-recovery-view.js +81 -0
- package/esm/browser/components/account-view.d.ts +1 -2
- package/esm/browser/components/account-view.js +10 -1
- package/esm/browser/components/app-nav.js +19 -8
- package/esm/browser/components/app-shell-hooks.d.ts +5 -0
- package/esm/browser/components/app-shell-hooks.js +45 -0
- package/esm/browser/components/app-shell-state.js +2 -1
- package/esm/browser/components/app-view.js +9 -5
- package/esm/browser/components/chat-emoji.d.ts +35 -0
- package/esm/browser/components/chat-emoji.js +129 -0
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-attachments.d.ts +6 -0
- package/esm/browser/components/composer-attachments.js +12 -1
- package/esm/browser/components/composer-box-protocol.d.ts +15 -0
- package/esm/browser/components/composer-box.js +110 -87
- package/esm/browser/components/composer-drop-hooks.d.ts +26 -0
- package/esm/browser/components/composer-drop-hooks.js +36 -0
- package/esm/browser/components/composer-emoji.js +1 -1
- package/esm/browser/components/composer-faces.d.ts +16 -0
- package/esm/browser/components/composer-faces.js +37 -0
- package/esm/browser/components/composer-media.d.ts +10 -0
- package/esm/browser/components/composer-media.js +12 -1
- package/esm/browser/components/composer-target.d.ts +4 -0
- package/esm/browser/components/composer-target.js +18 -7
- package/esm/browser/components/composer-type-focus.d.ts +24 -0
- package/esm/browser/components/composer-type-focus.js +17 -0
- package/esm/browser/components/composer-voice.d.ts +24 -0
- package/esm/browser/components/composer-voice.js +37 -0
- package/esm/browser/components/composer.d.ts +2 -2
- package/esm/browser/components/composer.js +39 -8
- package/esm/browser/components/context-menu.js +2 -1
- package/esm/browser/components/emoji-panel.d.ts +11 -7
- package/esm/browser/components/emoji-panel.js +40 -22
- package/esm/browser/components/extension-settings.js +2 -2
- package/esm/browser/components/folder-new.d.ts +18 -0
- package/esm/browser/components/folder-new.js +53 -0
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +18 -6
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-menu.d.ts +8 -3
- package/esm/browser/components/image-menu.js +34 -9
- package/esm/browser/components/markdown.js +9 -2
- package/esm/browser/components/media.js +3 -2
- package/esm/browser/components/message-list.js +2 -2
- package/esm/browser/components/message-steps.js +20 -11
- package/esm/browser/components/message-user.js +2 -2
- package/esm/browser/components/moved-notice.js +2 -1
- package/esm/browser/components/nav-places.d.ts +2 -0
- package/esm/browser/components/nav-places.js +4 -2
- package/esm/browser/components/phone-shell.d.ts +2 -0
- package/esm/browser/components/phone-shell.js +5 -1
- package/esm/browser/components/secret-text.d.ts +1 -1
- package/esm/browser/components/secret-text.js +4 -3
- package/esm/browser/components/session-view.js +3 -0
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +13 -5
- package/esm/browser/components/settings-more.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -2
- package/esm/browser/components/share-item-sheet.js +7 -1
- package/esm/browser/components/tab-title.d.ts +27 -0
- package/esm/browser/components/tab-title.js +35 -0
- package/esm/browser/components/use-composer-attachments.d.ts +28 -0
- package/esm/browser/components/use-composer-attachments.js +65 -0
- package/esm/browser/components/use-composer-files.d.ts +25 -0
- package/esm/browser/components/use-composer-files.js +52 -0
- package/esm/browser/components/web-composer.d.ts +3 -1
- package/esm/browser/components/web-composer.js +3 -2
- package/esm/browser/components/workbench-view.js +1 -0
- package/esm/browser/components/working-directory.js +2 -1
- package/esm/browser/device/drag-move.d.ts +21 -0
- package/esm/browser/device/drag-move.js +86 -0
- package/esm/browser/extension/icons.js +7 -1
- package/esm/browser/extension/web-api-desktop.d.ts +19 -0
- package/esm/browser/extension/web-api-menus.d.ts +19 -0
- package/esm/browser/extension/web-api-spec.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +24 -23
- package/esm/browser/extension/web-extension-context.d.ts +1 -0
- package/esm/browser/extension/web-extension-context.js +12 -5
- package/esm/browser/extension/web-extension-run.js +1 -0
- package/esm/browser/extension/web-share-ui.d.ts +1 -1
- package/esm/browser/extension/web-share-ui.js +2 -0
- package/esm/browser/extension/web-share.d.ts +13 -0
- package/esm/browser/extension/web-share.js +37 -2
- package/esm/browser/i18n/en/account.d.ts +18 -0
- package/esm/browser/i18n/en/account.js +18 -0
- package/esm/browser/i18n/en/call.js +1 -1
- package/esm/browser/i18n/en/chat.d.ts +15 -0
- package/esm/browser/i18n/en/chat.js +16 -1
- package/esm/browser/i18n/en/common.d.ts +2 -0
- package/esm/browser/i18n/en/common.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +2 -0
- package/esm/browser/i18n/en/discover.js +2 -0
- package/esm/browser/i18n/en/settings.d.ts +17 -0
- package/esm/browser/i18n/en/settings.js +17 -0
- package/esm/browser/i18n/ja/account.js +18 -0
- package/esm/browser/i18n/ja/call.js +1 -1
- package/esm/browser/i18n/ja/chat.js +16 -1
- package/esm/browser/i18n/ja/common.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -1
- package/esm/browser/i18n/ja/settings.js +17 -0
- package/esm/browser/i18n/locales.d.ts +55 -1
- package/esm/browser/i18n/messages.d.ts +54 -0
- package/esm/browser/i18n/zh/account.js +18 -0
- package/esm/browser/i18n/zh/call.js +1 -1
- package/esm/browser/i18n/zh/chat.js +16 -1
- package/esm/browser/i18n/zh/common.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -1
- package/esm/browser/i18n/zh/settings.js +17 -0
- package/esm/browser/i18n/zh-tw/account.js +18 -0
- package/esm/browser/i18n/zh-tw/call.js +1 -1
- package/esm/browser/i18n/zh-tw/chat.js +16 -1
- package/esm/browser/i18n/zh-tw/common.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -1
- package/esm/browser/i18n/zh-tw/settings.js +17 -0
- package/esm/browser/offline/kept-chats.d.ts +3 -1
- package/esm/browser/offline/kept-chats.js +1 -1
- package/esm/browser/partners/group-picker.d.ts +3 -2
- package/esm/browser/partners/group-picker.js +8 -3
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-docs.js +5 -2
- package/esm/browser/sandbox/work/work-frame.d.ts +3 -0
- package/esm/browser/sandbox/work/work-frame.js +9 -3
- package/esm/browser/sandbox/work/work-gates.d.ts +77 -0
- package/esm/browser/sandbox/work/work-gates.js +182 -0
- package/esm/browser/settings/agent-settings.js +1 -1
- package/esm/browser/settings/navigation.d.ts +38 -10
- package/esm/browser/settings/navigation.js +73 -17
- package/esm/browser/settings/settings-protocol.d.ts +16 -1
- package/esm/browser/settings/settings-protocol.js +20 -2
- package/esm/browser/settings/settings.js +4 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +15 -2
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +6 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +28 -8
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +5 -0
- package/esm/browser/style/device.js +5 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +3 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +13 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +4 -2
- package/esm/browser/util/chat-emoji.d.ts +44 -0
- package/esm/browser/util/chat-emoji.js +269 -0
- package/esm/browser/util/composer-drop.d.ts +26 -0
- package/esm/browser/util/composer-drop.js +40 -0
- package/esm/browser/util/composer-files.d.ts +48 -0
- package/esm/browser/util/composer-files.js +99 -0
- package/esm/browser/util/composer.d.ts +13 -1
- package/esm/browser/util/composer.js +24 -6
- package/esm/browser/util/markdown.d.ts +5 -0
- package/esm/browser/util/markdown.js +18 -0
- package/esm/browser/util/message.d.ts +6 -1
- package/esm/browser/util/message.js +13 -2
- package/esm/browser/util/process.d.ts +10 -13
- package/esm/browser/util/process.js +31 -83
- package/esm/browser/util/turn-join.d.ts +38 -0
- package/esm/browser/util/turn-join.js +119 -0
- package/esm/browser/workbench-services.js +1 -1
- package/lib/browser/account/account-side.js +4 -0
- package/lib/browser/account/device-account.d.ts +6 -0
- package/lib/browser/account/device-account.js +20 -5
- package/lib/browser/assistant/assistant-view.js +2 -0
- package/lib/browser/assistant/call-announcing.d.ts +26 -0
- package/lib/browser/assistant/call-announcing.js +36 -0
- package/lib/browser/assistant/call-answering.d.ts +44 -0
- package/lib/browser/assistant/call-answering.js +67 -0
- package/lib/browser/assistant/call-hearing.d.ts +54 -0
- package/lib/browser/assistant/call-hearing.js +102 -0
- package/lib/browser/assistant/call-pausing.d.ts +41 -0
- package/lib/browser/assistant/call-pausing.js +86 -0
- package/lib/browser/assistant/call-reading.d.ts +33 -0
- package/lib/browser/assistant/call-reading.js +39 -0
- package/lib/browser/assistant/call-revoicing.d.ts +34 -0
- package/lib/browser/assistant/call-revoicing.js +72 -0
- package/lib/browser/assistant/call-turns.d.ts +30 -0
- package/lib/browser/assistant/call-turns.js +37 -0
- package/lib/browser/assistant/spoken-answer.d.ts +22 -0
- package/lib/browser/assistant/spoken-answer.js +73 -0
- package/lib/browser/assistant/spoken-call.d.ts +8 -0
- package/lib/browser/assistant/spoken-call.js +19 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/lib/browser/assistant/voice-call.d.ts +47 -43
- package/lib/browser/assistant/voice-call.js +192 -218
- package/lib/browser/chat/chat-view.js +2 -1
- package/lib/browser/components/account-recovery-view.d.ts +12 -0
- package/lib/browser/components/account-recovery-view.js +117 -0
- package/lib/browser/components/account-view.d.ts +1 -2
- package/lib/browser/components/account-view.js +10 -1
- package/lib/browser/components/app-nav.js +19 -8
- package/lib/browser/components/app-shell-hooks.d.ts +5 -0
- package/lib/browser/components/app-shell-hooks.js +46 -0
- package/lib/browser/components/app-shell-state.js +1 -0
- package/lib/browser/components/app-view.js +8 -4
- package/lib/browser/components/chat-emoji.d.ts +36 -0
- package/lib/browser/components/chat-emoji.js +167 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-attachments.d.ts +6 -0
- package/lib/browser/components/composer-attachments.js +12 -0
- package/lib/browser/components/composer-box-protocol.d.ts +15 -0
- package/lib/browser/components/composer-box.js +107 -84
- package/lib/browser/components/composer-drop-hooks.d.ts +27 -0
- package/lib/browser/components/composer-drop-hooks.js +72 -0
- package/lib/browser/components/composer-emoji.js +1 -1
- package/lib/browser/components/composer-faces.d.ts +17 -0
- package/lib/browser/components/composer-faces.js +73 -0
- package/lib/browser/components/composer-media.d.ts +10 -0
- package/lib/browser/components/composer-media.js +13 -0
- package/lib/browser/components/composer-target.d.ts +4 -0
- package/lib/browser/components/composer-target.js +18 -7
- package/lib/browser/components/composer-type-focus.d.ts +25 -0
- package/lib/browser/components/composer-type-focus.js +20 -0
- package/lib/browser/components/composer-voice.d.ts +25 -0
- package/lib/browser/components/composer-voice.js +73 -0
- package/lib/browser/components/composer.d.ts +2 -2
- package/lib/browser/components/composer.js +38 -7
- package/lib/browser/components/context-menu.js +2 -1
- package/lib/browser/components/emoji-panel.d.ts +11 -7
- package/lib/browser/components/emoji-panel.js +40 -22
- package/lib/browser/components/extension-settings.js +1 -1
- package/lib/browser/components/folder-new.d.ts +19 -0
- package/lib/browser/components/folder-new.js +90 -0
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +17 -5
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-menu.d.ts +8 -3
- package/lib/browser/components/image-menu.js +34 -9
- package/lib/browser/components/markdown.js +9 -2
- package/lib/browser/components/media.js +3 -2
- package/lib/browser/components/message-list.js +2 -2
- package/lib/browser/components/message-steps.js +20 -11
- package/lib/browser/components/message-user.js +1 -1
- package/lib/browser/components/moved-notice.js +2 -1
- package/lib/browser/components/nav-places.d.ts +2 -0
- package/lib/browser/components/nav-places.js +4 -2
- package/lib/browser/components/phone-shell.d.ts +2 -0
- package/lib/browser/components/phone-shell.js +5 -1
- package/lib/browser/components/secret-text.d.ts +1 -1
- package/lib/browser/components/secret-text.js +4 -3
- package/lib/browser/components/session-view.js +3 -0
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +12 -4
- package/lib/browser/components/settings-more.js +2 -2
- package/lib/browser/components/settings-parts.js +11 -0
- package/lib/browser/components/share-item-sheet.js +7 -1
- package/lib/browser/components/tab-title.d.ts +28 -0
- package/lib/browser/components/tab-title.js +38 -0
- package/lib/browser/components/use-composer-attachments.d.ts +29 -0
- package/lib/browser/components/use-composer-attachments.js +101 -0
- package/lib/browser/components/use-composer-files.d.ts +26 -0
- package/lib/browser/components/use-composer-files.js +88 -0
- package/lib/browser/components/web-composer.d.ts +3 -1
- package/lib/browser/components/web-composer.js +3 -2
- package/lib/browser/components/workbench-view.js +1 -0
- package/lib/browser/components/working-directory.js +2 -1
- package/lib/browser/device/drag-move.d.ts +22 -0
- package/lib/browser/device/drag-move.js +122 -0
- package/lib/browser/extension/icons.js +6 -0
- package/lib/browser/extension/web-api-desktop.d.ts +19 -0
- package/lib/browser/extension/web-api-menus.d.ts +19 -0
- package/lib/browser/extension/web-api-spec.js +2 -0
- package/lib/browser/extension/web-extension-api.d.ts +24 -23
- package/lib/browser/extension/web-extension-context.d.ts +1 -0
- package/lib/browser/extension/web-extension-context.js +12 -5
- package/lib/browser/extension/web-extension-run.js +1 -0
- package/lib/browser/extension/web-share-ui.d.ts +1 -1
- package/lib/browser/extension/web-share-ui.js +2 -0
- package/lib/browser/extension/web-share.d.ts +13 -0
- package/lib/browser/extension/web-share.js +37 -2
- package/lib/browser/i18n/en/account.d.ts +18 -0
- package/lib/browser/i18n/en/account.js +18 -0
- package/lib/browser/i18n/en/call.js +1 -1
- package/lib/browser/i18n/en/chat.d.ts +15 -0
- package/lib/browser/i18n/en/chat.js +16 -1
- package/lib/browser/i18n/en/common.d.ts +2 -0
- package/lib/browser/i18n/en/common.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +2 -0
- package/lib/browser/i18n/en/discover.js +2 -0
- package/lib/browser/i18n/en/settings.d.ts +17 -0
- package/lib/browser/i18n/en/settings.js +17 -0
- package/lib/browser/i18n/ja/account.js +18 -0
- package/lib/browser/i18n/ja/call.js +1 -1
- package/lib/browser/i18n/ja/chat.js +16 -1
- package/lib/browser/i18n/ja/common.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -1
- package/lib/browser/i18n/ja/settings.js +17 -0
- package/lib/browser/i18n/locales.d.ts +55 -1
- package/lib/browser/i18n/messages.d.ts +54 -0
- package/lib/browser/i18n/zh/account.js +18 -0
- package/lib/browser/i18n/zh/call.js +1 -1
- package/lib/browser/i18n/zh/chat.js +16 -1
- package/lib/browser/i18n/zh/common.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -1
- package/lib/browser/i18n/zh/settings.js +17 -0
- package/lib/browser/i18n/zh-tw/account.js +18 -0
- package/lib/browser/i18n/zh-tw/call.js +1 -1
- package/lib/browser/i18n/zh-tw/chat.js +16 -1
- package/lib/browser/i18n/zh-tw/common.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -1
- package/lib/browser/i18n/zh-tw/settings.js +17 -0
- package/lib/browser/offline/kept-chats.d.ts +3 -1
- package/lib/browser/offline/kept-chats.js +1 -1
- package/lib/browser/partners/group-picker.d.ts +3 -2
- package/lib/browser/partners/group-picker.js +8 -3
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-docs.js +5 -2
- package/lib/browser/sandbox/work/work-frame.d.ts +3 -0
- package/lib/browser/sandbox/work/work-frame.js +9 -3
- package/lib/browser/sandbox/work/work-gates.d.ts +78 -0
- package/lib/browser/sandbox/work/work-gates.js +185 -0
- package/lib/browser/settings/agent-settings.js +1 -1
- package/lib/browser/settings/navigation.d.ts +38 -10
- package/lib/browser/settings/navigation.js +74 -18
- package/lib/browser/settings/settings-protocol.d.ts +16 -1
- package/lib/browser/settings/settings-protocol.js +21 -3
- package/lib/browser/settings/settings.js +3 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +15 -2
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +6 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +28 -8
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +5 -0
- package/lib/browser/style/device.js +5 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +3 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +13 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +4 -2
- package/lib/browser/util/chat-emoji.d.ts +45 -0
- package/lib/browser/util/chat-emoji.js +272 -0
- package/lib/browser/util/composer-drop.d.ts +27 -0
- package/lib/browser/util/composer-drop.js +43 -0
- package/lib/browser/util/composer-files.d.ts +49 -0
- package/lib/browser/util/composer-files.js +102 -0
- package/lib/browser/util/composer.d.ts +13 -1
- package/lib/browser/util/composer.js +24 -6
- package/lib/browser/util/markdown.d.ts +5 -0
- package/lib/browser/util/markdown.js +18 -0
- package/lib/browser/util/message.d.ts +6 -1
- package/lib/browser/util/message.js +13 -2
- package/lib/browser/util/process.d.ts +10 -13
- package/lib/browser/util/process.js +32 -84
- package/lib/browser/util/turn-join.d.ts +39 -0
- package/lib/browser/util/turn-join.js +122 -0
- package/lib/browser/workbench-services.js +1 -1
- package/package.json +7 -7
- package/public/emoji/wechat-v1.webp +0 -0
|
@@ -38,26 +38,30 @@ const lucide_react_1 = require("lucide-react");
|
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
39
|
const device_1 = require("../device/device");
|
|
40
40
|
const hold_1 = require("../device/hold");
|
|
41
|
-
const mini_program_1 = require("../device/mini-program");
|
|
42
41
|
const photo_picker_1 = require("../device/photo-picker");
|
|
43
42
|
const recent_shots_1 = require("../device/recent-shots");
|
|
44
43
|
const video_picks_1 = require("../device/video-picks");
|
|
45
44
|
const use_composer_draft_1 = require("../drafts/use-composer-draft");
|
|
46
45
|
const use_t_1 = require("../i18n/use-t");
|
|
47
46
|
const composer_1 = require("../util/composer");
|
|
47
|
+
const composer_files_1 = require("../util/composer-files");
|
|
48
48
|
const file_drag_1 = require("../util/file-drag");
|
|
49
49
|
const voice_1 = require("../util/voice");
|
|
50
50
|
const composer_attachments_1 = require("./composer-attachments");
|
|
51
51
|
const composer_box_hooks_1 = require("./composer-box-hooks");
|
|
52
|
+
const composer_drop_hooks_1 = require("./composer-drop-hooks");
|
|
52
53
|
const composer_emoji_1 = require("./composer-emoji");
|
|
54
|
+
const composer_faces_1 = require("./composer-faces");
|
|
53
55
|
const composer_media_1 = require("./composer-media");
|
|
54
56
|
const composer_menu_1 = require("./composer-menu");
|
|
57
|
+
const composer_voice_1 = require("./composer-voice");
|
|
55
58
|
const emoji_panel_1 = require("./emoji-panel");
|
|
56
59
|
const held_talk_1 = require("./held-talk");
|
|
57
60
|
const icon_1 = require("./icon");
|
|
58
61
|
const plus_menu_1 = require("./plus-menu");
|
|
59
62
|
const recent_shot_1 = require("./recent-shot");
|
|
60
|
-
const
|
|
63
|
+
const use_composer_attachments_1 = require("./use-composer-attachments");
|
|
64
|
+
const use_composer_files_1 = require("./use-composer-files");
|
|
61
65
|
const voice_talk_1 = require("./voice-talk");
|
|
62
66
|
/**
|
|
63
67
|
* The message box of every conversation: Enter sends (the Send key of a phone, as in WeChat), Shift+Enter is a new line, Alt+Enter a follow-up;
|
|
@@ -68,12 +72,14 @@ const voice_talk_1 = require("./voice-talk");
|
|
|
68
72
|
let talkFirst = false;
|
|
69
73
|
exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
70
74
|
var _a;
|
|
71
|
-
const { placeholder, working = false, compacting = false, onStop, onSend, sendTitle, commands = [], onArgumentQuery, argumentItems, onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
|
|
75
|
+
const { placeholder, working = false, compacting = false, onStop, onSend, sendTitle, commands = [], onArgumentQuery, argumentItems, onMentionQuery, mentions, mentionLabel, images: takesImages, files: takesFiles, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, droppedFiles, onError, } = props;
|
|
72
76
|
const t = (0, use_t_1.useT)();
|
|
73
77
|
const drafts = (0, use_composer_draft_1.useTaDrafts)();
|
|
74
78
|
const [text, setText] = React.useState(() => { var _a; var _b; return (_b = (draft === undefined ? undefined : (_a = drafts === null || drafts === void 0 ? void 0 : drafts.get(draft)) === null || _a === void 0 ? void 0 : _a.text)) !== null && _b !== void 0 ? _b : ''; });
|
|
75
79
|
const [caret, setCaret] = React.useState(() => text.length);
|
|
76
|
-
const
|
|
80
|
+
const uploaded = (0, use_composer_files_1.useComposerFiles)(takesFiles, cwd, t, onError);
|
|
81
|
+
const images = (0, use_composer_attachments_1.useComposerAttachments)({ images: !!takesImages, videos: props.videos, files: !!takesFiles, addFiles: uploaded.add, t, onError });
|
|
82
|
+
const attachments = images.attachments;
|
|
77
83
|
(0, use_composer_draft_1.useComposerDraft)(drafts, draft, {
|
|
78
84
|
text,
|
|
79
85
|
attachments,
|
|
@@ -81,10 +87,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
81
87
|
setText(next);
|
|
82
88
|
setCaret(next.length);
|
|
83
89
|
setDismissed(undefined);
|
|
84
|
-
|
|
85
|
-
composer_1.ComposerUtil.release(previous.filter(attachment => !kept.includes(attachment)));
|
|
86
|
-
return kept;
|
|
87
|
-
});
|
|
90
|
+
images.set(kept);
|
|
88
91
|
},
|
|
89
92
|
});
|
|
90
93
|
const [selected, setSelected] = React.useState(0);
|
|
@@ -100,6 +103,8 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
100
103
|
setStopping(false);
|
|
101
104
|
}
|
|
102
105
|
}, [busy]);
|
|
106
|
+
// When the box last sent: the button turns to stop under the pointer, and a second click then is not a stop.
|
|
107
|
+
const sentAt = React.useRef(undefined);
|
|
103
108
|
const stop = () => {
|
|
104
109
|
if (!onStop || stopping) {
|
|
105
110
|
return;
|
|
@@ -118,6 +123,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
118
123
|
const [focused, setFocused] = React.useState(false);
|
|
119
124
|
const input = React.useRef(null);
|
|
120
125
|
const picker = React.useRef(null);
|
|
126
|
+
const documents = React.useRef(null);
|
|
121
127
|
const camera = React.useRef(null);
|
|
122
128
|
const plus = React.useRef(null);
|
|
123
129
|
const panel = React.useRef(null);
|
|
@@ -127,6 +133,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
127
133
|
setClosing(handheld);
|
|
128
134
|
}, [handheld]);
|
|
129
135
|
const emojis = (0, composer_emoji_1.useComposerEmoji)(handheld, input, () => menu && setMenu(false));
|
|
136
|
+
const faces = (0, composer_faces_1.useBoxFaces)(input, text, !!takesEmoji);
|
|
130
137
|
const found = composer_1.ComposerUtil.trigger(text, caret);
|
|
131
138
|
const trigger = found && `${found.kind}:${found.start}` !== dismissed ? found : undefined;
|
|
132
139
|
const query = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' ? trigger.query : undefined;
|
|
@@ -142,10 +149,10 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
142
149
|
: []
|
|
143
150
|
: [];
|
|
144
151
|
const note = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' && onMentionQuery && !items.length ? mentions === null || mentions === void 0 ? void 0 : mentions.note : undefined;
|
|
145
|
-
const sendable = text.trim().length > 0 || attachments.length > 0;
|
|
152
|
+
const sendable = text.trim().length > 0 || attachments.length > 0 || uploaded.files.length > 0;
|
|
146
153
|
const action = composer_1.ComposerUtil.action(working, sendable, compacting);
|
|
147
|
-
// An image still being read holds the message back, rather than leaving without it.
|
|
148
|
-
const reading = !composer_1.ComposerUtil.ready(attachments);
|
|
154
|
+
// An image still being read, or a file still uploading, holds the message back, rather than leaving without it.
|
|
155
|
+
const reading = !composer_1.ComposerUtil.ready(attachments) || !uploaded.ready;
|
|
149
156
|
(0, composer_box_hooks_1.useFieldFit)(input, text, talkMode);
|
|
150
157
|
(0, composer_box_hooks_1.usePlusMenuDismiss)(menu, closeMenu, plus, panel);
|
|
151
158
|
const toggleMenu = () => {
|
|
@@ -174,7 +181,8 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
174
181
|
requestAnimationFrame(() => {
|
|
175
182
|
var _a, _b;
|
|
176
183
|
(_a = input.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
177
|
-
|
|
184
|
+
const at = faces.shownCaret(next, position);
|
|
185
|
+
(_b = input.current) === null || _b === void 0 ? void 0 : _b.setSelectionRange(at, at);
|
|
178
186
|
});
|
|
179
187
|
};
|
|
180
188
|
/** An emoji or a delete of the panel: on a phone the keyboard stays down, the caret where it was. */
|
|
@@ -192,12 +200,24 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
192
200
|
// What a talk finds as it ends, long after it began.
|
|
193
201
|
const latestCaret = React.useRef(caret);
|
|
194
202
|
latestCaret.current = caret;
|
|
203
|
+
// What a drop or a paste brings: the pictures into the box as ever, every other file under `uploads/` of the
|
|
204
|
+
// conversation, named where the caret is (useComposerDrop).
|
|
205
|
+
const drop = (0, composer_drop_hooks_1.useComposerDrop)({
|
|
206
|
+
files: !!takesFiles,
|
|
207
|
+
videos: !!props.videos,
|
|
208
|
+
droppedFiles,
|
|
209
|
+
addImages: images.add,
|
|
210
|
+
text: () => latest.current,
|
|
211
|
+
caret: () => latestCaret.current,
|
|
212
|
+
insert: edit,
|
|
213
|
+
onError,
|
|
214
|
+
});
|
|
195
215
|
const readingNow = React.useRef(reading);
|
|
196
216
|
readingNow.current = reading;
|
|
197
217
|
React.useImperativeHandle(ref, () => ({
|
|
198
218
|
text: () => latest.current,
|
|
199
219
|
setText: next => edit(next, next.length),
|
|
200
|
-
...(takesImages ? { addFiles: (files) =>
|
|
220
|
+
...(takesImages || takesFiles ? { addFiles: (files) => images.add(files) } : {}),
|
|
201
221
|
shown: () => { var _a; return !!((_a = input.current) === null || _a === void 0 ? void 0 : _a.isConnected) && input.current.getClientRects().length > 0; },
|
|
202
222
|
}));
|
|
203
223
|
const pick = (item) => {
|
|
@@ -212,17 +232,23 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
212
232
|
const typed = (item) => ((trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'command' && (item === null || item === void 0 ? void 0 : item.label) === text.trim()) || ((trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'argument' && (item === null || item === void 0 ? void 0 : item.key.trim()) === trigger.query.trim());
|
|
213
233
|
/** Sends; the sending, which fails as it does (what was sent back in the box), or nothing when there is nothing to send. */
|
|
214
234
|
const send = (key, message = text.trim()) => {
|
|
215
|
-
if ((!message && !attachments.length) || reading) {
|
|
235
|
+
if ((!message && !attachments.length && !uploaded.files.length) || reading) {
|
|
216
236
|
return undefined;
|
|
217
237
|
}
|
|
218
238
|
const attached = attachments;
|
|
239
|
+
const files = uploaded.files;
|
|
240
|
+
sentAt.current = performance.now();
|
|
219
241
|
setText('');
|
|
220
242
|
setCaret(0);
|
|
221
|
-
|
|
222
|
-
|
|
243
|
+
images.set([]);
|
|
244
|
+
uploaded.clear();
|
|
245
|
+
// Where the files are, after what was typed: the agent opens them with its tools.
|
|
246
|
+
const said = files.length ? [message, composer_files_1.ComposerFileUtil.references(files)].filter(part => part.trim()).join('\n\n') : message;
|
|
247
|
+
const sent = onSend(said, composer_1.ComposerUtil.images(attached), key);
|
|
223
248
|
sent.then(() => composer_1.ComposerUtil.release(attached), error => {
|
|
224
249
|
setText(message);
|
|
225
|
-
|
|
250
|
+
images.set(attached);
|
|
251
|
+
uploaded.restore(files);
|
|
226
252
|
onError(error);
|
|
227
253
|
});
|
|
228
254
|
return sent;
|
|
@@ -262,16 +288,6 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
262
288
|
}
|
|
263
289
|
}, onError, hints, onTalkCall ? talkCalls : []);
|
|
264
290
|
const talking = (0, composer_box_hooks_1.useTalkWiring)(talk, onListening, talkPlace);
|
|
265
|
-
// Speech goes where the caret was when listening began, between what was typed.
|
|
266
|
-
const spoken = React.useRef({ before: '', after: '' });
|
|
267
|
-
const listen = (on) => {
|
|
268
|
-
if (on) {
|
|
269
|
-
spoken.current = { before: text.slice(0, caret), after: text.slice(caret) };
|
|
270
|
-
}
|
|
271
|
-
setListening(on);
|
|
272
|
-
onListening === null || onListening === void 0 ? void 0 : onListening(on);
|
|
273
|
-
};
|
|
274
|
-
const speech = (words) => `${spoken.current.before}${words}${spoken.current.after}`;
|
|
275
291
|
const switchTalk = (on) => {
|
|
276
292
|
var _a;
|
|
277
293
|
talkFirst = on;
|
|
@@ -284,14 +300,31 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
284
300
|
requestAnimationFrame(() => { var _a; return (_a = input.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
285
301
|
}
|
|
286
302
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
303
|
+
/** Listening began or ended: the box shows it, and the microphone too. */
|
|
304
|
+
const listen = (on) => {
|
|
305
|
+
setListening(on);
|
|
306
|
+
onListening === null || onListening === void 0 ? void 0 : onListening(on);
|
|
307
|
+
};
|
|
308
|
+
const microphone = (0, composer_voice_1.useMicrophone)({
|
|
309
|
+
touch,
|
|
310
|
+
talkMode,
|
|
311
|
+
hints,
|
|
312
|
+
voiceSends: !!voiceSends,
|
|
313
|
+
said: () => ({ text: latest.current, caret: latestCaret.current }),
|
|
314
|
+
onHear: (words, at) => {
|
|
315
|
+
if (voiceSends) {
|
|
316
|
+
send('enter', words.trim());
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
setText(words);
|
|
320
|
+
setCaret(at);
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
onInsert: words => edit(...composer_1.ComposerUtil.insert(latest.current, latestCaret.current, words)),
|
|
324
|
+
onListening: listen,
|
|
325
|
+
onTalkKey: switchTalk,
|
|
326
|
+
onError,
|
|
327
|
+
});
|
|
295
328
|
// A finger held on the box while the keyboard is down talks (the field takes no finger then, .ta-talkable: a tap
|
|
296
329
|
// on it is the box's, which types in it). With the keyboard up, the field and the box are the system's.
|
|
297
330
|
const held = (0, hold_1.useHeld)();
|
|
@@ -307,43 +340,9 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
307
340
|
: undefined);
|
|
308
341
|
const box = React.useRef(null);
|
|
309
342
|
(0, composer_box_hooks_1.useTapToType)(box, input, talkable);
|
|
310
|
-
const remove = (id) => {
|
|
311
|
-
composer_1.ComposerUtil.release(attachments.filter(attachment => attachment.id === id));
|
|
312
|
-
setAttachments(previous => previous.filter(attachment => attachment.id !== id));
|
|
313
|
-
};
|
|
314
|
-
// The previews of a box that goes away go with it.
|
|
315
|
-
const shown = React.useRef(attachments);
|
|
316
|
-
shown.current = attachments;
|
|
317
|
-
React.useEffect(() => () => composer_1.ComposerUtil.release(shown.current), []);
|
|
318
|
-
/** Shows each image at once from its file, and reads them all at the same time. */
|
|
319
|
-
const addFiles = (list) => {
|
|
320
|
-
const added = [];
|
|
321
|
-
for (const file of video_picks_1.VideoPicks.take(list, props.videos)) {
|
|
322
|
-
const reason = composer_1.ComposerUtil.rejectImage(file, attachments.length + added.length);
|
|
323
|
-
if (reason) {
|
|
324
|
-
onError(new Error(t(`ta.composer.image.${reason}`, { name: file.name })));
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
added.push({ attachment: { id: crypto.randomUUID(), preview: URL.createObjectURL(file) }, file });
|
|
328
|
-
}
|
|
329
|
-
if (!added.length) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
setAttachments(previous => [...previous, ...added.map(({ attachment }) => attachment)]);
|
|
333
|
-
for (const { attachment, file } of added) {
|
|
334
|
-
void (0, composer_attachments_1.readImage)(file).then(image => {
|
|
335
|
-
if (!image) {
|
|
336
|
-
composer_1.ComposerUtil.release([attachment]);
|
|
337
|
-
}
|
|
338
|
-
setAttachments(previous => image
|
|
339
|
-
? previous.map(other => (other.id === attachment.id ? { ...other, image } : other))
|
|
340
|
-
: previous.filter(other => other.id !== attachment.id));
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
343
|
const onPicked = (event) => {
|
|
345
344
|
if (event.target.files) {
|
|
346
|
-
|
|
345
|
+
images.add(event.target.files);
|
|
347
346
|
}
|
|
348
347
|
event.target.value = '';
|
|
349
348
|
};
|
|
@@ -372,10 +371,21 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
372
371
|
}
|
|
373
372
|
};
|
|
374
373
|
const onPaste = (event) => {
|
|
375
|
-
const pasted =
|
|
374
|
+
const pasted = takesFiles || droppedFiles
|
|
375
|
+
? Array.from(event.clipboardData.files)
|
|
376
|
+
: takesImages
|
|
377
|
+
? video_picks_1.VideoPicks.pasted(event.clipboardData.files, !!props.videos)
|
|
378
|
+
: [];
|
|
376
379
|
if (pasted.length) {
|
|
377
380
|
event.preventDefault();
|
|
378
|
-
|
|
381
|
+
drop.take(pasted);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
/** A copy of the field with faces: their names in brackets, and what is cut away. */
|
|
385
|
+
const copyFaces = (event, cut) => {
|
|
386
|
+
const left = faces.copied(event, cut);
|
|
387
|
+
if (left !== undefined) {
|
|
388
|
+
edit(left, left.length);
|
|
379
389
|
}
|
|
380
390
|
};
|
|
381
391
|
const onDrop = (event) => {
|
|
@@ -386,9 +396,10 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
386
396
|
edit(...composer_1.ComposerUtil.insert(text, caret, `${file_drag_1.FileDragUtil.references(files, cwd)} `));
|
|
387
397
|
return;
|
|
388
398
|
}
|
|
389
|
-
|
|
399
|
+
const dropped = Array.from(event.dataTransfer.files);
|
|
400
|
+
if (dropped.length) {
|
|
390
401
|
event.preventDefault();
|
|
391
|
-
|
|
402
|
+
drop.take(dropped);
|
|
392
403
|
}
|
|
393
404
|
};
|
|
394
405
|
const own = [];
|
|
@@ -396,7 +407,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
396
407
|
var _a, _b, _c;
|
|
397
408
|
// The Ta app on iOS opens its library at once (and asks for the photos, for the screenshots, once picked).
|
|
398
409
|
if (photo_picker_1.PhotoPicker.available()) {
|
|
399
|
-
photo_picker_1.PhotoPicker.pickInto(composer_1.MAX_IMAGES - attachments.length,
|
|
410
|
+
photo_picker_1.PhotoPicker.pickInto(composer_1.MAX_IMAGES - attachments.length, images.add, props.videos);
|
|
400
411
|
return;
|
|
401
412
|
}
|
|
402
413
|
if (recentShots) {
|
|
@@ -407,6 +418,9 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
407
418
|
if (takesImages) {
|
|
408
419
|
own.push(...(0, composer_media_1.mediaTiles)({ phone: handheld && touch, videos: !!props.videos, t, pick: pickImages, shoot: () => { var _a; return (_a = camera.current) === null || _a === void 0 ? void 0 : _a.click(); } }));
|
|
409
420
|
}
|
|
421
|
+
if (takesFiles) {
|
|
422
|
+
own.push((0, composer_media_1.fileTile)(t, () => { var _a; return (_a = documents.current) === null || _a === void 0 ? void 0 : _a.click(); }));
|
|
423
|
+
}
|
|
410
424
|
if (mentionLabel) {
|
|
411
425
|
own.push({ key: 'mention', label: mentionLabel, icon: React.createElement(icon_1.Icon, { icon: lucide_react_1.AtSign, size: 16 }), run: () => edit(...composer_1.ComposerUtil.insert(text, caret, '@')) });
|
|
412
426
|
}
|
|
@@ -426,7 +440,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
426
440
|
above,
|
|
427
441
|
head && React.createElement("div", { className: "ta-console-head" }, head),
|
|
428
442
|
React.createElement("div", { ref: box, className: `ta-console-box${dragging ? ' ta-dragging' : ''}${talkable ? ' ta-talkable' : ''}`, ...boxHold, onDragOver: event => {
|
|
429
|
-
if (file_drag_1.FileDragUtil.has(event.dataTransfer) || (takesImages && event.dataTransfer.types.includes('Files'))) {
|
|
443
|
+
if (file_drag_1.FileDragUtil.has(event.dataTransfer) || ((takesImages || takesFiles || droppedFiles) && event.dataTransfer.types.includes('Files'))) {
|
|
430
444
|
event.preventDefault();
|
|
431
445
|
setDragging(true);
|
|
432
446
|
}
|
|
@@ -438,20 +452,28 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
438
452
|
(_a = input.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
439
453
|
}
|
|
440
454
|
} },
|
|
441
|
-
attachments.length > 0 && React.createElement(composer_attachments_1.Attachments, { attachments: attachments, onRemove: remove }),
|
|
455
|
+
attachments.length > 0 && React.createElement(composer_attachments_1.Attachments, { attachments: attachments, onRemove: images.remove }),
|
|
456
|
+
uploaded.files.length > 0 && React.createElement(composer_attachments_1.ComposerFiles, { files: uploaded.files, onRemove: uploaded.remove }),
|
|
442
457
|
React.createElement("div", { className: "ta-console-row ta-conversation" },
|
|
443
458
|
sections.length > 0 && (React.createElement("div", { className: "ta-plus", ref: plus },
|
|
444
459
|
React.createElement(icon_1.IconButton, { icon: lucide_react_1.Plus, label: t('ta.composer.more'), className: `ta-attach ta-plus-button ${menu ? 'ta-on' : ''}`, onClick: toggleMenu }),
|
|
445
460
|
menu && !handheld && React.createElement(plus_menu_1.PlusMenu, { sections: sections, onClose: closeMenu }),
|
|
446
|
-
takesImages && recentShots && (React.createElement(recent_shot_1.RecentShotOffer, { box: box, activity: `${text}|${attachments.length}|${menu}|${talkMode}`, onPick: file =>
|
|
461
|
+
takesImages && recentShots && (React.createElement(recent_shot_1.RecentShotOffer, { box: box, activity: `${text}|${attachments.length}|${menu}|${talkMode}`, onPick: file => images.add([file]) })))),
|
|
447
462
|
takesImages && React.createElement(composer_media_1.MediaInputs, { picker: picker, camera: handheld && touch ? camera : undefined, videos: !!props.videos, onChange: onPicked }),
|
|
463
|
+
takesFiles && React.createElement(composer_media_1.FileInput, { picker: documents, onChange: onPicked }),
|
|
448
464
|
talkMode && React.createElement(voice_talk_1.TalkBar, { talk: talk }),
|
|
449
|
-
React.createElement("textarea", { ref: input, hidden: talkMode, rows: 1, value:
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
465
|
+
React.createElement("textarea", { ref: input, hidden: talkMode, rows: 1, value: faces.shown, className: faces.mirror ? 'ta-faced' : undefined, autoFocus: autoFocus, enterKeyHint: "send", "aria-label": t('ta.composer.label'), "aria-controls": items.length ? menuId : undefined, "aria-activedescendant": items.length ? `${menuId}-${selected}` : undefined, placeholder: listening ? t('ta.composer.listening') : placeholder, onChange: event => {
|
|
466
|
+
const [next, position] = faces.typed(event.target.value, event.target.selectionStart);
|
|
467
|
+
setText(next);
|
|
468
|
+
onTextChange === null || onTextChange === void 0 ? void 0 : onTextChange(next);
|
|
469
|
+
setCaret(position);
|
|
453
470
|
setSelected(0);
|
|
454
|
-
|
|
471
|
+
// A face typed out by its name ([微笑]) turns into the face: the caret stays where it was,
|
|
472
|
+
// the browser told so, that it does not put its own back before the face.
|
|
473
|
+
if (faces.shown !== event.target.value) {
|
|
474
|
+
faces.settle(event.target, next, position);
|
|
475
|
+
}
|
|
476
|
+
}, onSelect: event => setCaret(faces.saidCaret(event.currentTarget.value, event.currentTarget.selectionStart)), onCopy: faces.mirror ? event => copyFaces(event, false) : undefined, onCut: faces.mirror ? event => copyFaces(event, true) : undefined, onKeyDown: onKeyDown, onPaste: onPaste, onFocus: () => {
|
|
455
477
|
setFocused(true);
|
|
456
478
|
// The keyboard comes in place of the panel.
|
|
457
479
|
if (menu && handheld) {
|
|
@@ -461,6 +483,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
461
483
|
emojis.close();
|
|
462
484
|
}
|
|
463
485
|
}, onBlur: () => setFocused(false) }),
|
|
486
|
+
faces.mirror && !talkMode && faces.mirror,
|
|
464
487
|
takesEmoji && (React.createElement(composer_emoji_1.ComposerEmojiButton, { emoji: emojis, handheld: handheld, onPick: emoji => type(...emoji_panel_1.EmojiPanelUtil.insert(text, caret, emoji)) })),
|
|
465
488
|
after,
|
|
466
489
|
microphone,
|
|
@@ -472,7 +495,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
472
495
|
? sendTitle
|
|
473
496
|
: t('ta.send'), "aria-label": action === 'stop' ? t(stopping ? 'ta.composer.stopping' : 'ta.stop') : t('ta.send'), "aria-busy": action === 'stop' && stopping, "data-ta-action": action === 'stop' ? 'stop' : 'send',
|
|
474
497
|
// Pressed with the keyboard open, the box keeps the focus and the keyboard stays, as in WeChat.
|
|
475
|
-
onPointerDown: event => document.activeElement === input.current && event.preventDefault(), onClick: () => (action === 'stop' ? stop() : send('enter')) }, action === 'stop' && stopping ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(icon_1.Icon, { icon: action === 'stop' ? lucide_react_1.Square : lucide_react_1.ArrowUp, size: action === 'stop' ? 14 : 18 }))))),
|
|
498
|
+
onPointerDown: event => document.activeElement === input.current && event.preventDefault(), onClick: () => (action === 'stop' ? !composer_1.ComposerUtil.accidentalStop(sentAt.current, performance.now()) && stop() : send('enter')) }, action === 'stop' && stopping ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(icon_1.Icon, { icon: action === 'stop' ? lucide_react_1.Square : lucide_react_1.ArrowUp, size: action === 'stop' ? 14 : 18 }))))),
|
|
476
499
|
takesEmoji && handheld && (emojis.open || emojis.closing) && (React.createElement(emoji_panel_1.EmojiPanel, { ref: emojis.panel, docked: true, closing: !emojis.open, onClosed: emojis.closed, onPick: emoji => type(...emoji_panel_1.EmojiPanelUtil.insert(text, caret, emoji)), onDelete: () => type(...emoji_panel_1.EmojiPanelUtil.deleteBack(text, caret)), sendable: sendable && !reading, onSend: () => void send('enter') })),
|
|
477
500
|
handheld && (menu || closing) && sections.length > 0 && (React.createElement(plus_menu_1.PlusMenu, { ref: panel, sections: sections, docked: true, closing: !menu, onClosed: () => setClosing(false), onClose: closeMenu }))));
|
|
478
501
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** What a drop or a paste into the box is given: the files, where the box puts the text they name. */
|
|
2
|
+
export interface ComposerDropHook {
|
|
3
|
+
/** Takes what came, as the box takes it: the pictures into it as ever, every other file where it takes none. */
|
|
4
|
+
take(files: File[]): void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The files of a drop or a paste into the message box (ComposerBoxProps.droppedFiles): the pictures (and the videos the
|
|
8
|
+
* box takes) into it as ever, and every other file where the box takes none, written by its owner under `uploads/` of
|
|
9
|
+
* the conversation and named as an `@` reference put where the caret is (ComposerDropUtil). A box that takes files of
|
|
10
|
+
* its own (files) keeps them as it did; one with neither hands them to the pictures, which says what it cannot send.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useComposerDrop(options: {
|
|
13
|
+
/** The box takes files of its own (ComposerBoxProps.files): they go there, pictures and all. */
|
|
14
|
+
files: boolean;
|
|
15
|
+
videos: boolean;
|
|
16
|
+
droppedFiles: ComposerBoxPropsFiles;
|
|
17
|
+
addImages(files: File[]): void;
|
|
18
|
+
/** Where the text typed so far is, as it is now: a file written a moment later still lands where the caret was. */
|
|
19
|
+
text(): string;
|
|
20
|
+
caret(): number;
|
|
21
|
+
insert(text: string, position: number): void;
|
|
22
|
+
onError(error: unknown): void;
|
|
23
|
+
}): ComposerDropHook;
|
|
24
|
+
/** ComposerBoxProps.droppedFiles, as the hook takes it. */
|
|
25
|
+
type ComposerBoxPropsFiles = ((files: File[]) => Promise<string[]>) | undefined;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=composer-drop-hooks.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
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.useComposerDrop = useComposerDrop;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const composer_1 = require("../util/composer");
|
|
39
|
+
const composer_drop_1 = require("../util/composer-drop");
|
|
40
|
+
/**
|
|
41
|
+
* The files of a drop or a paste into the message box (ComposerBoxProps.droppedFiles): the pictures (and the videos the
|
|
42
|
+
* box takes) into it as ever, and every other file where the box takes none, written by its owner under `uploads/` of
|
|
43
|
+
* the conversation and named as an `@` reference put where the caret is (ComposerDropUtil). A box that takes files of
|
|
44
|
+
* its own (files) keeps them as it did; one with neither hands them to the pictures, which says what it cannot send.
|
|
45
|
+
*/
|
|
46
|
+
function useComposerDrop(options) {
|
|
47
|
+
const { files, videos, droppedFiles, addImages, text, caret, insert, onError } = options;
|
|
48
|
+
return {
|
|
49
|
+
take: React.useCallback((coming) => {
|
|
50
|
+
const write = files ? undefined : droppedFiles;
|
|
51
|
+
if (!coming.length) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!write) {
|
|
55
|
+
addImages(coming);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const { pictures, others } = composer_drop_1.ComposerDropUtil.part(coming, videos);
|
|
59
|
+
if (pictures.length) {
|
|
60
|
+
addImages(pictures);
|
|
61
|
+
}
|
|
62
|
+
if (!others.length) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// As the files come: what was typed a moment before they are written is still there.
|
|
66
|
+
void write(others)
|
|
67
|
+
.then(paths => insert(...composer_1.ComposerUtil.insert(text(), caret(), `${composer_drop_1.ComposerDropUtil.references(paths)} `)))
|
|
68
|
+
.catch(error => onError(error));
|
|
69
|
+
}, [files, videos, droppedFiles, addImages, text, caret, insert, onError]),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=composer-drop-hooks.js.map
|
|
@@ -78,7 +78,7 @@ function ComposerEmojiButton({ emoji, handheld, onPick }) {
|
|
|
78
78
|
const t = (0, use_t_1.useT)();
|
|
79
79
|
const keyboard = emoji.open && handheld;
|
|
80
80
|
return (React.createElement("div", { className: "ta-emoji-anchor", ref: emoji.anchor },
|
|
81
|
-
React.createElement("button", { type: "button", className: `ta-
|
|
81
|
+
React.createElement("button", { type: "button", className: `ta-emoji-button${emoji.open ? ' ta-on' : ''}`, title: t(keyboard ? 'ta.composer.keyboard' : 'ta.composer.emoji'), "aria-label": t(keyboard ? 'ta.composer.keyboard' : 'ta.composer.emoji'), "aria-expanded": emoji.open,
|
|
82
82
|
// On a computer the field keeps the focus while the popover opens.
|
|
83
83
|
onPointerDown: event => !handheld && event.preventDefault(), onClick: emoji.toggle },
|
|
84
84
|
React.createElement(icon_1.Icon, { icon: keyboard ? lucide_react_1.Keyboard : lucide_react_1.Smile, size: 20 })),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The faces of the field of a box (ComposerBoxProps.emoji), as WeChat's box shows them: the text is still said the way
|
|
4
|
+
* it is sent (`[微笑]`), and the field shows each face as one character of its own font, drawn as the face (FaceField),
|
|
5
|
+
* which the caret steps over and Delete takes whole. Everything here is between the two.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useBoxFaces(field: React.RefObject<HTMLTextAreaElement | null>, text: string, takes: boolean): {
|
|
8
|
+
shown: string;
|
|
9
|
+
taken: boolean;
|
|
10
|
+
shownCaret: (said: string, position: number) => number;
|
|
11
|
+
saidCaret: (value: string, position: number) => number;
|
|
12
|
+
typed: (value: string, position: number) => [string, number];
|
|
13
|
+
settle: (field: HTMLTextAreaElement, said: string, position: number) => void;
|
|
14
|
+
copied: (event: React.ClipboardEvent<HTMLTextAreaElement>, cut: boolean) => string | undefined;
|
|
15
|
+
mirror: React.JSX.Element | undefined;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=composer-faces.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
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.useBoxFaces = useBoxFaces;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const chat_emoji_1 = require("./chat-emoji");
|
|
39
|
+
/**
|
|
40
|
+
* The faces of the field of a box (ComposerBoxProps.emoji), as WeChat's box shows them: the text is still said the way
|
|
41
|
+
* it is sent (`[微笑]`), and the field shows each face as one character of its own font, drawn as the face (FaceField),
|
|
42
|
+
* which the caret steps over and Delete takes whole. Everything here is between the two.
|
|
43
|
+
*/
|
|
44
|
+
function useBoxFaces(field, text, takes) {
|
|
45
|
+
// What the field holds: each face one character.
|
|
46
|
+
const shown = takes ? chat_emoji_1.ChatEmojiUtil.glyphs(text) : text;
|
|
47
|
+
/** Where a place of the text is in the field, and back. */
|
|
48
|
+
const shownCaret = React.useCallback((said, position) => (takes ? chat_emoji_1.ChatEmojiUtil.shownCaret(said, position) : position), [takes]);
|
|
49
|
+
const saidCaret = React.useCallback((value, position) => (takes ? chat_emoji_1.ChatEmojiUtil.saidCaret(value, position) : position), [takes]);
|
|
50
|
+
/** What the field was given: the text as it is said, and where the caret is in it. */
|
|
51
|
+
const typed = React.useCallback((value, position) => [takes ? chat_emoji_1.ChatEmojiUtil.codes(value) : value, saidCaret(value, position)], [takes, saidCaret]);
|
|
52
|
+
/** A face typed out by its name ([微笑]) turned into the face: the caret put where it was, after it. */
|
|
53
|
+
const settle = (field, said, position) => {
|
|
54
|
+
const at = chat_emoji_1.ChatEmojiUtil.shownCaret(said, position);
|
|
55
|
+
field.setSelectionRange(at, at);
|
|
56
|
+
};
|
|
57
|
+
/** Copied or cut, faces go as their names in brackets, as WeChat pastes them; what comes back is the text left. */
|
|
58
|
+
const copied = (event, cut) => {
|
|
59
|
+
const element = event.currentTarget;
|
|
60
|
+
const from = element.selectionStart;
|
|
61
|
+
const to = element.selectionEnd;
|
|
62
|
+
if (!takes || from === to) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
event.clipboardData.setData('text/plain', chat_emoji_1.ChatEmojiUtil.codes(element.value.slice(from, to)));
|
|
67
|
+
return cut ? chat_emoji_1.ChatEmojiUtil.codes(element.value.slice(0, from) + element.value.slice(to)) : undefined;
|
|
68
|
+
};
|
|
69
|
+
/** The faces of what the field shows, over it. */
|
|
70
|
+
const mirror = shown === text ? undefined : React.createElement(chat_emoji_1.FaceField, { field: field, text: shown });
|
|
71
|
+
return { shown, taken: takes, shownCaret, saidCaret, typed, settle, copied, mirror };
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=composer-faces.js.map
|
|
@@ -24,4 +24,14 @@ export declare function MediaInputs({ picker, camera, videos, onChange, }: {
|
|
|
24
24
|
videos: boolean;
|
|
25
25
|
onChange(event: React.ChangeEvent<HTMLInputElement>): void;
|
|
26
26
|
}): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* The tile of the + that adds files at all (ComposerBoxProps.files): a PDF, a sheet, a picture a model cannot see.
|
|
29
|
+
* They go to `uploads/` of the conversation, which the message names as `@` references.
|
|
30
|
+
*/
|
|
31
|
+
export declare function fileTile(t: ReturnType<typeof useT>, pick: () => void): ComposerAction;
|
|
32
|
+
/** The field of those files, hidden: they are anything, so it takes anything. */
|
|
33
|
+
export declare function FileInput({ picker, onChange }: {
|
|
34
|
+
picker: React.Ref<HTMLInputElement>;
|
|
35
|
+
onChange(event: React.ChangeEvent<HTMLInputElement>): void;
|
|
36
|
+
}): React.JSX.Element;
|
|
27
37
|
//# sourceMappingURL=composer-media.d.ts.map
|
|
@@ -35,6 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.mediaTiles = mediaTiles;
|
|
37
37
|
exports.MediaInputs = MediaInputs;
|
|
38
|
+
exports.fileTile = fileTile;
|
|
39
|
+
exports.FileInput = FileInput;
|
|
38
40
|
const lucide_react_1 = require("lucide-react");
|
|
39
41
|
const React = __importStar(require("react"));
|
|
40
42
|
const video_picks_1 = require("../device/video-picks");
|
|
@@ -71,4 +73,15 @@ function MediaInputs({ picker, camera, videos, onChange, }) {
|
|
|
71
73
|
React.createElement("input", { ref: picker, type: "file", accept: video_picks_1.VideoPicks.accept(composer_1.IMAGE_TYPES, videos), multiple: true, hidden: true, onChange: onChange }),
|
|
72
74
|
camera && React.createElement("input", { ref: camera, type: "file", accept: videos ? 'image/*,video/*' : 'image/*', capture: "environment", hidden: true, onChange: onChange })));
|
|
73
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The tile of the + that adds files at all (ComposerBoxProps.files): a PDF, a sheet, a picture a model cannot see.
|
|
78
|
+
* They go to `uploads/` of the conversation, which the message names as `@` references.
|
|
79
|
+
*/
|
|
80
|
+
function fileTile(t, pick) {
|
|
81
|
+
return { key: 'file', label: t('ta.composer.addFile'), icon: React.createElement(icon_1.Icon, { icon: lucide_react_1.FilePlus2, size: 16 }), run: pick };
|
|
82
|
+
}
|
|
83
|
+
/** The field of those files, hidden: they are anything, so it takes anything. */
|
|
84
|
+
function FileInput({ picker, onChange }) {
|
|
85
|
+
return React.createElement("input", { ref: picker, type: "file", multiple: true, hidden: true, onChange: onChange });
|
|
86
|
+
}
|
|
74
87
|
//# sourceMappingURL=composer-media.js.map
|
|
@@ -18,6 +18,10 @@ export interface ComposerDraft {
|
|
|
18
18
|
export declare namespace ComposerTarget {
|
|
19
19
|
/** A box shown; returns what forgets it. */
|
|
20
20
|
function set(handle: ComposerBoxHandle): () => void;
|
|
21
|
+
/** Whether a box is in front to type in. */
|
|
22
|
+
function present(): boolean;
|
|
23
|
+
/** Types a key pressed on the page at the end of what the box in front holds, and focuses it; false when none is shown. */
|
|
24
|
+
function type(key: string): boolean;
|
|
21
25
|
/** Puts the draft in the box in front, and focuses it; false when no box is shown. */
|
|
22
26
|
function add(draft: ComposerDraft): boolean;
|
|
23
27
|
}
|