@celljs/ta-web 4.9.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) 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 +33 -5
  6. package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
  7. package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
  8. package/esm/browser/assistant/assistant-task-source.js +2 -0
  9. package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
  10. package/esm/browser/assistant/assistant-task-util.js +13 -3
  11. package/esm/browser/assistant/assistant-tasks.js +3 -2
  12. package/esm/browser/assistant/assistant-view.js +81 -56
  13. package/esm/browser/assistant/assistant.d.ts +30 -1
  14. package/esm/browser/assistant/assistant.js +89 -6
  15. package/esm/browser/assistant/task-views.d.ts +40 -6
  16. package/esm/browser/assistant/task-views.js +73 -21
  17. package/esm/browser/avatar/dino-avatar.d.ts +3 -4
  18. package/esm/browser/avatar/dino-avatar.js +4 -178
  19. package/esm/browser/avatar/dino-face.d.ts +19 -0
  20. package/esm/browser/avatar/dino-face.js +142 -0
  21. package/esm/browser/avatar/dino-geometry.d.ts +11 -0
  22. package/esm/browser/avatar/dino-geometry.js +38 -0
  23. package/esm/browser/avatar/dino-kinds.d.ts +15 -0
  24. package/esm/browser/avatar/dino-kinds.js +544 -0
  25. package/esm/browser/avatar/dino-motion.js +1 -1
  26. package/esm/browser/avatar/dino-shape.d.ts +80 -0
  27. package/esm/browser/avatar/dino-shape.js +113 -0
  28. package/esm/browser/avatar/dino-species.d.ts +1 -61
  29. package/esm/browser/avatar/dino-species.js +2 -653
  30. package/esm/browser/chat/chat-packages.d.ts +39 -0
  31. package/esm/browser/chat/chat-packages.js +70 -0
  32. package/esm/browser/chat/chat-protocol.d.ts +23 -1
  33. package/esm/browser/chat/chat-stores.d.ts +59 -0
  34. package/esm/browser/chat/chat-stores.js +121 -0
  35. package/esm/browser/chat/chat-util.d.ts +17 -0
  36. package/esm/browser/chat/chat-util.js +61 -0
  37. package/esm/browser/chat/chat-view.js +33 -12
  38. package/esm/browser/chat/chat.d.ts +31 -39
  39. package/esm/browser/chat/chat.js +226 -175
  40. package/esm/browser/components/access-view.js +1 -1
  41. package/esm/browser/components/account-menu.js +1 -1
  42. package/esm/browser/components/app-nav.d.ts +6 -3
  43. package/esm/browser/components/app-nav.js +19 -10
  44. package/esm/browser/components/app-shell-hooks.d.ts +47 -0
  45. package/esm/browser/components/app-shell-hooks.js +169 -0
  46. package/esm/browser/components/app-view.js +81 -172
  47. package/esm/browser/components/auth-view.js +1 -1
  48. package/esm/browser/components/chat-list.d.ts +20 -2
  49. package/esm/browser/components/chat-list.js +138 -22
  50. package/esm/browser/components/composer-box.d.ts +5 -5
  51. package/esm/browser/components/composer-box.js +111 -4
  52. package/esm/browser/components/composer.d.ts +7 -0
  53. package/esm/browser/components/composer.js +22 -14
  54. package/esm/browser/components/connection-bar.js +50 -17
  55. package/esm/browser/components/context-menu.d.ts +30 -4
  56. package/esm/browser/components/context-menu.js +199 -37
  57. package/esm/browser/components/conversation-scroll.d.ts +129 -6
  58. package/esm/browser/components/conversation-scroll.js +429 -109
  59. package/esm/browser/components/dino.js +1 -1
  60. package/esm/browser/components/earlier-messages.d.ts +2 -1
  61. package/esm/browser/components/earlier-messages.js +2 -17
  62. package/esm/browser/components/editor-area.d.ts +3 -1
  63. package/esm/browser/components/editor-area.js +6 -5
  64. package/esm/browser/components/empty-pictures.d.ts +0 -2
  65. package/esm/browser/components/empty-pictures.js +0 -16
  66. package/esm/browser/components/folder-picker.d.ts +5 -2
  67. package/esm/browser/components/folder-picker.js +30 -9
  68. package/esm/browser/components/held-talk.d.ts +28 -0
  69. package/esm/browser/components/held-talk.js +76 -0
  70. package/esm/browser/components/host-view.d.ts +1 -1
  71. package/esm/browser/components/host-view.js +1 -1
  72. package/esm/browser/components/icon.d.ts +2 -2
  73. package/esm/browser/components/icon.js +5 -6
  74. package/esm/browser/components/image-viewer.d.ts +124 -0
  75. package/esm/browser/components/image-viewer.js +397 -0
  76. package/esm/browser/components/lightbox.d.ts +11 -0
  77. package/esm/browser/components/lightbox.js +24 -0
  78. package/esm/browser/components/markdown.d.ts +6 -2
  79. package/esm/browser/components/markdown.js +24 -10
  80. package/esm/browser/components/media.js +1 -10
  81. package/esm/browser/components/message-footer.d.ts +16 -2
  82. package/esm/browser/components/message-footer.js +29 -12
  83. package/esm/browser/components/message-list.d.ts +24 -3
  84. package/esm/browser/components/message-list.js +149 -20
  85. package/esm/browser/components/message-menu.d.ts +3 -1
  86. package/esm/browser/components/message-menu.js +18 -3
  87. package/esm/browser/components/nav-places.d.ts +16 -1
  88. package/esm/browser/components/nav-places.js +12 -3
  89. package/esm/browser/components/phone-shell.d.ts +4 -1
  90. package/esm/browser/components/phone-shell.js +3 -1
  91. package/esm/browser/components/run-status.js +3 -3
  92. package/esm/browser/components/select-bar.d.ts +9 -0
  93. package/esm/browser/components/select-bar.js +24 -0
  94. package/esm/browser/components/session-settings.d.ts +6 -0
  95. package/esm/browser/components/session-settings.js +14 -1
  96. package/esm/browser/components/session-view.js +8 -4
  97. package/esm/browser/components/settings-choices.d.ts +35 -0
  98. package/esm/browser/components/settings-choices.js +117 -0
  99. package/esm/browser/components/settings-parts.d.ts +21 -0
  100. package/esm/browser/components/settings-parts.js +323 -0
  101. package/esm/browser/components/settings-view.d.ts +0 -6
  102. package/esm/browser/components/settings-view.js +4 -406
  103. package/esm/browser/components/swipe-row.d.ts +2 -2
  104. package/esm/browser/components/swipe-row.js +7 -3
  105. package/esm/browser/components/tool-view.js +14 -12
  106. package/esm/browser/components/voice-button.d.ts +1 -1
  107. package/esm/browser/components/voice-button.js +1 -1
  108. package/esm/browser/components/voice-talk.d.ts +43 -0
  109. package/esm/browser/components/voice-talk.js +222 -0
  110. package/esm/browser/components/workbench-view.js +1 -1
  111. package/esm/browser/device/device.d.ts +3 -0
  112. package/esm/browser/device/device.js +11 -1
  113. package/esm/browser/device/hold.d.ts +42 -0
  114. package/esm/browser/device/hold.js +136 -0
  115. package/esm/browser/device/launch-screen.d.ts +1 -1
  116. package/esm/browser/device/launch-screen.js +1 -1
  117. package/esm/browser/device/long-press.d.ts +2 -0
  118. package/esm/browser/device/long-press.js +16 -1
  119. package/esm/browser/device/pull-down.d.ts +4 -2
  120. package/esm/browser/device/pull-down.js +64 -76
  121. package/esm/browser/device/row-swipe.d.ts +35 -10
  122. package/esm/browser/device/row-swipe.js +149 -71
  123. package/esm/browser/device/shake-undo.d.ts +16 -0
  124. package/esm/browser/device/shake-undo.js +59 -0
  125. package/esm/browser/device/sheet-swipe.d.ts +118 -18
  126. package/esm/browser/device/sheet-swipe.js +406 -107
  127. package/esm/browser/extension/icons.js +2 -1
  128. package/esm/browser/extension/web-extension-api.d.ts +135 -2
  129. package/esm/browser/extension/web-extension-code.d.ts +6 -0
  130. package/esm/browser/extension/web-extension-code.js +24 -0
  131. package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
  132. package/esm/browser/extension/web-extension-protocol.js +8 -0
  133. package/esm/browser/extension/web-extensions.d.ts +14 -1
  134. package/esm/browser/extension/web-extensions.js +128 -24
  135. package/esm/browser/extension/web-tasks.d.ts +9 -1
  136. package/esm/browser/extension/web-tasks.js +24 -0
  137. package/esm/browser/files/files-protocol.d.ts +25 -0
  138. package/esm/browser/files/files-protocol.js +2 -0
  139. package/esm/browser/files/files.d.ts +35 -0
  140. package/esm/browser/files/files.js +119 -0
  141. package/esm/browser/hooks.d.ts +3 -1
  142. package/esm/browser/hooks.js +8 -0
  143. package/esm/browser/i18n/locales.d.ts +29 -2
  144. package/esm/browser/i18n/messages.d.ts +28 -1
  145. package/esm/browser/i18n/messages.js +58 -4
  146. package/esm/browser/index.d.ts +6 -0
  147. package/esm/browser/index.js +6 -0
  148. package/esm/browser/notices/notices-protocol.d.ts +9 -1
  149. package/esm/browser/notices/notices.d.ts +2 -0
  150. package/esm/browser/notices/notices.js +20 -10
  151. package/esm/browser/offline/device-values.d.ts +55 -0
  152. package/esm/browser/offline/device-values.js +142 -0
  153. package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
  154. package/esm/browser/offline/kept-chats-protocol.js +2 -0
  155. package/esm/browser/offline/kept-chats.d.ts +47 -0
  156. package/esm/browser/offline/kept-chats.js +146 -0
  157. package/esm/browser/offline/offline-reads.d.ts +44 -0
  158. package/esm/browser/offline/offline-reads.js +107 -0
  159. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  160. package/esm/browser/settings/settings-protocol.js +2 -0
  161. package/esm/browser/style/conversation.d.ts +1 -1
  162. package/esm/browser/style/conversation.js +57 -17
  163. package/esm/browser/style/device.js +43 -4
  164. package/esm/browser/style/layout.d.ts +1 -1
  165. package/esm/browser/style/layout.js +67 -15
  166. package/esm/browser/style/pages.d.ts +1 -1
  167. package/esm/browser/style/pages.js +2 -1
  168. package/esm/browser/style/shell.d.ts +1 -1
  169. package/esm/browser/style/shell.js +47 -3
  170. package/esm/browser/style/tasks.d.ts +1 -1
  171. package/esm/browser/style/tasks.js +2 -0
  172. package/esm/browser/util/frame.d.ts +5 -4
  173. package/esm/browser/util/frame.js +5 -4
  174. package/esm/browser/util/markdown.d.ts +18 -1
  175. package/esm/browser/util/markdown.js +119 -5
  176. package/esm/browser/util/process.d.ts +21 -0
  177. package/esm/browser/util/process.js +45 -1
  178. package/esm/browser/util/voice.d.ts +5 -2
  179. package/esm/browser/util/voice.js +6 -3
  180. package/esm/browser/util/zoom.d.ts +46 -0
  181. package/esm/browser/util/zoom.js +96 -0
  182. package/esm/browser/workbench-calls.d.ts +59 -0
  183. package/esm/browser/workbench-calls.js +141 -0
  184. package/esm/browser/workbench-protocol.d.ts +5 -1
  185. package/esm/browser/workbench-util.d.ts +68 -0
  186. package/esm/browser/workbench-util.js +145 -0
  187. package/esm/browser/workbench.d.ts +15 -42
  188. package/esm/browser/workbench.js +53 -167
  189. package/lib/browser/assistant/assistant-chat-list.js +8 -2
  190. package/lib/browser/assistant/assistant-extension.d.ts +8 -1
  191. package/lib/browser/assistant/assistant-extension.js +33 -5
  192. package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
  193. package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
  194. package/lib/browser/assistant/assistant-task-source.js +2 -0
  195. package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
  196. package/lib/browser/assistant/assistant-task-util.js +13 -3
  197. package/lib/browser/assistant/assistant-tasks.js +2 -1
  198. package/lib/browser/assistant/assistant-view.js +78 -53
  199. package/lib/browser/assistant/assistant.d.ts +30 -1
  200. package/lib/browser/assistant/assistant.js +89 -6
  201. package/lib/browser/assistant/task-views.d.ts +40 -6
  202. package/lib/browser/assistant/task-views.js +74 -21
  203. package/lib/browser/avatar/dino-avatar.d.ts +3 -4
  204. package/lib/browser/avatar/dino-avatar.js +27 -202
  205. package/lib/browser/avatar/dino-face.d.ts +20 -0
  206. package/lib/browser/avatar/dino-face.js +148 -0
  207. package/lib/browser/avatar/dino-geometry.d.ts +12 -0
  208. package/lib/browser/avatar/dino-geometry.js +47 -0
  209. package/lib/browser/avatar/dino-kinds.d.ts +16 -0
  210. package/lib/browser/avatar/dino-kinds.js +547 -0
  211. package/lib/browser/avatar/dino-motion.js +2 -2
  212. package/lib/browser/avatar/dino-shape.d.ts +81 -0
  213. package/lib/browser/avatar/dino-shape.js +126 -0
  214. package/lib/browser/avatar/dino-species.d.ts +1 -61
  215. package/lib/browser/avatar/dino-species.js +34 -687
  216. package/lib/browser/chat/chat-packages.d.ts +40 -0
  217. package/lib/browser/chat/chat-packages.js +74 -0
  218. package/lib/browser/chat/chat-protocol.d.ts +23 -1
  219. package/lib/browser/chat/chat-stores.d.ts +60 -0
  220. package/lib/browser/chat/chat-stores.js +125 -0
  221. package/lib/browser/chat/chat-util.d.ts +18 -0
  222. package/lib/browser/chat/chat-util.js +64 -0
  223. package/lib/browser/chat/chat-view.js +33 -12
  224. package/lib/browser/chat/chat.d.ts +31 -39
  225. package/lib/browser/chat/chat.js +227 -176
  226. package/lib/browser/components/access-view.js +2 -2
  227. package/lib/browser/components/account-menu.js +2 -2
  228. package/lib/browser/components/app-nav.d.ts +6 -3
  229. package/lib/browser/components/app-nav.js +17 -8
  230. package/lib/browser/components/app-shell-hooks.d.ts +48 -0
  231. package/lib/browser/components/app-shell-hooks.js +211 -0
  232. package/lib/browser/components/app-view.js +89 -180
  233. package/lib/browser/components/auth-view.js +3 -3
  234. package/lib/browser/components/chat-list.d.ts +20 -2
  235. package/lib/browser/components/chat-list.js +137 -21
  236. package/lib/browser/components/composer-box.d.ts +5 -5
  237. package/lib/browser/components/composer-box.js +111 -4
  238. package/lib/browser/components/composer.d.ts +7 -0
  239. package/lib/browser/components/composer.js +22 -14
  240. package/lib/browser/components/connection-bar.js +48 -15
  241. package/lib/browser/components/context-menu.d.ts +30 -4
  242. package/lib/browser/components/context-menu.js +198 -36
  243. package/lib/browser/components/conversation-scroll.d.ts +129 -6
  244. package/lib/browser/components/conversation-scroll.js +431 -110
  245. package/lib/browser/components/dino.js +3 -3
  246. package/lib/browser/components/earlier-messages.d.ts +2 -1
  247. package/lib/browser/components/earlier-messages.js +2 -17
  248. package/lib/browser/components/editor-area.d.ts +3 -1
  249. package/lib/browser/components/editor-area.js +5 -4
  250. package/lib/browser/components/empty-pictures.d.ts +0 -2
  251. package/lib/browser/components/empty-pictures.js +0 -17
  252. package/lib/browser/components/folder-picker.d.ts +5 -2
  253. package/lib/browser/components/folder-picker.js +30 -9
  254. package/lib/browser/components/held-talk.d.ts +29 -0
  255. package/lib/browser/components/held-talk.js +79 -0
  256. package/lib/browser/components/host-view.d.ts +1 -1
  257. package/lib/browser/components/host-view.js +5 -5
  258. package/lib/browser/components/icon.d.ts +2 -2
  259. package/lib/browser/components/icon.js +7 -6
  260. package/lib/browser/components/image-viewer.d.ts +125 -0
  261. package/lib/browser/components/image-viewer.js +435 -0
  262. package/lib/browser/components/lightbox.d.ts +12 -0
  263. package/lib/browser/components/lightbox.js +60 -0
  264. package/lib/browser/components/markdown.d.ts +6 -2
  265. package/lib/browser/components/markdown.js +24 -10
  266. package/lib/browser/components/media.js +2 -11
  267. package/lib/browser/components/message-footer.d.ts +16 -2
  268. package/lib/browser/components/message-footer.js +31 -12
  269. package/lib/browser/components/message-list.d.ts +24 -3
  270. package/lib/browser/components/message-list.js +146 -16
  271. package/lib/browser/components/message-menu.d.ts +3 -1
  272. package/lib/browser/components/message-menu.js +17 -2
  273. package/lib/browser/components/nav-places.d.ts +16 -1
  274. package/lib/browser/components/nav-places.js +13 -3
  275. package/lib/browser/components/phone-shell.d.ts +4 -1
  276. package/lib/browser/components/phone-shell.js +3 -1
  277. package/lib/browser/components/run-status.js +3 -3
  278. package/lib/browser/components/select-bar.d.ts +10 -0
  279. package/lib/browser/components/select-bar.js +61 -0
  280. package/lib/browser/components/session-settings.d.ts +6 -0
  281. package/lib/browser/components/session-settings.js +14 -1
  282. package/lib/browser/components/session-view.js +7 -3
  283. package/lib/browser/components/settings-choices.d.ts +36 -0
  284. package/lib/browser/components/settings-choices.js +156 -0
  285. package/lib/browser/components/settings-parts.d.ts +22 -0
  286. package/lib/browser/components/settings-parts.js +359 -0
  287. package/lib/browser/components/settings-view.d.ts +0 -6
  288. package/lib/browser/components/settings-view.js +2 -405
  289. package/lib/browser/components/swipe-row.d.ts +2 -2
  290. package/lib/browser/components/swipe-row.js +7 -3
  291. package/lib/browser/components/tool-view.js +14 -12
  292. package/lib/browser/components/voice-button.d.ts +1 -1
  293. package/lib/browser/components/voice-button.js +1 -1
  294. package/lib/browser/components/voice-talk.d.ts +44 -0
  295. package/lib/browser/components/voice-talk.js +260 -0
  296. package/lib/browser/components/workbench-view.js +3 -3
  297. package/lib/browser/device/device.d.ts +3 -0
  298. package/lib/browser/device/device.js +11 -1
  299. package/lib/browser/device/hold.d.ts +43 -0
  300. package/lib/browser/device/hold.js +173 -0
  301. package/lib/browser/device/launch-screen.d.ts +1 -1
  302. package/lib/browser/device/launch-screen.js +1 -1
  303. package/lib/browser/device/long-press.d.ts +2 -0
  304. package/lib/browser/device/long-press.js +16 -1
  305. package/lib/browser/device/pull-down.d.ts +4 -2
  306. package/lib/browser/device/pull-down.js +63 -75
  307. package/lib/browser/device/row-swipe.d.ts +35 -10
  308. package/lib/browser/device/row-swipe.js +148 -70
  309. package/lib/browser/device/shake-undo.d.ts +17 -0
  310. package/lib/browser/device/shake-undo.js +63 -0
  311. package/lib/browser/device/sheet-swipe.d.ts +118 -18
  312. package/lib/browser/device/sheet-swipe.js +410 -108
  313. package/lib/browser/extension/icons.js +1 -0
  314. package/lib/browser/extension/web-extension-api.d.ts +135 -2
  315. package/lib/browser/extension/web-extension-code.d.ts +6 -0
  316. package/lib/browser/extension/web-extension-code.js +24 -0
  317. package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
  318. package/lib/browser/extension/web-extension-protocol.js +9 -1
  319. package/lib/browser/extension/web-extensions.d.ts +14 -1
  320. package/lib/browser/extension/web-extensions.js +125 -21
  321. package/lib/browser/extension/web-tasks.d.ts +9 -1
  322. package/lib/browser/extension/web-tasks.js +24 -0
  323. package/lib/browser/files/files-protocol.d.ts +26 -0
  324. package/lib/browser/files/files-protocol.js +5 -0
  325. package/lib/browser/files/files.d.ts +36 -0
  326. package/lib/browser/files/files.js +122 -0
  327. package/lib/browser/hooks.d.ts +3 -1
  328. package/lib/browser/hooks.js +9 -0
  329. package/lib/browser/i18n/locales.d.ts +29 -2
  330. package/lib/browser/i18n/messages.d.ts +28 -1
  331. package/lib/browser/i18n/messages.js +58 -4
  332. package/lib/browser/index.d.ts +6 -0
  333. package/lib/browser/index.js +6 -0
  334. package/lib/browser/notices/notices-protocol.d.ts +9 -1
  335. package/lib/browser/notices/notices.d.ts +2 -0
  336. package/lib/browser/notices/notices.js +20 -10
  337. package/lib/browser/offline/device-values.d.ts +56 -0
  338. package/lib/browser/offline/device-values.js +148 -0
  339. package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
  340. package/lib/browser/offline/kept-chats-protocol.js +5 -0
  341. package/lib/browser/offline/kept-chats.d.ts +48 -0
  342. package/lib/browser/offline/kept-chats.js +149 -0
  343. package/lib/browser/offline/offline-reads.d.ts +45 -0
  344. package/lib/browser/offline/offline-reads.js +111 -0
  345. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  346. package/lib/browser/settings/settings-protocol.js +2 -0
  347. package/lib/browser/style/conversation.d.ts +1 -1
  348. package/lib/browser/style/conversation.js +57 -17
  349. package/lib/browser/style/device.js +43 -4
  350. package/lib/browser/style/layout.d.ts +1 -1
  351. package/lib/browser/style/layout.js +67 -15
  352. package/lib/browser/style/pages.d.ts +1 -1
  353. package/lib/browser/style/pages.js +2 -1
  354. package/lib/browser/style/shell.d.ts +1 -1
  355. package/lib/browser/style/shell.js +47 -3
  356. package/lib/browser/style/tasks.d.ts +1 -1
  357. package/lib/browser/style/tasks.js +2 -0
  358. package/lib/browser/util/frame.d.ts +5 -4
  359. package/lib/browser/util/frame.js +5 -4
  360. package/lib/browser/util/markdown.d.ts +18 -1
  361. package/lib/browser/util/markdown.js +119 -5
  362. package/lib/browser/util/process.d.ts +21 -0
  363. package/lib/browser/util/process.js +46 -2
  364. package/lib/browser/util/voice.d.ts +5 -2
  365. package/lib/browser/util/voice.js +6 -3
  366. package/lib/browser/util/zoom.d.ts +47 -0
  367. package/lib/browser/util/zoom.js +99 -0
  368. package/lib/browser/workbench-calls.d.ts +60 -0
  369. package/lib/browser/workbench-calls.js +145 -0
  370. package/lib/browser/workbench-protocol.d.ts +5 -1
  371. package/lib/browser/workbench-util.d.ts +69 -0
  372. package/lib/browser/workbench-util.js +151 -0
  373. package/lib/browser/workbench.d.ts +15 -42
  374. package/lib/browser/workbench.js +74 -189
  375. package/package.json +10 -10
  376. package/public/launch.svg +46 -42
