@celljs/ta-web 4.15.2 → 4.17.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 (601) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-ask-book.d.ts +35 -0
  4. package/esm/browser/assistant/assistant-ask-book.js +96 -0
  5. package/esm/browser/assistant/assistant-conversation.d.ts +110 -0
  6. package/esm/browser/assistant/assistant-conversation.js +351 -0
  7. package/esm/browser/assistant/assistant-export.js +6 -7
  8. package/esm/browser/assistant/assistant-extension.d.ts +3 -2
  9. package/esm/browser/assistant/assistant-extension.js +57 -4
  10. package/esm/browser/assistant/assistant-protocol.d.ts +17 -2
  11. package/esm/browser/assistant/assistant-role.d.ts +22 -4
  12. package/esm/browser/assistant/assistant-role.js +29 -7
  13. package/esm/browser/assistant/assistant-state.d.ts +5 -1
  14. package/esm/browser/assistant/assistant-state.js +11 -0
  15. package/esm/browser/assistant/assistant-task-source.js +7 -1
  16. package/esm/browser/assistant/assistant-task-util.d.ts +19 -7
  17. package/esm/browser/assistant/assistant-task-util.js +73 -20
  18. package/esm/browser/assistant/assistant-tasks.d.ts +0 -7
  19. package/esm/browser/assistant/assistant-tasks.js +0 -2
  20. package/esm/browser/assistant/assistant-thread.d.ts +22 -0
  21. package/esm/browser/assistant/assistant-thread.js +108 -0
  22. package/esm/browser/assistant/assistant-view.js +77 -126
  23. package/esm/browser/assistant/assistant.d.ts +33 -105
  24. package/esm/browser/assistant/assistant.js +103 -356
  25. package/esm/browser/assistant/chat-task-source.d.ts +58 -0
  26. package/esm/browser/assistant/chat-task-source.js +107 -0
  27. package/esm/browser/assistant/read-aloud.d.ts +34 -0
  28. package/esm/browser/assistant/read-aloud.js +98 -0
  29. package/esm/browser/assistant/realtime-voice.d.ts +77 -0
  30. package/esm/browser/assistant/realtime-voice.js +320 -0
  31. package/esm/browser/assistant/task-views.d.ts +2 -3
  32. package/esm/browser/assistant/task-views.js +20 -16
  33. package/esm/browser/assistant/voice-call-bar.d.ts +60 -0
  34. package/esm/browser/assistant/voice-call-bar.js +260 -0
  35. package/esm/browser/assistant/voice-call.d.ts +175 -0
  36. package/esm/browser/assistant/voice-call.js +366 -0
  37. package/esm/browser/chat/chat-shown.d.ts +78 -0
  38. package/esm/browser/chat/chat-shown.js +262 -0
  39. package/esm/browser/chat/chat-view.js +2 -1
  40. package/esm/browser/chat/chat.d.ts +4 -68
  41. package/esm/browser/chat/chat.js +5 -253
  42. package/esm/browser/chat/draft-model.d.ts +1 -1
  43. package/esm/browser/components/access-view.js +1 -1
  44. package/esm/browser/components/account-menu.js +1 -1
  45. package/esm/browser/components/app-nav.d.ts +3 -1
  46. package/esm/browser/components/app-nav.js +7 -7
  47. package/esm/browser/components/app-shell-hooks.d.ts +11 -2
  48. package/esm/browser/components/app-shell-hooks.js +25 -4
  49. package/esm/browser/components/app-shell-state.d.ts +80 -0
  50. package/esm/browser/components/app-shell-state.js +466 -0
  51. package/esm/browser/components/app-view.js +128 -334
  52. package/esm/browser/components/asks-badge.d.ts +6 -2
  53. package/esm/browser/components/asks-badge.js +7 -3
  54. package/esm/browser/components/auth-pictures.d.ts +2 -2
  55. package/esm/browser/components/auth-pictures.js +13 -1
  56. package/esm/browser/components/auth-view.d.ts +4 -3
  57. package/esm/browser/components/auth-view.js +54 -5
  58. package/esm/browser/components/chat-asks.d.ts +2 -0
  59. package/esm/browser/components/chat-asks.js +8 -0
  60. package/esm/browser/components/chat-busy.d.ts +32 -0
  61. package/esm/browser/components/chat-busy.js +49 -0
  62. package/esm/browser/components/chat-icon.d.ts +6 -0
  63. package/esm/browser/components/chat-icon.js +17 -1
  64. package/esm/browser/components/chat-list-row.d.ts +84 -0
  65. package/esm/browser/components/chat-list-row.js +198 -0
  66. package/esm/browser/components/chat-list-util.d.ts +166 -0
  67. package/esm/browser/components/chat-list-util.js +335 -0
  68. package/esm/browser/components/chat-list.d.ts +11 -148
  69. package/esm/browser/components/chat-list.js +280 -511
  70. package/esm/browser/components/chat-seen.d.ts +7 -0
  71. package/esm/browser/components/chat-seen.js +58 -10
  72. package/esm/browser/components/composer-addon-util.d.ts +1 -1
  73. package/esm/browser/components/composer-addons.d.ts +1 -1
  74. package/esm/browser/components/composer-attachments.d.ts +11 -0
  75. package/esm/browser/components/composer-attachments.js +27 -0
  76. package/esm/browser/components/composer-box-hooks.d.ts +9 -0
  77. package/esm/browser/components/composer-box-hooks.js +138 -0
  78. package/esm/browser/components/composer-box-protocol.d.ts +108 -0
  79. package/esm/browser/components/composer-box-protocol.js +2 -0
  80. package/esm/browser/components/composer-box.d.ts +1 -95
  81. package/esm/browser/components/composer-box.js +49 -156
  82. package/esm/browser/components/composer-target.d.ts +21 -0
  83. package/esm/browser/components/composer-target.js +43 -0
  84. package/esm/browser/components/composer.d.ts +7 -1
  85. package/esm/browser/components/composer.js +13 -9
  86. package/esm/browser/components/context-menu.js +4 -0
  87. package/esm/browser/components/conversation-find.d.ts +27 -0
  88. package/esm/browser/components/conversation-find.js +151 -0
  89. package/esm/browser/components/conversation-scroll-hooks.js +2 -1
  90. package/esm/browser/components/conversation-scroll-util.d.ts +73 -0
  91. package/esm/browser/components/conversation-scroll-util.js +80 -0
  92. package/esm/browser/components/conversation-scroll.d.ts +1 -35
  93. package/esm/browser/components/conversation-scroll.js +2 -81
  94. package/esm/browser/components/conversation-view.d.ts +8 -0
  95. package/esm/browser/components/conversation-view.js +41 -0
  96. package/esm/browser/components/discover-view.d.ts +3 -2
  97. package/esm/browser/components/discover-view.js +31 -26
  98. package/esm/browser/components/dismiss.js +2 -0
  99. package/esm/browser/components/earlier-messages.d.ts +2 -0
  100. package/esm/browser/components/earlier-messages.js +2 -1
  101. package/esm/browser/components/environment-view.js +50 -1
  102. package/esm/browser/components/folder-picker.d.ts +7 -0
  103. package/esm/browser/components/folder-picker.js +90 -20
  104. package/esm/browser/components/gallery.d.ts +1 -1
  105. package/esm/browser/components/gallery.js +57 -14
  106. package/esm/browser/components/host-tag.js +2 -2
  107. package/esm/browser/components/host-view.d.ts +1 -1
  108. package/esm/browser/components/host-view.js +3 -1
  109. package/esm/browser/components/image-menu.d.ts +11 -0
  110. package/esm/browser/components/image-menu.js +29 -0
  111. package/esm/browser/components/image-viewer.d.ts +3 -2
  112. package/esm/browser/components/image-viewer.js +29 -4
  113. package/esm/browser/components/lightbox.js +2 -0
  114. package/esm/browser/components/link-dialog.js +2 -0
  115. package/esm/browser/components/list-rows.d.ts +3 -1
  116. package/esm/browser/components/list-rows.js +2 -1
  117. package/esm/browser/components/markdown.js +5 -0
  118. package/esm/browser/components/media.d.ts +2 -0
  119. package/esm/browser/components/media.js +16 -1
  120. package/esm/browser/components/message-actions.d.ts +1 -1
  121. package/esm/browser/components/message-actions.js +9 -0
  122. package/esm/browser/components/message-footer.d.ts +3 -1
  123. package/esm/browser/components/message-footer.js +3 -2
  124. package/esm/browser/components/message-images.d.ts +41 -0
  125. package/esm/browser/components/message-images.js +120 -0
  126. package/esm/browser/components/message-list.d.ts +4 -100
  127. package/esm/browser/components/message-list.js +10 -447
  128. package/esm/browser/components/message-menu.js +4 -0
  129. package/esm/browser/components/message-steps.d.ts +21 -0
  130. package/esm/browser/components/message-steps.js +182 -0
  131. package/esm/browser/components/message-user.d.ts +54 -0
  132. package/esm/browser/components/message-user.js +169 -0
  133. package/esm/browser/components/model-picker.d.ts +1 -1
  134. package/esm/browser/components/model-picker.js +2 -0
  135. package/esm/browser/components/moved-notice.d.ts +14 -0
  136. package/esm/browser/components/moved-notice.js +60 -0
  137. package/esm/browser/components/nav-places.d.ts +12 -1
  138. package/esm/browser/components/nav-places.js +10 -2
  139. package/esm/browser/components/notice-center.js +36 -1
  140. package/esm/browser/components/notice-face.js +2 -1
  141. package/esm/browser/components/phone-shell.d.ts +4 -3
  142. package/esm/browser/components/phone-shell.js +60 -68
  143. package/esm/browser/components/plus-menu.d.ts +1 -1
  144. package/esm/browser/components/relay-services.d.ts +6 -1
  145. package/esm/browser/components/relay-services.js +109 -2
  146. package/esm/browser/components/relay-view.js +2 -0
  147. package/esm/browser/components/remote-hosts.d.ts +10 -0
  148. package/esm/browser/components/remote-hosts.js +67 -5
  149. package/esm/browser/components/remote-prompts.js +2 -0
  150. package/esm/browser/components/scan-screen.js +7 -0
  151. package/esm/browser/components/screen-navigator-util.d.ts +28 -0
  152. package/esm/browser/components/screen-navigator-util.js +33 -0
  153. package/esm/browser/components/screen-navigator.d.ts +30 -0
  154. package/esm/browser/components/screen-navigator.js +47 -0
  155. package/esm/browser/components/session-settings.d.ts +1 -1
  156. package/esm/browser/components/session-view.js +157 -7
  157. package/esm/browser/components/settings-choices.d.ts +6 -0
  158. package/esm/browser/components/settings-choices.js +8 -0
  159. package/esm/browser/components/settings-more.d.ts +7 -0
  160. package/esm/browser/components/settings-more.js +263 -0
  161. package/esm/browser/components/settings-parts.d.ts +8 -3
  162. package/esm/browser/components/settings-parts.js +31 -249
  163. package/esm/browser/components/settings-view.js +43 -15
  164. package/esm/browser/components/stop-times.js +1 -0
  165. package/esm/browser/components/surface-flyout.js +2 -0
  166. package/esm/browser/components/unseen-drop.d.ts +10 -4
  167. package/esm/browser/components/unseen-drop.js +9 -8
  168. package/esm/browser/components/use-seen-chats.js +1 -1
  169. package/esm/browser/components/voice-services.d.ts +6 -0
  170. package/esm/browser/components/voice-services.js +137 -0
  171. package/esm/browser/components/voice-talk.d.ts +23 -6
  172. package/esm/browser/components/voice-talk.js +46 -11
  173. package/esm/browser/components/web-composer.d.ts +1 -1
  174. package/esm/browser/components/web-composer.js +2 -2
  175. package/esm/browser/components/web-dialog.js +2 -0
  176. package/esm/browser/device/back-stack.d.ts +89 -11
  177. package/esm/browser/device/back-stack.js +200 -29
  178. package/esm/browser/device/device-protocol.d.ts +1 -1
  179. package/esm/browser/device/device-protocol.js +1 -1
  180. package/esm/browser/device/own-gestures.d.ts +1 -1
  181. package/esm/browser/device/pull-down.js +3 -1
  182. package/esm/browser/device/row-swipe.js +3 -1
  183. package/esm/browser/device/sheet-swipe.d.ts +1 -179
  184. package/esm/browser/device/sheet-swipe.js +3 -433
  185. package/esm/browser/device/swipe-finger.d.ts +31 -0
  186. package/esm/browser/device/swipe-finger.js +83 -0
  187. package/esm/browser/device/swipe-settle.d.ts +52 -0
  188. package/esm/browser/device/swipe-settle.js +170 -0
  189. package/esm/browser/device/swipe-util.d.ts +97 -0
  190. package/esm/browser/device/swipe-util.js +183 -0
  191. package/esm/browser/drafts/drafts-protocol.d.ts +58 -0
  192. package/esm/browser/drafts/drafts-protocol.js +75 -0
  193. package/esm/browser/drafts/drafts.d.ts +21 -0
  194. package/esm/browser/drafts/drafts.js +91 -0
  195. package/esm/browser/drafts/use-composer-draft.d.ts +20 -0
  196. package/esm/browser/drafts/use-composer-draft.js +108 -0
  197. package/esm/browser/extension/icons.js +25 -4
  198. package/esm/browser/extension/web-api-components.d.ts +13 -0
  199. package/esm/browser/extension/web-api-contributions.d.ts +125 -0
  200. package/esm/browser/extension/web-extension-api.d.ts +88 -5
  201. package/esm/browser/extension/web-extension-context.d.ts +5 -0
  202. package/esm/browser/extension/web-extension-context.js +60 -7
  203. package/esm/browser/extension/web-extension-protocol.d.ts +19 -1
  204. package/esm/browser/extension/web-extension-protocol.js +3 -0
  205. package/esm/browser/extension/web-extension-run.d.ts +5 -2
  206. package/esm/browser/extension/web-extension-run.js +13 -1
  207. package/esm/browser/extension/web-extensions-running.d.ts +93 -0
  208. package/esm/browser/extension/web-extensions-running.js +339 -0
  209. package/esm/browser/extension/web-extensions.d.ts +6 -82
  210. package/esm/browser/extension/web-extensions.js +10 -319
  211. package/esm/browser/extension/web-pages.js +1 -0
  212. package/esm/browser/extension/web-session-notices.js +6 -1
  213. package/esm/browser/extension/web-tasks.d.ts +2 -0
  214. package/esm/browser/extension/web-tasks.js +6 -0
  215. package/esm/browser/extension/web-view-util.d.ts +2 -1
  216. package/esm/browser/extension/web-view-util.js +4 -1
  217. package/esm/browser/gateway/console-parts.d.ts +4 -12
  218. package/esm/browser/gateway/console-parts.js +42 -125
  219. package/esm/browser/gateway/console-tenant.js +3 -2
  220. package/esm/browser/gateway/console-trend.d.ts +11 -0
  221. package/esm/browser/gateway/console-trend.js +115 -0
  222. package/esm/browser/gateway/console-util.js +2 -2
  223. package/esm/browser/gateway/console-view.js +49 -3
  224. package/esm/browser/i18n/locales.d.ts +170 -6
  225. package/esm/browser/i18n/messages-ja.js +171 -7
  226. package/esm/browser/i18n/messages-zh-tw.js +171 -7
  227. package/esm/browser/i18n/messages.d.ts +167 -3
  228. package/esm/browser/i18n/messages.js +342 -14
  229. package/esm/browser/index.d.ts +17 -0
  230. package/esm/browser/index.js +17 -0
  231. package/esm/browser/notices/notices-protocol.d.ts +12 -0
  232. package/esm/browser/notices/notices.js +7 -4
  233. package/esm/browser/offline/device-values.d.ts +2 -0
  234. package/esm/browser/offline/device-values.js +6 -1
  235. package/esm/browser/screen/page-answers.d.ts +42 -0
  236. package/esm/browser/screen/page-answers.js +89 -0
  237. package/esm/browser/screen/screen-protocol.d.ts +112 -0
  238. package/esm/browser/screen/screen-protocol.js +45 -0
  239. package/esm/browser/screen/screen.d.ts +20 -0
  240. package/esm/browser/screen/screen.js +122 -0
  241. package/esm/browser/screen/use-screen-part.d.ts +6 -0
  242. package/esm/browser/screen/use-screen-part.js +14 -0
  243. package/esm/browser/settings/settings-protocol.d.ts +5 -1
  244. package/esm/browser/settings/settings-protocol.js +6 -2
  245. package/esm/browser/share/shared-extensions.d.ts +29 -0
  246. package/esm/browser/share/shared-extensions.js +145 -0
  247. package/esm/browser/share/shared-link.d.ts +11 -0
  248. package/esm/browser/share/shared-link.js +38 -0
  249. package/esm/browser/share/shared-page.d.ts +5 -0
  250. package/esm/browser/share/shared-page.js +137 -0
  251. package/esm/browser/state/state-protocol.d.ts +14 -0
  252. package/esm/browser/state/state-protocol.js +18 -0
  253. package/esm/browser/state/state.d.ts +10 -2
  254. package/esm/browser/state/state.js +19 -3
  255. package/esm/browser/style/base.d.ts +1 -1
  256. package/esm/browser/style/base.js +4 -0
  257. package/esm/browser/style/chat-list.d.ts +2 -0
  258. package/esm/browser/style/chat-list.js +153 -0
  259. package/esm/browser/style/conversation-column.d.ts +2 -0
  260. package/esm/browser/style/conversation-column.js +250 -0
  261. package/esm/browser/style/conversation.d.ts +1 -1
  262. package/esm/browser/style/conversation.js +24 -8
  263. package/esm/browser/style/dialogs.d.ts +2 -0
  264. package/esm/browser/style/dialogs.js +163 -0
  265. package/esm/browser/style/layout.d.ts +2 -2
  266. package/esm/browser/style/layout.js +1 -525
  267. package/esm/browser/style/pages.d.ts +1 -1
  268. package/esm/browser/style/pages.js +10 -3
  269. package/esm/browser/style/phone.d.ts +1 -1
  270. package/esm/browser/style/phone.js +6 -2
  271. package/esm/browser/style/shared.d.ts +2 -0
  272. package/esm/browser/style/shared.js +23 -0
  273. package/esm/browser/style/shell.d.ts +1 -1
  274. package/esm/browser/style/shell.js +47 -0
  275. package/esm/browser/style/tasks.d.ts +1 -1
  276. package/esm/browser/style/tasks.js +13 -8
  277. package/esm/browser/style.js +8 -0
  278. package/esm/browser/util/gallery.d.ts +24 -2
  279. package/esm/browser/util/gallery.js +82 -2
  280. package/esm/browser/util/image-copy.d.ts +16 -0
  281. package/esm/browser/util/image-copy.js +57 -0
  282. package/esm/browser/util/message.d.ts +5 -0
  283. package/esm/browser/util/message.js +14 -0
  284. package/esm/browser/util/process.d.ts +6 -2
  285. package/esm/browser/util/process.js +6 -2
  286. package/esm/browser/util/spoken.d.ts +24 -0
  287. package/esm/browser/util/spoken.js +83 -0
  288. package/esm/browser/util/transcript.d.ts +22 -0
  289. package/esm/browser/util/transcript.js +46 -0
  290. package/esm/browser/util/voice.d.ts +5 -1
  291. package/esm/browser/util/voice.js +6 -1
  292. package/esm/browser/workbench-hosts.d.ts +36 -0
  293. package/esm/browser/workbench-hosts.js +120 -0
  294. package/esm/browser/workbench-lists.d.ts +33 -0
  295. package/esm/browser/workbench-lists.js +128 -0
  296. package/esm/browser/workbench-protocol.d.ts +14 -1
  297. package/esm/browser/workbench-services.d.ts +49 -0
  298. package/esm/browser/workbench-services.js +120 -0
  299. package/esm/browser/workbench-util.d.ts +1 -1
  300. package/esm/browser/workbench.d.ts +6 -89
  301. package/esm/browser/workbench.js +26 -336
  302. package/lib/browser/assistant/assistant-ask-book.d.ts +36 -0
  303. package/lib/browser/assistant/assistant-ask-book.js +100 -0
  304. package/lib/browser/assistant/assistant-conversation.d.ts +111 -0
  305. package/lib/browser/assistant/assistant-conversation.js +355 -0
  306. package/lib/browser/assistant/assistant-export.js +6 -7
  307. package/lib/browser/assistant/assistant-extension.d.ts +3 -2
  308. package/lib/browser/assistant/assistant-extension.js +55 -2
  309. package/lib/browser/assistant/assistant-protocol.d.ts +17 -2
  310. package/lib/browser/assistant/assistant-role.d.ts +22 -4
  311. package/lib/browser/assistant/assistant-role.js +30 -8
  312. package/lib/browser/assistant/assistant-state.d.ts +5 -1
  313. package/lib/browser/assistant/assistant-state.js +11 -0
  314. package/lib/browser/assistant/assistant-task-source.js +7 -1
  315. package/lib/browser/assistant/assistant-task-util.d.ts +19 -7
  316. package/lib/browser/assistant/assistant-task-util.js +73 -20
  317. package/lib/browser/assistant/assistant-tasks.d.ts +0 -7
  318. package/lib/browser/assistant/assistant-tasks.js +1 -3
  319. package/lib/browser/assistant/assistant-thread.d.ts +23 -0
  320. package/lib/browser/assistant/assistant-thread.js +144 -0
  321. package/lib/browser/assistant/assistant-view.js +74 -123
  322. package/lib/browser/assistant/assistant.d.ts +33 -105
  323. package/lib/browser/assistant/assistant.js +100 -353
  324. package/lib/browser/assistant/chat-task-source.d.ts +59 -0
  325. package/lib/browser/assistant/chat-task-source.js +111 -0
  326. package/lib/browser/assistant/read-aloud.d.ts +35 -0
  327. package/lib/browser/assistant/read-aloud.js +102 -0
  328. package/lib/browser/assistant/realtime-voice.d.ts +78 -0
  329. package/lib/browser/assistant/realtime-voice.js +324 -0
  330. package/lib/browser/assistant/task-views.d.ts +2 -3
  331. package/lib/browser/assistant/task-views.js +19 -15
  332. package/lib/browser/assistant/voice-call-bar.d.ts +61 -0
  333. package/lib/browser/assistant/voice-call-bar.js +306 -0
  334. package/lib/browser/assistant/voice-call.d.ts +176 -0
  335. package/lib/browser/assistant/voice-call.js +370 -0
  336. package/lib/browser/chat/chat-shown.d.ts +79 -0
  337. package/lib/browser/chat/chat-shown.js +266 -0
  338. package/lib/browser/chat/chat-view.js +2 -1
  339. package/lib/browser/chat/chat.d.ts +4 -68
  340. package/lib/browser/chat/chat.js +3 -251
  341. package/lib/browser/chat/draft-model.d.ts +1 -1
  342. package/lib/browser/components/access-view.js +2 -2
  343. package/lib/browser/components/account-menu.js +1 -1
  344. package/lib/browser/components/app-nav.d.ts +3 -1
  345. package/lib/browser/components/app-nav.js +7 -7
  346. package/lib/browser/components/app-shell-hooks.d.ts +11 -2
  347. package/lib/browser/components/app-shell-hooks.js +26 -5
  348. package/lib/browser/components/app-shell-state.d.ts +81 -0
  349. package/lib/browser/components/app-shell-state.js +502 -0
  350. package/lib/browser/components/app-view.js +120 -326
  351. package/lib/browser/components/asks-badge.d.ts +6 -2
  352. package/lib/browser/components/asks-badge.js +7 -3
  353. package/lib/browser/components/auth-pictures.d.ts +2 -2
  354. package/lib/browser/components/auth-pictures.js +13 -1
  355. package/lib/browser/components/auth-view.d.ts +4 -3
  356. package/lib/browser/components/auth-view.js +53 -4
  357. package/lib/browser/components/chat-asks.d.ts +2 -0
  358. package/lib/browser/components/chat-asks.js +8 -0
  359. package/lib/browser/components/chat-busy.d.ts +33 -0
  360. package/lib/browser/components/chat-busy.js +52 -0
  361. package/lib/browser/components/chat-icon.d.ts +6 -0
  362. package/lib/browser/components/chat-icon.js +17 -1
  363. package/lib/browser/components/chat-list-row.d.ts +85 -0
  364. package/lib/browser/components/chat-list-row.js +236 -0
  365. package/lib/browser/components/chat-list-util.d.ts +167 -0
  366. package/lib/browser/components/chat-list-util.js +338 -0
  367. package/lib/browser/components/chat-list.d.ts +11 -148
  368. package/lib/browser/components/chat-list.js +297 -530
  369. package/lib/browser/components/chat-seen.d.ts +7 -0
  370. package/lib/browser/components/chat-seen.js +58 -10
  371. package/lib/browser/components/composer-addon-util.d.ts +1 -1
  372. package/lib/browser/components/composer-addons.d.ts +1 -1
  373. package/lib/browser/components/composer-attachments.d.ts +12 -0
  374. package/lib/browser/components/composer-attachments.js +64 -0
  375. package/lib/browser/components/composer-box-hooks.d.ts +10 -0
  376. package/lib/browser/components/composer-box-hooks.js +178 -0
  377. package/lib/browser/components/composer-box-protocol.d.ts +109 -0
  378. package/lib/browser/components/composer-box-protocol.js +3 -0
  379. package/lib/browser/components/composer-box.d.ts +1 -95
  380. package/lib/browser/components/composer-box.js +51 -159
  381. package/lib/browser/components/composer-target.d.ts +22 -0
  382. package/lib/browser/components/composer-target.js +46 -0
  383. package/lib/browser/components/composer.d.ts +7 -1
  384. package/lib/browser/components/composer.js +15 -11
  385. package/lib/browser/components/context-menu.js +4 -0
  386. package/lib/browser/components/conversation-find.d.ts +28 -0
  387. package/lib/browser/components/conversation-find.js +188 -0
  388. package/lib/browser/components/conversation-scroll-hooks.js +3 -2
  389. package/lib/browser/components/conversation-scroll-util.d.ts +73 -0
  390. package/lib/browser/components/conversation-scroll-util.js +85 -1
  391. package/lib/browser/components/conversation-scroll.d.ts +1 -35
  392. package/lib/browser/components/conversation-scroll.js +20 -100
  393. package/lib/browser/components/conversation-view.d.ts +9 -0
  394. package/lib/browser/components/conversation-view.js +77 -0
  395. package/lib/browser/components/discover-view.d.ts +3 -2
  396. package/lib/browser/components/discover-view.js +30 -25
  397. package/lib/browser/components/dismiss.js +2 -0
  398. package/lib/browser/components/earlier-messages.d.ts +2 -0
  399. package/lib/browser/components/earlier-messages.js +2 -1
  400. package/lib/browser/components/environment-view.js +49 -0
  401. package/lib/browser/components/folder-picker.d.ts +7 -0
  402. package/lib/browser/components/folder-picker.js +89 -19
  403. package/lib/browser/components/gallery.d.ts +1 -1
  404. package/lib/browser/components/gallery.js +56 -13
  405. package/lib/browser/components/host-tag.js +1 -1
  406. package/lib/browser/components/host-view.d.ts +1 -1
  407. package/lib/browser/components/host-view.js +4 -2
  408. package/lib/browser/components/image-menu.d.ts +12 -0
  409. package/lib/browser/components/image-menu.js +65 -0
  410. package/lib/browser/components/image-viewer.d.ts +3 -2
  411. package/lib/browser/components/image-viewer.js +28 -3
  412. package/lib/browser/components/lightbox.js +2 -0
  413. package/lib/browser/components/link-dialog.js +2 -0
  414. package/lib/browser/components/list-rows.d.ts +3 -1
  415. package/lib/browser/components/list-rows.js +2 -1
  416. package/lib/browser/components/markdown.js +5 -0
  417. package/lib/browser/components/media.d.ts +2 -0
  418. package/lib/browser/components/media.js +17 -1
  419. package/lib/browser/components/message-actions.d.ts +1 -1
  420. package/lib/browser/components/message-actions.js +9 -0
  421. package/lib/browser/components/message-footer.d.ts +3 -1
  422. package/lib/browser/components/message-footer.js +2 -1
  423. package/lib/browser/components/message-images.d.ts +42 -0
  424. package/lib/browser/components/message-images.js +157 -0
  425. package/lib/browser/components/message-list.d.ts +4 -100
  426. package/lib/browser/components/message-list.js +11 -455
  427. package/lib/browser/components/message-menu.js +4 -0
  428. package/lib/browser/components/message-steps.d.ts +22 -0
  429. package/lib/browser/components/message-steps.js +218 -0
  430. package/lib/browser/components/message-user.d.ts +55 -0
  431. package/lib/browser/components/message-user.js +211 -0
  432. package/lib/browser/components/model-picker.d.ts +1 -1
  433. package/lib/browser/components/model-picker.js +2 -0
  434. package/lib/browser/components/moved-notice.d.ts +15 -0
  435. package/lib/browser/components/moved-notice.js +96 -0
  436. package/lib/browser/components/nav-places.d.ts +12 -1
  437. package/lib/browser/components/nav-places.js +12 -3
  438. package/lib/browser/components/notice-center.js +35 -0
  439. package/lib/browser/components/notice-face.js +7 -6
  440. package/lib/browser/components/phone-shell.d.ts +4 -3
  441. package/lib/browser/components/phone-shell.js +59 -67
  442. package/lib/browser/components/plus-menu.d.ts +1 -1
  443. package/lib/browser/components/relay-services.d.ts +6 -1
  444. package/lib/browser/components/relay-services.js +107 -0
  445. package/lib/browser/components/relay-view.js +2 -0
  446. package/lib/browser/components/remote-hosts.d.ts +10 -0
  447. package/lib/browser/components/remote-hosts.js +67 -4
  448. package/lib/browser/components/remote-prompts.js +2 -0
  449. package/lib/browser/components/scan-screen.js +7 -0
  450. package/lib/browser/components/screen-navigator-util.d.ts +29 -0
  451. package/lib/browser/components/screen-navigator-util.js +36 -0
  452. package/lib/browser/components/screen-navigator.d.ts +31 -0
  453. package/lib/browser/components/screen-navigator.js +83 -0
  454. package/lib/browser/components/session-settings.d.ts +1 -1
  455. package/lib/browser/components/session-view.js +157 -7
  456. package/lib/browser/components/settings-choices.d.ts +7 -1
  457. package/lib/browser/components/settings-choices.js +9 -1
  458. package/lib/browser/components/settings-more.d.ts +8 -0
  459. package/lib/browser/components/settings-more.js +299 -0
  460. package/lib/browser/components/settings-parts.d.ts +8 -3
  461. package/lib/browser/components/settings-parts.js +27 -245
  462. package/lib/browser/components/settings-view.js +43 -15
  463. package/lib/browser/components/stop-times.js +1 -0
  464. package/lib/browser/components/surface-flyout.js +2 -0
  465. package/lib/browser/components/unseen-drop.d.ts +10 -4
  466. package/lib/browser/components/unseen-drop.js +9 -8
  467. package/lib/browser/components/use-seen-chats.js +2 -2
  468. package/lib/browser/components/voice-services.d.ts +7 -0
  469. package/lib/browser/components/voice-services.js +173 -0
  470. package/lib/browser/components/voice-talk.d.ts +23 -6
  471. package/lib/browser/components/voice-talk.js +45 -10
  472. package/lib/browser/components/web-composer.d.ts +1 -1
  473. package/lib/browser/components/web-composer.js +2 -2
  474. package/lib/browser/components/web-dialog.js +2 -0
  475. package/lib/browser/device/back-stack.d.ts +89 -11
  476. package/lib/browser/device/back-stack.js +205 -31
  477. package/lib/browser/device/device-protocol.d.ts +1 -1
  478. package/lib/browser/device/device-protocol.js +1 -1
  479. package/lib/browser/device/own-gestures.d.ts +1 -1
  480. package/lib/browser/device/pull-down.js +8 -6
  481. package/lib/browser/device/row-swipe.js +11 -9
  482. package/lib/browser/device/sheet-swipe.d.ts +1 -179
  483. package/lib/browser/device/sheet-swipe.js +16 -452
  484. package/lib/browser/device/swipe-finger.d.ts +32 -0
  485. package/lib/browser/device/swipe-finger.js +87 -0
  486. package/lib/browser/device/swipe-settle.d.ts +53 -0
  487. package/lib/browser/device/swipe-settle.js +176 -0
  488. package/lib/browser/device/swipe-util.d.ts +98 -0
  489. package/lib/browser/device/swipe-util.js +187 -0
  490. package/lib/browser/drafts/drafts-protocol.d.ts +59 -0
  491. package/lib/browser/drafts/drafts-protocol.js +78 -0
  492. package/lib/browser/drafts/drafts.d.ts +22 -0
  493. package/lib/browser/drafts/drafts.js +94 -0
  494. package/lib/browser/drafts/use-composer-draft.d.ts +21 -0
  495. package/lib/browser/drafts/use-composer-draft.js +146 -0
  496. package/lib/browser/extension/icons.js +24 -3
  497. package/lib/browser/extension/web-api-components.d.ts +13 -0
  498. package/lib/browser/extension/web-api-contributions.d.ts +125 -0
  499. package/lib/browser/extension/web-extension-api.d.ts +88 -5
  500. package/lib/browser/extension/web-extension-context.d.ts +5 -0
  501. package/lib/browser/extension/web-extension-context.js +62 -9
  502. package/lib/browser/extension/web-extension-protocol.d.ts +19 -1
  503. package/lib/browser/extension/web-extension-protocol.js +3 -0
  504. package/lib/browser/extension/web-extension-run.d.ts +5 -2
  505. package/lib/browser/extension/web-extension-run.js +13 -1
  506. package/lib/browser/extension/web-extensions-running.d.ts +94 -0
  507. package/lib/browser/extension/web-extensions-running.js +343 -0
  508. package/lib/browser/extension/web-extensions.d.ts +6 -82
  509. package/lib/browser/extension/web-extensions.js +7 -316
  510. package/lib/browser/extension/web-pages.js +1 -0
  511. package/lib/browser/extension/web-session-notices.js +8 -3
  512. package/lib/browser/extension/web-tasks.d.ts +2 -0
  513. package/lib/browser/extension/web-tasks.js +6 -0
  514. package/lib/browser/extension/web-view-util.d.ts +2 -1
  515. package/lib/browser/extension/web-view-util.js +4 -1
  516. package/lib/browser/gateway/console-parts.d.ts +4 -12
  517. package/lib/browser/gateway/console-parts.js +42 -126
  518. package/lib/browser/gateway/console-tenant.js +3 -2
  519. package/lib/browser/gateway/console-trend.d.ts +12 -0
  520. package/lib/browser/gateway/console-trend.js +151 -0
  521. package/lib/browser/gateway/console-util.js +2 -2
  522. package/lib/browser/gateway/console-view.js +48 -2
  523. package/lib/browser/i18n/locales.d.ts +170 -6
  524. package/lib/browser/i18n/messages-ja.js +171 -7
  525. package/lib/browser/i18n/messages-zh-tw.js +171 -7
  526. package/lib/browser/i18n/messages.d.ts +167 -3
  527. package/lib/browser/i18n/messages.js +342 -14
  528. package/lib/browser/index.d.ts +17 -0
  529. package/lib/browser/index.js +17 -0
  530. package/lib/browser/notices/notices-protocol.d.ts +12 -0
  531. package/lib/browser/notices/notices.js +7 -4
  532. package/lib/browser/offline/device-values.d.ts +2 -0
  533. package/lib/browser/offline/device-values.js +6 -1
  534. package/lib/browser/screen/page-answers.d.ts +43 -0
  535. package/lib/browser/screen/page-answers.js +93 -0
  536. package/lib/browser/screen/screen-protocol.d.ts +113 -0
  537. package/lib/browser/screen/screen-protocol.js +48 -0
  538. package/lib/browser/screen/screen.d.ts +21 -0
  539. package/lib/browser/screen/screen.js +125 -0
  540. package/lib/browser/screen/use-screen-part.d.ts +7 -0
  541. package/lib/browser/screen/use-screen-part.js +50 -0
  542. package/lib/browser/settings/settings-protocol.d.ts +5 -1
  543. package/lib/browser/settings/settings-protocol.js +5 -1
  544. package/lib/browser/share/shared-extensions.d.ts +30 -0
  545. package/lib/browser/share/shared-extensions.js +181 -0
  546. package/lib/browser/share/shared-link.d.ts +12 -0
  547. package/lib/browser/share/shared-link.js +41 -0
  548. package/lib/browser/share/shared-page.d.ts +6 -0
  549. package/lib/browser/share/shared-page.js +173 -0
  550. package/lib/browser/state/state-protocol.d.ts +14 -0
  551. package/lib/browser/state/state-protocol.js +20 -1
  552. package/lib/browser/state/state.d.ts +10 -2
  553. package/lib/browser/state/state.js +18 -2
  554. package/lib/browser/style/base.d.ts +1 -1
  555. package/lib/browser/style/base.js +4 -0
  556. package/lib/browser/style/chat-list.d.ts +3 -0
  557. package/lib/browser/style/chat-list.js +156 -0
  558. package/lib/browser/style/conversation-column.d.ts +3 -0
  559. package/lib/browser/style/conversation-column.js +253 -0
  560. package/lib/browser/style/conversation.d.ts +1 -1
  561. package/lib/browser/style/conversation.js +24 -8
  562. package/lib/browser/style/dialogs.d.ts +3 -0
  563. package/lib/browser/style/dialogs.js +166 -0
  564. package/lib/browser/style/layout.d.ts +2 -2
  565. package/lib/browser/style/layout.js +1 -525
  566. package/lib/browser/style/pages.d.ts +1 -1
  567. package/lib/browser/style/pages.js +10 -3
  568. package/lib/browser/style/phone.d.ts +1 -1
  569. package/lib/browser/style/phone.js +7 -3
  570. package/lib/browser/style/shared.d.ts +3 -0
  571. package/lib/browser/style/shared.js +26 -0
  572. package/lib/browser/style/shell.d.ts +1 -1
  573. package/lib/browser/style/shell.js +47 -0
  574. package/lib/browser/style/tasks.d.ts +1 -1
  575. package/lib/browser/style/tasks.js +13 -8
  576. package/lib/browser/style.js +8 -0
  577. package/lib/browser/util/gallery.d.ts +24 -2
  578. package/lib/browser/util/gallery.js +82 -2
  579. package/lib/browser/util/image-copy.d.ts +17 -0
  580. package/lib/browser/util/image-copy.js +60 -0
  581. package/lib/browser/util/message.d.ts +5 -0
  582. package/lib/browser/util/message.js +14 -0
  583. package/lib/browser/util/process.d.ts +6 -2
  584. package/lib/browser/util/process.js +6 -2
  585. package/lib/browser/util/spoken.d.ts +25 -0
  586. package/lib/browser/util/spoken.js +86 -0
  587. package/lib/browser/util/transcript.d.ts +23 -0
  588. package/lib/browser/util/transcript.js +49 -0
  589. package/lib/browser/util/voice.d.ts +5 -1
  590. package/lib/browser/util/voice.js +6 -1
  591. package/lib/browser/workbench-hosts.d.ts +37 -0
  592. package/lib/browser/workbench-hosts.js +124 -0
  593. package/lib/browser/workbench-lists.d.ts +34 -0
  594. package/lib/browser/workbench-lists.js +132 -0
  595. package/lib/browser/workbench-protocol.d.ts +14 -1
  596. package/lib/browser/workbench-services.d.ts +50 -0
  597. package/lib/browser/workbench-services.js +124 -0
  598. package/lib/browser/workbench-util.d.ts +1 -1
  599. package/lib/browser/workbench.d.ts +6 -89
  600. package/lib/browser/workbench.js +23 -333
  601. package/package.json +7 -7
