@celljs/ta-web 4.41.0 → 4.43.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 (318) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/apps/web-apps.d.ts +4 -0
  4. package/esm/browser/apps/web-apps.js +14 -3
  5. package/esm/browser/assistant/ta-hearing.d.ts +85 -0
  6. package/esm/browser/assistant/ta-hearing.js +272 -0
  7. package/esm/browser/components/auth-view.js +1 -1
  8. package/esm/browser/components/board.js +9 -1
  9. package/esm/browser/components/clipboard-link-host.d.ts +2 -0
  10. package/esm/browser/components/clipboard-link-host.js +27 -0
  11. package/esm/browser/components/cloud-network.js +1 -1
  12. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  13. package/esm/browser/components/custom-provider-advanced.js +8 -8
  14. package/esm/browser/components/custom-provider-view.js +12 -12
  15. package/esm/browser/components/empty-state.d.ts +2 -1
  16. package/esm/browser/components/empty-state.js +6 -2
  17. package/esm/browser/components/folder-picker.js +2 -2
  18. package/esm/browser/components/gallery.js +8 -9
  19. package/esm/browser/components/hearing-host.d.ts +5 -0
  20. package/esm/browser/components/hearing-host.js +58 -0
  21. package/esm/browser/components/host-view.d.ts +1 -1
  22. package/esm/browser/components/link-dialog.js +4 -0
  23. package/esm/browser/components/loading.d.ts +3 -2
  24. package/esm/browser/components/loading.js +7 -3
  25. package/esm/browser/components/markdown.d.ts +3 -1
  26. package/esm/browser/components/markdown.js +55 -10
  27. package/esm/browser/components/media.d.ts +10 -4
  28. package/esm/browser/components/media.js +60 -14
  29. package/esm/browser/components/people-picker.d.ts +17 -0
  30. package/esm/browser/components/people-picker.js +129 -0
  31. package/esm/browser/components/relay-view.js +1 -1
  32. package/esm/browser/components/settings-parts.js +2 -0
  33. package/esm/browser/components/share-dialog.d.ts +2 -2
  34. package/esm/browser/components/share-dialog.js +7 -4
  35. package/esm/browser/components/share-friends.js +3 -10
  36. package/esm/browser/components/share-item-sheet.d.ts +12 -0
  37. package/esm/browser/components/share-item-sheet.js +39 -0
  38. package/esm/browser/components/share-sheet.d.ts +9 -2
  39. package/esm/browser/components/share-sheet.js +5 -4
  40. package/esm/browser/components/sign-in-setup.js +4 -4
  41. package/esm/browser/components/trusted-domains.js +1 -1
  42. package/esm/browser/components/view-room.d.ts +25 -0
  43. package/esm/browser/components/view-room.js +136 -0
  44. package/esm/browser/components/voice-services.js +6 -6
  45. package/esm/browser/device/device-protocol.d.ts +9 -6
  46. package/esm/browser/device/device-protocol.js +7 -4
  47. package/esm/browser/device/launch-screen.d.ts +11 -1
  48. package/esm/browser/device/launch-screen.js +22 -4
  49. package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
  50. package/esm/browser/extension/share-sheet-compat.js +12 -2
  51. package/esm/browser/extension/web-api-code.d.ts +11 -0
  52. package/esm/browser/extension/web-api-components.d.ts +8 -1
  53. package/esm/browser/extension/web-api-contributions.d.ts +30 -1
  54. package/esm/browser/extension/web-api-desktop.d.ts +2 -1
  55. package/esm/browser/extension/web-api-file-views.d.ts +38 -0
  56. package/esm/browser/extension/web-api-file-views.js +2 -0
  57. package/esm/browser/extension/web-api-host.d.ts +47 -0
  58. package/esm/browser/extension/web-api-host.js +3 -0
  59. package/esm/browser/extension/web-api-menus.d.ts +46 -0
  60. package/esm/browser/extension/web-api-partners.d.ts +58 -1
  61. package/esm/browser/extension/web-api-spec.js +7 -0
  62. package/esm/browser/extension/web-extension-api.d.ts +10 -10
  63. package/esm/browser/extension/web-extension-context.d.ts +2 -8
  64. package/esm/browser/extension/web-extension-context.js +14 -39
  65. package/esm/browser/extension/web-extension-marks.d.ts +10 -0
  66. package/esm/browser/extension/web-extension-marks.js +29 -0
  67. package/esm/browser/extension/web-extension-protocol.d.ts +11 -1
  68. package/esm/browser/extension/web-extension-protocol.js +3 -0
  69. package/esm/browser/extension/web-extension-run.d.ts +15 -2
  70. package/esm/browser/extension/web-extension-run.js +77 -0
  71. package/esm/browser/extension/web-extensions-running.d.ts +5 -1
  72. package/esm/browser/extension/web-extensions-running.js +16 -0
  73. package/esm/browser/extension/web-extensions.d.ts +2 -1
  74. package/esm/browser/extension/web-extensions.js +3 -0
  75. package/esm/browser/extension/web-home.js +3 -1
  76. package/esm/browser/extension/web-host-values.d.ts +66 -0
  77. package/esm/browser/extension/web-host-values.js +191 -0
  78. package/esm/browser/extension/web-hosts.d.ts +7 -2
  79. package/esm/browser/extension/web-hosts.js +16 -4
  80. package/esm/browser/extension/web-share-ui.d.ts +7 -0
  81. package/esm/browser/extension/web-share-ui.js +15 -0
  82. package/esm/browser/extension/web-share.d.ts +18 -0
  83. package/esm/browser/extension/web-share.js +42 -0
  84. package/esm/browser/i18n/en/chat.d.ts +10 -0
  85. package/esm/browser/i18n/en/chat.js +10 -0
  86. package/esm/browser/i18n/en/common.d.ts +23 -0
  87. package/esm/browser/i18n/en/common.js +23 -0
  88. package/esm/browser/i18n/en/discover.d.ts +7 -0
  89. package/esm/browser/i18n/en/discover.js +7 -0
  90. package/esm/browser/i18n/en/settings.d.ts +2 -0
  91. package/esm/browser/i18n/en/settings.js +2 -0
  92. package/esm/browser/i18n/ja/chat.js +10 -0
  93. package/esm/browser/i18n/ja/common.js +23 -0
  94. package/esm/browser/i18n/ja/discover.js +7 -0
  95. package/esm/browser/i18n/ja/settings.js +2 -0
  96. package/esm/browser/i18n/locales.d.ts +43 -1
  97. package/esm/browser/i18n/messages.d.ts +42 -0
  98. package/esm/browser/i18n/zh/chat.js +10 -0
  99. package/esm/browser/i18n/zh/common.js +23 -0
  100. package/esm/browser/i18n/zh/discover.js +7 -0
  101. package/esm/browser/i18n/zh/settings.js +2 -0
  102. package/esm/browser/i18n/zh-tw/chat.js +10 -0
  103. package/esm/browser/i18n/zh-tw/common.js +23 -0
  104. package/esm/browser/i18n/zh-tw/discover.js +7 -0
  105. package/esm/browser/i18n/zh-tw/settings.js +2 -0
  106. package/esm/browser/launch-art/art-palette.d.ts +41 -0
  107. package/esm/browser/launch-art/art-palette.js +72 -0
  108. package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
  109. package/esm/browser/launch-art/cyclic-automaton.js +176 -0
  110. package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
  111. package/esm/browser/launch-art/fractal-tree.js +48 -0
  112. package/esm/browser/launch-art/launch-art.d.ts +98 -0
  113. package/esm/browser/launch-art/launch-art.js +420 -0
  114. package/esm/browser/launch-art/launch-sky.d.ts +66 -0
  115. package/esm/browser/launch-art/launch-sky.js +153 -0
  116. package/esm/browser/links/clipboard-links.d.ts +89 -0
  117. package/esm/browser/links/clipboard-links.js +303 -0
  118. package/esm/browser/links/link-text.d.ts +29 -0
  119. package/esm/browser/links/link-text.js +97 -0
  120. package/esm/browser/links/links-protocol.d.ts +12 -1
  121. package/esm/browser/links/links.d.ts +8 -2
  122. package/esm/browser/links/links.js +33 -3
  123. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  124. package/esm/browser/markdown/code-renderers.js +4 -0
  125. package/esm/browser/partners/group-picker.js +23 -29
  126. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  127. package/esm/browser/sandbox/work/work-senses.js +1 -1
  128. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  129. package/esm/browser/settings/settings-protocol.js +2 -0
  130. package/esm/browser/style/base.d.ts +1 -1
  131. package/esm/browser/style/base.js +10 -6
  132. package/esm/browser/style/chat-list.d.ts +1 -1
  133. package/esm/browser/style/chat-list.js +28 -15
  134. package/esm/browser/style/conversation-column.d.ts +1 -1
  135. package/esm/browser/style/conversation.d.ts +1 -1
  136. package/esm/browser/style/conversation.js +29 -2
  137. package/esm/browser/style/dialogs.d.ts +1 -1
  138. package/esm/browser/style/dialogs.js +2 -5
  139. package/esm/browser/style/forms.d.ts +5 -0
  140. package/esm/browser/style/forms.js +65 -0
  141. package/esm/browser/style/layout.d.ts +1 -1
  142. package/esm/browser/style/pages.d.ts +1 -1
  143. package/esm/browser/style/pages.js +14 -24
  144. package/esm/browser/style/phone.d.ts +1 -1
  145. package/esm/browser/style/shared.d.ts +1 -1
  146. package/esm/browser/style/shell.d.ts +1 -1
  147. package/esm/browser/style/shell.js +1 -6
  148. package/esm/browser/style/surfaces.d.ts +1 -1
  149. package/esm/browser/style/surfaces.js +0 -6
  150. package/esm/browser/style/tasks.d.ts +1 -1
  151. package/esm/browser/style.js +2 -0
  152. package/esm/browser/util/markdown.d.ts +45 -3
  153. package/esm/browser/util/markdown.js +67 -11
  154. package/esm/browser/util/voice.d.ts +18 -0
  155. package/esm/browser/util/voice.js +111 -3
  156. package/esm/browser/workbench-protocol.d.ts +2 -0
  157. package/esm/browser/workbench-services.d.ts +2 -0
  158. package/esm/browser/workbench-services.js +5 -0
  159. package/esm/browser/workbench.js +5 -0
  160. package/lib/browser/apps/web-apps.d.ts +4 -0
  161. package/lib/browser/apps/web-apps.js +14 -3
  162. package/lib/browser/assistant/ta-hearing.d.ts +86 -0
  163. package/lib/browser/assistant/ta-hearing.js +277 -0
  164. package/lib/browser/components/auth-view.js +1 -1
  165. package/lib/browser/components/board.js +9 -1
  166. package/lib/browser/components/clipboard-link-host.d.ts +3 -0
  167. package/lib/browser/components/clipboard-link-host.js +63 -0
  168. package/lib/browser/components/cloud-network.js +1 -1
  169. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  170. package/lib/browser/components/custom-provider-advanced.js +8 -8
  171. package/lib/browser/components/custom-provider-view.js +12 -12
  172. package/lib/browser/components/empty-state.d.ts +2 -1
  173. package/lib/browser/components/empty-state.js +6 -2
  174. package/lib/browser/components/folder-picker.js +2 -2
  175. package/lib/browser/components/gallery.js +7 -8
  176. package/lib/browser/components/hearing-host.d.ts +6 -0
  177. package/lib/browser/components/hearing-host.js +94 -0
  178. package/lib/browser/components/host-view.d.ts +1 -1
  179. package/lib/browser/components/link-dialog.js +4 -0
  180. package/lib/browser/components/loading.d.ts +3 -2
  181. package/lib/browser/components/loading.js +7 -3
  182. package/lib/browser/components/markdown.d.ts +3 -1
  183. package/lib/browser/components/markdown.js +53 -8
  184. package/lib/browser/components/media.d.ts +10 -4
  185. package/lib/browser/components/media.js +61 -14
  186. package/lib/browser/components/people-picker.d.ts +18 -0
  187. package/lib/browser/components/people-picker.js +166 -0
  188. package/lib/browser/components/relay-view.js +1 -1
  189. package/lib/browser/components/settings-parts.js +2 -0
  190. package/lib/browser/components/share-dialog.d.ts +2 -2
  191. package/lib/browser/components/share-dialog.js +7 -4
  192. package/lib/browser/components/share-friends.js +3 -10
  193. package/lib/browser/components/share-item-sheet.d.ts +13 -0
  194. package/lib/browser/components/share-item-sheet.js +75 -0
  195. package/lib/browser/components/share-sheet.d.ts +9 -2
  196. package/lib/browser/components/share-sheet.js +5 -3
  197. package/lib/browser/components/sign-in-setup.js +4 -4
  198. package/lib/browser/components/trusted-domains.js +1 -1
  199. package/lib/browser/components/view-room.d.ts +26 -0
  200. package/lib/browser/components/view-room.js +173 -0
  201. package/lib/browser/components/voice-services.js +6 -6
  202. package/lib/browser/device/device-protocol.d.ts +9 -6
  203. package/lib/browser/device/device-protocol.js +7 -4
  204. package/lib/browser/device/launch-screen.d.ts +11 -1
  205. package/lib/browser/device/launch-screen.js +22 -4
  206. package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
  207. package/lib/browser/extension/share-sheet-compat.js +13 -2
  208. package/lib/browser/extension/web-api-code.d.ts +11 -0
  209. package/lib/browser/extension/web-api-components.d.ts +8 -1
  210. package/lib/browser/extension/web-api-contributions.d.ts +30 -1
  211. package/lib/browser/extension/web-api-desktop.d.ts +2 -1
  212. package/lib/browser/extension/web-api-file-views.d.ts +39 -0
  213. package/lib/browser/extension/web-api-file-views.js +3 -0
  214. package/lib/browser/extension/web-api-host.d.ts +48 -0
  215. package/lib/browser/extension/web-api-host.js +4 -0
  216. package/lib/browser/extension/web-api-menus.d.ts +46 -0
  217. package/lib/browser/extension/web-api-partners.d.ts +58 -1
  218. package/lib/browser/extension/web-api-spec.js +7 -0
  219. package/lib/browser/extension/web-extension-api.d.ts +10 -10
  220. package/lib/browser/extension/web-extension-context.d.ts +2 -8
  221. package/lib/browser/extension/web-extension-context.js +14 -39
  222. package/lib/browser/extension/web-extension-marks.d.ts +11 -0
  223. package/lib/browser/extension/web-extension-marks.js +65 -0
  224. package/lib/browser/extension/web-extension-protocol.d.ts +11 -1
  225. package/lib/browser/extension/web-extension-protocol.js +3 -0
  226. package/lib/browser/extension/web-extension-run.d.ts +15 -2
  227. package/lib/browser/extension/web-extension-run.js +77 -0
  228. package/lib/browser/extension/web-extensions-running.d.ts +5 -1
  229. package/lib/browser/extension/web-extensions-running.js +16 -0
  230. package/lib/browser/extension/web-extensions.d.ts +2 -1
  231. package/lib/browser/extension/web-extensions.js +3 -0
  232. package/lib/browser/extension/web-home.js +3 -1
  233. package/lib/browser/extension/web-host-values.d.ts +67 -0
  234. package/lib/browser/extension/web-host-values.js +229 -0
  235. package/lib/browser/extension/web-hosts.d.ts +7 -2
  236. package/lib/browser/extension/web-hosts.js +16 -4
  237. package/lib/browser/extension/web-share-ui.d.ts +8 -0
  238. package/lib/browser/extension/web-share-ui.js +51 -0
  239. package/lib/browser/extension/web-share.d.ts +19 -0
  240. package/lib/browser/extension/web-share.js +45 -0
  241. package/lib/browser/i18n/en/chat.d.ts +10 -0
  242. package/lib/browser/i18n/en/chat.js +10 -0
  243. package/lib/browser/i18n/en/common.d.ts +23 -0
  244. package/lib/browser/i18n/en/common.js +23 -0
  245. package/lib/browser/i18n/en/discover.d.ts +7 -0
  246. package/lib/browser/i18n/en/discover.js +7 -0
  247. package/lib/browser/i18n/en/settings.d.ts +2 -0
  248. package/lib/browser/i18n/en/settings.js +2 -0
  249. package/lib/browser/i18n/ja/chat.js +10 -0
  250. package/lib/browser/i18n/ja/common.js +23 -0
  251. package/lib/browser/i18n/ja/discover.js +7 -0
  252. package/lib/browser/i18n/ja/settings.js +2 -0
  253. package/lib/browser/i18n/locales.d.ts +43 -1
  254. package/lib/browser/i18n/messages.d.ts +42 -0
  255. package/lib/browser/i18n/zh/chat.js +10 -0
  256. package/lib/browser/i18n/zh/common.js +23 -0
  257. package/lib/browser/i18n/zh/discover.js +7 -0
  258. package/lib/browser/i18n/zh/settings.js +2 -0
  259. package/lib/browser/i18n/zh-tw/chat.js +10 -0
  260. package/lib/browser/i18n/zh-tw/common.js +23 -0
  261. package/lib/browser/i18n/zh-tw/discover.js +7 -0
  262. package/lib/browser/i18n/zh-tw/settings.js +2 -0
  263. package/lib/browser/launch-art/art-palette.d.ts +42 -0
  264. package/lib/browser/launch-art/art-palette.js +76 -0
  265. package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
  266. package/lib/browser/launch-art/cyclic-automaton.js +180 -0
  267. package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
  268. package/lib/browser/launch-art/fractal-tree.js +52 -0
  269. package/lib/browser/launch-art/launch-art.d.ts +99 -0
  270. package/lib/browser/launch-art/launch-art.js +424 -0
  271. package/lib/browser/launch-art/launch-sky.d.ts +67 -0
  272. package/lib/browser/launch-art/launch-sky.js +157 -0
  273. package/lib/browser/links/clipboard-links.d.ts +90 -0
  274. package/lib/browser/links/clipboard-links.js +308 -0
  275. package/lib/browser/links/link-text.d.ts +30 -0
  276. package/lib/browser/links/link-text.js +100 -0
  277. package/lib/browser/links/links-protocol.d.ts +12 -1
  278. package/lib/browser/links/links.d.ts +8 -2
  279. package/lib/browser/links/links.js +33 -3
  280. package/lib/browser/markdown/code-renderers.d.ts +4 -0
  281. package/lib/browser/markdown/code-renderers.js +5 -1
  282. package/lib/browser/partners/group-picker.js +23 -29
  283. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  284. package/lib/browser/sandbox/work/work-senses.js +1 -1
  285. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  286. package/lib/browser/settings/settings-protocol.js +2 -0
  287. package/lib/browser/style/base.d.ts +1 -1
  288. package/lib/browser/style/base.js +10 -6
  289. package/lib/browser/style/chat-list.d.ts +1 -1
  290. package/lib/browser/style/chat-list.js +28 -15
  291. package/lib/browser/style/conversation-column.d.ts +1 -1
  292. package/lib/browser/style/conversation.d.ts +1 -1
  293. package/lib/browser/style/conversation.js +29 -2
  294. package/lib/browser/style/dialogs.d.ts +1 -1
  295. package/lib/browser/style/dialogs.js +2 -5
  296. package/lib/browser/style/forms.d.ts +6 -0
  297. package/lib/browser/style/forms.js +68 -0
  298. package/lib/browser/style/layout.d.ts +1 -1
  299. package/lib/browser/style/pages.d.ts +1 -1
  300. package/lib/browser/style/pages.js +14 -24
  301. package/lib/browser/style/phone.d.ts +1 -1
  302. package/lib/browser/style/shared.d.ts +1 -1
  303. package/lib/browser/style/shell.d.ts +1 -1
  304. package/lib/browser/style/shell.js +1 -6
  305. package/lib/browser/style/surfaces.d.ts +1 -1
  306. package/lib/browser/style/surfaces.js +0 -6
  307. package/lib/browser/style/tasks.d.ts +1 -1
  308. package/lib/browser/style.js +2 -0
  309. package/lib/browser/util/markdown.d.ts +45 -3
  310. package/lib/browser/util/markdown.js +68 -12
  311. package/lib/browser/util/voice.d.ts +18 -0
  312. package/lib/browser/util/voice.js +111 -3
  313. package/lib/browser/workbench-protocol.d.ts +2 -0
  314. package/lib/browser/workbench-services.d.ts +2 -0
  315. package/lib/browser/workbench-services.js +5 -0
  316. package/lib/browser/workbench.js +5 -0
  317. package/package.json +8 -8
  318. package/public/launch.svg +3 -3
