@celljs/ta-web 4.9.1 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -3
- package/README.md +4 -3
- package/esm/browser/assistant/assistant-chat-list.js +8 -2
- package/esm/browser/assistant/assistant-extension.d.ts +8 -1
- package/esm/browser/assistant/assistant-extension.js +20 -0
- package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
- package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-util.js +5 -3
- package/esm/browser/assistant/assistant-view.js +81 -56
- package/esm/browser/assistant/assistant.d.ts +10 -1
- package/esm/browser/assistant/assistant.js +44 -5
- package/esm/browser/chat/chat-packages.d.ts +39 -0
- package/esm/browser/chat/chat-packages.js +70 -0
- package/esm/browser/chat/chat-protocol.d.ts +23 -1
- package/esm/browser/chat/chat-stores.d.ts +59 -0
- package/esm/browser/chat/chat-stores.js +121 -0
- package/esm/browser/chat/chat-util.d.ts +17 -0
- package/esm/browser/chat/chat-util.js +61 -0
- package/esm/browser/chat/chat-view.js +33 -12
- package/esm/browser/chat/chat.d.ts +31 -39
- package/esm/browser/chat/chat.js +226 -175
- package/esm/browser/components/app-nav.d.ts +6 -3
- package/esm/browser/components/app-nav.js +19 -10
- package/esm/browser/components/app-shell-hooks.d.ts +2 -2
- package/esm/browser/components/app-shell-hooks.js +7 -3
- package/esm/browser/components/app-view.js +75 -21
- package/esm/browser/components/chat-list.d.ts +20 -2
- package/esm/browser/components/chat-list.js +138 -22
- package/esm/browser/components/composer-box.d.ts +5 -5
- package/esm/browser/components/composer-box.js +111 -4
- package/esm/browser/components/composer.d.ts +7 -0
- package/esm/browser/components/composer.js +5 -4
- package/esm/browser/components/connection-bar.js +50 -17
- package/esm/browser/components/context-menu.d.ts +30 -4
- package/esm/browser/components/context-menu.js +199 -37
- package/esm/browser/components/conversation-scroll.d.ts +129 -6
- package/esm/browser/components/conversation-scroll.js +429 -109
- package/esm/browser/components/earlier-messages.d.ts +2 -1
- package/esm/browser/components/earlier-messages.js +2 -17
- package/esm/browser/components/editor-area.d.ts +3 -1
- package/esm/browser/components/editor-area.js +6 -5
- package/esm/browser/components/empty-pictures.d.ts +0 -2
- package/esm/browser/components/empty-pictures.js +0 -16
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +26 -8
- package/esm/browser/components/held-talk.d.ts +28 -0
- package/esm/browser/components/held-talk.js +76 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/icon.d.ts +2 -2
- package/esm/browser/components/icon.js +5 -6
- package/esm/browser/components/image-viewer.d.ts +124 -0
- package/esm/browser/components/image-viewer.js +397 -0
- package/esm/browser/components/lightbox.d.ts +11 -0
- package/esm/browser/components/lightbox.js +24 -0
- package/esm/browser/components/markdown.d.ts +6 -2
- package/esm/browser/components/markdown.js +24 -10
- package/esm/browser/components/media.js +1 -10
- package/esm/browser/components/message-footer.d.ts +16 -2
- package/esm/browser/components/message-footer.js +29 -12
- package/esm/browser/components/message-list.d.ts +24 -3
- package/esm/browser/components/message-list.js +149 -20
- package/esm/browser/components/message-menu.d.ts +3 -1
- package/esm/browser/components/message-menu.js +18 -3
- package/esm/browser/components/nav-places.d.ts +16 -1
- package/esm/browser/components/nav-places.js +12 -3
- package/esm/browser/components/phone-shell.d.ts +4 -1
- package/esm/browser/components/phone-shell.js +3 -1
- package/esm/browser/components/run-status.js +3 -3
- package/esm/browser/components/session-settings.d.ts +6 -0
- package/esm/browser/components/session-settings.js +14 -1
- package/esm/browser/components/session-view.js +8 -4
- package/esm/browser/components/settings-parts.d.ts +2 -2
- package/esm/browser/components/settings-parts.js +24 -1
- package/esm/browser/components/swipe-row.d.ts +2 -2
- package/esm/browser/components/swipe-row.js +7 -3
- package/esm/browser/components/tool-view.js +14 -12
- package/esm/browser/components/voice-button.d.ts +1 -1
- package/esm/browser/components/voice-button.js +1 -1
- package/esm/browser/components/voice-talk.d.ts +43 -0
- package/esm/browser/components/voice-talk.js +222 -0
- package/esm/browser/device/device.d.ts +3 -0
- package/esm/browser/device/device.js +11 -1
- package/esm/browser/device/hold.d.ts +42 -0
- package/esm/browser/device/hold.js +136 -0
- package/esm/browser/device/launch-screen.d.ts +1 -1
- package/esm/browser/device/launch-screen.js +1 -1
- package/esm/browser/device/long-press.d.ts +2 -0
- package/esm/browser/device/long-press.js +16 -1
- package/esm/browser/device/pull-down.d.ts +4 -2
- package/esm/browser/device/pull-down.js +64 -76
- package/esm/browser/device/row-swipe.d.ts +35 -10
- package/esm/browser/device/row-swipe.js +149 -71
- package/esm/browser/device/shake-undo.d.ts +16 -0
- package/esm/browser/device/shake-undo.js +59 -0
- package/esm/browser/device/sheet-swipe.d.ts +118 -18
- package/esm/browser/device/sheet-swipe.js +406 -107
- package/esm/browser/extension/web-extension-api.d.ts +97 -1
- package/esm/browser/extension/web-extension-code.d.ts +6 -0
- package/esm/browser/extension/web-extension-code.js +24 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
- package/esm/browser/extension/web-extension-protocol.js +8 -0
- package/esm/browser/extension/web-extensions.d.ts +14 -1
- package/esm/browser/extension/web-extensions.js +122 -23
- package/esm/browser/files/files-protocol.d.ts +25 -0
- package/esm/browser/files/files-protocol.js +2 -0
- package/esm/browser/files/files.d.ts +35 -0
- package/esm/browser/files/files.js +119 -0
- package/esm/browser/i18n/locales.d.ts +24 -2
- package/esm/browser/i18n/messages.d.ts +23 -1
- package/esm/browser/i18n/messages.js +48 -4
- package/esm/browser/index.d.ts +6 -0
- package/esm/browser/index.js +6 -0
- package/esm/browser/notices/notices-protocol.d.ts +9 -1
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +20 -10
- package/esm/browser/offline/device-values.d.ts +55 -0
- package/esm/browser/offline/device-values.js +142 -0
- package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
- package/esm/browser/offline/kept-chats-protocol.js +2 -0
- package/esm/browser/offline/kept-chats.d.ts +47 -0
- package/esm/browser/offline/kept-chats.js +146 -0
- package/esm/browser/offline/offline-reads.d.ts +44 -0
- package/esm/browser/offline/offline-reads.js +107 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +57 -17
- package/esm/browser/style/device.js +27 -4
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +67 -15
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +46 -3
- package/esm/browser/util/frame.d.ts +5 -4
- package/esm/browser/util/frame.js +5 -4
- package/esm/browser/util/markdown.d.ts +18 -1
- package/esm/browser/util/markdown.js +119 -5
- package/esm/browser/util/process.d.ts +21 -0
- package/esm/browser/util/process.js +45 -1
- package/esm/browser/util/voice.d.ts +5 -2
- package/esm/browser/util/voice.js +6 -3
- package/esm/browser/util/zoom.d.ts +46 -0
- package/esm/browser/util/zoom.js +96 -0
- package/esm/browser/workbench-calls.d.ts +59 -0
- package/esm/browser/workbench-calls.js +141 -0
- package/esm/browser/workbench-protocol.d.ts +5 -1
- package/esm/browser/workbench-util.d.ts +7 -0
- package/esm/browser/workbench-util.js +9 -2
- package/esm/browser/workbench.d.ts +14 -5
- package/esm/browser/workbench.js +51 -31
- package/lib/browser/assistant/assistant-chat-list.js +8 -2
- package/lib/browser/assistant/assistant-extension.d.ts +8 -1
- package/lib/browser/assistant/assistant-extension.js +20 -0
- package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
- package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-util.js +5 -3
- package/lib/browser/assistant/assistant-view.js +78 -53
- package/lib/browser/assistant/assistant.d.ts +10 -1
- package/lib/browser/assistant/assistant.js +44 -5
- package/lib/browser/chat/chat-packages.d.ts +40 -0
- package/lib/browser/chat/chat-packages.js +74 -0
- package/lib/browser/chat/chat-protocol.d.ts +23 -1
- package/lib/browser/chat/chat-stores.d.ts +60 -0
- package/lib/browser/chat/chat-stores.js +125 -0
- package/lib/browser/chat/chat-util.d.ts +18 -0
- package/lib/browser/chat/chat-util.js +64 -0
- package/lib/browser/chat/chat-view.js +33 -12
- package/lib/browser/chat/chat.d.ts +31 -39
- package/lib/browser/chat/chat.js +227 -176
- package/lib/browser/components/app-nav.d.ts +6 -3
- package/lib/browser/components/app-nav.js +17 -8
- package/lib/browser/components/app-shell-hooks.d.ts +2 -2
- package/lib/browser/components/app-shell-hooks.js +7 -3
- package/lib/browser/components/app-view.js +74 -20
- package/lib/browser/components/chat-list.d.ts +20 -2
- package/lib/browser/components/chat-list.js +137 -21
- package/lib/browser/components/composer-box.d.ts +5 -5
- package/lib/browser/components/composer-box.js +111 -4
- package/lib/browser/components/composer.d.ts +7 -0
- package/lib/browser/components/composer.js +5 -4
- package/lib/browser/components/connection-bar.js +48 -15
- package/lib/browser/components/context-menu.d.ts +30 -4
- package/lib/browser/components/context-menu.js +198 -36
- package/lib/browser/components/conversation-scroll.d.ts +129 -6
- package/lib/browser/components/conversation-scroll.js +431 -110
- package/lib/browser/components/earlier-messages.d.ts +2 -1
- package/lib/browser/components/earlier-messages.js +2 -17
- package/lib/browser/components/editor-area.d.ts +3 -1
- package/lib/browser/components/editor-area.js +5 -4
- package/lib/browser/components/empty-pictures.d.ts +0 -2
- package/lib/browser/components/empty-pictures.js +0 -17
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +26 -8
- package/lib/browser/components/held-talk.d.ts +29 -0
- package/lib/browser/components/held-talk.js +79 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/icon.d.ts +2 -2
- package/lib/browser/components/icon.js +7 -6
- package/lib/browser/components/image-viewer.d.ts +125 -0
- package/lib/browser/components/image-viewer.js +435 -0
- package/lib/browser/components/lightbox.d.ts +12 -0
- package/lib/browser/components/lightbox.js +60 -0
- package/lib/browser/components/markdown.d.ts +6 -2
- package/lib/browser/components/markdown.js +24 -10
- package/lib/browser/components/media.js +2 -11
- package/lib/browser/components/message-footer.d.ts +16 -2
- package/lib/browser/components/message-footer.js +31 -12
- package/lib/browser/components/message-list.d.ts +24 -3
- package/lib/browser/components/message-list.js +146 -16
- package/lib/browser/components/message-menu.d.ts +3 -1
- package/lib/browser/components/message-menu.js +17 -2
- package/lib/browser/components/nav-places.d.ts +16 -1
- package/lib/browser/components/nav-places.js +13 -3
- package/lib/browser/components/phone-shell.d.ts +4 -1
- package/lib/browser/components/phone-shell.js +3 -1
- package/lib/browser/components/run-status.js +3 -3
- package/lib/browser/components/session-settings.d.ts +6 -0
- package/lib/browser/components/session-settings.js +14 -1
- package/lib/browser/components/session-view.js +7 -3
- package/lib/browser/components/settings-parts.d.ts +2 -2
- package/lib/browser/components/settings-parts.js +24 -1
- package/lib/browser/components/swipe-row.d.ts +2 -2
- package/lib/browser/components/swipe-row.js +7 -3
- package/lib/browser/components/tool-view.js +14 -12
- package/lib/browser/components/voice-button.d.ts +1 -1
- package/lib/browser/components/voice-button.js +1 -1
- package/lib/browser/components/voice-talk.d.ts +44 -0
- package/lib/browser/components/voice-talk.js +260 -0
- package/lib/browser/device/device.d.ts +3 -0
- package/lib/browser/device/device.js +11 -1
- package/lib/browser/device/hold.d.ts +43 -0
- package/lib/browser/device/hold.js +173 -0
- package/lib/browser/device/launch-screen.d.ts +1 -1
- package/lib/browser/device/launch-screen.js +1 -1
- package/lib/browser/device/long-press.d.ts +2 -0
- package/lib/browser/device/long-press.js +16 -1
- package/lib/browser/device/pull-down.d.ts +4 -2
- package/lib/browser/device/pull-down.js +63 -75
- package/lib/browser/device/row-swipe.d.ts +35 -10
- package/lib/browser/device/row-swipe.js +148 -70
- package/lib/browser/device/shake-undo.d.ts +17 -0
- package/lib/browser/device/shake-undo.js +63 -0
- package/lib/browser/device/sheet-swipe.d.ts +118 -18
- package/lib/browser/device/sheet-swipe.js +410 -108
- package/lib/browser/extension/web-extension-api.d.ts +97 -1
- package/lib/browser/extension/web-extension-code.d.ts +6 -0
- package/lib/browser/extension/web-extension-code.js +24 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
- package/lib/browser/extension/web-extension-protocol.js +9 -1
- package/lib/browser/extension/web-extensions.d.ts +14 -1
- package/lib/browser/extension/web-extensions.js +120 -21
- package/lib/browser/files/files-protocol.d.ts +26 -0
- package/lib/browser/files/files-protocol.js +5 -0
- package/lib/browser/files/files.d.ts +36 -0
- package/lib/browser/files/files.js +122 -0
- package/lib/browser/i18n/locales.d.ts +24 -2
- package/lib/browser/i18n/messages.d.ts +23 -1
- package/lib/browser/i18n/messages.js +48 -4
- package/lib/browser/index.d.ts +6 -0
- package/lib/browser/index.js +6 -0
- package/lib/browser/notices/notices-protocol.d.ts +9 -1
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +20 -10
- package/lib/browser/offline/device-values.d.ts +56 -0
- package/lib/browser/offline/device-values.js +148 -0
- package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
- package/lib/browser/offline/kept-chats-protocol.js +5 -0
- package/lib/browser/offline/kept-chats.d.ts +48 -0
- package/lib/browser/offline/kept-chats.js +149 -0
- package/lib/browser/offline/offline-reads.d.ts +45 -0
- package/lib/browser/offline/offline-reads.js +111 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +57 -17
- package/lib/browser/style/device.js +27 -4
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +67 -15
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +46 -3
- package/lib/browser/util/frame.d.ts +5 -4
- package/lib/browser/util/frame.js +5 -4
- package/lib/browser/util/markdown.d.ts +18 -1
- package/lib/browser/util/markdown.js +119 -5
- package/lib/browser/util/process.d.ts +21 -0
- package/lib/browser/util/process.js +46 -2
- package/lib/browser/util/voice.d.ts +5 -2
- package/lib/browser/util/voice.js +6 -3
- package/lib/browser/util/zoom.d.ts +47 -0
- package/lib/browser/util/zoom.js +99 -0
- package/lib/browser/workbench-calls.d.ts +60 -0
- package/lib/browser/workbench-calls.js +145 -0
- package/lib/browser/workbench-protocol.d.ts +5 -1
- package/lib/browser/workbench-util.d.ts +7 -0
- package/lib/browser/workbench-util.js +10 -3
- package/lib/browser/workbench.d.ts +14 -5
- package/lib/browser/workbench.js +51 -31
- package/package.json +10 -10
- package/public/launch.svg +46 -42
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ComposerAttachment, type ComposerImage } from '../util/composer';
|
|
3
3
|
import { type ComposerMenuItem } from './composer-menu';
|
|
4
|
+
import { type TalkPlace } from './held-talk';
|
|
4
5
|
/** An entry of the + menu: an action, or a list to pick one of (a model, a level). */
|
|
5
6
|
export interface ComposerAction {
|
|
6
7
|
key: string;
|
|
@@ -62,6 +63,10 @@ export interface ComposerBoxProps {
|
|
|
62
63
|
after?: React.ReactNode;
|
|
63
64
|
/** What the microphone hears is sent at once, as to the double; otherwise it stays in the box to be read over. */
|
|
64
65
|
voiceSends?: boolean;
|
|
66
|
+
/** The entry of the navigation whose hold talks through this box (HeldTalk): the double's, a new conversation's. */
|
|
67
|
+
talkPlace?: TalkPlace;
|
|
68
|
+
/** A talk was sent (a finger held on the box, or on the entry of the navigation): the double reads its answer out. */
|
|
69
|
+
onTalkSent?(): void;
|
|
65
70
|
onListening?(listening: boolean): void;
|
|
66
71
|
autoFocus?: boolean;
|
|
67
72
|
/** The directory of the conversation: files dragged in from it become `@` references relative to it. */
|
|
@@ -76,10 +81,5 @@ export declare function Attachments({ attachments, onRemove }: {
|
|
|
76
81
|
attachments: ComposerAttachment[];
|
|
77
82
|
onRemove(id: string): void;
|
|
78
83
|
}): React.JSX.Element;
|
|
79
|
-
/**
|
|
80
|
-
* 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;
|
|
81
|
-
* `/` lists commands, `@` the `mentions` its owner finds; images are pasted, dropped or picked; the microphone, where the browser recognizes speech, types what is said. The rest (images,
|
|
82
|
-
* mentions, commands, the settings of the conversation) is behind the + on its left.
|
|
83
|
-
*/
|
|
84
84
|
export declare const ComposerBox: React.ForwardRefExoticComponent<ComposerBoxProps & React.RefAttributes<ComposerBoxHandle>>;
|
|
85
85
|
//# sourceMappingURL=composer-box.d.ts.map
|
|
@@ -37,14 +37,19 @@ exports.ComposerBox = void 0;
|
|
|
37
37
|
exports.Attachments = Attachments;
|
|
38
38
|
const lucide_react_1 = require("lucide-react");
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
|
+
const device_1 = require("../device/device");
|
|
41
|
+
const hold_1 = require("../device/hold");
|
|
42
|
+
const long_press_1 = require("../device/long-press");
|
|
40
43
|
const use_t_1 = require("../i18n/use-t");
|
|
41
44
|
const composer_1 = require("../util/composer");
|
|
42
45
|
const file_drag_1 = require("../util/file-drag");
|
|
43
46
|
const voice_1 = require("../util/voice");
|
|
44
47
|
const composer_menu_1 = require("./composer-menu");
|
|
48
|
+
const held_talk_1 = require("./held-talk");
|
|
45
49
|
const icon_1 = require("./icon");
|
|
46
50
|
const option_list_1 = require("./option-list");
|
|
47
51
|
const voice_button_1 = require("./voice-button");
|
|
52
|
+
const voice_talk_1 = require("./voice-talk");
|
|
48
53
|
const workbench_toggle_1 = require("./workbench-toggle");
|
|
49
54
|
function readImage(file) {
|
|
50
55
|
return new Promise(resolve => {
|
|
@@ -100,9 +105,13 @@ function PlusMenu({ sections, onClose }) {
|
|
|
100
105
|
* `/` lists commands, `@` the `mentions` its owner finds; images are pasted, dropped or picked; the microphone, where the browser recognizes speech, types what is said. The rest (images,
|
|
101
106
|
* mentions, commands, the settings of the conversation) is behind the + on its left.
|
|
102
107
|
*/
|
|
108
|
+
/** A press on the box that is the talk's: the field while the keyboard is down, its blank space, the microphone. */
|
|
109
|
+
function talkTarget(target) {
|
|
110
|
+
return target !== document.activeElement && !target.closest('input, a, [role="menu"], .ta-attachments, button:not(.ta-mic)');
|
|
111
|
+
}
|
|
103
112
|
exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
104
113
|
var _a;
|
|
105
|
-
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, onListening, autoFocus, cwd, onError, } = props;
|
|
114
|
+
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, cwd, onError, } = props;
|
|
106
115
|
const t = (0, use_t_1.useT)();
|
|
107
116
|
const workbench = (0, workbench_toggle_1.useWorkbenchAction)();
|
|
108
117
|
const [text, setText] = React.useState('');
|
|
@@ -117,6 +126,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
117
126
|
const picker = React.useRef(null);
|
|
118
127
|
const plus = React.useRef(null);
|
|
119
128
|
const menuId = React.useId();
|
|
129
|
+
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
120
130
|
const found = composer_1.ComposerUtil.trigger(text, caret);
|
|
121
131
|
const trigger = found && `${found.kind}:${found.start}` !== dismissed ? found : undefined;
|
|
122
132
|
const query = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' ? trigger.query : undefined;
|
|
@@ -134,12 +144,17 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
134
144
|
// An image still being read holds the message back, rather than leaving without it.
|
|
135
145
|
const reading = !composer_1.ComposerUtil.ready(attachments);
|
|
136
146
|
// Grows with the text, up to a limit; measured again when the text or the width changes (the first
|
|
137
|
-
// layout of a page can be narrower than the last).
|
|
147
|
+
// layout of a page can be narrower than the last). Measured at its least height, its row keeps the height
|
|
148
|
+
// it had meanwhile: the page around does not shrink for that moment, which would pull a conversation at its
|
|
149
|
+
// bottom up by the lines the field had, and leave it there.
|
|
138
150
|
const fit = React.useCallback(() => {
|
|
139
151
|
const element = input.current;
|
|
140
|
-
|
|
152
|
+
const row = element === null || element === void 0 ? void 0 : element.parentElement;
|
|
153
|
+
if (element && row) {
|
|
154
|
+
row.style.minHeight = `${row.offsetHeight}px`;
|
|
141
155
|
element.style.height = 'auto';
|
|
142
156
|
element.style.height = `${Math.min(element.scrollHeight, 240)}px`;
|
|
157
|
+
row.style.minHeight = '';
|
|
143
158
|
}
|
|
144
159
|
}, []);
|
|
145
160
|
// biome-ignore lint/correctness/useExhaustiveDependencies: the height is measured again whenever the text changes
|
|
@@ -203,6 +218,11 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
203
218
|
};
|
|
204
219
|
const latest = React.useRef(text);
|
|
205
220
|
latest.current = text;
|
|
221
|
+
// What a talk finds as it ends, long after it began.
|
|
222
|
+
const latestCaret = React.useRef(caret);
|
|
223
|
+
latestCaret.current = caret;
|
|
224
|
+
const readingNow = React.useRef(reading);
|
|
225
|
+
readingNow.current = reading;
|
|
206
226
|
React.useImperativeHandle(ref, () => ({ text: () => latest.current, setText: next => edit(next, next.length) }));
|
|
207
227
|
const pick = (item) => {
|
|
208
228
|
if (!trigger) {
|
|
@@ -228,6 +248,40 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
228
248
|
onError(error);
|
|
229
249
|
});
|
|
230
250
|
};
|
|
251
|
+
// A finger held on the box talks, as WeChat's: let go and what was said goes, at the caret with what was typed;
|
|
252
|
+
// slid over 编辑 it stays in the box, over 取消 it is dropped, and a talk too short to be meant leaves nothing.
|
|
253
|
+
const talk = (0, voice_talk_1.useVoiceTalk)((words, zone) => {
|
|
254
|
+
const [message, position] = composer_1.ComposerUtil.insert(latest.current, latestCaret.current, words);
|
|
255
|
+
// An image still being read would hold the message back: it waits in the box instead.
|
|
256
|
+
if (zone === 'send' && !readingNow.current) {
|
|
257
|
+
send(false, message.trim());
|
|
258
|
+
onTalkSent === null || onTalkSent === void 0 ? void 0 : onTalkSent();
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
edit(message, position);
|
|
262
|
+
}
|
|
263
|
+
}, onError);
|
|
264
|
+
const talking = React.useRef(talk);
|
|
265
|
+
talking.current = talk;
|
|
266
|
+
const listeningTo = React.useRef(onListening);
|
|
267
|
+
listeningTo.current = onListening;
|
|
268
|
+
const talkActive = talk.active;
|
|
269
|
+
const talked = React.useRef(false);
|
|
270
|
+
React.useEffect(() => {
|
|
271
|
+
var _a;
|
|
272
|
+
if (talkActive !== talked.current) {
|
|
273
|
+
talked.current = talkActive;
|
|
274
|
+
(_a = listeningTo.current) === null || _a === void 0 ? void 0 : _a.call(listeningTo, talkActive);
|
|
275
|
+
}
|
|
276
|
+
}, [talkActive]);
|
|
277
|
+
// The entry of the navigation held for this box: it listens as the hold comes and gives as it goes.
|
|
278
|
+
React.useEffect(() => talkPlace &&
|
|
279
|
+
held_talk_1.HeldTalk.attach(talkPlace, {
|
|
280
|
+
start: () => talking.current.start(),
|
|
281
|
+
point: (x, y) => talking.current.point(x, y),
|
|
282
|
+
release: () => talking.current.release(),
|
|
283
|
+
cancel: () => talking.current.cancel(),
|
|
284
|
+
}), [talkPlace]);
|
|
231
285
|
// Speech goes where the caret was when listening began, between what was typed.
|
|
232
286
|
const spoken = React.useRef({ before: '', after: '' });
|
|
233
287
|
const listen = (on) => {
|
|
@@ -242,6 +296,58 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
242
296
|
setText(speech(words));
|
|
243
297
|
setCaret(spoken.current.before.length + words.length);
|
|
244
298
|
}, onHeard: words => (voiceSends ? send(false, speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
|
|
299
|
+
// A finger held on the box talks: its blank space, its microphone, and its field while the keyboard is down (the
|
|
300
|
+
// field takes no finger then, .ta-talkable: a tap on it is the box's, which types in it). The field being
|
|
301
|
+
// typed in, the buttons and what the box holds are theirs.
|
|
302
|
+
const held = (0, hold_1.useHeld)();
|
|
303
|
+
const talkable = touch && voice_1.Voice.canListen();
|
|
304
|
+
const boxHold = held(talkable
|
|
305
|
+
? {
|
|
306
|
+
accepts: event => event.pointerType !== 'mouse' && talkTarget(event.target),
|
|
307
|
+
start: () => talking.current.start(),
|
|
308
|
+
move: (x, y) => talking.current.point(x, y),
|
|
309
|
+
end: () => talking.current.release(),
|
|
310
|
+
cancel: () => talking.current.cancel(),
|
|
311
|
+
}
|
|
312
|
+
: undefined);
|
|
313
|
+
// iOS takes a finger held on a field for its caret, with its loupe, whatever the field lets through: the box
|
|
314
|
+
// keeps a finger on its field or its blank space from the system while the keyboard is down, and a tap of it
|
|
315
|
+
// types in the field, as it would have.
|
|
316
|
+
const box = React.useRef(null);
|
|
317
|
+
React.useEffect(() => {
|
|
318
|
+
const element = box.current;
|
|
319
|
+
if (!element || !talkable) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
let tap;
|
|
323
|
+
const onStart = (event) => {
|
|
324
|
+
const touch = event.touches[0];
|
|
325
|
+
tap = undefined;
|
|
326
|
+
if (event.touches.length !== 1 || !touch || !(event.target instanceof Element) || event.target.closest('.ta-mic') || !talkTarget(event.target)) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
tap = { x: touch.clientX, y: touch.clientY, at: Date.now() };
|
|
331
|
+
};
|
|
332
|
+
const onEnd = (event) => {
|
|
333
|
+
const touch = event.changedTouches[0];
|
|
334
|
+
const press = tap;
|
|
335
|
+
tap = undefined;
|
|
336
|
+
if (press && touch && Date.now() - press.at < long_press_1.LongPressUtil.PRESS_MS && !long_press_1.LongPressUtil.moved(press, { x: touch.clientX, y: touch.clientY })) {
|
|
337
|
+
const field = input.current;
|
|
338
|
+
if (field && document.activeElement !== field) {
|
|
339
|
+
field.focus();
|
|
340
|
+
field.setSelectionRange(field.value.length, field.value.length);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
element.addEventListener('touchstart', onStart, { passive: false });
|
|
345
|
+
element.addEventListener('touchend', onEnd);
|
|
346
|
+
return () => {
|
|
347
|
+
element.removeEventListener('touchstart', onStart);
|
|
348
|
+
element.removeEventListener('touchend', onEnd);
|
|
349
|
+
};
|
|
350
|
+
}, [talkable]);
|
|
245
351
|
const remove = (id) => {
|
|
246
352
|
composer_1.ComposerUtil.release(attachments.filter(attachment => attachment.id === id));
|
|
247
353
|
setAttachments(previous => previous.filter(attachment => attachment.id !== id));
|
|
@@ -338,9 +444,10 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
338
444
|
const typing = (action) => action.insert === undefined ? action : { ...action, run: () => edit(...composer_1.ComposerUtil.insert(text, caret, action.insert)) };
|
|
339
445
|
const sections = [own, ...actions.map(section => section.map(typing)), workbench ? [workbench] : []].filter(section => section.length > 0);
|
|
340
446
|
return (React.createElement("div", { className: "ta-console-composer" },
|
|
447
|
+
React.createElement(voice_talk_1.VoiceTalkOverlay, { talk: talk }),
|
|
341
448
|
(items.length > 0 || note) && React.createElement(composer_menu_1.ComposerMenu, { id: menuId, items: items, selected: selected, note: note, onPick: pick, onHover: setSelected }),
|
|
342
449
|
above,
|
|
343
|
-
React.createElement("div", { className: `ta-console-box
|
|
450
|
+
React.createElement("div", { ref: box, className: `ta-console-box${dragging ? ' ta-dragging' : ''}${talkable ? ' ta-talkable' : ''}`, ...boxHold, onDragOver: event => {
|
|
344
451
|
if (file_drag_1.FileDragUtil.has(event.dataTransfer) || (takesImages && event.dataTransfer.types.includes('Files'))) {
|
|
345
452
|
event.preventDefault();
|
|
346
453
|
setDragging(true);
|
|
@@ -3,6 +3,7 @@ import type { TaCommandResult, TaServer, TaWorkspaceServer } from '@celljs/ta-pr
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { type ComposerImage } from '../util/composer';
|
|
5
5
|
import { type ComposerAction, type ComposerBoxHandle } from './composer-box';
|
|
6
|
+
import type { TalkPlace } from './held-talk';
|
|
6
7
|
type Command = TaCommandResult<'get_commands'>['commands'][number];
|
|
7
8
|
export interface ComposerProps {
|
|
8
9
|
/** The session it sends to; none for a new conversation, which sends with `onSubmit`. */
|
|
@@ -14,6 +15,10 @@ export interface ComposerProps {
|
|
|
14
15
|
after?: React.ReactNode;
|
|
15
16
|
/** What the microphone hears is sent at once. */
|
|
16
17
|
voiceSends?: boolean;
|
|
18
|
+
/** The entry of the navigation whose hold talks through this box (HeldTalk). */
|
|
19
|
+
talkPlace?: TalkPlace;
|
|
20
|
+
/** A talk was sent. */
|
|
21
|
+
onTalkSent?(): void;
|
|
17
22
|
onListening?(listening: boolean): void;
|
|
18
23
|
server: TaServer;
|
|
19
24
|
/** Where `@` looks for files. */
|
|
@@ -30,6 +35,8 @@ export interface ComposerProps {
|
|
|
30
35
|
above?: React.ReactNode;
|
|
31
36
|
/** A message goes out (as the double stops reading aloud). */
|
|
32
37
|
onSending?(): void;
|
|
38
|
+
/** Stops the work with no session yet (a new conversation still opening). */
|
|
39
|
+
onStop?(): void;
|
|
33
40
|
onError(error: unknown): void;
|
|
34
41
|
}
|
|
35
42
|
/**
|
|
@@ -93,7 +93,7 @@ function useQueue(store, working) {
|
|
|
93
93
|
* and Alt+Enter queues a follow-up; Escape stops it.
|
|
94
94
|
*/
|
|
95
95
|
exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
96
|
-
const { store, onSubmit, beside, after, voiceSends, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onError, } = props;
|
|
96
|
+
const { store, onSubmit, beside, after, voiceSends, talkPlace, onTalkSent, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onError, } = props;
|
|
97
97
|
// A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
|
|
98
98
|
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
99
99
|
const t = (0, use_t_1.useT)();
|
|
@@ -102,7 +102,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
102
102
|
const files = useFiles(workspace, cwd, query);
|
|
103
103
|
const box = React.useRef(null);
|
|
104
104
|
React.useImperativeHandle(ref, () => ({ text: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; }, setText: text => { var _a; return (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(text); } }));
|
|
105
|
-
const stop = () => store
|
|
105
|
+
const stop = () => (store ? server.abort(store.sessionId).catch(onError) : onStop === null || onStop === void 0 ? void 0 : onStop());
|
|
106
106
|
const send = (message, images, followUp) => {
|
|
107
107
|
var _a;
|
|
108
108
|
onSending === null || onSending === void 0 ? void 0 : onSending();
|
|
@@ -110,8 +110,9 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
110
110
|
if (!store) {
|
|
111
111
|
return (_a = onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message, prompt.images)) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
112
112
|
}
|
|
113
|
+
// A message that fails to go stays in the conversation, marked, to send again: not back in the box.
|
|
113
114
|
return !working
|
|
114
|
-
? store.
|
|
115
|
+
? store.send(message, { images: prompt.images })
|
|
115
116
|
: followUp
|
|
116
117
|
? server.followUp(store.sessionId, prompt)
|
|
117
118
|
: server.steer(store.sessionId, prompt);
|
|
@@ -140,7 +141,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
140
141
|
}, onError);
|
|
141
142
|
};
|
|
142
143
|
const waiting = composer_1.ComposerUtil.queued(queue);
|
|
143
|
-
return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: commands, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, actions: actions, beside: beside, after: after, voiceSends: voiceSends, onListening: onListening, autoFocus: !touch, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
144
|
+
return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: commands, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, actions: actions, beside: beside, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onListening: onListening, autoFocus: !touch, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
144
145
|
above,
|
|
145
146
|
waiting.length > 0 && (React.createElement("div", { className: "ta-queue", "aria-live": "polite" },
|
|
146
147
|
React.createElement("div", { className: "ta-queue-head" },
|
|
@@ -47,6 +47,8 @@ const BACK_MS = 1200;
|
|
|
47
47
|
const LEAVE_MS = 240;
|
|
48
48
|
/** A try the user asked for shows as one for at least this long, however soon it fails. */
|
|
49
49
|
const TRY_SHOWN_MS = 900;
|
|
50
|
+
/** How long it says that something did not happen for a moment's drop (NoticesState.notDoneAt). */
|
|
51
|
+
const NOT_DONE_MS = 3500;
|
|
50
52
|
/** The seconds until `at`, counted down once a second; `undefined` without `at`. */
|
|
51
53
|
function useSecondsUntil(at) {
|
|
52
54
|
const [now, setNow] = React.useState(Date.now);
|
|
@@ -60,12 +62,31 @@ function useSecondsUntil(at) {
|
|
|
60
62
|
}, [at]);
|
|
61
63
|
return at === undefined ? undefined : Math.max(0, Math.ceil((at - now) / 1000));
|
|
62
64
|
}
|
|
63
|
-
/**
|
|
64
|
-
function
|
|
65
|
+
/** Whether `at` is less than `ms` ago, turning false when it no longer is. */
|
|
66
|
+
function useRecent(at, ms) {
|
|
67
|
+
const recent = at !== undefined && Date.now() - at < ms;
|
|
68
|
+
const [, setTick] = React.useState(0);
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
if (!recent || at === undefined) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const timer = setTimeout(() => setTick(tick => tick + 1), at + ms - Date.now());
|
|
74
|
+
return () => clearTimeout(timer);
|
|
75
|
+
}, [recent, at, ms]);
|
|
76
|
+
return recent;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Offline while the workbench shows it so, then "back" for a moment, then going; nothing for a drop it does
|
|
80
|
+
* not show. `notDone` while online: something the user did was cut off by a drop that mended itself.
|
|
81
|
+
*/
|
|
82
|
+
function usePhase(shown, notDone) {
|
|
65
83
|
const [phase, setPhase] = React.useState('none');
|
|
66
84
|
React.useEffect(() => {
|
|
67
85
|
setPhase(phase => (shown ? 'offline' : phase === 'offline' ? 'back' : phase));
|
|
68
86
|
}, [shown]);
|
|
87
|
+
React.useEffect(() => {
|
|
88
|
+
setPhase(phase => (notDone && (phase === 'none' || phase === 'leaving') ? 'notDone' : !notDone && phase === 'notDone' ? 'leaving' : phase));
|
|
89
|
+
}, [notDone]);
|
|
69
90
|
React.useEffect(() => {
|
|
70
91
|
if (phase !== 'back' && phase !== 'leaving') {
|
|
71
92
|
return;
|
|
@@ -94,15 +115,23 @@ function usePressed() {
|
|
|
94
115
|
*/
|
|
95
116
|
function useConnectionNotice() {
|
|
96
117
|
const t = (0, use_t_1.useT)();
|
|
97
|
-
const [{ offlineShown, error, retryAt }, workbench] = (0, hooks_1.useWorkbench)();
|
|
98
|
-
const
|
|
118
|
+
const [{ offlineShown, error, retryAt, status }, workbench] = (0, hooks_1.useWorkbench)();
|
|
119
|
+
const [{ notDoneAt }] = (0, hooks_1.useNotices)();
|
|
120
|
+
// Something the user did did not happen: no notice over the page, this row says it. Offline, it shows at once.
|
|
121
|
+
const notDone = useRecent(notDoneAt, NOT_DONE_MS);
|
|
122
|
+
const online = status === 'online';
|
|
123
|
+
const phase = usePhase(!!offlineShown || (notDone && !online && status !== 'signed-out'), notDone && online);
|
|
99
124
|
const seconds = useSecondsUntil(phase === 'offline' ? retryAt : undefined);
|
|
100
125
|
const [pressed, press] = usePressed();
|
|
101
126
|
const text = error === 'away' ? t('ta.connection.away') : error === 'unreachable' ? t('ta.unreachable') : t('ta.connection.lost');
|
|
127
|
+
// One line, for a phone: what was shown before still shows under it, as a chat app does without network.
|
|
128
|
+
const brief = error === 'away' ? t('ta.connection.awayBrief') : error === 'unreachable' ? t('ta.connection.unreachableBrief') : t('ta.connection.lost');
|
|
102
129
|
return {
|
|
103
130
|
phase,
|
|
104
|
-
back: phase
|
|
131
|
+
back: phase === 'back' || phase === 'leaving',
|
|
132
|
+
notDone: phase === 'notDone',
|
|
105
133
|
text,
|
|
134
|
+
brief,
|
|
106
135
|
seconds,
|
|
107
136
|
trying: phase === 'offline' && (pressed || !seconds),
|
|
108
137
|
retry: () => {
|
|
@@ -138,17 +167,20 @@ function useWidth(body, content) {
|
|
|
138
167
|
*/
|
|
139
168
|
function ConnectionBar() {
|
|
140
169
|
const t = (0, use_t_1.useT)();
|
|
141
|
-
const { phase, back, text, seconds, trying, retry } = useConnectionNotice();
|
|
170
|
+
const { phase, back, notDone, text, seconds, trying, retry } = useConnectionNotice();
|
|
142
171
|
const body = React.useRef(null);
|
|
143
|
-
const
|
|
172
|
+
const shown = phase === 'none' ? undefined : notDone ? 'notDone' : back ? 'back' : 'offline';
|
|
173
|
+
const width = useWidth(body, shown);
|
|
144
174
|
if (phase === 'none') {
|
|
145
175
|
return null;
|
|
146
176
|
}
|
|
147
|
-
const classes = ['ta-connection', back && 'ta-connection-back', phase === 'leaving' && 'ta-connection-leaving'];
|
|
177
|
+
const classes = ['ta-connection', back && 'ta-connection-back', notDone && 'ta-connection-notdone', phase === 'leaving' && 'ta-connection-leaving'];
|
|
148
178
|
// The border of the bar is around the body.
|
|
149
179
|
const style = width === undefined ? undefined : { width: width + 2 };
|
|
150
180
|
return (React.createElement("div", { className: classes.filter(Boolean).join(' '), role: "status", style: style },
|
|
151
|
-
React.createElement("div", { className: "ta-connection-body", ref: body, key:
|
|
181
|
+
React.createElement("div", { className: "ta-connection-body", ref: body, key: shown }, notDone ? (React.createElement(React.Fragment, null,
|
|
182
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 15, className: "ta-level-icon" }),
|
|
183
|
+
React.createElement("span", { className: "ta-connection-text" }, t('ta.connection.notDone')))) : back ? (React.createElement(React.Fragment, null,
|
|
152
184
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleCheck, size: 15, className: "ta-level-icon" }),
|
|
153
185
|
React.createElement("span", null, t('ta.connection.back')))) : (React.createElement(React.Fragment, null,
|
|
154
186
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.WifiOff, size: 15, className: "ta-level-icon" }),
|
|
@@ -167,18 +199,19 @@ function ConnectionBar() {
|
|
|
167
199
|
function ConnectionBanner() {
|
|
168
200
|
const t = (0, use_t_1.useT)();
|
|
169
201
|
const handheld = (0, device_1.useDevice)(device => device.handheld);
|
|
170
|
-
const { phase, back, text, trying, retry } = useConnectionNotice();
|
|
202
|
+
const { phase, back, notDone, text, brief, trying, retry } = useConnectionNotice();
|
|
171
203
|
if (!handheld) {
|
|
172
204
|
return null;
|
|
173
205
|
}
|
|
174
|
-
const open = phase === 'offline' || phase === 'back';
|
|
206
|
+
const open = phase === 'offline' || phase === 'back' || notDone;
|
|
207
|
+
const quiet = back || notDone;
|
|
175
208
|
const classes = ['ta-connection-banner', open && 'ta-open', back && 'ta-connection-back'];
|
|
176
209
|
// Always there, empty while closed, so that it opens with a transition.
|
|
177
210
|
return (React.createElement("div", { className: classes.filter(Boolean).join(' '), role: "status", "aria-hidden": !open },
|
|
178
|
-
React.createElement("div", { className: "ta-connection-banner-inner" }, phase !== 'none' && (React.createElement("button", { type: "button", className: "ta-connection-banner-row", disabled:
|
|
179
|
-
React.createElement(icon_1.Icon, { icon: back ? lucide_react_1.CircleCheck : lucide_react_1.WifiOff, size: 16, className: "ta-level-icon" }),
|
|
180
|
-
React.createElement("span", { className: "ta-connection-banner-text" }, back ? t('ta.connection.back') :
|
|
181
|
-
!
|
|
211
|
+
React.createElement("div", { className: "ta-connection-banner-inner" }, phase !== 'none' && (React.createElement("button", { type: "button", className: "ta-connection-banner-row", disabled: quiet || trying, tabIndex: open ? undefined : -1, title: quiet ? undefined : text, onClick: retry },
|
|
212
|
+
React.createElement(icon_1.Icon, { icon: notDone ? lucide_react_1.CircleAlert : back ? lucide_react_1.CircleCheck : lucide_react_1.WifiOff, size: 16, className: "ta-level-icon" }),
|
|
213
|
+
React.createElement("span", { className: "ta-connection-banner-text" }, notDone ? t('ta.connection.notDone') : back ? t('ta.connection.back') : brief),
|
|
214
|
+
!quiet && (React.createElement("span", { className: "ta-connection-banner-action" },
|
|
182
215
|
trying ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(icon_1.Icon, { icon: lucide_react_1.RotateCw, size: 14 }),
|
|
183
216
|
trying ? t('ta.connection.retrying') : t('ta.connection.retry'))))))));
|
|
184
217
|
}
|
|
@@ -6,10 +6,22 @@ export type ContextMenuItem = '-' | {
|
|
|
6
6
|
disabled?: boolean /** Cannot be undone, as delete: drawn in red. */;
|
|
7
7
|
danger?: boolean;
|
|
8
8
|
};
|
|
9
|
+
/** Where a menu was opened: the pointer, and the element it is the menu of (a row), which a finger keeps in sight. */
|
|
10
|
+
export interface MenuOpening {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
around?: {
|
|
14
|
+
top: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
9
18
|
export declare namespace ContextMenuUtil {
|
|
10
19
|
/**
|
|
11
|
-
* Where a menu of `size` goes for a click at `at`: its corner at the pointer, as a browser's
|
|
12
|
-
*
|
|
20
|
+
* Where a menu of `size` goes for a click at `at`: its corner at the pointer, as a browser's. Under a finger,
|
|
21
|
+
* never where the finger covers it: above the finger and the row it pressed (`around`), centred, as the menus
|
|
22
|
+
* of a phone; with no room there, beside the finger on the side with more room; else below the row, as far
|
|
23
|
+
* from the finger sideways as the screen allows. Always on the screen, out of the status bar and the home
|
|
24
|
+
* indicator (`safe`). `origin` is where it grows from: the side of the finger.
|
|
13
25
|
*/
|
|
14
26
|
function place(at: {
|
|
15
27
|
x: number;
|
|
@@ -23,14 +35,28 @@ export declare namespace ContextMenuUtil {
|
|
|
23
35
|
}, touch: boolean, safe?: {
|
|
24
36
|
top: number;
|
|
25
37
|
bottom: number;
|
|
38
|
+
}, around?: {
|
|
39
|
+
top: number;
|
|
40
|
+
bottom: number;
|
|
26
41
|
}): {
|
|
27
42
|
left: number;
|
|
28
43
|
top: number;
|
|
44
|
+
origin: string;
|
|
29
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Places a menu of the page, fixed to the screen, where it was `opened` (`place`), and on a touch screen lets
|
|
48
|
+
* the finger have it as on a phone: the finger of the long press that opened it slides onto an entry and lets go
|
|
49
|
+
* to choose it (the entry under it marked `data-armed`), or slides off and lets go to close it; let go where it
|
|
50
|
+
* was, the menu stays for a tap. A tap outside only closes it (the menu's own listener), not also tapping what is
|
|
51
|
+
* under it. For the menus of a layout effect, after the menu rendered its entries (`role="menuitem"`). Returns
|
|
52
|
+
* how to stop.
|
|
53
|
+
*/
|
|
54
|
+
function attach(menu: HTMLElement, opened: MenuOpening, close: () => void): () => void;
|
|
30
55
|
}
|
|
31
56
|
/**
|
|
32
57
|
* A context menu at the pointer, as a browser's tabs have: arrows move, Enter runs, Escape or a click
|
|
33
|
-
* elsewhere closes. `open` takes the event of a right click (or of the menu key) and the entries.
|
|
58
|
+
* elsewhere closes. `open` takes the event of a right click (or of the menu key) and the entries. Opened by a
|
|
59
|
+
* long press, it keeps out from under the finger and the finger may slide onto an entry (ContextMenuUtil.attach).
|
|
34
60
|
*/
|
|
35
|
-
export declare function useContextMenu(): [React.ReactNode, (event: React.MouseEvent, items: ContextMenuItem[]) => void];
|
|
61
|
+
export declare function useContextMenu(): [React.ReactNode, (event: React.MouseEvent, items: ContextMenuItem[], caption?: string) => void];
|
|
36
62
|
//# sourceMappingURL=context-menu.d.ts.map
|