@@ -1,10 +1,12 @@
1
- import { X } from 'lucide-react';
1
+ import { ArrowRight, Undo2, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { createPortal } from 'react-dom';
4
+ import { useBackLayer } from '../device/back-stack.js';
4
5
  import { useNotices } from '../hooks.js';
5
6
  import { useT } from '../i18n/use-t.js';
6
7
  import { NoticesUtil } from '../notices/notices.js';
7
8
  import { LEVEL_ICONS } from './callout.js';
9
+ import { Face } from './face.js';
8
10
  import { Icon, IconButton } from './icon.js';
9
11
  import { NoticeFace } from './notice-face.js';
10
12
  import { TerminalArt } from './terminal-art.js';
@@ -73,6 +75,34 @@ function SessionToast({ notice, leaving, leave, hold, }) {
73
75
  } }, action.label))))),
74
76
  React.createElement(IconButton, { icon: X, label: t('ta.dismiss'), className: "ta-toast-close", onClick: leave })));
75
77
  }
78
+ /**
79
+ * What Ta did for the user: its face, what it did as the head, what changed under it a row each (before, an arrow, after),
80
+ * and Undo beside the head, where the eye already is.
81
+ */
82
+ function TaToast({ notice, leaving, leave, hold }) {
83
+ var _a;
84
+ const t = useT();
85
+ const action = notice.action;
86
+ return (React.createElement("div", { className: `ta-toast ta-toast-ta${leaving ? ' ta-leaving' : ''}`, role: "status", ...hold },
87
+ React.createElement("span", { className: "ta-toast-face" },
88
+ React.createElement(Face, { double: true, size: 32 })),
89
+ React.createElement("div", { className: "ta-toast-text" },
90
+ React.createElement("div", { className: "ta-toast-title" }, notice.message),
91
+ (_a = notice.changes) === null || _a === void 0 ? void 0 :
92
+ _a.map((change, index) => (React.createElement("div", { key: index, className: "ta-toast-change" },
93
+ change.label && React.createElement("span", { className: "ta-toast-change-label" }, change.label),
94
+ change.before !== undefined && (React.createElement(React.Fragment, null,
95
+ React.createElement("span", { className: "ta-toast-change-before" }, change.before),
96
+ React.createElement(Icon, { icon: ArrowRight, size: 12, className: "ta-toast-change-arrow" }))),
97
+ React.createElement("span", { className: `ta-toast-change-after${change.label || change.before !== undefined ? '' : ' ta-toast-change-name'}` }, change.after))))),
98
+ action && (React.createElement("button", { type: "button", className: "ta-toast-undo", onClick: () => {
99
+ action.run();
100
+ leave();
101
+ } },
102
+ React.createElement(Icon, { icon: Undo2, size: 14 }),
103
+ action.label)),
104
+ React.createElement(IconButton, { icon: X, label: t('ta.dismiss'), className: "ta-toast-close", onClick: leave })));
105
+ }
76
106
  function Toast({ notice, notices }) {
77
107
  var _a;
78
108
  const t = useT();
@@ -82,6 +112,9 @@ function Toast({ notice, notices }) {
82
112
  setTimeout(() => notices.dismiss(notice.id), LEAVE_MS);
83
113
  }, [notices, notice.id]);
