@celljs/ta-web 4.47.0 → 4.48.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 (269) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +1 -1
  2. package/esm/browser/assistant/assistant-role.js +1 -1
  3. package/esm/browser/assistant/assistant-task-source.js +6 -1
  4. package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
  5. package/esm/browser/assistant/assistant-task-util.js +9 -3
  6. package/esm/browser/assistant/assistant-view.js +5 -2
  7. package/esm/browser/chat/chat-view.js +2 -1
  8. package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
  9. package/esm/browser/cloud/cloud-sign-in.js +88 -18
  10. package/esm/browser/components/app-nav.d.ts +3 -1
  11. package/esm/browser/components/app-nav.js +3 -3
  12. package/esm/browser/components/app-shell-state.js +11 -0
  13. package/esm/browser/components/app-view.js +16 -6
  14. package/esm/browser/components/asks-badge.d.ts +12 -0
  15. package/esm/browser/components/asks-badge.js +17 -1
  16. package/esm/browser/components/chat-list-row.d.ts +4 -1
  17. package/esm/browser/components/chat-list-row.js +7 -1
  18. package/esm/browser/components/chats-dot.d.ts +4 -1
  19. package/esm/browser/components/chats-dot.js +6 -2
  20. package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
  21. package/esm/browser/components/cloud-sign-in-view.js +28 -5
  22. package/esm/browser/components/composer-box-protocol.d.ts +5 -3
  23. package/esm/browser/components/composer-box.js +11 -11
  24. package/esm/browser/components/composer.d.ts +8 -1
  25. package/esm/browser/components/composer.js +57 -34
  26. package/esm/browser/components/discover-view.js +1 -1
  27. package/esm/browser/components/first-steps-util.d.ts +30 -0
  28. package/esm/browser/components/first-steps-util.js +36 -3
  29. package/esm/browser/components/host-view.d.ts +1 -1
  30. package/esm/browser/components/lightbox.d.ts +15 -1
  31. package/esm/browser/components/lightbox.js +14 -2
  32. package/esm/browser/components/link.js +8 -3
  33. package/esm/browser/components/list-rows.d.ts +1 -1
  34. package/esm/browser/components/list-rows.js +1 -1
  35. package/esm/browser/components/markdown.d.ts +4 -2
  36. package/esm/browser/components/markdown.js +13 -4
  37. package/esm/browser/components/media.d.ts +6 -0
  38. package/esm/browser/components/media.js +9 -1
  39. package/esm/browser/components/message-images.d.ts +5 -0
  40. package/esm/browser/components/message-images.js +40 -4
  41. package/esm/browser/components/message-user.js +4 -2
  42. package/esm/browser/components/partner-row.js +4 -4
  43. package/esm/browser/components/phone-hint.d.ts +6 -0
  44. package/esm/browser/components/phone-hint.js +63 -0
  45. package/esm/browser/components/phone-shell.d.ts +2 -0
  46. package/esm/browser/components/phone-shell.js +2 -2
  47. package/esm/browser/components/sending.d.ts +19 -0
  48. package/esm/browser/components/sending.js +27 -0
  49. package/esm/browser/components/session-view.js +5 -3
  50. package/esm/browser/components/settings-choices.js +1 -0
  51. package/esm/browser/components/settings-parts.js +28 -17
  52. package/esm/browser/components/share-dialog.js +3 -2
  53. package/esm/browser/components/share-item-sheet.js +1 -1
  54. package/esm/browser/components/share-sheet.d.ts +4 -2
  55. package/esm/browser/components/share-sheet.js +16 -2
  56. package/esm/browser/components/sign-in-accounts.js +7 -1
  57. package/esm/browser/components/unseen-drop.d.ts +2 -2
  58. package/esm/browser/components/unseen-drop.js +1 -1
  59. package/esm/browser/device/app-badge.d.ts +8 -0
  60. package/esm/browser/device/app-badge.js +28 -0
  61. package/esm/browser/device/code-scan.js +1 -1
  62. package/esm/browser/extension/web-api-code.d.ts +26 -0
  63. package/esm/browser/extension/web-api-components.d.ts +31 -0
  64. package/esm/browser/extension/web-api-menus.d.ts +15 -0
  65. package/esm/browser/extension/web-api-messages.d.ts +15 -0
  66. package/esm/browser/extension/web-api-messages.js +2 -0
  67. package/esm/browser/extension/web-api-partners.d.ts +16 -0
  68. package/esm/browser/extension/web-api-spec.js +1 -0
  69. package/esm/browser/extension/web-extension-api.d.ts +7 -13
  70. package/esm/browser/extension/web-extension-context.js +2 -0
  71. package/esm/browser/extension/web-session-notices.js +11 -2
  72. package/esm/browser/extension/web-share-ui.js +1 -0
  73. package/esm/browser/extension/web-share.js +3 -3
  74. package/esm/browser/extension/web-sharing.js +1 -1
  75. package/esm/browser/i18n/en/assistant.d.ts +2 -0
  76. package/esm/browser/i18n/en/assistant.js +2 -0
  77. package/esm/browser/i18n/en/chat.d.ts +11 -0
  78. package/esm/browser/i18n/en/chat.js +13 -2
  79. package/esm/browser/i18n/en/common.d.ts +4 -0
  80. package/esm/browser/i18n/en/common.js +4 -0
  81. package/esm/browser/i18n/en/service.d.ts +7 -0
  82. package/esm/browser/i18n/en/service.js +7 -0
  83. package/esm/browser/i18n/en/settings.d.ts +6 -0
  84. package/esm/browser/i18n/en/settings.js +8 -2
  85. package/esm/browser/i18n/ja/assistant.js +2 -0
  86. package/esm/browser/i18n/ja/chat.js +13 -2
  87. package/esm/browser/i18n/ja/common.js +4 -0
  88. package/esm/browser/i18n/ja/service.js +7 -0
  89. package/esm/browser/i18n/ja/settings.js +10 -4
  90. package/esm/browser/i18n/locales.d.ts +31 -1
  91. package/esm/browser/i18n/messages.d.ts +30 -0
  92. package/esm/browser/i18n/zh/assistant.js +2 -0
  93. package/esm/browser/i18n/zh/chat.js +13 -2
  94. package/esm/browser/i18n/zh/common.js +4 -0
  95. package/esm/browser/i18n/zh/service.js +7 -0
  96. package/esm/browser/i18n/zh/settings.js +8 -2
  97. package/esm/browser/i18n/zh-tw/assistant.js +2 -0
  98. package/esm/browser/i18n/zh-tw/chat.js +13 -2
  99. package/esm/browser/i18n/zh-tw/common.js +4 -0
  100. package/esm/browser/i18n/zh-tw/service.js +7 -0
  101. package/esm/browser/i18n/zh-tw/settings.js +8 -2
  102. package/esm/browser/links/links.js +1 -1
  103. package/esm/browser/notices/session-notices.d.ts +4 -4
  104. package/esm/browser/notices/session-notices.js +3 -6
  105. package/esm/browser/partners/partners-util.d.ts +6 -0
  106. package/esm/browser/partners/partners-util.js +22 -0
  107. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  108. package/esm/browser/settings/agent-settings.d.ts +2 -0
  109. package/esm/browser/settings/agent-settings.js +2 -0
  110. package/esm/browser/settings/settings-protocol.d.ts +8 -0
  111. package/esm/browser/settings/settings-protocol.js +5 -0
  112. package/esm/browser/style/base.d.ts +1 -1
  113. package/esm/browser/style/base.js +3 -0
  114. package/esm/browser/style/chat-list.d.ts +1 -1
  115. package/esm/browser/style/chat-list.js +8 -3
  116. package/esm/browser/style/conversation-column.d.ts +1 -1
  117. package/esm/browser/style/conversation-column.js +10 -1
  118. package/esm/browser/style/conversation.d.ts +1 -1
  119. package/esm/browser/style/conversation.js +18 -0
  120. package/esm/browser/style/phone.d.ts +1 -1
  121. package/esm/browser/style/phone.js +2 -0
  122. package/esm/browser/style/skins.d.ts +1 -1
  123. package/esm/browser/style/skins.js +1 -1
  124. package/esm/browser/util/composer.d.ts +18 -3
  125. package/esm/browser/util/composer.js +31 -5
  126. package/esm/browser/util/desktop.d.ts +8 -1
  127. package/esm/browser/util/desktop.js +10 -0
  128. package/esm/browser/util/image-shrink.d.ts +5 -1
  129. package/esm/browser/util/image-shrink.js +1 -1
  130. package/esm/browser/util/markdown.d.ts +3 -5
  131. package/esm/browser/util/markdown.js +5 -29
  132. package/esm/browser/util/process.js +2 -2
  133. package/lib/browser/assistant/assistant-role.d.ts +1 -1
  134. package/lib/browser/assistant/assistant-role.js +1 -1
  135. package/lib/browser/assistant/assistant-task-source.js +5 -0
  136. package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
  137. package/lib/browser/assistant/assistant-task-util.js +8 -2
  138. package/lib/browser/assistant/assistant-view.js +5 -2
  139. package/lib/browser/chat/chat-view.js +2 -1
  140. package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
  141. package/lib/browser/cloud/cloud-sign-in.js +89 -19
  142. package/lib/browser/components/app-nav.d.ts +3 -1
  143. package/lib/browser/components/app-nav.js +2 -2
  144. package/lib/browser/components/app-shell-state.js +11 -0
  145. package/lib/browser/components/app-view.js +16 -6
  146. package/lib/browser/components/asks-badge.d.ts +12 -0
  147. package/lib/browser/components/asks-badge.js +19 -1
  148. package/lib/browser/components/chat-list-row.d.ts +4 -1
  149. package/lib/browser/components/chat-list-row.js +7 -1
  150. package/lib/browser/components/chats-dot.d.ts +4 -1
  151. package/lib/browser/components/chats-dot.js +6 -2
  152. package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
  153. package/lib/browser/components/cloud-sign-in-view.js +28 -5
  154. package/lib/browser/components/composer-box-protocol.d.ts +5 -3
  155. package/lib/browser/components/composer-box.js +11 -11
  156. package/lib/browser/components/composer.d.ts +8 -1
  157. package/lib/browser/components/composer.js +56 -33
  158. package/lib/browser/components/discover-view.js +1 -1
  159. package/lib/browser/components/first-steps-util.d.ts +30 -0
  160. package/lib/browser/components/first-steps-util.js +37 -4
  161. package/lib/browser/components/host-view.d.ts +1 -1
  162. package/lib/browser/components/lightbox.d.ts +15 -1
  163. package/lib/browser/components/lightbox.js +15 -2
  164. package/lib/browser/components/link.js +8 -3
  165. package/lib/browser/components/list-rows.d.ts +1 -1
  166. package/lib/browser/components/list-rows.js +1 -1
  167. package/lib/browser/components/markdown.d.ts +4 -2
  168. package/lib/browser/components/markdown.js +11 -2
  169. package/lib/browser/components/media.d.ts +6 -0
  170. package/lib/browser/components/media.js +10 -2
  171. package/lib/browser/components/message-images.d.ts +5 -0
  172. package/lib/browser/components/message-images.js +40 -4
  173. package/lib/browser/components/message-user.js +4 -2
  174. package/lib/browser/components/partner-row.js +4 -4
  175. package/lib/browser/components/phone-hint.d.ts +7 -0
  176. package/lib/browser/components/phone-hint.js +99 -0
  177. package/lib/browser/components/phone-shell.d.ts +2 -0
  178. package/lib/browser/components/phone-shell.js +1 -1
  179. package/lib/browser/components/sending.d.ts +20 -0
  180. package/lib/browser/components/sending.js +63 -0
  181. package/lib/browser/components/session-view.js +5 -3
  182. package/lib/browser/components/settings-choices.js +1 -0
  183. package/lib/browser/components/settings-parts.js +26 -15
  184. package/lib/browser/components/share-dialog.js +3 -2
  185. package/lib/browser/components/share-item-sheet.js +1 -1
  186. package/lib/browser/components/share-sheet.d.ts +4 -2
  187. package/lib/browser/components/share-sheet.js +16 -2
  188. package/lib/browser/components/sign-in-accounts.js +7 -1
  189. package/lib/browser/components/unseen-drop.d.ts +2 -2
  190. package/lib/browser/components/unseen-drop.js +1 -1
  191. package/lib/browser/device/app-badge.d.ts +9 -0
  192. package/lib/browser/device/app-badge.js +31 -0
  193. package/lib/browser/device/code-scan.js +1 -1
  194. package/lib/browser/extension/web-api-code.d.ts +26 -0
  195. package/lib/browser/extension/web-api-components.d.ts +31 -0
  196. package/lib/browser/extension/web-api-menus.d.ts +15 -0
  197. package/lib/browser/extension/web-api-messages.d.ts +16 -0
  198. package/lib/browser/extension/web-api-messages.js +3 -0
  199. package/lib/browser/extension/web-api-partners.d.ts +16 -0
  200. package/lib/browser/extension/web-api-spec.js +1 -0
  201. package/lib/browser/extension/web-extension-api.d.ts +7 -13
  202. package/lib/browser/extension/web-extension-context.js +2 -0
  203. package/lib/browser/extension/web-session-notices.js +10 -1
  204. package/lib/browser/extension/web-share-ui.js +1 -0
  205. package/lib/browser/extension/web-share.js +3 -3
  206. package/lib/browser/extension/web-sharing.js +1 -1
  207. package/lib/browser/i18n/en/assistant.d.ts +2 -0
  208. package/lib/browser/i18n/en/assistant.js +2 -0
  209. package/lib/browser/i18n/en/chat.d.ts +11 -0
  210. package/lib/browser/i18n/en/chat.js +13 -2
  211. package/lib/browser/i18n/en/common.d.ts +4 -0
  212. package/lib/browser/i18n/en/common.js +4 -0
  213. package/lib/browser/i18n/en/service.d.ts +7 -0
  214. package/lib/browser/i18n/en/service.js +7 -0
  215. package/lib/browser/i18n/en/settings.d.ts +6 -0
  216. package/lib/browser/i18n/en/settings.js +8 -2
  217. package/lib/browser/i18n/ja/assistant.js +2 -0
  218. package/lib/browser/i18n/ja/chat.js +13 -2
  219. package/lib/browser/i18n/ja/common.js +4 -0
  220. package/lib/browser/i18n/ja/service.js +7 -0
  221. package/lib/browser/i18n/ja/settings.js +10 -4
  222. package/lib/browser/i18n/locales.d.ts +31 -1
  223. package/lib/browser/i18n/messages.d.ts +30 -0
  224. package/lib/browser/i18n/zh/assistant.js +2 -0
  225. package/lib/browser/i18n/zh/chat.js +13 -2
  226. package/lib/browser/i18n/zh/common.js +4 -0
  227. package/lib/browser/i18n/zh/service.js +7 -0
  228. package/lib/browser/i18n/zh/settings.js +8 -2
  229. package/lib/browser/i18n/zh-tw/assistant.js +2 -0
  230. package/lib/browser/i18n/zh-tw/chat.js +13 -2
  231. package/lib/browser/i18n/zh-tw/common.js +4 -0
  232. package/lib/browser/i18n/zh-tw/service.js +7 -0
  233. package/lib/browser/i18n/zh-tw/settings.js +8 -2
  234. package/lib/browser/links/links.js +1 -1
  235. package/lib/browser/notices/session-notices.d.ts +4 -4
  236. package/lib/browser/notices/session-notices.js +3 -6
  237. package/lib/browser/partners/partners-util.d.ts +6 -0
  238. package/lib/browser/partners/partners-util.js +22 -0
  239. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  240. package/lib/browser/settings/agent-settings.d.ts +2 -0
  241. package/lib/browser/settings/agent-settings.js +3 -1
  242. package/lib/browser/settings/settings-protocol.d.ts +8 -0
  243. package/lib/browser/settings/settings-protocol.js +6 -1
  244. package/lib/browser/style/base.d.ts +1 -1
  245. package/lib/browser/style/base.js +3 -0
  246. package/lib/browser/style/chat-list.d.ts +1 -1
  247. package/lib/browser/style/chat-list.js +8 -3
  248. package/lib/browser/style/conversation-column.d.ts +1 -1
  249. package/lib/browser/style/conversation-column.js +10 -1
  250. package/lib/browser/style/conversation.d.ts +1 -1
  251. package/lib/browser/style/conversation.js +18 -0
  252. package/lib/browser/style/phone.d.ts +1 -1
  253. package/lib/browser/style/phone.js +2 -0
  254. package/lib/browser/style/skins.d.ts +1 -1
  255. package/lib/browser/style/skins.js +1 -1
  256. package/lib/browser/util/composer.d.ts +18 -3
  257. package/lib/browser/util/composer.js +31 -5
  258. package/lib/browser/util/desktop.d.ts +8 -1
  259. package/lib/browser/util/desktop.js +10 -0
  260. package/lib/browser/util/image-shrink.d.ts +5 -1
  261. package/lib/browser/util/image-shrink.js +1 -1
  262. package/lib/browser/util/markdown.d.ts +3 -5
  263. package/lib/browser/util/markdown.js +5 -29
  264. package/lib/browser/util/process.js +1 -1
  265. package/package.json +7 -7
  266. package/esm/browser/util/share-link.d.ts +0 -21
  267. package/esm/browser/util/share-link.js +0 -61
  268. package/lib/browser/util/share-link.d.ts +0 -22
  269. package/lib/browser/util/share-link.js +0 -64
