@celljs/ta-web 4.49.0 → 4.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/account/account-side.js +4 -0
  4. package/esm/browser/account/device-account.d.ts +6 -0
  5. package/esm/browser/account/device-account.js +20 -5
  6. package/esm/browser/assistant/assistant-view.js +2 -0
  7. package/esm/browser/assistant/call-announcing.d.ts +25 -0
  8. package/esm/browser/assistant/call-announcing.js +32 -0
  9. package/esm/browser/assistant/call-answering.d.ts +43 -0
  10. package/esm/browser/assistant/call-answering.js +63 -0
  11. package/esm/browser/assistant/call-hearing.d.ts +53 -0
  12. package/esm/browser/assistant/call-hearing.js +98 -0
  13. package/esm/browser/assistant/call-pausing.d.ts +40 -0
  14. package/esm/browser/assistant/call-pausing.js +82 -0
  15. package/esm/browser/assistant/call-reading.d.ts +32 -0
  16. package/esm/browser/assistant/call-reading.js +35 -0
  17. package/esm/browser/assistant/call-revoicing.d.ts +33 -0
  18. package/esm/browser/assistant/call-revoicing.js +68 -0
  19. package/esm/browser/assistant/call-turns.d.ts +29 -0
  20. package/esm/browser/assistant/call-turns.js +33 -0
  21. package/esm/browser/assistant/spoken-answer.d.ts +21 -0
  22. package/esm/browser/assistant/spoken-answer.js +69 -0
  23. package/esm/browser/assistant/spoken-call.d.ts +7 -0
  24. package/esm/browser/assistant/spoken-call.js +16 -0
  25. package/esm/browser/assistant/voice-call-protocol.d.ts +5 -0
  26. package/esm/browser/assistant/voice-call.d.ts +47 -43
  27. package/esm/browser/assistant/voice-call.js +193 -219
  28. package/esm/browser/chat/chat-view.js +2 -1
  29. package/esm/browser/components/account-recovery-view.d.ts +11 -0
  30. package/esm/browser/components/account-recovery-view.js +81 -0
  31. package/esm/browser/components/account-view.d.ts +1 -2
  32. package/esm/browser/components/account-view.js +10 -1
  33. package/esm/browser/components/app-nav.js +19 -8
  34. package/esm/browser/components/app-shell-hooks.d.ts +5 -0
  35. package/esm/browser/components/app-shell-hooks.js +45 -0
  36. package/esm/browser/components/app-shell-state.js +2 -1
  37. package/esm/browser/components/app-view.js +9 -5
  38. package/esm/browser/components/chat-emoji.d.ts +35 -0
  39. package/esm/browser/components/chat-emoji.js +129 -0
  40. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  41. package/esm/browser/components/composer-attachments.d.ts +6 -0
  42. package/esm/browser/components/composer-attachments.js +12 -1
  43. package/esm/browser/components/composer-box-protocol.d.ts +15 -0
  44. package/esm/browser/components/composer-box.js +110 -87
  45. package/esm/browser/components/composer-drop-hooks.d.ts +26 -0
  46. package/esm/browser/components/composer-drop-hooks.js +36 -0
  47. package/esm/browser/components/composer-emoji.js +1 -1
  48. package/esm/browser/components/composer-faces.d.ts +16 -0
  49. package/esm/browser/components/composer-faces.js +37 -0
  50. package/esm/browser/components/composer-media.d.ts +10 -0
  51. package/esm/browser/components/composer-media.js +12 -1
  52. package/esm/browser/components/composer-target.d.ts +4 -0
  53. package/esm/browser/components/composer-target.js +18 -7
  54. package/esm/browser/components/composer-type-focus.d.ts +24 -0
  55. package/esm/browser/components/composer-type-focus.js +17 -0
  56. package/esm/browser/components/composer-voice.d.ts +24 -0
  57. package/esm/browser/components/composer-voice.js +37 -0
  58. package/esm/browser/components/composer.d.ts +2 -2
  59. package/esm/browser/components/composer.js +39 -8
  60. package/esm/browser/components/context-menu.js +2 -1
  61. package/esm/browser/components/emoji-panel.d.ts +11 -7
  62. package/esm/browser/components/emoji-panel.js +40 -22
  63. package/esm/browser/components/extension-settings.js +2 -2
  64. package/esm/browser/components/folder-new.d.ts +18 -0
  65. package/esm/browser/components/folder-new.js +53 -0
  66. package/esm/browser/components/folder-picker.d.ts +5 -2
  67. package/esm/browser/components/folder-picker.js +18 -6
  68. package/esm/browser/components/host-view.d.ts +1 -1
  69. package/esm/browser/components/image-menu.d.ts +8 -3
  70. package/esm/browser/components/image-menu.js +34 -9
  71. package/esm/browser/components/markdown.js +9 -2
  72. package/esm/browser/components/media.js +3 -2
  73. package/esm/browser/components/message-list.js +2 -2
  74. package/esm/browser/components/message-steps.js +20 -11
  75. package/esm/browser/components/message-user.js +2 -2
  76. package/esm/browser/components/moved-notice.js +2 -1
  77. package/esm/browser/components/nav-places.d.ts +2 -0
  78. package/esm/browser/components/nav-places.js +4 -2
  79. package/esm/browser/components/phone-shell.d.ts +2 -0
  80. package/esm/browser/components/phone-shell.js +5 -1
  81. package/esm/browser/components/secret-text.d.ts +1 -1
  82. package/esm/browser/components/secret-text.js +4 -3
  83. package/esm/browser/components/session-view.js +3 -0
  84. package/esm/browser/components/settings-choices.d.ts +2 -1
  85. package/esm/browser/components/settings-choices.js +13 -5
  86. package/esm/browser/components/settings-more.js +3 -3
  87. package/esm/browser/components/settings-parts.js +13 -2
  88. package/esm/browser/components/share-item-sheet.js +7 -1
  89. package/esm/browser/components/tab-title.d.ts +27 -0
  90. package/esm/browser/components/tab-title.js +35 -0
  91. package/esm/browser/components/use-composer-attachments.d.ts +28 -0
  92. package/esm/browser/components/use-composer-attachments.js +65 -0
  93. package/esm/browser/components/use-composer-files.d.ts +25 -0
  94. package/esm/browser/components/use-composer-files.js +52 -0
  95. package/esm/browser/components/web-composer.d.ts +3 -1
  96. package/esm/browser/components/web-composer.js +3 -2
  97. package/esm/browser/components/workbench-view.js +1 -0
  98. package/esm/browser/components/working-directory.js +2 -1
  99. package/esm/browser/device/drag-move.d.ts +21 -0
  100. package/esm/browser/device/drag-move.js +86 -0
  101. package/esm/browser/extension/icons.js +7 -1
  102. package/esm/browser/extension/web-api-desktop.d.ts +19 -0
  103. package/esm/browser/extension/web-api-menus.d.ts +19 -0
  104. package/esm/browser/extension/web-api-spec.js +2 -0
  105. package/esm/browser/extension/web-extension-api.d.ts +24 -23
  106. package/esm/browser/extension/web-extension-context.d.ts +1 -0
  107. package/esm/browser/extension/web-extension-context.js +12 -5
  108. package/esm/browser/extension/web-extension-run.js +1 -0
  109. package/esm/browser/extension/web-share-ui.d.ts +1 -1
  110. package/esm/browser/extension/web-share-ui.js +2 -0
  111. package/esm/browser/extension/web-share.d.ts +13 -0
  112. package/esm/browser/extension/web-share.js +37 -2
  113. package/esm/browser/i18n/en/account.d.ts +18 -0
  114. package/esm/browser/i18n/en/account.js +18 -0
  115. package/esm/browser/i18n/en/call.js +1 -1
  116. package/esm/browser/i18n/en/chat.d.ts +15 -0
  117. package/esm/browser/i18n/en/chat.js +16 -1
  118. package/esm/browser/i18n/en/common.d.ts +2 -0
  119. package/esm/browser/i18n/en/common.js +2 -0
  120. package/esm/browser/i18n/en/discover.d.ts +2 -0
  121. package/esm/browser/i18n/en/discover.js +2 -0
  122. package/esm/browser/i18n/en/settings.d.ts +17 -0
  123. package/esm/browser/i18n/en/settings.js +17 -0
  124. package/esm/browser/i18n/ja/account.js +18 -0
  125. package/esm/browser/i18n/ja/call.js +1 -1
  126. package/esm/browser/i18n/ja/chat.js +16 -1
  127. package/esm/browser/i18n/ja/common.js +2 -0
  128. package/esm/browser/i18n/ja/discover.js +3 -1
  129. package/esm/browser/i18n/ja/settings.js +17 -0
  130. package/esm/browser/i18n/locales.d.ts +55 -1
  131. package/esm/browser/i18n/messages.d.ts +54 -0
  132. package/esm/browser/i18n/zh/account.js +18 -0
  133. package/esm/browser/i18n/zh/call.js +1 -1
  134. package/esm/browser/i18n/zh/chat.js +16 -1
  135. package/esm/browser/i18n/zh/common.js +2 -0
  136. package/esm/browser/i18n/zh/discover.js +3 -1
  137. package/esm/browser/i18n/zh/settings.js +17 -0
  138. package/esm/browser/i18n/zh-tw/account.js +18 -0
  139. package/esm/browser/i18n/zh-tw/call.js +1 -1
  140. package/esm/browser/i18n/zh-tw/chat.js +16 -1
  141. package/esm/browser/i18n/zh-tw/common.js +2 -0
  142. package/esm/browser/i18n/zh-tw/discover.js +3 -1
  143. package/esm/browser/i18n/zh-tw/settings.js +17 -0
  144. package/esm/browser/offline/kept-chats.d.ts +3 -1
  145. package/esm/browser/offline/kept-chats.js +1 -1
  146. package/esm/browser/partners/group-picker.d.ts +3 -2
  147. package/esm/browser/partners/group-picker.js +8 -3
  148. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  149. package/esm/browser/sandbox/work/work-docs.js +5 -2
  150. package/esm/browser/sandbox/work/work-frame.d.ts +3 -0
  151. package/esm/browser/sandbox/work/work-frame.js +9 -3
  152. package/esm/browser/sandbox/work/work-gates.d.ts +77 -0
  153. package/esm/browser/sandbox/work/work-gates.js +182 -0
  154. package/esm/browser/settings/agent-settings.js +1 -1
  155. package/esm/browser/settings/navigation.d.ts +38 -10
  156. package/esm/browser/settings/navigation.js +73 -17
  157. package/esm/browser/settings/settings-protocol.d.ts +16 -1
  158. package/esm/browser/settings/settings-protocol.js +20 -2
  159. package/esm/browser/settings/settings.js +4 -1
  160. package/esm/browser/style/base.d.ts +1 -1
  161. package/esm/browser/style/base.js +15 -2
  162. package/esm/browser/style/chat-list.d.ts +1 -1
  163. package/esm/browser/style/chat-list.js +6 -3
  164. package/esm/browser/style/conversation-column.d.ts +1 -1
  165. package/esm/browser/style/conversation-column.js +28 -8
  166. package/esm/browser/style/conversation.d.ts +1 -1
  167. package/esm/browser/style/conversation.js +5 -0
  168. package/esm/browser/style/device.js +5 -0
  169. package/esm/browser/style/pages.d.ts +1 -1
  170. package/esm/browser/style/pages.js +3 -3
  171. package/esm/browser/style/shell.d.ts +1 -1
  172. package/esm/browser/style/shell.js +13 -6
  173. package/esm/browser/style/tasks.d.ts +1 -1
  174. package/esm/browser/style/tasks.js +4 -2
  175. package/esm/browser/util/chat-emoji.d.ts +44 -0
  176. package/esm/browser/util/chat-emoji.js +269 -0
  177. package/esm/browser/util/composer-drop.d.ts +26 -0
  178. package/esm/browser/util/composer-drop.js +40 -0
  179. package/esm/browser/util/composer-files.d.ts +48 -0
  180. package/esm/browser/util/composer-files.js +99 -0
  181. package/esm/browser/util/composer.d.ts +13 -1
  182. package/esm/browser/util/composer.js +24 -6
  183. package/esm/browser/util/markdown.d.ts +5 -0
  184. package/esm/browser/util/markdown.js +18 -0
  185. package/esm/browser/util/message.d.ts +6 -1
  186. package/esm/browser/util/message.js +13 -2
  187. package/esm/browser/util/process.d.ts +10 -13
  188. package/esm/browser/util/process.js +31 -83
  189. package/esm/browser/util/turn-join.d.ts +38 -0
  190. package/esm/browser/util/turn-join.js +119 -0
  191. package/esm/browser/workbench-services.js +1 -1
  192. package/lib/browser/account/account-side.js +4 -0
  193. package/lib/browser/account/device-account.d.ts +6 -0
  194. package/lib/browser/account/device-account.js +20 -5
  195. package/lib/browser/assistant/assistant-view.js +2 -0
  196. package/lib/browser/assistant/call-announcing.d.ts +26 -0
  197. package/lib/browser/assistant/call-announcing.js +36 -0
  198. package/lib/browser/assistant/call-answering.d.ts +44 -0
  199. package/lib/browser/assistant/call-answering.js +67 -0
  200. package/lib/browser/assistant/call-hearing.d.ts +54 -0
  201. package/lib/browser/assistant/call-hearing.js +102 -0
  202. package/lib/browser/assistant/call-pausing.d.ts +41 -0
  203. package/lib/browser/assistant/call-pausing.js +86 -0
  204. package/lib/browser/assistant/call-reading.d.ts +33 -0
  205. package/lib/browser/assistant/call-reading.js +39 -0
  206. package/lib/browser/assistant/call-revoicing.d.ts +34 -0
  207. package/lib/browser/assistant/call-revoicing.js +72 -0
  208. package/lib/browser/assistant/call-turns.d.ts +30 -0
  209. package/lib/browser/assistant/call-turns.js +37 -0
  210. package/lib/browser/assistant/spoken-answer.d.ts +22 -0
  211. package/lib/browser/assistant/spoken-answer.js +73 -0
  212. package/lib/browser/assistant/spoken-call.d.ts +8 -0
  213. package/lib/browser/assistant/spoken-call.js +19 -0
  214. package/lib/browser/assistant/voice-call-protocol.d.ts +5 -0
  215. package/lib/browser/assistant/voice-call.d.ts +47 -43
  216. package/lib/browser/assistant/voice-call.js +192 -218
  217. package/lib/browser/chat/chat-view.js +2 -1
  218. package/lib/browser/components/account-recovery-view.d.ts +12 -0
  219. package/lib/browser/components/account-recovery-view.js +117 -0
  220. package/lib/browser/components/account-view.d.ts +1 -2
  221. package/lib/browser/components/account-view.js +10 -1
  222. package/lib/browser/components/app-nav.js +19 -8
  223. package/lib/browser/components/app-shell-hooks.d.ts +5 -0
  224. package/lib/browser/components/app-shell-hooks.js +46 -0
  225. package/lib/browser/components/app-shell-state.js +1 -0
  226. package/lib/browser/components/app-view.js +8 -4
  227. package/lib/browser/components/chat-emoji.d.ts +36 -0
  228. package/lib/browser/components/chat-emoji.js +167 -0
  229. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  230. package/lib/browser/components/composer-attachments.d.ts +6 -0
  231. package/lib/browser/components/composer-attachments.js +12 -0
  232. package/lib/browser/components/composer-box-protocol.d.ts +15 -0
  233. package/lib/browser/components/composer-box.js +107 -84
  234. package/lib/browser/components/composer-drop-hooks.d.ts +27 -0
  235. package/lib/browser/components/composer-drop-hooks.js +72 -0
  236. package/lib/browser/components/composer-emoji.js +1 -1
  237. package/lib/browser/components/composer-faces.d.ts +17 -0
  238. package/lib/browser/components/composer-faces.js +73 -0
  239. package/lib/browser/components/composer-media.d.ts +10 -0
  240. package/lib/browser/components/composer-media.js +13 -0
  241. package/lib/browser/components/composer-target.d.ts +4 -0
  242. package/lib/browser/components/composer-target.js +18 -7
  243. package/lib/browser/components/composer-type-focus.d.ts +25 -0
  244. package/lib/browser/components/composer-type-focus.js +20 -0
  245. package/lib/browser/components/composer-voice.d.ts +25 -0
  246. package/lib/browser/components/composer-voice.js +73 -0
  247. package/lib/browser/components/composer.d.ts +2 -2
  248. package/lib/browser/components/composer.js +38 -7
  249. package/lib/browser/components/context-menu.js +2 -1
  250. package/lib/browser/components/emoji-panel.d.ts +11 -7
  251. package/lib/browser/components/emoji-panel.js +40 -22
  252. package/lib/browser/components/extension-settings.js +1 -1
  253. package/lib/browser/components/folder-new.d.ts +19 -0
  254. package/lib/browser/components/folder-new.js +90 -0
  255. package/lib/browser/components/folder-picker.d.ts +5 -2
  256. package/lib/browser/components/folder-picker.js +17 -5
  257. package/lib/browser/components/host-view.d.ts +1 -1
  258. package/lib/browser/components/image-menu.d.ts +8 -3
  259. package/lib/browser/components/image-menu.js +34 -9
  260. package/lib/browser/components/markdown.js +9 -2
  261. package/lib/browser/components/media.js +3 -2
  262. package/lib/browser/components/message-list.js +2 -2
  263. package/lib/browser/components/message-steps.js +20 -11
  264. package/lib/browser/components/message-user.js +1 -1
  265. package/lib/browser/components/moved-notice.js +2 -1
  266. package/lib/browser/components/nav-places.d.ts +2 -0
  267. package/lib/browser/components/nav-places.js +4 -2
  268. package/lib/browser/components/phone-shell.d.ts +2 -0
  269. package/lib/browser/components/phone-shell.js +5 -1
  270. package/lib/browser/components/secret-text.d.ts +1 -1
  271. package/lib/browser/components/secret-text.js +4 -3
  272. package/lib/browser/components/session-view.js +3 -0
  273. package/lib/browser/components/settings-choices.d.ts +2 -1
  274. package/lib/browser/components/settings-choices.js +12 -4
  275. package/lib/browser/components/settings-more.js +2 -2
  276. package/lib/browser/components/settings-parts.js +11 -0
  277. package/lib/browser/components/share-item-sheet.js +7 -1
  278. package/lib/browser/components/tab-title.d.ts +28 -0
  279. package/lib/browser/components/tab-title.js +38 -0
  280. package/lib/browser/components/use-composer-attachments.d.ts +29 -0
  281. package/lib/browser/components/use-composer-attachments.js +101 -0
  282. package/lib/browser/components/use-composer-files.d.ts +26 -0
  283. package/lib/browser/components/use-composer-files.js +88 -0
  284. package/lib/browser/components/web-composer.d.ts +3 -1
  285. package/lib/browser/components/web-composer.js +3 -2
  286. package/lib/browser/components/workbench-view.js +1 -0
  287. package/lib/browser/components/working-directory.js +2 -1
  288. package/lib/browser/device/drag-move.d.ts +22 -0
  289. package/lib/browser/device/drag-move.js +122 -0
  290. package/lib/browser/extension/icons.js +6 -0
  291. package/lib/browser/extension/web-api-desktop.d.ts +19 -0
  292. package/lib/browser/extension/web-api-menus.d.ts +19 -0
  293. package/lib/browser/extension/web-api-spec.js +2 -0
  294. package/lib/browser/extension/web-extension-api.d.ts +24 -23
  295. package/lib/browser/extension/web-extension-context.d.ts +1 -0
  296. package/lib/browser/extension/web-extension-context.js +12 -5
  297. package/lib/browser/extension/web-extension-run.js +1 -0
  298. package/lib/browser/extension/web-share-ui.d.ts +1 -1
  299. package/lib/browser/extension/web-share-ui.js +2 -0
  300. package/lib/browser/extension/web-share.d.ts +13 -0
  301. package/lib/browser/extension/web-share.js +37 -2
  302. package/lib/browser/i18n/en/account.d.ts +18 -0
  303. package/lib/browser/i18n/en/account.js +18 -0
  304. package/lib/browser/i18n/en/call.js +1 -1
  305. package/lib/browser/i18n/en/chat.d.ts +15 -0
  306. package/lib/browser/i18n/en/chat.js +16 -1
  307. package/lib/browser/i18n/en/common.d.ts +2 -0
  308. package/lib/browser/i18n/en/common.js +2 -0
  309. package/lib/browser/i18n/en/discover.d.ts +2 -0
  310. package/lib/browser/i18n/en/discover.js +2 -0
  311. package/lib/browser/i18n/en/settings.d.ts +17 -0
  312. package/lib/browser/i18n/en/settings.js +17 -0
  313. package/lib/browser/i18n/ja/account.js +18 -0
  314. package/lib/browser/i18n/ja/call.js +1 -1
  315. package/lib/browser/i18n/ja/chat.js +16 -1
  316. package/lib/browser/i18n/ja/common.js +2 -0
  317. package/lib/browser/i18n/ja/discover.js +3 -1
  318. package/lib/browser/i18n/ja/settings.js +17 -0
  319. package/lib/browser/i18n/locales.d.ts +55 -1
  320. package/lib/browser/i18n/messages.d.ts +54 -0
  321. package/lib/browser/i18n/zh/account.js +18 -0
  322. package/lib/browser/i18n/zh/call.js +1 -1
  323. package/lib/browser/i18n/zh/chat.js +16 -1
  324. package/lib/browser/i18n/zh/common.js +2 -0
  325. package/lib/browser/i18n/zh/discover.js +3 -1
  326. package/lib/browser/i18n/zh/settings.js +17 -0
  327. package/lib/browser/i18n/zh-tw/account.js +18 -0
  328. package/lib/browser/i18n/zh-tw/call.js +1 -1
  329. package/lib/browser/i18n/zh-tw/chat.js +16 -1
  330. package/lib/browser/i18n/zh-tw/common.js +2 -0
  331. package/lib/browser/i18n/zh-tw/discover.js +3 -1
  332. package/lib/browser/i18n/zh-tw/settings.js +17 -0
  333. package/lib/browser/offline/kept-chats.d.ts +3 -1
  334. package/lib/browser/offline/kept-chats.js +1 -1
  335. package/lib/browser/partners/group-picker.d.ts +3 -2
  336. package/lib/browser/partners/group-picker.js +8 -3
  337. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  338. package/lib/browser/sandbox/work/work-docs.js +5 -2
  339. package/lib/browser/sandbox/work/work-frame.d.ts +3 -0
  340. package/lib/browser/sandbox/work/work-frame.js +9 -3
  341. package/lib/browser/sandbox/work/work-gates.d.ts +78 -0
  342. package/lib/browser/sandbox/work/work-gates.js +185 -0
  343. package/lib/browser/settings/agent-settings.js +1 -1
  344. package/lib/browser/settings/navigation.d.ts +38 -10
  345. package/lib/browser/settings/navigation.js +74 -18
  346. package/lib/browser/settings/settings-protocol.d.ts +16 -1
  347. package/lib/browser/settings/settings-protocol.js +21 -3
  348. package/lib/browser/settings/settings.js +3 -0
  349. package/lib/browser/style/base.d.ts +1 -1
  350. package/lib/browser/style/base.js +15 -2
  351. package/lib/browser/style/chat-list.d.ts +1 -1
  352. package/lib/browser/style/chat-list.js +6 -3
  353. package/lib/browser/style/conversation-column.d.ts +1 -1
  354. package/lib/browser/style/conversation-column.js +28 -8
  355. package/lib/browser/style/conversation.d.ts +1 -1
  356. package/lib/browser/style/conversation.js +5 -0
  357. package/lib/browser/style/device.js +5 -0
  358. package/lib/browser/style/pages.d.ts +1 -1
  359. package/lib/browser/style/pages.js +3 -3
  360. package/lib/browser/style/shell.d.ts +1 -1
  361. package/lib/browser/style/shell.js +13 -6
  362. package/lib/browser/style/tasks.d.ts +1 -1
  363. package/lib/browser/style/tasks.js +4 -2
  364. package/lib/browser/util/chat-emoji.d.ts +45 -0
  365. package/lib/browser/util/chat-emoji.js +272 -0
  366. package/lib/browser/util/composer-drop.d.ts +27 -0
  367. package/lib/browser/util/composer-drop.js +43 -0
  368. package/lib/browser/util/composer-files.d.ts +49 -0
  369. package/lib/browser/util/composer-files.js +102 -0
  370. package/lib/browser/util/composer.d.ts +13 -1
  371. package/lib/browser/util/composer.js +24 -6
  372. package/lib/browser/util/markdown.d.ts +5 -0
  373. package/lib/browser/util/markdown.js +18 -0
  374. package/lib/browser/util/message.d.ts +6 -1
  375. package/lib/browser/util/message.js +13 -2
  376. package/lib/browser/util/process.d.ts +10 -13
  377. package/lib/browser/util/process.js +32 -84
  378. package/lib/browser/util/turn-join.d.ts +39 -0
  379. package/lib/browser/util/turn-join.js +122 -0
  380. package/lib/browser/workbench-services.js +1 -1
  381. package/package.json +7 -7
  382. package/public/emoji/wechat-v1.webp +0 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Typing anywhere but in a field goes into the message box in front, as the composer of a desktop assistant does:
