@dxos/plugin-thread 0.8.4-main.fd6878d → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (464) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +75 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/ChannelArticle-H633OM3U.mjs +57 -0
  5. package/dist/lib/neutral/ChannelArticle-H633OM3U.mjs.map +7 -0
  6. package/dist/lib/neutral/ChannelCreatePanel-NUXXKHZQ.mjs +38 -0
  7. package/dist/lib/neutral/ChannelCreatePanel-NUXXKHZQ.mjs.map +7 -0
  8. package/dist/lib/neutral/ThreadArticle-ROQXQLEZ.mjs +57 -0
  9. package/dist/lib/neutral/ThreadArticle-ROQXQLEZ.mjs.map +7 -0
  10. package/dist/lib/neutral/ThreadPlugin.mjs +67 -0
  11. package/dist/lib/neutral/ThreadPlugin.mjs.map +7 -0
  12. package/dist/lib/neutral/ThreadPlugin.node.mjs +29 -0
  13. package/dist/lib/neutral/ThreadPlugin.node.mjs.map +7 -0
  14. package/dist/lib/neutral/ThreadPlugin.workerd.mjs +27 -0
  15. package/dist/lib/neutral/ThreadPlugin.workerd.mjs.map +7 -0
  16. package/dist/lib/neutral/app-graph-builder-OLKN3VTB.mjs +50 -0
  17. package/dist/lib/neutral/app-graph-builder-OLKN3VTB.mjs.map +7 -0
  18. package/dist/lib/neutral/append-channel-message-J6DXDPBH.mjs +34 -0
  19. package/dist/lib/neutral/append-channel-message-J6DXDPBH.mjs.map +7 -0
  20. package/dist/lib/neutral/capabilities/index.mjs +19 -0
  21. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  22. package/dist/lib/neutral/channel-backend-feed-FCXGAIEC.mjs +58 -0
  23. package/dist/lib/neutral/channel-backend-feed-FCXGAIEC.mjs.map +7 -0
  24. package/dist/lib/neutral/chunk-AWAQTEU6.mjs +10 -0
  25. package/dist/lib/neutral/chunk-AWAQTEU6.mjs.map +7 -0
  26. package/dist/lib/neutral/chunk-HJHK5O6F.mjs +109 -0
  27. package/dist/lib/neutral/chunk-HJHK5O6F.mjs.map +7 -0
  28. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  29. package/dist/lib/neutral/chunk-OOC6EQ7X.mjs +36 -0
  30. package/dist/lib/neutral/chunk-OOC6EQ7X.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-P4RSGFS4.mjs +69 -0
  32. package/dist/lib/neutral/chunk-P4RSGFS4.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-SZXFLBZL.mjs +8 -0
  34. package/dist/lib/neutral/chunk-SZXFLBZL.mjs.map +7 -0
  35. package/dist/lib/neutral/components/index.mjs +93 -0
  36. package/dist/lib/neutral/components/index.mjs.map +7 -0
  37. package/dist/lib/neutral/containers/index.mjs +13 -0
  38. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  39. package/dist/lib/neutral/create-channel-UW2LSL4G.mjs +41 -0
  40. package/dist/lib/neutral/create-channel-UW2LSL4G.mjs.map +7 -0
  41. package/dist/lib/neutral/create-object-RLCOUVAW.mjs +46 -0
  42. package/dist/lib/neutral/create-object-RLCOUVAW.mjs.map +7 -0
  43. package/dist/lib/neutral/hooks/index.mjs +11 -0
  44. package/dist/lib/neutral/index.mjs +34 -0
  45. package/dist/lib/neutral/meta.json +1 -0
  46. package/dist/lib/neutral/meta.mjs +10 -0
  47. package/dist/lib/neutral/navigation-resolver-4X4HCQYX.mjs +14 -0
  48. package/dist/lib/neutral/navigation-resolver-4X4HCQYX.mjs.map +7 -0
  49. package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs +13 -0
  50. package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs.map +7 -0
  51. package/dist/lib/neutral/operations/index.mjs +8 -0
  52. package/dist/lib/neutral/plugin.mjs +16 -0
  53. package/dist/lib/neutral/plugin.mjs.map +7 -0
  54. package/dist/lib/neutral/react-surface-G6KT7TSU.mjs +48 -0
  55. package/dist/lib/neutral/react-surface-G6KT7TSU.mjs.map +7 -0
  56. package/dist/lib/neutral/translations.mjs +91 -0
  57. package/dist/lib/neutral/translations.mjs.map +7 -0
  58. package/dist/lib/neutral/types/index.mjs +16 -0
  59. package/dist/types/src/ThreadPlugin.d.ts +3 -1
  60. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  61. package/dist/types/src/ThreadPlugin.node.d.ts +4 -0
  62. package/dist/types/src/ThreadPlugin.node.d.ts.map +1 -0
  63. package/dist/types/src/ThreadPlugin.test.d.ts +2 -0
  64. package/dist/types/src/ThreadPlugin.test.d.ts.map +1 -0
  65. package/dist/types/src/ThreadPlugin.workerd.d.ts +4 -0
  66. package/dist/types/src/ThreadPlugin.workerd.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  68. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/channel-backend-feed.d.ts +13 -0
  70. package/dist/types/src/capabilities/channel-backend-feed.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  72. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/index.d.ts +12 -14
  74. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
  76. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  78. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  80. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  81. package/dist/types/src/components/Chat/Chat.d.ts +43 -0
  82. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
  83. package/dist/types/src/components/Chat/index.d.ts +2 -0
  84. package/dist/types/src/components/Chat/index.d.ts.map +1 -0
  85. package/dist/types/src/components/index.d.ts +1 -10
  86. package/dist/types/src/components/index.d.ts.map +1 -1
  87. package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts +19 -0
  88. package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts.map +1 -0
  89. package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts +162 -0
  90. package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts.map +1 -0
  91. package/dist/types/src/containers/ChannelArticle/index.d.ts +2 -0
  92. package/dist/types/src/containers/ChannelArticle/index.d.ts.map +1 -0
  93. package/dist/types/src/containers/ChannelCreatePanel/ChannelCreatePanel.d.ts +11 -0
  94. package/dist/types/src/containers/ChannelCreatePanel/ChannelCreatePanel.d.ts.map +1 -0
  95. package/dist/types/src/containers/ChannelCreatePanel/index.d.ts +2 -0
  96. package/dist/types/src/containers/ChannelCreatePanel/index.d.ts.map +1 -0
  97. package/dist/types/src/containers/ThreadArticle/ThreadArticle.d.ts +20 -0
  98. package/dist/types/src/containers/ThreadArticle/ThreadArticle.d.ts.map +1 -0
  99. package/dist/types/src/containers/ThreadArticle/ThreadArticle.stories.d.ts +162 -0
  100. package/dist/types/src/containers/ThreadArticle/ThreadArticle.stories.d.ts.map +1 -0
  101. package/dist/types/src/containers/ThreadArticle/index.d.ts +2 -0
  102. package/dist/types/src/containers/ThreadArticle/index.d.ts.map +1 -0
  103. package/dist/types/src/containers/index.d.ts +5 -0
  104. package/dist/types/src/containers/index.d.ts.map +1 -0
  105. package/dist/types/src/hooks/index.d.ts +1 -4
  106. package/dist/types/src/hooks/index.d.ts.map +1 -1
  107. package/dist/types/src/hooks/useMessages.d.ts +4 -0
  108. package/dist/types/src/hooks/useMessages.d.ts.map +1 -0
  109. package/dist/types/src/hooks/useStatus.d.ts.map +1 -1
  110. package/dist/types/src/index.d.ts +2 -3
  111. package/dist/types/src/index.d.ts.map +1 -1
  112. package/dist/types/src/meta.d.ts +3 -4
  113. package/dist/types/src/meta.d.ts.map +1 -1
  114. package/dist/types/src/operations/append-channel-message.d.ts +5 -0
  115. package/dist/types/src/operations/append-channel-message.d.ts.map +1 -0
  116. package/dist/types/src/operations/create-channel.d.ts +5 -0
  117. package/dist/types/src/operations/create-channel.d.ts.map +1 -0
  118. package/dist/types/src/operations/index.d.ts +3 -0
  119. package/dist/types/src/operations/index.d.ts.map +1 -0
  120. package/dist/types/src/paths.d.ts +3 -0
  121. package/dist/types/src/paths.d.ts.map +1 -0
  122. package/dist/types/src/plugin.d.ts +4 -0
  123. package/dist/types/src/plugin.d.ts.map +1 -0
  124. package/dist/types/src/translations.d.ts +142 -72
  125. package/dist/types/src/translations.d.ts.map +1 -1
  126. package/dist/types/src/types/ThreadCapabilities.d.ts +37 -0
  127. package/dist/types/src/types/ThreadCapabilities.d.ts.map +1 -0
  128. package/dist/types/src/types/ThreadOperation.d.ts +91 -0
  129. package/dist/types/src/types/ThreadOperation.d.ts.map +1 -0
  130. package/dist/types/src/types/channel-backend.d.ts +16 -0
  131. package/dist/types/src/types/channel-backend.d.ts.map +1 -0
  132. package/dist/types/src/types/channel-backend.test.d.ts +2 -0
  133. package/dist/types/src/types/channel-backend.test.d.ts.map +1 -0
  134. package/dist/types/src/types/index.d.ts +3 -2
  135. package/dist/types/src/types/index.d.ts.map +1 -1
  136. package/dist/types/src/util.d.ts +4 -20
  137. package/dist/types/src/util.d.ts.map +1 -1
  138. package/dist/types/tsconfig.tsbuildinfo +1 -1
  139. package/package.json +108 -81
  140. package/src/ThreadPlugin.node.ts +26 -0
  141. package/src/ThreadPlugin.test.ts +27 -0
  142. package/src/ThreadPlugin.tsx +38 -144
  143. package/src/ThreadPlugin.workerd.ts +25 -0
  144. package/src/capabilities/app-graph-builder.ts +44 -174
  145. package/src/capabilities/channel-backend-feed.ts +60 -0
  146. package/src/capabilities/create-object.ts +46 -0
  147. package/src/capabilities/index.ts +11 -11
  148. package/src/capabilities/navigation-resolver.ts +18 -0
  149. package/src/capabilities/operation-handler.ts +16 -0
  150. package/src/capabilities/react-surface.tsx +39 -79
  151. package/src/components/Chat/Chat.tsx +119 -0
  152. package/src/components/Chat/index.ts +5 -0
  153. package/src/components/index.ts +1 -14
  154. package/src/containers/ChannelArticle/ChannelArticle.stories.tsx +108 -0
  155. package/src/containers/ChannelArticle/ChannelArticle.tsx +83 -0
  156. package/src/containers/ChannelArticle/index.ts +5 -0
  157. package/src/containers/ChannelCreatePanel/ChannelCreatePanel.tsx +52 -0
  158. package/src/containers/ChannelCreatePanel/index.ts +5 -0
  159. package/src/containers/ThreadArticle/ThreadArticle.stories.tsx +86 -0
  160. package/src/containers/ThreadArticle/ThreadArticle.tsx +75 -0
  161. package/src/containers/ThreadArticle/index.ts +5 -0
  162. package/src/containers/index.ts +9 -0
  163. package/src/hooks/index.ts +1 -4
  164. package/src/hooks/useMessages.ts +37 -0
  165. package/src/index.ts +4 -4
  166. package/src/meta.ts +27 -9
  167. package/src/operations/append-channel-message.ts +31 -0
  168. package/src/operations/create-channel.ts +30 -0
  169. package/src/operations/index.ts +10 -0
  170. package/src/paths.ts +10 -0
  171. package/src/plugin.ts +11 -0
  172. package/src/translations.ts +75 -73
  173. package/src/types/ThreadCapabilities.ts +47 -0
  174. package/src/types/ThreadOperation.ts +49 -0
  175. package/src/types/channel-backend.test.ts +48 -0
  176. package/src/types/channel-backend.ts +54 -0
  177. package/src/types/index.ts +3 -2
  178. package/src/util.ts +35 -18
  179. package/src/vite-env.d.ts +10 -0
  180. package/dist/lib/browser/ChannelContainer-O2SFQJU7.mjs +0 -16
  181. package/dist/lib/browser/ChatContainer-PVT3DUZJ.mjs +0 -15
  182. package/dist/lib/browser/app-graph-builder-AF3M7UWN.mjs +0 -171
  183. package/dist/lib/browser/app-graph-builder-AF3M7UWN.mjs.map +0 -7
  184. package/dist/lib/browser/call-manager-XRRCAVLI.mjs +0 -24
  185. package/dist/lib/browser/call-manager-XRRCAVLI.mjs.map +0 -7
  186. package/dist/lib/browser/chunk-2CWJBXBH.mjs +0 -21
  187. package/dist/lib/browser/chunk-2CWJBXBH.mjs.map +0 -7
  188. package/dist/lib/browser/chunk-4APCDRSH.mjs +0 -18
  189. package/dist/lib/browser/chunk-4APCDRSH.mjs.map +0 -7
  190. package/dist/lib/browser/chunk-DW7JD64V.mjs +0 -137
  191. package/dist/lib/browser/chunk-DW7JD64V.mjs.map +0 -7
  192. package/dist/lib/browser/chunk-EV4JWI7L.mjs +0 -17
  193. package/dist/lib/browser/chunk-EV4JWI7L.mjs.map +0 -7
  194. package/dist/lib/browser/chunk-FY4ZRD5X.mjs +0 -367
  195. package/dist/lib/browser/chunk-FY4ZRD5X.mjs.map +0 -7
  196. package/dist/lib/browser/chunk-GERVMFQW.mjs +0 -31
  197. package/dist/lib/browser/chunk-GERVMFQW.mjs.map +0 -7
  198. package/dist/lib/browser/chunk-J3JO5NWO.mjs +0 -477
  199. package/dist/lib/browser/chunk-J3JO5NWO.mjs.map +0 -7
  200. package/dist/lib/browser/chunk-JGKMMI65.mjs +0 -56
  201. package/dist/lib/browser/chunk-JGKMMI65.mjs.map +0 -7
  202. package/dist/lib/browser/chunk-TUFWPOVS.mjs +0 -1698
  203. package/dist/lib/browser/chunk-TUFWPOVS.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-X5PIP5YR.mjs +0 -149
  205. package/dist/lib/browser/chunk-X5PIP5YR.mjs.map +0 -7
  206. package/dist/lib/browser/chunk-ZJ7QBXK6.mjs +0 -984
  207. package/dist/lib/browser/chunk-ZJ7QBXK6.mjs.map +0 -7
  208. package/dist/lib/browser/index.mjs +0 -302
  209. package/dist/lib/browser/index.mjs.map +0 -7
  210. package/dist/lib/browser/intent-resolver-DCY4P4OX.mjs +0 -369
  211. package/dist/lib/browser/intent-resolver-DCY4P4OX.mjs.map +0 -7
  212. package/dist/lib/browser/markdown-WZSXCEZJ.mjs +0 -169
  213. package/dist/lib/browser/markdown-WZSXCEZJ.mjs.map +0 -7
  214. package/dist/lib/browser/meta.json +0 -1
  215. package/dist/lib/browser/react-root-QXPALOUQ.mjs +0 -28
  216. package/dist/lib/browser/react-root-QXPALOUQ.mjs.map +0 -7
  217. package/dist/lib/browser/react-surface-PYAMIADB.mjs +0 -109
  218. package/dist/lib/browser/react-surface-PYAMIADB.mjs.map +0 -7
  219. package/dist/lib/browser/settings-AC6YSASL.mjs +0 -22
  220. package/dist/lib/browser/settings-AC6YSASL.mjs.map +0 -7
  221. package/dist/lib/browser/state-2T4KDWBX.mjs +0 -34
  222. package/dist/lib/browser/state-2T4KDWBX.mjs.map +0 -7
  223. package/dist/lib/browser/types/index.mjs +0 -16
  224. package/dist/lib/node-esm/ChannelContainer-B2ZGAE4P.mjs +0 -17
  225. package/dist/lib/node-esm/ChatContainer-2CT4PJ7I.mjs +0 -16
  226. package/dist/lib/node-esm/app-graph-builder-OLSJVCWY.mjs +0 -172
  227. package/dist/lib/node-esm/app-graph-builder-OLSJVCWY.mjs.map +0 -7
  228. package/dist/lib/node-esm/call-manager-EI7FXRAU.mjs +0 -25
  229. package/dist/lib/node-esm/call-manager-EI7FXRAU.mjs.map +0 -7
  230. package/dist/lib/node-esm/chunk-4TME3BR4.mjs +0 -1699
  231. package/dist/lib/node-esm/chunk-4TME3BR4.mjs.map +0 -7
  232. package/dist/lib/node-esm/chunk-57XR3LEF.mjs +0 -33
  233. package/dist/lib/node-esm/chunk-57XR3LEF.mjs.map +0 -7
  234. package/dist/lib/node-esm/chunk-6CRHHOST.mjs +0 -23
  235. package/dist/lib/node-esm/chunk-6CRHHOST.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-BF4UKS55.mjs +0 -368
  237. package/dist/lib/node-esm/chunk-BF4UKS55.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-GRLRWTRU.mjs +0 -19
  239. package/dist/lib/node-esm/chunk-GRLRWTRU.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-PYTVBN5J.mjs +0 -19
  241. package/dist/lib/node-esm/chunk-PYTVBN5J.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-QBHKLWGR.mjs +0 -58
  243. package/dist/lib/node-esm/chunk-QBHKLWGR.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-SED3O2XO.mjs +0 -150
  245. package/dist/lib/node-esm/chunk-SED3O2XO.mjs.map +0 -7
  246. package/dist/lib/node-esm/chunk-VNG6M2IY.mjs +0 -478
  247. package/dist/lib/node-esm/chunk-VNG6M2IY.mjs.map +0 -7
  248. package/dist/lib/node-esm/chunk-XVKWHTH4.mjs +0 -138
  249. package/dist/lib/node-esm/chunk-XVKWHTH4.mjs.map +0 -7
  250. package/dist/lib/node-esm/chunk-YIDU3DXK.mjs +0 -985
  251. package/dist/lib/node-esm/chunk-YIDU3DXK.mjs.map +0 -7
  252. package/dist/lib/node-esm/index.mjs +0 -303
  253. package/dist/lib/node-esm/index.mjs.map +0 -7
  254. package/dist/lib/node-esm/intent-resolver-QGTPU6QB.mjs +0 -370
  255. package/dist/lib/node-esm/intent-resolver-QGTPU6QB.mjs.map +0 -7
  256. package/dist/lib/node-esm/markdown-3MZXUGUA.mjs +0 -170
  257. package/dist/lib/node-esm/markdown-3MZXUGUA.mjs.map +0 -7
  258. package/dist/lib/node-esm/meta.json +0 -1
  259. package/dist/lib/node-esm/react-root-7ZFJYVUZ.mjs +0 -29
  260. package/dist/lib/node-esm/react-root-7ZFJYVUZ.mjs.map +0 -7
  261. package/dist/lib/node-esm/react-surface-UJFCSFNO.mjs +0 -110
  262. package/dist/lib/node-esm/react-surface-UJFCSFNO.mjs.map +0 -7
  263. package/dist/lib/node-esm/settings-N52O7MLS.mjs +0 -23
  264. package/dist/lib/node-esm/settings-N52O7MLS.mjs.map +0 -7
  265. package/dist/lib/node-esm/state-62TQKQVB.mjs +0 -35
  266. package/dist/lib/node-esm/state-62TQKQVB.mjs.map +0 -7
  267. package/dist/lib/node-esm/types/index.mjs +0 -17
  268. package/dist/types/src/calls/call-manager.d.ts +0 -77
  269. package/dist/types/src/calls/call-manager.d.ts.map +0 -1
  270. package/dist/types/src/calls/call-swarm-synchronizer.d.ts +0 -66
  271. package/dist/types/src/calls/call-swarm-synchronizer.d.ts.map +0 -1
  272. package/dist/types/src/calls/index.d.ts +0 -7
  273. package/dist/types/src/calls/index.d.ts.map +0 -1
  274. package/dist/types/src/calls/media-manager.d.ts +0 -60
  275. package/dist/types/src/calls/media-manager.d.ts.map +0 -1
  276. package/dist/types/src/calls/speaking-monitor.d.ts +0 -24
  277. package/dist/types/src/calls/speaking-monitor.d.ts.map +0 -1
  278. package/dist/types/src/calls/types.d.ts +0 -45
  279. package/dist/types/src/calls/types.d.ts.map +0 -1
  280. package/dist/types/src/calls/util/audio.d.ts +0 -6
  281. package/dist/types/src/calls/util/audio.d.ts.map +0 -1
  282. package/dist/types/src/calls/util/calls-service.d.ts +0 -75
  283. package/dist/types/src/calls/util/calls-service.d.ts.map +0 -1
  284. package/dist/types/src/calls/util/history-cache.d.ts +0 -11
  285. package/dist/types/src/calls/util/history-cache.d.ts.map +0 -1
  286. package/dist/types/src/calls/util/index.d.ts +0 -5
  287. package/dist/types/src/calls/util/index.d.ts.map +0 -1
  288. package/dist/types/src/calls/util/media.d.ts +0 -6
  289. package/dist/types/src/calls/util/media.d.ts.map +0 -1
  290. package/dist/types/src/calls/util/stub-media-streams.d.ts +0 -18
  291. package/dist/types/src/calls/util/stub-media-streams.d.ts.map +0 -1
  292. package/dist/types/src/calls/util/task-scheduling.d.ts +0 -17
  293. package/dist/types/src/calls/util/task-scheduling.d.ts.map +0 -1
  294. package/dist/types/src/calls-service.stories.d.ts +0 -22
  295. package/dist/types/src/calls-service.stories.d.ts.map +0 -1
  296. package/dist/types/src/capabilities/call-manager.d.ts +0 -5
  297. package/dist/types/src/capabilities/call-manager.d.ts.map +0 -1
  298. package/dist/types/src/capabilities/capabilities.d.ts +0 -27
  299. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  300. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  301. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  302. package/dist/types/src/capabilities/markdown.d.ts +0 -4
  303. package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
  304. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  305. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  306. package/dist/types/src/capabilities/settings.d.ts +0 -4
  307. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  308. package/dist/types/src/capabilities/state.d.ts +0 -7
  309. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  310. package/dist/types/src/components/Call/Call.d.ts +0 -17
  311. package/dist/types/src/components/Call/Call.d.ts.map +0 -1
  312. package/dist/types/src/components/Call/Toolbar.d.ts +0 -16
  313. package/dist/types/src/components/Call/Toolbar.d.ts.map +0 -1
  314. package/dist/types/src/components/Call/index.d.ts +0 -3
  315. package/dist/types/src/components/Call/index.d.ts.map +0 -1
  316. package/dist/types/src/components/CallDebugPanel.d.ts +0 -8
  317. package/dist/types/src/components/CallDebugPanel.d.ts.map +0 -1
  318. package/dist/types/src/components/CallSidebar.d.ts +0 -4
  319. package/dist/types/src/components/CallSidebar.d.ts.map +0 -1
  320. package/dist/types/src/components/ChannelContainer.d.ts +0 -14
  321. package/dist/types/src/components/ChannelContainer.d.ts.map +0 -1
  322. package/dist/types/src/components/ChannelContainer.stories.d.ts +0 -10
  323. package/dist/types/src/components/ChannelContainer.stories.d.ts.map +0 -1
  324. package/dist/types/src/components/Chat.stories.d.ts +0 -7
  325. package/dist/types/src/components/Chat.stories.d.ts.map +0 -1
  326. package/dist/types/src/components/ChatContainer.d.ts +0 -17
  327. package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
  328. package/dist/types/src/components/Comments.stories.d.ts +0 -6
  329. package/dist/types/src/components/Comments.stories.d.ts.map +0 -1
  330. package/dist/types/src/components/CommentsContainer.d.ts +0 -13
  331. package/dist/types/src/components/CommentsContainer.d.ts.map +0 -1
  332. package/dist/types/src/components/CommentsThreadContainer.d.ts +0 -14
  333. package/dist/types/src/components/CommentsThreadContainer.d.ts.map +0 -1
  334. package/dist/types/src/components/Lobby/Lobby.d.ts +0 -15
  335. package/dist/types/src/components/Lobby/Lobby.d.ts.map +0 -1
  336. package/dist/types/src/components/Lobby/index.d.ts +0 -2
  337. package/dist/types/src/components/Lobby/index.d.ts.map +0 -1
  338. package/dist/types/src/components/Media/AudioStream.d.ts +0 -6
  339. package/dist/types/src/components/Media/AudioStream.d.ts.map +0 -1
  340. package/dist/types/src/components/Media/VideoObject.d.ts +0 -15
  341. package/dist/types/src/components/Media/VideoObject.d.ts.map +0 -1
  342. package/dist/types/src/components/Media/VideoObject.stories.d.ts +0 -8
  343. package/dist/types/src/components/Media/VideoObject.stories.d.ts.map +0 -1
  344. package/dist/types/src/components/Media/index.d.ts +0 -3
  345. package/dist/types/src/components/Media/index.d.ts.map +0 -1
  346. package/dist/types/src/components/MessageContainer.d.ts +0 -11
  347. package/dist/types/src/components/MessageContainer.d.ts.map +0 -1
  348. package/dist/types/src/components/Participant/Participant.d.ts +0 -6
  349. package/dist/types/src/components/Participant/Participant.d.ts.map +0 -1
  350. package/dist/types/src/components/Participant/ParticipantGrid.d.ts +0 -11
  351. package/dist/types/src/components/Participant/ParticipantGrid.d.ts.map +0 -1
  352. package/dist/types/src/components/Participant/index.d.ts +0 -3
  353. package/dist/types/src/components/Participant/index.d.ts.map +0 -1
  354. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts +0 -12
  355. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.d.ts.map +0 -1
  356. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts +0 -10
  357. package/dist/types/src/components/ResponsiveGrid/ResponsiveContainer.stories.d.ts.map +0 -1
  358. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.d.ts +0 -32
  359. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.d.ts.map +0 -1
  360. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts +0 -23
  361. package/dist/types/src/components/ResponsiveGrid/ResponsiveGrid.stories.d.ts.map +0 -1
  362. package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts +0 -21
  363. package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts.map +0 -1
  364. package/dist/types/src/components/ResponsiveGrid/index.d.ts +0 -4
  365. package/dist/types/src/components/ResponsiveGrid/index.d.ts.map +0 -1
  366. package/dist/types/src/components/ThreadComplementary.d.ts +0 -5
  367. package/dist/types/src/components/ThreadComplementary.d.ts.map +0 -1
  368. package/dist/types/src/components/ThreadSettings.d.ts +0 -6
  369. package/dist/types/src/components/ThreadSettings.d.ts.map +0 -1
  370. package/dist/types/src/components/command-extension.d.ts +0 -3
  371. package/dist/types/src/components/command-extension.d.ts.map +0 -1
  372. package/dist/types/src/components/testing.d.ts +0 -4
  373. package/dist/types/src/components/testing.d.ts.map +0 -1
  374. package/dist/types/src/extensions/index.d.ts +0 -2
  375. package/dist/types/src/extensions/index.d.ts.map +0 -1
  376. package/dist/types/src/extensions/threads.d.ts +0 -9
  377. package/dist/types/src/extensions/threads.d.ts.map +0 -1
  378. package/dist/types/src/hooks/analytics.d.ts +0 -4
  379. package/dist/types/src/hooks/analytics.d.ts.map +0 -1
  380. package/dist/types/src/hooks/useDebugMode.d.ts +0 -2
  381. package/dist/types/src/hooks/useDebugMode.d.ts.map +0 -1
  382. package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts +0 -2
  383. package/dist/types/src/hooks/useInaudibleAudioStreamTrack.d.ts.map +0 -1
  384. package/dist/types/src/hooks/useVideoStreamTrack.d.ts +0 -3
  385. package/dist/types/src/hooks/useVideoStreamTrack.d.ts.map +0 -1
  386. package/dist/types/src/testing/index.d.ts +0 -2
  387. package/dist/types/src/testing/index.d.ts.map +0 -1
  388. package/dist/types/src/testing/stories.d.ts +0 -2
  389. package/dist/types/src/testing/stories.d.ts.map +0 -1
  390. package/dist/types/src/types/schema.d.ts +0 -164
  391. package/dist/types/src/types/schema.d.ts.map +0 -1
  392. package/dist/types/src/types/types.d.ts +0 -388
  393. package/dist/types/src/types/types.d.ts.map +0 -1
  394. package/src/calls/call-manager.ts +0 -246
  395. package/src/calls/call-swarm-synchronizer.ts +0 -350
  396. package/src/calls/index.ts +0 -10
  397. package/src/calls/media-manager.ts +0 -349
  398. package/src/calls/speaking-monitor.ts +0 -85
  399. package/src/calls/types.ts +0 -70
  400. package/src/calls/util/audio.ts +0 -58
  401. package/src/calls/util/calls-service.ts +0 -531
  402. package/src/calls/util/history-cache.ts +0 -27
  403. package/src/calls/util/index.ts +0 -8
  404. package/src/calls/util/media.ts +0 -52
  405. package/src/calls/util/stub-media-streams.ts +0 -70
  406. package/src/calls/util/task-scheduling.ts +0 -92
  407. package/src/calls-service.stories.tsx +0 -216
  408. package/src/capabilities/call-manager.ts +0 -20
  409. package/src/capabilities/capabilities.ts +0 -33
  410. package/src/capabilities/intent-resolver.ts +0 -315
  411. package/src/capabilities/markdown.ts +0 -69
  412. package/src/capabilities/react-root.tsx +0 -17
  413. package/src/capabilities/settings.ts +0 -19
  414. package/src/capabilities/state.ts +0 -26
  415. package/src/components/Call/Call.tsx +0 -89
  416. package/src/components/Call/Toolbar.tsx +0 -182
  417. package/src/components/Call/index.ts +0 -6
  418. package/src/components/CallDebugPanel.tsx +0 -115
  419. package/src/components/CallSidebar.tsx +0 -18
  420. package/src/components/ChannelContainer.stories.tsx +0 -59
  421. package/src/components/ChannelContainer.tsx +0 -201
  422. package/src/components/Chat.stories.tsx +0 -89
  423. package/src/components/ChatContainer.tsx +0 -142
  424. package/src/components/Comments.stories.tsx +0 -93
  425. package/src/components/CommentsContainer.tsx +0 -72
  426. package/src/components/CommentsThreadContainer.tsx +0 -168
  427. package/src/components/Lobby/Lobby.tsx +0 -119
  428. package/src/components/Lobby/index.ts +0 -5
  429. package/src/components/Media/AudioStream.tsx +0 -67
  430. package/src/components/Media/VideoObject.stories.tsx +0 -53
  431. package/src/components/Media/VideoObject.tsx +0 -58
  432. package/src/components/Media/index.ts +0 -6
  433. package/src/components/MessageContainer.tsx +0 -152
  434. package/src/components/Participant/Participant.tsx +0 -57
  435. package/src/components/Participant/ParticipantGrid.tsx +0 -89
  436. package/src/components/Participant/index.ts +0 -6
  437. package/src/components/ResponsiveGrid/ResponsiveContainer.stories.tsx +0 -55
  438. package/src/components/ResponsiveGrid/ResponsiveContainer.tsx +0 -31
  439. package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +0 -157
  440. package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +0 -341
  441. package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +0 -131
  442. package/src/components/ResponsiveGrid/index.ts +0 -7
  443. package/src/components/ThreadComplementary.tsx +0 -151
  444. package/src/components/ThreadSettings.tsx +0 -17
  445. package/src/components/command-extension.ts +0 -33
  446. package/src/components/testing.ts +0 -29
  447. package/src/extensions/index.ts +0 -5
  448. package/src/extensions/threads.ts +0 -126
  449. package/src/hooks/analytics.ts +0 -40
  450. package/src/hooks/useDebugMode.ts +0 -25
  451. package/src/hooks/useInaudibleAudioStreamTrack.tsx +0 -27
  452. package/src/hooks/useVideoStreamTrack.tsx +0 -33
  453. package/src/testing/index.ts +0 -5
  454. package/src/testing/stories.ts +0 -54
  455. package/src/types/schema.ts +0 -33
  456. package/src/types/types.ts +0 -119
  457. package/src/typings/peermetrics-webrtc-stats.d.ts +0 -30
  458. package/src/typings.d.ts +0 -8
  459. /package/dist/lib/{browser/ChannelContainer-O2SFQJU7.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  460. /package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
  461. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
  462. /package/dist/lib/{browser/ChatContainer-PVT3DUZJ.mjs.map → neutral/meta.mjs.map} +0 -0
  463. /package/dist/lib/{node-esm/ChannelContainer-B2ZGAE4P.mjs.map → neutral/operations/index.mjs.map} +0 -0
  464. /package/dist/lib/{node-esm/ChatContainer-2CT4PJ7I.mjs.map → neutral/types/index.mjs.map} +0 -0
@@ -1,201 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Rx } from '@effect-rx/rx-react';
6
- import React, { type ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react';
7
-
8
- import { useCapabilities, useCapability } from '@dxos/app-framework';
9
- import { Context } from '@dxos/context';
10
- import { failUndefined } from '@dxos/debug';
11
- import { log } from '@dxos/log';
12
- import { useClient } from '@dxos/react-client';
13
- import { fullyQualifiedId, getSpace } from '@dxos/react-client/echo';
14
- import { useIdentity } from '@dxos/react-client/halo';
15
- import { ElevationProvider, Input, type ThemedClassName, useTranslation } from '@dxos/react-ui';
16
- import { ControlGroup, ControlGroupButton, ControlItemInput } from '@dxos/react-ui-form';
17
- import { MenuProvider, ToolbarMenu, createMenuAction, createMenuItemGroup, useMenuActions } from '@dxos/react-ui-menu';
18
- import { useSoundEffect } from '@dxos/react-ui-sfx';
19
- import { StackItem } from '@dxos/react-ui-stack';
20
-
21
- import { ThreadCapabilities } from '../capabilities';
22
- import { meta } from '../meta';
23
- import { type ChannelType } from '../types';
24
-
25
- import { Call } from './Call';
26
- import ChatContainer from './ChatContainer';
27
-
28
- export type ChannelContainerProps = {
29
- channel?: ChannelType;
30
- roomId?: string;
31
- role?: string;
32
- fullscreen?: boolean;
33
- };
34
-
35
- /**
36
- * Renders a call when active, otherwise renders the channel chat.
37
- */
38
- export const ChannelContainer = ({ channel, roomId: _roomId, role, fullscreen }: ChannelContainerProps) => {
39
- const space = getSpace(channel);
40
- const callManager = useCapability(ThreadCapabilities.CallManager);
41
- const roomId = _roomId ?? (channel ? fullyQualifiedId(channel) : failUndefined());
42
- const identity = useIdentity();
43
- const isNamed = !!identity?.profile?.displayName;
44
- const joinSound = useSoundEffect('JoinCall');
45
- const leaveSound = useSoundEffect('LeaveCall');
46
-
47
- const extensions = useCapabilities(ThreadCapabilities.CallExtension);
48
- useEffect(() => {
49
- const ctx = new Context();
50
- callManager.left.on(ctx, (roomId) => {
51
- extensions.forEach((extension) => {
52
- void extension.onLeave?.(roomId);
53
- });
54
- });
55
-
56
- callManager.callStateUpdated.on(ctx, (state) => {
57
- extensions.forEach((extension) => {
58
- void extension.onCallStateUpdated?.(state);
59
- });
60
- });
61
-
62
- callManager.mediaStateUpdated.on(ctx, (state) => {
63
- extensions.forEach((extension) => {
64
- void extension.onMediaStateUpdated?.(state);
65
- });
66
- });
67
-
68
- return () => {
69
- void ctx.dispose();
70
- };
71
- }, [callManager, extensions]);
72
-
73
- /**
74
- * Join the call.
75
- */
76
- // TODO(wittjosiah): Show preview before joining?
77
- const handleJoin = useCallback(async () => {
78
- if (!roomId || !channel) {
79
- return;
80
- }
81
-
82
- if (callManager.joined) {
83
- await callManager.leave();
84
- }
85
-
86
- try {
87
- void joinSound.play();
88
- callManager.setRoomId(roomId);
89
- await callManager.join();
90
- await Promise.all(extensions.map((extension) => extension.onJoin?.({ channel, roomId })));
91
- } catch (err) {
92
- // TODO(burdon): Error sound.
93
- log.catch(err);
94
- }
95
- }, [extensions, channel, roomId]);
96
-
97
- /**
98
- * Leave the call.
99
- */
100
- const handleLeave = useCallback(async () => {
101
- try {
102
- void leaveSound.play();
103
- } catch (err) {
104
- // TODO(burdon): Error sound.
105
- log.catch(err);
106
- } finally {
107
- void callManager.turnAudioOff();
108
- void callManager.turnVideoOff();
109
- void callManager.turnScreenshareOff();
110
- void callManager.leave();
111
- }
112
- }, [extensions, roomId]);
113
-
114
- const isJoined = callManager.joined && callManager.roomId === roomId;
115
-
116
- return (
117
- <StackItem.Content toolbar={!isJoined} classNames={isJoined && 'h-full'}>
118
- {isJoined && !isNamed && <DisplayNameMissing />}
119
- {isJoined && isNamed && (
120
- <Call.Root>
121
- <Call.Grid fullscreen={fullscreen} />
122
- <Call.Toolbar channel={channel} onLeave={handleLeave} />
123
- </Call.Root>
124
- )}
125
- {!isJoined && channel && channel.defaultThread.target && space && (
126
- <>
127
- <ChannelToolbar attendableId={fullyQualifiedId(channel)} role={role} onJoinCall={handleJoin} />
128
- <ChatContainer space={space} thread={channel.defaultThread.target} />
129
- </>
130
- )}
131
- </StackItem.Content>
132
- );
133
- };
134
-
135
- export default ChannelContainer;
136
-
137
- const DisplayNameMissing = () => {
138
- const { t } = useTranslation(meta.id);
139
- const client = useClient();
140
- const [displayName, setDisplayName] = useState('');
141
- const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => setDisplayName(event.target.value), []);
142
- const handleSave = useCallback(() => client.halo.updateProfile({ displayName }), [client, displayName]);
143
-
144
- return (
145
- <ControlGroup classNames='p-4 place-content-center'>
146
- <ControlItemInput title={t('display name label')} description={t('display name description')}>
147
- <Input.TextInput
148
- value={displayName}
149
- onChange={handleChange}
150
- placeholder={t('display name input placeholder')}
151
- classNames='md:min-is-64'
152
- />
153
- </ControlItemInput>
154
- <ControlGroupButton disabled={!displayName} onClick={handleSave}>
155
- {t('set display name label')}
156
- </ControlGroupButton>
157
- </ControlGroup>
158
- );
159
- };
160
-
161
- const useChannelToolbarActions = (onJoinCall?: () => void) => {
162
- const creator = useMemo(
163
- () =>
164
- Rx.make(() => {
165
- return {
166
- nodes: [
167
- createMenuItemGroup('root', {
168
- label: ['channel toolbar title', { ns: meta.id }],
169
- }),
170
- createMenuAction('video-call', () => onJoinCall?.(), {
171
- label: ['start video call label', { ns: meta.id }],
172
- icon: 'ph--video-camera--regular',
173
- type: 'video-call',
174
- }),
175
- ],
176
- edges: [{ source: 'root', target: 'video-call' }],
177
- };
178
- }),
179
- [],
180
- );
181
-
182
- return useMenuActions(creator);
183
- };
184
-
185
- type ChannelToolbarProps = ThemedClassName<{
186
- attendableId?: string;
187
- role?: string;
188
- onJoinCall?: () => void;
189
- }>;
190
-
191
- const ChannelToolbar = ({ attendableId, role, onJoinCall, classNames }: ChannelToolbarProps) => {
192
- const menuProps = useChannelToolbarActions(onJoinCall);
193
-
194
- return (
195
- <ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
196
- <MenuProvider {...menuProps} attendableId={attendableId}>
197
- <ToolbarMenu classNames={classNames} />
198
- </MenuProvider>
199
- </ElevationProvider>
200
- );
201
- };
@@ -1,89 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
8
- import React, { useEffect, useState } from 'react';
9
-
10
- import { Capabilities, IntentPlugin, contributes, createSurface } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { Obj, Ref } from '@dxos/echo';
13
- import { faker } from '@dxos/random';
14
- import { useClient } from '@dxos/react-client';
15
- import { type Space } from '@dxos/react-client/echo';
16
- import { useIdentity } from '@dxos/react-client/halo';
17
- import { withClientProvider } from '@dxos/react-client/testing';
18
- import { Thread } from '@dxos/react-ui-thread';
19
- import { DataType } from '@dxos/schema';
20
- import { withLayout, withTheme } from '@dxos/storybook-utils';
21
-
22
- import { translations } from '../translations';
23
- import { ChannelType, ThreadType } from '../types';
24
-
25
- import { ChatContainer } from './ChatContainer';
26
-
27
- faker.seed(1);
28
-
29
- const Story = () => {
30
- const client = useClient();
31
- const identity = useIdentity();
32
- const [space, setSpace] = useState<Space>();
33
- const [channel, setChannel] = useState<ChannelType | null>();
34
-
35
- useEffect(() => {
36
- if (identity) {
37
- setTimeout(async () => {
38
- const space = await client.spaces.create();
39
- const channel = space.db.add(
40
- Obj.make(ChannelType, {
41
- defaultThread: Ref.make(Obj.make(ThreadType, { messages: [], status: 'active' })),
42
- threads: [],
43
- }),
44
- );
45
- setSpace(space);
46
- setChannel(channel);
47
- });
48
- }
49
- }, [identity]);
50
-
51
- if (!identity || !channel || !space || !channel.defaultThread.target) {
52
- return null;
53
- }
54
-
55
- return (
56
- <main className='max-is-prose mli-auto bs-dvh overflow-hidden'>
57
- <ChatContainer space={space} thread={channel.defaultThread.target} />
58
- </main>
59
- );
60
- };
61
-
62
- export const Default = {};
63
-
64
- const meta: Meta<typeof Thread.Root> = {
65
- title: 'plugins/plugin-thread/Chat',
66
- component: Thread.Root,
67
- render: () => <Story />,
68
- decorators: [
69
- withPluginManager({
70
- plugins: [IntentPlugin()],
71
- capabilities: [
72
- contributes(
73
- Capabilities.ReactSurface,
74
- createSurface({
75
- id: 'test',
76
- role: 'card',
77
- component: ({ role }) => <span>{JSON.stringify({ role })}</span>,
78
- }),
79
- ),
80
- ],
81
- }),
82
- withTheme,
83
- withLayout({ fullscreen: true }),
84
- withClientProvider({ createSpace: true, types: [ThreadType, DataType.Message] }),
85
- ],
86
- parameters: { translations },
87
- };
88
-
89
- export default meta;
@@ -1,142 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
6
-
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { type Space, fullyQualifiedId, useMembers } from '@dxos/react-client/echo';
9
- import { useIdentity } from '@dxos/react-client/halo';
10
- import { Icon, ScrollArea, useThemeContext, useTranslation } from '@dxos/react-ui';
11
- import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';
12
- import { StackItem } from '@dxos/react-ui-stack';
13
- import { mx } from '@dxos/react-ui-theme';
14
- import {
15
- MessageTextbox,
16
- type MessageTextboxProps,
17
- Thread,
18
- type ThreadRootProps,
19
- threadLayout,
20
- } from '@dxos/react-ui-thread';
21
- import { DataType } from '@dxos/schema';
22
- import { isNonNullable } from '@dxos/util';
23
-
24
- import { useStatus } from '../hooks';
25
- import { meta } from '../meta';
26
- import { type ThreadType } from '../types';
27
- import { getMessageMetadata } from '../util';
28
-
29
- import { command } from './command-extension';
30
- import { MessageContainer } from './MessageContainer';
31
-
32
- export const ChatHeading = ({ attendableId }: { attendableId?: string }) => {
33
- const { t } = useTranslation(meta.id);
34
- return (
35
- <div role='none' className='flex items-center'>
36
- <StackItem.SigilButton attendableId={attendableId}>
37
- <Icon icon='ph--chat--regular' size={5} />
38
- </StackItem.SigilButton>
39
- <StackItem.HeadingLabel attendableId={attendableId}>{t('chat heading')}</StackItem.HeadingLabel>
40
- </div>
41
- );
42
- };
43
-
44
- export type ChatContainerProps = {
45
- space: Space;
46
- thread: ThreadType;
47
- context?: Obj.Any;
48
- autoFocusTextbox?: boolean;
49
- } & Pick<ThreadRootProps, 'current'>;
50
-
51
- export const ChatContainer = ({ space, thread, context, current, autoFocusTextbox }: ChatContainerProps) => {
52
- const { t } = useTranslation(meta.id);
53
- const id = fullyQualifiedId(thread);
54
- const identity = useIdentity()!;
55
- const members = useMembers(space?.key);
56
- const activity = useStatus(space, id);
57
- // TODO(wittjosiah): This is a hack to reset the editor after a message is sent.
58
- const [_count, _setCount] = useState(0);
59
- const rerenderEditor = () => _setCount((count) => count + 1);
60
- const [autoFocus, setAutoFocus] = useState(autoFocusTextbox);
61
- const threadScrollRef = useRef<HTMLDivElement | null>(null);
62
- const { themeMode } = useThemeContext();
63
-
64
- const textboxMetadata = getMessageMetadata(id, identity);
65
- const messageRef = useRef('');
66
- const extensions = useMemo(
67
- () => [
68
- createBasicExtensions({ placeholder: t('message placeholder') }),
69
- createThemeExtensions({ themeMode }),
70
- listener({ onChange: (text) => (messageRef.current = text) }),
71
- command,
72
- ],
73
- [themeMode, _count],
74
- );
75
-
76
- // TODO(thure): Factor out.
77
- // TODO(thure): `flex-col-reverse` does not work to start the container scrolled to the end while also using
78
- // `ScrollArea`. This is the least-bad way I found to scroll to the end on mount. Note that 0ms was insufficient
79
- // for the desired effect; this is likely hardware-dependent and should be reevaluated.
80
- const scrollToEnd = (behavior: ScrollBehavior) =>
81
- setTimeout(() => threadScrollRef.current?.scrollIntoView({ behavior, block: 'end' }), 10);
82
-
83
- useLayoutEffect(() => {
84
- scrollToEnd('instant');
85
- }, []);
86
-
87
- // TODO(burdon): Change to model.
88
- const handleCreate: MessageTextboxProps['onSend'] = () => {
89
- if (!messageRef.current?.length) {
90
- return false;
91
- }
92
-
93
- thread.messages.push(
94
- Ref.make(
95
- Obj.make(DataType.Message, {
96
- created: new Date().toISOString(),
97
- sender: { identityDid: identity.did },
98
- blocks: [{ _tag: 'text', text: messageRef.current }],
99
- properties: context ? { context: Ref.make(context) } : undefined,
100
- }),
101
- ),
102
- );
103
-
104
- messageRef.current = '';
105
- setAutoFocus(true);
106
- scrollToEnd('smooth');
107
- rerenderEditor();
108
- return true;
109
- };
110
-
111
- return (
112
- <Thread.Root
113
- current={current}
114
- id={id}
115
- classNames='bs-full grid-rows-[1fr_min-content_min-content] overflow-hidden transition-[padding-block-end] [[data-sidebar-inline-start-state=open]_&]:lg:pbe-0'
116
- >
117
- <ScrollArea.Root classNames='col-span-2'>
118
- <ScrollArea.Viewport 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]'>
119
- <div role='none' className={mx(threadLayout, 'place-self-end')}>
120
- {thread.messages
121
- .map((message) => message.target)
122
- .filter(isNonNullable)
123
- .map((message) => (
124
- <MessageContainer key={message.id} message={message} members={members} />
125
- ))}
126
- </div>
127
- {/* NOTE(thure): This can’t also be the `overflow-anchor` because `ScrollArea` injects an interceding node that contains this necessary ref’d element. */}
128
- <div role='none' className='bs-px -mbs-px' ref={threadScrollRef} />
129
- <ScrollArea.Scrollbar>
130
- <ScrollArea.Thumb />
131
- </ScrollArea.Scrollbar>
132
- </ScrollArea.Viewport>
133
- </ScrollArea.Root>
134
-
135
- <MessageTextbox extensions={extensions} autoFocus={autoFocus} onSend={handleCreate} {...textboxMetadata} />
136
-
137
- <Thread.Status activity={activity}>{t('activity message')}</Thread.Status>
138
- </Thread.Root>
139
- );
140
- };
141
-
142
- export default ChatContainer;
@@ -1,93 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
8
- import React, { useEffect } from 'react';
9
-
10
- import { IntentPlugin } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { Obj, Query, Relation, Type } from '@dxos/echo';
13
- import { ClientPlugin } from '@dxos/plugin-client';
14
- import { faker } from '@dxos/random';
15
- import { useQuery, useSpace } from '@dxos/react-client/echo';
16
- import { useIdentity } from '@dxos/react-client/halo';
17
- import { AnchoredTo, DataType } from '@dxos/schema';
18
- import { layoutCentered, render, withLayout, withTheme } from '@dxos/storybook-utils';
19
-
20
- import { translations } from '../translations';
21
- import { ThreadType } from '../types';
22
-
23
- import { CommentsContainer } from './CommentsContainer';
24
- import { createCommentThread } from './testing';
25
-
26
- faker.seed(1);
27
-
28
- const DefaultStory = () => {
29
- const identity = useIdentity();
30
- const space = useSpace();
31
- const anchors = useQuery(space, Query.type(AnchoredTo));
32
-
33
- useEffect(() => {
34
- if (identity && space) {
35
- const t = setTimeout(async () => {
36
- const object = space.db.add(Obj.make(Type.Expando, {}));
37
- const thread1 = space.db.add(createCommentThread(identity));
38
- const thread2 = space.db.add(createCommentThread(identity));
39
- space.db.add(
40
- Relation.make(AnchoredTo, {
41
- [Relation.Source]: thread1,
42
- [Relation.Target]: object,
43
- }),
44
- );
45
- space.db.add(
46
- Relation.make(AnchoredTo, {
47
- [Relation.Source]: thread2,
48
- [Relation.Target]: object,
49
- }),
50
- );
51
- });
52
-
53
- return () => clearTimeout(t);
54
- }
55
- }, [identity, space]);
56
-
57
- if (!identity || !space || !anchors) {
58
- return null;
59
- }
60
-
61
- return (
62
- <div className='w-[30rem] overflow-y-auto bg-baseSurface'>
63
- <CommentsContainer anchors={anchors} onThreadDelete={console.log} />
64
- </div>
65
- );
66
- };
67
-
68
- const meta: Meta = {
69
- title: 'plugins/plugin-thread/Comments',
70
- render: render(DefaultStory),
71
- decorators: [
72
- withTheme,
73
- withLayout({ fullscreen: true, classNames: layoutCentered }),
74
- withPluginManager({
75
- plugins: [
76
- IntentPlugin(),
77
- ClientPlugin({
78
- types: [DataType.Message, ThreadType, AnchoredTo],
79
- onClientInitialized: async ({ client }) => {
80
- await client.halo.createIdentity();
81
- },
82
- }),
83
- ],
84
- }),
85
- ],
86
- parameters: {
87
- translations,
88
- },
89
- };
90
-
91
- export default meta;
92
-
93
- export const Default = {};
@@ -1,72 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React, { useEffect } from 'react';
6
-
7
- import { Relation } from '@dxos/echo';
8
- import { fullyQualifiedId } from '@dxos/react-client/echo';
9
- import { Callout, Icon, Trans, useTranslation } from '@dxos/react-ui';
10
- import { type AnchoredTo } from '@dxos/schema';
11
-
12
- import { meta } from '../meta';
13
- import { type ThreadType } from '../types';
14
-
15
- import { CommentsThreadContainer, type CommentsThreadContainerProps } from './CommentsThreadContainer';
16
-
17
- export type CommentsContainerProps = Omit<CommentsThreadContainerProps, 'anchor' | 'current'> & {
18
- anchors: AnchoredTo[];
19
- currentId?: string;
20
- showResolvedThreads?: boolean;
21
- };
22
-
23
- /**
24
- * Root container for collection of comment threads.
25
- */
26
- export const CommentsContainer = ({ anchors, currentId, showResolvedThreads, ...props }: CommentsContainerProps) => {
27
- const { t } = useTranslation(meta.id);
28
-
29
- // TODO(wittjosiah): There seems to be a race between thread and anchor being deleted.
30
- const filteredAnchors = showResolvedThreads
31
- ? anchors.filter((anchor) => !!Relation.getSource(anchor))
32
- : anchors.filter((anchor) => {
33
- const thread = Relation.getSource(anchor);
34
- return thread && thread.status !== 'resolved';
35
- });
36
-
37
- useEffect(() => {
38
- if (currentId) {
39
- document.getElementById(currentId)?.scrollIntoView({ behavior: 'smooth', block: 'end' });
40
- }
41
- }, [currentId]);
42
-
43
- if (filteredAnchors.length === 0) {
44
- return (
45
- <div role='none' className='plb-cardSpacingBlock pli-cardSpacingInline'>
46
- <Callout.Root>
47
- <Callout.Title>
48
- <Trans
49
- {...{
50
- t,
51
- i18nKey: 'no comments message',
52
- components: {
53
- commentIcon: <Icon icon='ph--chat-text--regular' size={4} classNames='inline-block' />,
54
- },
55
- }}
56
- />
57
- </Callout.Title>
58
- </Callout.Root>
59
- </div>
60
- );
61
- }
62
-
63
- return (
64
- <div>
65
- {filteredAnchors.map((anchor) => {
66
- const thread = Relation.getSource(anchor) as ThreadType;
67
- const threadId = fullyQualifiedId(thread);
68
- return <CommentsThreadContainer key={threadId} anchor={anchor} current={currentId === threadId} {...props} />;
69
- })}
70
- </div>
71
- );
72
- };