@dxos/plugin-thread 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8

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