@@ -6,7 +6,7 @@ import * as React from 'react';
6
6
  * its close button, Escape, back or a finger that pulls it down closes it, shrinking back onto its thumbnail (ImagePull). In the top layer, so no container clips it; the touches in it are its
7
7
  * own, never a swipe of a sheet under it.
8
8
  */
9
- export declare function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, }: {
9
+ export declare function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, original, }: {
10
10
  src: string;
11
11
  alt: string;
12
12
  /** The words that name it, at the top. */
@@ -22,4 +22,18 @@ export declare function Lightbox({ src, alt, caption, count, onClose, onPrevious
22
22
  /** The images before and after it, in sight as a finger swipes it to them. */
23
23
  previousSrc?: string;
24
24
  nextSrc?: string;
25
+ /** The picture as it was picked, of one shown made smaller: 查看原图 with its size at the bottom left, as WeChat has it. */
26
+ original?: LightboxOriginal;
25
27
  }): React.JSX.Element;
28
+ /** 查看原图 of a picture over the page (Lightbox): its bytes, how its loading goes, and what loads it. */
29
+ export interface LightboxOriginal {
30
+ bytes: number;
31
+ state?: 'loading' | 'failed';
32
+ onLoad(): void;
33
+ }
34
+ export declare namespace LightboxUtil {
35
+ /** 154 KB, 1.2 MB: the size of a picture, as WeChat says it beside 查看原图. */
36
+ function size(bytes: number): string;
37
+ /** The picture `src` small on the page, in sight (the thumbnail it was opened from, in `opener` first), out of `lightbox`. */
38
+ function thumbnail(src: string, lightbox: HTMLElement, opener: Element | null): HTMLImageElement | undefined;
39
+ }
@@ -12,7 +12,7 @@ import { ImageViewer } from './image-viewer.js';
12
12
  * its close button, Escape, back or a finger that pulls it down closes it, shrinking back onto its thumbnail (ImagePull). In the top layer, so no container clips it; the touches in it are its
13
13
  * own, never a swipe of a sheet under it.
14
14
  */
15
- export function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, }) {
15
+ export function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, original, }) {
16
16
  const t = useT();
17
17
  const dialog = React.useRef(null);
18
18
  /** What opened it (the thumbnail tapped): the picture goes back there first, of those that show the same. */
@@ -61,11 +61,23 @@ export function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext
61
61
  (caption || count) && (React.createElement("div", { className: "ta-lightbox-caption" },
62
62
  caption && React.createElement("span", { className: "ta-lightbox-words" }, caption),
63
63
  count && count.of > 1 && React.createElement("span", { className: "ta-lightbox-count" }, `${count.at + 1} / ${count.of}`))),
64
+ original && (React.createElement("button", { type: "button", className: "ta-lightbox-original", disabled: original.state === 'loading', "aria-busy": original.state === 'loading' || undefined, onClick: original.onLoad },
65
+ original.state === 'loading' && React.createElement("span", { className: "ta-spinner" }),
66
+ original.state === 'loading'
67
+ ? t('ta.images.originalLoading')
68
+ : original.state === 'failed'
69
+ ? t('ta.images.originalFailed')
70
+ : t('ta.images.original', { size: LightboxUtil.size(original.bytes) }))),
64
71
  React.createElement("button", { type: "button", className: "ta-lightbox-close", title: t('ta.close'), "aria-label": t('ta.close'), onClick: close },
65
72
  React.createElement(Icon, { icon: X, size: 18 }))));
