@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.
Files changed (302) hide show
  1. package/README.en.md +4 -3
  2. package/README.md +4 -3
  3. package/esm/browser/assistant/assistant-chat-list.js +8 -2
  4. package/esm/browser/assistant/assistant-extension.d.ts +8 -1
  5. package/esm/browser/assistant/assistant-extension.js +20 -0
  6. package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
  7. package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
  8. package/esm/browser/assistant/assistant-task-util.js +5 -3
  9. package/esm/browser/assistant/assistant-view.js +81 -56
  10. package/esm/browser/assistant/assistant.d.ts +10 -1
  11. package/esm/browser/assistant/assistant.js +44 -5
  12. package/esm/browser/chat/chat-packages.d.ts +39 -0
  13. package/esm/browser/chat/chat-packages.js +70 -0
  14. package/esm/browser/chat/chat-protocol.d.ts +23 -1
  15. package/esm/browser/chat/chat-stores.d.ts +59 -0
  16. package/esm/browser/chat/chat-stores.js +121 -0
  17. package/esm/browser/chat/chat-util.d.ts +17 -0
  18. package/esm/browser/chat/chat-util.js +61 -0
  19. package/esm/browser/chat/chat-view.js +33 -12
  20. package/esm/browser/chat/chat.d.ts +31 -39
  21. package/esm/browser/chat/chat.js +226 -175
  22. package/esm/browser/components/app-nav.d.ts +6 -3
  23. package/esm/browser/components/app-nav.js +19 -10
  24. package/esm/browser/components/app-shell-hooks.d.ts +2 -2
  25. package/esm/browser/components/app-shell-hooks.js +7 -3
  26. package/esm/browser/components/app-view.js +75 -21
  27. package/esm/browser/components/chat-list.d.ts +20 -2
  28. package/esm/browser/components/chat-list.js +138 -22
  29. package/esm/browser/components/composer-box.d.ts +5 -5
  30. package/esm/browser/components/composer-box.js +111 -4
  31. package/esm/browser/components/composer.d.ts +7 -0
  32. package/esm/browser/components/composer.js +5 -4
  33. package/esm/browser/components/connection-bar.js +50 -17
  34. package/esm/browser/components/context-menu.d.ts +30 -4
  35. package/esm/browser/components/context-menu.js +199 -37
  36. package/esm/browser/components/conversation-scroll.d.ts +129 -6
  37. package/esm/browser/components/conversation-scroll.js +429 -109
  38. package/esm/browser/components/earlier-messages.d.ts +2 -1
  39. package/esm/browser/components/earlier-messages.js +2 -17
  40. package/esm/browser/components/editor-area.d.ts +3 -1
  41. package/esm/browser/components/editor-area.js +6 -5
  42. package/esm/browser/components/empty-pictures.d.ts +0 -2
  43. package/esm/browser/components/empty-pictures.js +0 -16
  44. package/esm/browser/components/folder-picker.d.ts +5 -2
  45. package/esm/browser/components/folder-picker.js +26 -8
  46. package/esm/browser/components/held-talk.d.ts +28 -0
  47. package/esm/browser/components/held-talk.js +76 -0
  48. package/esm/browser/components/host-view.d.ts +1 -1
  49. package/esm/browser/components/icon.d.ts +2 -2
  50. package/esm/browser/components/icon.js +5 -6
  51. package/esm/browser/components/image-viewer.d.ts +124 -0
  52. package/esm/browser/components/image-viewer.js +397 -0
  53. package/esm/browser/components/lightbox.d.ts +11 -0
  54. package/esm/browser/components/lightbox.js +24 -0
  55. package/esm/browser/components/markdown.d.ts +6 -2
  56. package/esm/browser/components/markdown.js +24 -10
  57. package/esm/browser/components/media.js +1 -10
  58. package/esm/browser/components/message-footer.d.ts +16 -2
  59. package/esm/browser/components/message-footer.js +29 -12
  60. package/esm/browser/components/message-list.d.ts +24 -3
  61. package/esm/browser/components/message-list.js +149 -20
  62. package/esm/browser/components/message-menu.d.ts +3 -1
  63. package/esm/browser/components/message-menu.js +18 -3
  64. package/esm/browser/components/nav-places.d.ts +16 -1
  65. package/esm/browser/components/nav-places.js +12 -3
  66. package/esm/browser/components/phone-shell.d.ts +4 -1
  67. package/esm/browser/components/phone-shell.js +3 -1
  68. package/esm/browser/components/run-status.js +3 -3
  69. package/esm/browser/components/session-settings.d.ts +6 -0
  70. package/esm/browser/components/session-settings.js +14 -1
  71. package/esm/browser/components/session-view.js +8 -4
  72. package/esm/browser/components/settings-parts.d.ts +2 -2
  73. package/esm/browser/components/settings-parts.js +24 -1
  74. package/esm/browser/components/swipe-row.d.ts +2 -2
  75. package/esm/browser/components/swipe-row.js +7 -3
  76. package/esm/browser/components/tool-view.js +14 -12
  77. package/esm/browser/components/voice-button.d.ts +1 -1
  78. package/esm/browser/components/voice-button.js +1 -1
  79. package/esm/browser/components/voice-talk.d.ts +43 -0
  80. package/esm/browser/components/voice-talk.js +222 -0
  81. package/esm/browser/device/device.d.ts +3 -0
  82. package/esm/browser/device/device.js +11 -1
  83. package/esm/browser/device/hold.d.ts +42 -0
  84. package/esm/browser/device/hold.js +136 -0
  85. package/esm/browser/device/launch-screen.d.ts +1 -1
  86. package/esm/browser/device/launch-screen.js +1 -1
  87. package/esm/browser/device/long-press.d.ts +2 -0
  88. package/esm/browser/device/long-press.js +16 -1
  89. package/esm/browser/device/pull-down.d.ts +4 -2
  90. package/esm/browser/device/pull-down.js +64 -76
  91. package/esm/browser/device/row-swipe.d.ts +35 -10
  92. package/esm/browser/device/row-swipe.js +149 -71
  93. package/esm/browser/device/shake-undo.d.ts +16 -0
  94. package/esm/browser/device/shake-undo.js +59 -0
  95. package/esm/browser/device/sheet-swipe.d.ts +118 -18
  96. package/esm/browser/device/sheet-swipe.js +406 -107
  97. package/esm/browser/extension/web-extension-api.d.ts +97 -1
  98. package/esm/browser/extension/web-extension-code.d.ts +6 -0
  99. package/esm/browser/extension/web-extension-code.js +24 -0
  100. package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
  101. package/esm/browser/extension/web-extension-protocol.js +8 -0
  102. package/esm/browser/extension/web-extensions.d.ts +14 -1
  103. package/esm/browser/extension/web-extensions.js +122 -23
  104. package/esm/browser/files/files-protocol.d.ts +25 -0
  105. package/esm/browser/files/files-protocol.js +2 -0
  106. package/esm/browser/files/files.d.ts +35 -0
  107. package/esm/browser/files/files.js +119 -0
  108. package/esm/browser/i18n/locales.d.ts +24 -2
  109. package/esm/browser/i18n/messages.d.ts +23 -1
  110. package/esm/browser/i18n/messages.js +48 -4
  111. package/esm/browser/index.d.ts +6 -0
  112. package/esm/browser/index.js +6 -0
  113. package/esm/browser/notices/notices-protocol.d.ts +9 -1
  114. package/esm/browser/notices/notices.d.ts +2 -0
  115. package/esm/browser/notices/notices.js +20 -10
  116. package/esm/browser/offline/device-values.d.ts +55 -0
  117. package/esm/browser/offline/device-values.js +142 -0
  118. package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
  119. package/esm/browser/offline/kept-chats-protocol.js +2 -0
  120. package/esm/browser/offline/kept-chats.d.ts +47 -0
  121. package/esm/browser/offline/kept-chats.js +146 -0
  122. package/esm/browser/offline/offline-reads.d.ts +44 -0
  123. package/esm/browser/offline/offline-reads.js +107 -0
  124. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  125. package/esm/browser/settings/settings-protocol.js +2 -0
  126. package/esm/browser/style/conversation.d.ts +1 -1
  127. package/esm/browser/style/conversation.js +57 -17
  128. package/esm/browser/style/device.js +27 -4
  129. package/esm/browser/style/layout.d.ts +1 -1
  130. package/esm/browser/style/layout.js +67 -15
  131. package/esm/browser/style/pages.d.ts +1 -1
  132. package/esm/browser/style/pages.js +2 -1
  133. package/esm/browser/style/shell.d.ts +1 -1
  134. package/esm/browser/style/shell.js +46 -3
  135. package/esm/browser/util/frame.d.ts +5 -4
  136. package/esm/browser/util/frame.js +5 -4
  137. package/esm/browser/util/markdown.d.ts +18 -1
  138. package/esm/browser/util/markdown.js +119 -5
  139. package/esm/browser/util/process.d.ts +21 -0
  140. package/esm/browser/util/process.js +45 -1
  141. package/esm/browser/util/voice.d.ts +5 -2
  142. package/esm/browser/util/voice.js +6 -3
  143. package/esm/browser/util/zoom.d.ts +46 -0
  144. package/esm/browser/util/zoom.js +96 -0
  145. package/esm/browser/workbench-calls.d.ts +59 -0
  146. package/esm/browser/workbench-calls.js +141 -0
  147. package/esm/browser/workbench-protocol.d.ts +5 -1
  148. package/esm/browser/workbench-util.d.ts +7 -0
  149. package/esm/browser/workbench-util.js +9 -2
  150. package/esm/browser/workbench.d.ts +14 -5
  151. package/esm/browser/workbench.js +51 -31
  152. package/lib/browser/assistant/assistant-chat-list.js +8 -2
  153. package/lib/browser/assistant/assistant-extension.d.ts +8 -1
  154. package/lib/browser/assistant/assistant-extension.js +20 -0
  155. package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
  156. package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
  157. package/lib/browser/assistant/assistant-task-util.js +5 -3
  158. package/lib/browser/assistant/assistant-view.js +78 -53
  159. package/lib/browser/assistant/assistant.d.ts +10 -1
  160. package/lib/browser/assistant/assistant.js +44 -5
  161. package/lib/browser/chat/chat-packages.d.ts +40 -0
  162. package/lib/browser/chat/chat-packages.js +74 -0
  163. package/lib/browser/chat/chat-protocol.d.ts +23 -1
  164. package/lib/browser/chat/chat-stores.d.ts +60 -0
  165. package/lib/browser/chat/chat-stores.js +125 -0
  166. package/lib/browser/chat/chat-util.d.ts +18 -0
  167. package/lib/browser/chat/chat-util.js +64 -0
  168. package/lib/browser/chat/chat-view.js +33 -12
  169. package/lib/browser/chat/chat.d.ts +31 -39
  170. package/lib/browser/chat/chat.js +227 -176
  171. package/lib/browser/components/app-nav.d.ts +6 -3
  172. package/lib/browser/components/app-nav.js +17 -8
  173. package/lib/browser/components/app-shell-hooks.d.ts +2 -2
  174. package/lib/browser/components/app-shell-hooks.js +7 -3
  175. package/lib/browser/components/app-view.js +74 -20
  176. package/lib/browser/components/chat-list.d.ts +20 -2
  177. package/lib/browser/components/chat-list.js +137 -21
  178. package/lib/browser/components/composer-box.d.ts +5 -5
  179. package/lib/browser/components/composer-box.js +111 -4
  180. package/lib/browser/components/composer.d.ts +7 -0
  181. package/lib/browser/components/composer.js +5 -4
  182. package/lib/browser/components/connection-bar.js +48 -15
  183. package/lib/browser/components/context-menu.d.ts +30 -4
  184. package/lib/browser/components/context-menu.js +198 -36
  185. package/lib/browser/components/conversation-scroll.d.ts +129 -6
  186. package/lib/browser/components/conversation-scroll.js +431 -110
  187. package/lib/browser/components/earlier-messages.d.ts +2 -1
  188. package/lib/browser/components/earlier-messages.js +2 -17
  189. package/lib/browser/components/editor-area.d.ts +3 -1
  190. package/lib/browser/components/editor-area.js +5 -4
  191. package/lib/browser/components/empty-pictures.d.ts +0 -2
  192. package/lib/browser/components/empty-pictures.js +0 -17
  193. package/lib/browser/components/folder-picker.d.ts +5 -2
  194. package/lib/browser/components/folder-picker.js +26 -8
  195. package/lib/browser/components/held-talk.d.ts +29 -0
  196. package/lib/browser/components/held-talk.js +79 -0
  197. package/lib/browser/components/host-view.d.ts +1 -1
  198. package/lib/browser/components/icon.d.ts +2 -2
  199. package/lib/browser/components/icon.js +7 -6
  200. package/lib/browser/components/image-viewer.d.ts +125 -0
  201. package/lib/browser/components/image-viewer.js +435 -0
  202. package/lib/browser/components/lightbox.d.ts +12 -0
  203. package/lib/browser/components/lightbox.js +60 -0
  204. package/lib/browser/components/markdown.d.ts +6 -2
  205. package/lib/browser/components/markdown.js +24 -10
  206. package/lib/browser/components/media.js +2 -11
  207. package/lib/browser/components/message-footer.d.ts +16 -2
  208. package/lib/browser/components/message-footer.js +31 -12
  209. package/lib/browser/components/message-list.d.ts +24 -3
  210. package/lib/browser/components/message-list.js +146 -16
  211. package/lib/browser/components/message-menu.d.ts +3 -1
  212. package/lib/browser/components/message-menu.js +17 -2
  213. package/lib/browser/components/nav-places.d.ts +16 -1
  214. package/lib/browser/components/nav-places.js +13 -3
  215. package/lib/browser/components/phone-shell.d.ts +4 -1
  216. package/lib/browser/components/phone-shell.js +3 -1
  217. package/lib/browser/components/run-status.js +3 -3
  218. package/lib/browser/components/session-settings.d.ts +6 -0
  219. package/lib/browser/components/session-settings.js +14 -1
  220. package/lib/browser/components/session-view.js +7 -3
  221. package/lib/browser/components/settings-parts.d.ts +2 -2
  222. package/lib/browser/components/settings-parts.js +24 -1
  223. package/lib/browser/components/swipe-row.d.ts +2 -2
  224. package/lib/browser/components/swipe-row.js +7 -3
  225. package/lib/browser/components/tool-view.js +14 -12
  226. package/lib/browser/components/voice-button.d.ts +1 -1
  227. package/lib/browser/components/voice-button.js +1 -1
  228. package/lib/browser/components/voice-talk.d.ts +44 -0
  229. package/lib/browser/components/voice-talk.js +260 -0
  230. package/lib/browser/device/device.d.ts +3 -0
  231. package/lib/browser/device/device.js +11 -1
  232. package/lib/browser/device/hold.d.ts +43 -0
  233. package/lib/browser/device/hold.js +173 -0
  234. package/lib/browser/device/launch-screen.d.ts +1 -1
  235. package/lib/browser/device/launch-screen.js +1 -1
  236. package/lib/browser/device/long-press.d.ts +2 -0
  237. package/lib/browser/device/long-press.js +16 -1
  238. package/lib/browser/device/pull-down.d.ts +4 -2
  239. package/lib/browser/device/pull-down.js +63 -75
  240. package/lib/browser/device/row-swipe.d.ts +35 -10
  241. package/lib/browser/device/row-swipe.js +148 -70
  242. package/lib/browser/device/shake-undo.d.ts +17 -0
  243. package/lib/browser/device/shake-undo.js +63 -0
  244. package/lib/browser/device/sheet-swipe.d.ts +118 -18
  245. package/lib/browser/device/sheet-swipe.js +410 -108
  246. package/lib/browser/extension/web-extension-api.d.ts +97 -1
  247. package/lib/browser/extension/web-extension-code.d.ts +6 -0
  248. package/lib/browser/extension/web-extension-code.js +24 -0
  249. package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
  250. package/lib/browser/extension/web-extension-protocol.js +9 -1
  251. package/lib/browser/extension/web-extensions.d.ts +14 -1
  252. package/lib/browser/extension/web-extensions.js +120 -21
  253. package/lib/browser/files/files-protocol.d.ts +26 -0
  254. package/lib/browser/files/files-protocol.js +5 -0
  255. package/lib/browser/files/files.d.ts +36 -0
  256. package/lib/browser/files/files.js +122 -0
  257. package/lib/browser/i18n/locales.d.ts +24 -2
  258. package/lib/browser/i18n/messages.d.ts +23 -1
  259. package/lib/browser/i18n/messages.js +48 -4
  260. package/lib/browser/index.d.ts +6 -0
  261. package/lib/browser/index.js +6 -0
  262. package/lib/browser/notices/notices-protocol.d.ts +9 -1
  263. package/lib/browser/notices/notices.d.ts +2 -0
  264. package/lib/browser/notices/notices.js +20 -10
  265. package/lib/browser/offline/device-values.d.ts +56 -0
  266. package/lib/browser/offline/device-values.js +148 -0
  267. package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
  268. package/lib/browser/offline/kept-chats-protocol.js +5 -0
  269. package/lib/browser/offline/kept-chats.d.ts +48 -0
  270. package/lib/browser/offline/kept-chats.js +149 -0
  271. package/lib/browser/offline/offline-reads.d.ts +45 -0
  272. package/lib/browser/offline/offline-reads.js +111 -0
  273. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  274. package/lib/browser/settings/settings-protocol.js +2 -0
  275. package/lib/browser/style/conversation.d.ts +1 -1
  276. package/lib/browser/style/conversation.js +57 -17
  277. package/lib/browser/style/device.js +27 -4
  278. package/lib/browser/style/layout.d.ts +1 -1
  279. package/lib/browser/style/layout.js +67 -15
  280. package/lib/browser/style/pages.d.ts +1 -1
  281. package/lib/browser/style/pages.js +2 -1
  282. package/lib/browser/style/shell.d.ts +1 -1
  283. package/lib/browser/style/shell.js +46 -3
  284. package/lib/browser/util/frame.d.ts +5 -4
  285. package/lib/browser/util/frame.js +5 -4
  286. package/lib/browser/util/markdown.d.ts +18 -1
  287. package/lib/browser/util/markdown.js +119 -5
  288. package/lib/browser/util/process.d.ts +21 -0
  289. package/lib/browser/util/process.js +46 -2
  290. package/lib/browser/util/voice.d.ts +5 -2
  291. package/lib/browser/util/voice.js +6 -3
  292. package/lib/browser/util/zoom.d.ts +47 -0
  293. package/lib/browser/util/zoom.js +99 -0
  294. package/lib/browser/workbench-calls.d.ts +60 -0
  295. package/lib/browser/workbench-calls.js +145 -0
  296. package/lib/browser/workbench-protocol.d.ts +5 -1
  297. package/lib/browser/workbench-util.d.ts +7 -0
  298. package/lib/browser/workbench-util.js +10 -3
  299. package/lib/browser/workbench.d.ts +14 -5
  300. package/lib/browser/workbench.js +51 -31
  301. package/package.json +10 -10
  302. 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.js';