@@ -0,0 +1,222 @@
1
+ import { PenLine, X } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { HeldUtil } from '../device/hold.js';
5
+ import { useLanguage, useT } from '../i18n/use-t.js';
6
+ import { Voice } from '../util/voice.js';
7
+ import { Icon } from './icon.js';
8
+ export var VoiceTalkUtil;
9
+ (function (VoiceTalkUtil) {
10
+ /** How long a talk lasts for the words to count: shorter, a finger slipped on the box and nothing is given. */
11
+ VoiceTalkUtil.SHORT_MS = 600;
12
+ /** How long the end of a talk waits for recognition to say it ended before it ends anyway. */
13
+ VoiceTalkUtil.SETTLE_MS = 1500;
14
+ /** How long "too short" stays before the page comes back. */
15
+ VoiceTalkUtil.SHORT_NOTICE_MS = 700;
16
+ /** How long the overlay takes to fade out. */
17
+ VoiceTalkUtil.LEAVE_MS = 160;
18
+ /** What a talk gives; none when it was too short to be meant, or when nothing was heard. */
19
+ function given(words, heldMs) {
20
+ const text = words.trim();
21
+ return text && heldMs >= VoiceTalkUtil.SHORT_MS ? text : undefined;
22
+ }
23
+ VoiceTalkUtil.given = given;
24
+ /** The zone of the overlay under a point (`data-talk-zone`): the bottom, where the finger starts, sends. */
25
+ function zone(element) {
26
+ var _a;
27
+ const zone = (_a = element === null || element === void 0 ? void 0 : element.closest('[data-talk-zone]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-talk-zone');
28
+ return zone === 'cancel' || zone === 'edit' ? zone : 'send';
29
+ }
30
+ VoiceTalkUtil.zone = zone;
31
+ })(VoiceTalkUtil || (VoiceTalkUtil = {}));
32
+ const IDLE = { phase: 'idle', words: '', zone: 'send' };
33
+ /**
34
+ * A conversation by voice as WeChat's: a finger held on the message box (or on an entry of the navigation) dims the
35
+ * page and a green bubble listens, the words coming as they are said. Let go on the bottom, they are sent; slid
36
+ * over 取消 they are dropped, over 编辑 they stay in the box to be read over. A talk too short to be meant, which a
37
+ * wrong touch is, says so and gives nothing, as one where nothing was heard does.
38
+ */
39
+ export function useVoiceTalk(onGive, onError) {
40
+ const t = useT();
41
+ const language = useLanguage();
42
+ const [state, setState] = React.useState(IDLE);
43
+ // The phase as the finger and recognition find it, between renders.
44
+ const phase = React.useRef('idle');
45
+ const listening = React.useRef(undefined);
46
+ const heard = React.useRef('');
47
+ const since = React.useRef(0);
48
+ const held = React.useRef(0);
49
+ const zone = React.useRef('send');
50
+ /** Recognition ended while the finger was still down (a long silence): what it heard waits for the finger. */
51
+ const ended = React.useRef(false);
52
+ const timer = React.useRef(undefined);
53
+ // Recognition and the finger outlive a render: always to what the box is now.
54
+ const give = React.useRef(onGive);
55
+ give.current = onGive;
56
+ const fail = React.useRef(onError);
57
+ fail.current = onError;
58
+ // The box goes as it listens (another conversation, another page): what was said is not given to it.
59
+ React.useEffect(() => () => {
60
+ clearTimeout(timer.current);
61
+ const session = listening.current;
62
+ listening.current = undefined;
63
+ session === null || session === void 0 ? void 0 : session.stop();
64
+ }, []);
65
+ const go = (next, more) => {
66
+ phase.current = next;
67
+ setState(current => ({ ...current, ...more, phase: next }));
68
+ };
69
+ const later = (ms, then) => {
70
+ clearTimeout(timer.current);
71
+ timer.current = setTimeout(then, ms);
72
+ };
73
+ /** Stops listening, whatever it heard after. */
74
+ const quiet = () => {
75
+ const session = listening.current;
76
+ listening.current = undefined;
77
+ session === null || session === void 0 ? void 0 : session.stop();
78
+ };
79
+ /** The page comes back, the overlay fading out. */
80
+ const leave = () => {
81
+ quiet();
82
+ go('leaving');
83
+ later(VoiceTalkUtil.LEAVE_MS, () => {
84
+ phase.current = 'idle';
85
+ setState(IDLE);
86
+ });
87
+ };
88
+ /** The finger let go off 取消 and recognition said its last: the words go as the place it let go says. */
89
+ const deliver = () => {
90
+ const text = VoiceTalkUtil.given(heard.current, held.current);
91
+ const where = zone.current;
92
+ leave();
93
+ if (text && where !== 'cancel') {
94
+ give.current(text, where);
95
+ }
96
+ };
97
+ const start = () => {
98
+ if (phase.current === 'listening' || phase.current === 'released') {
99
+ return;
100
+ }
101
+ clearTimeout(timer.current);
102
+ since.current = Date.now();
103
+ held.current = 0;
104
+ heard.current = '';
105
+ zone.current = 'send';
106
+ ended.current = false;
107
+ // What a talk ended or dropped before still says it ended (onerror, then onend): not to the next one.
108
+ let session;
109
+ session = Voice.listen(language, words => {
110
+ if (listening.current === session) {
111
+ heard.current = words;
112
+ setState(current => ({ ...current, words }));
113
+ }
114
+ }, failure => {
115
+ if (listening.current !== session) {
116
+ return;
117
+ }
118
+ if (failure) {
119
+ fail.current(new Error(t(Voice.denied(failure) ? 'ta.composer.voiceDenied' : 'ta.composer.voiceFailed', { error: failure })));
120
+ leave();
121
+ }
122
+ else if (phase.current === 'released') {
123
+ listening.current = undefined;
124
+ deliver();
125
+ }
126
+ else {
127
+ ended.current = true;
128
+ }
129
+ },
130
+ // A finger held goes on past a pause: it stops when it lets go.
131
+ true);
132
+ if (session) {
133
+ listening.current = session;
134
+ go('listening', { words: '', zone: 'send' });
135
+ }
136
+ };
137
+ const point = (x, y) => {
138
+ if (phase.current !== 'listening') {
139
+ return;
140
+ }
141
+ const next = VoiceTalkUtil.zone(document.elementFromPoint(x, y));
142
+ if (next !== zone.current) {
143
+ zone.current = next;
144
+ setState(current => ({ ...current, zone: next }));
145
+ if (next !== 'send') {
146
+ HeldUtil.tick();
147
+ }
148
+ }
149
+ };
150
+ const release = () => {
151
+ var _a;
152
+ if (phase.current !== 'listening') {
153
+ return;
154
+ }
155
+ held.current = Date.now() - since.current;
156
+ if (zone.current === 'cancel') {
157
+ leave();
158
+ }
159
+ else if (held.current < VoiceTalkUtil.SHORT_MS) {
160
+ // Too short to be meant: said so for a moment, and nothing is given.
161
+ quiet();
162
+ go('short');
163
+ later(VoiceTalkUtil.SHORT_NOTICE_MS, leave);
164
+ }
165
+ else if (ended.current) {
166
+ listening.current = undefined;
167
+ deliver();
168
+ }
169
+ else {
170
+ go('released');
171
+ (_a = listening.current) === null || _a === void 0 ? void 0 : _a.stop();
172
+ // Recognition that does not say it ended would leave the page dimmed: the talk ends with what was heard.
173
+ later(VoiceTalkUtil.SETTLE_MS, () => phase.current === 'released' && deliver());
174
+ }
175
+ };
176
+ const cancel = () => {
177
+ if (phase.current !== 'idle' && phase.current !== 'leaving') {
178
+ leave();
179
+ }
180
+ };
181
+ return { ...state, active: state.phase === 'listening' || state.phase === 'released', start, point, release, cancel };
182
+ }
183
+ /**
184
+ * What a talk shows, over the whole page (above the keyboard): the page dimmed, a green bubble with the words as
185
+ * they come, 取消 and 编辑 to slide the finger onto, and the bottom it starts on, which says what letting go does.
186
+ */
187
+ export function VoiceTalkOverlay({ talk }) {
188
+ const t = useT();
189
+ const { phase, cancel } = talk;
190
+ const listening = phase === 'listening';
191
+ React.useEffect(() => {
192
+ if (!listening) {
193
+ return;
194
+ }
195
+ const onKey = (event) => event.key === 'Escape' && cancel();
196
+ document.addEventListener('keydown', onKey);
197
+ return () => document.removeEventListener('keydown', onKey);
198
+ }, [listening, cancel]);
199
+ if (phase === 'idle') {
200
+ return null;
201
+ }
202
+ const short = phase === 'short';
203
+ const hint = listening ? t(talk.zone === 'cancel' ? 'ta.talk.releaseCancel' : talk.zone === 'edit' ? 'ta.talk.releaseEdit' : 'ta.talk.releaseSend') : '';
204
+ return createPortal(React.createElement("div", { className: `ta-talk ta-talk-${talk.zone} ta-talk-${phase}`, role: "dialog", "aria-modal": "true", "aria-label": t('ta.talk.listening') },
205
+ React.createElement("div", { className: "ta-talk-bubble", "aria-live": "polite" }, short ? (React.createElement("p", { className: "ta-talk-words" }, t('ta.talk.tooShort'))) : talk.words ? (React.createElement("p", { className: "ta-talk-words" }, talk.words)) : (React.createElement("span", { className: "ta-wave", "aria-hidden": "true" },
206
+ React.createElement("i", null),
207
+ React.createElement("i", null),
208
+ React.createElement("i", null),
209
+ React.createElement("i", null)))),
210
+ React.createElement("div", { className: "ta-talk-zones", "aria-hidden": !listening },
211
+ React.createElement("div", { className: `ta-talk-zone${talk.zone === 'cancel' ? ' ta-on' : ''}`, "data-talk-zone": "cancel" },
212
+ React.createElement("span", { className: "ta-talk-zone-label" }, t('ta.cancel')),
213
+ React.createElement("span", { className: "ta-talk-zone-circle" },
214
+ React.createElement(Icon, { icon: X, size: 26 }))),
215
+ React.createElement("div", { className: `ta-talk-zone${talk.zone === 'edit' ? ' ta-on' : ''}`, "data-talk-zone": "edit" },
216
+ React.createElement("span", { className: "ta-talk-zone-label" }, t('ta.talk.edit')),
217
+ React.createElement("span", { className: "ta-talk-zone-circle" },
218
+ React.createElement(Icon, { icon: PenLine, size: 24 })))),
219
+ React.createElement("div", { className: "ta-talk-base" },
220
+ React.createElement("span", { className: "ta-talk-hint" }, hint))), document.body);
221
+ }
222
+ //# sourceMappingURL=voice-talk.js.map
@@ -4,7 +4,7 @@ import { Scanner } from '../device/scanner.js';
4
4
  import { usePwa, useSettings } from '../hooks.js';
5
5
  import { useT } from '../i18n/use-t.js';
6
6
  import { STYLE } from '../style.js';
7
- import { WorkbenchUtil } from '../workbench.js';
7
+ import { WorkbenchUtil } from '../workbench-util.js';
8
8
  import { dinoFavicon } from './dino.js';
9
9
  import { AddHostPanel } from './host-view.js';
10
10
  import { SignInAccounts, useSignInWays } from './sign-in-accounts.js';
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { type DeviceLayout, type DeviceState } from './device-protocol.js';
3
3
  import { type NewLineBridge } from './new-line.js';
4
+ import { type ShakeUndoBridge } from './shake-undo.js';
4
5
  /** What the observer reads of the browser; tests give their own. */
5
6
  export interface DeviceEnvironment {
6
7
  matchMedia(query: string): {
@@ -33,6 +34,8 @@ export interface DeviceEnvironment {
33
34
  readonly keyboard?: (listener: (height: number) => void) => void;
34
35
  /** The edit menu of the app on iOS, which offers New Line in the message box (new-line.ts); none elsewhere. */
35
36
  readonly newLine?: NewLineBridge;
37
+ /** Shake to Undo of the app on iOS, offered only while a field has text (shake-undo.ts); none elsewhere. */
38
+ readonly shakeUndo?: ShakeUndoBridge;
36
39
  }
37
40
  export declare namespace DeviceUtil {
38
41
  /** Where the page is not in a browser (tests, the server). */
@@ -3,6 +3,7 @@ import { DeviceMedia, DeviceMotion } from './device-protocol.js';
3
3
  import { startFieldDismiss } from './field-dismiss.js';
4
4
  import { startLongPress } from './long-press.js';
5
5
  import { startNewLine } from './new-line.js';
6
+ import { startShakeUndo } from './shake-undo.js';
6
7
  /** How much of the height the keyboard has to take before it counts as open: more than the bars of a browser. */
7
8
  const KEYBOARD_PX = 80;
8
9
  export var DeviceUtil;
@@ -95,6 +96,9 @@ export class DeviceObserver {
95
96
  if (env.newLine) {
96
97
  startNewLine(env.document, env.newLine);
97
98
  }
99
+ if (env.shakeUndo) {
100
+ startShakeUndo(env.document, env.shakeUndo);
101
+ }
98
102
  }
99
103
  if (env.keyboard) {
100
104
  env.keyboard(height => this.moveKeyboard(height));
@@ -194,9 +198,15 @@ function browser() {
194
198
  root: document.documentElement,
195
199
  native: nativeBridge(),
196
200
  keyboard: nativeKeyboard(),
197
- newLine: (_b = (_a = window.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taEditing,
201
+ newLine: (_a = messageHandlers()) === null || _a === void 0 ? void 0 : _a.taEditing,
202
+ shakeUndo: (_b = messageHandlers()) === null || _b === void 0 ? void 0 : _b.taUndo,
198
203
  };
199
204
  }
205
+ /** What the Ta app on iOS listens to from the page (TaBridgeViewController of apps/ta-mobile); none elsewhere. */
206
+ function messageHandlers() {
207
+ var _a;
208
+ return (_a = window.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers;
209
+ }
200
210
  /** One plugin of the Ta app (Capacitor), when the app has it; none in a browser, or in an app built before it. */
201
211
  export function nativePlugin(name) {
202
212
  var _a;
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * What a held finger does, as the talk button of a phone's chat: it starts once the finger has been kept still
4
+ * for PRESS_MS, follows the finger while it stays, and ends when it lets go.
5
+ */
6
+ export interface Hold {
7
+ /** Whether a press is the hold's (a field, a button of its own are not); every press is, without it. */
8
+ accepts?(event: React.PointerEvent): boolean;
9
+ start(): void;
10
+ /** Where the finger is while it is held, in the coordinates of the page. */
11
+ move?(x: number, y: number): void;
12
+ /** The finger let go. */
13
+ end(): void;
14
+ /** The system took the finger (a gesture of its own, a call): nothing is given. */
15
+ cancel(): void;
16
+ }
17
+ /**
18
+ * What an element takes of the pointer, for the hold it has. `data-held` takes the panning of a finger from the
19
+ * browser (style/device.ts): it decides that as the finger lands, too early for a hold, and a pan it began takes
20
+ * the finger from the page (pointercancel) as soon as it slides toward 取消.
21
+ */
22
+ export interface HeldProps {
23
+ onPointerDown?(event: React.PointerEvent): void;
24
+ onContextMenu?(event: React.MouseEvent): void;
25
+ 'data-held'?: '';
26
+ }
27
+ /**
28
+ * Something done while an element is held. A press that moves first scrolls, and one let go before PRESS_MS
29
+ * starts nothing, so that a tap stays a tap. Once held, the finger is the hold's until it lets go: the page does
30
+ * not scroll under it, the system's menu and selection do not come, the click of the finger let go is not a tap
31
+ * of what was under it, and the hold outlives the element (a tab bar that a page slides over).
32
+ */
33
+ export declare function useHeld(): (hold: Hold | undefined) => HeldProps;
34
+ export declare namespace HeldUtil {
35
+ /** A light tap of the haptic engine as a held finger comes onto something (取消, 编辑): the app's, or a phone's. */
36
+ function tick(): void;
37
+ /**
38
+ * The click that follows a finger let go after a hold: not a tap of what was under it. A browser that sends
39
+ * none (a long press is no tap to it) leaves the next press its own.
40
+ */
41
+ function swallowClick(): void;
42
+ }
@@ -0,0 +1,136 @@
1
+ import * as React from 'react';
2
+ import { nativePlugin } from './device.js';
3
+ import { LongPressUtil } from './long-press.js';
4
+ /**
5
+ * Something done while an element is held. A press that moves first scrolls, and one let go before PRESS_MS
6
+ * starts nothing, so that a tap stays a tap. Once held, the finger is the hold's until it lets go: the page does
7
+ * not scroll under it, the system's menu and selection do not come, the click of the finger let go is not a tap
8
+ * of what was under it, and the hold outlives the element (a tab bar that a page slides over).
9
+ */
10
+ export function useHeld() {
11
+ const current = React.useRef(undefined);
12
+ // Gone before it held, the press is nothing; once held, it ends when the finger lets go.
13
+ React.useEffect(() => () => {
14
+ const press = current.current;
15
+ if (press && !press.held) {
16
+ clearTimeout(press.timer);
17
+ press.off();
18
+ current.current = undefined;
19
+ }
20
+ }, []);
21
+ return React.useCallback((hold) => {
22
+ if (!hold) {
23
+ return {};
24
+ }
25
+ return {
26
+ 'data-held': '',
27
+ onPointerDown: event => {
28
+ if (current.current || !event.isPrimary || event.button !== 0 || (hold.accepts && !hold.accepts(event))) {
29
+ return;
30
+ }
31
+ const from = { x: event.clientX, y: event.clientY };
32
+ const finish = (how) => {
33
+ if (current.current !== press) {
34
+ return;
35
+ }
36
+ current.current = undefined;
37
+ clearTimeout(press.timer);
38
+ press.off();
39
+ if (!press.held || how === 'none') {
40
+ return;
41
+ }
42
+ HeldUtil.swallowClick();
43
+ if (how === 'end') {
44
+ hold.end();
45
+ }
46
+ else {
47
+ hold.cancel();
48
+ }
49
+ };
50
+ const onUp = () => finish('end');
51
+ const onCancel = () => finish('cancel');
52
+ const onMove = (moved) => {
53
+ var _a;
54
+ if (press.held) {
55
+ (_a = hold.move) === null || _a === void 0 ? void 0 : _a.call(hold, moved.clientX, moved.clientY);
56
+ }
57
+ else if (LongPressUtil.moved(from, moved)) {
58
+ finish('none');
59
+ }
60
+ };
61
+ // Held, the finger drags nothing: no scroll, which would take it from the hold (pointercancel).
62
+ const onTouchMove = (touch) => press.held && touch.cancelable && touch.preventDefault();
63
+ const onSelect = (select) => press.held && select.preventDefault();
64
+ const press = {
65
+ hold,
66
+ held: false,
67
+ timer: setTimeout(() => {
68
+ var _a, _b;
69
+ press.held = true;
70
+ (_a = document.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
71
+ hold.start();
72
+ (_b = hold.move) === null || _b === void 0 ? void 0 : _b.call(hold, from.x, from.y);
73
+ }, LongPressUtil.PRESS_MS),
74
+ off: () => {
75
+ document.removeEventListener('pointerup', onUp);
76
+ document.removeEventListener('pointercancel', onCancel);
77
+ document.removeEventListener('pointermove', onMove);
78
+ document.removeEventListener('touchmove', onTouchMove);
79
+ document.removeEventListener('selectstart', onSelect, true);
80
+ },
81
+ };
82
+ current.current = press;
83
+ document.addEventListener('pointerup', onUp);
84
+ document.addEventListener('pointercancel', onCancel);
85
+ document.addEventListener('pointermove', onMove);
86
+ document.addEventListener('touchmove', onTouchMove, { passive: false });
87
+ document.addEventListener('selectstart', onSelect, true);
88
+ },
89
+ // The long press of a finger (the system's, or startLongPress's) is the hold's: no menu. Taken, it is
90
+ // also what gives the light tap of the haptic engine in the app. A right click is the browser's.
91
+ onContextMenu: event => {
92
+ if (current.current) {
93
+ event.preventDefault();
94
+ }
95
+ },
96
+ };
97
+ }, []);
98
+ }
99
+ export var HeldUtil;
100
+ (function (HeldUtil) {
101
+ /** A light tap of the haptic engine as a held finger comes onto something (取消, 编辑): the app's, or a phone's. */
102
+ function tick() {
103
+ var _a, _b;
104
+ const haptics = nativePlugin('Haptics');
105
+ if (haptics) {
106
+ haptics('impact', { style: 'LIGHT' }).catch(() => undefined);
107
+ }
108
+ else {
109
+ (_b = (_a = globalThis.navigator) === null || _a === void 0 ? void 0 : _a.vibrate) === null || _b === void 0 ? void 0 : _b.call(_a, 8);
110
+ }
111
+ }
112
+ HeldUtil.tick = tick;
113
+ /**
114
+ * The click that follows a finger let go after a hold: not a tap of what was under it. A browser that sends
115
+ * none (a long press is no tap to it) leaves the next press its own.
116
+ */
117
+ function swallowClick() {
118
+ const until = Date.now() + LongPressUtil.CLICK_GUARD_MS;
119
+ const off = () => {
120
+ document.removeEventListener('click', swallow, true);
121
+ document.removeEventListener('pointerdown', off, true);
122
+ };
123
+ const swallow = (event) => {
124
+ off();
125
+ if (Date.now() < until) {
126
+ event.preventDefault();
127
+ event.stopPropagation();
128
+ }
129
+ };
130
+ document.addEventListener('click', swallow, true);
131
+ document.addEventListener('pointerdown', off, true);
132
+ setTimeout(off, LongPressUtil.CLICK_GUARD_MS);
133
+ }
134
+ HeldUtil.swallowClick = swallowClick;
135
+ })(HeldUtil || (HeldUtil = {}));
136
+ //# sourceMappingURL=hold.js.map
@@ -17,7 +17,7 @@ export interface LaunchEnvironment {
17
17
  */
18
18
  export declare class LaunchScreen {
19
19
  protected readonly env: LaunchEnvironment;
20
- static readonly MAX = 3000;
20
+ static readonly MAX = 2000;
21
21
  static readonly FADE = 320;
22
22
  protected done: boolean;
23
23
  protected stops: (() => void)[];
@@ -43,7 +43,7 @@ export class LaunchScreen {
43
43
  this.env.later(() => element.remove(), LaunchScreen.FADE);
44
44
  }
45
45
  }
46
- LaunchScreen.MAX = 3000;
46
+ LaunchScreen.MAX = 2000;
47
47
  LaunchScreen.FADE = 320;
48
48
  export var LaunchScreenUtil;
49
49
  (function (LaunchScreenUtil) {
@@ -11,6 +11,8 @@ export declare namespace LongPressUtil {
11
11
  const MOVE_PX = 10;
12
12
  /** After a menu opened, the click of the finger let go is not a tap of what was under it. */
13
13
  const CLICK_GUARD_MS = 800;
14
+ /** What the finger of a long press that opened a menu pressed, while it is still down. */
15
+ function held(): Element | undefined;
14
16
  function moved(from: {
15
17
  x: number;
16
18
  y: number;
@@ -1,3 +1,5 @@
1
+ /** What a long press that opened a menu pressed, while the finger is still down: it may slide onto an entry (ContextMenuUtil.attach). */
2
+ let holding;
1
3
  /**
2
4
  * A long press as the right click of a finger: what a right click opens (the menus of tabs, files, chats,
3
5
  * messages) opens under a held finger too, as in the apps of a phone. iOS fires no `contextmenu` on a long
@@ -11,6 +13,11 @@ export var LongPressUtil;
11
13
  LongPressUtil.MOVE_PX = 10;
12
14
  /** After a menu opened, the click of the finger let go is not a tap of what was under it. */
13
15
  LongPressUtil.CLICK_GUARD_MS = 800;
16
+ /** What the finger of a long press that opened a menu pressed, while it is still down. */
17
+ function held() {
18
+ return holding;
19
+ }
20
+ LongPressUtil.held = held;
14
21
  function moved(from, to) {
15
22
  return Math.hypot(to.x - from.x, to.y - from.y) > LongPressUtil.MOVE_PX;
16
23
  }
@@ -37,6 +44,7 @@ export function startLongPress(doc, native) {
37
44
  const end = () => {
38
45
  var _a;
39
46
  cancel();
47
+ holding = undefined;
40
48
  if (taken) {
41
49
  taken = false;
42
50
  (_a = doc.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
@@ -61,6 +69,8 @@ export function startLongPress(doc, native) {
61
69
  return;
62
70
  }
63
71
  sent = true;
72
+ // Before the menu renders, which may be before dispatchEvent returns.
73
+ holding = current.target;
64
74
  const event = new MouseEvent('contextmenu', { bubbles: true, cancelable: true, composed: true, clientX: current.x, clientY: current.y, button: 2 });
65
75
  current.target.dispatchEvent(event);
66
76
  if (event.defaultPrevented) {
@@ -70,11 +80,15 @@ export function startLongPress(doc, native) {
70
80
  (_a = doc.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
71
81
  native === null || native === void 0 ? void 0 : native('Haptics', 'impact', { style: 'LIGHT' }).catch(() => undefined);
72
82
  }
83
+ else {
84
+ holding = undefined;
85
+ }
73
86
  };
74
87
  const onStart = (event) => {
75
88
  cancel();
76
89
  sent = false;
77
90
  taken = false;
91
+ holding = undefined;
78
92
  const touch = event.touches[0];
79
93
  const target = event.target instanceof Element ? event.target : null;
80
94
  if (event.touches.length !== 1 || !touch || !target || LongPressUtil.native(target)) {
@@ -103,7 +117,8 @@ export function startLongPress(doc, native) {
103
117
  }
104
118
  };
105
119
  const onClick = (event) => {
106
- if (Date.now() < guardUntil) {
120
+ // The click of the finger let go; not an entry the finger slid onto, which the menu clicks.
121
+ if (event.isTrusted && Date.now() < guardUntil) {
107
122
  guardUntil = 0;
108
123
  event.preventDefault();
109
124
  event.stopImmediatePropagation();
@@ -40,7 +40,9 @@ export interface PullDownOptions {
40
40
  }
41
41
  /**
42
42
  * Lets a finger pull the launcher down over the first tab while `enabled`. As useSheetSwipe: transforms and
43
- * opacities only, and the listener that may hold a move back is there only for a touch that may be a pull. A
44
- * pull down is decided on the first move (iOS lets a scroll that started go on), only at the top of the list.
43
+ * opacities only, the listener that may hold a move back there only for a touch that may be a pull, the finger
44
+ * followed on what it touched (SwipeFinger), and let go it slides on at once as on a spring (SwipeSettle), the
45
+ * state following. A pull down is decided on the first move (iOS lets a scroll that started go on), only at
46
+ * the top of the list.
45
47
  */
46
48
  export declare function usePullDown(options: PullDownOptions): void;