66
73
  }
67
- var LightboxUtil;
74
+ export var LightboxUtil;
68
75
  (function (LightboxUtil) {
76
+ /** 154 KB, 1.2 MB: the size of a picture, as WeChat says it beside 查看原图. */
77
+ function size(bytes) {
78
+ return bytes < 1024 * 1024 ? `${Math.max(1, Math.round(bytes / 1024))} KB` : `${(bytes / 1024 ** 2).toFixed(bytes < 10 * 1024 ** 2 ? 1 : 0)} MB`;
79
+ }
80
+ LightboxUtil.size = size;
69
81
  /** The picture `src` small on the page, in sight (the thumbnail it was opened from, in `opener` first), out of `lightbox`. */
70
82
  function thumbnail(src, lightbox, opener) {
71
83
  var _a;
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { useT } from '../i18n/use-t.js';
3
3
  import { LinkUtil } from '../util/link.js';
4
4
  import { useContextMenu } from './context-menu.js';
5
+ import { ElsewhereFiles } from './media.js';
5
6
  /**
6
7
  * Opens what a link of a reply points to (TaLinks.open, with the directory of the conversation it is in);
7
8
  * `external` for Cmd or Ctrl + click. Without it, as in tests, only pages of the web are links.
@@ -19,8 +20,10 @@ function external(event) {
19
20
  export function LinkView({ href, children }) {
20
21
  const t = useT();
21
22
  const open = React.useContext(OpenLink);
23
+ const elsewhere = React.useContext(ElsewhereFiles);
22
24
  const target = React.useMemo(() => LinkUtil.parse(href), [href]);
23
- if (!target) {
25
+ // A file of another computer that did not come with the text is no link here.
26
+ if (!target || (target.type === 'path' && elsewhere && !elsewhere.has(target.path))) {
24
27
  return React.createElement(React.Fragment, null, children);
25
28
  }
26
29
  if (target.type !== 'path') {
@@ -41,8 +44,9 @@ export function LinkView({ href, children }) {
41
44
  /** A code span that names a file or a directory (`src/app.ts:12`), as a link to it. */
42
45
  export function CodeLink({ text }) {
43
46
  const open = React.useContext(OpenLink);
47
+ const elsewhere = React.useContext(ElsewhereFiles);
44
48
  const target = React.useMemo(() => (open ? LinkUtil.codeReference(text) : undefined), [open, text]);
45
- if (!target) {
49
+ if (!target || (target.type === 'path' && elsewhere && !elsewhere.has(target.path))) {
46
50
  return React.createElement("code", null, text);
47
51
  }
48
52
  return (React.createElement(PathButton, { target: target, code: true },
@@ -58,10 +62,11 @@ export function FileLink({ path }) {
58
62
  const t = useT();
59
63
  const open = React.useContext(OpenLink);
60
64
  const fileMenu = React.useContext(FileMenu);
65
+ const elsewhere = React.useContext(ElsewhereFiles);
61
66
  const [menu, openMenu] = useContextMenu();
62
67
  const target = React.useMemo(() => { var _a; return (open ? ((_a = LinkUtil.codeReference(path)) !== null && _a !== void 0 ? _a : LinkUtil.parse(path)) : undefined); }, [open, path]);
63
68
  const label = path.replace(/\/+$/, '').split('/').pop() || path;
64
- if ((target === null || target === void 0 ? void 0 : target.type) !== 'path') {
69
+ if ((target === null || target === void 0 ? void 0 : target.type) !== 'path' || (elsewhere && !elsewhere.has(target.path))) {
65
70
  return (React.createElement("code", { className: "ta-file-chip", title: path }, label));
66
71
  }
67
72
  const onMenu = fileMenu && !target.directory
@@ -18,7 +18,7 @@ export interface ListRowProps {
18
18
  /** Small, before the chevron: WebView.mark of a page under Discover. */
19
19
  mark?: React.ReactNode;
20
20
  danger?: boolean;
21
- /** No chevron: the row does something rather than lead somewhere. */
21
+ /** No chevron: the row does something rather than lead somewhere; centred unless it has a trailing control. */
22
22
  action?: boolean;
23
23
  }
24
24
  export declare namespace ListRowUtil {
@@ -24,7 +24,7 @@ export var ListRowUtil;
24
24
  export function ListRow({ icon, label, detail, onClick, onContextMenu, trailing, mark, danger, action }) {
25
25
  const [busy, run] = useBusy();
26
26
  const chevron = !trailing && !action;
27
- return (React.createElement("div", { className: `ta-list-row${danger ? ' ta-danger' : ''}${action ? ' ta-action' : ''}` },
27
+ return (React.createElement("div", { className: `ta-list-row${danger ? ' ta-danger' : ''}${action && !trailing ? ' ta-action' : ''}` },
28
28
  React.createElement("button", { type: "button", className: "ta-list-main", "aria-busy": busy || undefined, onClick: () => void run(onClick).catch(() => undefined), onContextMenu: onContextMenu },
29
29
  icon && React.createElement(Icon, { icon: icon, size: 19, className: "ta-list-icon" }),
30
30
  React.createElement("span", { className: "ta-list-label" }, chevron ? ListRowUtil.label(label) : label),
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { WebCodeRendererProps } from '../extension/web-api-code.js';
2
+ import type { WebCodeRendererProps, WebMarkdownFiles } from '../extension/web-api-code.js';
3
3
  export declare function CodeBlock({ code, language }: {
4
4
  code: string;
5
5
  language?: string;
@@ -12,11 +12,13 @@ export declare function CodeBlock({ code, language }: {
12
12
  * text a page shows of a conversation of its own (a group chat); else those of the conversation it is in, if any.
13
13
  * `whole`: its blocks are what the page shows, never folded (WebCodeRendererProps.whole).
14
14
  */
15
- export declare function Markdown({ text, streaming, inline, send, answer, whole, }: {
15
+ export declare function Markdown({ text, streaming, inline, send, answer, whole, files, }: {
16
16
  text: string;
17
17
  streaming?: boolean;
18
18
  inline?: boolean;
19
19
  send?: WebCodeRendererProps['send'];
20
20
  answer?: string;
21
21
  whole?: boolean;
22
+ /** Of a text said on another computer, the files that came with it (WebMarkdownFiles): none of this computer. */
23
+ files?: WebMarkdownFiles;
22
24
  }): React.JSX.Element;
@@ -9,9 +9,9 @@ import { MarkdownUtil } from '../util/markdown.js';
9
9
  import { SpokenReply } from '../util/spoken.js';
10
10
  import { Gallery } from './gallery.js';
11
11
  import { IconButton } from './icon.js';
12
- import { CodeLink, LinkView } from './link.js';
12
+ import { CodeLink, FileMenu, LinkView, OpenLink } from './link.js';
13
13
  import { MathView } from './math.js';
14
- import { MediaView } from './media.js';
14
+ import { ElsewhereFiles, FileUrls, MediaView } from './media.js';
15
15
  import { MermaidView } from './mermaid-view.js';
16
16
  import { SecretText } from './secret-text.js';
17
17
  function Inline({ nodes }) {
@@ -273,10 +273,19 @@ const MarkdownBody = React.memo(function MarkdownBody({ text, streaming }) {
273
273
  * text a page shows of a conversation of its own (a group chat); else those of the conversation it is in, if any.
274
274
  * `whole`: its blocks are what the page shows, never folded (WebCodeRendererProps.whole).
275
275
  */
276
- export function Markdown({ text, streaming = false, inline = false, send, answer, whole, }) {
276
+ export function Markdown({ text, streaming = false, inline = false, send, answer, whole, files, }) {
277
+ const open = React.useContext(OpenLink);
278
+ const elsewhere = React.useMemo(() => files && {
279
+ url: (path) => (files.has(path) ? files.url(path) : Promise.reject(new Error(`${path} did not come with the text.`))),
280
+ open: (target, external) => target.type === 'path' ? files.has(target.path) && files.open(target.path) : open === null || open === void 0 ? void 0 : open(target, external),
281
+ }, [files, open]);
277
282
  const body = inline ? (React.createElement("span", { className: "ta-markdown ta-markdown-inline" },
278
283
  React.createElement(Text, { text: text }))) : (React.createElement(MarkdownBody, { text: text, streaming: streaming }));
279
- const drawn = whole === undefined ? body : React.createElement(CodeWhole.Provider, { value: whole }, body);
284
+ const own = whole === undefined ? body : React.createElement(CodeWhole.Provider, { value: whole }, body);
285
+ const drawn = files && elsewhere ? (React.createElement(ElsewhereFiles.Provider, { value: files },
286
+ React.createElement(FileUrls.Provider, { value: elsewhere.url },
287
+ React.createElement(OpenLink.Provider, { value: elsewhere.open },
288
+ React.createElement(FileMenu.Provider, { value: undefined }, own))))) : (own);
280
289
  return send ? (React.createElement(CodeReply.Provider, { value: send },
281
290
  React.createElement(CodeAnswer.Provider, { value: answer }, drawn))) : (drawn);
282
291
  }
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { WebMarkdownFiles } from '../extension/web-api-code.js';
2
3
  import { ThumbnailUtil } from '../util/thumbnail.js';
3
4
  /**
4
5
  * Where the page loads a file of the workspace from (TaWorkspaceServer.fileUrl), in the directory of the
@@ -7,6 +8,11 @@ import { ThumbnailUtil } from '../util/thumbnail.js';
7
8
  * the file before.
8
9
  */
9
10
  export declare const FileUrls: React.Context<((path: string, box?: ThumbnailUtil.Box) => Promise<string>) | undefined>;
11
+ /**
12
+ * The files that came with a text said on another computer (WebMarkdownFiles), where one is drawn: its paths are of that
13
+ * computer, and one that did not come is said to be there, not missing, nor a link.
14
+ */
15
+ export declare const ElsewhereFiles: React.Context<WebMarkdownFiles | undefined>;
10
16
  /**
11
17
  * Asks every picture that could not load to load again: one may not have come for a while (a phone whose network
12
18
  * changed, the app in the background, the relay of the computer reconnecting), not be missing.
@@ -14,6 +14,11 @@ import { Lightbox } from './lightbox.js';
14
14
  * the file before.
15
15
  */
16
16
  export const FileUrls = React.createContext(undefined);
17
+ /**
18
+ * The files that came with a text said on another computer (WebMarkdownFiles), where one is drawn: its paths are of that
19
+ * computer, and one that did not come is said to be there, not missing, nor a link.
20
+ */
21
+ export const ElsewhereFiles = React.createContext(undefined);
17
22
  /**
18
23
  * What the targets replies showed came to, kept on the device: shown again, even after the page loaded again, an
19
24
  * image has its place before it loads and one that could not show says so at once, so that nothing under them moves.
@@ -148,6 +153,7 @@ export function MediaView({ src, alt }) {
148
153
  const [full] = useMediaUrl(open && kind === 'image' ? src : undefined);
149
154
  const [loaded, setLoaded] = React.useState(false);
150
155
  const fullUrl = useFullUrl();
156
+ const elsewhere = React.useContext(ElsewhereFiles);
151
157
  const [menu, openMenu] = useImageMenu();
152
158
  const known = shown.get(src);
153
159
  // One that could not show before says so at once while it is asked again: it may only not have come then.
@@ -173,9 +179,11 @@ export function MediaView({ src, alt }) {
173
179
  }
174
180
  if (!url || failed) {
175
181
  const name = alt || src.split(/[?#]/)[0].split('/').pop() || src;
182
+ const path = MarkdownUtil.localPath(src);
183
+ const away = elsewhere && path !== undefined && !elsewhere.has(path);
176
184
  return (React.createElement("button", { type: "button", className: "ta-media-missing", title: `${src}\n${t('ta.markdown.retry')}`, onClick: askAgain },
177
185
  React.createElement(Icon, { icon: ImageOff, size: 14 }),
178
- t('ta.markdown.missing', { name })));
186
+ t(away ? 'ta.markdown.elsewhere' : 'ta.markdown.missing', { name })));
179
187
  }
180
188
  switch (kind) {
181
189
  case 'video':
@@ -50,6 +50,11 @@ export interface ChatImage {
50
50
  thumb?: string;
51
51
  width: number;
52
52
  height: number;
53
+ /** The picture as it was picked, of one shown made smaller: loaded when the user asks for it (查看原图). */
54
+ original?: {
55
+ bytes: number;
56
+ load(): Promise<string | undefined>;
57
+ };
53
58
  }
54
59
  /**
55
60
  * The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
@@ -165,24 +165,60 @@ export function UserImages({ blocks, timestamp }) {
165
165
  lightbox,
166
166
  folding));
167
167
  }
168
+ /**
169
+ * The originals of pictures shown made smaller, as the user asks for them over the page (查看原图): the URL of each
170
+ * come, by key, how the loading of each goes, and the 查看原图 of the Lightbox of one not come yet.
171
+ */
172
+ function useOriginals() {
173
+ const [loaded, setLoaded] = React.useState({});
174
+ const [states, setStates] = React.useState({});
175
+ const live = React.useRef(true);
176
+ React.useEffect(() => {
177
+ live.current = true;
178
+ return () => {
179
+ live.current = false;
180
+ };
181
+ }, []);
182
+ const of = (image) => {
183
+ const original = image === null || image === void 0 ? void 0 : image.original;
184
+ if (!image || !original || loaded[image.key]) {
185
+ return undefined;
186
+ }
187
+ return {
188
+ bytes: original.bytes,
189
+ state: states[image.key],
190
+ onLoad: () => {
191
+ setStates(current => ({ ...current, [image.key]: 'loading' }));
192
+ original.load().then(url => {
193
+ if (live.current) {
194
+ url && setLoaded(current => ({ ...current, [image.key]: url }));
195
+ setStates(({ [image.key]: _, ...rest }) => (url ? rest : { ...rest, [image.key]: 'failed' }));
196
+ }
197
+ }, () => live.current && setStates(current => ({ ...current, [image.key]: 'failed' })));
198
+ },
199
+ };
200
+ };
201
+ return { src: (image) => { var _a; return (image ? ((_a = loaded[image.key]) !== null && _a !== void 0 ? _a : image.src) : undefined); }, of };
202
+ }
168
203
  /**
169
204
  * The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
170
205
  * conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
171
206
  * blurred from their thumbnail.
172
207
  */
173
208
  export function ChatImages({ images, alt = '' }) {
174
- var _a, _b, _c, _d, _e;
209
+ var _a, _b;
175
210
  const t = useT();
176
211
  const [open, setOpen] = React.useState();
177
212
  const [menu, openMenu] = useImageMenu();
178
213
  const [, redraw] = React.useReducer((n) => n + 1, 0);
214
+ const originals = useOriginals();
179
215
  if (images.length === 0) {
180
216
  return null;
181
217
  }
182
218
  const fold = `chat:${images[0].key}`;
183
219
  const single = images.length === 1 ? UserImageUtil.box({ width: images[0].width, height: images[0].height }) : undefined;
184
- const shown = open !== undefined ? (_a = images[open]) === null || _a === void 0 ? void 0 : _a.src : undefined;
185
- const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_b = images[open - 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_c = images[open + 1]) === null || _c === void 0 ? void 0 : _c.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? (_d = images[open - 1]) === null || _d === void 0 ? void 0 : _d.src : undefined, nextSrc: (_e = images[open + 1]) === null || _e === void 0 ? void 0 : _e.src }));
220
+ const shown = open !== undefined ? originals.src(images[open]) : undefined;
221
+ const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_a = images[open - 1]) === null || _a === void 0 ? void 0 : _a.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_b = images[open + 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? originals.src(images[open - 1]) : undefined, nextSrc: originals.src(images[open + 1]), original: originals.of(images[open]) }));
186
222
  if (ImageStackUtil.stacked(images.length, fold)) {
187
223
  return (React.createElement(React.Fragment, null,
188
224
  React.createElement(ImageStack, { sources: images.map(image => { var _a; return (_a = image.src) !== null && _a !== void 0 ? _a : image.thumb; }), first: { width: images[0].width, height: images[0].height }, count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
@@ -193,7 +229,7 @@ export function ChatImages({ images, alt = '' }) {
193
229
  }
194
230
  return (React.createElement("div", { className: "ta-user-images ta-chat-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': GalleryUtil.columns(images.length) } },
195
231
  images.map((image, at) => (React.createElement("button", { key: image.key, type: "button", className: "ta-user-image", title: image.src ? t('ta.markdown.enlarge') : alt, disabled: !image.src, onClick: () => setOpen(at), onContextMenu: event => {
196
- const source = image.src;
232
+ const source = originals.src(image);
197
233
  if (source) {
198
234
  openMenu(event, { full: () => source, enlarge: () => setOpen(at) });
199
235
  }
@@ -15,6 +15,7 @@ import { STACK_FROM, UserImages, UserImageUtil } from './message-images.js';
15
15
  import { useMessageMenu } from './message-menu.js';
16
16
  import { MessagePeople } from './people.js';
17
17
  import { SaidText } from './said-text.js';
18
+ import { Sending } from './sending.js';
18
19
  /** The messages of the conversation still on their way from here, by message, with what can be done with those that failed. */
19
20
  export const Outbox = React.createContext({ of: new Map() });
20
21
  /** A message that did not go: marked as such, with a way to send it again or take it back, as in a messenger. */
@@ -203,8 +204,9 @@ function UserBubble({ message, blocks, text, copied, skill, queued, }) {
203
204
  // Not in the session yet: nothing to branch from or rewind to.
204
205
  return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
205
206
  marks,
206
- React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
207
- sent.failed ? React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) : React.createElement("div", { className: "ta-footer" })));
207
+ React.createElement(Sending, { failed: sent.failed, onResend: sent.code === TaErrorCode.NOT_SIGNED_IN ? undefined : outbox.actions && (() => { var _a; return (_a = outbox.actions) === null || _a === void 0 ? void 0 : _a.resend(sent.id); }), line: React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) },
208
+ React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp })),
209
+ !sent.failed && React.createElement("div", { className: "ta-footer" })));
208
210
  }
209
211
  return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
210
212
  marks,
@@ -16,8 +16,8 @@ import { SwipeRow } from './swipe-row.js';
16
16
  * same for every kind (PartnerRowUtil).
17
17
  */
18
18
  export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
19
- var _a, _b;
20
- var _c;
19
+ var _a, _b, _c, _d;
20
+ var _e;
21
21
  const t = useT();
22
22
  const [menu, openMenu] = useContextMenu();
23
23
  const [opening, setOpening] = React.useState(false);
@@ -55,7 +55,7 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
55
55
  Own && !opening ? (React.createElement("span", { className: "ta-chat-face", style: { width: 38, height: 38 }, "aria-hidden": "true" },
56
56
  React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
57
57
  partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
58
- React.createElement(ChatDot, { unseen: unseen, asks: asks })),
59
- React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: (_c = partner.label) !== null && _c !== void 0 ? _c : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
58
+ React.createElement(ChatDot, { unseen: unseen, asks: asks, count: PartnersUtil.count(partner), onSee: selected || partner.status ? undefined : (_b = partner.chat) === null || _b === void 0 ? void 0 : _b.see })),
59
+ React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, flag: !partner.status && ((_c = partner.chat) === null || _c === void 0 ? void 0 : _c.flag) ? React.createElement("span", { className: "ta-chat-flag ta-alert" }, partner.chat.flag) : undefined, busy: !partner.status && !!((_d = partner.chat) === null || _d === void 0 ? void 0 : _d.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: (_e = partner.label) !== null && _e !== void 0 ? _e : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
60
60
  }
61
61
  //# sourceMappingURL=partner-row.js.map
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
4
+ * the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
5
+ */
6
+ export declare function PhoneHint(): React.JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { useInject } from '@celljs/react';
2
+ import { TA_OWNER } from '@celljs/ta-protocol';
3
+ import { Smartphone, X } from 'lucide-react';
4
+ import * as React from 'react';
5
+ import { useDevice } from '../device/device.js';
6
+ import { WebMetrics } from '../extension/web-metrics.js';
7
+ import { usePersisted, useWorkbench } from '../hooks.js';
8
+ import { useT } from '../i18n/use-t.js';
9
+ import { TaState } from '../state/state-protocol.js';
10
+ import { FirstStepsUtil } from './first-steps-util.js';
11
+ import { Icon, IconButton } from './icon.js';
12
+ import { MessagePeople } from './people.js';
13
+ import { RelayDialog } from './relay-view.js';
14
+ /**
15
+ * A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
16
+ * the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
17
+ */
18
+ export function PhoneHint() {
19
+ var _a;
20
+ const t = useT();
21
+ const handheld = useDevice(device => device.handheld);
22
+ const state = useInject(TaState);
23
+ const [workbench, bench] = useWorkbench();
24
+ const [kept, setKept] = usePersisted(FirstStepsUtil.STATE);
25
+ const [loaded, setLoaded] = React.useState(false);
26
+ const [paired, setPaired] = React.useState();
27
+ const [pairing, setPairing] = React.useState(false);
28
+ // Pairing is the owner's: one let into their Ta (a collaborator, a guest) is not offered it.
29
+ const owner = React.useContext(MessagePeople).me === TA_OWNER;
30
+ const online = owner && workbench.status === 'online';
31
+ React.useEffect(() => {
32
+ void state.load(FirstStepsUtil.STATE).then(() => setLoaded(true), () => undefined);
33
+ }, [state]);
34
+ // The phones paired, asked only once the line could show at all.
35
+ const candidate = loaded && online && FirstStepsUtil.phoneHint(kept, { handheld, paired: 0, now: Date.now() });
36
+ React.useEffect(() => {
37
+ if (candidate && paired === undefined) {
38
+ bench.relay.getRelay().then(info => setPaired(info.devices.length), () => undefined);
39
+ }
40
+ }, [candidate, paired, bench]);
41
+ const shown = candidate && paired !== undefined && FirstStepsUtil.phoneHint(kept, { handheld, paired, now: Date.now() });
42
+ React.useEffect(() => {
43
+ var _a, _b;
44
+ if (shown && ((_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at) === undefined) {
45
+ (_b = WebMetrics.current) === null || _b === void 0 ? void 0 : _b.own('step:phone-hint');
46
+ setKept(before => ({ ...before, phone: { ...before.phone, at: Date.now() } }));
47
+ }
48
+ }, [shown, (_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at, setKept]);
49
+ const done = () => setKept(before => ({ ...before, phone: { ...before.phone, done: true } }));
50
+ return (React.createElement(React.Fragment, null,
51
+ shown && (React.createElement("div", { className: "ta-phone-hint" },
52
+ React.createElement(Icon, { icon: Smartphone, size: 14 }),
53
+ React.createElement("span", { className: "ta-ellipsis" }, t('ta.phoneHint.text')),
54
+ React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => {
55
+ var _a;
56
+ (_a = WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own('step:phone-pair');
57
+ setPairing(true);
58
+ done();
59
+ } }, t('ta.phoneHint.pair')),
60
+ React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: done }))),
61
+ pairing && React.createElement(RelayDialog, { onClose: () => setPairing(false) })));
62
+ }
63
+ //# sourceMappingURL=phone-hint.js.map
@@ -19,6 +19,8 @@ export interface PhoneTab {
19
19
  onSeeAll?(): void;
20
20
  /** How many wait for the user to decide (the double's tab): a blue count, in place of the amber dot. */
21
21
  asks?: number;
22
+ /** How many messages people sent the user has not seen (the chats' tab): a red number, before all else. */
23
+ count?: number;
22
24
  }
23
25
  export interface PhoneShellProps {
24
26
  tabs: PhoneTab[];
@@ -6,7 +6,7 @@ import { useHeld } from '../device/hold.js';
6
6
  import { usePullDown } from '../device/pull-down.js';
7
7
  import { useSheetSwipe } from '../device/sheet-swipe.js';
8
8
  import { useT } from '../i18n/use-t.js';
9
- import { AsksBadge } from './asks-badge.js';
9
+ import { AsksBadge, PeopleBadge } from './asks-badge.js';
10
10
  import { useContextMenu } from './context-menu.js';
11
11
  import { DinoFace } from './ta-avatar.js';
12
12
  import { UnseenDrop } from './unseen-drop.js';
@@ -243,7 +243,7 @@ function TabBar({ tabs, tab, onTab }) {
243
243
  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) },
244
244
  React.createElement("span", { className: "ta-tabbar-icon" },
245
245
  item.double ? React.createElement(DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
246
- item.asks ? (React.createElement(AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
246
+ item.count ? (React.createElement(PeopleBadge, { count: item.count, onDismiss: item.onSeeAll })) : item.asks ? (React.createElement(AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
247
247
  React.createElement("span", null, item.label)));
248
248
  }),
249
249
  menu));
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ /** How a message of the user on its way shows (WebSendingProps). */
3
+ export interface SendingProps {
4
+ /** Why it did not go: a red mark beside it, and under it the line `line`, else 发送失败 · 重发 · 删除. */
5
+ failed?: string;
6
+ /** How far it went, 0 to 1, when known: said beside the spinner. */
7
+ progress?: number;
8
+ onResend?(): void;
9
+ onDiscard?(): void;
10
+ /** In place of the line under one that did not go. */
11
+ line?: React.ReactNode;
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
16
+ * mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
17
+ * of extensions (`ui.Sending`) show their messages on their way so alike.
18
+ */
19
+ export declare function Sending({ failed, progress, onResend, onDiscard, line, children }: SendingProps): React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { CircleAlert } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { useT } from '../i18n/use-t.js';
4
+ import { Icon } from './icon.js';
5
+ /**
6
+ * A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
7
+ * mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
8
+ * of extensions (`ui.Sending`) show their messages on their way so alike.
9
+ */
10
+ export function Sending({ failed, progress, onResend, onDiscard, line, children }) {
11
+ const t = useT();
12
+ const percent = progress !== undefined && progress >= 0 && progress < 1 ? Math.floor(progress * 100) : undefined;
13
+ return (React.createElement(React.Fragment, null,
14
+ React.createElement("div", { className: `ta-sending${failed ? ' ta-sending-failed' : ''}` },
15
+ failed ? (React.createElement("button", { type: "button", className: "ta-sending-mark", title: failed, "aria-label": t('ta.message.resend'), disabled: !onResend, onClick: onResend },
16
+ React.createElement(Icon, { icon: CircleAlert, size: 18 }))) : (React.createElement("span", { className: "ta-sending-mark", role: "status", "aria-label": t('ta.message.sending') },
17
+ percent !== undefined && React.createElement("span", { className: "ta-sending-percent" }, `${percent}%`),
18
+ React.createElement("span", { className: "ta-spinner" }))),
19
+ React.createElement("div", { className: "ta-sending-body" }, children)),
20
+ failed &&
21
+ (line !== null && line !== void 0 ? line : (React.createElement("div", { className: "ta-send-failed", title: failed },
22
+ React.createElement(Icon, { icon: CircleAlert, size: 14 }),
23
+ React.createElement("span", null, t('ta.message.sendFailed')),
24
+ onResend && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onResend }, t('ta.message.resend'))),
25
+ onDiscard && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onDiscard }, t('ta.message.discard'))))))));
26
+ }
27
+ //# sourceMappingURL=sending.js.map
@@ -13,6 +13,7 @@ import { CodeConversation, CodeReply } from '../markdown/code-renderers.js';
13
13
  import { ScreenUtil } from '../screen/screen-protocol.js';
14
14
  import { ScreenScroll } from '../screen/screen-scroll.js';
15
15
  import { useScreenPart } from '../screen/use-screen-part.js';
16
+ import { QUEUE_SETTINGS } from '../settings/agent-settings.js';
16
17
  import { LinkUtil } from '../util/link.js';
17
18
  import { MessageUtil } from '../util/message.js';
18
19
  import { TerminalText } from '../util/terminal-text.js';
@@ -41,6 +42,7 @@ import { MessageImages } from './message-images.js';
41
42
  import { ConversationSession, MessageList } from './message-list.js';
42
43
  import { MovedNotice } from './moved-notice.js';
43
44
  import { MessagePeople, PeopleFaces, PresenceLine, PresenceUtil } from './people.js';
45
+ import { PhoneHint } from './phone-hint.js';
44
46
  import { useSessionSettings } from './session-settings.js';
45
47
  import { TerminalArt } from './terminal-art.js';
46
48
  import { useStopTimes } from './use-stop-times.js';
@@ -153,7 +155,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
153
155
  const { settings, actions } = useSessionSettings(server, useSettingsServer(), store, state, t, fail, contextAct);
154
156
  const composer = React.useRef(null);
155
157
  const [settingsState] = useSettings();
156
- const recentShots = settingsState.settings.recentShots;
158
+ const { recentShots, sendWhileWorking } = settingsState.settings;
157
159
  // A call: the conversation listens, answers aloud, and listens again (VoiceCall); not in a tab of the workbench.
158
160
  const [callState, call] = useVoiceCall({
159
161
  language: () => settingsState.language,
@@ -206,7 +208,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
206
208
  const fileUrl = React.useCallback(async (path, box) => files.loadable(ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
207
209
  const namedPaths = React.useCallback(() => MessageUtil.namedPaths(store.state.messages), [store]);
208
210
  const openLink = useOpenLink(cwd, namedPaths);
209
- const [{ fileMenus }] = useWebExtensions();
211
+ const [{ fileMenus }, extensions] = useWebExtensions();
210
212
  const fileMenu = React.useCallback((path) => (cwd ? fileMenus.flatMap(menu => menu(LinkUtil.fileRef(cwd, path))) : []), [cwd, fileMenus]);
211
213
  // biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
212
214
  React.useEffect(() => onActivity(), [state.working, onActivity]);
@@ -390,7 +392,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
390
392
  widgetsAt('aboveEditor'),
391
393
  addons.above,
392
394
  React.createElement(CallBar, { state: callState, call: call })),
393
- React.createElement(Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
395
+ React.createElement(Composer, { above: React.createElement(PhoneHint, null), ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, sendWhileWorking: sendWhileWorking, onQueueSettings: () => extensions.openSettings(QUEUE_SETTINGS), onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
394
396
  belowComposer,
395
397
  widgetsAt('belowEditor'),
396
398
  statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
@@ -43,6 +43,7 @@ export const SHORTCUTS = [
43
43
  { keys: 'Enter', label: 'ta.shortcut.send' },
44
44
  { keys: 'Shift+Enter', label: 'ta.shortcut.newline' },
45
45
  { keys: 'Alt+Enter', label: 'ta.shortcut.followUp' },
46
+ { keys: 'Mod+Enter', label: 'ta.shortcut.sendNow' },
46
47
  { keys: 'Esc', label: 'ta.shortcut.stop' },
47
48
  { keys: '/', label: 'ta.shortcut.commands' },
48
49
  { keys: '@', label: 'ta.shortcut.files' },