3
+ * a letter pressed while reading the conversation starts writing, the keyboard's focus going with it.
4
+ *
5
+ * Not when the field (or anything typed in) has the focus, nor under a dialog or a menu opened over the page: those
6
+ * take the keys first. Not a space (it scrolls the page), nor a key of a shortcut, nor what an input method composes.
7
+ */
8
+ export interface TypeFocusInput {
9
+ key: string;
10
+ ctrlKey?: boolean;
11
+ metaKey?: boolean;
12
+ altKey?: boolean;
13
+ isComposing?: boolean;
14
+ defaultPrevented?: boolean;
15
+ /** What holds the focus: a field, an editor, a terminal, a page that draws its own keys. */
16
+ editable: boolean;
17
+ /** A dialog, a menu or a panel opened over the page (its own aria-modal, a popover, the + menu of the box). */
18
+ overlain: boolean;
19
+ /** The box is on the screen now. */
20
+ shown: boolean;
21
+ }
22
+ export declare namespace TypeFocus {
23
+ function takes(input: TypeFocusInput): boolean;
24
+ }
@@ -0,0 +1,17 @@
1
+ export var TypeFocus;
2
+ (function (TypeFocus) {
3
+ function takes(input) {
4
+ return (!input.editable &&
5
+ !input.overlain &&
6
+ input.shown &&
7
+ !input.ctrlKey &&
8
+ !input.metaKey &&
9
+ !input.altKey &&
10
+ !input.isComposing &&
11
+ !input.defaultPrevented &&
12
+ [...input.key].length === 1 &&
13
+ input.key !== ' ');
14
+ }
15
+ TypeFocus.takes = takes;
16
+ })(TypeFocus || (TypeFocus = {}));
17
+ //# sourceMappingURL=composer-type-focus.js.map
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The microphone of the box, as WeChat's: on a touch screen it turns the field into a bar held to talk (or, in a mini
4
+ * program, dictates); elsewhere it listens while pressed. What is heard goes where the caret was when listening began,
5
+ * between what was typed. Without a recognizer there is none.
6
+ */
7
+ export declare function useMicrophone({ touch, talkMode, hints, voiceSends, said, onHear, onInsert, onListening, onTalkKey, onError, }: {
8
+ touch: boolean;
9
+ talkMode: boolean;
10
+ hints: string[];
11
+ voiceSends: boolean;
12
+ /** The text of the box, and the caret in it, as the listening begins. */
13
+ said: () => {
14
+ text: string;
15
+ caret: number;
16
+ };
17
+ /** What is heard: the words among the text, and where the caret goes after them. Sent when the box sends by voice. */
18
+ onHear: (words: string, caret: number) => void;
19
+ /** Words said with nothing heard yet, put after the text as it stands: the caret after them. */
20
+ onInsert: (words: string) => void;
21
+ onListening: (on: boolean) => void;
22
+ onTalkKey: (on: boolean) => void;
23
+ onError: (error: unknown) => void;
24
+ }): React.JSX.Element | null;
@@ -0,0 +1,37 @@
1
+ import { Keyboard, Mic } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { MiniProgram } from '../device/mini-program.js';
4
+ import { useT } from '../i18n/use-t.js';
5
+ import { Voice } from '../util/voice.js';
6
+ import { Icon } from './icon.js';
7
+ import { DictateButton, VoiceButton } from './voice-button.js';
8
+ /**
9
+ * The microphone of the box, as WeChat's: on a touch screen it turns the field into a bar held to talk (or, in a mini
10
+ * program, dictates); elsewhere it listens while pressed. What is heard goes where the caret was when listening began,
11
+ * between what was typed. Without a recognizer there is none.
12
+ */
13
+ export function useMicrophone({ touch, talkMode, hints, voiceSends, said, onHear, onInsert, onListening, onTalkKey, onError, }) {
14
+ const t = useT();
15
+ // Speech goes where the caret was when listening began, between what was typed.
16
+ const spoken = React.useRef({ before: '', after: '' });
17
+ const listen = (on) => {
18
+ if (on) {
19
+ const { text, caret } = said();
20
+ spoken.current = { before: text.slice(0, caret), after: text.slice(caret) };
21
+ }
22
+ onListening(on);
23
+ };
24
+ if (MiniProgram.canDictate()) {
25
+ return React.createElement(DictateButton, { onHeard: onInsert });
26
+ }
27
+ if (!Voice.canListen()) {
28
+ return null;
29
+ }
30
+ return touch ? (React.createElement("button", { type: "button", className: "ta-mic", title: t(talkMode ? 'ta.composer.keyboard' : 'ta.composer.voice'), "aria-label": t(talkMode ? 'ta.composer.keyboard' : 'ta.composer.voice'), "aria-pressed": talkMode, onClick: () => onTalkKey(!talkMode) },
31
+ React.createElement(Icon, { icon: talkMode ? Keyboard : Mic, size: 18 }))) : (React.createElement(VoiceButton, { hints: hints, onListening: listen, onText: words => onHear(`${spoken.current.before}${words}${spoken.current.after}`, spoken.current.before.length + words.length), onHeard: words => {
32
+ const text = `${spoken.current.before}${words}${spoken.current.after}`;
33
+ const caret = spoken.current.before.length + words.length;
34
+ onHear(voiceSends ? text.trim() : text, voiceSends ? 0 : caret);
35
+ }, onError: onError }));
36
+ }
37
+ //# sourceMappingURL=composer-voice.js.map
@@ -28,8 +28,8 @@ export interface ComposerProps {
28
28
  talkCalls?: ComposerBoxProps['talkCalls'];
29
29
  onListening?(listening: boolean): void;
30
30
  server: TaServer;
31
- /** Where `@` looks for files. */
32
- workspace: Pick<TaWorkspaceServer, 'findFiles'>;
31
+ /** Where `@` looks for files, and where the files dropped in the box are uploaded (`uploads/` of `cwd`). */
32
+ workspace: Pick<TaWorkspaceServer, 'findFiles' | 'uploadFile' | 'listDirectory'>;
33
33
  working: boolean;
34
34
  /** ComposerBoxProps.compacting: the stop of the box stops compacting the conversation too. */
35
35
  compacting?: boolean;
@@ -1,11 +1,12 @@
1
1
  import { TA_OWNER, TaMessageAuthor } from '@celljs/ta-protocol';
2
- import { ArrowUp, Clock3, CornerDownRight, PenLine, Settings2, X } from 'lucide-react';
2
+ import { ArrowUp, Clock3, CornerDownRight, Image as ImageIcon, PenLine, Settings2, X } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { AssistantTaskUtil } from '../assistant/assistant-task-util.js';
5
5
  import { useDevice } from '../device/device.js';
6
6
  import { useLanguage, useT } from '../i18n/use-t.js';
7
7
  import { ShortcutUtil } from '../settings/agent-settings.js';
8
8
  import { ComposerUtil } from '../util/composer.js';
9
+ import { ComposerDropUtil } from '../util/composer-drop.js';
9
10
  import { MessageUtil } from '../util/message.js';
10
11
  import { ComposerBox } from './composer-box.js';
11
12
  import { Face } from './face.js';
@@ -28,6 +29,12 @@ const said = (texts) => texts.filter(text => !AssistantTaskUtil.noteOf(text)).ma
28
29
  /** A waiting message as the user sees it in the conversation: without its context, the package it came from apart. */
29
30
  const blocksOf = (text) => [{ type: 'text', text }];
30
31
  const words = (text) => userWords(blocksOf(text));
32
+ /** Whether a message of the conversation is the one last sent from this page: by its words, or, sent without any, by its images. */
33
+ const sentAs = (message, sent) => {
34
+ const blocks = MessageUtil.blocks(message);
35
+ const { text } = userWords(blocks);
36
+ return sent ? text.includes(sent) : blocks.some(block => block.type === 'image');
37
+ };
31
38
  /** The files for an `@` being typed; a server without file search answers with an error, and the menu says so. */
32
39
  function useFiles(workspace, cwd, query) {
33
40
  const t = useT();
@@ -106,6 +113,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
106
113
  const keyNames = React.useMemo(() => ComposerUtil.keyNames(ShortcutUtil.isMac()), []);
107
114
  const [query, setQuery] = React.useState();
108
115
  const files = useFiles(workspace, cwd, query);
116
+ const uploads = React.useMemo(() => ({ workspace }), [workspace]);
109
117
  const [argumentQuery, setArgumentQuery] = React.useState();
110
118
  const argumentItems = useArgumentCompletions(server, store === null || store === void 0 ? void 0 : store.sessionId, argumentQuery);
111
119
  const box = React.useRef(null);
@@ -139,7 +147,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
139
147
  // Stopped before anything came of it, with nothing typed since: the message sent from this page comes back
140
148
  // into the box. Not one of a scheduled task, a group or another device: only what was last sent here.
141
149
  const last = ((_a = box.current) === null || _a === void 0 ? void 0 : _a.text().trim()) ? undefined : MessageUtil.unanswered(store.state.messages);
142
- const unanswered = last && lastSent && userWords(MessageUtil.blocks(last)).text.includes(lastSent) ? last : undefined;
150
+ const unanswered = last && lastSent !== undefined && sentAs(last, lastSent) ? last : undefined;
143
151
  const waited = ComposerUtil.queued(queue).length > 0;
144
152
  return server.abort(store.sessionId).then(async () => {
145
153
  timed(clock, clock.answered(performance.now()));
@@ -167,9 +175,16 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
167
175
  if (!id || ((_a = box.current) === null || _a === void 0 ? void 0 : _a.text().trim())) {
168
176
  return;
169
177
  }
178
+ // Its images, as the box had them: the conversation gives them without their bytes, gone with it once moved.
179
+ const timestamp = message.timestamp;
180
+ const shown = MessageUtil.blocks(message).flatMap((block, index) => (block.type === 'image' ? [index] : []));
181
+ const images = timestamp === undefined ? [] : await Promise.all(shown.map(index => server.getMessageImage(store.sessionId, timestamp, index)));
170
182
  const result = await server.navigateTree(store.sessionId, id);
171
- if (!result.cancelled && result.editorText && !((_b = box.current) === null || _b === void 0 ? void 0 : _b.text().trim())) {
172
- (_c = box.current) === null || _c === void 0 ? void 0 : _c.setText(result.editorText);
183
+ if (!result.cancelled && !((_b = box.current) === null || _b === void 0 ? void 0 : _b.text().trim())) {
184
+ if (result.editorText) {
185
+ (_c = box.current) === null || _c === void 0 ? void 0 : _c.setText(result.editorText);
186
+ }
187
+ putBack(images.filter(image => !!image));
173
188
  }
174
189
  }
175
190
  catch (_d) {
@@ -204,16 +219,25 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
204
219
  setQueue(ComposerUtil.without(queue, entry));
205
220
  server.sendNow(store.sessionId, entry.kind, entry.index).catch(onError);
206
221
  };
207
- /** Takes all that waits back into the box: before what is typed, or after it (`after`). */
222
+ /** Images taken back, into the box as they were pasted. */
223
+ const putBack = (images) => {
224
+ var _a, _b;
225
+ if (images.length) {
226
+ (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.addFiles) === null || _b === void 0 ? void 0 : _b.call(_a, images.map(ComposerUtil.imageFile));
227
+ }
228
+ };
229
+ /** Takes all that waits back into the box, with its images: before what is typed, or after it (`after`). */
208
230
  const takeBack = (after = false) => {
209
231
  if (!store) {
210
232
  return;
211
233
  }
212
234
  server.clearQueue(store.sessionId).then(taken => {
213
- var _a;
235
+ var _a, _b, _c;
236
+ var _d, _e;
214
237
  setQueue(EMPTY_QUEUE);
215
238
  const back = { steering: said(taken.steering), followUp: said(taken.followUp) };
216
239
  (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(ComposerUtil.restore(back, box.current.text(), after));
240
+ putBack([...((_d = (_b = taken.images) === null || _b === void 0 ? void 0 : _b.steering) !== null && _d !== void 0 ? _d : []), ...((_e = (_c = taken.images) === null || _c === void 0 ? void 0 : _c.followUp) !== null && _e !== void 0 ? _e : [])].flat());
217
241
  }, onError);
218
242
  };
219
243
  /** Takes one message out; into the box when `back`. */
@@ -224,13 +248,16 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
224
248
  setQueue(ComposerUtil.without(queue, entry));
225
249
  server.removeQueued(store.sessionId, entry.kind, entry.index).then(removed => {
226
250
  var _a;
251
+ var _b;
227
252
  if (removed && back) {
228
253
  (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(ComposerUtil.restore({ steering: said([entry.text]), followUp: [] }, box.current.text()));
254
+ // A Ta service of before says only that it was taken: its images stay behind.
255
+ putBack(typeof removed === 'object' ? ((_b = removed.images) !== null && _b !== void 0 ? _b : []) : []);
229
256
  }
230
257
  }, onError);
231
258
  };
232
259
  const waiting = ComposerUtil.queued(queue);
233
- return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch, sendWhileWorking), keyNames), sendTitle: t(ComposerUtil.sendTitleKey(sendWhileWorking), keyNames), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onArgumentQuery: setArgumentQuery, argumentItems: argumentItems, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
260
+ return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch, sendWhileWorking), keyNames), sendTitle: t(ComposerUtil.sendTitleKey(sendWhileWorking), keyNames), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onArgumentQuery: setArgumentQuery, argumentItems: argumentItems, onMentionQuery: setQuery, mentions: files, emoji: true, mentionLabel: t('ta.composer.mentionFile'), images: true, files: uploads, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, droppedFiles: files => ComposerDropUtil.write(workspace, cwd, files), onError: onError, above: React.createElement(React.Fragment, null,
234
261
  above,
235
262
  waiting.length > 0 && (React.createElement(QueuedMessages, { waiting: waiting, onTakeBack: () => takeBack(), onRemove: remove, onSendNow: sendNow, onSettings: onQueueSettings }))) }));