84
114
  const hold = useLifetime(notice, leave);
115
+ if (notice.ta) {
116
+ return React.createElement(TaToast, { notice: notice, leaving: leaving, leave: leave, hold: hold });
117
+ }
85
118
  if (notice.from) {
86
119
  return React.createElement(SessionToast, { notice: notice, leaving: leaving, leave: leave, hold: hold });
87
120
  }
@@ -109,6 +142,7 @@ function ConfirmDialog({ request, notices }) {
109
142
  var _a;
110
143
  const t = useT();
111
144
  const answer = (confirmed) => notices.answer(request.id, confirmed);
145
+ useBackLayer(true, () => answer(false));
112
146
  React.useEffect(() => {
113
147
  const onKey = (event) => event.key === 'Escape' && notices.answer(request.id, false);
114
148
  document.addEventListener('keydown', onKey);
@@ -129,6 +163,7 @@ function InputDialog({ request, notices }) {
129
163
  const t = useT();
130
164
  const [value, setValue] = React.useState((_a = request.value) !== null && _a !== void 0 ? _a : '');
131
165
  const cancel = () => notices.answerInput(request.id, undefined);
166
+ useBackLayer(true, cancel);
132
167
  const submit = (event) => {
133
168
  event === null || event === void 0 ? void 0 : event.preventDefault();
134
169
  notices.answerInput(request.id, value);
@@ -2,7 +2,8 @@ import * as React from 'react';
2
2
  import { useAssistant } from '../assistant/assistant-hooks.js';
3
3
  import { SessionAvatars } from '../extension/extension-view.js';
4
4
  import { useWorkbench } from '../hooks.js';
5
- import { ChatAvatar, ChatListUtil } from './chat-list.js';
5
+ import { ChatAvatar } from './chat-list-row.js';
6
+ import { ChatListUtil } from './chat-list-util.js';
6
7
  /**
7
8
  * The face a conversation has in the lists, for a notice it gave (NoticeFrom): the double's, an agent's, else the
8
9
  * letter of its directory in its color. Nothing while the lists do not have it.
@@ -47,7 +47,7 @@ export interface PhoneShellProps {
47
47
  }
48
48
  /** What comes out over the first tab: the launcher (pulled down), the board (from the right). */
49
49
  export type PhoneSurface = 'launcher' | 'board';
50
- /** A screen pushed over the screen of the phone (PhoneStack): the shell closes it with a swipe or the back of the system. */
50
+ /** A page pushed (PhoneStack), for what shows that one is: the head of an extension's page, the launcher. */
51
51
  export interface StackLayer {
52
52
  close(): void;
53
53
  }
@@ -78,8 +78,9 @@ export interface PhoneStackProps {
78
78
  /**
79
79
  * A screen pushed over the screen of a phone, as iOS pushes a page of its settings over their list: it slides
80
80
  * in from the right and goes back with its button, a swipe from the left edge or the back of the system, as
81
- * the screen under it does (PhoneShell follows the finger and keeps it in the history). Outside a PhoneShell
82
- * it only slides. In the page of an extension (`ui.Stack`), the head of the page shows back while it is open.
81
+ * the screen under it does, in a tab too (each is a layer of BackLayers; only the top one has the swipe).
82
+ * Outside a PhoneShell it only slides, and the back of the system closes it on a touch screen. In the page of
83
+ * an extension (`ui.Stack`), the head of the page shows back while it is open.
83
84
  */
84
85
  export declare function PhoneStack({ base, top, open, onClose }: PhoneStackProps): React.JSX.Element;
85
86
  export declare namespace PhoneUtil {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useBackStack } from '../device/back-stack.js';
2
+ import { BackLayerContext, useBackLayer, useNoBackLayer } from '../device/back-stack.js';
3
3
  import { useDevice } from '../device/device.js';
4
4
  import { DeviceMotion } from '../device/device-protocol.js';
5
5
  import { useHeld } from '../device/hold.js';
@@ -22,7 +22,10 @@ function useWarm(wanted) {
22
22
  }, [wanted, warm]);
23
23
  return warm;
24
24
  }
25
+ /** What the launcher pushed over itself: the shell moves the home out of its way. */
25
26
  const PhoneStackContext = React.createContext(undefined);
27
+ /** Inside the shell of a phone, where a PhoneStack closes with a swipe from the left edge. */
28
+ const InPhoneContext = React.createContext(false);
26
29
  /** The page of an extension a PhoneStack is in (PageView): its head shows back while one is pushed, on any device. */
27
30
  export const PageStackContext = React.createContext(undefined);
28
31
  const ArrivingContext = React.createContext(false);
@@ -61,16 +64,20 @@ export function PhoneShell(props) {
61
64
  const t = useT();
62
65
  const touch = useDevice(device => device.touch);
63
66
  const { screenOpen, workbenchOpen, onBack, onWorkbench, surface, onSurface, launcher, board } = props;
64
- const [stack, setStack] = React.useState();
65
- const stacked = screenOpen && !!stack;
66
67
  const home = !screenOpen && !workbenchOpen;
68
+ // The layers of the shell, in the one list of the page (BackLayers): the back of the system closes the top one, and
69
+ // only the top one has its swipe, so that none moves under a page pushed, a dialog or a menu.
70
+ const screenLayer = useBackLayer(screenOpen, onBack);
71
+ const surfaceLayer = useBackLayer(!!surface, () => onSurface(undefined));
72
+ const workbenchLayer = useBackLayer(workbenchOpen, () => onWorkbench(false));
73
+ const bare = useNoBackLayer();
67
74
  // What the launcher pushed over itself (its search page): the home goes down out of the way, and it goes back as a screen's.
68
75
  const [launcherStack, setLauncherStack] = React.useState();
69
76
  const launcherStacked = home && surface === 'launcher' && !!launcherStack;
70
77
  const warmLauncher = useWarm(!!launcher) || surface === 'launcher';
71
78
  const warmBoard = useWarm(!!board) || surface === 'board';
72
79
  usePullDown({
73
- enabled: touch && !!launcher && home && surface !== 'board' && !launcherStacked,
80
+ enabled: touch && !!launcher && home && (surface === 'launcher' ? surfaceLayer.top : !surface && bare),
74
81
  open: surface === 'launcher',
75
82
  setOpen: open => onSurface(open ? 'launcher' : undefined),
76
83
  sheet: '.ta-phone-home',
@@ -80,7 +87,7 @@ export function PhoneShell(props) {
80
87
  peek: '.ta-phone-peek',
81
88
  });
82
89
  useSheetSwipe({
83
- enabled: touch && !!board && home && surface !== 'launcher',
90
+ enabled: touch && !!board && home && (surface === 'board' ? surfaceLayer.top : !surface && bare),
84
91
  open: surface === 'board',
85
92
  setOpen: open => onSurface(open ? 'board' : undefined),
86
93
  // From the left, as a swipe to the right brings it: a row swipes to the left, so only an open one, which a
@@ -96,7 +103,7 @@ export function PhoneShell(props) {
96
103
  });
97
104
  const arriving = useArriving(screenOpen);
98
105
  useSheetSwipe({
99
- enabled: touch && screenOpen && !workbenchOpen && !stacked,
106
+ enabled: touch && screenLayer.top,
100
107
  open: screenOpen,
101
108
  setOpen: open => !open && onBack(),
102
109
  side: 'right',
@@ -106,31 +113,9 @@ export function PhoneShell(props) {
106
113
  under: '.ta-phone-home',
107
114
  scrim: '.ta-phone-dim[data-for="screen"]',
108
115
  });
109
- useSheetSwipe({
110
- enabled: touch && stacked && !workbenchOpen,
111
- open: stacked,
112
- setOpen: open => !open && (stack === null || stack === void 0 ? void 0 : stack.close()),
113
- side: 'right',
114
- opensFrom: 'never',
115
- closesFrom: 'edge',
116
- sheet: '.ta-phone-screen .ta-phone-stack-top',
117
- under: '.ta-phone-screen .ta-phone-stack-base',
118
- scrim: '.ta-phone-screen .ta-phone-stack > .ta-phone-dim',
119
- });
120
- useSheetSwipe({
121
- enabled: touch && launcherStacked,
122
- open: launcherStacked,
123
- setOpen: open => !open && (launcherStack === null || launcherStack === void 0 ? void 0 : launcherStack.close()),
124
- side: 'right',
125
- opensFrom: 'never',
126
- closesFrom: 'edge',
127
- sheet: '.ta-phone-launcher .ta-phone-stack-top',
128
- under: '.ta-phone-launcher .ta-phone-stack-base',
129
- scrim: '.ta-phone-launcher .ta-phone-stack > .ta-phone-dim',
130
- });
131
116
  useSheetSwipe({
132
117
  // Put away over a page of a tab too (its head has the button); brought out by a swipe only over a conversation.
133
- enabled: touch && !!props.workbench && (screenOpen || workbenchOpen),
118
+ enabled: touch && !!props.workbench && (workbenchOpen ? workbenchLayer.top : screenLayer.top),
134
119
  open: workbenchOpen,
135
120
  setOpen: onWorkbench,
136
121
  side: 'right',
@@ -142,52 +127,58 @@ export function PhoneShell(props) {
142
127
  // A row swipes to the left as the workbench comes: over one, the workbench comes only from the edge.
143
128
  edgeOver: '.ta-swipe-row[data-swipeable]',
144
129
  });
145
- // The layers in the order they stack, the top first: the workbench, what is pushed over the screen or the launcher, then
146
- // the screen or what came out over the first tab. Going back closes those past the depth the history is at.
147
- const layers = [
148
- [workbenchOpen, () => onWorkbench(false)],
149
- [launcherStacked, () => launcherStack === null || launcherStack === void 0 ? void 0 : launcherStack.close()],
150
- [stacked, () => stack === null || stack === void 0 ? void 0 : stack.close()],
151
- [!!surface && home, () => onSurface(undefined)],
152
- [screenOpen, onBack],
153
- ];
154
- const open = layers.filter(([shown]) => shown);
155
- useBackStack(open.length, depth => {
156
- for (const [, close] of open.slice(0, Math.max(0, open.length - depth))) {
157
- close();
158
- }
159
- });
160
- return (React.createElement("div", { className: "ta-app ta-phone", "data-screen": screenOpen ? '' : undefined, "data-workbench": workbenchOpen ? '' : undefined, "data-surface": surface, "data-surface-stack": launcherStacked ? '' : undefined },
161
- launcher && (React.createElement("div", { className: "ta-phone-launcher", inert: surface !== 'launcher' },
162
- React.createElement("div", { className: "ta-phone-launcher-body" },
163
- React.createElement(PhoneStackContext.Provider, { value: setLauncherStack }, warmLauncher && launcher)))),
164
- React.createElement("div", { className: "ta-phone-home", inert: screenOpen || workbenchOpen || !!surface },
165
- React.createElement("div", { className: "ta-phone-page" }, props.home),
166
- React.createElement(TabBar, { tabs: props.tabs, tab: props.tab, onTab: props.onTab })),
167
- launcher && (React.createElement("button", { type: "button", className: "ta-phone-peek", "aria-label": t('ta.launcher.back'), tabIndex: surface === 'launcher' ? 0 : -1, onClick: () => onSurface(undefined) })),
168
- board && (React.createElement(React.Fragment, null,
169
- React.createElement("div", { className: "ta-phone-dim", "data-for": "board" }),
170
- React.createElement("div", { className: "ta-phone-board", inert: surface !== 'board' }, warmBoard && board))),
171
- React.createElement("div", { className: "ta-phone-dim", "data-for": "screen" }),
172
- React.createElement("div", { className: "ta-phone-screen", inert: !screenOpen || workbenchOpen },
173
- React.createElement("main", { className: "ta-main" },
174
- React.createElement(PhoneStackContext.Provider, { value: setStack },
175
- React.createElement(ArrivingContext.Provider, { value: arriving }, props.screen)))),
176
- props.workbench && React.createElement("div", { className: "ta-phone-dim", "data-for": "workbench" }),
177
- props.workbench,
178
- props.children));
130
+ return (React.createElement(InPhoneContext.Provider, { value: true },
131
+ React.createElement("div", { className: "ta-app ta-phone", "data-screen": screenOpen ? '' : undefined, "data-workbench": workbenchOpen ? '' : undefined, "data-surface": surface, "data-surface-stack": launcherStacked ? '' : undefined },
132
+ launcher && (React.createElement("div", { className: "ta-phone-launcher", inert: surface !== 'launcher' },
133
+ React.createElement("div", { className: "ta-phone-launcher-body" },
134
+ React.createElement(BackLayerContext.Provider, { value: surfaceLayer.layer },
135
+ React.createElement(PhoneStackContext.Provider, { value: setLauncherStack }, warmLauncher && launcher))))),
136
+ React.createElement("div", { className: "ta-phone-home", inert: screenOpen || workbenchOpen || !!surface },
137
+ React.createElement("div", { className: "ta-phone-page" }, props.home),
138
+ React.createElement(TabBar, { tabs: props.tabs, tab: props.tab, onTab: props.onTab })),
139
+ launcher && (React.createElement("button", { type: "button", className: "ta-phone-peek", "aria-label": t('ta.launcher.back'), tabIndex: surface === 'launcher' ? 0 : -1, onClick: () => onSurface(undefined) })),
140
+ board && (React.createElement(React.Fragment, null,
141
+ React.createElement("div", { className: "ta-phone-dim", "data-for": "board" }),
142
+ React.createElement("div", { className: "ta-phone-board", inert: surface !== 'board' },
143
+ React.createElement(BackLayerContext.Provider, { value: surfaceLayer.layer }, warmBoard && board)))),
144
+ React.createElement("div", { className: "ta-phone-dim", "data-for": "screen" }),
145
+ React.createElement("div", { className: "ta-phone-screen", inert: !screenOpen || workbenchOpen },
146
+ React.createElement("main", { className: "ta-main" },
147
+ React.createElement(BackLayerContext.Provider, { value: screenLayer.layer },
148
+ React.createElement(ArrivingContext.Provider, { value: arriving }, props.screen)))),
149
+ props.workbench && React.createElement("div", { className: "ta-phone-dim", "data-for": "workbench" }),
150
+ React.createElement(BackLayerContext.Provider, { value: workbenchLayer.layer }, props.workbench),
151
+ props.children)));
179
152
  }
180
153
  /**
181
154
  * A screen pushed over the screen of a phone, as iOS pushes a page of its settings over their list: it slides
182
155
  * in from the right and goes back with its button, a swipe from the left edge or the back of the system, as
183
- * the screen under it does (PhoneShell follows the finger and keeps it in the history). Outside a PhoneShell
184
- * it only slides. In the page of an extension (`ui.Stack`), the head of the page shows back while it is open.
156
+ * the screen under it does, in a tab too (each is a layer of BackLayers; only the top one has the swipe).
157
+ * Outside a PhoneShell it only slides, and the back of the system closes it on a touch screen. In the page of
158
+ * an extension (`ui.Stack`), the head of the page shows back while it is open.
185
159
  */
186
160
  export function PhoneStack({ base, top, open, onClose }) {
161
+ const inPhone = React.useContext(InPhoneContext);
187
162
  const register = React.useContext(PhoneStackContext);
188
163
  const page = React.useContext(PageStackContext);
164
+ const touch = useDevice(device => device.touch);
189
165
  const close = React.useRef(onClose);
190
166
  close.current = onClose;
167
+ // A layer of the page, wherever it is (a tab, the screen, the launcher, another PhoneStack): the back closes it.
168
+ const back = useBackLayer(open, onClose);
169
+ const id = React.useId();
170
+ const of = `.ta-phone-stack[data-stack="${id}"]`;
171
+ useSheetSwipe({
172
+ enabled: inPhone && touch && back.top,
173
+ open,
174
+ setOpen: shown => !shown && close.current(),
175
+ side: 'right',
176
+ opensFrom: 'never',
177
+ closesFrom: 'edge',
178
+ sheet: `${of} > .ta-phone-stack-top`,
179
+ under: `${of} > .ta-phone-stack-base`,
180
+ scrim: `${of} > .ta-phone-dim`,
181
+ });
191
182
  React.useEffect(() => {
192
183
  const registers = [register, page].filter((each) => !!each);
193
184
  if (!open || registers.length === 0) {
@@ -203,10 +194,11 @@ export function PhoneStack({ base, top, open, onClose }) {
203
194
  }
204
195
  };
205
196
  }, [open, register, page]);
206
- return (React.createElement("div", { className: "ta-phone-stack", "data-open": open ? '' : undefined },
197
+ return (React.createElement("div", { className: "ta-phone-stack", "data-open": open ? '' : undefined, "data-stack": id },
207
198
  React.createElement("div", { className: "ta-phone-stack-base", inert: open }, base),
208
199
  React.createElement("div", { className: "ta-phone-dim" }),
209
- React.createElement("div", { className: "ta-phone-stack-top", inert: !open }, top)));
200
+ React.createElement("div", { className: "ta-phone-stack-top", inert: !open },
201
+ React.createElement(BackLayerContext.Provider, { value: back.layer }, top))));
210
202
  }
211
203
  function TabBar({ tabs, tab, onTab }) {
212
204
  const t = useT();
@@ -229,7 +221,7 @@ function TabBar({ tabs, tab, onTab }) {
229
221
  return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? again(item.id, event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu ? event => { var _a; return openMenu(event, (_a = item.menu) !== null && _a !== void 0 ? _a : []); } : undefined, ...held(item.hold) },
230
222
  React.createElement("span", { className: "ta-tabbar-icon" },
231
223
  item.double ? React.createElement(DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
232
- item.asks ? React.createElement(AsksBadge, { count: item.asks }) : item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll })),
224
+ item.asks ? (React.createElement(AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
233
225
  React.createElement("span", null, item.label)));
234
226
  }),
235
227
  menu));
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ComposerAction } from './composer-box.js';
2
+ import type { ComposerAction } from './composer-box-protocol.js';
3
3
  export declare namespace PlusMenuUtil {
4
4
  /** Tiles on a page of the grid: four to a row, two rows, as WeChat's + panel; more go to the next page, which a swipe shows. */
5
5
  const COLUMNS = 4;
@@ -1,4 +1,4 @@
1
- import { type TaRelayFeature, type TaRelayProbe, type TaRelayService, type TaRelayTypeInfo } from '@celljs/ta-protocol';
1
+ import { type TaJoinedDeployment, type TaRelayFeature, type TaRelayProbe, type TaRelayService, type TaRelayTypeInfo } from '@celljs/ta-protocol';
2
2
  import { type LucideIcon } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useT } from '../i18n/use-t.js';
@@ -11,6 +11,11 @@ export declare namespace RelayServicesUtil {
11
11
  function serves(service: TaRelayService, feature: TaRelayFeature): boolean;
12
12
  /** The icon of a service: the official relay, a relay, a folder, a store by the icon its package gave its type. */
13
13
  function icon(service: TaRelayService, types?: readonly TaRelayTypeInfo[]): LucideIcon;
14
+ /** What a deployment is called: its name, else the host of the address it was joined by. */
15
+ function deploymentName(deployment: TaJoinedDeployment): string;
16
+ function host(url: string): string;
17
+ /** A name for the cloud workspace of a deployment's gateway (ta://<name>): its first label, as TaLocation takes it. */
18
+ function cloudName(gateway: string): string;
14
19
  function iconNamed(name: string | undefined): LucideIcon;
15
20
  /** What a relay shows under its name: where it is, whether it answers, what it keeps. */
16
21
  function line(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
@@ -1,9 +1,10 @@
1
- import { TaPackageTextUtil } from '@celljs/ta-protocol';
2
- import { Cloud, Database, FileJson, Folder, GitBranch, HardDrive, Plus, Server, ShieldCheck, Trash2 } from 'lucide-react';
1
+ import { TaPackageTextUtil, } from '@celljs/ta-protocol';
2
+ import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, Server, ShieldCheck, Trash2, } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useNotices, useWorkbench } from '../hooks.js';
5
5
  import { useLanguage, useT } from '../i18n/use-t.js';
6
6
  import { Icon, IconButton } from './icon.js';
7
+ import { AddCloudHost } from './remote-hosts.js';
7
8
  import { Row } from './settings-controls.js';
8
9
  /** The features that go through a relay, in the order the settings list them. */
9
10
  const FEATURES = ['devices', 'share', 'rooms', 'sync'];
@@ -46,6 +47,31 @@ export var RelayServicesUtil;
46
47
  return iconNamed((_a = types.find(each => each.type === service.type)) === null || _a === void 0 ? void 0 : _a.icon);
47
48
  }
48
49
  RelayServicesUtil.icon = icon;
50
+ /** What a deployment is called: its name, else the host of the address it was joined by. */
51
+ function deploymentName(deployment) {
52
+ var _a;
53
+ return (_a = deployment.name) !== null && _a !== void 0 ? _a : host(deployment.url);
54
+ }
55
+ RelayServicesUtil.deploymentName = deploymentName;
56
+ function host(url) {
57
+ try {
58
+ return new URL(url).host;
59
+ }
60
+ catch (_a) {
61
+ return url;
62
+ }
63
+ }
64
+ RelayServicesUtil.host = host;
65
+ /** A name for the cloud workspace of a deployment's gateway (ta://<name>): its first label, as TaLocation takes it. */
66
+ function cloudName(gateway) {
67
+ var _a;
68
+ const first = ((_a = host(gateway).split(/[.:]/)[0]) !== null && _a !== void 0 ? _a : '')
69
+ .toLowerCase()
70
+ .replace(/[^a-z0-9-]+/g, '-')
71
+ .replace(/^-+|-+$/g, '');
72
+ return /^[a-z0-9]/.test(first) ? first.slice(0, 40) : 'cloud';
73
+ }
74
+ RelayServicesUtil.cloudName = cloudName;
49
75
  function iconNamed(name) {
50
76
  return name === 'Database' ? Database : name === 'GitBranch' ? GitBranch : name === 'HardDrive' ? HardDrive : name === 'Server' ? Server : Cloud;
51
77
  }
@@ -162,6 +188,14 @@ export function RelayServices() {
162
188
  const used = new Set(Object.values(relays.use));
163
189
  const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
164
190
  return (React.createElement(React.Fragment, null,
191
+ React.createElement(Deployment, { relays: relays, changed: listed => {
192
+ var _a;
193
+ setRelays(listed);
194
+ const id = (_a = listed.deployment) === null || _a === void 0 ? void 0 : _a.relay;
195
+ if (id) {
196
+ void bench.relay.probeRelay(id).then(probe => setProbes(before => ({ ...before, [id]: probe })));
197
+ }
198
+ } }),
165
199
  relays.error && React.createElement(Row, { label: t('ta.relays.broken'), description: relays.error }),
166
200
  FEATURES.map(feature => { var _a; return (React.createElement(Row, { key: feature, label: t(`ta.relays.feature.${feature}`), description: t(`ta.relays.feature.${feature}Hint`) },
167
201
  React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
@@ -195,6 +229,79 @@ export function RelayServices() {
195
229
  t('ta.relays.addButton')))),
196
230
  React.createElement(Row, { icon: FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
197
231
  }
232
+ /**
233
+ * A deployment of Ta, inside a company or outside it (docs/design/ta-deploy.md 8): joined by the address of any of its
234
+ * services, its relay is the default of what is new, and its gateway gives a Ta in the cloud to open, or its sandbox as a
235
+ * cloud workspace here. Joined, it shows what it is and how to leave it.
236
+ */
237
+ function Deployment({ relays, changed }) {
238
+ const t = useT();
239
+ const [, bench] = useWorkbench();
240
+ const [, notices] = useNotices();
241
+ const [url, setUrl] = React.useState('');
242
+ const [busy, setBusy] = React.useState(false);
243
+ const [clouds, setClouds] = React.useState();
244
+ const joined = relays.deployment;
245
+ const gateway = joined === null || joined === void 0 ? void 0 : joined.gateway;
246
+ const readClouds = React.useCallback(async () => {
247
+ const hosts = await bench.remote.listHosts();
248
+ setClouds(hosts.filter(host => host.source === 'cloud' && host.url).map(host => host.url));
249
+ }, [bench]);
250
+ React.useEffect(() => {
251
+ if (gateway) {
252
+ readClouds().catch(() => setClouds([]));
253
+ }
254
+ }, [gateway, readClouds]);
255
+ const act = async (action) => {
256
+ setBusy(true);
257
+ try {
258
+ const listed = await action();
259
+ changed(listed);
260
+ return listed;
261
+ }
262
+ catch (error) {
263
+ notices.error(error);
264
+ return undefined;
265
+ }
266
+ finally {
267
+ setBusy(false);
268
+ }
269
+ };
270
+ if (!joined) {
271
+ return (React.createElement(Row, { label: t('ta.deploy.join'), description: t('ta.deploy.joinHint'), stacked: true },
272
+ React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
273
+ event.preventDefault();
274
+ void act(() => bench.relay.joinDeployment(url.trim())).then(listed => {
275
+ if (listed === null || listed === void 0 ? void 0 : listed.deployment) {
276
+ setUrl('');
277
+ notices.notify(t('ta.deploy.joined', { name: RelayServicesUtil.deploymentName(listed.deployment) }), { level: 'success' });
278
+ }
279
+ });
280
+ } },
281
+ React.createElement("input", { className: "ta-input", value: url, type: "url", inputMode: "url", placeholder: "https://ta.example.com", "aria-label": t('ta.deploy.join'), spellCheck: false, autoCapitalize: "off", onChange: event => setUrl(event.target.value) }),
282
+ React.createElement("button", { type: "submit", className: `ta-button${busy ? ' ta-busy' : ''}`, disabled: !url.trim() || busy },
283
+ busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
284
+ React.createElement("span", null, t('ta.deploy.joinButton'))))));
285
+ }
286
+ const relay = relays.relays.find(each => each.id === joined.relay);
287
+ const parts = [
288
+ (relay === null || relay === void 0 ? void 0 : relay.url) ? t('ta.deploy.relay', { host: RelayServicesUtil.host(relay.url) }) : undefined,
289
+ gateway ? t('ta.deploy.gateway', { host: RelayServicesUtil.host(gateway) }) : undefined,
290
+ ].filter(Boolean);
291
+ const added = gateway && (clouds === null || clouds === void 0 ? void 0 : clouds.some(each => RelayServicesUtil.host(each) === RelayServicesUtil.host(gateway)));
292
+ return (React.createElement(React.Fragment, null,
293
+ React.createElement(Row, { icon: Building2, label: RelayServicesUtil.deploymentName(joined), description: [t('ta.deploy.joinedLine'), ...parts].join(' · ') },
294
+ React.createElement("button", { type: "button", className: `ta-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void act(() => bench.relay.leaveDeployment()) },
295
+ busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
296
+ React.createElement("span", null, t('ta.deploy.leave')))),
297
+ gateway && (React.createElement(Row, { label: t('ta.deploy.cloud'), description: added ? t('ta.deploy.cloudAdded') : t('ta.deploy.cloudHint'), stacked: true },
298
+ React.createElement("div", { className: "ta-deploy-cloud" },
299
+ React.createElement("a", { className: "ta-button", href: gateway, target: "_blank", rel: "noreferrer noopener" },
300
+ React.createElement(Icon, { icon: ExternalLink, size: 14 }),
301
+ " ",
302
+ t('ta.deploy.open')),
303
+ clouds && !added && React.createElement(AddCloudHost, { url: gateway, name: RelayServicesUtil.cloudName(gateway), onAdded: readClouds }))))));
304
+ }
198
305
  /**
199
306
  * The form of a type of service a package registered (WebDAV, S3, git): its fields as the package said, secrets as
200
307
  * passwords, and a name. Ta tries the store before it adds it; then sync goes there.
@@ -1,6 +1,7 @@
1
1
  import { Copy, Smartphone, Trash2, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { createPortal } from 'react-dom';
4
+ import { useBackLayer } from '../device/back-stack.js';
4
5
  import { useNotices, useWorkbench } from '../hooks.js';
5
6
  import { useT } from '../i18n/use-t.js';
6
7
  import { BusyMark } from './busy.js';
@@ -43,6 +44,7 @@ export function RelayDialog({ onClose }) {
43
44
  const timer = setInterval(load, 3000);
44
45
  return () => clearInterval(timer);
45
46
  }, [load]);
47
+ useBackLayer(true, onClose);
46
48
  React.useEffect(() => {
47
49
  const onKey = (event) => event.key === 'Escape' && onClose();
48
50
  document.addEventListener('keydown', onKey);
@@ -1,4 +1,14 @@
1
1
  import * as React from 'react';
2
+ /**
3
+ * A cloud workspace to add: the address of a Ta gateway (or Ta service), a token of one's account there, and a name for
4
+ * its directories, `ta://<name>/…`. Checked by connecting before it is kept. A deployment joined (RelayServices) opens
5
+ * it with the address of its gateway and a name filled in.
6
+ */
7
+ export declare function AddCloudHost({ onAdded, url: givenUrl, name: givenName }: {
8
+ onAdded(): Promise<unknown>;
9
+ url?: string;
10
+ name?: string;
11
+ }): React.JSX.Element;
2
12
  /**
3
13
  * The machines conversations can work on (`ssh://` directories): those of ~/.ssh/config and those added,
4
14
  * whether Ta is connected to each, and the ports forwarded from them. Connecting checks a host the way a
@@ -1,5 +1,5 @@
1
1
  import { TaLocation } from '@celljs/ta-protocol';
2
- import { Plug, Plus, Server, Trash2, Unplug, X } from 'lucide-react';
2
+ import { Cloud, ExternalLink, KeyRound, Link2, Plug, Plus, Server, Tag, Trash2, Unplug, X } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useNotices, useWorkbench } from '../hooks.js';
5
5
  import { useT } from '../i18n/use-t.js';
@@ -26,6 +26,60 @@ function useRemote() {
26
26
  }, [workbench.status, bench, read]);
27
27
  return { bench, hosts, ports, read };
28
28
  }
29
+ /**
30
+ * A cloud workspace to add: the address of a Ta gateway (or Ta service), a token of one's account there, and a name for
31
+ * its directories, `ta://<name>/…`. Checked by connecting before it is kept. A deployment joined (RelayServices) opens
32
+ * it with the address of its gateway and a name filled in.
33
+ */
34
+ export function AddCloudHost({ onAdded, url: givenUrl = '', name: givenName = '' }) {
35
+ const t = useT();
36
+ const [, bench] = useWorkbench();
37
+ const [, notices] = useNotices();
38
+ const [open, setOpen] = React.useState(false);
39
+ const [name, setName] = React.useState(givenName);
40
+ const [url, setUrl] = React.useState(givenUrl);
41
+ const [token, setToken] = React.useState('');
42
+ const [busy, setBusy] = React.useState(false);
43
+ const nameOk = TaLocation.isCloudName(name.trim());
44
+ if (!open) {
45
+ return (React.createElement("button", { type: "button", className: "ta-button", onClick: () => setOpen(true) },
46
+ React.createElement(Icon, { icon: Cloud, size: 14 }),
47
+ " ",
48
+ t('ta.remote.addCloud')));
49
+ }
50
+ return (React.createElement("form", { className: "ta-environment-own", onSubmit: async (event) => {
51
+ event.preventDefault();
52
+ setBusy(true);
53
+ try {
54
+ const added = await bench.remote.addCloudHost(name.trim(), url.trim(), token.trim());
55
+ notices.notify(t('ta.remote.cloudAdded', { name: TaLocation.hostLabel(added.host) }), { level: 'success' });
56
+ setOpen(false);
57
+ setName(givenName);
58
+ setUrl(givenUrl);
59
+ setToken('');
60
+ await onAdded();
61
+ }
62
+ catch (error) {
63
+ notices.error(error);
64
+ }
65
+ finally {
66
+ setBusy(false);
67
+ }
68
+ } },
69
+ React.createElement("label", { className: "ta-field" },
70
+ React.createElement(Icon, { icon: Link2, size: 16 }),
71
+ React.createElement("input", { value: url, placeholder: "https://ta.example.com", "aria-label": t('ta.remote.cloudUrl'), spellCheck: false, autoCapitalize: "off", onChange: event => setUrl(event.target.value) })),
72
+ React.createElement("label", { className: "ta-field" },
73
+ React.createElement(Icon, { icon: KeyRound, size: 16 }),
74
+ React.createElement("input", { type: "password", value: token, placeholder: t('ta.remote.cloudToken'), "aria-label": t('ta.remote.cloudToken'), autoComplete: "off", onChange: event => setToken(event.target.value) })),
75
+ React.createElement("label", { className: "ta-field" },
76
+ React.createElement(Icon, { icon: Tag, size: 16 }),
77
+ React.createElement("input", { value: name, placeholder: t('ta.remote.cloudName'), "aria-label": t('ta.remote.cloudName'), "aria-invalid": name.trim() && !nameOk ? true : undefined, spellCheck: false, autoCapitalize: "off", onChange: event => setName(event.target.value.toLowerCase()) })),
78
+ React.createElement("p", { className: "ta-environment-hint" }, t('ta.remote.cloudHint')),
79
+ React.createElement("div", { className: "ta-auth-actions" },
80
+ React.createElement("button", { type: "button", className: "ta-button", onClick: () => setOpen(false) }, t('ta.cancel')),
81
+ React.createElement("button", { type: "submit", className: "ta-button ta-primary", disabled: busy || !nameOk || !url.trim() || !token.trim() }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.remote.cloudConnect')))));
82
+ }
29
83
  /**
30
84
  * The machines conversations can work on (`ssh://` directories): those of ~/.ssh/config and those added,
31
85
  * whether Ta is connected to each, and the ports forwarded from them. Connecting checks a host the way a
@@ -70,24 +124,32 @@ export function RemoteHosts() {
70
124
  React.createElement(Icon, { icon: Plus, size: 14 }),
71
125
  " ",
72
126
  t('ta.remote.add')))),
127
+ React.createElement(Row, { label: t('ta.remote.cloudTitle'), description: t('ta.remote.cloudDescription'), stacked: true },
128
+ React.createElement(AddCloudHost, { onAdded: read })),
73
129
  hosts.length === 0 && React.createElement(EmptyRow, { picture: React.createElement(RemotePicture, null), title: t('ta.remote.none'), hint: t('ta.remote.noneHint') }),
74
- hosts.map(host => (React.createElement(Row, { key: host.host, label: RemoteHostsUtil.breakable(host.host), description: React.createElement("span", { className: "ta-remote-state" },
130
+ hosts.map(host => { var _a; return (React.createElement(Row, { key: host.host, icon: host.source === 'cloud' ? Cloud : undefined, label: host.source === 'cloud' ? TaLocation.hostLabel(host.host) : RemoteHostsUtil.breakable(host.host), description: React.createElement("span", { className: "ta-remote-state" },
75
131
  React.createElement("span", { className: `ta-remote-light${host.connected ? ' ta-on' : ''}` }),
76
132
  [
77
133
  t(host.connected ? 'ta.remote.connected' : 'ta.remote.disconnected'),
78
- t(host.source === 'config' ? 'ta.remote.fromConfig' : 'ta.remote.added'),
134
+ host.source === 'cloud'
135
+ ? ((_a = host.url) !== null && _a !== void 0 ? _a : '').replace(/^https?:\/\//, '')
136
+ : t(host.source === 'config' ? 'ta.remote.fromConfig' : 'ta.remote.added'),
79
137
  ].join(' · ')) },
138
+ host.source === 'cloud' && host.url && (React.createElement("a", { className: "ta-button", href: host.url, target: "_blank", rel: "noreferrer noopener", title: t('ta.remote.openCloudHint') },
139
+ React.createElement(Icon, { icon: ExternalLink, size: 14 }),
140
+ " ",
141
+ t('ta.remote.openCloud'))),
80
142
  host.connected ? (React.createElement("button", { type: "button", className: "ta-button", disabled: busy === host.host, onClick: () => run(host.host, () => bench.remote.disconnect(host.host)) },
81
143
  React.createElement(Icon, { icon: Unplug, size: 14 }),
82
144
  " ",
83
145
  t('ta.remote.disconnect'))) : (React.createElement("button", { type: "button", className: "ta-button", disabled: busy === host.host, onClick: () => run(host.host, async () => {
84
146
  await bench.remote.resolveLocation(TaLocation.ssh(host.host));
85
- notices.notify(t('ta.remote.connectedTo', { host: host.host }), { level: 'success' });
147
+ notices.notify(t('ta.remote.connectedTo', { host: TaLocation.hostLabel(host.host) }), { level: 'success' });
86
148
  }) },
87
149
  busy === host.host ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Icon, { icon: Plug, size: 14 }),
88
150
  " ",
89
151
  t('ta.remote.connect'))),
90
- host.source === 'recent' && (React.createElement(IconButton, { icon: Trash2, label: t('ta.remote.remove', { host: host.host }), disabled: busy === host.host, onClick: () => run(host.host, () => bench.remote.removeHost(host.host)) }))))),
152
+ host.source !== 'config' && (React.createElement(IconButton, { icon: Trash2, label: t('ta.remote.remove', { host: host.host }), disabled: busy === host.host, onClick: () => run(host.host, () => bench.remote.removeHost(host.host)) })))); }),
91
153
  ports.map(port => (React.createElement(Row, { key: `${port.host}:${port.remotePort}`, label: t('ta.remote.port', { host: port.host, port: port.remotePort }), description: `localhost:${port.localPort}` },
92
154
  React.createElement(Icon, { icon: Server, size: 14, className: "ta-muted" }),
93
155
  React.createElement(IconButton, { icon: X, label: t('ta.remote.closePort'), onClick: () => run(port.host, () => bench.remote.closeForwardedPort(port.host, port.remotePort)) }))))));