3
3
  import { type ComposerMenuItem } from './composer-menu.js';
4
+ import { type TalkPlace } from './held-talk.js';
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,9 +81,4 @@ 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>>;
@@ -1,13 +1,18 @@
1
1
  import { ArrowUp, AtSign, Check, ChevronLeft, ChevronRight, ImagePlus, Plus, Slash, Square, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
+ import { useDevice } from '../device/device.js';
4
+ import { useHeld } from '../device/hold.js';
5
+ import { LongPressUtil } from '../device/long-press.js';
3
6
  import { useT } from '../i18n/use-t.js';
4
7
  import { ComposerUtil, IMAGE_TYPES } from '../util/composer.js';
5
8
  import { FileDragUtil } from '../util/file-drag.js';
6
9
  import { Voice } from '../util/voice.js';
7
10
  import { ComposerMenu } from './composer-menu.js';
11
+ import { HeldTalk } from './held-talk.js';
8
12
  import { Icon, IconButton } from './icon.js';
9
13
  import { OptionList } from './option-list.js';
10
14
  import { VoiceButton } from './voice-button.js';
15
+ import { useVoiceTalk, VoiceTalkOverlay } from './voice-talk.js';
11
16
  import { useWorkbenchAction } from './workbench-toggle.js';
12
17
  function readImage(file) {
13
18
  return new Promise(resolve => {
@@ -63,9 +68,13 @@ function PlusMenu({ sections, onClose }) {
63
68
  * `/` 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,
64
69
  * mentions, commands, the settings of the conversation) is behind the + on its left.
65
70
  */
71
+ /** A press on the box that is the talk's: the field while the keyboard is down, its blank space, the microphone. */
72
+ function talkTarget(target) {
73
+ return target !== document.activeElement && !target.closest('input, a, [role="menu"], .ta-attachments, button:not(.ta-mic)');
74
+ }
66
75
  export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
67
76
  var _a;
68
- const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, onListening, autoFocus, cwd, onError, } = props;
77
+ const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, cwd, onError, } = props;
69
78
  const t = useT();
70
79
  const workbench = useWorkbenchAction();
71
80
  const [text, setText] = React.useState('');
@@ -80,6 +89,7 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
80
89
  const picker = React.useRef(null);
81
90
  const plus = React.useRef(null);
82
91
  const menuId = React.useId();
92
+ const touch = useDevice(device => device.touch);
83
93
  const found = ComposerUtil.trigger(text, caret);
84
94
  const trigger = found && `${found.kind}:${found.start}` !== dismissed ? found : undefined;
85
95
  const query = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' ? trigger.query : undefined;
@@ -97,12 +107,17 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
97
107
  // An image still being read holds the message back, rather than leaving without it.
98
108
  const reading = !ComposerUtil.ready(attachments);
99
109
  // Grows with the text, up to a limit; measured again when the text or the width changes (the first
100
- // layout of a page can be narrower than the last).
110
+ // layout of a page can be narrower than the last). Measured at its least height, its row keeps the height
111
+ // it had meanwhile: the page around does not shrink for that moment, which would pull a conversation at its
112
+ // bottom up by the lines the field had, and leave it there.
101
113
  const fit = React.useCallback(() => {
102
114
  const element = input.current;
103
- if (element) {
115
+ const row = element === null || element === void 0 ? void 0 : element.parentElement;
116
+ if (element && row) {
117
+ row.style.minHeight = `${row.offsetHeight}px`;
104
118
  element.style.height = 'auto';
105
119
  element.style.height = `${Math.min(element.scrollHeight, 240)}px`;
120
+ row.style.minHeight = '';
106
121
  }
107
122
  }, []);
108
123
  // biome-ignore lint/correctness/useExhaustiveDependencies: the height is measured again whenever the text changes
@@ -166,6 +181,11 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
166
181
  };
167
182
  const latest = React.useRef(text);
168
183
  latest.current = text;
184
+ // What a talk finds as it ends, long after it began.
185
+ const latestCaret = React.useRef(caret);
186
+ latestCaret.current = caret;
187
+ const readingNow = React.useRef(reading);
188
+ readingNow.current = reading;
169
189
  React.useImperativeHandle(ref, () => ({ text: () => latest.current, setText: next => edit(next, next.length) }));
170
190
  const pick = (item) => {
171
191
  if (!trigger) {
@@ -191,6 +211,40 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
191
211
  onError(error);
192
212
  });
193
213
  };
214
+ // A finger held on the box talks, as WeChat's: let go and what was said goes, at the caret with what was typed;
215
+ // slid over 编辑 it stays in the box, over 取消 it is dropped, and a talk too short to be meant leaves nothing.
216
+ const talk = useVoiceTalk((words, zone) => {
217
+ const [message, position] = ComposerUtil.insert(latest.current, latestCaret.current, words);
218
+ // An image still being read would hold the message back: it waits in the box instead.
219
+ if (zone === 'send' && !readingNow.current) {
220
+ send(false, message.trim());
221
+ onTalkSent === null || onTalkSent === void 0 ? void 0 : onTalkSent();
222
+ }
223
+ else {
224
+ edit(message, position);
225
+ }
226
+ }, onError);
227
+ const talking = React.useRef(talk);
228
+ talking.current = talk;
229
+ const listeningTo = React.useRef(onListening);
230
+ listeningTo.current = onListening;
231
+ const talkActive = talk.active;
232
+ const talked = React.useRef(false);
233
+ React.useEffect(() => {
234
+ var _a;
235
+ if (talkActive !== talked.current) {
236
+ talked.current = talkActive;
237
+ (_a = listeningTo.current) === null || _a === void 0 ? void 0 : _a.call(listeningTo, talkActive);
238
+ }
239
+ }, [talkActive]);
240
+ // The entry of the navigation held for this box: it listens as the hold comes and gives as it goes.
241
+ React.useEffect(() => talkPlace &&
242
+ HeldTalk.attach(talkPlace, {
243
+ start: () => talking.current.start(),
244
+ point: (x, y) => talking.current.point(x, y),
245
+ release: () => talking.current.release(),
246
+ cancel: () => talking.current.cancel(),
247
+ }), [talkPlace]);
194
248
  // Speech goes where the caret was when listening began, between what was typed.
195
249
  const spoken = React.useRef({ before: '', after: '' });
196
250
  const listen = (on) => {
@@ -205,6 +259,58 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
205
259
  setText(speech(words));
206
260
  setCaret(spoken.current.before.length + words.length);
207
261
  }, onHeard: words => (voiceSends ? send(false, speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
262
+ // A finger held on the box talks: its blank space, its microphone, and its field while the keyboard is down (the
263
+ // field takes no finger then, .ta-talkable: a tap on it is the box's, which types in it). The field being
264
+ // typed in, the buttons and what the box holds are theirs.
265
+ const held = useHeld();
266
+ const talkable = touch && Voice.canListen();
267
+ const boxHold = held(talkable
268
+ ? {
269
+ accepts: event => event.pointerType !== 'mouse' && talkTarget(event.target),
270
+ start: () => talking.current.start(),
271
+ move: (x, y) => talking.current.point(x, y),
272
+ end: () => talking.current.release(),
273
+ cancel: () => talking.current.cancel(),
274
+ }
275
+ : undefined);
276
+ // iOS takes a finger held on a field for its caret, with its loupe, whatever the field lets through: the box
277
+ // keeps a finger on its field or its blank space from the system while the keyboard is down, and a tap of it
278
+ // types in the field, as it would have.
279
+ const box = React.useRef(null);
280
+ React.useEffect(() => {
281
+ const element = box.current;
282
+ if (!element || !talkable) {
283
+ return;
284
+ }
285
+ let tap;
286
+ const onStart = (event) => {
287
+ const touch = event.touches[0];
288
+ tap = undefined;
289
+ if (event.touches.length !== 1 || !touch || !(event.target instanceof Element) || event.target.closest('.ta-mic') || !talkTarget(event.target)) {
290
+ return;
291
+ }
292
+ event.preventDefault();
293
+ tap = { x: touch.clientX, y: touch.clientY, at: Date.now() };
294
+ };
295
+ const onEnd = (event) => {
296
+ const touch = event.changedTouches[0];
297
+ const press = tap;
298
+ tap = undefined;
299
+ if (press && touch && Date.now() - press.at < LongPressUtil.PRESS_MS && !LongPressUtil.moved(press, { x: touch.clientX, y: touch.clientY })) {
300
+ const field = input.current;
301
+ if (field && document.activeElement !== field) {
302
+ field.focus();
303
+ field.setSelectionRange(field.value.length, field.value.length);
304
+ }
305
+ }
306
+ };
307
+ element.addEventListener('touchstart', onStart, { passive: false });
308
+ element.addEventListener('touchend', onEnd);
309
+ return () => {
310
+ element.removeEventListener('touchstart', onStart);
311
+ element.removeEventListener('touchend', onEnd);
312
+ };
313
+ }, [talkable]);
208
314
  const remove = (id) => {
209
315
  ComposerUtil.release(attachments.filter(attachment => attachment.id === id));
210
316
  setAttachments(previous => previous.filter(attachment => attachment.id !== id));
@@ -301,9 +407,10 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
301
407
  const typing = (action) => action.insert === undefined ? action : { ...action, run: () => edit(...ComposerUtil.insert(text, caret, action.insert)) };
302
408
  const sections = [own, ...actions.map(section => section.map(typing)), workbench ? [workbench] : []].filter(section => section.length > 0);
303
409
  return (React.createElement("div", { className: "ta-console-composer" },
410
+ React.createElement(VoiceTalkOverlay, { talk: talk }),
304
411
  (items.length > 0 || note) && React.createElement(ComposerMenu, { id: menuId, items: items, selected: selected, note: note, onPick: pick, onHover: setSelected }),
305
412
  above,
306
- React.createElement("div", { className: `ta-console-box ${dragging ? 'ta-dragging' : ''}`, onDragOver: event => {
413
+ React.createElement("div", { ref: box, className: `ta-console-box${dragging ? ' ta-dragging' : ''}${talkable ? ' ta-talkable' : ''}`, ...boxHold, onDragOver: event => {
307
414
  if (FileDragUtil.has(event.dataTransfer) || (takesImages && event.dataTransfer.types.includes('Files'))) {
308
415
  event.preventDefault();
309
416
  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.js';
5
5
  import { type ComposerAction, type ComposerBoxHandle } from './composer-box.js';
6
+ import type { TalkPlace } from './held-talk.js';
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
  /**
@@ -57,7 +57,7 @@ function useQueue(store, working) {
57
57
  * and Alt+Enter queues a follow-up; Escape stops it.
58
58
  */
59
59
  export const Composer = React.forwardRef(function Composer(props, ref) {
60
- const { store, onSubmit, beside, after, voiceSends, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onError, } = props;
60
+ const { store, onSubmit, beside, after, voiceSends, talkPlace, onTalkSent, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onError, } = props;
61
61
  // A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
62
62
  const touch = useDevice(device => device.touch);
63
63
  const t = useT();
@@ -66,7 +66,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
66
66
  const files = useFiles(workspace, cwd, query);
67
67
  const box = React.useRef(null);
68
68
  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); } }));
69
- const stop = () => store && server.abort(store.sessionId).catch(onError);
69
+ const stop = () => (store ? server.abort(store.sessionId).catch(onError) : onStop === null || onStop === void 0 ? void 0 : onStop());
70
70
  const send = (message, images, followUp) => {
71
71
  var _a;
72
72
  onSending === null || onSending === void 0 ? void 0 : onSending();
@@ -74,8 +74,9 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
74
74
  if (!store) {
75
75
  return (_a = onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message, prompt.images)) !== null && _a !== void 0 ? _a : Promise.resolve();
76
76
  }
77
+ // A message that fails to go stays in the conversation, marked, to send again: not back in the box.
77
78
  return !working
78
- ? store.prompt(message, { images: prompt.images })
79
+ ? store.send(message, { images: prompt.images })
79
80
  : followUp
80
81
  ? server.followUp(store.sessionId, prompt)
81
82
  : server.steer(store.sessionId, prompt);
@@ -104,7 +105,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
104
105
  }, onError);
105
106
  };
106
107
  const waiting = ComposerUtil.queued(queue);
107
- return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(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,
108
+ return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(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,
108
109
  above,
109
110
  waiting.length > 0 && (React.createElement("div", { className: "ta-queue", "aria-live": "polite" },
110
111
  React.createElement("div", { className: "ta-queue-head" },
@@ -1,7 +1,7 @@
1
- import { CircleCheck, RotateCw, WifiOff } from 'lucide-react';
1
+ import { CircleAlert, CircleCheck, RotateCw, WifiOff } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useDevice } from '../device/device.js';
4
- import { useWorkbench } from '../hooks.js';
4
+ import { useNotices, useWorkbench } from '../hooks.js';
5
5
  import { useT } from '../i18n/use-t.js';
6
6
  import { Icon } from './icon.js';
7
7
  /** How long "connected again" stays. */
@@ -10,6 +10,8 @@ const BACK_MS = 1200;
10
10
  const LEAVE_MS = 240;
11
11
  /** A try the user asked for shows as one for at least this long, however soon it fails. */
12
12
  const TRY_SHOWN_MS = 900;
13
+ /** How long it says that something did not happen for a moment's drop (NoticesState.notDoneAt). */
14
+ const NOT_DONE_MS = 3500;
13
15
  /** The seconds until `at`, counted down once a second; `undefined` without `at`. */
14
16
  function useSecondsUntil(at) {
15
17
  const [now, setNow] = React.useState(Date.now);
@@ -23,12 +25,31 @@ function useSecondsUntil(at) {
23
25
  }, [at]);
24
26
  return at === undefined ? undefined : Math.max(0, Math.ceil((at - now) / 1000));
25
27
  }
26
- /** Offline while the workbench shows it so, then "back" for a moment, then going; nothing for a drop it does not show. */
27
- function usePhase(shown) {
28
+ /** Whether `at` is less than `ms` ago, turning false when it no longer is. */
29
+ function useRecent(at, ms) {
30
+ const recent = at !== undefined && Date.now() - at < ms;
31
+ const [, setTick] = React.useState(0);
32
+ React.useEffect(() => {
33
+ if (!recent || at === undefined) {
34
+ return;
35
+ }
36
+ const timer = setTimeout(() => setTick(tick => tick + 1), at + ms - Date.now());
37
+ return () => clearTimeout(timer);
38
+ }, [recent, at, ms]);
39
+ return recent;
40
+ }
41
+ /**
42
+ * Offline while the workbench shows it so, then "back" for a moment, then going; nothing for a drop it does
43
+ * not show. `notDone` while online: something the user did was cut off by a drop that mended itself.
44
+ */
45
+ function usePhase(shown, notDone) {
28
46
  const [phase, setPhase] = React.useState('none');
29
47
  React.useEffect(() => {
30
48
  setPhase(phase => (shown ? 'offline' : phase === 'offline' ? 'back' : phase));
31
49
  }, [shown]);
50
+ React.useEffect(() => {
51
+ setPhase(phase => (notDone && (phase === 'none' || phase === 'leaving') ? 'notDone' : !notDone && phase === 'notDone' ? 'leaving' : phase));
52
+ }, [notDone]);
32
53
  React.useEffect(() => {
33
54
  if (phase !== 'back' && phase !== 'leaving') {
34
55
  return;
@@ -57,15 +78,23 @@ function usePressed() {
57
78
  */
58
79
  function useConnectionNotice() {
59
80
  const t = useT();
60
- const [{ offlineShown, error, retryAt }, workbench] = useWorkbench();
61
- const phase = usePhase(!!offlineShown);
81
+ const [{ offlineShown, error, retryAt, status }, workbench] = useWorkbench();
82
+ const [{ notDoneAt }] = useNotices();
83
+ // Something the user did did not happen: no notice over the page, this row says it. Offline, it shows at once.
84
+ const notDone = useRecent(notDoneAt, NOT_DONE_MS);
85
+ const online = status === 'online';
86
+ const phase = usePhase(!!offlineShown || (notDone && !online && status !== 'signed-out'), notDone && online);
62
87
  const seconds = useSecondsUntil(phase === 'offline' ? retryAt : undefined);
63
88
  const [pressed, press] = usePressed();
64
89
  const text = error === 'away' ? t('ta.connection.away') : error === 'unreachable' ? t('ta.unreachable') : t('ta.connection.lost');
90
+ // One line, for a phone: what was shown before still shows under it, as a chat app does without network.
91
+ const brief = error === 'away' ? t('ta.connection.awayBrief') : error === 'unreachable' ? t('ta.connection.unreachableBrief') : t('ta.connection.lost');
65
92
  return {
66
93
  phase,
67
- back: phase !== 'offline',
94
+ back: phase === 'back' || phase === 'leaving',
95
+ notDone: phase === 'notDone',
68
96
  text,
97
+ brief,
69
98
  seconds,
70
99
  trying: phase === 'offline' && (pressed || !seconds),
71
100
  retry: () => {
@@ -101,17 +130,20 @@ function useWidth(body, content) {
101
130
  */
102
131
  export function ConnectionBar() {
103
132
  const t = useT();
104
- const { phase, back, text, seconds, trying, retry } = useConnectionNotice();
133
+ const { phase, back, notDone, text, seconds, trying, retry } = useConnectionNotice();
105
134
  const body = React.useRef(null);
106
- const width = useWidth(body, phase === 'none' ? undefined : back ? 'back' : 'offline');
135
+ const shown = phase === 'none' ? undefined : notDone ? 'notDone' : back ? 'back' : 'offline';
136
+ const width = useWidth(body, shown);
107
137
  if (phase === 'none') {
108
138
  return null;
109
139
  }
110
- const classes = ['ta-connection', back && 'ta-connection-back', phase === 'leaving' && 'ta-connection-leaving'];
140
+ const classes = ['ta-connection', back && 'ta-connection-back', notDone && 'ta-connection-notdone', phase === 'leaving' && 'ta-connection-leaving'];
111
141
  // The border of the bar is around the body.
112
142
  const style = width === undefined ? undefined : { width: width + 2 };
113
143
  return (React.createElement("div", { className: classes.filter(Boolean).join(' '), role: "status", style: style },
114
- React.createElement("div", { className: "ta-connection-body", ref: body, key: back ? 'back' : 'offline' }, back ? (React.createElement(React.Fragment, null,
144
+ React.createElement("div", { className: "ta-connection-body", ref: body, key: shown }, notDone ? (React.createElement(React.Fragment, null,
145
+ React.createElement(Icon, { icon: CircleAlert, size: 15, className: "ta-level-icon" }),
146
+ React.createElement("span", { className: "ta-connection-text" }, t('ta.connection.notDone')))) : back ? (React.createElement(React.Fragment, null,
115
147
  React.createElement(Icon, { icon: CircleCheck, size: 15, className: "ta-level-icon" }),
116
148
  React.createElement("span", null, t('ta.connection.back')))) : (React.createElement(React.Fragment, null,
117
149
  React.createElement(Icon, { icon: WifiOff, size: 15, className: "ta-level-icon" }),
@@ -130,18 +162,19 @@ export function ConnectionBar() {
130
162
  export function ConnectionBanner() {
131
163
  const t = useT();
132
164
  const handheld = useDevice(device => device.handheld);
133
- const { phase, back, text, trying, retry } = useConnectionNotice();
165
+ const { phase, back, notDone, text, brief, trying, retry } = useConnectionNotice();
134
166
  if (!handheld) {
135
167
  return null;
136
168
  }
137
- const open = phase === 'offline' || phase === 'back';
169
+ const open = phase === 'offline' || phase === 'back' || notDone;
170
+ const quiet = back || notDone;
138
171
  const classes = ['ta-connection-banner', open && 'ta-open', back && 'ta-connection-back'];
139
172
  // Always there, empty while closed, so that it opens with a transition.
140
173
  return (React.createElement("div", { className: classes.filter(Boolean).join(' '), role: "status", "aria-hidden": !open },
141
- React.createElement("div", { className: "ta-connection-banner-inner" }, phase !== 'none' && (React.createElement("button", { type: "button", className: "ta-connection-banner-row", disabled: back || trying, tabIndex: open ? undefined : -1, onClick: retry },
142
- React.createElement(Icon, { icon: back ? CircleCheck : WifiOff, size: 16, className: "ta-level-icon" }),
143
- React.createElement("span", { className: "ta-connection-banner-text" }, back ? t('ta.connection.back') : text),
144
- !back && (React.createElement("span", { className: "ta-connection-banner-action" },
174
+ 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 },
175
+ React.createElement(Icon, { icon: notDone ? CircleAlert : back ? CircleCheck : WifiOff, size: 16, className: "ta-level-icon" }),
176
+ React.createElement("span", { className: "ta-connection-banner-text" }, notDone ? t('ta.connection.notDone') : back ? t('ta.connection.back') : brief),
177
+ !quiet && (React.createElement("span", { className: "ta-connection-banner-action" },
145
178
  trying ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Icon, { icon: RotateCw, size: 14 }),
146
179
  trying ? t('ta.connection.retrying') : t('ta.connection.retry'))))))));
147
180
  }
@@ -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; above a finger
12
- * (below when there is no room), centred on it, as the menus of a phone. Always on the screen.
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,13 +35,27 @@ 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];