236
263
  });
@@ -248,7 +275,9 @@ export function QueuedMessages({ waiting, onTakeBack, onRemove, onSendNow, onSet
248
275
  var _a, _b, _c, _d;
249
276
  const note = AssistantTaskUtil.noteOf(entry.text);
250
277
  const shown = words(entry.text);
251
- const text = (note && ((_a = AssistantTaskUtil.noteLine(note, t)) !== null && _a !== void 0 ? _a : note.title)) || shown.text || shown.copied;
278
+ const images = entry.images > 0 ? t('ta.message.images', { count: entry.images }) : '';
279
+ // Images sent without words have no text: they show as what they are, as a chat list says them.
280
+ const text = (note && ((_a = AssistantTaskUtil.noteLine(note, t)) !== null && _a !== void 0 ? _a : note.title)) || shown.text || shown.copied || images;
252
281
  const kind = t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp');
253
282
  // Another's waits as theirs: they take it back, or the owner of the Ta removes it (ta serve holds to it too).
254
283
  const author = TaMessageAuthor.of(entry.text);
@@ -261,6 +290,8 @@ export function QueuedMessages({ waiting, onTakeBack, onRemove, onSendNow, onSet
261
290
  React.createElement(Face, { seed: (_c = author === null || author === void 0 ? void 0 : author.id) !== null && _c !== void 0 ? _c : TA_OWNER, size: 14, double: !author }),
262
291
  React.createElement("span", { className: "ta-origin-name" }, (_d = author === null || author === void 0 ? void 0 : author.name) !== null && _d !== void 0 ? _d : (ownerName || t('ta.presence.owner'))))),
263
292
  !note && React.createElement(MessageOrigin, { blocks: blocksOf(entry.text) }),
293
+ images && (React.createElement("span", { className: "ta-queue-images", title: images },
294
+ React.createElement(Icon, { icon: ImageIcon, size: 13 }))),
264
295
  React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: text }, text),
