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