@dxos/plugin-thread 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7

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 (326) hide show
  1. package/dist/lib/browser/CallDebugPanel-BO3SLD4E.mjs +182 -0
  2. package/dist/lib/browser/CallDebugPanel-BO3SLD4E.mjs.map +7 -0
  3. package/dist/lib/browser/CallSidebar-WGAPDBFY.mjs +36 -0
  4. package/dist/lib/browser/CallSidebar-WGAPDBFY.mjs.map +7 -0
  5. package/dist/lib/browser/ChannelContainer-M7YGXCQ3.mjs +17 -0
  6. package/dist/lib/browser/ChannelContainer-M7YGXCQ3.mjs.map +7 -0
  7. package/dist/lib/browser/ChatContainer-DZ2JIT7Y.mjs +18 -0
  8. package/dist/lib/browser/ChatContainer-DZ2JIT7Y.mjs.map +7 -0
  9. package/dist/lib/browser/ThreadCompanion-UUOD5N66.mjs +207 -0
  10. package/dist/lib/browser/ThreadCompanion-UUOD5N66.mjs.map +7 -0
  11. package/dist/lib/browser/ThreadSettings-VL3HBE62.mjs +20 -0
  12. package/dist/lib/browser/ThreadSettings-VL3HBE62.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-7C2QW32W.mjs → app-graph-builder-MOGFPE3O.mjs} +25 -24
  14. package/dist/lib/browser/app-graph-builder-MOGFPE3O.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-UJ4QH3LV.mjs +17 -0
  16. package/dist/lib/browser/blueprint-definition-UJ4QH3LV.mjs.map +7 -0
  17. package/dist/lib/browser/blueprints/index.mjs +3 -3
  18. package/dist/lib/browser/{call-manager-4P536YNX.mjs → call-manager-SBJYUKXN.mjs} +5 -4
  19. package/dist/lib/browser/call-manager-SBJYUKXN.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-2M2HV5K4.mjs +35 -0
  21. package/dist/lib/browser/chunk-2M2HV5K4.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-2FIHSX35.mjs → chunk-A4VH2D5C.mjs} +30 -46
  23. package/dist/lib/browser/chunk-A4VH2D5C.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-BWXT2OVT.mjs +1094 -0
  25. package/dist/lib/browser/chunk-BWXT2OVT.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-DLO2G3DM.mjs → chunk-HDLDMR54.mjs} +2 -2
  27. package/dist/lib/browser/chunk-HDLDMR54.mjs.map +7 -0
  28. package/dist/lib/browser/{chunk-ZFLSTQSE.mjs → chunk-J75MXJZN.mjs} +26 -27
  29. package/dist/lib/browser/chunk-J75MXJZN.mjs.map +7 -0
  30. package/dist/lib/browser/{markdown-QMJLRR6R.mjs → chunk-MJXZ26FR.mjs} +3 -78
  31. package/dist/lib/browser/chunk-MJXZ26FR.mjs.map +7 -0
  32. package/dist/lib/browser/chunk-MQJNILMF.mjs +127 -0
  33. package/dist/lib/browser/chunk-MQJNILMF.mjs.map +7 -0
  34. package/dist/lib/browser/chunk-QVJO3VJ4.mjs +20 -0
  35. package/dist/lib/browser/chunk-QVJO3VJ4.mjs.map +7 -0
  36. package/dist/lib/browser/chunk-SRVNHDO7.mjs +221 -0
  37. package/dist/lib/browser/chunk-SRVNHDO7.mjs.map +7 -0
  38. package/dist/lib/browser/index.mjs +60 -80
  39. package/dist/lib/browser/index.mjs.map +4 -4
  40. package/dist/lib/browser/markdown-EG46BLO3.mjs +83 -0
  41. package/dist/lib/browser/markdown-EG46BLO3.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/{operation-resolver-T63EP5TY.mjs → operation-resolver-ZZAG4PJ2.mjs} +22 -29
  44. package/dist/lib/browser/operation-resolver-ZZAG4PJ2.mjs.map +7 -0
  45. package/dist/lib/browser/{react-root-56MJI77R.mjs → react-root-5MXZ6Y3J.mjs} +8 -6
  46. package/dist/lib/browser/react-root-5MXZ6Y3J.mjs.map +7 -0
  47. package/dist/lib/browser/{react-surface-DMBHQOXJ.mjs → react-surface-J4X3HUUD.mjs} +40 -35
  48. package/dist/lib/browser/react-surface-J4X3HUUD.mjs.map +7 -0
  49. package/dist/lib/browser/{settings-WZMJMML3.mjs → settings-E6YJEDEZ.mjs} +8 -5
  50. package/dist/lib/browser/settings-E6YJEDEZ.mjs.map +7 -0
  51. package/dist/lib/browser/{state-SJR2GL5G.mjs → state-G35LOVYP.mjs} +3 -2
  52. package/dist/lib/browser/types/index.mjs +2 -1
  53. package/dist/lib/node-esm/CallDebugPanel-7OIL5FVT.mjs +183 -0
  54. package/dist/lib/node-esm/CallDebugPanel-7OIL5FVT.mjs.map +7 -0
  55. package/dist/lib/node-esm/CallSidebar-QDM234XX.mjs +37 -0
  56. package/dist/lib/node-esm/CallSidebar-QDM234XX.mjs.map +7 -0
  57. package/dist/lib/node-esm/ChannelContainer-AFBKQJZU.mjs +18 -0
  58. package/dist/lib/node-esm/ChannelContainer-AFBKQJZU.mjs.map +7 -0
  59. package/dist/lib/node-esm/ChatContainer-ZQF6LTM6.mjs +19 -0
  60. package/dist/lib/node-esm/ChatContainer-ZQF6LTM6.mjs.map +7 -0
  61. package/dist/lib/node-esm/ThreadCompanion-SNRNEPWT.mjs +208 -0
  62. package/dist/lib/node-esm/ThreadCompanion-SNRNEPWT.mjs.map +7 -0
  63. package/dist/lib/node-esm/ThreadSettings-TCZMYH3J.mjs +21 -0
  64. package/dist/lib/node-esm/ThreadSettings-TCZMYH3J.mjs.map +7 -0
  65. package/dist/lib/node-esm/{app-graph-builder-JCSVFRVY.mjs → app-graph-builder-BIAIWS2E.mjs} +25 -24
  66. package/dist/lib/node-esm/app-graph-builder-BIAIWS2E.mjs.map +7 -0
  67. package/dist/lib/node-esm/{blueprint-definition-MZZXXL37.mjs → blueprint-definition-SABUBK23.mjs} +6 -6
  68. package/dist/lib/node-esm/blueprint-definition-SABUBK23.mjs.map +7 -0
  69. package/dist/lib/node-esm/blueprints/index.mjs +3 -3
  70. package/dist/lib/node-esm/{call-manager-FMLRR5S5.mjs → call-manager-5JYDNYEA.mjs} +5 -4
  71. package/dist/lib/node-esm/call-manager-5JYDNYEA.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-4H4UJROP.mjs +128 -0
  73. package/dist/lib/node-esm/chunk-4H4UJROP.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-7CNPVAGT.mjs +222 -0
  75. package/dist/lib/node-esm/chunk-7CNPVAGT.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-A3SWGVF3.mjs +37 -0
  77. package/dist/lib/node-esm/chunk-A3SWGVF3.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-DFXKA3BF.mjs +1095 -0
  79. package/dist/lib/node-esm/chunk-DFXKA3BF.mjs.map +7 -0
  80. package/dist/lib/node-esm/{chunk-WMWUXWAS.mjs → chunk-HT4D266X.mjs} +30 -46
  81. package/dist/lib/node-esm/chunk-HT4D266X.mjs.map +7 -0
  82. package/dist/lib/node-esm/chunk-N2T5KLKB.mjs +22 -0
  83. package/dist/lib/node-esm/chunk-N2T5KLKB.mjs.map +7 -0
  84. package/dist/lib/node-esm/{chunk-AQHPP6ZX.mjs → chunk-NDSI2G7B.mjs} +26 -26
  85. package/dist/lib/node-esm/chunk-NDSI2G7B.mjs.map +7 -0
  86. package/dist/lib/node-esm/{markdown-L6LLQLIN.mjs → chunk-SV74KS5H.mjs} +3 -78
  87. package/dist/lib/node-esm/chunk-SV74KS5H.mjs.map +7 -0
  88. package/dist/lib/node-esm/{chunk-KRBZBJRI.mjs → chunk-YN2Y7GPW.mjs} +2 -2
  89. package/dist/lib/node-esm/chunk-YN2Y7GPW.mjs.map +7 -0
  90. package/dist/lib/node-esm/index.mjs +60 -80
  91. package/dist/lib/node-esm/index.mjs.map +4 -4
  92. package/dist/lib/node-esm/markdown-YUI4GVUF.mjs +84 -0
  93. package/dist/lib/node-esm/markdown-YUI4GVUF.mjs.map +7 -0
  94. package/dist/lib/node-esm/meta.json +1 -1
  95. package/dist/lib/node-esm/{operation-resolver-G6GZPBRP.mjs → operation-resolver-YJMVCJEM.mjs} +22 -29
  96. package/dist/lib/node-esm/operation-resolver-YJMVCJEM.mjs.map +7 -0
  97. package/dist/lib/node-esm/{react-root-V4W4X5GL.mjs → react-root-I3D36WIQ.mjs} +8 -6
  98. package/dist/lib/node-esm/react-root-I3D36WIQ.mjs.map +7 -0
  99. package/dist/lib/node-esm/{react-surface-ELDSTUA3.mjs → react-surface-3OCF55AK.mjs} +40 -35
  100. package/dist/lib/node-esm/react-surface-3OCF55AK.mjs.map +7 -0
  101. package/dist/lib/node-esm/{settings-37CO3SNR.mjs → settings-2FQ6CDHD.mjs} +8 -5
  102. package/dist/lib/node-esm/settings-2FQ6CDHD.mjs.map +7 -0
  103. package/dist/lib/node-esm/{state-5R3TZJQE.mjs → state-ZQ2Y3R2X.mjs} +3 -2
  104. package/dist/lib/{browser/state-SJR2GL5G.mjs.map → node-esm/state-ZQ2Y3R2X.mjs.map} +1 -1
  105. package/dist/lib/node-esm/types/index.mjs +2 -1
  106. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  107. package/dist/types/src/blueprints/index.d.ts +1 -1
  108. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  109. package/dist/types/src/blueprints/thread-blueprint.d.ts +3 -20
  110. package/dist/types/src/blueprints/thread-blueprint.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
  112. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +3 -6
  114. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
  115. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -1
  116. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/call-manager/call-manager.d.ts +1 -1
  118. package/dist/types/src/capabilities/call-manager/call-manager.d.ts.map +1 -1
  119. package/dist/types/src/capabilities/index.d.ts +0 -1
  120. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  121. package/dist/types/src/capabilities/markdown/markdown.d.ts +1 -1
  122. package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
  124. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
  125. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
  126. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
  127. package/dist/types/src/capabilities/react-root/react-root.d.ts +1 -1
  128. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
  129. package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
  130. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
  131. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
  132. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
  133. package/dist/types/src/capabilities/settings/index.d.ts +1 -1
  134. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
  135. package/dist/types/src/capabilities/settings/settings.d.ts +3 -2
  136. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
  137. package/dist/types/src/capabilities/state/state.d.ts +1 -1
  138. package/dist/types/src/components/Call/Toolbar.d.ts.map +1 -1
  139. package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts +13 -0
  140. package/dist/types/src/components/CommentsPanel/CommentsPanel.d.ts.map +1 -0
  141. package/dist/types/src/components/{Comments.stories.d.ts → CommentsPanel/CommentsPanel.stories.d.ts} +4 -2
  142. package/dist/types/src/components/CommentsPanel/CommentsPanel.stories.d.ts.map +1 -0
  143. package/dist/types/src/components/{CommentsThreadContainer.d.ts → CommentsPanel/CommentsThread.d.ts} +3 -3
  144. package/dist/types/src/components/CommentsPanel/CommentsThread.d.ts.map +1 -0
  145. package/dist/types/src/components/CommentsPanel/index.d.ts +3 -0
  146. package/dist/types/src/components/CommentsPanel/index.d.ts.map +1 -0
  147. package/dist/types/src/components/MessagePanel/MessagePanel.d.ts +15 -0
  148. package/dist/types/src/components/MessagePanel/MessagePanel.d.ts.map +1 -0
  149. package/dist/types/src/components/MessagePanel/index.d.ts +2 -0
  150. package/dist/types/src/components/MessagePanel/index.d.ts.map +1 -0
  151. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts +2 -0
  152. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts.map +1 -1
  153. package/dist/types/src/components/ResponsiveGrid/{ResponsiveContainer.d.ts → ResponsivePanel.d.ts} +4 -4
  154. package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.d.ts.map +1 -0
  155. package/dist/types/src/components/ResponsiveGrid/{ResponsiveContainer.stories.d.ts → ResponsivePanel.stories.d.ts} +5 -3
  156. package/dist/types/src/components/ResponsiveGrid/ResponsivePanel.stories.d.ts.map +1 -0
  157. package/dist/types/src/components/ResponsiveGrid/index.d.ts +1 -1
  158. package/dist/types/src/components/ResponsiveGrid/index.d.ts.map +1 -1
  159. package/dist/types/src/components/index.d.ts +2 -9
  160. package/dist/types/src/components/index.d.ts.map +1 -1
  161. package/dist/types/src/{components → containers/CallDebugPanel}/CallDebugPanel.d.ts +1 -1
  162. package/dist/types/src/containers/CallDebugPanel/CallDebugPanel.d.ts.map +1 -0
  163. package/dist/types/src/containers/CallDebugPanel/index.d.ts +3 -0
  164. package/dist/types/src/containers/CallDebugPanel/index.d.ts.map +1 -0
  165. package/dist/types/src/{components → containers/CallSidebar}/CallSidebar.d.ts +0 -1
  166. package/dist/types/src/containers/CallSidebar/CallSidebar.d.ts.map +1 -0
  167. package/dist/types/src/containers/CallSidebar/index.d.ts +3 -0
  168. package/dist/types/src/containers/CallSidebar/index.d.ts.map +1 -0
  169. package/dist/types/src/{components → containers/ChannelContainer}/ChannelContainer.d.ts +3 -4
  170. package/dist/types/src/containers/ChannelContainer/ChannelContainer.d.ts.map +1 -0
  171. package/dist/types/src/{components → containers/ChannelContainer}/ChannelContainer.stories.d.ts +4 -2
  172. package/dist/types/src/containers/ChannelContainer/ChannelContainer.stories.d.ts.map +1 -0
  173. package/dist/types/src/containers/ChannelContainer/index.d.ts +3 -0
  174. package/dist/types/src/containers/ChannelContainer/index.d.ts.map +1 -0
  175. package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +4 -5
  176. package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
  177. package/dist/types/src/{components/Chat.stories.d.ts → containers/ChatContainer/ChatContainer.stories.d.ts} +4 -2
  178. package/dist/types/src/containers/ChatContainer/ChatContainer.stories.d.ts.map +1 -0
  179. package/dist/types/src/containers/ChatContainer/index.d.ts +4 -0
  180. package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
  181. package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts +6 -0
  182. package/dist/types/src/containers/ThreadCompanion/ThreadCompanion.d.ts.map +1 -0
  183. package/dist/types/src/containers/ThreadCompanion/index.d.ts +3 -0
  184. package/dist/types/src/containers/ThreadCompanion/index.d.ts.map +1 -0
  185. package/dist/types/src/{components → containers/ThreadSettings}/ThreadSettings.d.ts +1 -1
  186. package/dist/types/src/containers/ThreadSettings/ThreadSettings.d.ts.map +1 -0
  187. package/dist/types/src/containers/ThreadSettings/index.d.ts +3 -0
  188. package/dist/types/src/containers/ThreadSettings/index.d.ts.map +1 -0
  189. package/dist/types/src/containers/index.d.ts +8 -0
  190. package/dist/types/src/containers/index.d.ts.map +1 -0
  191. package/dist/types/src/{components/command-extension.d.ts → extensions/command.d.ts} +1 -1
  192. package/dist/types/src/extensions/command.d.ts.map +1 -0
  193. package/dist/types/src/extensions/index.d.ts +1 -0
  194. package/dist/types/src/extensions/index.d.ts.map +1 -1
  195. package/dist/types/src/functions/create-proposals.d.ts +8 -1
  196. package/dist/types/src/functions/create-proposals.d.ts.map +1 -1
  197. package/dist/types/src/functions/index.d.ts +13 -1
  198. package/dist/types/src/functions/index.d.ts.map +1 -1
  199. package/dist/types/src/hooks/analytics.d.ts.map +1 -1
  200. package/dist/types/src/{components/testing.d.ts → testing/data.d.ts} +1 -1
  201. package/dist/types/src/testing/data.d.ts.map +1 -0
  202. package/dist/types/src/testing/stories.d.ts.map +1 -1
  203. package/dist/types/src/translations.d.ts +2 -0
  204. package/dist/types/src/translations.d.ts.map +1 -1
  205. package/dist/types/src/types/Channel.d.ts +25 -9
  206. package/dist/types/src/types/Channel.d.ts.map +1 -1
  207. package/dist/types/src/types/types.d.ts +182 -105
  208. package/dist/types/src/types/types.d.ts.map +1 -1
  209. package/dist/types/tsconfig.tsbuildinfo +1 -1
  210. package/package.json +67 -65
  211. package/src/ThreadPlugin.tsx +29 -46
  212. package/src/blueprints/index.ts +1 -1
  213. package/src/blueprints/thread-blueprint.ts +14 -6
  214. package/src/calls-service.stories.tsx +2 -2
  215. package/src/capabilities/app-graph-builder/app-graph-builder.ts +20 -18
  216. package/src/capabilities/blueprint-definition/blueprint-definition.ts +6 -12
  217. package/src/capabilities/call-manager/call-manager.ts +2 -2
  218. package/src/capabilities/index.ts +0 -1
  219. package/src/capabilities/markdown/markdown.ts +11 -13
  220. package/src/capabilities/operation-resolver/operation-resolver.ts +13 -21
  221. package/src/capabilities/react-root/react-root.tsx +2 -2
  222. package/src/capabilities/react-surface/react-surface.tsx +28 -24
  223. package/src/capabilities/settings/settings.ts +3 -2
  224. package/src/components/Call/Call.tsx +1 -1
  225. package/src/components/Call/Toolbar.tsx +6 -7
  226. package/src/components/{Comments.stories.tsx → CommentsPanel/CommentsPanel.stories.tsx} +12 -12
  227. package/src/components/{CommentsContainer.tsx → CommentsPanel/CommentsPanel.tsx} +14 -13
  228. package/src/components/{CommentsThreadContainer.tsx → CommentsPanel/CommentsThread.tsx} +12 -13
  229. package/src/components/CommentsPanel/index.ts +6 -0
  230. package/src/components/Lobby/Lobby.tsx +4 -4
  231. package/src/components/Media/VideoObject.stories.tsx +6 -6
  232. package/src/components/Media/VideoObject.tsx +1 -1
  233. package/src/components/{MessageContainer.tsx → MessagePanel/MessagePanel.tsx} +16 -16
  234. package/src/components/MessagePanel/index.ts +5 -0
  235. package/src/components/Participant/Participant.tsx +1 -1
  236. package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +4 -4
  237. package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +8 -8
  238. package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +5 -5
  239. package/src/components/ResponsiveGrid/{ResponsiveContainer.stories.tsx → ResponsivePanel.stories.tsx} +7 -7
  240. package/src/components/ResponsiveGrid/{ResponsiveContainer.tsx → ResponsivePanel.tsx} +5 -5
  241. package/src/components/ResponsiveGrid/index.ts +1 -1
  242. package/src/components/index.ts +2 -10
  243. package/src/{components → containers/CallDebugPanel}/CallDebugPanel.tsx +4 -4
  244. package/src/containers/CallDebugPanel/index.ts +7 -0
  245. package/src/{components → containers/CallSidebar}/CallSidebar.tsx +4 -7
  246. package/src/containers/CallSidebar/index.ts +7 -0
  247. package/src/{components → containers/ChannelContainer}/ChannelContainer.stories.tsx +11 -13
  248. package/src/{components → containers/ChannelContainer}/ChannelContainer.tsx +58 -43
  249. package/src/containers/ChannelContainer/index.ts +7 -0
  250. package/src/{components/Chat.stories.tsx → containers/ChatContainer/ChatContainer.stories.tsx} +20 -18
  251. package/src/{components → containers/ChatContainer}/ChatContainer.tsx +27 -37
  252. package/src/containers/ChatContainer/index.ts +8 -0
  253. package/src/{components → containers/ThreadCompanion}/ThreadCompanion.tsx +50 -44
  254. package/src/containers/ThreadCompanion/index.ts +7 -0
  255. package/src/{components → containers/ThreadSettings}/ThreadSettings.tsx +5 -4
  256. package/src/containers/ThreadSettings/index.ts +7 -0
  257. package/src/containers/index.ts +12 -0
  258. package/src/{components/command-extension.ts → extensions/command.ts} +1 -1
  259. package/src/extensions/index.ts +1 -0
  260. package/src/functions/create-proposals.ts +10 -10
  261. package/src/functions/index.ts +5 -1
  262. package/src/hooks/analytics.ts +2 -1
  263. package/src/meta.ts +2 -2
  264. package/src/testing/stories.ts +2 -1
  265. package/src/translations.ts +1 -0
  266. package/src/types/Channel.ts +5 -3
  267. package/src/types/capabilities.ts +5 -5
  268. package/src/types/types.ts +18 -18
  269. package/dist/lib/browser/app-graph-builder-7C2QW32W.mjs.map +0 -7
  270. package/dist/lib/browser/blueprint-definition-UQ63QKQG.mjs +0 -17
  271. package/dist/lib/browser/blueprint-definition-UQ63QKQG.mjs.map +0 -7
  272. package/dist/lib/browser/call-manager-4P536YNX.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-2FIHSX35.mjs.map +0 -7
  274. package/dist/lib/browser/chunk-DLO2G3DM.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-YSHXWAL3.mjs +0 -1815
  276. package/dist/lib/browser/chunk-YSHXWAL3.mjs.map +0 -7
  277. package/dist/lib/browser/chunk-ZFLSTQSE.mjs.map +0 -7
  278. package/dist/lib/browser/markdown-QMJLRR6R.mjs.map +0 -7
  279. package/dist/lib/browser/operation-resolver-T63EP5TY.mjs.map +0 -7
  280. package/dist/lib/browser/react-root-56MJI77R.mjs.map +0 -7
  281. package/dist/lib/browser/react-surface-DMBHQOXJ.mjs.map +0 -7
  282. package/dist/lib/browser/repair-6OZ75AUU.mjs +0 -38
  283. package/dist/lib/browser/repair-6OZ75AUU.mjs.map +0 -7
  284. package/dist/lib/browser/settings-WZMJMML3.mjs.map +0 -7
  285. package/dist/lib/node-esm/app-graph-builder-JCSVFRVY.mjs.map +0 -7
  286. package/dist/lib/node-esm/blueprint-definition-MZZXXL37.mjs.map +0 -7
  287. package/dist/lib/node-esm/call-manager-FMLRR5S5.mjs.map +0 -7
  288. package/dist/lib/node-esm/chunk-7XQLXMX7.mjs +0 -1816
  289. package/dist/lib/node-esm/chunk-7XQLXMX7.mjs.map +0 -7
  290. package/dist/lib/node-esm/chunk-AQHPP6ZX.mjs.map +0 -7
  291. package/dist/lib/node-esm/chunk-KRBZBJRI.mjs.map +0 -7
  292. package/dist/lib/node-esm/chunk-WMWUXWAS.mjs.map +0 -7
  293. package/dist/lib/node-esm/markdown-L6LLQLIN.mjs.map +0 -7
  294. package/dist/lib/node-esm/operation-resolver-G6GZPBRP.mjs.map +0 -7
  295. package/dist/lib/node-esm/react-root-V4W4X5GL.mjs.map +0 -7
  296. package/dist/lib/node-esm/react-surface-ELDSTUA3.mjs.map +0 -7
  297. package/dist/lib/node-esm/repair-6777EPOM.mjs +0 -39
  298. package/dist/lib/node-esm/repair-6777EPOM.mjs.map +0 -7
  299. package/dist/lib/node-esm/settings-37CO3SNR.mjs.map +0 -7
  300. package/dist/types/src/capabilities/repair/index.d.ts +0 -3
  301. package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
  302. package/dist/types/src/capabilities/repair/repair.d.ts +0 -6
  303. package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
  304. package/dist/types/src/components/CallDebugPanel.d.ts.map +0 -1
  305. package/dist/types/src/components/CallSidebar.d.ts.map +0 -1
  306. package/dist/types/src/components/ChannelContainer.d.ts.map +0 -1
  307. package/dist/types/src/components/ChannelContainer.stories.d.ts.map +0 -1
  308. package/dist/types/src/components/Chat.stories.d.ts.map +0 -1
  309. package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
  310. package/dist/types/src/components/Comments.stories.d.ts.map +0 -1
  311. package/dist/types/src/components/CommentsContainer.d.ts +0 -13
  312. package/dist/types/src/components/CommentsContainer.d.ts.map +0 -1
  313. package/dist/types/src/components/CommentsThreadContainer.d.ts.map +0 -1
  314. package/dist/types/src/components/MessageContainer.d.ts +0 -15
  315. package/dist/types/src/components/MessageContainer.d.ts.map +0 -1
  316. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts.map +0 -1
  317. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts.map +0 -1
  318. package/dist/types/src/components/ThreadCompanion.d.ts +0 -5
  319. package/dist/types/src/components/ThreadCompanion.d.ts.map +0 -1
  320. package/dist/types/src/components/ThreadSettings.d.ts.map +0 -1
  321. package/dist/types/src/components/command-extension.d.ts.map +0 -1
  322. package/dist/types/src/components/testing.d.ts.map +0 -1
  323. package/src/capabilities/repair/index.ts +0 -7
  324. package/src/capabilities/repair/repair.ts +0 -51
  325. /package/dist/lib/{node-esm/state-5R3TZJQE.mjs.map → browser/state-G35LOVYP.mjs.map} +0 -0
  326. /package/src/{components/testing.ts → testing/data.ts} +0 -0