265
296
  React.createElement("span", { className: "ta-queue-actions", hidden: !mine && me !== TA_OWNER },
266
297
  !note && mine && (React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => onRemove(entry, true), title: t('ta.composer.queue.editTitle'), "aria-label": t('ta.composer.queue.editTitle') },
@@ -4,6 +4,7 @@ import { createPortal } from 'react-dom';
4
4
  import { Back } from '../device/back-stack.js';
5
5
  import { Device, nativePlugin } from '../device/device.js';
6
6
  import { LongPressUtil } from '../device/long-press.js';
7
+ import { MenuLabel } from './chat-emoji.js';
7
8
  export var ContextMenuUtil;
8
9
  (function (ContextMenuUtil) {
9
10
  /** A menu of groups of items, a line between them: the empty ones left out, as no line comes first, last or twice. */
@@ -267,7 +268,7 @@ function ContextMenu({ x, y, around, items, caption, onClose }) {
267
268
  onClose();
268
269
  item.run();
269
270
  } },
270
- item.label,
271
+ React.createElement(MenuLabel, { text: item.label }),
271
272
  choice && React.createElement(Check, { size: 15, className: item.checked ? 'ta-context-menu-check ta-on' : 'ta-context-menu-check', "aria-hidden": "true" }))))));
272
273
  }