@@ -1,6 +1,6 @@
1
1
  import type { TaEvent } from '@celljs/ta-protocol';
2
2
  import type * as React from 'react';
3
- import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererOptions, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api';
3
+ import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererOptions, WebComposerAddon, WebFileMenu, WebFileView, WebHomeSource, WebInitiative, WebLinkDescriber, WebMenuItem, WebOpener, WebOpenerOptions, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebShareWay, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api';
4
4
  import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol';
5
5
  /** What an extension registered through its API: all of it goes when it stops. */
6
6
  export interface WebRegistrations {
@@ -27,13 +27,17 @@ export interface WebRegistrations {
27
27
  openers: WebOpener[];
28
28
  /** Openers of some links only (WebOpenerOptions.specific): asked first. */
29
29
  specificOpeners: WebOpener[];
30
+ /** What links of their own are (WebOpenerOptions.describe). */
31
+ linkDescribers: WebLinkDescriber[];
30
32
  sessionMenus: WebSessionMenu[];
31
33
  fileMenus: WebFileMenu[];
32
34
  codeMenus: WebCodeMenu[];
35
+ shareWays: WebShareWay[];
33
36
  taskSources: WebTaskSource[];
34
37
  searches: WebSearchSource[];
35
38
  composerAddons: WebComposerAddon[];
36
39
  roomAddons: WebRoomAddon[];
40
+ fileViews: WebFileView[];
37
41
  settingsSections: WebSettingsSection[];
38
42
  handlers: {
39
43
  type: string;
@@ -53,8 +57,17 @@ export interface WebExtensionRun extends WebRegistrations {
53
57
  dispose?: () => void;
54
58
  }
55
59
  export declare namespace WebExtensionRunUtil {
60
+ /**
61
+ * An opener of links (registerOpener), with what it says links of its own are (`describe`). One that fails, or of an
62
+ * extension that stopped, leaves the link to the next one, and names none.
63
+ */
64
+ function opener(run: WebExtensionRun, opener: WebOpener, options?: WebOpenerOptions): void;
56
65
  /** A menu of the extension (registerSessionMenu, registerFileMenu, registerCodeMenu): none once it stopped, nor when it throws. */
57
66
  function menu<T>(run: WebExtensionRun, menu: (target: T) => WebMenuItem[]): (target: T) => WebMenuItem[];
67
+ /** How files of a kind look (registerFileView): it takes none once the extension stopped, nor when it throws. */
68
+ function fileView(run: WebExtensionRun, view: WebFileView): WebFileView;
69
+ /** A way to share of the extension: it takes nothing once it stopped, nor when it throws. */
70
+ function shareWay(run: WebExtensionRun, way: WebShareWay): WebShareWay;
58
71
  /** Nothing registered: the one list of what a run holds, so that a stop clears every kind of it. */
59
72
  function registrations(): WebRegistrations;
60
73
  function create(loaded: LoadedWebExtension, hash?: string): WebExtensionRun;
@@ -70,6 +83,6 @@ export declare namespace WebExtensionRunUtil {
70
83
  */
71
84
  function voice(run: WebExtensionRun, voice: WebVoice): WebVoice;
72
85
  /** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
73
- function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'codeMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'codePointable' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
86
+ function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'linkDescribers' | 'sessionMenus' | 'fileMenus' | 'fileViews' | 'codeMenus' | 'shareWays' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'codePointable' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
74
87
  }
75
88
  //# sourceMappingURL=web-extension-run.d.ts.map
@@ -4,6 +4,36 @@ exports.WebExtensionRunUtil = void 0;
4
4
  const DEFAULT_ORDER = 100;
5
5
  var WebExtensionRunUtil;
6
6
  (function (WebExtensionRunUtil) {
7
+ /**
8
+ * An opener of links (registerOpener), with what it says links of its own are (`describe`). One that fails, or of an
9
+ * extension that stopped, leaves the link to the next one, and names none.
10
+ */
11
+ function opener(run, opener, options) {
12
+ ((options === null || options === void 0 ? void 0 : options.specific) ? run.specificOpeners : run.openers).push(async (link) => {
13
+ try {
14
+ return !run.stopped && (await opener(link)) === true;
15
+ }
16
+ catch (error) {
17
+ console.error(`The web extension ${run.loaded.name} failed:`, error);
18
+ return false;
19
+ }
20
+ });
21
+ const describe = options === null || options === void 0 ? void 0 : options.describe;
22
+ if (!describe) {
23
+ return;
24
+ }
25
+ run.linkDescribers.push(url => {
26
+ try {
27
+ const kind = run.stopped ? undefined : describe({ type: 'url', url });
28
+ return typeof kind === 'string' && kind.trim() ? kind.trim() : undefined;
29
+ }
30
+ catch (error) {
31
+ console.error(`The web extension ${run.loaded.name} failed:`, error);
32
+ return undefined;
33
+ }
34
+ });
35
+ }
36
+ WebExtensionRunUtil.opener = opener;
7
37
  /** A menu of the extension (registerSessionMenu, registerFileMenu, registerCodeMenu): none once it stopped, nor when it throws. */
8
38
  function menu(run, menu) {
9
39
  return target => {
@@ -17,6 +47,47 @@ var WebExtensionRunUtil;
17
47
  };
18
48
  }
19
49
  WebExtensionRunUtil.menu = menu;
50
+ /** How files of a kind look (registerFileView): it takes none once the extension stopped, nor when it throws. */
51
+ function fileView(run, view) {
52
+ return {
53
+ accepts: file => {
54
+ try {
55
+ return !run.stopped && view.accepts(file) === true;
56
+ }
57
+ catch (error) {
58
+ console.error(`The web extension ${run.loaded.name} failed:`, error);
59
+ return false;
60
+ }
61
+ },
62
+ render: view.render,
63
+ };
64
+ }
65
+ WebExtensionRunUtil.fileView = fileView;
66
+ /** A way to share of the extension: it takes nothing once it stopped, nor when it throws. */
67
+ function shareWay(run, way) {
68
+ const failed = (error) => console.error(`The web extension ${run.loaded.name} failed:`, error);
69
+ return {
70
+ key: `${run.loaded.name}/${way.key}`,
71
+ label: way.label,
72
+ icon: way.icon,
73
+ order: way.order,
74
+ accepts: item => {
75
+ try {
76
+ return !run.stopped && way.accepts(item);
77
+ }
78
+ catch (error) {
79
+ failed(error);
80
+ return false;
81
+ }
82
+ },
83
+ share: async (item) => {
84
+ if (!run.stopped) {
85
+ await way.share(item);
86
+ }
87
+ },
88
+ };
89
+ }
90
+ WebExtensionRunUtil.shareWay = shareWay;
20
91
  /** Nothing registered: the one list of what a run holds, so that a stop clears every kind of it. */
21
92
  function registrations() {
22
93
  return {
@@ -38,13 +109,16 @@ var WebExtensionRunUtil;
38
109
  toolRenderers: [],
39
110
  openers: [],
40
111
  specificOpeners: [],
112
+ linkDescribers: [],
41
113
  sessionMenus: [],
42
114
  fileMenus: [],
43
115
  codeMenus: [],
116
+ shareWays: [],
44
117
  taskSources: [],
45
118
  searches: [],
46
119
  composerAddons: [],
47
120
  roomAddons: [],
121
+ fileViews: [],
48
122
  settingsSections: [],
49
123
  handlers: [],
50
124
  };
@@ -170,9 +244,12 @@ var WebExtensionRunUtil;
170
244
  return {
171
245
  openers: [...runs.flatMap(run => run.specificOpeners), ...runs.flatMap(run => run.openers)],
172
246
  specificOpeners: runs.flatMap(run => run.specificOpeners),
247
+ linkDescribers: runs.flatMap(run => run.linkDescribers),
173
248
  sessionMenus: runs.flatMap(run => run.sessionMenus),
174
249
  fileMenus: runs.flatMap(run => run.fileMenus),
250
+ fileViews: runs.flatMap(run => run.fileViews),
175
251
  codeMenus: runs.flatMap(run => run.codeMenus),
252
+ shareWays: runs.flatMap(run => run.shareWays).sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 100) - ((_b = b.order) !== null && _b !== void 0 ? _b : 100); }),
176
253
  extensions: runs.map(run => run.loaded),
177
254
  views,
178
255
  widgets: runs.flatMap(run => [...run.widgets].map(([key, { component, options }]) => { var _a; return ({
@@ -8,8 +8,9 @@ import { TaSettings } from '../settings/settings-protocol';
8
8
  import { TaState } from '../state/state-protocol';
9
9
  import { TaTargets } from '../targets/targets-protocol';
10
10
  import { TaWorkbench } from '../workbench-protocol';
11
+ import type { WebShareItem } from './web-api-menus';
11
12
  import { WebEditorTabs } from './web-editor-tabs';
12
- import type { WebExtensionFactory } from './web-extension-api';
13
+ import type { WebExtensionFactory, WebMenuItem } from './web-extension-api';
13
14
  import { WebExtensionCode } from './web-extension-code';
14
15
  import type { WebExtensionContext } from './web-extension-context';
15
16
  import { BuiltinWebExtension, type LoadedWebExtension, type WebExtensionConversation, type WebExtensionsState, type WebSessionSwitcher, type WebViewEntry } from './web-extension-protocol';
@@ -109,6 +110,9 @@ export declare abstract class WebExtensionsRunning {
109
110
  protected stop(run: WebExtensionRun): void;
110
111
  protected guard(run: WebExtensionRun, action: () => void): void;
111
112
  protected publish(): void;
113
+ /** Share, opening the share sheet, for what a way to share takes. */
114
+ protected shareMenu(item: WebShareItem | undefined): WebMenuItem[];
115
+ abstract shareItem(item: WebShareItem | undefined): void;
112
116
  protected update(change: Partial<WebExtensionsState>): void;
113
117
  abstract refresh(): Promise<boolean>;
114
118
  abstract openView(id: string, preserveFocus?: boolean): void;
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.WebExtensionsRunning = void 0;
13
13
  const core_1 = require("@celljs/core");
14
+ const lucide_react_1 = require("lucide-react");
14
15
  const files_protocol_1 = require("../files/files-protocol");
15
16
  const messages_1 = require("../i18n/messages");
16
17
  const links_protocol_1 = require("../links/links-protocol");
@@ -35,6 +36,7 @@ const web_on_demand_1 = require("./web-on-demand");
35
36
  const web_page_list_1 = require("./web-page-list");
36
37
  const web_pages_1 = require("./web-pages");
37
38
  const web_partners_1 = require("./web-partners");
39
+ const web_share_1 = require("./web-share");
38
40
  const web_tasks_1 = require("./web-tasks");
39
41
  const web_view_util_1 = require("./web-view-util");
40
42
  /**
@@ -424,12 +426,26 @@ class WebExtensionsRunning {
424
426
  }
425
427
  this.update({
426
428
  ...registered,
429
+ // The one Share, after what the extensions add, once there is a way to share: where it takes the block or the file.
430
+ ...(registered.shareWays.length
431
+ ? {
432
+ codeMenus: [...registered.codeMenus, block => this.shareMenu(web_share_1.WebShareUtil.ofBlock(block))],
433
+ fileMenus: [...registered.fileMenus, file => this.shareMenu(web_share_1.WebShareUtil.ofFile(file))],
434
+ }
435
+ : {}),
427
436
  views: views.sort((a, b) => a.order - b.order),
428
437
  onOpen: this.onDemand.list(),
429
438
  kept: this.onDemand.kept(),
430
439
  usage: this.onDemand.used,
431
440
  });
432
441
  }
442
+ /** Share, opening the share sheet, for what a way to share takes. */
443
+ shareMenu(item) {
444
+ if (!item || web_share_1.WebShareUtil.ways(this.current.shareWays, item).length === 0) {
445
+ return [];
446
+ }
447
+ return [{ key: 'ta-share', label: (0, messages_1.message)(this.settings.state.language, 'ta.share.share'), icon: lucide_react_1.Share2, run: () => this.shareItem(item) }];
448
+ }
433
449
  update(change) {
434
450
  this.current = { ...this.current, ...change };
435
451
  for (const listener of this.listeners) {
@@ -1,6 +1,6 @@
1
1
  import type { TaEvent, TaTemporaryFrom } from '@celljs/ta-protocol';
2
2
  import type * as React from 'react';
3
- import type { WebHomeEntry, WebShareTarget } from './web-extension-api';
3
+ import type { WebHomeEntry, WebShareItem, WebShareTarget } from './web-extension-api';
4
4
  import { WebExtensionContext, type WebExtensionContextHost } from './web-extension-context';
5
5
  import { TaWebExtensions, type WebEditorEntry, type WebExtensionConversation, type WebExtensionsState, type WebSessionSwitcher } from './web-extension-protocol';
6
6
  import { WebExtensionsRunning } from './web-extensions-running';
@@ -32,6 +32,7 @@ export declare class TaWebExtensionsImpl extends WebExtensionsRunning implements
32
32
  openTemporary(source: string, from: TaTemporaryFrom): Promise<string>;
33
33
  openShared(text: string): Promise<boolean>;
34
34
  share(target: WebShareTarget | undefined): void;
35
+ shareItem(item: WebShareItem | undefined): void;
35
36
  protected nextCustom: number;
36
37
  showCustom(extension: string, component: React.ComponentType<{
37
38
  close(): void;
@@ -176,6 +176,9 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl extends web_extensions_runni
176
176
  share(target) {
177
177
  this.update({ sharing: target });
178
178
  }
179
+ shareItem(item) {
180
+ this.update({ sharingItem: item });
181
+ }
179
182
  showCustom(extension, component) {
180
183
  const id = ++this.nextCustom;
181
184
  this.update({ customs: [...this.current.customs, { id, extension, component }] });
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.WebHomeBoard = exports.WebHomeUtil = void 0;
37
37
  const React = __importStar(require("react"));
38
+ const people_picker_1 = require("../components/people-picker");
38
39
  const group_picker_1 = require("../partners/group-picker");
39
40
  const web_row_board_1 = require("./web-row-board");
40
41
  var WebHomeUtil;
@@ -63,13 +64,14 @@ var WebHomeUtil;
63
64
  (0, group_picker_1.openGroupPicker)(extensions, partner === undefined ? undefined : extensions.partners.partners().find(each => each.key === `${extension}/${partner}`));
64
65
  },
65
66
  openPartner: async (id, kind) => {
66
- const partner = extensions.partners.partners().find(each => each.id === id && (!kind || each.kind === kind));
67
+ const partner = extensions.partners.partners().find(each => (each.id === id || each.room === id) && (!kind || each.kind === kind));
67
68
  if (!partner || stopped()) {
68
69
  return false;
69
70
  }
70
71
  await partner.open();
71
72
  return true;
72
73
  },
74
+ PeoplePicker: people_picker_1.PeoplePicker,
73
75
  };
74
76
  }
75
77
  WebHomeUtil.ui = ui;
@@ -0,0 +1,67 @@
1
+ import type { TaWorkbench } from '../workbench-protocol';
2
+ import type { WebHostOptions, WebHostValue } from './web-api-host';
3
+ import { type WebExtensionRun } from './web-extension-run';
4
+ /** What the values of one extension need of the page. */
5
+ export interface WebHostValuesDeps {
6
+ /** Calls a method of the package's host. */
7
+ call(method: string, params: readonly unknown[]): Promise<unknown>;
8
+ /** What the package's host says changed; how to stop. */
9
+ onChanged(listener: (topics: string[]) => void): () => void;
10
+ /** The connection came back: what the page read may have changed meanwhile, and the server forgot it reads it. */
11
+ onReconnect(listener: () => void): () => void;
12
+ /** Whether the page is hidden now, and when it shows again; none: always shown. */
13
+ hidden?(): boolean;
14
+ onShown?(listener: () => void): () => void;
15
+ }
16
+ interface Entry {
17
+ method: string;
18
+ params: readonly unknown[];
19
+ topics: ReadonlySet<string>;
20
+ every?: number;
21
+ listeners: Set<() => void>;
22
+ snapshot: WebHostValue<unknown>;
23
+ /** Of the value shown, to render nothing when an answer is the same. */
24
+ json?: string;
25
+ reading?: Promise<void>;
26
+ /** A change came during the read: read once more after it. */
27
+ again?: boolean;
28
+ /** A change came while the page was hidden: read as it shows. */
29
+ stale?: boolean;
30
+ timer?: ReturnType<typeof setInterval>;
31
+ }
32
+ /**
33
+ * What the methods of one package's host answer, for `ui.useHost`: one read for all who show the same, again only as
34
+ * the host says it changed (TaExtensionHost.changed), the connection comes back or the page shows after a change it
35
+ * missed; the same snapshot until an answer differs.
36
+ */
37
+ export declare class WebHostValues {
38
+ protected readonly deps: WebHostValuesDeps;
39
+ protected readonly entries: Map<string, Entry>;
40
+ protected stops: (() => void)[];
41
+ constructor(deps: WebHostValuesDeps);
42
+ /** What a method with its params is kept by. */
43
+ static key(method: string, params?: readonly unknown[]): string;
44
+ /** The snapshot of a method with its params (WebHostValues.key), the same object until it changes. */
45
+ get<T>(key: string): WebHostValue<T>;
46
+ /** Shows it: read now, and again as it changes, until the function returned. */
47
+ subscribe(key: string, options: WebHostOptions, listener: () => void): () => void;
48
+ /** Heard of the host: what reads one of the topics is read again, or marked to be once the page shows. */
49
+ changed(topics: readonly string[]): void;
50
+ dispose(): void;
51
+ protected entry(key: string): Entry;
52
+ protected listen(): void;
53
+ /** Reads again what shows; only what changed while hidden with `stale`. */
54
+ protected readShown(stale: boolean): void;
55
+ protected shown(): Entry[];
56
+ protected hidden(): boolean;
57
+ protected read(entry: Entry): Promise<void>;
58
+ protected show(entry: Entry, snapshot: WebHostValue<unknown>): void;
59
+ }
60
+ /** What `ui.useHost` and `onHostChanged` of an extension read: its package's host, on the connection of the page. */
61
+ export declare namespace WebHostValuesUtil {
62
+ function of(run: WebExtensionRun, workbench: Pick<TaWorkbench, 'packages' | 'onHostChanged' | 'onReconnect'>): WebHostValues;
63
+ }
64
+ /** `ui.useHost` on the values of one extension. */
65
+ export declare function useHostValue<T>(values: WebHostValues, method: string, params?: readonly unknown[], options?: WebHostOptions): WebHostValue<T>;
66
+ export {};
67
+ //# sourceMappingURL=web-host-values.d.ts.map
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.WebHostValuesUtil = exports.WebHostValues = void 0;
37
+ exports.useHostValue = useHostValue;
38
+ const React = __importStar(require("react"));
39
+ const web_extension_run_1 = require("./web-extension-run");
40
+ /**
41
+ * What the methods of one package's host answer, for `ui.useHost`: one read for all who show the same, again only as
42
+ * the host says it changed (TaExtensionHost.changed), the connection comes back or the page shows after a change it
43
+ * missed; the same snapshot until an answer differs.
44
+ */
45
+ class WebHostValues {
46
+ constructor(deps) {
47
+ this.deps = deps;
48
+ this.entries = new Map();
49
+ this.stops = [];
50
+ }
51
+ /** What a method with its params is kept by. */
52
+ static key(method, params = []) {
53
+ return `${method}\n${JSON.stringify(params)}`;
54
+ }
55
+ /** The snapshot of a method with its params (WebHostValues.key), the same object until it changes. */
56
+ get(key) {
57
+ return this.entry(key).snapshot;
58
+ }
59
+ /** Shows it: read now, and again as it changes, until the function returned. */
60
+ subscribe(key, options, listener) {
61
+ var _a;
62
+ const entry = this.entry(key);
63
+ entry.topics = new Set((_a = options.topics) !== null && _a !== void 0 ? _a : [entry.method]);
64
+ entry.every = options.every;
65
+ entry.listeners.add(listener);
66
+ if (entry.listeners.size === 1) {
67
+ this.listen();
68
+ void this.read(entry);
69
+ if (entry.every) {
70
+ entry.timer = setInterval(() => !this.hidden() && void this.read(entry), entry.every);
71
+ }
72
+ }
73
+ return () => {
74
+ entry.listeners.delete(listener);
75
+ if (entry.listeners.size === 0) {
76
+ clearInterval(entry.timer);
77
+ entry.timer = undefined;
78
+ if (![...this.entries.values()].some(each => each.listeners.size)) {
79
+ this.dispose();
80
+ }
81
+ }
82
+ };
83
+ }
84
+ /** Heard of the host: what reads one of the topics is read again, or marked to be once the page shows. */
85
+ changed(topics) {
86
+ for (const entry of this.shown()) {
87
+ if (topics.some(topic => entry.topics.has(topic))) {
88
+ if (this.hidden()) {
89
+ entry.stale = true;
90
+ }
91
+ else {
92
+ void this.read(entry);
93
+ }
94
+ }
95
+ }
96
+ }
97
+ dispose() {
98
+ for (const stop of this.stops) {
99
+ stop();
100
+ }
101
+ this.stops = [];
102
+ }
103
+ entry(key) {
104
+ let entry = this.entries.get(key);
105
+ if (!entry) {
106
+ const at = key.indexOf('\n');
107
+ const method = key.slice(0, at);
108
+ const params = JSON.parse(key.slice(at + 1));
109
+ const created = {
110
+ method,
111
+ params,
112
+ topics: new Set([method]),
113
+ listeners: new Set(),
114
+ snapshot: { loading: true, read: () => this.read(created) },
115
+ };
116
+ this.entries.set(key, created);
117
+ entry = created;
118
+ }
119
+ return entry;
120
+ }
121
+ listen() {
122
+ var _a, _b;
123
+ if (this.stops.length) {
124
+ return;
125
+ }
126
+ this.stops.push(this.deps.onChanged(topics => this.changed(topics)));
127
+ this.stops.push(this.deps.onReconnect(() => this.readShown(false)));
128
+ const shows = (_b = (_a = this.deps).onShown) === null || _b === void 0 ? void 0 : _b.call(_a, () => this.readShown(true));
129
+ if (shows) {
130
+ this.stops.push(shows);
131
+ }
132
+ }
133
+ /** Reads again what shows; only what changed while hidden with `stale`. */
134
+ readShown(stale) {
135
+ for (const entry of this.shown()) {
136
+ if (!stale || entry.stale) {
137
+ void this.read(entry);
138
+ }
139
+ }
140
+ }
141
+ shown() {
142
+ return [...this.entries.values()].filter(entry => entry.listeners.size > 0);
143
+ }
144
+ hidden() {
145
+ var _a, _b;
146
+ var _c;
147
+ return (_c = (_b = (_a = this.deps).hidden) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
148
+ }
149
+ read(entry) {
150
+ if (entry.reading) {
151
+ entry.again = true;
152
+ return entry.reading;
153
+ }
154
+ entry.stale = false;
155
+ entry.reading = (async () => {
156
+ do {
157
+ entry.again = false;
158
+ try {
159
+ const value = await this.deps.call(entry.method, entry.params);
160
+ const json = JSON.stringify(value !== null && value !== void 0 ? value : null);
161
+ if (json !== entry.json || entry.snapshot.loading || entry.snapshot.error !== undefined) {
162
+ entry.json = json;
163
+ this.show(entry, { value: value !== null && value !== void 0 ? value : undefined, loading: false, read: entry.snapshot.read });
164
+ }
165
+ }
166
+ catch (failure) {
167
+ const error = failure instanceof Error ? failure.message : String(failure);
168
+ if (error !== entry.snapshot.error || entry.snapshot.loading) {
169
+ this.show(entry, { value: entry.snapshot.value, error, loading: false, read: entry.snapshot.read });
170
+ }
171
+ }
172
+ } while (entry.again);
173
+ })().finally(() => {
174
+ entry.reading = undefined;
175
+ });
176
+ return entry.reading;
177
+ }
178
+ show(entry, snapshot) {
179
+ entry.snapshot = snapshot;
180
+ for (const listener of [...entry.listeners]) {
181
+ listener();
182
+ }
183
+ }
184
+ }
185
+ exports.WebHostValues = WebHostValues;
186
+ /** The values of each extension that runs, made as it first asks. */
187
+ const OF_RUN = new WeakMap();
188
+ /** What `ui.useHost` and `onHostChanged` of an extension read: its package's host, on the connection of the page. */
189
+ var WebHostValuesUtil;
190
+ (function (WebHostValuesUtil) {
191
+ function of(run, workbench) {
192
+ let values = OF_RUN.get(run);
193
+ if (!values) {
194
+ const { name } = run.loaded;
195
+ const visible = typeof document !== 'undefined';
196
+ values = new WebHostValues({
197
+ call: (method, params) => run.stopped
198
+ ? Promise.reject(new Error(`The web extension ${name} has stopped.`))
199
+ : workbench.packages.callPackageHost(name, method, [...params]),
200
+ onChanged: listener => web_extension_run_1.WebExtensionRunUtil.track(run, () => workbench.onHostChanged((changed, topics) => changed === name && listener(topics))),
201
+ onReconnect: listener => web_extension_run_1.WebExtensionRunUtil.track(run, () => workbench.onReconnect(listener)),
202
+ hidden: () => visible && document.visibilityState === 'hidden',
203
+ onShown: listener => {
204
+ if (!visible) {
205
+ return () => undefined;
206
+ }
207
+ const shown = () => document.visibilityState === 'visible' && listener();
208
+ document.addEventListener('visibilitychange', shown);
209
+ return () => document.removeEventListener('visibilitychange', shown);
210
+ },
211
+ });
212
+ OF_RUN.set(run, values);
213
+ }
214
+ return values;
215
+ }
216
+ WebHostValuesUtil.of = of;
217
+ })(WebHostValuesUtil || (exports.WebHostValuesUtil = WebHostValuesUtil = {}));
218
+ /** `ui.useHost` on the values of one extension. */
219
+ function useHostValue(values, method, params = [], options = {}) {
220
+ var _a;
221
+ const key = WebHostValues.key(method, params);
222
+ // By their values, not the arrays of each render.
223
+ const topics = ((_a = options.topics) !== null && _a !== void 0 ? _a : [method]).join('\n');
224
+ const { every } = options;
225
+ const subscribe = React.useCallback((listener) => values.subscribe(key, { topics: topics.split('\n'), every }, listener), [values, key, topics, every]);
226
+ const get = React.useCallback(() => values.get(key), [values, key]);
227
+ return React.useSyncExternalStore(subscribe, get, get);
228
+ }
229
+ //# sourceMappingURL=web-host-values.js.map
@@ -1,8 +1,13 @@
1
1
  import type { SavedHost, TaWorkbench } from '../workbench-protocol';
2
2
  import type { WebHost, WebHosts } from './web-api-hosts';
3
- /** The computers of the device as extensions see them (WebExtensionAPI.hosts): never their ways in. */
3
+ /**
4
+ * The computers of the device as extensions see them (WebExtensionAPI.hosts): never their ways in. Once the extension
5
+ * stopped, it keeps no computer and moves the page to none: what acts for the user fails (WebExtensionContext).
6
+ */
4
7
  export declare namespace WebHostsUtil {
5
- function of(workbench: () => TaWorkbench): WebHosts;
8
+ function of(workbench: () => TaWorkbench, extension?: {
9
+ readonly stopped: boolean;
10
+ }): WebHosts;
6
11
  function hostOf(saved: SavedHost): WebHost;
7
12
  }
8
13
  //# sourceMappingURL=web-hosts.d.ts.map
@@ -2,10 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebHostsUtil = void 0;
4
4
  const hosts_1 = require("../hosts");
5
- /** The computers of the device as extensions see them (WebExtensionAPI.hosts): never their ways in. */
5
+ /**
6
+ * The computers of the device as extensions see them (WebExtensionAPI.hosts): never their ways in. Once the extension
7
+ * stopped, it keeps no computer and moves the page to none: what acts for the user fails (WebExtensionContext).
8
+ */
6
9
  var WebHostsUtil;
7
10
  (function (WebHostsUtil) {
8
- function of(workbench) {
11
+ function of(workbench, extension = { stopped: false }) {
9
12
  return {
10
13
  current: () => {
11
14
  const { hosts, host } = workbench().state;
@@ -13,8 +16,17 @@ var WebHostsUtil;
13
16
  return saved && hostOf(saved);
14
17
  },
15
18
  list: () => workbench().state.hosts.map(hostOf),
16
- keep: (link, name) => workbench().keepHost(link, name),
17
- switchTo: id => workbench().switchTo(id),
19
+ keep: (link, name) => {
20
+ if (extension.stopped) {
21
+ throw new Error('The web extension has stopped.');
22
+ }
23
+ return workbench().keepHost(link, name);
24
+ },
25
+ switchTo: id => {
26
+ if (!extension.stopped) {
27
+ workbench().switchTo(id);
28
+ }
29
+ },
18
30
  };
19
31
  }
20
32
  WebHostsUtil.of = of;
@@ -0,0 +1,8 @@
1
+ import type { WebExtensionUI } from './web-extension-api';
2
+ import type { WebExtensionContextHost } from './web-extension-context';
3
+ /**
4
+ * What `ui` gives an extension to share with (docs/design/ta-links.md 4): the share sheet of a link, that of something
5
+ * (`share`, its tiles the ways to share), and handing an extension on. None of it does anything once it stopped.
6
+ */
7
+ export declare function shareUI(host: Pick<WebExtensionContextHost, 'extensions' | 'notices' | 'workbench'>, stopped: () => boolean): Pick<WebExtensionUI, 'shareExtension' | 'share' | 'ShareSheet'>;
8
+ //# sourceMappingURL=web-share-ui.d.ts.map