@celljs/ta 4.11.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pi/CHANGELOG.md +4 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/extension/index.mjs +194 -17
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +4 -1
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +8 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +70 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.js +176 -18
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +16 -2
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +1 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +7 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +26 -3
- package/dist/pi/packages/ta-agents/lib/extension.js +7 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +12 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +12 -0
- package/dist/pi/packages/ta-agents/package.json +1 -1
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-channels/lib/sidebar.js +31 -13
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +3 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts +12 -0
- package/dist/pi/packages/ta-channels/lib/views.js +19 -0
- package/dist/pi/packages/ta-channels/package.json +1 -1
- package/dist/pi/packages/ta-channels/web/index.js +54 -9
- package/dist/pi/packages/ta-computer-use/package.json +1 -1
- package/dist/pi/packages/ta-cron/package.json +1 -1
- package/dist/pi/packages/ta-extensions/package.json +1 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +1 -0
- package/dist/pi/packages/ta-games/package.json +1 -1
- package/dist/pi/packages/ta-glance/lib/card.js +5 -4
- package/dist/pi/packages/ta-glance/lib/glance-spec.d.ts +2 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +8 -6
- package/dist/pi/packages/ta-glance/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/style.js +178 -101
- package/dist/pi/packages/ta-glance/package.json +1 -1
- package/dist/pi/packages/ta-glance/web/index.js +189 -109
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-manual/lib/pictures-c.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +53 -0
- package/dist/pi/packages/ta-manual/lib/pictures.js +2 -1
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +1 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +35 -1
- package/dist/pi/packages/ta-manual/package.json +1 -1
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +11 -0
- package/dist/pi/packages/ta-manual/web/index.js +186 -1
- package/dist/pi/packages/ta-notify/package.json +1 -1
- package/dist/pi/packages/ta-recall/extension/index.mjs +2 -1
- package/dist/pi/packages/ta-recall/lib/conversations.js +6 -0
- package/dist/pi/packages/ta-recall/lib/extension.js +5 -4
- package/dist/pi/packages/ta-recall/package.json +1 -1
- package/dist/pi/packages/ta-recall/web/index.js +4 -0
- package/dist/pi/packages/ta-rooms/README.en.md +8 -2
- package/dist/pi/packages/ta-rooms/README.md +8 -2
- package/dist/pi/packages/ta-rooms/extension/index.mjs +362 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +966 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.d.ts +25 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.js +128 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.d.ts +114 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.js +645 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +85 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +172 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +165 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +73 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +99 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.js +180 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +45 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +145 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.d.ts +34 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +223 -0
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +176 -0
- package/dist/pi/packages/ta-rooms/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-rooms/lib/host.js +18 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +4 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +8 -0
- package/dist/pi/packages/ta-rooms/lib/index.js +23 -2
- package/dist/pi/packages/ta-rooms/lib/members-view.js +32 -2
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +57 -8
- package/dist/pi/packages/ta-rooms/lib/page.js +121 -27
- package/dist/pi/packages/ta-rooms/lib/room-view.d.ts +2 -4
- package/dist/pi/packages/ta-rooms/lib/room-view.js +52 -34
- package/dist/pi/packages/ta-rooms/lib/rooms-home.d.ts +32 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-home.js +141 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.d.ts +8 -2
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +64 -21
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +96 -45
- package/dist/pi/packages/ta-rooms/package.json +9 -3
- package/dist/pi/packages/ta-rooms/web/index.js +1380 -147
- package/dist/pi/packages/ta-share/lib/shares-page.js +35 -11
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +11 -5
- package/dist/pi/packages/ta-share/package.json +1 -1
- package/dist/pi/packages/ta-share/web/index.js +45 -18
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-D9uU0Tx2.js → abnfDiagram-S7VZAUFO-BnqtcbpZ.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-f7Nm7EIo.js → architecture-WOLXFQ4H-BzPq1Ioe.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-DSAqlcms.js → architectureDiagram-YGSQEFNW-BsquO3a7.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-C0lPIW9g.js → blockDiagram-APKKGZFW-BQNYOEP4.js} +1 -1
- package/dist/public/assets/{browser-WLpgVYno.js → browser-DS711n7Y.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CDcZ7mJq.js → c4Diagram-KJ2TOQU5-D6e79Ycq.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-CXPuyqPL.js → chunk-6MUBBAK2-B-sgaPoU.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-Du6JRX1x.js → chunk-AXFCVDMN-D8pJKIg2.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-D592E55X.js → chunk-BG4553SI-86TL-vCz.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-BW2r2SL4.js → chunk-DQASFODM-CfUVuGjc.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-C3yoe54R.js → chunk-HFQBQIA3-Drm0FEYk.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DF8gfYCy.js → chunk-KQLB2F66-BVFRADlC.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-C8CRMTv1.js → chunk-KS47KZWR-DfyALEmP.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-BDcMKiwj.js → chunk-LEVMRMFU-DtJVzk2c.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-CKJPBygc.js → chunk-M57EVK23-DTy27PHQ.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-B3ZWH07L.js → chunk-OY52VR5R-nSgn7jZg.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-DI-z4UPL.js → chunk-QB3YPZ4I-CkSxO_X6.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-Bg4-haAc.js → chunk-R3KSYZAL-Ck6iAjAL.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-l_SHib3p.js → chunk-STOXU5M4-DQPHdSTh.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-BINu9tIm.js → chunk-TU62E6Q5-Bc2AbV2Y.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-BQn-mvV5.js → chunk-X4PVCEUW-Cgpm0IXm.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-uvpAu0Ys.js → chunk-XXDRQBXY-CGE4eLpg.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-BIowooW1.js → classDiagram-v2-L25IHNXF-4eQuDPEo.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-BTyx1Mh2.js → cose-bilkent-JH36ORCC-tDLCWq07.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dd40W2Jh.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-D64EU9I0.js → cynefinDiagram-L36ESFBY-ByqcZ8x9.js} +1 -1
- package/dist/public/assets/{d3-selection-CN9k6_B9.js → d3-selection-Bgn1374-.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-FCbz2-Kk.js → dagre-SPEB5RXH-mCgr71mV.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-OhHUSI7j.js → diagram-3B7GL73J-DpYSwpQ0.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-Be4xMtp6.js → diagram-DNEMPZML-DMozUQzi.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-CmKSs3aG.js → diagram-L3MUGCDN-Bk5Uf8PD.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-D1C32rMN.js → diagram-LA4NIPWU-DFt5cPVK.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-BjoE6JXs.js → diagram-MHCOC4E2-BkZZcKqK.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-B22k4v8R.js → diagram-XPFHEONP-HEY6kyyN.js} +1 -1
- package/dist/public/assets/{dist-DcBP8Cf6.js → dist-Bj2CrKn7.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-Tn-K8-X7.js → ebnfDiagram-UZSYDL2S-D4JvYyVb.js} +1 -1
- package/dist/public/assets/{editor.api-Bz4sjRz_.js → editor.api-BpJFzYbl.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-COnQsWlN.js → elk-XV6XMXQE-CT6qLJkF.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-c53dJilq.js → erDiagram-EYBAPDEH-BGng1goR.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-DaFpPPks.js → eventmodeling-K75KTNOO-Tt8O-Q1Z.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-uFzenfA3.js +1 -0
- package/dist/public/assets/{freemarker2-BLxfRHsw.js → freemarker2-Dd5ksoRn.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-Md-SavIS.js → ganttDiagram-23REXITY-Jl8VO_g2.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D28I_jUc.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-CMSwTghO.js → gitGraphDiagram-STJD7YCW-Be4qXALb.js} +1 -1
- package/dist/public/assets/{handlebars-sNpu01kP.js → handlebars-4xabgUi4.js} +1 -1
- package/dist/public/assets/{html-C_tKd-uP.js → html-Dk3kt2w_.js} +1 -1
- package/dist/public/assets/{index-Bn86rI4n.js → index-Bx0c7eoh.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-5vIGEIq7.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-CwgNj-7i.js → infoDiagram-KBXO4MBG-Coc0tdwb.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-BSlzQNMN.js → ishikawaDiagram-M35NCXHK-CE_1VQCg.js} +1 -1
- package/dist/public/assets/{javascript-l3qKw0L-.js → javascript-DKLGqy6v.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-B09LPEnF.js → journeyDiagram-OPLOXDXO-CrolRZ_7.js} +1 -1
- package/dist/public/assets/{jsonMode-5SQQn1EX.js → jsonMode-Chcs19_y.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-BiW4aJ29.js → kanban-definition-BZKZHSQY-CjJj47De.js} +1 -1
- package/dist/public/assets/{liquid-BGyTIIUt.js → liquid-jff3p-Ji.js} +1 -1
- package/dist/public/assets/{mdx-8tGjz4em.js → mdx-DW4uRDfJ.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-CctN5b0z.js → mermaid-parser.core-XhQj6FvH.js} +3 -3
- package/dist/public/assets/{mermaid.core-7ERSdZ4-.js → mermaid.core-OD4Atimg.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-D-GOUwW1.js → mindmap-definition-I2QAS2VK-DpGelVY7.js} +1 -1
- package/dist/public/assets/module-CrD0OHQp.js +1 -0
- package/dist/public/assets/module-DEBMgdtf.js +2273 -0
- package/dist/public/assets/{monaco-B_9hlk78.js → monaco-BTVZP-tU.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-CBxQ5Mzy.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-Dmy1fWB3.js → pegDiagram-FD4XPPHP-CqcBmPfB.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-DT5V3581.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-CXFHLYTg.js → pieDiagram-J4AKIIQI-CRir3beB.js} +1 -1
- package/dist/public/assets/{python-e-JK0s5M.js → python-BwW_0207.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-RQvEpGWO.js → quadrantDiagram-XTYBLID2-DIY6gdcf.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-BAOovYEa.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-RZ2Rnwzh.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-CDOSPZwX.js → railroad-abnf-LNEFI6M7-XWNOzunl.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-BTrNQ0DX.js → railroad-ebnf-DWYD2UWJ-CI0-j1Jz.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-B7NtVofS.js → railroad-peg-JR7BVNR7-BVB_IaIG.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-DsDrT0Jf.js → railroadDiagram-MRQ6NCDL-CudwT6q2.js} +1 -1
- package/dist/public/assets/{razor-DtSPwumi.js → razor-DrjCyQqB.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-BQh0hFuA.js → requirementDiagram-Y7LWUY3S-CvRMeRqj.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-BUXNAQEF.js → sankeyDiagram-WGJFYUXA-adxYCJKr.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-05f-N5V_.js → sequenceDiagram-5NDRBG5M-lCRsoLUp.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-D6V1fGWV.js → stateDiagram-v2-FJ4FJNEA-DNst1BLg.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-DWhlPvKs.js → swimlanes-UMQ2AFYF-S_omrdvA.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-By5lnz4u.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-CMdocOui.js → timeline-definition-SEUHKTQE-_pMGrTE-.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-Cyb9N8KY.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BkMo57pG.js +1 -0
- package/dist/public/assets/{typescript-65jNyipU.js → typescript-0-z_OYCU.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-BQTHUX1f.js → usecaseDiagram-AFA6YXN4-B2oJKi5Q.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-BULkVTfA.js → vennDiagram-NNMJR3RB-inPs2Kkr.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-CSt-uQ-Y.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-Cek6l8lz.js → wardleyDiagram-S7YFUSEH-DNhNHM7b.js} +1 -1
- package/dist/public/assets/{xml-DWBejfu-.js → xml-BXPxQzKF.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-ujnZQTWA.js → xychartDiagram-GGNKY7IX-DJc93dNT.js} +1 -1
- package/dist/public/assets/{yaml-CwRCT7q1.js → yaml-CGmD9Rya.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +1222 -727
- package/package.json +31 -31
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dg54eFzZ.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-V5qkYWIO.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-1q8ldRXU.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-Crere6sx.js +0 -1
- package/dist/public/assets/module-DEqsdd00.js +0 -1
- package/dist/public/assets/module-TWc52XwT.js +0 -2244
- package/dist/public/assets/packet-JDAUHWVQ-qMf5LkHT.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-BjqLn4qm.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-DWO6t_4C.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-D1XOJPWy.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CRn5uHsY.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-D09wHNzT.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-ChxAT7Fq.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-DfSjKzbJ.js +0 -1
|
@@ -8,6 +8,8 @@ exports.message = message;
|
|
|
8
8
|
exports.rooms = rooms;
|
|
9
9
|
exports.useBook = useBook;
|
|
10
10
|
exports.useLines = useLines;
|
|
11
|
+
exports.useAgents = useAgents;
|
|
12
|
+
exports.useJoining = useJoining;
|
|
11
13
|
exports.unseen = unseen;
|
|
12
14
|
exports.openRoom = openRoom;
|
|
13
15
|
exports.useOpened = useOpened;
|
|
@@ -18,8 +20,11 @@ exports.when = when;
|
|
|
18
20
|
exports.tint = tint;
|
|
19
21
|
exports.initial = initial;
|
|
20
22
|
exports.Face = Face;
|
|
23
|
+
exports.faceMembers = faceMembers;
|
|
21
24
|
exports.RoomFace = RoomFace;
|
|
25
|
+
exports.MemberFaces = MemberFaces;
|
|
22
26
|
const relay_room_chat_1 = require("@celljs/ta-relay/lib/common/relay-room-chat");
|
|
27
|
+
const double_protocol_1 = require("./double-protocol");
|
|
23
28
|
const i18n_1 = require("./i18n");
|
|
24
29
|
const react_1 = require("./react");
|
|
25
30
|
/** The kind of the rooms made here: a group chat, which this page shows (room-view.tsx). */
|
|
@@ -28,8 +33,8 @@ exports.ROOMS_KIND = 'ta-rooms';
|
|
|
28
33
|
exports.ROOMS_VIEW = '@celljs/ta-rooms/rooms';
|
|
29
34
|
/** The members of the room shown, a tool of the workbench (members-view.tsx). */
|
|
30
35
|
exports.MEMBERS_VIEW = '@celljs/ta-rooms/members';
|
|
31
|
-
/** What the page hears of the state of the rooms without their messages: what is said (chat.ts). */
|
|
32
|
-
exports.CHAT_STATE = ['chat:'];
|
|
36
|
+
/** What the page hears of the state of the rooms without their messages: what is said (chat.ts), the agents invited. */
|
|
37
|
+
exports.CHAT_STATE = ['chat:', double_protocol_1.ROOM_AGENTS_KEY];
|
|
33
38
|
const SEEN_KEY = 'seen';
|
|
34
39
|
function bindPage(api) {
|
|
35
40
|
exports.pi = api;
|
|
@@ -55,6 +60,11 @@ class RoomBook {
|
|
|
55
60
|
this.state = { requests: [], seen: {} };
|
|
56
61
|
this.listeners = new Set();
|
|
57
62
|
this.chats = new Map();
|
|
63
|
+
/** The agents of each room read, by key of its state (RoomAgentsUtil), and listed. */
|
|
64
|
+
this.agentStates = new Map();
|
|
65
|
+
this.agentLists = new Map();
|
|
66
|
+
/** The agents the user invites to each room, till they are in it. */
|
|
67
|
+
this.joiningLists = new Map();
|
|
58
68
|
this.again = false;
|
|
59
69
|
this.seenRead = false;
|
|
60
70
|
}
|
|
@@ -101,6 +111,9 @@ class RoomBook {
|
|
|
101
111
|
for (const chat of this.chats.values()) {
|
|
102
112
|
void chat.load().catch(() => undefined);
|
|
103
113
|
}
|
|
114
|
+
for (const room of this.agentStates.keys()) {
|
|
115
|
+
this.readAgents(room);
|
|
116
|
+
}
|
|
104
117
|
}, 300);
|
|
105
118
|
}
|
|
106
119
|
set(partial) {
|
|
@@ -123,12 +136,58 @@ class RoomBook {
|
|
|
123
136
|
}
|
|
124
137
|
return chat;
|
|
125
138
|
}
|
|
126
|
-
/**
|
|
127
|
-
|
|
139
|
+
/** The agents invited to a room, read the first time it is asked for and kept as its state changes. */
|
|
140
|
+
agents(room) {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!this.agentStates.has(room)) {
|
|
143
|
+
this.agentStates.set(room, {});
|
|
144
|
+
this.readAgents(room);
|
|
145
|
+
}
|
|
146
|
+
return (_a = this.agentLists.get(room)) !== null && _a !== void 0 ? _a : NO_AGENTS;
|
|
147
|
+
}
|
|
148
|
+
/** The agents the user invites to a room, on their way in. */
|
|
149
|
+
joining(room) {
|
|
150
|
+
var _a;
|
|
151
|
+
return (_a = this.joiningLists.get(room)) !== null && _a !== void 0 ? _a : NO_JOINING;
|
|
152
|
+
}
|
|
153
|
+
/** An agent the user invites is on its way into a room (`true`), or no more. */
|
|
154
|
+
setJoining(room, agent, on) {
|
|
155
|
+
const others = this.joining(room).filter(each => each.id !== agent.id);
|
|
156
|
+
this.joiningLists.set(room, on ? [...others, agent] : others);
|
|
157
|
+
this.set({});
|
|
158
|
+
}
|
|
159
|
+
/** The agents of the user in a room, as the server listed them on inviting one: shown before the room says so. */
|
|
160
|
+
putMine(room, member, agents) {
|
|
128
161
|
var _a;
|
|
129
|
-
|
|
130
|
-
|
|
162
|
+
var _b;
|
|
163
|
+
const known = this.agentStates.get(room);
|
|
164
|
+
if (!known) {
|
|
165
|
+
return;
|
|
131
166
|
}
|
|
167
|
+
const key = double_protocol_1.RoomAgentsUtil.key(member);
|
|
168
|
+
this.putAgents(room, { ...known, [key]: { value: agents, by: member, version: (_b = (_a = known[key]) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : 0 } });
|
|
169
|
+
}
|
|
170
|
+
/** What happened in a room: what was said goes to its chat, if it was read; who was invited, to its agents. */
|
|
171
|
+
heard(event) {
|
|
172
|
+
var _a, _b;
|
|
173
|
+
var _c;
|
|
174
|
+
if (event.type !== 'state') {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
(_a = this.chats.get(event.room)) === null || _a === void 0 ? void 0 : _a.heard(event.key, event);
|
|
178
|
+
const known = this.agentStates.get(event.room);
|
|
179
|
+
if (known && event.key.startsWith(double_protocol_1.ROOM_AGENTS_KEY) && ((_c = (_b = known[event.key]) === null || _b === void 0 ? void 0 : _b.version) !== null && _c !== void 0 ? _c : 0) < event.version) {
|
|
180
|
+
this.putAgents(event.room, { ...known, [event.key]: event });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
readAgents(room) {
|
|
184
|
+
var _a;
|
|
185
|
+
void ((_a = rooms()) === null || _a === void 0 ? void 0 : _a.getState(room, double_protocol_1.ROOM_AGENTS_KEY).then(state => this.putAgents(room, state)).catch(() => undefined));
|
|
186
|
+
}
|
|
187
|
+
putAgents(room, state) {
|
|
188
|
+
this.agentStates.set(room, state);
|
|
189
|
+
this.agentLists.set(room, double_protocol_1.RoomAgentsUtil.of(state));
|
|
190
|
+
this.set({});
|
|
132
191
|
}
|
|
133
192
|
/** The user saw what was said in a room till `at`. */
|
|
134
193
|
see(room, at) {
|
|
@@ -179,12 +238,23 @@ function useBook() {
|
|
|
179
238
|
return state;
|
|
180
239
|
}
|
|
181
240
|
const NO_LINES = [];
|
|
241
|
+
const NO_AGENTS = [];
|
|
242
|
+
const NO_JOINING = [];
|
|
182
243
|
const NO_STOP = () => undefined;
|
|
183
244
|
/** What was said in a room, as it changes; nothing for one not joined. */
|
|
184
245
|
function useLines(room) {
|
|
185
246
|
const chat = room.status === 'member' ? exports.book.chat(room.id) : undefined;
|
|
186
247
|
return react_1.React.useSyncExternalStore(listener => { var _a; return (_a = chat === null || chat === void 0 ? void 0 : chat.subscribe(listener)) !== null && _a !== void 0 ? _a : NO_STOP; }, () => { var _a; return (_a = chat === null || chat === void 0 ? void 0 : chat.lines) !== null && _a !== void 0 ? _a : NO_LINES; });
|
|
187
248
|
}
|
|
249
|
+
/** The agents invited to a room, as they come and go; none for one not joined. */
|
|
250
|
+
function useAgents(room) {
|
|
251
|
+
const member = room.status === 'member';
|
|
252
|
+
return react_1.React.useSyncExternalStore(listener => exports.book.subscribe(listener), () => (member ? exports.book.agents(room.id) : NO_AGENTS));
|
|
253
|
+
}
|
|
254
|
+
/** The agents the user invites to a room, till they said hello there. */
|
|
255
|
+
function useJoining(room) {
|
|
256
|
+
return react_1.React.useSyncExternalStore(listener => exports.book.subscribe(listener), () => exports.book.joining(room.id));
|
|
257
|
+
}
|
|
188
258
|
/** Said in a room by others since the user saw it last (or joined). */
|
|
189
259
|
function unseen(room, lines, seen) {
|
|
190
260
|
var _a;
|
|
@@ -194,9 +264,12 @@ function unseen(room, lines, seen) {
|
|
|
194
264
|
const last = lines[lines.length - 1];
|
|
195
265
|
return !!last && last.at > since && last.from !== self;
|
|
196
266
|
}
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Shows a room: its chat, over the list on a phone, beside it elsewhere; `direct` from elsewhere than the list, on a phone
|
|
269
|
+
* without the list under it, so that back goes where the user came from.
|
|
270
|
+
*/
|
|
271
|
+
function openRoom(id, direct = false) {
|
|
272
|
+
exports.book.set({ opened: id, direct });
|
|
200
273
|
void exports.pi.ui.showView(exports.ROOMS_VIEW);
|
|
201
274
|
}
|
|
202
275
|
/** The room shown, while it is one the user is in. */
|
|
@@ -272,35 +345,56 @@ function initial(name) {
|
|
|
272
345
|
var _b;
|
|
273
346
|
return (_b = (_a = Array.from(name.trim())[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : '?';
|
|
274
347
|
}
|
|
275
|
-
/** A
|
|
276
|
-
function Face({ id, name, size = 34, online }) {
|
|
348
|
+
/** A face of one of the rooms, as the agents of channels have (`ui.Face`); a letter in a circle in an app of before. */
|
|
349
|
+
function Face({ id, name, size = 34, online, face }) {
|
|
350
|
+
if (exports.pi.ui.Face) {
|
|
351
|
+
return react_1.React.createElement(exports.pi.ui.Face, { seed: id, face: face, size: size, online: online });
|
|
352
|
+
}
|
|
277
353
|
const n = tint(id);
|
|
278
354
|
return (react_1.React.createElement("span", { className: "trm-face", "aria-hidden": "true", style: { width: size, height: size, fontSize: Math.round(size * 0.42), background: `var(--ta-tint-${n})`, color: `var(--ta-tint-ink-${n})` } },
|
|
279
355
|
initial(name),
|
|
280
356
|
online !== undefined && react_1.React.createElement("i", { className: online ? 'trm-on' : 'trm-off' })));
|
|
281
357
|
}
|
|
282
358
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
359
|
+
* Those a room is drawn by, as a channel by its members: the others first, its owner in front, then the agents in it, then
|
|
360
|
+
* the user, so that a room of two (the user and an agent) shows both; the user alone in a room of its own.
|
|
361
|
+
*/
|
|
362
|
+
function faceMembers(room, agents = []) {
|
|
363
|
+
const others = room.members.filter(member => !member.self).sort((a, b) => Number(b.owner) - Number(a.owner));
|
|
364
|
+
const all = [...others, ...agents, ...room.members.filter(member => member.self)];
|
|
365
|
+
return all.length ? all : [{ id: room.owner ? room.id : room.ownerName || room.id, name: room.ownerName || room.title }];
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* The face of a room, as a channel is drawn (`ui.GroupFace`): two of those in it, one in front of the other; the icon
|
|
369
|
+
* of the page of its game at a corner; an amber dot for what the user has not read.
|
|
285
370
|
*/
|
|
286
|
-
function RoomFace({ room, size =
|
|
371
|
+
function RoomFace({ room, size = 40, unread }) {
|
|
372
|
+
var _a, _b, _c;
|
|
373
|
+
var _d, _e;
|
|
287
374
|
const page = usePageOf(room);
|
|
288
|
-
const members = room.members.length ? room.members.slice(0, 4) : [{ member: room.id, id: room.id, name: room.title }];
|
|
289
375
|
const Mark = page === null || page === void 0 ? void 0 : page.icon;
|
|
290
|
-
const
|
|
291
|
-
return (react_1.React.createElement("span", { className: "trm-room-face",
|
|
292
|
-
members.map(member => {
|
|
293
|
-
const n = tint(member.id);
|
|
294
|
-
return (react_1.React.createElement("span", { key: member.member, className: "trm-room-face-cell", style: {
|
|
295
|
-
width: cell,
|
|
296
|
-
height: cell,
|
|
297
|
-
fontSize: Math.round(cell * 0.5),
|
|
298
|
-
background: `var(--ta-tint-${n})`,
|
|
299
|
-
color: `var(--ta-tint-ink-${n})`,
|
|
300
|
-
} }, initial(member.name)));
|
|
301
|
-
}),
|
|
376
|
+
const members = faceMembers(room, useAgents(room));
|
|
377
|
+
return (react_1.React.createElement("span", { className: "trm-room-face", style: { width: size, height: size }, "aria-hidden": "true" },
|
|
378
|
+
exports.pi.ui.GroupFace ? (react_1.React.createElement(exports.pi.ui.GroupFace, { members: members.map(member => ({ seed: member.id, face: member.face })), size: size })) : (react_1.React.createElement(Face, { id: (_d = (_a = members[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _d !== void 0 ? _d : room.id, name: (_e = (_b = members[0]) === null || _b === void 0 ? void 0 : _b.name) !== null && _e !== void 0 ? _e : room.title, face: (_c = members[0]) === null || _c === void 0 ? void 0 : _c.face, size: size })),
|
|
302
379
|
Mark && (react_1.React.createElement("span", { className: "trm-room-face-mark" },
|
|
303
380
|
react_1.React.createElement(Mark, { size: 11, strokeWidth: 2.4 }))),
|
|
304
381
|
unread && react_1.React.createElement("i", { className: "trm-unread" })));
|
|
305
382
|
}
|
|
383
|
+
/** The faces of those in a room, up to five, as the head of a channel shows them; the button shows its members. */
|
|
384
|
+
function MemberFaces({ room, onClick, shown }) {
|
|
385
|
+
const agents = useAgents(room);
|
|
386
|
+
// The people, its owner first, then the agents in it: all who speak there.
|
|
387
|
+
const members = [
|
|
388
|
+
...[...room.members]
|
|
389
|
+
.sort((a, b) => Number(b.owner) - Number(a.owner))
|
|
390
|
+
.map(member => ({ key: member.member, id: member.id, name: member.name, face: undefined })),
|
|
391
|
+
...agents.map(agent => ({ key: `${agent.member}/${agent.id}`, id: agent.id, name: agent.name, face: agent.face })),
|
|
392
|
+
];
|
|
393
|
+
return (react_1.React.createElement("button", { type: "button", className: `trm-faces${shown ? ' trm-on-icon' : ''}`, title: t('members'), "aria-label": t('members'), "aria-pressed": shown, onClick: onClick },
|
|
394
|
+
members.slice(0, 5).map(member => (react_1.React.createElement("span", { key: member.key, className: "trm-faces-one" },
|
|
395
|
+
react_1.React.createElement(Face, { id: member.id, name: member.name, face: member.face, size: 24 })))),
|
|
396
|
+
members.length > 5 && react_1.React.createElement("span", { className: "trm-faces-more" },
|
|
397
|
+
"+",
|
|
398
|
+
members.length - 5)));
|
|
399
|
+
}
|
|
306
400
|
//# sourceMappingURL=page.js.map
|
|
@@ -2,10 +2,8 @@ import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
|
2
2
|
export declare function confirmThen(title: string, hint: string, label: string, action: () => Promise<unknown>): Promise<boolean>;
|
|
3
3
|
/** Leaves a room (its owner closes it), asking first; one asked to join, refused or gone is only forgotten. */
|
|
4
4
|
export declare function leaveRoom(room: TaRoomInfo): Promise<boolean>;
|
|
5
|
-
/** The
|
|
6
|
-
export declare function
|
|
7
|
-
/** The title of a room, its members counted, as a messenger titles a group. */
|
|
8
|
-
export declare function RoomTitle({ room }: {
|
|
5
|
+
/** The head of a room, as that of a channel: its name, how many are in it and online, their faces to show them. */
|
|
6
|
+
export declare function RoomHead({ room }: {
|
|
9
7
|
room: TaRoomInfo;
|
|
10
8
|
}): import("react").JSX.Element;
|
|
11
9
|
/** A room, as a group chat: those in it on the left, the user on the right, the box under them. */
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.confirmThen = confirmThen;
|
|
4
4
|
exports.leaveRoom = leaveRoom;
|
|
5
|
-
exports.
|
|
6
|
-
exports.RoomTitle = RoomTitle;
|
|
5
|
+
exports.RoomHead = RoomHead;
|
|
7
6
|
exports.RoomView = RoomView;
|
|
7
|
+
const agents_view_1 = require("./agents-view");
|
|
8
|
+
const double_i18n_1 = require("./double-i18n");
|
|
9
|
+
const doubles_store_1 = require("./doubles-store");
|
|
8
10
|
const page_1 = require("./page");
|
|
9
11
|
const react_1 = require("./react");
|
|
10
12
|
/** A new run after this long without a word of the same member; a line with the time after a longer pause. */
|
|
@@ -32,6 +34,12 @@ function leaveRoom(room) {
|
|
|
32
34
|
}
|
|
33
35
|
return confirmThen(room.owner ? (0, page_1.t)('closeTitle', { title: room.title }) : (0, page_1.t)('leaveTitle', { title: room.title }), room.owner ? (0, page_1.t)('closeHint') : (0, page_1.t)('leaveHint'), room.owner ? (0, page_1.t)('close') : (0, page_1.t)('leave'), async () => { var _a; return (_a = (0, page_1.rooms)()) === null || _a === void 0 ? void 0 : _a.leave(room.id); });
|
|
34
36
|
}
|
|
37
|
+
/** Who says a line, for its runs: a person, their double and each of their agents are each their own. */
|
|
38
|
+
function speaker(line) {
|
|
39
|
+
var _a;
|
|
40
|
+
var _b;
|
|
41
|
+
return `${line.from}:${line.double ? 'd' : ''}:${(_b = (_a = line.agent) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''}`;
|
|
42
|
+
}
|
|
35
43
|
/** The time of a line: when today, else the day too. */
|
|
36
44
|
function time(at) {
|
|
37
45
|
const date = new Date(at);
|
|
@@ -40,25 +48,18 @@ function time(at) {
|
|
|
40
48
|
? clock
|
|
41
49
|
: `${date.toLocaleDateString(page_1.pi.ui.language, { month: 'numeric', day: 'numeric' })} ${clock}`;
|
|
42
50
|
}
|
|
43
|
-
/** The
|
|
44
|
-
function
|
|
51
|
+
/** The head of a room, as that of a channel: its name, how many are in it and online, their faces to show them. */
|
|
52
|
+
function RoomHead({ room }) {
|
|
45
53
|
var _a, _b, _c;
|
|
46
54
|
const shown = !!((_c = (_b = (_a = page_1.pi.ui).useView) === null || _b === void 0 ? void 0 : _b.call(_a, page_1.MEMBERS_VIEW)) === null || _c === void 0 ? void 0 : _c.shown);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
react_1.React.createElement("span", { className: "trm-room-title-text" },
|
|
56
|
-
react_1.React.createElement("span", { className: "trm-ellipsis" }, room.title),
|
|
57
|
-
react_1.React.createElement("span", { className: "trm-room-count" },
|
|
58
|
-
"(",
|
|
59
|
-
room.members.length,
|
|
60
|
-
")")),
|
|
61
|
-
react_1.React.createElement("span", { className: `trm-room-sub${room.connected ? '' : ' trm-quiet'}` }, !room.connected ? (0, page_1.t)('connecting') : online ? (0, page_1.t)('othersOnline', { n: online }) : (0, page_1.t)('nobodyOnline'))));
|
|
55
|
+
const page = (0, page_1.usePageOf)(room);
|
|
56
|
+
const online = room.members.filter(member => member.online).length;
|
|
57
|
+
return (react_1.React.createElement("div", { className: "trm-room-head" },
|
|
58
|
+
react_1.React.createElement("span", { className: "trm-room-head-title" },
|
|
59
|
+
react_1.React.createElement("strong", { className: "trm-ellipsis" }, room.title),
|
|
60
|
+
react_1.React.createElement("span", { className: "trm-room-head-count" }, (0, page_1.t)('memberCount', { n: room.members.length })),
|
|
61
|
+
react_1.React.createElement("span", { className: `trm-room-head-sub${room.connected ? '' : ' trm-quiet'}` }, !room.connected ? (0, page_1.t)('connecting') : page ? page.title : (0, page_1.t)('onlineCount', { n: online }))),
|
|
62
|
+
react_1.React.createElement(page_1.MemberFaces, { room: room, shown: shown, onClick: () => void page_1.pi.ui.showView(page_1.MEMBERS_VIEW) })));
|
|
62
63
|
}
|
|
63
64
|
/** A room an extension made: its page, a line above the chat that opens it (the Town). */
|
|
64
65
|
function PageLine({ room }) {
|
|
@@ -83,16 +84,22 @@ function RoomView({ room, head, onBack }) {
|
|
|
83
84
|
const Back = (0, page_1.icon)('ArrowLeft');
|
|
84
85
|
const chat = page_1.book.chat(room.id);
|
|
85
86
|
const lines = (0, page_1.useLines)(room);
|
|
87
|
+
const agents = (0, page_1.useAgents)(room);
|
|
88
|
+
const joining = (0, page_1.useJoining)(room);
|
|
86
89
|
const list = react_1.React.useRef(null);
|
|
87
90
|
const stuck = react_1.React.useRef(true);
|
|
88
91
|
const self = room.members.find(member => member.self);
|
|
89
|
-
const
|
|
92
|
+
const personOf = (line) => { var _a; var _b; return (_b = (_a = room.members.find(member => member.member === line.from)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : line.name; };
|
|
93
|
+
// What a double says is its own, beside the person's: on the left, with their face and `X's double`, the user's too; an agent's with its name.
|
|
94
|
+
const nameOf = (line) => line.agent ? line.agent.name : !line.double ? personOf(line) : line.from === (self === null || self === void 0 ? void 0 : self.member) ? (0, double_i18n_1.dt)('myDouble') : (0, double_i18n_1.dt)('doubleOf', { name: personOf(line) });
|
|
95
|
+
const tagOf = (line) => (line.agent ? (0, agents_view_1.agentOwner)(room, { member: line.from }) : line.double ? (0, double_i18n_1.dt)('doubleTag') : '');
|
|
96
|
+
const mentions = react_1.React.useMemo(() => [...(0, agents_view_1.agentMentions)(room, agents), ...(0, doubles_store_1.askable)(room).map(member => ({ name: (0, doubles_store_1.mentionName)(member.name), detail: (0, double_i18n_1.dt)('mentionDetail') }))], [room, agents]);
|
|
90
97
|
react_1.React.useLayoutEffect(() => {
|
|
91
98
|
const element = list.current;
|
|
92
99
|
if (element && stuck.current) {
|
|
93
100
|
element.scrollTop = element.scrollHeight;
|
|
94
101
|
}
|
|
95
|
-
}, [lines]);
|
|
102
|
+
}, [lines, joining]);
|
|
96
103
|
react_1.React.useEffect(() => {
|
|
97
104
|
var _a;
|
|
98
105
|
if (page_1.pi.ui.Stack) {
|
|
@@ -112,39 +119,50 @@ function RoomView({ room, head, onBack }) {
|
|
|
112
119
|
throw new Error((0, page_1.t)('connecting'));
|
|
113
120
|
}
|
|
114
121
|
stuck.current = true;
|
|
115
|
-
|
|
122
|
+
const to = (0, doubles_store_1.addressed)(text, room, agents);
|
|
123
|
+
await chat.say(text, self, to.length ? { to } : {});
|
|
116
124
|
};
|
|
117
125
|
return (react_1.React.createElement("div", { className: "trm-room-page" },
|
|
118
|
-
head && (react_1.React.createElement("div", { className: "trm-room-
|
|
126
|
+
head && (react_1.React.createElement("div", { className: "trm-room-bar" },
|
|
119
127
|
onBack && (react_1.React.createElement("button", { type: "button", className: "trm-icon", title: (0, page_1.t)('back'), "aria-label": (0, page_1.t)('back'), onClick: onBack },
|
|
120
128
|
react_1.React.createElement(Back, { size: 18 }))),
|
|
121
|
-
react_1.React.createElement(
|
|
122
|
-
react_1.React.createElement(MembersButton, null))),
|
|
129
|
+
react_1.React.createElement(RoomHead, { room: room }))),
|
|
123
130
|
react_1.React.createElement(PageLine, { room: room }),
|
|
124
131
|
react_1.React.createElement("div", { className: "trm-chat ta-conversation", ref: list, onScroll: event => {
|
|
125
132
|
const element = event.currentTarget;
|
|
126
133
|
stuck.current = element.scrollHeight - element.scrollTop - element.clientHeight < 48;
|
|
127
134
|
} },
|
|
128
135
|
react_1.React.createElement("div", { className: "trm-chat-col" },
|
|
129
|
-
lines.length === 0 && react_1.React.createElement("div", { className: "trm-chat-empty" },
|
|
136
|
+
lines.length === 0 && (react_1.React.createElement("div", { className: "trm-chat-empty" },
|
|
137
|
+
react_1.React.createElement(page_1.RoomFace, { room: room, size: 56 }),
|
|
138
|
+
react_1.React.createElement("strong", null, room.title),
|
|
139
|
+
react_1.React.createElement("span", null, room.owner ? (0, page_1.t)('ownRoom') : (0, page_1.t)('roomOf', { name: room.ownerName })),
|
|
140
|
+
react_1.React.createElement("span", { className: "trm-chat-hint" }, (0, page_1.t)('chatEmpty')),
|
|
141
|
+
agents.length === 0 && joining.length === 0 && room.members.length < 2 && (react_1.React.createElement("button", { type: "button", className: "ta-button trm-try-alone", onClick: () => (0, agents_view_1.openAgentPicker)(room) }, (0, double_i18n_1.dt)('inviteAgent'))))),
|
|
130
142
|
lines.map((line, index) => {
|
|
131
|
-
var _a;
|
|
143
|
+
var _a, _b;
|
|
144
|
+
var _c, _d;
|
|
132
145
|
const before = lines[index - 1];
|
|
133
146
|
const separator = !before || line.at - before.at > PAUSE_MS;
|
|
134
|
-
const first = separator || before
|
|
147
|
+
const first = separator || speaker(before) !== speaker(line) || line.at - before.at > RUN_MS;
|
|
135
148
|
const other = room.members.find(member => member.member === line.from);
|
|
136
149
|
return (react_1.React.createElement(react_1.React.Fragment, { key: line.id },
|
|
137
150
|
separator && react_1.React.createElement("div", { className: "trm-chat-time" }, time(line.at)),
|
|
138
|
-
line.from === (self === null || self === void 0 ? void 0 : self.member) ? (react_1.React.createElement("div", { className: "ta-message ta-user trm-mine", title: time(line.at) },
|
|
151
|
+
line.from === (self === null || self === void 0 ? void 0 : self.member) && !line.double && !line.agent ? (react_1.React.createElement("div", { className: "ta-message ta-user trm-mine", title: time(line.at) },
|
|
139
152
|
react_1.React.createElement("div", { className: "ta-bubble" },
|
|
140
|
-
react_1.React.createElement(page_1.pi.ui.Markdown, { text: line.text })))) : (react_1.React.createElement("div", { className: `trm-msg${first ? ' trm-first' : ''}` },
|
|
141
|
-
react_1.React.createElement("div", { className: "trm-msg-face" }, first && react_1.React.createElement(page_1.Face, { id: (_a = other === null || other === void 0 ? void 0 : other.id) !== null &&
|
|
153
|
+
react_1.React.createElement(page_1.pi.ui.Markdown, { text: line.text })))) : (react_1.React.createElement("div", { className: `trm-msg${first ? ' trm-first' : ''}${line.double ? ' trm-double' : ''}${line.agent ? ' trm-agent' : ''}` },
|
|
154
|
+
react_1.React.createElement("div", { className: "trm-msg-face" }, first && (react_1.React.createElement(page_1.Face, { id: (_d = (_c = (_a = line.agent) === null || _a === void 0 ? void 0 : _a.id) !== null && _c !== void 0 ? _c : other === null || other === void 0 ? void 0 : other.id) !== null && _d !== void 0 ? _d : line.from, name: nameOf(line), face: line.agent && ((_b = agents.find(agent => { var _a; return agent.id === ((_a = line.agent) === null || _a === void 0 ? void 0 : _a.id) && agent.member === line.from; })) === null || _b === void 0 ? void 0 : _b.face), size: 28 }))),
|
|
142
155
|
react_1.React.createElement("div", { className: "trm-msg-col" },
|
|
143
|
-
first && react_1.React.createElement("div", { className: "trm-msg-name" },
|
|
156
|
+
first && (react_1.React.createElement("div", { className: "trm-msg-name" },
|
|
157
|
+
nameOf(line),
|
|
158
|
+
tagOf(line) && (react_1.React.createElement("span", { className: `trm-tag ${line.agent ? 'trm-tag-agent' : 'trm-tag-double'}` }, tagOf(line))))),
|
|
144
159
|
react_1.React.createElement("div", { className: "trm-msg-bubble", title: time(line.at) },
|
|
145
160
|
react_1.React.createElement(page_1.pi.ui.Markdown, { text: line.text })))))));
|
|
146
|
-
})
|
|
161
|
+
}),
|
|
162
|
+
joining.map(agent => (react_1.React.createElement("div", { key: agent.id, className: "trm-chat-joining", role: "status" },
|
|
163
|
+
react_1.React.createElement("span", { className: "ta-spinner" }),
|
|
164
|
+
(0, double_i18n_1.dt)('joiningRoom', { name: agent.name })))))),
|
|
147
165
|
react_1.React.createElement("div", { className: "trm-chat-bottom" },
|
|
148
|
-
react_1.React.createElement(page_1.pi.ui.Composer, { placeholder: (0, page_1.t)('chatPlaceholder'), onSend: say }))));
|
|
166
|
+
react_1.React.createElement(page_1.pi.ui.Composer, { placeholder: (0, page_1.t)('chatPlaceholder'), onSend: say, mentions: mentions, mentionLabel: (0, double_i18n_1.dt)('mentionLabel') }))));
|
|
149
167
|
}
|
|
150
168
|
//# sourceMappingURL=room-view.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { RelayRoomChat } from '@celljs/ta-relay/lib/common/relay-room-chat';
|
|
3
|
+
import type { WebHomeItem, WebHomeSource, WebSettingsSection } from '@celljs/ta-web/lib/browser/extension/web-extension-api';
|
|
4
|
+
/** Whether the rooms show on the double's home, the same on every device (pi.storage); on unless the user turned it off. */
|
|
5
|
+
export declare const HOME_KEY = "home.rooms";
|
|
6
|
+
/**
|
|
7
|
+
* The rooms the user is in as a section of the double's home (WebHomeItem.section), the latest said in first, as the
|
|
8
|
+
* Rooms page lists them: what was said last, an amber dot for what the user has not read. None when they are in no
|
|
9
|
+
* room, or turned it off ({@link HOME_KEY}).
|
|
10
|
+
*/
|
|
11
|
+
export declare class RoomsHome implements WebHomeSource {
|
|
12
|
+
protected current: readonly WebHomeItem[];
|
|
13
|
+
protected signature: string;
|
|
14
|
+
protected shown: boolean;
|
|
15
|
+
protected readonly listeners: Set<() => void>;
|
|
16
|
+
protected readonly chats: Map<string, () => void>;
|
|
17
|
+
protected readonly faces: Map<string, import("react").ComponentType<{
|
|
18
|
+
size: number;
|
|
19
|
+
}>>;
|
|
20
|
+
readonly items: () => readonly WebHomeItem[];
|
|
21
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
22
|
+
start(): () => void;
|
|
23
|
+
protected readShown(): void;
|
|
24
|
+
/** Builds the rows again, and says so only when what they show changed. */
|
|
25
|
+
protected refresh(): void;
|
|
26
|
+
protected item(room: TaRoomInfo, lines: RelayRoomChat['lines'], fresh: boolean): WebHomeItem;
|
|
27
|
+
/** What is said in each room the rows show, as it comes. */
|
|
28
|
+
protected follow(joined: readonly TaRoomInfo[]): void;
|
|
29
|
+
}
|
|
30
|
+
/** Rooms, in the settings: whether they show on the double's home. */
|
|
31
|
+
export declare function roomsSettings(): WebSettingsSection;
|
|
32
|
+
//# sourceMappingURL=rooms-home.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoomsHome = exports.HOME_KEY = void 0;
|
|
4
|
+
exports.roomsSettings = roomsSettings;
|
|
5
|
+
const page_1 = require("./page");
|
|
6
|
+
const react_1 = require("./react");
|
|
7
|
+
const rooms_page_1 = require("./rooms-page");
|
|
8
|
+
/** Whether the rooms show on the double's home, the same on every device (pi.storage); on unless the user turned it off. */
|
|
9
|
+
exports.HOME_KEY = 'home.rooms';
|
|
10
|
+
/** The face of a room on the double's home: the room as the book has it now. */
|
|
11
|
+
function homeFace(id) {
|
|
12
|
+
return function HomeFace({ size }) {
|
|
13
|
+
const room = react_1.React.useSyncExternalStore(listener => page_1.book.subscribe(listener), () => { var _a; return (_a = page_1.book.get().rooms) === null || _a === void 0 ? void 0 : _a.find(each => each.id === id); });
|
|
14
|
+
return room ? react_1.React.createElement(page_1.RoomFace, { room: room, size: size }) : null;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The rooms the user is in as a section of the double's home (WebHomeItem.section), the latest said in first, as the
|
|
19
|
+
* Rooms page lists them: what was said last, an amber dot for what the user has not read. None when they are in no
|
|
20
|
+
* room, or turned it off ({@link HOME_KEY}).
|
|
21
|
+
*/
|
|
22
|
+
class RoomsHome {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.current = [];
|
|
25
|
+
this.signature = '';
|
|
26
|
+
this.shown = true;
|
|
27
|
+
this.listeners = new Set();
|
|
28
|
+
this.chats = new Map();
|
|
29
|
+
this.faces = new Map();
|
|
30
|
+
this.items = () => this.current;
|
|
31
|
+
this.subscribe = (listener) => {
|
|
32
|
+
this.listeners.add(listener);
|
|
33
|
+
return () => this.listeners.delete(listener);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
start() {
|
|
37
|
+
const stopBook = page_1.book.subscribe(() => this.refresh());
|
|
38
|
+
const stopStorage = page_1.pi.storage.onChange(keys => keys.includes(exports.HOME_KEY) && this.readShown());
|
|
39
|
+
this.readShown();
|
|
40
|
+
this.refresh();
|
|
41
|
+
return () => {
|
|
42
|
+
stopBook();
|
|
43
|
+
stopStorage();
|
|
44
|
+
for (const stop of this.chats.values()) {
|
|
45
|
+
stop();
|
|
46
|
+
}
|
|
47
|
+
this.chats.clear();
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
readShown() {
|
|
51
|
+
void page_1.pi.storage.get(exports.HOME_KEY).then(value => {
|
|
52
|
+
this.shown = value !== false;
|
|
53
|
+
this.refresh();
|
|
54
|
+
}, () => undefined);
|
|
55
|
+
}
|
|
56
|
+
/** Builds the rows again, and says so only when what they show changed. */
|
|
57
|
+
refresh() {
|
|
58
|
+
const { rooms = [], seen } = page_1.book.get();
|
|
59
|
+
const joined = this.shown ? rooms.filter(room => room.status === 'member') : [];
|
|
60
|
+
this.follow(joined);
|
|
61
|
+
const rows = joined.map(room => { var _a; var _b; return ({ room, lines: (_b = (_a = page_1.book.chat(room.id)) === null || _a === void 0 ? void 0 : _a.lines) !== null && _b !== void 0 ? _b : [] }); }).sort((a, b) => (0, rooms_page_1.lastAt)(b.room) - (0, rooms_page_1.lastAt)(a.room));
|
|
62
|
+
const signature = rows
|
|
63
|
+
.map(({ room, lines }) => { var _a; var _b; return [room.id, room.title, (_b = (_a = lines.at(-1)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '', (0, page_1.unseen)(room, lines, seen) ? 1 : 0, room.connected ? 1 : 0, room.members.length].join(':'); })
|
|
64
|
+
.join('|');
|
|
65
|
+
if (signature === this.signature) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.signature = signature;
|
|
69
|
+
this.current = rows.map(({ room, lines }) => this.item(room, lines, (0, page_1.unseen)(room, lines, seen)));
|
|
70
|
+
for (const listener of this.listeners) {
|
|
71
|
+
listener();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
item(room, lines, fresh) {
|
|
75
|
+
let face = this.faces.get(room.id);
|
|
76
|
+
if (!face) {
|
|
77
|
+
face = homeFace(room.id);
|
|
78
|
+
this.faces.set(room.id, face);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
id: room.id,
|
|
82
|
+
title: room.title,
|
|
83
|
+
detail: (0, rooms_page_1.roomPreview)(room, lines.at(-1)),
|
|
84
|
+
icon: (0, page_1.icon)('Users'),
|
|
85
|
+
face,
|
|
86
|
+
section: (0, page_1.t)('roomsTitle'),
|
|
87
|
+
at: (0, rooms_page_1.lastAt)(room),
|
|
88
|
+
unseen: fresh,
|
|
89
|
+
open: () => (0, page_1.openRoom)(room.id, true),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** What is said in each room the rows show, as it comes. */
|
|
93
|
+
follow(joined) {
|
|
94
|
+
var _a;
|
|
95
|
+
const ids = new Set(joined.map(room => room.id));
|
|
96
|
+
for (const [id, stop] of this.chats) {
|
|
97
|
+
if (!ids.has(id)) {
|
|
98
|
+
stop();
|
|
99
|
+
this.chats.delete(id);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const room of joined) {
|
|
103
|
+
if (!this.chats.has(room.id)) {
|
|
104
|
+
const stop = (_a = page_1.book.chat(room.id)) === null || _a === void 0 ? void 0 : _a.subscribe(() => this.refresh());
|
|
105
|
+
this.chats.set(room.id, stop !== null && stop !== void 0 ? stop : (() => undefined));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.RoomsHome = RoomsHome;
|
|
111
|
+
function HomeSwitch() {
|
|
112
|
+
const [on, setOn] = react_1.React.useState(true);
|
|
113
|
+
react_1.React.useEffect(() => {
|
|
114
|
+
let live = true;
|
|
115
|
+
const read = () => void page_1.pi.storage.get(exports.HOME_KEY).then(value => live && setOn(value !== false), () => undefined);
|
|
116
|
+
read();
|
|
117
|
+
const stop = page_1.pi.storage.onChange(keys => keys.includes(exports.HOME_KEY) && read());
|
|
118
|
+
return () => {
|
|
119
|
+
live = false;
|
|
120
|
+
stop();
|
|
121
|
+
};
|
|
122
|
+
}, []);
|
|
123
|
+
const change = (next) => {
|
|
124
|
+
setOn(next);
|
|
125
|
+
return page_1.pi.storage.set(exports.HOME_KEY, next).catch(error => {
|
|
126
|
+
setOn(!next);
|
|
127
|
+
page_1.pi.ui.notify(error instanceof Error ? error.message : String(error), 'error');
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const Switch = page_1.pi.ui.Switch;
|
|
131
|
+
return Switch ? (react_1.React.createElement(Switch, { checked: on, label: (0, page_1.t)('showOnHome'), onChange: change })) : (react_1.React.createElement("input", { type: "checkbox", role: "switch", className: "ta-switch", checked: on, "aria-checked": on, "aria-label": (0, page_1.t)('showOnHome'), onChange: event => void change(event.target.checked) }));
|
|
132
|
+
}
|
|
133
|
+
/** Rooms, in the settings: whether they show on the double's home. */
|
|
134
|
+
function roomsSettings() {
|
|
135
|
+
return {
|
|
136
|
+
title: () => (0, page_1.t)('roomsTitle'),
|
|
137
|
+
icon: (0, page_1.icon)('Users'),
|
|
138
|
+
rows: [{ key: 'home', label: () => (0, page_1.t)('showOnHome'), description: () => (0, page_1.t)('showOnHomeHint'), render: HomeSwitch }],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=rooms-home.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { RelayChatLine as ChatLine } from '@celljs/ta-relay/lib/common/relay-room-chat';
|
|
3
|
+
/** What a row of a room says under its title: what was said last and by whom, else how the room is. */
|
|
4
|
+
export declare function roomPreview(room: TaRoomInfo, last: ChatLine | undefined): string;
|
|
5
|
+
export declare function lastAt(room: TaRoomInfo): number;
|
|
1
6
|
/**
|
|
2
|
-
* The head of the page
|
|
3
|
-
* and the
|
|
7
|
+
* The head of the page, as the sidebar and the head of a channel side by side: on a computer, the title and the + over
|
|
8
|
+
* the list and the head of the room shown beside them; on a phone the title and the +, or, while a room is pushed over
|
|
9
|
+
* the list, that room's head (the head of the page then goes back, ui.Stack).
|
|
4
10
|
*/
|
|
5
11
|
export declare function RoomsHead(): import("react").JSX.Element;
|
|
6
12
|
/** Rooms, under Discover: the list and a room beside it, or on a phone the list and the room pushed over it. */
|