273
274
  //# sourceMappingURL=context-menu.js.map
@@ -1,14 +1,15 @@
1
1
  import * as React from 'react';
2
2
  export declare namespace EmojiPanelUtil {
3
- /** The faces and signs most said in a chat, as WeChat's panel puts them first. */
4
- const EMOJIS: readonly string[];
5
- /** The text with the emoji at the caret, right against what is there: no space put before it. */
6
- function insert(text: string, caret: number, emoji: string): [string, number];
7
- /** The text with the last character before the caret taken out, an emoji of the panel (with its selector) as one. */
3
+ /** The faces a text says at its end, as a face is said (`[微笑]`): the length of one, to be taken away whole. */
4
+ function faceBefore(text: string, caret: number): number;
5
+ /** The text with the face at the caret, right against what is there: no space put before it. */
6
+ function insert(text: string, caret: number, face: string): [string, number];
7
+ /** The text with the face before the caret taken out whole (`[微笑]`), or else one character. */
8
8
  function deleteBack(text: string, caret: number): [string, number];
9
9
  }
10
10
  export interface EmojiPanelProps {
11
- onPick(emoji: string): void;
11
+ /** A face picked, as it is said in the text (`[微笑]`). */
12
+ onPick(face: string): void;
12
13
  /** On a phone: a panel under the box in place of the keyboard, with Delete and Send, as WeChat's; else a popover above the button. */
13
14
  docked?: boolean;
14
15
  /** Going: a docked panel folds away, then `onClosed`. */
@@ -18,5 +19,8 @@ export interface EmojiPanelProps {
18
19
  onSend?(): void;
19
20
  sendable?: boolean;
20
21
  }
21
- /** The emoji of the message box: a tap puts one where the caret is. */
22
+ /**
23
+ * The faces of the message box, as WeChat's panel: 最近使用 above 所有表情, a tap putting one where the caret is. What
24
+ * is put in is the face's name (`[微笑]`), drawn as the face by the conversation.
25
+ */
22
26
  export declare const EmojiPanel: React.ForwardRefExoticComponent<EmojiPanelProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,51 +1,69 @@
1
1
  import { Delete } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useT } from '../i18n/use-t.js';