@@ -1,1816 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- useDebugMode,
4
- useOnEditAnalytics,
5
- useStatus
6
- } from "./chunk-KRBZBJRI.mjs";
7
- import {
8
- getMessageMetadata
9
- } from "./chunk-ABUFOZVX.mjs";
10
- import {
11
- ThreadCapabilities,
12
- ThreadOperation,
13
- meta
14
- } from "./chunk-WMWUXWAS.mjs";
15
-
16
- // src/components/Call/Call.tsx
17
- import { useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
18
- import React9 from "react";
19
- import { useCapability as useCapability3 } from "@dxos/app-framework/react";
20
-
21
- // src/components/Media/AudioStream.tsx
22
- import React, { useEffect, useRef } from "react";
23
- var AudioStream = ({ tracks }) => {
24
- const mediaStreamRef = useRef(new MediaStream());
25
- const ref = useRef(null);
26
- useEffect(() => {
27
- const audio = ref.current;
28
- if (!audio) {
29
- return;
30
- }
31
- const mediaStream = mediaStreamRef.current;
32
- audio.srcObject = mediaStream;
33
- }, []);
34
- const resetSrcObject = () => {
35
- const audio = ref.current;
36
- const mediaStream = mediaStreamRef.current;
37
- if (!audio || !mediaStream) {
38
- return;
39
- }
40
- audio.addEventListener("canplay", () => audio.play(), {
41
- once: true
42
- });
43
- audio.srcObject = mediaStream;
44
- };
45
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("audio", {
46
- ref,
47
- autoPlay: true
48
- }), tracks.map((track) => /* @__PURE__ */ React.createElement(AudioTrack, {
49
- key: track.id,
50
- track,
51
- mediaStream: mediaStreamRef.current,
52
- resetSrcObject
53
- })));
54
- };
55
- var AudioTrack = ({ track, mediaStream, resetSrcObject }) => {
56
- useEffect(() => {
57
- const currentTrack = track;
58
- mediaStream.addTrack(currentTrack);
59
- resetSrcObject();
60
- return () => {
61
- mediaStream.removeTrack(currentTrack);
62
- resetSrcObject();
63
- };
64
- }, [
65
- track,
66
- mediaStream
67
- ]);
68
- return null;
69
- };
70
-
71
- // src/components/Media/VideoObject.tsx
72
- import React2, { forwardRef, memo, useEffect as useEffect2, useRef as useRef2 } from "react";
73
- import { mx } from "@dxos/ui-theme";
74
- var VideoObject = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ videoStream, classNames, flip, contain, ...rest }, ref) => {
75
- const internalRef = useRef2(null);
76
- useEffect2(() => {
77
- const video = internalRef.current;
78
- if (video && videoStream) {
79
- video.srcObject = videoStream;
80
- video.setAttribute("autoplay", "true");
81
- video.setAttribute("playsinline", "true");
82
- }
83
- }, [
84
- videoStream,
85
- internalRef.current
86
- ]);
87
- return /* @__PURE__ */ React2.createElement("video", {
88
- className: mx("is-full aspect-video", flip && "scale-x-[-1]", contain ? "object-contain" : "object-cover", classNames),
89
- ref: (v) => {
90
- internalRef.current = v;
91
- if (ref === null) {
92
- return;
93
- }
94
- if (typeof ref === "function") {
95
- ref(v);
96
- } else {
97
- ref.current = v;
98
- }
99
- },
100
- ...rest
101
- });
102
- }));
103
- VideoObject.displayName = "VideoObject";
104
-
105
- // src/components/Participant/Participant.tsx
106
- import { useAtomValue } from "@effect-atom/atom-react";
107
- import React6, { memo as memo2, useMemo as useMemo2 } from "react";
108
- import { useCapability } from "@dxos/app-framework/react";
109
-
110
- // src/components/ResponsiveGrid/ResponsiveContainer.tsx
111
- import React3 from "react";
112
- import { mx as mx2 } from "@dxos/ui-theme";
113
- var ResponsiveContainer = ({ children }) => {
114
- return (
115
- // Outer container that takes full size of parent.
116
- /* @__PURE__ */ React3.createElement("div", {
117
- role: "none",
118
- className: "relative flex is-full bs-full"
119
- }, /* @__PURE__ */ React3.createElement("div", {
120
- role: "none",
121
- className: "absolute inset-0 flex justify-center items-center"
122
- }, /* @__PURE__ */ React3.createElement("div", {
123
- role: "none",
124
- className: mx2("max-bs-full max-is-full is-auto bs-auto aspect-video")
125
- }, children)))
126
- );
127
- };
128
-
129
- // src/components/ResponsiveGrid/ResponsiveGrid.tsx
130
- import React4, { useCallback, useEffect as useEffect3, useLayoutEffect, useMemo, useState } from "react";
131
- import { useResizeDetector } from "react-resize-detector";
132
- import { invariant } from "@dxos/invariant";
133
- import { mx as mx3 } from "@dxos/ui-theme";
134
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-thread/src/components/ResponsiveGrid/ResponsiveGrid.tsx";
135
- var ASPECT_RATIO = 16 / 9;
136
- var MIN_GALLERY_HEIGHT = 250;
137
- var DEFAULT_GAP = 8;
138
- var maxImageSize = "is-[2560px] bs-[1440px]";
139
- var defaultGetId = (item) => item.id;
140
- var ResponsiveGrid = ({ classNames, Cell, gap = DEFAULT_GAP, getId: getId2 = defaultGetId, items, pinned, autoHideGallery = false, debug, onPinnedChange }) => {
141
- const { width: containerWidth = 0, height: containerHeight = 0, ref: containerRef } = useResizeDetector({
142
- refreshRate: 100
143
- });
144
- const [dividerHeight, setDividerHeight] = useState(0);
145
- useEffect3(() => {
146
- if (containerWidth && containerHeight) {
147
- const { height: height2 } = fitAspectRatio(containerWidth, containerHeight, ASPECT_RATIO);
148
- setDividerHeight(Math.min(height2, containerHeight - MIN_GALLERY_HEIGHT));
149
- }
150
- }, [
151
- containerWidth,
152
- containerHeight
153
- ]);
154
- const pinnedItem = useMemo(() => items.find((item) => getId2(item) === pinned), [
155
- items,
156
- pinned
157
- ]);
158
- const mainItems = useMemo(() => items.filter((item) => getId2(item) !== pinned), [
159
- items,
160
- pinned
161
- ]);
162
- const hideGallery = autoHideGallery && pinnedItem !== void 0;
163
- const [{ time, columns, cellWidth }, setLayout] = useState({
164
- time: 0,
165
- columns: 0,
166
- cellWidth: 0
167
- });
168
- const { width = 0, height = 0, ref: gridContainerRef } = useResizeDetector({
169
- refreshRate: 200
170
- });
171
- useEffect3(() => {
172
- if (containerHeight && width && height) {
173
- const layout = calculateLayout(width, height, mainItems.length, gap);
174
- setLayout({
175
- time: Date.now(),
176
- ...layout
177
- });
178
- }
179
- }, [
180
- containerHeight,
181
- width,
182
- height,
183
- mainItems.length,
184
- gap,
185
- pinned
186
- ]);
187
- const [bounds, setBounds] = useState([]);
188
- useLayoutEffect(() => {
189
- if (!hideGallery && !gridContainerRef.current || !containerHeight) {
190
- return;
191
- }
192
- const t = setTimeout(() => {
193
- setBounds(items.filter((item) => !hideGallery || item === pinnedItem).map((item) => {
194
- invariant(containerRef.current, void 0, {
195
- F: __dxlog_file,
196
- L: 117,
197
- S: void 0,
198
- A: [
199
- "containerRef.current",
200
- ""
201
- ]
202
- });
203
- const el = containerRef.current.querySelector(`[data-grid-item="${getId2(item)}"]`);
204
- if (!el) {
205
- return null;
206
- }
207
- const bounds2 = getRelativeBounds(containerRef.current, el);
208
- return [
209
- item,
210
- bounds2
211
- ];
212
- }).filter((item) => item !== null));
213
- });
214
- return () => clearTimeout(t);
215
- }, [
216
- containerHeight,
217
- items,
218
- pinnedItem,
219
- hideGallery,
220
- time
221
- ]);
222
- const handleClick = useCallback((item) => onPinnedChange?.(getId2(item) === pinned ? void 0 : getId2(item)), [
223
- pinned,
224
- onPinnedChange
225
- ]);
226
- return /* @__PURE__ */ React4.createElement("div", {
227
- ref: containerRef,
228
- className: mx3("relative is-full bs-full", classNames)
229
- }, /* @__PURE__ */ React4.createElement("div", {
230
- className: "absolute inset-0 flex flex-col grow gap-2"
231
- }, pinnedItem && /* @__PURE__ */ React4.createElement("div", {
232
- className: mx3("flex grow-[2] shrink overflow-hidden justify-center items-center", hideGallery && "bs-full"),
233
- style: hideGallery ? {} : {
234
- height: dividerHeight
235
- }
236
- }, /* @__PURE__ */ React4.createElement(SoloItem, {
237
- id: getId2(pinnedItem),
238
- debug
239
- })), !hideGallery && /* @__PURE__ */ React4.createElement("div", {
240
- ref: gridContainerRef,
241
- className: "flex grow-[1] overflow-hidden justify-center items-center",
242
- style: hideGallery ? {} : {
243
- minHeight: MIN_GALLERY_HEIGHT
244
- }
245
- }, mainItems.length === 1 && /* @__PURE__ */ React4.createElement("div", {
246
- style: {
247
- width: cellWidth
248
- },
249
- className: "flex bs-full"
250
- }, /* @__PURE__ */ React4.createElement(SoloItem, {
251
- id: getId2(mainItems[0]),
252
- debug
253
- })), mainItems.length > 1 && columns > 0 && /* @__PURE__ */ React4.createElement("div", {
254
- role: "grid",
255
- style: {
256
- display: "grid",
257
- gridTemplateColumns: `repeat(${columns}, ${cellWidth}px)`,
258
- gap: `${gap}px`
259
- }
260
- }, mainItems.map((item) => /* @__PURE__ */ React4.createElement("div", {
261
- key: getId2(item),
262
- "data-grid-item": getId2(item),
263
- className: mx3("aspect-video max-bs-full max-is-full is-auto bs-auto", debug && "border border-primary-500")
264
- }))))), /* @__PURE__ */ React4.createElement("div", {
265
- className: mx3(debug && "opacity-10")
266
- }, bounds.map(([item, bounds2]) => /* @__PURE__ */ React4.createElement(Cell, {
267
- key: getId2(item),
268
- classNames: "absolute transition-all duration-500",
269
- item,
270
- style: bounds2,
271
- pinned: getId2(item) === pinned,
272
- onClick: items.length > 1 ? handleClick : void 0
273
- }))));
274
- };
275
- var SoloItem = ({ debug, id }) => {
276
- return /* @__PURE__ */ React4.createElement(ResponsiveContainer, null, /* @__PURE__ */ React4.createElement("div", {
277
- "data-grid-item": id,
278
- className: mx3("aspect-video overflow-hidden", debug && "z-20 border-2 border-primary-500")
279
- }, /* @__PURE__ */ React4.createElement("img", {
280
- alt: "placeholder video",
281
- className: mx3("opacity-0", maxImageSize)
282
- })));
283
- };
284
- var getRelativeBounds = (container, el) => {
285
- const containerRect = container.getBoundingClientRect();
286
- const elementRect = el.getBoundingClientRect();
287
- return {
288
- top: elementRect.top - containerRect.top,
289
- left: elementRect.left - containerRect.left,
290
- width: elementRect.width,
291
- height: elementRect.height
292
- };
293
- };
294
- var calculateLayout = (containerWidth, containerHeight, count, gap, aspectRatio = ASPECT_RATIO) => {
295
- if (count === 0) {
296
- return {
297
- columns: 1,
298
- cellWidth: 1
299
- };
300
- }
301
- let minWastedSpace = Infinity;
302
- let bestColumns = 1;
303
- let cellWidth = 0;
304
- for (let rows = 1; rows <= count; rows++) {
305
- const cols = Math.ceil(count / rows);
306
- const { width: itemWidth, height: itemHeight } = fitItemsToGrid(containerWidth, containerHeight, cols, rows, aspectRatio, gap);
307
- const usedWidth = itemWidth * cols + gap * cols - 1;
308
- const usedHeight = itemHeight * rows + gap * rows - 1;
309
- const wastedSpace = containerWidth * containerHeight - usedWidth * usedHeight;
310
- if (wastedSpace < minWastedSpace) {
311
- minWastedSpace = wastedSpace;
312
- bestColumns = cols;
313
- cellWidth = itemWidth;
314
- }
315
- }
316
- return {
317
- columns: bestColumns,
318
- cellWidth
319
- };
320
- };
321
- var fitItemsToGrid = (outerWidth, outerHeight, numCols, numRows, aspectRatio, gap) => {
322
- const availableWidth = outerWidth - gap * (numCols - 1);
323
- const availableHeight = outerHeight - gap * (numRows - 1);
324
- const maxCellWidth = availableWidth / numCols;
325
- const maxCellHeight = availableHeight / numRows;
326
- return fitAspectRatio(maxCellWidth, maxCellHeight, aspectRatio);
327
- };
328
- var fitAspectRatio = (outerWidth, outerHeight, aspectRatio) => {
329
- if (outerWidth <= 0 || outerHeight <= 0 || aspectRatio <= 0) {
330
- return {
331
- width: 0,
332
- height: 0
333
- };
334
- }
335
- let width = outerWidth;
336
- let height = width / aspectRatio;
337
- if (height > outerHeight) {
338
- height = outerHeight;
339
- width = height * aspectRatio;
340
- }
341
- return {
342
- width,
343
- height
344
- };
345
- };
346
-
347
- // src/components/ResponsiveGrid/ResponsiveGridItem.tsx
348
- import React5, { useEffect as useEffect4, useState as useState2 } from "react";
349
- import { Icon, IconButton, useTranslation } from "@dxos/react-ui";
350
- import { Waveform } from "@dxos/react-ui-sfx";
351
- import { groupHoverControlItemWithTransition, mx as mx4 } from "@dxos/ui-theme";
352
- var ResponsiveGridItem = ({ children, classNames, item, style, name, self, pinned, screenshare, video, mute, wave, speaking, onClick }) => {
353
- const { t } = useTranslation(meta.id);
354
- const iconProps = {
355
- wave: {
356
- icon: "ph--hand-waving--duotone",
357
- label: t("icon wave"),
358
- classNames: "animate-pulse bg-orange-500"
359
- },
360
- mute: {
361
- icon: "ph--microphone-slash--regular",
362
- label: t("icon muted")
363
- }
364
- };
365
- const props = wave && !pinned ? iconProps.wave : mute ? iconProps.mute : speaking ? iconProps.speaking : void 0;
366
- const [speakingIndicator, setSpeakingIndicator] = useState2(speaking);
367
- useEffect4(() => {
368
- if (speaking) {
369
- setSpeakingIndicator(true);
370
- } else {
371
- const timeout = setTimeout(() => {
372
- setSpeakingIndicator(false);
373
- }, 1e3);
374
- return () => clearTimeout(timeout);
375
- }
376
- }, [
377
- speaking
378
- ]);
379
- return /* @__PURE__ */ React5.createElement("div", {
380
- className: mx4("relative is-full bs-full group", "rounded-md outline outline-2 outline-neutral-900 transition-[outline-color] duration-500", speakingIndicator ? "outline-green-500" : !video && "outline-separator", classNames),
381
- style
382
- }, children, onClick && /* @__PURE__ */ React5.createElement("div", {
383
- className: "z-10 absolute top-1 right-1 flex"
384
- }, /* @__PURE__ */ React5.createElement(IconButton, {
385
- classNames: mx4("p-1 min-bs-1 rounded", groupHoverControlItemWithTransition),
386
- iconOnly: true,
387
- icon: pinned ? "ph--x--regular" : "ph--arrows-out--regular",
388
- size: pinned ? 5 : 4,
389
- label: pinned ? t("icon unpin") : t("icon pin"),
390
- onClick: () => onClick?.(item)
391
- })), name && /* @__PURE__ */ React5.createElement("div", {
392
- className: "z-10 absolute bottom-1 left-8 right-1 flex justify-end gap-1 items-center"
393
- }, screenshare && /* @__PURE__ */ React5.createElement(Icon, {
394
- icon: "ph--broadcast--regular",
395
- size: pinned ? 5 : 4
396
- }), /* @__PURE__ */ React5.createElement("div", {
397
- className: mx4("bg-neutral-800 text-neutral-100 plb-0.5 truncate rounded", pinned ? "pli-2" : "pli-1 text-xs")
398
- }, name)), /* @__PURE__ */ React5.createElement("div", {
399
- className: "z-10 absolute bottom-1 left-1 flex"
400
- }, speaking && /* @__PURE__ */ React5.createElement(Waveform, {
401
- active: true,
402
- size: pinned ? 5 : 4
403
- }) || props && /* @__PURE__ */ React5.createElement(IconButton, {
404
- classNames: mx4("p-1 min-bs-1 rounded", props?.classNames),
405
- icon: props?.icon,
406
- label: props?.label,
407
- size: pinned ? 5 : 4,
408
- iconOnly: true
409
- })));
410
- };
411
-
412
- // src/components/Participant/Participant.tsx
413
- var SCREENSHARE_SUFFIX = "_screenshare";
414
- var Participant = /* @__PURE__ */ memo2(({ item: user, debug, ...props }) => {
415
- const call = useCapability(ThreadCapabilities.CallManager);
416
- const self = useAtomValue(call.selfAtom);
417
- const media = useAtomValue(call.mediaAtom);
418
- const isSelf = self.id !== void 0 && user.id !== void 0 && user.id.startsWith(self.id);
419
- const isScreenshare = user.id?.endsWith(SCREENSHARE_SUFFIX);
420
- const pulledVideoStream = useMemo2(() => {
421
- if (isSelf) {
422
- return void 0;
423
- }
424
- const trackName = isScreenshare && user.tracks?.screenshareEnabled ? user.tracks?.screenshare : !isScreenshare && user.tracks?.videoEnabled ? user.tracks?.video : void 0;
425
- return trackName ? media.pulledVideoStreams[trackName]?.stream : void 0;
426
- }, [
427
- isSelf,
428
- isScreenshare,
429
- media.pulledVideoStreams,
430
- user.tracks?.screenshare,
431
- user.tracks?.video,
432
- user.tracks?.screenshareEnabled,
433
- user.tracks?.videoEnabled
434
- ]);
435
- const videoStream = useMemo2(() => {
436
- if (isSelf) {
437
- return isScreenshare ? media.screenshareVideoStream : media.videoStream;
438
- }
439
- return pulledVideoStream;
440
- }, [
441
- isSelf,
442
- isScreenshare,
443
- media.videoStream,
444
- media.screenshareVideoStream,
445
- pulledVideoStream
446
- ]);
447
- return /* @__PURE__ */ React6.createElement(ResponsiveGridItem, {
448
- ...props,
449
- item: user,
450
- name: user.name,
451
- self: isSelf,
452
- screenshare: !!media.screenshareVideoStream,
453
- video: media.videoEnabled,
454
- mute: user ? !user.tracks?.audioEnabled : false,
455
- wave: user.raisedHand,
456
- speaking: user.speaking,
457
- debug
458
- }, /* @__PURE__ */ React6.createElement(VideoObject, {
459
- videoStream,
460
- flip: isSelf && !isScreenshare,
461
- contain: !!isScreenshare,
462
- classNames: "rounded-md"
463
- }));
464
- });
465
- Participant.displayName = "Participant";
466
-
467
- // src/components/Participant/ParticipantGrid.tsx
468
- import React7, { useEffect as useEffect5, useMemo as useMemo3, useState as useState3 } from "react";
469
- var getId = (user) => user.id;
470
- var ParticipantGrid = ({ classNames, self, users, fullscreen, debug }) => {
471
- const [pinned, setPinned] = useState3();
472
- const allUsers = useMemo3(() => {
473
- const allUsers2 = [];
474
- users.forEach((user) => {
475
- if (!user.joined) {
476
- return;
477
- }
478
- allUsers2.push({
479
- ...user,
480
- isSelf: user.id === self.id
481
- });
482
- if (user.tracks?.screenshareEnabled) {
483
- const screenshare = {
484
- ...user,
485
- id: user.id + SCREENSHARE_SUFFIX,
486
- tracks: {
487
- ...user.tracks,
488
- video: user.tracks.screenshare,
489
- videoEnabled: user.tracks.screenshareEnabled
490
- }
491
- };
492
- allUsers2.push(screenshare);
493
- }
494
- });
495
- return allUsers2;
496
- }, [
497
- self,
498
- users
499
- ]);
500
- useEffect5(() => {
501
- if (pinned) {
502
- if (!allUsers.find((user) => user.id === pinned)) {
503
- setPinned(void 0);
504
- }
505
- }
506
- }, [
507
- pinned,
508
- allUsers
509
- ]);
510
- const sortedUsers = allUsers.sort((a, b) => {
511
- if (a.isSelf) {
512
- return 1;
513
- } else if (b.isSelf) {
514
- return -1;
515
- } else if (a.tracks?.screenshareEnabled) {
516
- return -1;
517
- } else if (b.tracks?.screenshareEnabled) {
518
- return 1;
519
- } else {
520
- return 0;
521
- }
522
- });
523
- return /* @__PURE__ */ React7.createElement(ResponsiveGrid, {
524
- classNames,
525
- Cell: Participant,
526
- debug,
527
- getId,
528
- items: sortedUsers,
529
- pinned,
530
- autoHideGallery: fullscreen,
531
- onPinnedChange: setPinned
532
- });
533
- };
534
-
535
- // src/components/Call/Toolbar.tsx
536
- import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
537
- import React8 from "react";
538
- import { useAppGraph, useCapability as useCapability2 } from "@dxos/app-framework/react";
539
- import { Obj } from "@dxos/echo";
540
- import { Node, useActionRunner } from "@dxos/plugin-graph";
541
- import { useActions, useNode } from "@dxos/plugin-graph";
542
- import { Icon as Icon2, IconButton as IconButton2, Toolbar as NaturalToolbar, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
543
- import { groupHoverControlItemWithTransition as groupHoverControlItemWithTransition2, mx as mx5 } from "@dxos/ui-theme";
544
- var Toolbar = ({ classNames, channel, participants, autoHideControls = true, onJoin, onLeave }) => {
545
- const { t } = useTranslation2(meta.id);
546
- const { graph } = useAppGraph();
547
- const runAction = useActionRunner();
548
- const call = useCapability2(ThreadCapabilities.CallManager);
549
- const media = useAtomValue2(call.mediaAtom);
550
- const joined = useAtomValue2(call.joinedAtom);
551
- const raisedHand = useAtomValue2(call.raisedHandAtom);
552
- const node = useNode(graph, channel && Obj.getDXN(channel).toString());
553
- const actions = useActions(graph, node?.id).filter((action) => action.properties.disposition === "toolbar");
554
- const isScreensharing = media.screenshareTrack !== void 0;
555
- const canSharescreen = typeof navigator.mediaDevices !== "undefined" && navigator.mediaDevices.getDisplayMedia !== void 0;
556
- return /* @__PURE__ */ React8.createElement("div", {
557
- className: mx5("z-20 flex justify-center m-8", autoHideControls && groupHoverControlItemWithTransition2)
558
- }, /* @__PURE__ */ React8.createElement(NaturalToolbar.Root, {
559
- classNames: [
560
- "p-2 bg-modalSurface rounded-md shadow-md",
561
- classNames
562
- ]
563
- }, /* @__PURE__ */ React8.createElement(ToggleButton, {
564
- active: media.audioEnabled,
565
- state: {
566
- on: {
567
- icon: "ph--microphone--regular",
568
- label: t("mic off"),
569
- onClick: () => call.turnAudioOff(),
570
- classNames: "bg-callActive"
571
- },
572
- off: {
573
- icon: "ph--microphone-slash--duotone",
574
- label: t("mic on"),
575
- onClick: () => call.turnAudioOn(),
576
- classNames: [
577
- joined && "bg-callAlert"
578
- ]
579
- }
580
- }
581
- }), /* @__PURE__ */ React8.createElement(ToggleButton, {
582
- active: media.videoEnabled,
583
- state: {
584
- on: {
585
- icon: "ph--video-camera--regular",
586
- label: t("camera off"),
587
- onClick: () => call.turnVideoOff()
588
- },
589
- off: {
590
- icon: "ph--video-camera-slash--duotone",
591
- label: t("camera on"),
592
- onClick: () => call.turnVideoOn()
593
- }
594
- }
595
- }), participants !== void 0 && /* @__PURE__ */ React8.createElement("div", {
596
- className: "flex justify-center items-center gap-2 is-[5rem] text-xs text-subdued"
597
- }, /* @__PURE__ */ React8.createElement(Icon2, {
598
- icon: "ph--users--regular",
599
- size: 4
600
- }), /* @__PURE__ */ React8.createElement("div", null, participants)) || /* @__PURE__ */ React8.createElement(NaturalToolbar.Separator, {
601
- variant: "gap"
602
- }), joined && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(ToggleButton, {
603
- disabled: !canSharescreen,
604
- active: isScreensharing,
605
- state: {
606
- on: {
607
- icon: "ph--monitor--regular",
608
- label: t("screenshare off"),
609
- onClick: () => call.turnScreenshareOff()
610
- },
611
- off: {
612
- icon: "ph--monitor-arrow-up--duotone",
613
- label: t("screenshare on"),
614
- onClick: () => call.turnScreenshareOn()
615
- }
616
- }
617
- }), actions.filter((action) => Node.isAction(action)).map((action) => /* @__PURE__ */ React8.createElement(IconButton2, {
618
- key: action.id,
619
- ...defaultButtonProps,
620
- icon: action.properties.icon,
621
- label: toLocalizedString(action.properties.label, t),
622
- classNames: action.properties.classNames,
623
- onClick: () => node && void runAction(action, {
624
- parent: node
625
- })
626
- })), /* @__PURE__ */ React8.createElement(ToggleButton, {
627
- active: raisedHand,
628
- state: {
629
- on: {
630
- icon: "ph--hand-waving--regular",
631
- label: t("lower hand"),
632
- onClick: () => call.setRaisedHand(false),
633
- classNames: [
634
- joined && "bg-callAlert"
635
- ]
636
- },
637
- off: {
638
- icon: "ph--hand-palm--duotone",
639
- label: t("raise hand"),
640
- onClick: () => call.setRaisedHand(true)
641
- }
642
- }
643
- })), joined ? /* @__PURE__ */ React8.createElement(IconButton2, {
644
- variant: "destructive",
645
- icon: "ph--phone-x--regular",
646
- label: t("leave call"),
647
- onClick: onLeave
648
- }) : /* @__PURE__ */ React8.createElement(IconButton2, {
649
- variant: "primary",
650
- icon: "ph--phone-incoming--regular",
651
- label: t("join call"),
652
- onClick: onJoin
653
- })));
654
- };
655
- Toolbar.displayName = "MeetingToolbar";
656
- var defaultButtonProps = {
657
- size: 5,
658
- iconOnly: true
659
- };
660
- var ToggleButton = ({ active, state }) => /* @__PURE__ */ React8.createElement(IconButton2, {
661
- ...defaultButtonProps,
662
- classNames: [
663
- active ? state.on.classNames ?? "bg-callActive" : state.off.classNames
664
- ],
665
- icon: active ? state.on.icon : state.off.icon,
666
- label: active ? state.on.label : state.off.label,
667
- onClick: active ? state.on.onClick : state.off.onClick
668
- });
669
-
670
- // src/components/Call/Call.tsx
671
- var CallRoot = ({ children }) => {
672
- return /* @__PURE__ */ React9.createElement("div", {
673
- className: "relative flex flex-col grow overflow-hidden"
674
- }, children);
675
- };
676
- CallRoot.displayName = "CallRoot";
677
- var CallAudio = () => {
678
- const call = useCapability3(ThreadCapabilities.CallManager);
679
- const audioTracksToPlay = useAtomValue3(call.audioTracksToPlayAtom);
680
- return /* @__PURE__ */ React9.createElement(AudioStream, {
681
- tracks: audioTracksToPlay
682
- });
683
- };
684
- CallAudio.displayName = "CallAudio";
685
- var CallGrid = ({ fullscreen }) => {
686
- const debug = useDebugMode();
687
- const call = useCapability3(ThreadCapabilities.CallManager);
688
- const self = useAtomValue3(call.selfAtom);
689
- const users = useAtomValue3(call.usersAtom);
690
- return /* @__PURE__ */ React9.createElement("div", {
691
- className: "grid grow p-4 dark:bg-neutral-900"
692
- }, /* @__PURE__ */ React9.createElement(ParticipantGrid, {
693
- self,
694
- users,
695
- debug,
696
- fullscreen
697
- }));
698
- };
699
- CallGrid.displayName = "CallGrid";
700
- var CallToolbar = (props) => {
701
- return /* @__PURE__ */ React9.createElement("div", {
702
- className: "absolute bottom-0 left-0 right-0 flex justify-center"
703
- }, /* @__PURE__ */ React9.createElement(Toolbar, {
704
- isInRoom: true,
705
- ...props
706
- }));
707
- };
708
- CallToolbar.displayName = "CallToolbar";
709
- var Call = {
710
- Root: CallRoot,
711
- Grid: CallGrid,
712
- Audio: CallAudio,
713
- Toolbar: CallToolbar
714
- };
715
-
716
- // src/components/CallDebugPanel.tsx
717
- import { WebRTCStats } from "@peermetrics/webrtc-stats";
718
- import React10, { useEffect as useEffect6, useMemo as useMemo4, useState as useState4 } from "react";
719
- import { truncateKey } from "@dxos/debug";
720
- import { JsonView, Panel } from "@dxos/devtools";
721
- import { log } from "@dxos/log";
722
- import { IconButton as IconButton3, Input, useTranslation as useTranslation3 } from "@dxos/react-ui";
723
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-thread/src/components/CallDebugPanel.tsx";
724
- var CallDebugPanel = ({ state }) => {
725
- const { t } = useTranslation3(meta.id);
726
- const [open, setOpen] = useState4(false);
727
- const handleToggle = () => setOpen(!open);
728
- const [showServiceHistory, setShowServiceHistory] = useState4(false);
729
- const handleToggleServiceHistory = () => setShowServiceHistory(!showServiceHistory);
730
- const handleCopyRaw = async () => {
731
- await navigator.clipboard.writeText(JSON.stringify({
732
- users: state?.call?.users,
733
- stats
734
- }, null, 2));
735
- };
736
- const [showDetailedWebRTCStats, setShowDetailedWebRTCStats] = useState4(false);
737
- const handleShowDetailedWebRTCStats = () => setShowDetailedWebRTCStats(!showDetailedWebRTCStats);
738
- const webrtcStats = useMemo4(() => new WebRTCStats({
739
- getStatsInterval: 1e3
740
- }), []);
741
- const [stats, setStats] = useState4();
742
- useEffect6(() => {
743
- const pc = state?.media.peer?.session?.peerConnection;
744
- const handleStats = (stats2) => {
745
- setStats(stats2.data);
746
- };
747
- let added = false;
748
- if (pc && showDetailedWebRTCStats) {
749
- webrtcStats.addConnection({
750
- pc,
751
- peerId: 1,
752
- connectionId: "1"
753
- });
754
- webrtcStats.on("stats", handleStats);
755
- added = true;
756
- }
757
- return () => {
758
- try {
759
- if (pc && added) {
760
- webrtcStats.removeConnection({
761
- pc
762
- });
763
- webrtcStats.removeListener("stats", handleStats);
764
- }
765
- } catch (error) {
766
- log.error("error removing webrtc stats", {
767
- error,
768
- pc,
769
- peerId: 1,
770
- connectionId: "1"
771
- }, {
772
- F: __dxlog_file2,
773
- L: 60,
774
- S: void 0,
775
- C: (f, a) => f(...a)
776
- });
777
- }
778
- };
779
- }, [
780
- state?.media.peer?.session?.peerConnection,
781
- showDetailedWebRTCStats
782
- ]);
783
- const rows = useMemo4(() => getCallStatusTable(state), [
784
- state?.call.users,
785
- state?.media.pulledAudioTracks
786
- ]);
787
- return /* @__PURE__ */ React10.createElement(Panel, {
788
- id: "meeting-status",
789
- icon: "ph--video-conference--regular",
790
- open,
791
- onToggle: handleToggle,
792
- title: t("meeting status title"),
793
- info: /* @__PURE__ */ React10.createElement("div", {
794
- className: "flex items-center gap-2"
795
- }, " ", state?.call.joined ? "Active" : "Inactive"),
796
- maxHeight: 0
797
- }, /* @__PURE__ */ React10.createElement("div", {
798
- className: "flex flex-col is-full text-xs"
799
- }, /* @__PURE__ */ React10.createElement("div", {
800
- className: "flex items-center gap-2 items-center"
801
- }, /* @__PURE__ */ React10.createElement(Input.Root, null, /* @__PURE__ */ React10.createElement(Input.Switch, {
802
- checked: showDetailedWebRTCStats,
803
- onCheckedChange: handleShowDetailedWebRTCStats
804
- }), /* @__PURE__ */ React10.createElement(Input.Label, null, t("show webrtc stats title")))), /* @__PURE__ */ React10.createElement("div", {
805
- className: "flex items-center gap-2 items-center"
806
- }, /* @__PURE__ */ React10.createElement(Input.Root, null, /* @__PURE__ */ React10.createElement(Input.Switch, {
807
- checked: showServiceHistory,
808
- onCheckedChange: handleToggleServiceHistory
809
- }), /* @__PURE__ */ React10.createElement(Input.Label, null, t("show calls history title")))), /* @__PURE__ */ React10.createElement("div", {
810
- className: "flex items-center gap-2 items-center"
811
- }, /* @__PURE__ */ React10.createElement(IconButton3, {
812
- icon: "ph--copy--regular",
813
- label: "copy raw",
814
- onClick: handleCopyRaw
815
- })), /* @__PURE__ */ React10.createElement(Table, {
816
- rows
817
- }), showDetailedWebRTCStats && /* @__PURE__ */ React10.createElement(JsonView, {
818
- data: {
819
- stats
820
- }
821
- }), showServiceHistory && /* @__PURE__ */ React10.createElement(JsonView, {
822
- data: {
823
- history: state?.media.peer?.history.get()
824
- }
825
- })));
826
- };
827
- var getCallStatusTable = (state) => {
828
- if (!state || !state.call?.users) {
829
- return [];
830
- }
831
- const self = state.call.self;
832
- const users = state.call.users.filter((user) => user.id !== self.id).map((user) => {
833
- const isOk = {
834
- audio: user.tracks?.audio && state.media.pulledAudioTracks[user.tracks?.audio]?.ctx.disposed === false,
835
- video: user.tracks?.video && state.media.pulledVideoStreams[user.tracks?.video]?.ctx.disposed === false,
836
- screenshare: user.tracks?.screenshare && state.media.pulledVideoStreams[user.tracks?.screenshare]?.ctx.disposed === false
837
- };
838
- return {
839
- ...user,
840
- isOk
841
- };
842
- });
843
- return [
844
- [
845
- "users",
846
- state.call.users.length ?? 0
847
- ],
848
- [
849
- "*self* " + (self?.name ?? truncateKey(self.id, 8)),
850
- self?.tracks?.audio && state.media.pushedAudioTrack ? "AUD \u2705" : "AUD \u274C",
851
- self?.tracks?.video && state.media.pushedVideoTrack ? "VID \u2705" : "VID \u274C",
852
- self?.tracks?.screenshareEnabled ? self.tracks.screenshareEnabled && state.media.pushedScreenshareTrack ? "SCR \u2705" : "SCR \u274C" : void 0
853
- ],
854
- ...users.map((user) => [
855
- user.name ?? truncateKey(user.id, 8),
856
- user.isOk.audio ? "AUD \u2705" : "AUD \u274C",
857
- user.isOk.video ? "VID \u2705" : "VID \u274C",
858
- user.tracks?.screenshareEnabled ? user.isOk.screenshare ? "SCR \u2705" : "SCR \u274C" : void 0
859
- ]),
860
- [
861
- "ICE",
862
- state.media.peer?.session?.peerConnection.iceConnectionState ?? "no connection"
863
- ]
864
- ];
865
- };
866
- (function(Unit2) {
867
- Unit2.KB = (n) => ((n ?? 0) / 1e3).toFixed(2);
868
- })(Unit || (Unit = {}));
869
- var Table = ({ rows }) => {
870
- return /* @__PURE__ */ React10.createElement("div", {
871
- className: "is-full text-xs font-mono"
872
- }, rows.map(([prefix, label, value, unit], i) => /* @__PURE__ */ React10.createElement("div", {
873
- key: i,
874
- className: "grid grid-cols-[3fr_1fr_1fr_1fr]"
875
- }, /* @__PURE__ */ React10.createElement("div", {
876
- className: "p-1"
877
- }, prefix), /* @__PURE__ */ React10.createElement("div", {
878
- className: "p-1"
879
- }, label), /* @__PURE__ */ React10.createElement("div", {
880
- className: "p-1"
881
- }, value), /* @__PURE__ */ React10.createElement("div", {
882
- className: "p-1"
883
- }, unit))));
884
- };
885
- var Unit;
886
-
887
- // src/components/ChatContainer.tsx
888
- import React12, { useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef4, useState as useState6 } from "react";
889
- import { Obj as Obj2, Ref as Ref2 } from "@dxos/echo";
890
- import { useMembers } from "@dxos/react-client/echo";
891
- import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
892
- import { Icon as Icon3, ScrollArea, useThemeContext as useThemeContext2, useTranslation as useTranslation5 } from "@dxos/react-ui";
893
- import { StackItem } from "@dxos/react-ui-stack";
894
- import { MessageTextbox, Thread as ThreadComponent, threadLayout } from "@dxos/react-ui-thread";
895
- import { Message } from "@dxos/types";
896
- import { createBasicExtensions as createBasicExtensions2, createThemeExtensions as createThemeExtensions2, listener } from "@dxos/ui-editor";
897
- import { mx as mx8 } from "@dxos/ui-theme";
898
- import { isNonNullable } from "@dxos/util";
899
-
900
- // src/components/command-extension.ts
901
- import { HighlightStyle, StreamLanguage, syntaxHighlighting } from "@codemirror/language";
902
- import { tags } from "@dxos/ui-editor";
903
- import { mx as mx6 } from "@dxos/ui-theme";
904
- var parser = StreamLanguage.define({
905
- startState: () => ({
906
- count: 0
907
- }),
908
- token: (stream, state) => {
909
- state.count++;
910
- if (stream.eatSpace()) {
911
- return null;
912
- }
913
- if (state.count === 1 && stream.match(/^(\/\w+)/)) {
914
- return "tagName";
915
- }
916
- stream.next();
917
- return null;
918
- }
919
- });
920
- var styles = HighlightStyle.define([
921
- {
922
- tag: tags.tagName,
923
- class: mx6("dx-tag dx-tag--indigo text-baseText font-medium")
924
- }
925
- ]);
926
- var command = [
927
- parser,
928
- syntaxHighlighting(styles)
929
- ];
930
-
931
- // src/components/MessageContainer.tsx
932
- import { EditorView } from "@codemirror/view";
933
- import React11, { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect7, useRef as useRef3, useState as useState5 } from "react";
934
- import { Surface } from "@dxos/app-framework/react";
935
- import { Ref } from "@dxos/echo";
936
- import { useObject } from "@dxos/echo-react";
937
- import { PublicKey } from "@dxos/react-client";
938
- import { useIdentity } from "@dxos/react-client/halo";
939
- import { IconButton as IconButton4, useOnTransition, useThemeContext, useTranslation as useTranslation4 } from "@dxos/react-ui";
940
- import { useTextEditor } from "@dxos/react-ui-editor";
941
- import { Card } from "@dxos/react-ui-mosaic";
942
- import { MessageHeading, MessageRoot } from "@dxos/react-ui-thread";
943
- import { createBasicExtensions, createThemeExtensions } from "@dxos/ui-editor";
944
- import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx as mx7 } from "@dxos/ui-theme";
945
- var buttonGroupClassNames = "flex flex-row items-center gap-0.5 pie-2";
946
- var buttonClassNames = "!p-1 transition-opacity";
947
- var MessageContainer = ({ message: messageOrRef, members, editable = false, onDelete, onAcceptProposal }) => {
948
- const { t } = useTranslation4(meta.id);
949
- const [message, updateMessage] = useObject(messageOrRef);
950
- const identity = useIdentity();
951
- const [editing, setEditing] = useState5(false);
952
- const textBlockIndex = message?.blocks.findIndex((block) => block._tag === "text") ?? -1;
953
- const handleEdit = useCallback2(() => setEditing((editing2) => !editing2), []);
954
- const handleDelete = useCallback2(() => message && onDelete?.(message.id), [
955
- message,
956
- onDelete
957
- ]);
958
- const handleAcceptProposal = useCallback2(() => message && onAcceptProposal?.(message.id), [
959
- message,
960
- onAcceptProposal
961
- ]);
962
- const handleTextBlockChange = useCallback2((newText) => {
963
- updateMessage((m) => {
964
- const targetBlock = m.blocks[textBlockIndex];
965
- if (targetBlock && targetBlock._tag === "text") {
966
- targetBlock.text = newText;
967
- }
968
- });
969
- }, [
970
- updateMessage,
971
- textBlockIndex
972
- ]);
973
- const textBlock = message && textBlockIndex !== -1 ? message.blocks[textBlockIndex] : void 0;
974
- useOnEditAnalytics(message, textBlock, !!editing);
975
- if (!message) {
976
- return null;
977
- }
978
- const senderIdentity = members.find((member) => message.sender.identityDid && member.identity.did === message.sender.identityDid || message.sender.identityKey && PublicKey.equals(member.identity.identityKey, message.sender.identityKey))?.identity;
979
- const messageMetadata = getMessageMetadata(message.id, senderIdentity);
980
- const userIsAuthor = identity?.did === messageMetadata.authorId;
981
- const proposalBlock = message.blocks.find((block) => block._tag === "proposal");
982
- const references = message.blocks.filter((block) => block._tag === "reference").map((block) => block.reference);
983
- return /* @__PURE__ */ React11.createElement(MessageRoot, {
984
- ...messageMetadata,
985
- classNames: [
986
- hoverableControls,
987
- hoverableFocusedWithinControls
988
- ]
989
- }, /* @__PURE__ */ React11.createElement(MessageHeading, {
990
- authorName: messageMetadata.authorName,
991
- timestamp: messageMetadata.timestamp
992
- }, /* @__PURE__ */ React11.createElement("div", {
993
- role: "none",
994
- className: buttonGroupClassNames
995
- }, userIsAuthor && editable && /* @__PURE__ */ React11.createElement(IconButton4, {
996
- "data-testid": editing ? "thread.message.save" : "thread.message.edit",
997
- variant: "ghost",
998
- icon: editing ? "ph--check--regular" : "ph--pencil-simple--regular",
999
- iconOnly: true,
1000
- label: t(editing ? "save message label" : "edit message label"),
1001
- classNames: [
1002
- buttonClassNames,
1003
- hoverableControlItem
1004
- ],
1005
- onClick: handleEdit
1006
- }), proposalBlock && onAcceptProposal && /* @__PURE__ */ React11.createElement(IconButton4, {
1007
- "data-testid": "thread.message.accept",
1008
- variant: "ghost",
1009
- icon: "ph--check--regular",
1010
- iconOnly: true,
1011
- label: t("accept proposal label"),
1012
- classNames: [
1013
- buttonClassNames,
1014
- hoverableControlItem
1015
- ],
1016
- onClick: handleAcceptProposal
1017
- }), onDelete && /* @__PURE__ */ React11.createElement(IconButton4, {
1018
- "data-testid": "thread.message.delete",
1019
- variant: "ghost",
1020
- icon: "ph--x--regular",
1021
- iconOnly: true,
1022
- label: t("delete message label"),
1023
- classNames: [
1024
- buttonClassNames,
1025
- hoverableControlItem
1026
- ],
1027
- onClick: handleDelete
1028
- }))), textBlock && /* @__PURE__ */ React11.createElement(TextboxBlock, {
1029
- block: textBlock,
1030
- isAuthor: userIsAuthor,
1031
- editing,
1032
- onSave: handleTextBlockChange
1033
- }), proposalBlock && /* @__PURE__ */ React11.createElement(ProposalBlock, {
1034
- block: proposalBlock
1035
- }), Ref.Array.targets(references).map((reference, index) => /* @__PURE__ */ React11.createElement(MessagePart, {
1036
- key: index,
1037
- part: reference
1038
- })));
1039
- };
1040
- var MessagePart = ({ part }) => {
1041
- return /* @__PURE__ */ React11.createElement(MessageBlockObjectTile, {
1042
- subject: part
1043
- });
1044
- };
1045
- var TextboxBlock = ({ block, isAuthor, editing, onSave }) => {
1046
- const { themeMode } = useThemeContext();
1047
- const inMemoryContentRef = useRef3(block.text);
1048
- const handleDocumentChange = useCallback2((newState) => {
1049
- inMemoryContentRef.current = newState;
1050
- }, []);
1051
- const saveDocumentChange = useCallback2(() => {
1052
- onSave?.(inMemoryContentRef.current);
1053
- }, [
1054
- onSave
1055
- ]);
1056
- useOnTransition(editing, true, false, saveDocumentChange);
1057
- const { parentRef, focusAttributes, view } = useTextEditor(() => ({
1058
- initialValue: block.text,
1059
- extensions: [
1060
- createBasicExtensions({
1061
- readOnly: !isAuthor || !editing
1062
- }),
1063
- createThemeExtensions({
1064
- themeMode
1065
- }),
1066
- command,
1067
- EditorView.updateListener.of((update) => {
1068
- if (update.docChanged) {
1069
- handleDocumentChange(update.state.doc.toString());
1070
- }
1071
- })
1072
- ]
1073
- }), [
1074
- block.text,
1075
- editing,
1076
- isAuthor,
1077
- themeMode,
1078
- handleDocumentChange
1079
- ]);
1080
- useEffect7(() => {
1081
- editing && view?.focus();
1082
- }, [
1083
- editing,
1084
- view
1085
- ]);
1086
- return /* @__PURE__ */ React11.createElement("div", {
1087
- role: "none",
1088
- ref: parentRef,
1089
- className: "mie-4",
1090
- ...focusAttributes
1091
- });
1092
- };
1093
- var ProposalBlock = ({ block }) => {
1094
- return /* @__PURE__ */ React11.createElement("div", {
1095
- role: "none",
1096
- className: "mie-4 italic"
1097
- }, block.text);
1098
- };
1099
- var MessageBlockObjectTile = /* @__PURE__ */ forwardRef2(({ subject }, forwardedRef) => {
1100
- let title = subject.name ?? subject.title ?? subject.type ?? "Object";
1101
- if (typeof title !== "string") {
1102
- title = title?.content ?? "";
1103
- }
1104
- return /* @__PURE__ */ React11.createElement(Card.Root, {
1105
- className: mx7("grid col-span-3 plb-1 pr-4", hoverableControls, hoverableFocusedWithinControls),
1106
- ref: forwardedRef
1107
- }, /* @__PURE__ */ React11.createElement(Surface, {
1108
- role: "card-content",
1109
- limit: 1,
1110
- data: {
1111
- subject
1112
- },
1113
- fallback: title
1114
- }));
1115
- });
1116
-
1117
- // src/components/ChatContainer.tsx
1118
- var ChatContainer = ({ classNames, space, thread, context, current, autoFocusTextbox }) => {
1119
- const { t } = useTranslation5(meta.id);
1120
- const id = Obj2.getDXN(thread).toString();
1121
- const identity = useIdentity2();
1122
- const members = useMembers(space?.id);
1123
- const activity = useStatus(space, id);
1124
- const [_count, _setCount] = useState6(0);
1125
- const rerenderEditor = () => _setCount((count) => count + 1);
1126
- const [autoFocus, setAutoFocus] = useState6(autoFocusTextbox);
1127
- const threadScrollRef = useRef4(null);
1128
- const { themeMode } = useThemeContext2();
1129
- const textboxMetadata = getMessageMetadata(id, identity);
1130
- const messageRef = useRef4("");
1131
- const extensions = useMemo5(() => [
1132
- createBasicExtensions2({
1133
- placeholder: t("message placeholder")
1134
- }),
1135
- createThemeExtensions2({
1136
- themeMode
1137
- }),
1138
- listener({
1139
- onChange: ({ text }) => messageRef.current = text
1140
- }),
1141
- command
1142
- ], [
1143
- themeMode,
1144
- _count
1145
- ]);
1146
- const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
1147
- behavior,
1148
- block: "end"
1149
- }), 10);
1150
- useLayoutEffect2(() => {
1151
- scrollToEnd("instant");
1152
- }, []);
1153
- const handleCreate = () => {
1154
- if (!messageRef.current?.length) {
1155
- return false;
1156
- }
1157
- Obj2.change(thread, (t2) => {
1158
- t2.messages.push(Ref2.make(Obj2.make(Message.Message, {
1159
- created: (/* @__PURE__ */ new Date()).toISOString(),
1160
- sender: {
1161
- identityDid: identity.did
1162
- },
1163
- blocks: [
1164
- {
1165
- _tag: "text",
1166
- text: messageRef.current
1167
- }
1168
- ],
1169
- properties: context ? {
1170
- context: Ref2.make(context)
1171
- } : void 0
1172
- })));
1173
- });
1174
- messageRef.current = "";
1175
- setAutoFocus(true);
1176
- scrollToEnd("smooth");
1177
- rerenderEditor();
1178
- return true;
1179
- };
1180
- return /* @__PURE__ */ React12.createElement(ThreadComponent.Root, {
1181
- current,
1182
- id,
1183
- classNames: [
1184
- "bs-full grid-rows-[1fr_min-content_min-content] overflow-hidden",
1185
- "transition-[padding-block-end] [[data-sidebar-inline-start-state=open]_&]:lg:pbe-0",
1186
- classNames
1187
- ]
1188
- }, /* @__PURE__ */ React12.createElement(ScrollArea.Root, {
1189
- classNames: "col-span-2"
1190
- }, /* @__PURE__ */ React12.createElement(ScrollArea.Viewport, {
1191
- classNames: "overflow-anchored after:overflow-anchor after:block after:bs-px after:-mbs-px [&>div]:min-bs-full [&>div]:!grid [&>div]:grid-rows-[1fr_0]"
1192
- }, /* @__PURE__ */ React12.createElement("div", {
1193
- role: "none",
1194
- className: mx8(threadLayout, "place-self-end")
1195
- }, thread.messages.map((message) => message.target).filter(isNonNullable).map((message) => /* @__PURE__ */ React12.createElement(MessageContainer, {
1196
- key: message.id,
1197
- message,
1198
- members
1199
- }))), /* @__PURE__ */ React12.createElement("div", {
1200
- role: "none",
1201
- className: "bs-px -mbs-px",
1202
- ref: threadScrollRef
1203
- })), /* @__PURE__ */ React12.createElement(ScrollArea.Scrollbar, null, /* @__PURE__ */ React12.createElement(ScrollArea.Thumb, null))), /* @__PURE__ */ React12.createElement(MessageTextbox, {
1204
- extensions,
1205
- autoFocus,
1206
- onSend: handleCreate,
1207
- ...textboxMetadata
1208
- }), /* @__PURE__ */ React12.createElement(ThreadComponent.Status, {
1209
- activity
1210
- }, t("activity message")));
1211
- };
1212
- var ChatContainer_default = ChatContainer;
1213
-
1214
- // src/components/ChannelContainer.tsx
1215
- import { Atom, useAtomValue as useAtomValue4 } from "@effect-atom/atom-react";
1216
- import React13, { useCallback as useCallback3, useEffect as useEffect8, useMemo as useMemo6, useState as useState7 } from "react";
1217
- import { useCapabilities, useCapability as useCapability4 } from "@dxos/app-framework/react";
1218
- import { Context } from "@dxos/context";
1219
- import { failUndefined } from "@dxos/debug";
1220
- import { Obj as Obj3 } from "@dxos/echo";
1221
- import { log as log2 } from "@dxos/log";
1222
- import { useClient } from "@dxos/react-client";
1223
- import { getSpace } from "@dxos/react-client/echo";
1224
- import { useIdentity as useIdentity3 } from "@dxos/react-client/halo";
1225
- import { ElevationProvider, Input as Input2, useTranslation as useTranslation6 } from "@dxos/react-ui";
1226
- import { ControlGroup, ControlGroupButton, ControlItemInput } from "@dxos/react-ui-form";
1227
- import { MenuProvider, ToolbarMenu, createMenuAction, createMenuItemGroup, useMenuActions } from "@dxos/react-ui-menu";
1228
- import { useSoundEffect } from "@dxos/react-ui-sfx";
1229
- import { StackItem as StackItem2 } from "@dxos/react-ui-stack";
1230
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-thread/src/components/ChannelContainer.tsx";
1231
- var ChannelContainer = ({ role, subject: channel, roomId: roomIdProp, fullscreen }) => {
1232
- const space = getSpace(channel);
1233
- const callManager = useCapability4(ThreadCapabilities.CallManager);
1234
- const joined = useAtomValue4(callManager.joinedAtom);
1235
- const currentRoomId = useAtomValue4(callManager.roomIdAtom);
1236
- const attendableId = channel ? Obj3.getDXN(channel).toString() : void 0;
1237
- const roomId = roomIdProp ?? attendableId ?? failUndefined();
1238
- const identity = useIdentity3();
1239
- const isNamed = !!identity?.profile?.displayName;
1240
- const joinSound = useSoundEffect("JoinCall");
1241
- const leaveSound = useSoundEffect("LeaveCall");
1242
- const extensions = useCapabilities(ThreadCapabilities.CallExtension);
1243
- useEffect8(() => {
1244
- const ctx = new Context(void 0, {
1245
- F: __dxlog_file3,
1246
- L: 55
1247
- });
1248
- callManager.left.on(ctx, (roomId2) => {
1249
- extensions.forEach((extension) => {
1250
- void extension.onLeave?.(roomId2);
1251
- });
1252
- });
1253
- callManager.callStateUpdated.on(ctx, (state) => {
1254
- extensions.forEach((extension) => {
1255
- void extension.onCallStateUpdated?.(state);
1256
- });
1257
- });
1258
- callManager.mediaStateUpdated.on(ctx, (state) => {
1259
- extensions.forEach((extension) => {
1260
- void extension.onMediaStateUpdated?.(state);
1261
- });
1262
- });
1263
- return () => {
1264
- void ctx.dispose();
1265
- };
1266
- }, [
1267
- callManager,
1268
- extensions
1269
- ]);
1270
- const handleJoin = useCallback3(async () => {
1271
- if (!roomId || !channel) {
1272
- return;
1273
- }
1274
- if (joined) {
1275
- await callManager.leave();
1276
- }
1277
- try {
1278
- void joinSound.play();
1279
- callManager.setRoomId(roomId);
1280
- await callManager.join();
1281
- await Promise.all(extensions.map((extension) => extension.onJoin?.({
1282
- channel,
1283
- roomId
1284
- })));
1285
- } catch (err) {
1286
- log2.catch(err, void 0, {
1287
- F: __dxlog_file3,
1288
- L: 99,
1289
- S: void 0,
1290
- C: (f, a) => f(...a)
1291
- });
1292
- }
1293
- }, [
1294
- extensions,
1295
- channel,
1296
- roomId,
1297
- joined
1298
- ]);
1299
- const handleLeave = useCallback3(async () => {
1300
- try {
1301
- void leaveSound.play();
1302
- } catch (err) {
1303
- log2.catch(err, void 0, {
1304
- F: __dxlog_file3,
1305
- L: 111,
1306
- S: void 0,
1307
- C: (f, a) => f(...a)
1308
- });
1309
- } finally {
1310
- void callManager.turnAudioOff();
1311
- void callManager.turnVideoOff();
1312
- void callManager.turnScreenshareOff();
1313
- void callManager.leave();
1314
- }
1315
- }, [
1316
- extensions,
1317
- roomId
1318
- ]);
1319
- const isJoined = joined && currentRoomId === roomId;
1320
- return /* @__PURE__ */ React13.createElement(StackItem2.Content, {
1321
- classNames: isJoined && "bs-full",
1322
- toolbar: !isJoined
1323
- }, isJoined && !isNamed && /* @__PURE__ */ React13.createElement(DisplayNameMissing, null), isJoined && isNamed && /* @__PURE__ */ React13.createElement(Call.Root, null, /* @__PURE__ */ React13.createElement(Call.Grid, {
1324
- fullscreen
1325
- }), /* @__PURE__ */ React13.createElement(Call.Toolbar, {
1326
- channel,
1327
- onLeave: handleLeave
1328
- })), !isJoined && channel && channel.defaultThread.target && space && /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ChannelToolbar, {
1329
- attendableId,
1330
- role,
1331
- onJoinCall: handleJoin
1332
- }), /* @__PURE__ */ React13.createElement(ChatContainer_default, {
1333
- space,
1334
- thread: channel.defaultThread.target,
1335
- classNames: "container-max-width"
1336
- })));
1337
- };
1338
- var DisplayNameMissing = () => {
1339
- const { t } = useTranslation6(meta.id);
1340
- const client = useClient();
1341
- const [displayName, setDisplayName] = useState7("");
1342
- const handleChange = useCallback3((event) => setDisplayName(event.target.value), []);
1343
- const handleSave = useCallback3(() => client.halo.updateProfile({
1344
- displayName
1345
- }), [
1346
- client,
1347
- displayName
1348
- ]);
1349
- return /* @__PURE__ */ React13.createElement(ControlGroup, {
1350
- classNames: "p-4 place-content-center"
1351
- }, /* @__PURE__ */ React13.createElement(ControlItemInput, {
1352
- title: t("display name label"),
1353
- description: t("display name description")
1354
- }, /* @__PURE__ */ React13.createElement(Input2.TextInput, {
1355
- value: displayName,
1356
- onChange: handleChange,
1357
- placeholder: t("display name input placeholder"),
1358
- classNames: "md:min-is-64"
1359
- })), /* @__PURE__ */ React13.createElement(ControlGroupButton, {
1360
- disabled: !displayName,
1361
- onClick: handleSave
1362
- }, t("set display name label")));
1363
- };
1364
- var useChannelToolbarActions = (onJoinCall) => {
1365
- const creator = useMemo6(() => Atom.make(() => {
1366
- return {
1367
- nodes: [
1368
- createMenuItemGroup("root", {
1369
- label: [
1370
- "channel toolbar title",
1371
- {
1372
- ns: meta.id
1373
- }
1374
- ]
1375
- }),
1376
- createMenuAction("video-call", () => onJoinCall?.(), {
1377
- label: [
1378
- "start video call label",
1379
- {
1380
- ns: meta.id
1381
- }
1382
- ],
1383
- icon: "ph--video-camera--regular",
1384
- type: "video-call"
1385
- })
1386
- ],
1387
- edges: [
1388
- {
1389
- source: "root",
1390
- target: "video-call"
1391
- }
1392
- ]
1393
- };
1394
- }), []);
1395
- return useMenuActions(creator);
1396
- };
1397
- var ChannelToolbar = ({ attendableId, role, onJoinCall }) => {
1398
- const menuProps = useChannelToolbarActions(onJoinCall);
1399
- return /* @__PURE__ */ React13.createElement(ElevationProvider, {
1400
- elevation: role === "section" ? "positioned" : "base"
1401
- }, /* @__PURE__ */ React13.createElement(MenuProvider, {
1402
- ...menuProps,
1403
- attendableId
1404
- }, /* @__PURE__ */ React13.createElement(ToolbarMenu, {
1405
- textBlockWidth: true
1406
- })));
1407
- };
1408
-
1409
- // src/components/CallSidebar.tsx
1410
- import { useAtomValue as useAtomValue5 } from "@effect-atom/atom-react";
1411
- import React14 from "react";
1412
- import { useCapability as useCapability5 } from "@dxos/app-framework/react";
1413
- var CallSidebar = () => {
1414
- const call = useCapability5(ThreadCapabilities.CallManager);
1415
- const roomId = useAtomValue5(call.roomIdAtom);
1416
- return /* @__PURE__ */ React14.createElement(ChannelContainer, {
1417
- subject: void 0,
1418
- roomId
1419
- });
1420
- };
1421
-
1422
- // src/components/ThreadCompanion.tsx
1423
- import { useAtomValue as useAtomValue6 } from "@effect-atom/atom-react";
1424
- import React18, { useCallback as useCallback5, useMemo as useMemo8 } from "react";
1425
- import { Common } from "@dxos/app-framework";
1426
- import { useCapabilities as useCapabilities2, useCapability as useCapability6, useOperationInvoker } from "@dxos/app-framework/react";
1427
- import { Filter, Obj as Obj6, Query, Relation as Relation3 } from "@dxos/echo";
1428
- import { Ref as Ref3, useQuery } from "@dxos/react-client/echo";
1429
- import { useIdentity as useIdentity5 } from "@dxos/react-client/halo";
1430
- import { useTranslation as useTranslation10 } from "@dxos/react-ui";
1431
- import { useAttended } from "@dxos/react-ui-attention";
1432
- import { Layout } from "@dxos/react-ui-mosaic";
1433
- import { Tabs } from "@dxos/react-ui-tabs";
1434
- import { AnchoredTo, Thread } from "@dxos/types";
1435
- import { mx as mx10 } from "@dxos/ui-theme";
1436
-
1437
- // src/components/CommentsContainer.tsx
1438
- import React16, { useEffect as useEffect9 } from "react";
1439
- import { Obj as Obj5, Relation as Relation2 } from "@dxos/echo";
1440
- import { Callout, Icon as Icon4, Trans, useTranslation as useTranslation8 } from "@dxos/react-ui";
1441
-
1442
- // src/components/CommentsThreadContainer.tsx
1443
- import React15, { useCallback as useCallback4, useMemo as useMemo7, useRef as useRef5, useState as useState8 } from "react";
1444
- import { Obj as Obj4, Relation } from "@dxos/echo";
1445
- import { useObject as useObject2 } from "@dxos/echo-react";
1446
- import { getSpace as getSpace2, useMembers as useMembers2 } from "@dxos/react-client/echo";
1447
- import { useIdentity as useIdentity4 } from "@dxos/react-client/halo";
1448
- import { IconButton as IconButton5, Tag, Tooltip, useThemeContext as useThemeContext3, useTranslation as useTranslation7 } from "@dxos/react-ui";
1449
- import { MessageTextbox as MessageTextbox2, Thread as ThreadComponent2 } from "@dxos/react-ui-thread";
1450
- import { createBasicExtensions as createBasicExtensions3, createThemeExtensions as createThemeExtensions3, listener as listener2 } from "@dxos/ui-editor";
1451
- import { hoverableControlItem as hoverableControlItem2, hoverableControls as hoverableControls2, hoverableFocusedWithinControls as hoverableFocusedWithinControls2, mx as mx9 } from "@dxos/ui-theme";
1452
- var CommentsThreadContainer = ({ anchor, current, onAttend, onComment, onResolve, onMessageDelete, onThreadDelete, onAcceptProposal }) => {
1453
- const { themeMode } = useThemeContext3();
1454
- const { t } = useTranslation7(meta.id);
1455
- const identity = useIdentity4();
1456
- const space = getSpace2(anchor);
1457
- const members = useMembers2(space?.id);
1458
- const detached = !anchor.anchor;
1459
- const thread = Relation.getSource(anchor);
1460
- const [messages] = useObject2(thread, "messages");
1461
- const activity = useStatus(space, Obj4.getDXN(thread).toString());
1462
- const threadScrollRef = useRef5(null);
1463
- const textboxMetadata = getMessageMetadata(Obj4.getDXN(thread).toString(), identity);
1464
- const [state, setState] = useState8({});
1465
- const messageRef = useRef5("");
1466
- const extensions = useMemo7(() => [
1467
- createBasicExtensions3({
1468
- placeholder: t("message placeholder")
1469
- }),
1470
- createThemeExtensions3({
1471
- themeMode
1472
- }),
1473
- listener2({
1474
- onChange: ({ text }) => messageRef.current = text
1475
- }),
1476
- command
1477
- ], [
1478
- state
1479
- ]);
1480
- const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
1481
- behavior,
1482
- block: "end"
1483
- }), 10);
1484
- const handleAttend = useCallback4(() => onAttend?.(anchor), [
1485
- onAttend,
1486
- anchor
1487
- ]);
1488
- const handleResolve = useCallback4(() => onResolve?.(anchor), [
1489
- onResolve,
1490
- anchor
1491
- ]);
1492
- const handleMessageDelete = useCallback4((id) => onMessageDelete?.(anchor, id), [
1493
- onMessageDelete,
1494
- anchor
1495
- ]);
1496
- const handleThreadDelete = useCallback4(() => onThreadDelete?.(anchor), [
1497
- onThreadDelete,
1498
- anchor
1499
- ]);
1500
- const handleAcceptProposal = useCallback4((id) => onAcceptProposal?.(anchor, id), [
1501
- onAcceptProposal,
1502
- anchor
1503
- ]);
1504
- const handleComment = useCallback4(() => {
1505
- if (!messageRef.current) {
1506
- return false;
1507
- }
1508
- onComment?.(anchor, messageRef.current);
1509
- messageRef.current = "";
1510
- scrollToEnd("instant");
1511
- setState({});
1512
- return true;
1513
- }, [
1514
- anchor,
1515
- identity
1516
- ]);
1517
- return /* @__PURE__ */ React15.createElement(ThreadComponent2.Root, {
1518
- id: Obj4.getDXN(thread).toString(),
1519
- classNames: "pbs-2 border-be border-subduedSeparator last:border-none",
1520
- current,
1521
- onClickCapture: handleAttend,
1522
- onFocusCapture: handleAttend
1523
- }, /* @__PURE__ */ React15.createElement("div", {
1524
- role: "none",
1525
- className: mx9("col-span-2 grid grid-cols-[var(--rail-size)_1fr_min-content]", hoverableControls2, hoverableFocusedWithinControls2)
1526
- }, detached ? /* @__PURE__ */ React15.createElement(Tooltip.Trigger, {
1527
- asChild: true,
1528
- content: t("detached thread label"),
1529
- side: "top"
1530
- }, /* @__PURE__ */ React15.createElement(ThreadComponent2.Header, {
1531
- detached: true
1532
- }, thread.name)) : /* @__PURE__ */ React15.createElement(ThreadComponent2.Header, null, thread.name), /* @__PURE__ */ React15.createElement("div", {
1533
- role: "none",
1534
- className: buttonGroupClassNames
1535
- }, thread.status === "staged" && /* @__PURE__ */ React15.createElement(Tag, {
1536
- palette: "neutral"
1537
- }, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ React15.createElement(IconButton5, {
1538
- "data-testid": "thread.resolve",
1539
- variant: "ghost",
1540
- icon: thread?.status === "resolved" ? "ph--check--fill" : "ph--check--regular",
1541
- iconOnly: true,
1542
- label: t("resolve thread label"),
1543
- classNames: [
1544
- buttonClassNames,
1545
- thread?.status !== "resolved" && hoverableControlItem2
1546
- ],
1547
- onClick: handleResolve
1548
- }), onThreadDelete && /* @__PURE__ */ React15.createElement(IconButton5, {
1549
- "data-testid": "thread.delete",
1550
- variant: "ghost",
1551
- icon: "ph--x--regular",
1552
- iconOnly: true,
1553
- label: t("delete thread label"),
1554
- classNames: [
1555
- buttonClassNames,
1556
- hoverableControlItem2
1557
- ],
1558
- onClick: handleThreadDelete
1559
- }))), messages?.map((ref) => /* @__PURE__ */ React15.createElement(MessageContainer, {
1560
- key: ref.dxn.toString(),
1561
- editable: true,
1562
- message: ref,
1563
- members,
1564
- onDelete: handleMessageDelete,
1565
- onAcceptProposal: handleAcceptProposal
1566
- })), /* @__PURE__ */ React15.createElement(MessageTextbox2, {
1567
- extensions,
1568
- onSend: handleComment,
1569
- ...textboxMetadata
1570
- }), /* @__PURE__ */ React15.createElement(ThreadComponent2.Status, {
1571
- activity
1572
- }, t("activity message")), /* @__PURE__ */ React15.createElement("div", {
1573
- role: "none",
1574
- className: "bs-px -mbs-px",
1575
- ref: threadScrollRef
1576
- }));
1577
- };
1578
-
1579
- // src/components/CommentsContainer.tsx
1580
- var CommentsContainer = ({ anchors, currentId, showResolvedThreads, ...props }) => {
1581
- const { t } = useTranslation8(meta.id);
1582
- const filteredAnchors = showResolvedThreads ? anchors.filter((anchor) => !!Relation2.getSource(anchor)) : anchors.filter((anchor) => {
1583
- const thread = Relation2.getSource(anchor);
1584
- return thread && thread.status !== "resolved";
1585
- });
1586
- useEffect9(() => {
1587
- if (currentId) {
1588
- document.getElementById(currentId)?.scrollIntoView({
1589
- behavior: "smooth",
1590
- block: "end"
1591
- });
1592
- }
1593
- }, [
1594
- currentId
1595
- ]);
1596
- if (filteredAnchors.length === 0) {
1597
- return /* @__PURE__ */ React16.createElement("div", {
1598
- role: "none",
1599
- className: "plb-cardSpacingBlock pli-cardSpacingInline"
1600
- }, /* @__PURE__ */ React16.createElement(Callout.Root, null, /* @__PURE__ */ React16.createElement(Callout.Title, null, /* @__PURE__ */ React16.createElement(Trans, {
1601
- t,
1602
- i18nKey: "no comments message",
1603
- components: {
1604
- commentIcon: /* @__PURE__ */ React16.createElement(Icon4, {
1605
- icon: "ph--chat-text--regular",
1606
- size: 4,
1607
- classNames: "inline-block"
1608
- })
1609
- }
1610
- }))));
1611
- }
1612
- return /* @__PURE__ */ React16.createElement("div", null, filteredAnchors.map((anchor) => {
1613
- const thread = Relation2.getSource(anchor);
1614
- const threadId = Obj5.getDXN(thread).toString();
1615
- return /* @__PURE__ */ React16.createElement(CommentsThreadContainer, {
1616
- key: threadId,
1617
- anchor,
1618
- current: currentId === threadId,
1619
- ...props
1620
- });
1621
- }));
1622
- };
1623
-
1624
- // src/components/ThreadSettings.tsx
1625
- import React17 from "react";
1626
- import { useTranslation as useTranslation9 } from "@dxos/react-ui";
1627
- import { ControlPage } from "@dxos/react-ui-form";
1628
- var ThreadSettings = ({ settings: _settings }) => {
1629
- const { t: _t } = useTranslation9(meta.id);
1630
- return /* @__PURE__ */ React17.createElement(ControlPage, null);
1631
- };
1632
-
1633
- // src/components/ThreadCompanion.tsx
1634
- var initialViewState = {
1635
- showResolvedThreads: false
1636
- };
1637
- var ThreadCompanion = ({ subject }) => {
1638
- const { t } = useTranslation10(meta.id);
1639
- const { invokePromise } = useOperationInvoker();
1640
- const identity = useIdentity5();
1641
- const subjectId = Obj6.getDXN(subject).toString();
1642
- const registry = useCapability6(Common.Capability.AtomRegistry);
1643
- const stateAtom = useCapability6(ThreadCapabilities.State);
1644
- const viewStoreAtom = useCapability6(ThreadCapabilities.ViewState);
1645
- const state = useAtomValue6(stateAtom);
1646
- const viewStore = useAtomValue6(viewStoreAtom);
1647
- const drafts = state.drafts[subjectId];
1648
- const viewState = useMemo8(() => {
1649
- if (!viewStore[subjectId]) {
1650
- registry.set(viewStoreAtom, {
1651
- ...viewStore,
1652
- [subjectId]: {
1653
- ...initialViewState
1654
- }
1655
- });
1656
- return initialViewState;
1657
- }
1658
- return viewStore[subjectId];
1659
- }, [
1660
- viewStore,
1661
- subjectId,
1662
- registry,
1663
- viewStoreAtom
1664
- ]);
1665
- const { showResolvedThreads } = viewState;
1666
- const onChangeViewState = useCallback5((nextValue) => {
1667
- registry.set(viewStoreAtom, {
1668
- ...registry.get(viewStoreAtom),
1669
- [subjectId]: {
1670
- ...registry.get(viewStoreAtom)[subjectId],
1671
- showResolvedThreads: nextValue === "all"
1672
- }
1673
- });
1674
- }, [
1675
- registry,
1676
- viewStoreAtom,
1677
- subjectId
1678
- ]);
1679
- const anchorSorts = useCapabilities2(Common.Capability.AnchorSort);
1680
- const sort = useMemo8(() => anchorSorts.find(({ key }) => key === Obj6.getTypename(subject))?.sort, [
1681
- anchorSorts,
1682
- subject
1683
- ]);
1684
- const db = Obj6.getDatabase(subject);
1685
- const objectsAnchoredTo = useQuery(db, Query.select(Filter.id(subject.id)).targetOf(AnchoredTo.AnchoredTo));
1686
- const anchors = objectsAnchoredTo.toSorted((a, b) => sort?.(a, b) ?? 0).filter((anchor) => Obj6.instanceOf(Thread.Thread, Relation3.getSource(anchor))).concat(drafts ?? []);
1687
- const attended = useAttended();
1688
- const handleAttend = useCallback5((anchor) => {
1689
- const thread = Relation3.getSource(anchor);
1690
- const threadId = Obj6.getDXN(thread).toString();
1691
- if (state.current !== threadId) {
1692
- registry.set(stateAtom, {
1693
- ...registry.get(stateAtom),
1694
- current: threadId
1695
- });
1696
- void invokePromise(Common.LayoutOperation.ScrollIntoView, {
1697
- subject: Obj6.getDXN(subject).toString(),
1698
- cursor: anchor.anchor,
1699
- ref: threadId
1700
- });
1701
- }
1702
- }, [
1703
- state.current,
1704
- invokePromise,
1705
- subject,
1706
- registry,
1707
- stateAtom
1708
- ]);
1709
- const handleComment = useCallback5(async (anchor, text) => {
1710
- await invokePromise(ThreadOperation.AddMessage, {
1711
- anchor,
1712
- subject,
1713
- sender: {
1714
- identityDid: identity?.did
1715
- },
1716
- text
1717
- });
1718
- const thread = Relation3.getSource(anchor);
1719
- registry.set(stateAtom, {
1720
- ...registry.get(stateAtom),
1721
- current: Obj6.getDXN(thread).toString()
1722
- });
1723
- }, [
1724
- invokePromise,
1725
- identity,
1726
- subject,
1727
- registry,
1728
- stateAtom
1729
- ]);
1730
- const handleResolve = useCallback5((anchor) => invokePromise(ThreadOperation.ToggleResolved, {
1731
- thread: Relation3.getSource(anchor)
1732
- }), [
1733
- invokePromise
1734
- ]);
1735
- const handleThreadDelete = useCallback5((anchor) => invokePromise(ThreadOperation.Delete, {
1736
- anchor,
1737
- subject
1738
- }), [
1739
- invokePromise,
1740
- subject
1741
- ]);
1742
- const handleMessageDelete = useCallback5((anchor, messageId) => invokePromise(ThreadOperation.DeleteMessage, {
1743
- anchor,
1744
- subject,
1745
- messageId
1746
- }), [
1747
- invokePromise,
1748
- subject
1749
- ]);
1750
- const handleAcceptProposal = useCallback5(async (anchor, messageId) => {
1751
- const thread = Relation3.getSource(anchor);
1752
- const messageIndex = thread.messages.findIndex(Ref3.hasObjectId(messageId));
1753
- const message = thread.messages[messageIndex]?.target;
1754
- const proposal = message?.blocks.find((block) => block._tag === "proposal");
1755
- if (!proposal || !anchor.anchor) {
1756
- return;
1757
- }
1758
- await invokePromise(Common.CollaborationOperation.AcceptProposal, {
1759
- subject,
1760
- anchor: anchor.anchor,
1761
- proposal
1762
- });
1763
- await invokePromise(ThreadOperation.ToggleResolved, {
1764
- thread
1765
- });
1766
- }, [
1767
- invokePromise,
1768
- subject
1769
- ]);
1770
- const comments = /* @__PURE__ */ React18.createElement(CommentsContainer, {
1771
- anchors,
1772
- currentId: attended.includes(subjectId) ? state.current : void 0,
1773
- showResolvedThreads,
1774
- onAttend: handleAttend,
1775
- onComment: handleComment,
1776
- onResolve: handleResolve,
1777
- onMessageDelete: handleMessageDelete,
1778
- onThreadDelete: handleThreadDelete,
1779
- onAcceptProposal: handleAcceptProposal
1780
- });
1781
- return /* @__PURE__ */ React18.createElement(Layout.Main, {
1782
- toolbar: true
1783
- }, /* @__PURE__ */ React18.createElement(Tabs.Root, {
1784
- value: showResolvedThreads ? "all" : "unresolved",
1785
- orientation: "horizontal",
1786
- classNames: [
1787
- 'contents [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:overflow-y-auto [&_[role="tabpanel"]]:scrollbar-thin'
1788
- ],
1789
- onValueChange: onChangeViewState
1790
- }, /* @__PURE__ */ React18.createElement(Tabs.Tablist, {
1791
- classNames: mx10("bg-toolbarSurface border-be border-subduedSeparator")
1792
- }, /* @__PURE__ */ React18.createElement(Tabs.Tab, {
1793
- value: "unresolved",
1794
- classNames: "text-sm"
1795
- }, t("show unresolved label")), /* @__PURE__ */ React18.createElement(Tabs.Tab, {
1796
- value: "all",
1797
- classNames: "text-sm"
1798
- }, t("show all label"))), /* @__PURE__ */ React18.createElement("div", {
1799
- className: "overflow-y-auto"
1800
- }, /* @__PURE__ */ React18.createElement(Tabs.Tabpanel, {
1801
- value: "all"
1802
- }, showResolvedThreads && comments), /* @__PURE__ */ React18.createElement(Tabs.Tabpanel, {
1803
- value: "unresolved"
1804
- }, !showResolvedThreads && comments))));
1805
- };
1806
-
1807
- export {
1808
- Call,
1809
- CallDebugPanel,
1810
- ChatContainer,
1811
- ChannelContainer,
1812
- CallSidebar,
1813
- ThreadCompanion,
1814
- ThreadSettings
1815
- };
1816
- //# sourceMappingURL=chunk-7XQLXMX7.mjs.map