4
+ import { ChatEmojiUtil } from '../util/chat-emoji.js';
5
+ import { ChatFace } from './chat-emoji.js';
4
6
  import { Icon } from './icon.js';
5
7
  export var EmojiPanelUtil;
6
8
  (function (EmojiPanelUtil) {
7
- /** The faces and signs most said in a chat, as WeChat's panel puts them first. */
8
- EmojiPanelUtil.EMOJIS = Array.from('😀😁😂🤣😃😄😅😆😉😊😋😎😍😘🥰😗🙂🤗🤩🤔🤨😐😑😶🙄😏😣😥😮🤐😯😪😫🥱😴😌😛😜😝🤤😒😓😔😕🙃🫠🤑😲🙁😖😞😟😤😢😭😦😧😨😩🤯😬😰😱🥵🥶😳🤪😵😡😠🤬😷🤒🤕🤢🤮🥴😇🥳🥺🤠🤡🤓🧐😈👻💀🤖🎃😺👍👎👌✌️🤞🤟🤘🤙👏🙌👐🤝🙏💪👀👋✊👊❤️🧡💛💚💙💜🖤🤍💔💯💢💥💫💦💨🔥✨🎉🎊🎁🏆🌹🌸🌞🌙⭐🌈☕🍺🍻🍉🍰🍜🐶🐱🐼🦖🚀💡💰📌✅❌❓❗').reduce((list, char) => {
9
- // A variation selector belongs to the sign before it.
10
- if (char === '\uFE0F' && list.length) {
11
- list[list.length - 1] += char;
12
- }
13
- else {
14
- list.push(char);
15
- }
16
- return list;
17
- }, []);
18
- /** The text with the emoji at the caret, right against what is there: no space put before it. */
19
- function insert(text, caret, emoji) {
20
- return [text.slice(0, caret) + emoji + text.slice(caret), caret + emoji.length];
9
+ /** The faces a text says at its end, as a face is said (`[微笑]`): the length of one, to be taken away whole. */
10
+ function faceBefore(text, caret) {
11
+ return ChatEmojiUtil.before(text, caret);
12
+ }
13
+ EmojiPanelUtil.faceBefore = faceBefore;
14
+ /** The text with the face at the caret, right against what is there: no space put before it. */
15
+ function insert(text, caret, face) {
16
+ return [text.slice(0, caret) + face + text.slice(caret), caret + face.length];
21
17
  }
22
18
  EmojiPanelUtil.insert = insert;
23
- /** The text with the last character before the caret taken out, an emoji of the panel (with its selector) as one. */
19
+ /** The text with the face before the caret taken out whole (`[微笑]`), or else one character. */
24
20
  function deleteBack(text, caret) {
25
- var _a, _b;
21
+ var _a;
22
+ const face = ChatEmojiUtil.before(text, caret);
23
+ if (face) {
24
+ return [text.slice(0, caret - face) + text.slice(caret), caret - face];
25
+ }
26
26
  const before = text.slice(0, caret);
27
27
  if (!before) {
28
28
  return [text, caret];
29
29
  }
30
- const last = (_b = (_a = EmojiPanelUtil.EMOJIS.find(emoji => emoji.length > 1 && before.endsWith(emoji))) !== null && _a !== void 0 ? _a : Array.from(before).pop()) !== null && _b !== void 0 ? _b : '';
30
+ const last = (_a = Array.from(before).pop()) !== null && _a !== void 0 ? _a : '';
31
31
  const at = caret - last.length;
32
32
  return [text.slice(0, at) + text.slice(caret), at];
33
33
  }
34
34
  EmojiPanelUtil.deleteBack = deleteBack;
35
35
  })(EmojiPanelUtil || (EmojiPanelUtil = {}));
36
- /** The emoji of the message box: a tap puts one where the caret is. */
36
+ /**
37
+ * The faces of the message box, as WeChat's panel: 最近使用 above 所有表情, a tap putting one where the caret is. What
38
+ * is put in is the face's name (`[微笑]`), drawn as the face by the conversation.
39
+ */
37
40
  export const EmojiPanel = React.forwardRef(function EmojiPanel({ onPick, docked, closing, onClosed, onDelete, onSend, sendable }, ref) {
38
41
  const t = useT();
39
- const grid = (React.createElement("div", { className: "ta-emoji-grid", role: "listbox", "aria-label": t('ta.composer.emoji') }, EmojiPanelUtil.EMOJIS.map(emoji => (React.createElement("button", { key: emoji, type: "button", role: "option", "aria-selected": false, className: "ta-emoji",
42
+ const [recent, setRecent] = React.useState(() => ChatEmojiUtil.recent());
43
+ const pick = (index) => {
44
+ ChatEmojiUtil.used(index);
45
+ setRecent(ChatEmojiUtil.recent());
46
+ onPick(ChatEmojiUtil.code(index));
47
+ };
48
+ const all = ChatEmojiUtil.FACES.map((_face, index) => index);
49
+ const grid = (items) => (React.createElement("div", { className: "ta-emoji-grid", role: "listbox", "aria-label": t('ta.composer.emoji') }, items.map(index => (React.createElement("button", { key: index, type: "button", role: "option", "aria-selected": false, className: "ta-emoji",
40
50
  // The field keeps the caret (and on a computer the focus) while one is picked.
41
- onPointerDown: event => event.preventDefault(), onClick: () => onPick(emoji) }, emoji)))));
51
+ onPointerDown: event => event.preventDefault(), onClick: () => pick(index) },
52
+ React.createElement(ChatFace, { index: index }))))));
53
+ const body = (React.createElement(React.Fragment, null,
54
+ recent.length > 0 && (React.createElement(React.Fragment, null,
55
+ React.createElement("div", { className: "ta-emoji-title" }, t('ta.composer.emojiRecent')),
56
+ grid(recent))),
57
+ React.createElement("div", { className: "ta-emoji-title" }, t('ta.composer.emojiAll')),
58
+ grid(all)));
42
59
  if (!docked) {
43
- return (React.createElement("div", { ref: ref, className: "ta-emoji-pop" }, grid));
60
+ return (React.createElement("div", { ref: ref, className: "ta-emoji-pop" },
61
+ React.createElement("div", { className: "ta-emoji-scroll" }, body)));
44
62
  }
45
63
  return (React.createElement("div", { ref: ref, className: `ta-plus-dock${closing ? ' ta-closing' : ''}`, onAnimationEnd: event => closing && event.target === event.currentTarget && (onClosed === null || onClosed === void 0 ? void 0 : onClosed()) },
46
64
  React.createElement("div", { className: "ta-plus-dock-inner" },
47
65
  React.createElement("div", { className: "ta-emoji-panel" },
48
- grid,
66
+ React.createElement("div", { className: "ta-emoji-scroll" }, body),
49
67
  React.createElement("div", { className: "ta-emoji-keys" },
50
68
  React.createElement("button", { type: "button", className: "ta-emoji-key", "aria-label": t('ta.composer.deleteBack'), onClick: onDelete },
51
69
  React.createElement(Icon, { icon: Delete, size: 20 })),
@@ -1,4 +1,4 @@
1
- import { Puzzle } from 'lucide-react';
1
+ import { Blocks } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { ExtensionBoundary } from '../extension/extension-view.js';
4
4
  import { WebLabelUtil } from '../extension/web-extension-protocol.js';
@@ -11,7 +11,7 @@ export function extensionSection(entry) {
11
11
  return {
12
12
  id: `extension-${id.replace(/[^\w-]+/g, '-')}`,
13
13
  title: WebLabelUtil.text(section.title),
14
- icon: (_a = section.icon) !== null && _a !== void 0 ? _a : Puzzle,
14
+ icon: (_a = section.icon) !== null && _a !== void 0 ? _a : Blocks,
15
15
  group: section.group && SETTINGS_GROUPS.some(group => group.id === section.group) ? section.group : 'extensions',
16
16
  order: (_b = section.order) !== null && _b !== void 0 ? _b : 100,
17
17
  ...(section.tier === 'common' ? { tier: 'common' } : {}),
@@ -0,0 +1,18 @@
1
+ import type { TaDirEntry } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ import { type Translate } from '../i18n/use-t.js';
4
+ export declare namespace NewFolderUtil {
5
+ /** Why `name` cannot be the name of a new folder in a directory holding `entries`; undefined when it can. */
6
+ function problem(name: string, entries: readonly TaDirEntry[], t: Translate): string | undefined;
7
+ }
8
+ export interface NewFolderProps {
9
+ /** The directory it is made in, and what is there. */
10
+ location: string;
11
+ entries: readonly TaDirEntry[];
12
+ create(directory: string, name: string): Promise<void>;
13
+ /** The folder made, to go into. */
14
+ onMade(location: string): void;
15
+ onClose(): void;
16
+ }
17
+ /** The name of a folder to make in the directory shown; made, the picker goes into it. */
18
+ export declare function NewFolder({ location, entries, create, onMade, onClose }: NewFolderProps): React.JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { TaLocation } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ import { useT } from '../i18n/use-t.js';
4
+ export var NewFolderUtil;
5
+ (function (NewFolderUtil) {
6
+ /** Why `name` cannot be the name of a new folder in a directory holding `entries`; undefined when it can. */
7
+ function problem(name, entries, t) {
8
+ if (/[\\/]/.test(name) || name === '.' || name === '..') {
9
+ return t('ta.folder.newInvalid');
10
+ }
11
+ return entries.some(entry => entry.name === name) ? t('ta.folder.newExists', { name }) : undefined;
12
+ }
13
+ NewFolderUtil.problem = problem;
14
+ })(NewFolderUtil || (NewFolderUtil = {}));
15
+ /** The name of a folder to make in the directory shown; made, the picker goes into it. */
16
+ export function NewFolder({ location, entries, create, onMade, onClose }) {
17
+ const t = useT();
18
+ const [name, setName] = React.useState('');
19
+ const [problem, setProblem] = React.useState();
20
+ const [busy, setBusy] = React.useState(false);
21
+ const make = () => {
22
+ const trimmed = name.trim();
23
+ const wrong = NewFolderUtil.problem(trimmed, entries, t);
24
+ if (wrong) {
25
+ setProblem(wrong);
26
+ return;
27
+ }
28
+ const made = TaLocation.child(location, trimmed);
29
+ setBusy(true);
30
+ create(location, trimmed).then(() => onMade(made), error => {
31
+ setBusy(false);
32
+ setProblem(error instanceof Error ? error.message : String(error));
33
+ });
34
+ };
35
+ return (React.createElement("form", { className: "ta-folder-add", onSubmit: event => {
36
+ event.preventDefault();
37
+ make();
38
+ } },
39
+ React.createElement("div", { className: "ta-folder-add-row" },
40
+ React.createElement("label", { className: "ta-field" },
41
+ React.createElement("input", { autoFocus: true, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", autoComplete: "off", enterKeyHint: "done", value: name, placeholder: t('ta.folder.newName'), "aria-label": t('ta.folder.newName'), "aria-invalid": problem ? true : undefined, onChange: event => {
42
+ setName(event.target.value);
43
+ setProblem(undefined);
44
+ }, onKeyDown: event => {
45
+ if (event.key === 'Escape') {
46
+ event.stopPropagation();
47
+ onClose();
48
+ }
49
+ } })),
50
+ React.createElement("button", { type: "submit", className: "ta-button ta-primary", disabled: busy || !name.trim() }, t('ta.folder.newConfirm'))),
51
+ problem && React.createElement("div", { className: "ta-folder-failed" }, problem)));
52
+ }
53
+ //# sourceMappingURL=folder-new.js.map
@@ -43,6 +43,8 @@ export declare namespace FolderPickerUtil {
43
43
  export interface FolderPickerProps {
44
44
  /** The entries of a directory of the server. */
45
45
  list(directory: string): Promise<TaDirEntry[]>;
46
+ /** Makes the folder `name` in `directory` (a location): offers to make one in the directory shown. */
47
+ create?(directory: string, name: string): Promise<void>;
46
48
  /** Where it opens: a path, or an `ssh://` location. */
47
49
  initial: string;
48
50
  onPick(path: string): Promise<void>;
@@ -54,7 +56,7 @@ export interface FolderPickerProps {
54
56
  * Picks a directory, of the machine of the server or of a host it reaches with ssh, folder by folder or by
55
57
  * a path typed in, to open a conversation there.
56
58
  */
57
- export declare function FolderPicker({ list, initial, onPick, onClose, remote: bench }: FolderPickerProps): React.ReactElement;
59
+ export declare function FolderPicker({ list, create, initial, onPick, onClose, remote: bench }: FolderPickerProps): React.ReactElement;
58
60
  /** The name of a directory, with the host of one of another machine. */
59
61
  export declare function DirectoryName({ cwd }: {
60
62
  cwd: string;
@@ -64,8 +66,9 @@ export interface DirectoryButtonProps {
64
66
  cwd: string;
65
67
  /** The entries of a directory of the server, the same function from one render to the next. */
66
68
  list(directory: string): Promise<TaDirEntry[]>;
69
+ create?(directory: string, name: string): Promise<void>;
67
70
  onPick(cwd: string): void | Promise<void>;
68
71
  remote?: FolderPickerRemote;
69
72
  }
70
73
  /** The directory a new conversation will work in, above its message box: a click picks another. */
71
- export declare function DirectoryButton({ cwd, list, onPick, remote }: DirectoryButtonProps): React.ReactElement;
74
+ export declare function DirectoryButton({ cwd, list, create, onPick, remote }: DirectoryButtonProps): React.ReactElement;
@@ -1,5 +1,5 @@
1
1
  import { TaLocation } from '@celljs/ta-protocol';
2
- import { ChevronDown, ChevronRight, Cloud, CornerLeftUp, Folder, Monitor, Pencil, Plus, Server, X } from 'lucide-react';
2
+ import { ChevronDown, ChevronRight, Cloud, CornerLeftUp, Folder, FolderPlus, Monitor, Pencil, Plus, Server, X } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { useBackLayer } from '../device/back-stack.js';
@@ -7,6 +7,7 @@ import { useDevice } from '../device/device.js';
7
7
  import { useT } from '../i18n/use-t.js';
8
8
  import { MessageUtil } from '../util/message.js';
9
9
  import { EmptyState } from './empty-state.js';
10
+ import { NewFolder } from './folder-new.js';
10
11
  import { HostTag } from './host-tag.js';
11
12
  import { Icon, IconButton } from './icon.js';
12
13
  import { useRemoteSteps } from './remote-steps.js';
@@ -162,7 +163,7 @@ function Machines({ host, hosts, onPick }) {
162
163
  * Picks a directory, of the machine of the server or of a host it reaches with ssh, folder by folder or by
163
164
  * a path typed in, to open a conversation there.
164
165
  */
165
- export function FolderPicker({ list, initial, onPick, onClose, remote: bench }) {
166
+ export function FolderPicker({ list, create, initial, onPick, onClose, remote: bench }) {
166
167
  var _a;
167
168
  const t = useT();
168
169
  // On a touch screen the keyboard would cover the folders: the user goes folder by folder there.
@@ -222,11 +223,16 @@ export function FolderPicker({ list, initial, onPick, onClose, remote: bench })
222
223
  }, [bench]);
223
224
  /** On a touch screen the path is typed only when asked for: else its folders are buttons. */
224
225
  const [typing, setTyping] = React.useState(false);
226
+ /** The name of a new folder is being typed. */
227
+ const [making, setMaking] = React.useState(false);
228
+ /** A folder can be made in the directory shown: it is listed, of the machine shown. */
229
+ const canMake = !!create && !loading && folders !== undefined && TaLocation.host(path) === host;
225
230
  const up = FolderPickerUtil.parent(path);
226
231
  const pick = () => {
227
232
  setBusy(true);
228
233
  onPick(path).finally(() => setBusy(false));
229
234
  };
235
+ const newFolderButton = create && (React.createElement(IconButton, { icon: FolderPlus, label: t('ta.folder.new'), className: making ? 'ta-on' : undefined, "aria-pressed": making, disabled: !canMake, onClick: () => setMaking(!making) }));
230
236
  return createPortal(React.createElement("div", { className: "ta-modal-scrim" },
231
237
  React.createElement("button", { type: "button", className: "ta-overlay-close", "aria-label": t('ta.close'), tabIndex: -1, onClick: onClose }),
232
238
  React.createElement("div", { className: "ta-modal ta-folder", role: "dialog", "aria-modal": "true", "aria-label": t('ta.folder.title'), onKeyDown: event => event.key === 'Escape' && onClose() },
@@ -237,7 +243,8 @@ export function FolderPicker({ list, initial, onPick, onClose, remote: bench })
237
243
  touch && !typing ? (React.createElement("div", { className: "ta-folder-bar" },
238
244
  React.createElement(IconButton, { icon: CornerLeftUp, label: t('ta.folder.up'), disabled: !up, onClick: () => up && go(up) }),
239
245
  React.createElement(PathCrumbs, { location: TaLocation.host(path) === host ? path : undefined, host: host, onPick: go }),
240
- React.createElement(IconButton, { icon: Pencil, label: t('ta.folder.type'), onClick: () => setTyping(true) }))) : (React.createElement("form", { className: "ta-folder-bar", onSubmit: event => {
246
+ React.createElement(IconButton, { icon: Pencil, label: t('ta.folder.type'), onClick: () => setTyping(true) }),
247
+ newFolderButton)) : (React.createElement("form", { className: "ta-folder-bar", onSubmit: event => {
241
248
  event.preventDefault();
242
249
  if (input.trim()) {
243
250
  go(FolderPickerUtil.typed(input, host, path));
@@ -251,7 +258,12 @@ export function FolderPicker({ list, initial, onPick, onClose, remote: bench })
251
258
  setTyping(false);
252
259
  setInput(TaLocation.path(path));
253
260
  }
254
- } })))),
261
+ } })),
262
+ newFolderButton)),
263
+ making && canMake && create && (React.createElement(NewFolder, { key: path, location: path, entries: folders !== null && folders !== void 0 ? folders : [], create: create, onClose: () => setMaking(false), onMade: made => {
264
+ setMaking(false);
265
+ go(made);
266
+ } })),
255
267
  React.createElement("ul", { className: "ta-folder-list" },
256
268
  (folders === undefined || (loading && connecting)) && !failed && (React.createElement("li", { className: "ta-folder-note" },
257
269
  React.createElement("span", { className: "ta-spinner" }),
@@ -304,14 +316,14 @@ export function DirectoryName({ cwd }) {
304
316
  React.createElement(HostTag, { host: host })));
305
317
  }
306
318
  /** The directory a new conversation will work in, above its message box: a click picks another. */
307
- export function DirectoryButton({ cwd, list, onPick, remote }) {
319
+ export function DirectoryButton({ cwd, list, create, onPick, remote }) {
308
320
  const t = useT();
309
321
  const [picking, setPicking] = React.useState(false);
310
322
  return (React.createElement(React.Fragment, null,
311
323
  React.createElement("button", { type: "button", className: "ta-cwd-chip", title: t('ta.chat.cwdTitle', { path: cwd }), onClick: () => setPicking(true) },
312
324
  React.createElement(DirectoryName, { cwd: cwd }),
313
325
  React.createElement(Icon, { icon: ChevronDown, size: 13 })),
314
- picking && (React.createElement(FolderPicker, { list: list, initial: cwd, remote: remote, onClose: () => setPicking(false), onPick: async (path) => {
326
+ picking && (React.createElement(FolderPicker, { list: list, create: create, initial: cwd, remote: remote, onClose: () => setPicking(false), onPick: async (path) => {
315
327
  await onPick(path);
316
328
  setPicking(false);
317
329
  } }))));