@nextclaw/ui 0.25.4 → 0.26.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/CHANGELOG.md +33 -0
- package/dist/.vite/manifest.json +1146 -1390
- package/dist/assets/{abnfDiagram-VRR7QNED-DX_u5BBX.js → abnfDiagram-VRR7QNED-Bjrmb5-o.js} +1 -1
- package/dist/assets/account-panel-C1S3xtUB.js +1 -0
- package/dist/assets/{aiden0z-pptx-renderer.es-C-E9e5yB.js → aiden0z-pptx-renderer.es-DO4DCX3e.js} +1 -1
- package/dist/assets/api-D9e9cHtW.js +20 -0
- package/dist/assets/app-presenter-provider-J9IgTbc9.js +124 -0
- package/dist/assets/appearance-settings-page-BljTr6nB.js +1 -0
- package/dist/assets/{arc-Cxwa624o.js → arc-g4XaP3S4.js} +1 -1
- package/dist/assets/architecture-TIHT7OUA-BWywYH_m.js +1 -0
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-D8mCj0H1.js → architectureDiagram-ZJ3FMSHR-CAP7YDux.js} +1 -1
- package/dist/assets/{blockDiagram-677ZJIJ3-CbGC1IHl.js → blockDiagram-677ZJIJ3-DhaP0zUG.js} +1 -1
- package/dist/assets/{book-open-xqEj1OLE.js → book-open-vxpV2eSM.js} +1 -1
- package/dist/assets/{c4Diagram-LMCZKHZV-BQhGC1Vc.js → c4Diagram-LMCZKHZV-DHCQJJkD.js} +1 -1
- package/dist/assets/card-D9NYhSdf.js +1 -0
- package/dist/assets/channel-1nKIAEXr.js +1 -0
- package/dist/assets/channels-list-page-BiHA1zZd.js +8 -0
- package/dist/assets/chunk-2Q5K7J3B-CAwv72v4.js +1 -0
- package/dist/assets/{chunk-32BRIVSS-B74ZZwYG.js → chunk-32BRIVSS-BcQlxl4v.js} +1 -1
- package/dist/assets/{chunk-52WLFC77-BvmxW_f_.js → chunk-52WLFC77-ClPpG-2S.js} +1 -1
- package/dist/assets/{chunk-5FCAYU7R-DQvBRnwL.js → chunk-5FCAYU7R-B_qmYOdX.js} +1 -1
- package/dist/assets/{chunk-5HE753X5-CDIH0_y3.js → chunk-5HE753X5-DTO-V56q.js} +1 -1
- package/dist/assets/{chunk-5JV3BV7I-CcevlKd-.js → chunk-5JV3BV7I-CU1SOaaG.js} +1 -1
- package/dist/assets/{chunk-5TONJI2A-_3dxVdnY.js → chunk-5TONJI2A-CzSDkWNa.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-pGO5vvo-.js → chunk-5VM5RSS4-ChkfqIRE.js} +1 -1
- package/dist/assets/{chunk-7BUUIJ7U-DEKF5uAN.js → chunk-7BUUIJ7U-Du3Ozi62.js} +1 -1
- package/dist/assets/{chunk-BIQX33UG-CjBFgq2r.js → chunk-BIQX33UG-C-HVafHB.js} +1 -1
- package/dist/assets/{chunk-C7G6YPKG-e_K9OGTz.js → chunk-C7G6YPKG-BSjZ86D0.js} +1 -1
- package/dist/assets/{chunk-CQNSW5MT-C2IiHyHz.js → chunk-CQNSW5MT-1D1W2lF6.js} +1 -1
- package/dist/assets/{chunk-CYSBUYHQ-DCC6KmGp.js → chunk-CYSBUYHQ-ISpyj_lK.js} +1 -1
- package/dist/assets/{chunk-EMLP6XTP-BYGgekQ0.js → chunk-EMLP6XTP-Cp8iUBt2.js} +1 -1
- package/dist/assets/{chunk-EX3LRPZG-FGcwuVsA.js → chunk-EX3LRPZG-BN5RzF5j.js} +1 -1
- package/dist/assets/{chunk-FWX5IMBZ-CV3Ih_Os.js → chunk-FWX5IMBZ-DecJDW4r.js} +2 -2
- package/dist/assets/{chunk-HOUHSVGY-CXpq_hfV.js → chunk-HOUHSVGY-BE_XNgGk.js} +1 -1
- package/dist/assets/{chunk-ICXQ74PX-CZIpjupq.js → chunk-ICXQ74PX-BFOKMkWV.js} +1 -1
- package/dist/assets/{chunk-JG7HCLWE-CdgwBpW7.js → chunk-JG7HCLWE-DL-pl8VB.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BPjAZpOQ.js → chunk-JWPE2WC7-B-bcwfmh.js} +1 -1
- package/dist/assets/{chunk-MOJQB5TN-DbJDm8to.js → chunk-MOJQB5TN-BC0taFro.js} +1 -1
- package/dist/assets/{chunk-MOZMSUNE-BUa1fqKn.js → chunk-MOZMSUNE-RrhfU6MO.js} +1 -1
- package/dist/assets/{chunk-OGEWGWER-CtnzLgRu.js → chunk-OGEWGWER-TuI7SR7i.js} +1 -1
- package/dist/assets/{chunk-OSBZ3O6U-fUgdpTUM.js → chunk-OSBZ3O6U-C5jMBKlU.js} +1 -1
- package/dist/assets/{chunk-PUDLZKDR-CtDWZT9-.js → chunk-PUDLZKDR-C5lMBn0K.js} +1 -1
- package/dist/assets/{chunk-Q4XR5HBZ-BxnK2qxr.js → chunk-Q4XR5HBZ-B-kzUbwT.js} +1 -1
- package/dist/assets/{chunk-QBLGF6JB-CH4UKoCF.js → chunk-QBLGF6JB-CRb_WAEj.js} +1 -1
- package/dist/assets/{chunk-R7FJI6CG-BxwFoF1v.js → chunk-R7FJI6CG-De6Y7ozO.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-DpHAmq7O.js → chunk-RYQCIY6F-Igv92q8k.js} +1 -1
- package/dist/assets/{chunk-U6XO7XAA-BjH2VUHU.js → chunk-U6XO7XAA-bCjRshkT.js} +1 -1
- package/dist/assets/{chunk-V7JOEXUC-DKJZ3HGj.js → chunk-V7JOEXUC-0J1s_Kgq.js} +1 -1
- package/dist/assets/chunk-VAUOI2AC-DnaryNw2.js +1 -0
- package/dist/assets/{chunk-VR4S4FIN-Cf-o2GtI.js → chunk-VR4S4FIN-DX6lXnNx.js} +1 -1
- package/dist/assets/{chunk-WYO6CB5R-zeNXGm20.js → chunk-WYO6CB5R-DLqMXfFC.js} +3 -3
- package/dist/assets/chunk-XXDRQBXY-BToo1uqb.js +1 -0
- package/dist/assets/{chunk-YOTPTUD7-Ck87Kqxe.js → chunk-YOTPTUD7-CY4obsV0.js} +1 -1
- package/dist/assets/{chunk-ZGVPDNZ5-BbfK6Bfd.js → chunk-ZGVPDNZ5-BleImZKe.js} +1 -1
- package/dist/assets/{chunk-ZIRB5QZD-BDpzh4Yl.js → chunk-ZIRB5QZD-C1TfdjpX.js} +1 -1
- package/dist/assets/{circle-dashed-CU3yApvP.js → circle-dashed-CEEssYIw.js} +1 -1
- package/dist/assets/classDiagram-OUVF2IWQ-D_TusZGx.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-B1NFZTmS.js +1 -0
- package/dist/assets/client-C6YQx7A-.js +1 -0
- package/dist/assets/config-split-page-DKPelvjR.js +1 -0
- package/dist/assets/confirm-dialog-BCGeh61X.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-CQfMxKCT.js → cose-bilkent-JH36ORCC-CVgUHXkj.js} +1 -1
- package/dist/assets/createLucideIcon-CF8U9dh7.js +1 -0
- package/dist/assets/cynefin-VYW2F7L2-CJZSs5s_.js +1 -0
- package/dist/assets/{cynefinDiagram-TSTJHNR4-CxFTiC-p.js → cynefinDiagram-TSTJHNR4-cdfImbfI.js} +1 -1
- package/dist/assets/{dagre-CaBNMcB1.js → dagre-CHNN9L9I.js} +1 -1
- package/dist/assets/{dagre-VKFMJZFB-S_7Hc7bI.js → dagre-VKFMJZFB-PscaENwr.js} +1 -1
- package/dist/assets/desktop-capabilities-page-BENHdKfk.js +1 -0
- package/dist/assets/desktop-update-config-BJMTQMRS.js +1 -0
- package/dist/assets/{diagram-FQU43EPY-C7zENvFb.js → diagram-FQU43EPY-CH_wye41.js} +1 -1
- package/dist/assets/{diagram-G47NLZAW-DqYTCqZA.js → diagram-G47NLZAW-Dtjpmi6D.js} +1 -1
- package/dist/assets/{diagram-NH7WQ7WH-BfSJtXRc.js → diagram-NH7WQ7WH-UdjLHyaz.js} +1 -1
- package/dist/assets/{diagram-OA4YK3LP-CFO-j67H.js → diagram-OA4YK3LP-DYsToEaL.js} +1 -1
- package/dist/assets/{diagram-WEI45ONY-DBQDbTaJ.js → diagram-WEI45ONY-CA7kuIer.js} +1 -1
- package/dist/assets/dialog-DQXou6pg.js +5 -0
- package/dist/assets/dist-CiC9Fd9J.js +1 -0
- package/dist/assets/doc-browser-CCYS_csH.js +1 -0
- package/dist/assets/doc-browser-context-CPLWVFLd.js +1 -0
- package/dist/assets/{docx-preview-B4-aDfvO.js → docx-preview-D--EsUWi.js} +1 -1
- package/dist/assets/{ebnfDiagram-CCIWWBDH-CfDNIXFN.js → ebnfDiagram-CCIWWBDH-BrjaoOuq.js} +1 -1
- package/dist/assets/{erDiagram-Q63AITRT-D95rFXMM.js → erDiagram-Q63AITRT-nZQa2kCM.js} +1 -1
- package/dist/assets/es2015-DHRpDU-q.js +41 -0
- package/dist/assets/eventmodeling-45OFAUF4-rc7kUq4V.js +1 -0
- package/dist/assets/extensions-CsWT7x3v.js +1 -0
- package/dist/assets/{eye-C84inPcV.js → eye-DJtw5KJ5.js} +1 -1
- package/dist/assets/flowDiagram-23GEKE2U-DAjaeGO8.js +1 -0
- package/dist/assets/form-actions-DDQk0END.js +1 -0
- package/dist/assets/{ganttDiagram-NO4QXBWP-Bawg0P0r.js → ganttDiagram-NO4QXBWP-CyFZHIHN.js} +1 -1
- package/dist/assets/gitGraph-TEB2WS4Q-Ce0gf6ps.js +1 -0
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-BbKh9nbL.js → gitGraphDiagram-IHSO6WYX-Dfpq3z2M.js} +1 -1
- package/dist/assets/{i18n-20rSH40D.js → i18n-BjPkAKMQ.js} +2 -2
- package/dist/assets/info-DKCQHKI2-Cp-Tr78m.js +1 -0
- package/dist/assets/{infoDiagram-FWYZ7A6U-DPffZXYh.js → infoDiagram-FWYZ7A6U-Diiz0k1E.js} +1 -1
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-CBMsLwZ2.js → ishikawaDiagram-FXEZZL3T-B3R3SN4M.js} +1 -1
- package/dist/assets/{journeyDiagram-5HDEW3XC-Mz5U4OzU.js → journeyDiagram-5HDEW3XC-DFOLKiNv.js} +1 -1
- package/dist/assets/{kanban-definition-HUTT4EX6-FXZq2k19.js → kanban-definition-HUTT4EX6-BMXpDp3g.js} +1 -1
- package/dist/assets/katex-B4FQSo9k.js +1 -0
- package/dist/assets/keyboard-shortcuts-settings-page-hqTP7akj.js +1 -0
- package/dist/assets/{line-BZwCgT9K.js → line-64_FhCoJ.js} +1 -1
- package/dist/assets/{linear-CTe9mKUw.js → linear-aF1fg7bK.js} +1 -1
- package/dist/assets/loader-circle-B-4WwzBj.js +1 -0
- package/dist/assets/login-page-BUwshAq4.js +1 -0
- package/dist/assets/login-page-CdlI6B8e.js +1 -0
- package/dist/assets/main-BVYdyT60.css +1 -0
- package/dist/assets/main-DYEALeoQ.js +2 -0
- package/dist/assets/main-i18n-catalog.config-1o2hjZ0m.js +1 -0
- package/dist/assets/{map-Ci48ZwAp.js → map-BC3Amra3.js} +1 -1
- package/dist/assets/mcp-marketplace-page-CRRQT6SP.js +1 -0
- package/dist/assets/{mermaid-parser.core-CzPD3U_z.js → mermaid-parser.core-DdMcZwnE.js} +2 -2
- package/dist/assets/{mermaid.core-geIMNPbV.js → mermaid.core-BHdiEBbI.js} +3 -3
- package/dist/assets/{mindmap-definition-LN4V7U3C-xqlKxsr_.js → mindmap-definition-LN4V7U3C-CtHVaZyV.js} +1 -1
- package/dist/assets/model-config-page-BSsHOhV7.js +1 -0
- package/dist/assets/navigation-history-CyawyVz0.js +1 -0
- package/dist/assets/navigation-link-D-fxdv0i.js +3 -0
- package/dist/assets/{ordinal-MxnX8yhv.js → ordinal-6b3jw4cz.js} +1 -1
- package/dist/assets/packet-7NZHBO7P-BOJuCraS.js +1 -0
- package/dist/assets/panel-app-i18n-catalog.config-kQO7QAwH.js +1 -0
- package/dist/assets/panelStandalone-BeI0Ndsx.js +2 -0
- package/dist/assets/{pegDiagram-2B236MQR-D50MFTN1.js → pegDiagram-2B236MQR-BtbG3Bgu.js} +1 -1
- package/dist/assets/pie-RZYD4A2V-D-FEO81x.js +1 -0
- package/dist/assets/{pieDiagram-ENE6RG2P-CpA13oiC.js → pieDiagram-ENE6RG2P-FmLl2hzN.js} +1 -1
- package/dist/assets/privacy-settings-page-pW_1naDz.js +1 -0
- package/dist/assets/projects-k6SLda_A.js +1 -0
- package/dist/assets/provider-models-mVzuEQBS.js +1 -0
- package/dist/assets/provider-scoped-model-input-CVbtT8L9.js +1 -0
- package/dist/assets/providers-config-page-rBlVrHkb.js +1 -0
- package/dist/assets/{puzzle-D6gulz7u.js → puzzle-kKiVft9-.js} +1 -1
- package/dist/assets/pwa-BgGM4kkY.js +1 -0
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-CYCgaj4l.js → quadrantDiagram-ABIIQ3AL-7-OzMNpF.js} +1 -1
- package/dist/assets/radar-I7S5WNFK-Bq3eK1vK.js +1 -0
- package/dist/assets/railroad-3IZDKUUU-C3uZ1esg.js +1 -0
- package/dist/assets/railroad-abnf-AHOZXSZD-D3iZd1KT.js +1 -0
- package/dist/assets/railroad-ebnf-EBAXGLYW-Dl0FWqZu.js +1 -0
- package/dist/assets/railroad-peg-LSFZ7HO6-B51SbzGp.js +1 -0
- package/dist/assets/{railroadDiagram-RFXS5EU6-4LKDGlXN.js → railroadDiagram-RFXS5EU6-B_UVtLJO.js} +1 -1
- package/dist/assets/{refresh-cw-h9Xq3LY3.js → refresh-cw-BeG0y6yZ.js} +1 -1
- package/dist/assets/remote-wYWqir2w.js +1 -0
- package/dist/assets/{requirementDiagram-TGXJPOKE-CxNOU0JH.js → requirementDiagram-TGXJPOKE-D8TO2YeZ.js} +1 -1
- package/dist/assets/{rotate-cw-B6xm41Wn.js → rotate-cw-Ci2dcTO5.js} +1 -1
- package/dist/assets/runtime-config-page-DCXN0nkS.js +1 -0
- package/dist/assets/{sankeyDiagram-HTMAVEWB-DbCBDe2S.js → sankeyDiagram-HTMAVEWB-CUzIcq0B.js} +1 -1
- package/dist/assets/{save-fff_WpY2.js → save-Cr895abt.js} +1 -1
- package/dist/assets/search-config-page-CNQd481d.js +1 -0
- package/dist/assets/secrets-config-page--q7M58L8.js +3 -0
- package/dist/assets/security-config-CJb2pK2O.js +1 -0
- package/dist/assets/select-Bq-UmfCK.js +1 -0
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-DA6W2BS_.js → sequenceDiagram-DBY2YBRQ-kqJzXbwu.js} +1 -1
- package/dist/assets/service-apps-panel-iLLEByRF.js +1 -0
- package/dist/assets/{settings-2-CE3ELQyk.js → settings-2-IodCcaXd.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-T_q_d_VW.js → sizeCapture-X5ZJPWSS-D9ISogq1.js} +1 -1
- package/dist/assets/{src-CYpUlx-4.js → src-Bc0PoUJ1.js} +1 -1
- package/dist/assets/{stateDiagram-2N3HPSRC-mi8z2G0a.js → stateDiagram-2N3HPSRC-CqH5xc9W.js} +1 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-CcOGfDdx.js +1 -0
- package/dist/assets/status-dot-DUYSKRCU.js +1 -0
- package/dist/assets/{swimlanes-5IMT3BWC-DkBEhWE4.js → swimlanes-5IMT3BWC-mwejV-rW.js} +2 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-BMI2k8RZ.js +8 -0
- package/dist/assets/tag-chip-CQU51ST3.js +1 -0
- package/dist/assets/theme-provider-D-zZkXxS.js +1 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-BoFmqBw1.js → timeline-definition-FHXFAJF6-CuikIDlX.js} +1 -1
- package/dist/assets/trash-2-BDdqDh6E.js +1 -0
- package/dist/assets/treeView-QDETBFTQ-C0_07QI1.js +1 -0
- package/dist/assets/treemap-6X3UGDF4-Djpx6ccG.js +1 -0
- package/dist/assets/use-config-Bxx7DdaL.js +1 -0
- package/dist/assets/{use-desktop-capabilities-BkuRd2cY.js → use-desktop-capabilities-BTgdFgJy.js} +1 -1
- package/dist/assets/use-viewport-layout-CDcca0YL.js +1 -0
- package/dist/assets/{vennDiagram-L72KCM5P-BlZ3Or5U.js → vennDiagram-L72KCM5P-BD0P0qHh.js} +1 -1
- package/dist/assets/wardley-OPB4EBWU-DZVFxu81.js +1 -0
- package/dist/assets/{wardleyDiagram-EHGQE667-yDfr33i3.js → wardleyDiagram-EHGQE667-C6ma3t5D.js} +1 -1
- package/dist/assets/x-LUUwl8rK.js +1 -0
- package/dist/assets/{xychartDiagram-FW5EYKEG-mIXwIGAQ.js → xychartDiagram-FW5EYKEG-D7E40NBk.js} +1 -1
- package/dist/index.html +37 -54
- package/dist/panel-standalone.html +11 -15
- package/package.json +5 -5
- package/src/app/components/layout/__tests__/app-layout.test.tsx +8 -0
- package/src/app/components/layout/app-layout.tsx +18 -46
- package/src/app/configs/__tests__/app-navigation.config.test.ts +4 -0
- package/src/app/configs/app-navigation.config.ts +2 -0
- package/src/app/configs/page-resource-renderers.config.ts +13 -0
- package/src/app/index.tsx +4 -0
- package/src/app/presenters/app.presenter.ts +13 -2
- package/src/features/agents/components/__tests__/agents-page.test.tsx +4 -0
- package/src/features/agents/components/agent-details-dialog.tsx +3 -0
- package/src/features/agents/components/agents-page.tsx +7 -3
- package/src/features/apps/components/app-package-card.tsx +2 -2
- package/src/features/chat/components/conversation/chat-conversation-content.tsx +32 -19
- package/src/features/chat/components/conversation/chat-conversation-header-section.tsx +1 -0
- package/src/features/chat/components/conversation/chat-conversation-header.tsx +1 -1
- package/src/features/chat/components/conversation/chat-conversation-panel.tsx +2 -2
- package/src/features/chat/components/conversation/chat-conversation-workspace-section.tsx +1 -0
- package/src/features/chat/components/layout/__tests__/chat-page-shell.test.tsx +7 -6
- package/src/features/chat/components/layout/__tests__/chat-sidebar-toolbar.test.tsx +14 -12
- package/src/features/chat/components/layout/chat-page-shell.tsx +33 -64
- package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +8 -4
- package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +64 -256
- package/src/features/chat/components/layout/chat-sidebar.tsx +8 -30
- package/src/features/chat/components/providers/chat-runtime.provider.tsx +62 -0
- package/src/features/chat/features/conversation/components/__tests__/floating-session-conversation.test.tsx +70 -0
- package/src/features/chat/features/conversation/components/floating-session-conversation.tsx +27 -0
- package/src/features/chat/features/conversation/components/session-conversation-area.tsx +1 -0
- package/src/features/chat/features/conversation/components/session-conversation-panel-tab.tsx +25 -0
- package/src/features/chat/features/conversation/hooks/use-chat-composer-reference-intent.ts +2 -1
- package/src/features/chat/features/message/components/__tests__/chat-inline-panel-app-card.test.tsx +2 -1
- package/src/features/chat/features/message/components/__tests__/chat-message-assistant-header.container.test.tsx +3 -0
- package/src/features/chat/features/message/components/__tests__/chat-message-list-skill-preview.container.test.tsx +3 -0
- package/src/features/chat/features/message/components/__tests__/chat-message-list.container.test.tsx +3 -0
- package/src/features/chat/features/message/hooks/use-chat-inline-token-actions.ts +7 -3
- package/src/features/chat/features/session/components/__tests__/chat-sidebar-session-item.test.tsx +20 -0
- package/src/features/chat/features/session/components/chat-mobile-session-row.tsx +61 -0
- package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +0 -35
- package/src/features/chat/features/session/components/chat-sidebar-session-entry.tsx +2 -0
- package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +13 -5
- package/src/features/chat/features/session/components/chat-sidebar-session-list.tsx +5 -3
- package/src/features/chat/features/session/components/session-header/__tests__/chat-session-header-actions.test.tsx +8 -0
- package/src/features/chat/features/session/components/session-header/chat-session-header-actions.tsx +3 -0
- package/src/features/chat/features/session/components/session-header/chat-session-more-actions-menu.tsx +6 -0
- package/src/features/chat/features/session/utils/chat-session-route.utils.ts +12 -0
- package/src/features/chat/features/workspace/components/__tests__/chat-session-child-sessions.test.tsx +28 -0
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-file-preview.test.tsx +9 -0
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-panel-content.test.tsx +6 -2
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-panel.test.tsx +49 -12
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +13 -6
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-content.tsx +6 -0
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-nav.tsx +21 -36
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel.tsx +40 -31
- package/src/features/chat/features/workspace/components/child-sessions/chat-session-child-sessions.tsx +6 -1
- package/src/features/chat/features/workspace/components/project-files/workspace-directory-tree.tsx +2 -2
- package/src/features/chat/features/workspace/components/project-files/workspace-project-files-toolbar.tsx +2 -2
- package/src/features/chat/features/workspace/utils/__tests__/chat-workspace-panel-view-model.utils.test.ts +27 -0
- package/src/features/chat/features/workspace/utils/__tests__/workspace-file-panel-route.utils.test.ts +94 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-file-tab-persistence.utils.ts +2 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-file-tab.utils.ts +15 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-panel-view-model.utils.ts +11 -0
- package/src/features/chat/features/workspace/utils/workspace-file-panel-route.utils.ts +147 -0
- package/src/features/chat/index.ts +20 -4
- package/src/features/chat/managers/__tests__/chat-completion-notification.manager.test.ts +8 -0
- package/src/features/chat/managers/__tests__/chat-thread-workspace.manager.test.ts +7 -2
- package/src/features/chat/managers/__tests__/session-surface.manager.test.ts +45 -0
- package/src/features/chat/managers/chat-completion-notification.manager.ts +5 -0
- package/src/features/chat/managers/chat-composer-intent.manager.ts +16 -0
- package/src/features/chat/managers/chat-thread.manager.ts +18 -27
- package/src/features/chat/managers/session-surface.manager.ts +46 -0
- package/src/features/chat/pages/__tests__/ncp-chat-page.test.tsx +23 -5
- package/src/features/chat/pages/ncp-chat-page.tsx +6 -86
- package/src/features/chat/presenters/chat.presenter.ts +2 -1
- package/src/features/chat/stores/__tests__/chat-thread.store.test.ts +2 -2
- package/src/features/chat/stores/chat-thread.store.ts +7 -1
- package/src/features/chat/stores/floating-session.store.ts +11 -0
- package/src/features/cron/components/__tests__/cron-config.test.tsx +4 -0
- package/src/features/cron/components/cron-job-detail-dialog.tsx +3 -1
- package/src/features/cron/components/cron-job-row.tsx +5 -1
- package/src/features/inbox/components/inbox-reader-dialog.test.tsx +3 -0
- package/src/features/inbox/components/inbox-reader-dialog.tsx +3 -0
- package/src/features/inbox/pages/inbox-page.test.ts +3 -0
- package/src/features/inbox/pages/inbox-page.tsx +3 -0
- package/src/features/marketplace/components/__tests__/marketplace-page-detail.test.tsx +5 -1
- package/src/features/marketplace/components/__tests__/marketplace-page.test.tsx +3 -0
- package/src/features/marketplace/components/curated-shelves/__tests__/marketplace-curated-scene-route.test.tsx +2 -0
- package/src/features/marketplace/components/marketplace-list-card.tsx +4 -0
- package/src/features/marketplace/components/mcp/__tests__/mcp-marketplace-page.test.tsx +2 -0
- package/src/features/marketplace/components/mcp/mcp-marketplace-card.tsx +3 -0
- package/src/features/notifications/components/__tests__/app-notification-toast.test.tsx +19 -0
- package/src/features/notifications/components/app-notification-toast.tsx +33 -15
- package/src/features/notifications/managers/app-notification.manager.ts +2 -0
- package/src/features/panel-apps/components/__tests__/panel-app-list-item.test.tsx +11 -4
- package/src/features/panel-apps/components/__tests__/panel-app-toolbar.test.tsx +11 -5
- package/src/features/panel-apps/components/panel-app-main-sidebar-menu-item.tsx +5 -38
- package/src/features/panel-apps/index.ts +1 -1
- package/src/features/projects/components/project-materials.test.tsx +2 -0
- package/src/features/projects/components/project-skills.tsx +7 -3
- package/src/features/projects/components/work/project-work-item-drawer.test.tsx +2 -0
- package/src/features/projects/components/work/project-work-item-drawer.tsx +3 -1
- package/src/features/right-panel-resources/components/__tests__/page-resource-icon.test.tsx +67 -0
- package/src/features/right-panel-resources/components/__tests__/page-resource-sidebar-nav.test.tsx +158 -0
- package/src/features/right-panel-resources/components/__tests__/system-object-resource.test.tsx +42 -0
- package/src/features/right-panel-resources/components/current-page-actions.tsx +36 -0
- package/src/features/right-panel-resources/components/page-resource-actions-menu.tsx +71 -0
- package/src/features/right-panel-resources/components/page-resource-icon.tsx +245 -0
- package/src/features/right-panel-resources/components/page-resource-sidebar-nav.tsx +122 -0
- package/src/features/right-panel-resources/components/system-object-resource.tsx +100 -0
- package/src/features/right-panel-resources/components/workspace-file-resource.tsx +56 -0
- package/src/features/right-panel-resources/configs/right-panel-resource-routes.config.ts +46 -3
- package/src/features/right-panel-resources/hooks/use-page-resource-actions.ts +137 -0
- package/src/features/right-panel-resources/index.ts +22 -8
- package/src/features/right-panel-resources/managers/__tests__/page-resource.manager.test.ts +149 -0
- package/src/features/right-panel-resources/managers/page-resource.manager.ts +342 -0
- package/src/features/right-panel-resources/pages/resource-page.tsx +114 -0
- package/src/features/right-panel-resources/stores/page-navigation.store.ts +55 -0
- package/src/features/right-panel-resources/types/page-resource.types.ts +11 -0
- package/src/features/right-panel-resources/utils/__tests__/right-panel-resource-route-resolver.utils.test.ts +10 -0
- package/src/features/right-panel-resources/utils/page-resource-identity.utils.ts +61 -0
- package/src/features/right-panel-resources/utils/right-panel-resource-uri.utils.ts +2 -6
- package/src/features/service-apps/components/__tests__/service-apps-panel.test.tsx +2 -0
- package/src/features/service-apps/components/service-app-list-item.tsx +5 -1
- package/src/features/settings/pages/providers-config-page.tsx +2 -2
- package/src/features/side-dock/components/__tests__/side-dock.test.tsx +9 -8
- package/src/features/side-dock/components/side-dock.tsx +14 -47
- package/src/features/side-dock/managers/side-dock.manager.ts +2 -0
- package/src/platforms/desktop/components/__tests__/desktop-app-shell.test.tsx +3 -0
- package/src/platforms/desktop/components/desktop-app-shell.tsx +5 -14
- package/src/platforms/mobile/components/__tests__/mobile-app-shell.test.tsx +1 -0
- package/src/platforms/mobile/components/__tests__/mobile-bottom-nav.test.tsx +3 -2
- package/src/platforms/mobile/components/mobile-app-shell.tsx +5 -4
- package/src/platforms/mobile/components/mobile-bottom-nav.tsx +7 -7
- package/src/platforms/mobile/components/mobile-topbar.tsx +4 -4
- package/src/shared/components/doc-browser/__tests__/doc-browser-context.test.tsx +4 -3
- package/src/shared/components/doc-browser/__tests__/doc-browser-tab-strip.test.tsx +0 -5
- package/src/shared/components/doc-browser/__tests__/doc-browser.test.tsx +57 -73
- package/src/shared/components/doc-browser/__tests__/resource-link-interceptor.test.tsx +104 -0
- package/src/shared/components/doc-browser/doc-browser-context.tsx +5 -1
- package/src/shared/components/doc-browser/doc-browser-panel-parts.tsx +1 -1
- package/src/shared/components/doc-browser/doc-browser-tab-strip.tsx +6 -118
- package/src/shared/components/doc-browser/doc-browser.tsx +30 -194
- package/src/shared/components/doc-browser/hooks/use-doc-browser-scroll-restoration.ts +1 -1
- package/src/shared/components/doc-browser/managers/doc-browser.manager.ts +11 -1
- package/src/shared/components/doc-browser/stores/doc-browser.store.ts +3 -7
- package/src/shared/components/doc-browser/types/doc-browser.types.ts +8 -1
- package/src/shared/components/doc-browser/use-doc-link-interceptor.ts +30 -32
- package/src/shared/components/doc-browser/utils/doc-browser-state.utils.ts +6 -6
- package/src/shared/components/ui/context-menu/__tests__/context-menu.test.tsx +22 -0
- package/src/shared/components/ui/context-menu/context-menu.tsx +18 -10
- package/src/shared/components/workbench/__tests__/workbench-surface.manager.test.ts +70 -0
- package/src/shared/components/workbench/__tests__/workbench-surface.test.tsx +111 -0
- package/src/shared/components/workbench/managers/workbench-surface.manager.ts +120 -0
- package/src/shared/components/workbench/stores/workbench-surface.store.ts +83 -0
- package/src/shared/components/workbench/types/workbench-surface.types.ts +32 -0
- package/src/shared/components/workbench/utils/workbench-surface-geometry.utils.ts +46 -0
- package/src/shared/components/workbench/workbench-surface-toolbar.tsx +102 -0
- package/src/shared/components/workbench/workbench-surface.tsx +401 -0
- package/src/shared/hooks/use-panel-app-scroll-restoration.test.tsx +19 -0
- package/src/shared/hooks/use-panel-app-scroll-restoration.ts +8 -6
- package/src/shared/hooks/use-scroll-restoration.test.tsx +39 -2
- package/src/shared/hooks/use-scroll-restoration.ts +33 -33
- package/src/shared/lib/api/marketplace.types.ts +1 -0
- package/src/shared/lib/i18n/locales/en-US/chat.json +38 -0
- package/src/shared/lib/i18n/locales/en-US/doc-browser.json +1 -1
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +38 -0
- package/src/shared/lib/navigation-history/index.ts +1 -0
- package/src/shared/lib/navigation-history/navigation-history.utils.ts +1 -1
- package/src/shared/lib/navigation-history/scroll-restoration.manager.test.ts +11 -0
- package/src/shared/lib/navigation-history/scroll-restoration.manager.ts +36 -7
- package/src/shared/lib/navigation-history/view-memory-storage.store.test.ts +37 -0
- package/src/shared/lib/navigation-history/view-memory-storage.store.ts +21 -0
- package/src/shared/lib/ui-document-title/index.ts +1 -0
- package/dist/assets/account-panel-BW4GbzQd.js +0 -1
- package/dist/assets/api-DqzQ-_3w.js +0 -13
- package/dist/assets/app-data-C54N2p8b.js +0 -1
- package/dist/assets/app-presenter-provider-CBZ_-ewx.js +0 -115
- package/dist/assets/appearance-settings-page-C-uZ2Wkf.js +0 -1
- package/dist/assets/architecture-TIHT7OUA-DEt0Abz9.js +0 -1
- package/dist/assets/boxes-D6uPnkGo.js +0 -1
- package/dist/assets/card-BhfAZv5L.js +0 -1
- package/dist/assets/channel-CxQkbwRD.js +0 -1
- package/dist/assets/channels-list-page-Bv7CVSqV.js +0 -8
- package/dist/assets/chevron-down-BL-yMYcX.js +0 -1
- package/dist/assets/chunk-2Q5K7J3B-ClVhziok.js +0 -1
- package/dist/assets/chunk-VAUOI2AC-DZQxkIsv.js +0 -1
- package/dist/assets/chunk-XXDRQBXY-BkExtw5C.js +0 -1
- package/dist/assets/circle-alert-lSa3LRvS.js +0 -1
- package/dist/assets/classDiagram-OUVF2IWQ-Bd6apBb-.js +0 -1
- package/dist/assets/classDiagram-v2-EOCWNBFH-CYxUZGCI.js +0 -1
- package/dist/assets/client-BtGBwLTs.js +0 -1
- package/dist/assets/config-split-page-DqAXKLmG.js +0 -1
- package/dist/assets/confirm-dialog-BTKCWMn6.js +0 -1
- package/dist/assets/createLucideIcon-BNKf0_kc.js +0 -1
- package/dist/assets/cynefin-VYW2F7L2-CV0bFLH9.js +0 -1
- package/dist/assets/desktop-capabilities-page-zLzCSB7A.js +0 -1
- package/dist/assets/desktop-update-config-PmofcFf6.js +0 -1
- package/dist/assets/dialog-Xe73hpQz.js +0 -5
- package/dist/assets/dist-BiIcnf9j.js +0 -1
- package/dist/assets/dist-C5I0v8Qn.js +0 -1
- package/dist/assets/dist-czPa8xFO.js +0 -1
- package/dist/assets/doc-browser-BJrre2S_.js +0 -1
- package/dist/assets/doc-browser-BPqA-zQx.js +0 -1
- package/dist/assets/doc-browser-context-TILuCY5c.js +0 -1
- package/dist/assets/ellipsis-C5YXdOUx.js +0 -1
- package/dist/assets/es2015-cuwbYI-l.js +0 -41
- package/dist/assets/eventmodeling-45OFAUF4-BzkLWWdP.js +0 -1
- package/dist/assets/extensions-CVUFK6Jj.js +0 -1
- package/dist/assets/flowDiagram-23GEKE2U-ukkCsB0j.js +0 -1
- package/dist/assets/form-actions-BRESe-m_.js +0 -1
- package/dist/assets/gitGraph-TEB2WS4Q-BYFhT0Q5.js +0 -1
- package/dist/assets/i18n-provider-BPRq6S7O.js +0 -1
- package/dist/assets/info-DKCQHKI2-CTmlJdcH.js +0 -1
- package/dist/assets/katex-DbZC06Q5.js +0 -1
- package/dist/assets/keyboard-shortcuts-settings-page-CScSXYS4.js +0 -1
- package/dist/assets/loader-circle-K1BDdHR5.js +0 -1
- package/dist/assets/login-page-Dlyvp-81.js +0 -1
- package/dist/assets/login-page-f8qQ4xKY.js +0 -1
- package/dist/assets/logo-badge-C-5-zim6.js +0 -1
- package/dist/assets/main-D2dWy8fM.css +0 -1
- package/dist/assets/main-DMNmwcJE.js +0 -2
- package/dist/assets/main-i18n-catalog.config-DZ-5ollN.js +0 -1
- package/dist/assets/mcp-marketplace-page-FfIfEo6w.js +0 -10
- package/dist/assets/mcp-marketplace-page-sH7VptN_.js +0 -1
- package/dist/assets/model-config-page-Bcm6-pCX.js +0 -1
- package/dist/assets/navigation-link-BAQjgx2F.js +0 -3
- package/dist/assets/packet-7NZHBO7P-BbrI0ZlN.js +0 -1
- package/dist/assets/panel-app-i18n-catalog.config-p3qAY_Eq.js +0 -1
- package/dist/assets/panelStandalone-By-6dDXS.js +0 -2
- package/dist/assets/pie-RZYD4A2V-B7zE1ZIr.js +0 -1
- package/dist/assets/plus-LA8-jpxP.js +0 -1
- package/dist/assets/popover-NkrFlWHp.js +0 -1
- package/dist/assets/privacy-settings-page-B1sHLAc1.js +0 -1
- package/dist/assets/projects-Voql-cvx.js +0 -1
- package/dist/assets/provider-models-hrHMcHqg.js +0 -1
- package/dist/assets/provider-scoped-model-input-BQsugx1v.js +0 -1
- package/dist/assets/providers-config-page-BDEdHJbw.js +0 -1
- package/dist/assets/pwa-CzqfYjFx.js +0 -1
- package/dist/assets/radar-I7S5WNFK-1X_q11Ed.js +0 -1
- package/dist/assets/railroad-3IZDKUUU-CIXnuFyE.js +0 -1
- package/dist/assets/railroad-abnf-AHOZXSZD-D6ImKl2r.js +0 -1
- package/dist/assets/railroad-ebnf-EBAXGLYW-2j9d3twU.js +0 -1
- package/dist/assets/railroad-peg-LSFZ7HO6-DMVaJGbm.js +0 -1
- package/dist/assets/remote-BekqL5nA.js +0 -1
- package/dist/assets/runtime-config-page-BH9uF4u_.js +0 -1
- package/dist/assets/search-CUe41wjm.js +0 -1
- package/dist/assets/search-config-page-DWKlMHgH.js +0 -1
- package/dist/assets/secrets-config-page-DiQL088Y.js +0 -3
- package/dist/assets/security-config-DmTDKKY4.js +0 -1
- package/dist/assets/select-CG5YWnwe.js +0 -1
- package/dist/assets/service-apps-panel-CEnyYsQp.js +0 -1
- package/dist/assets/skeleton-Drvn83YW.js +0 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-OlIMT57r.js +0 -1
- package/dist/assets/swimlanesDiagram-G3AALYLV-sLThrh07.js +0 -8
- package/dist/assets/tabs-BuE0qKMh.js +0 -1
- package/dist/assets/tag-chip-B1AYPOKL.js +0 -1
- package/dist/assets/theme-provider-DzvAi3pe.js +0 -1
- package/dist/assets/tooltip-DYcuWhuP.js +0 -1
- package/dist/assets/trash-2-BPPYt2NV.js +0 -1
- package/dist/assets/treeView-QDETBFTQ-CCFyazDE.js +0 -1
- package/dist/assets/treemap-6X3UGDF4-D6wvq1Hz.js +0 -1
- package/dist/assets/use-config-BEdbtpD4.js +0 -1
- package/dist/assets/use-panel-app-scroll-restoration-ZnicIfo3.js +0 -1
- package/dist/assets/use-viewport-layout-BS18drMT.js +0 -1
- package/dist/assets/utils-CBZPzC_b.js +0 -8
- package/dist/assets/wardley-OPB4EBWU-BRzaRyFf.js +0 -1
- package/dist/assets/x-DdXOqLnX.js +0 -1
- package/src/features/panel-apps/components/__tests__/panel-app-main-sidebar-nav.test.tsx +0 -219
- package/src/features/panel-apps/components/panel-app-main-sidebar-nav.tsx +0 -258
- package/src/shared/components/doc-browser/utils/doc-browser-floating-panel.utils.ts +0 -83
- /package/dist/assets/{array-D0DyKZdT.js → array-B0sEvCP9.js} +0 -0
- /package/dist/assets/{chunk-KEIR6QF5-CuZFOa6q.js → chunk-KEIR6QF5-BeO7fxDQ.js} +0 -0
- /package/dist/assets/{chunk-Y2CYZVJY-Frut-1TF.js → chunk-Y2CYZVJY-JQfgEV36.js} +0 -0
- /package/dist/assets/{config-hints-B_C9DAp5.js → config-hints-D3OuwoEY.js} +0 -0
- /package/dist/assets/{cytoscape.esm-BibuhnZD.js → cytoscape.esm-CzJ9uXgi.js} +0 -0
- /package/dist/assets/{defaultLocale-q7sRUXPc.js → defaultLocale-USmzX3VG.js} +0 -0
- /package/dist/assets/{dist-DhMddrrH.js → dist-BYF6XVna.js} +0 -0
- /package/dist/assets/{graphlib-BM63WsW3.js → graphlib-DEFMkHdW.js} +0 -0
- /package/dist/assets/{host-capabilities-B107nwS3.js → host-capabilities-C0MmWd3M.js} +0 -0
- /package/dist/assets/{init-CRMkf9sL.js → init-04ErALoz.js} +0 -0
- /package/dist/assets/{jszip.min-6thm2J_a.js → jszip.min-BnQ5NRy2.js} +0 -0
- /package/dist/assets/{katex-B26hhTOT.js → katex-CsAM73R9.js} +0 -0
- /package/dist/assets/{middleware-0o3JF3tS.js → middleware-CAXxl-af.js} +0 -0
- /package/dist/assets/{panel-app-B39rJPj8.js → panel-app-2EACRB8p.js} +0 -0
- /package/dist/assets/{path-BFMmafCM.js → path-CzxQ9n2G.js} +0 -0
- /package/dist/assets/{rough.esm-5Tjchx1D.js → rough.esm-pT9fdsW3.js} +0 -0
- /package/dist/assets/{xlsx-BC8ibjXK.js → xlsx-BRpCSiE4.js} +0 -0
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useAppPresenter } from '@/app/components/app-presenter-provider';
|
|
4
|
+
import { isDocsUrl } from './doc-browser-context';
|
|
5
|
+
import { toast } from 'sonner';
|
|
6
|
+
import { t } from '@/shared/lib/i18n';
|
|
3
7
|
|
|
4
|
-
/**
|
|
5
|
-
* Global click interceptor for docs links.
|
|
6
|
-
* Captures clicks on <a> tags pointing to the docs domain
|
|
7
|
-
* and opens them in the in-app micro-browser instead.
|
|
8
|
-
*/
|
|
8
|
+
/** Resource links use the same opening policy as navigation and page menus. */
|
|
9
9
|
export function useDocLinkInterceptor() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return () => document.removeEventListener('click', handler, true);
|
|
35
|
-
}, [docBrowser]);
|
|
10
|
+
const app = useAppPresenter();
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const handler = (event: MouseEvent) => {
|
|
14
|
+
if (event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
15
|
+
const anchor = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>('a[href]') : null;
|
|
16
|
+
if (!anchor || anchor.hasAttribute('data-doc-external') || anchor.hasAttribute('download')) return;
|
|
17
|
+
const href = anchor.getAttribute('href') ?? '';
|
|
18
|
+
if (!href.startsWith('nextclaw://') && !isDocsUrl(href)) return;
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
const origin = anchor.closest<HTMLElement>('[data-resource-session]');
|
|
22
|
+
const page = app.pageResourceManager.resolve(href, { workingDir: origin?.dataset.resourceWorkingDir, sessionKey: origin?.dataset.resourceSession });
|
|
23
|
+
if (page) {
|
|
24
|
+
const label = anchor.cloneNode(true) as HTMLAnchorElement;
|
|
25
|
+
label.querySelectorAll('[aria-hidden="true"]').forEach((element) => element.remove());
|
|
26
|
+
const title = label.textContent?.trim();
|
|
27
|
+
app.pageResourceManager.open(title ? { ...page, title, target: { ...page.target, title } } : page, 'default', navigate);
|
|
28
|
+
}
|
|
29
|
+
else toast.error(t('pageUnavailable'));
|
|
30
|
+
};
|
|
31
|
+
document.addEventListener('click', handler, true);
|
|
32
|
+
return () => document.removeEventListener('click', handler, true);
|
|
33
|
+
}, [app, navigate]);
|
|
36
34
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
DOC_BROWSER_HOME_URL,
|
|
14
14
|
inferTabTitle,
|
|
15
15
|
} from './doc-browser-url.utils';
|
|
16
|
+
import { pushNavigationHistoryEntry } from '@/shared/lib/navigation-history';
|
|
16
17
|
import { t } from '@/shared/lib/i18n';
|
|
17
18
|
import {
|
|
18
19
|
createUiContentParamsWindowName,
|
|
@@ -44,6 +45,7 @@ export function createDocBrowserTab(
|
|
|
44
45
|
resourceUri?: string,
|
|
45
46
|
dockIcon?: DocBrowserDockIcon,
|
|
46
47
|
contentParams?: UiContentParams,
|
|
48
|
+
viewState?: unknown,
|
|
47
49
|
): DocBrowserTab {
|
|
48
50
|
const tabTitle = title?.trim() || inferTabTitle(url, kind, kind === 'docs' ? t('docBrowserHelp') : 'Detail');
|
|
49
51
|
const normalizedResourceUri = resourceUri?.trim();
|
|
@@ -55,6 +57,7 @@ export function createDocBrowserTab(
|
|
|
55
57
|
currentUrl: url,
|
|
56
58
|
resourceUri: normalizedResourceUri ? normalizedResourceUri : undefined,
|
|
57
59
|
contentParams,
|
|
60
|
+
viewState,
|
|
58
61
|
dockIcon,
|
|
59
62
|
dedupeKey,
|
|
60
63
|
history: [url],
|
|
@@ -67,11 +70,8 @@ export function appendManualNavigation(
|
|
|
67
70
|
tab: DocBrowserTab,
|
|
68
71
|
url: string,
|
|
69
72
|
): Pick<DocBrowserTab, 'history' | 'historyIndex'> {
|
|
70
|
-
const
|
|
71
|
-
return {
|
|
72
|
-
history,
|
|
73
|
-
historyIndex: history.length - 1,
|
|
74
|
-
};
|
|
73
|
+
const next = pushNavigationHistoryEntry({ entries: tab.history, index: tab.historyIndex }, url);
|
|
74
|
+
return { history: [...next.entries], historyIndex: next.index };
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export function updateTabForOpen(
|
|
@@ -89,6 +89,7 @@ export function updateTabForOpen(
|
|
|
89
89
|
dockIcon: options?.dockIcon ?? target.dockIcon,
|
|
90
90
|
dedupeKey,
|
|
91
91
|
contentParams: target.contentParams,
|
|
92
|
+
viewState: options?.viewState ?? target.viewState ?? tab.viewState,
|
|
92
93
|
};
|
|
93
94
|
const hasSameUrl = routeResolver.areUrlsEquivalent(
|
|
94
95
|
tab.currentUrl,
|
|
@@ -130,7 +131,6 @@ export function createDefaultDocBrowserState(): DocBrowserState {
|
|
|
130
131
|
const initialTab = createDocBrowserTab(DOC_BROWSER_HOME_URL, DOC_BROWSER_HOME_TAB_KIND, t('docBrowserHomeTitle'));
|
|
131
132
|
return {
|
|
132
133
|
isOpen: false,
|
|
133
|
-
mode: 'docked',
|
|
134
134
|
dockedWidth: DOC_BROWSER_DOCKED_DEFAULT_WIDTH,
|
|
135
135
|
tabs: [initialTab],
|
|
136
136
|
activeTabId: initialTab.id,
|
|
@@ -4,6 +4,28 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
4
4
|
import { ContextMenu, ContextMenuTrigger } from '@/shared/components/ui/context-menu/context-menu';
|
|
5
5
|
|
|
6
6
|
describe('ContextMenu', () => {
|
|
7
|
+
it('keeps modal actions inside the dialog focus boundary and consumes Escape', async () => {
|
|
8
|
+
const onSelect = vi.fn();
|
|
9
|
+
const onDialogKeyDown = vi.fn();
|
|
10
|
+
render(
|
|
11
|
+
<div role="dialog" onKeyDown={onDialogKeyDown}>
|
|
12
|
+
<ContextMenu label="Resource actions" groups={[{ key: 'open', items: [{ key: 'open', label: 'Open resource', onSelect }] }]}>
|
|
13
|
+
<div><ContextMenuTrigger><button type="button">Actions</button></ContextMenuTrigger></div>
|
|
14
|
+
</ContextMenu>
|
|
15
|
+
</div>,
|
|
16
|
+
);
|
|
17
|
+
await userEvent.click(screen.getByRole('button', { name: 'Actions' }));
|
|
18
|
+
const menu = screen.getByRole('menu');
|
|
19
|
+
expect(menu.closest('[role="dialog"]')).toBe(screen.getByRole('dialog'));
|
|
20
|
+
expect(menu.parentElement?.className).toContain('pointer-events-auto');
|
|
21
|
+
await userEvent.keyboard('{Escape}');
|
|
22
|
+
expect(screen.queryByRole('menu')).toBeNull();
|
|
23
|
+
expect(onDialogKeyDown).not.toHaveBeenCalled();
|
|
24
|
+
await userEvent.click(screen.getByRole('button', { name: 'Actions' }));
|
|
25
|
+
await userEvent.click(screen.getByRole('menuitem', { name: 'Open resource' }));
|
|
26
|
+
expect(onSelect).toHaveBeenCalledOnce();
|
|
27
|
+
});
|
|
28
|
+
|
|
7
29
|
it('opens at the trigger and supports keyboard selection', async () => {
|
|
8
30
|
const onSelect = vi.fn();
|
|
9
31
|
render(
|
|
@@ -18,6 +18,7 @@ type ContextMenuItemBase = {
|
|
|
18
18
|
icon?: ReactNode;
|
|
19
19
|
destructive?: boolean;
|
|
20
20
|
disabled?: boolean;
|
|
21
|
+
pressed?: boolean;
|
|
21
22
|
restoreFocus?: boolean;
|
|
22
23
|
};
|
|
23
24
|
|
|
@@ -68,26 +69,31 @@ function ContextMenuSurface({
|
|
|
68
69
|
position: ContextMenuPosition;
|
|
69
70
|
}) {
|
|
70
71
|
const menuRef = useRef<HTMLDivElement | null>(null);
|
|
72
|
+
// Keep modal menus inside the dialog's focus and pointer-event boundary.
|
|
73
|
+
const portalHost = position.trigger.closest<HTMLElement>('[role="dialog"]') ?? document.body;
|
|
74
|
+
const isModal = portalHost !== document.body;
|
|
71
75
|
|
|
72
76
|
useLayoutEffect(() => {
|
|
73
77
|
const menu = menuRef.current;
|
|
74
78
|
if (!menu) {
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
81
|
+
const bounds = isModal ? portalHost.getBoundingClientRect() : { left: 0, top: 0, right: window.innerWidth, bottom: window.innerHeight, height: window.innerHeight };
|
|
82
|
+
menu.style.maxHeight = `${Math.max(0, bounds.height - CONTEXT_MENU_EDGE_GAP * 2)}px`;
|
|
77
83
|
const rect = menu.getBoundingClientRect();
|
|
78
84
|
const preferredLeft = position.align === 'end' ? position.x - rect.width : position.x;
|
|
79
85
|
const left = Math.max(
|
|
80
|
-
CONTEXT_MENU_EDGE_GAP,
|
|
81
|
-
Math.min(preferredLeft,
|
|
86
|
+
bounds.left + CONTEXT_MENU_EDGE_GAP,
|
|
87
|
+
Math.min(preferredLeft, bounds.right - rect.width - CONTEXT_MENU_EDGE_GAP),
|
|
82
88
|
);
|
|
83
89
|
const top = Math.max(
|
|
84
|
-
CONTEXT_MENU_EDGE_GAP,
|
|
85
|
-
Math.min(position.y,
|
|
90
|
+
bounds.top + CONTEXT_MENU_EDGE_GAP,
|
|
91
|
+
Math.min(position.y, bounds.bottom - rect.height - CONTEXT_MENU_EDGE_GAP),
|
|
86
92
|
);
|
|
87
|
-
menu.style.left = `${left}px`;
|
|
88
|
-
menu.style.top = `${top}px`;
|
|
93
|
+
menu.style.left = `${left - bounds.left}px`;
|
|
94
|
+
menu.style.top = `${top - bounds.top}px`;
|
|
89
95
|
menu.querySelector<HTMLElement>('[role="menuitem"]:not(:disabled)')?.focus();
|
|
90
|
-
}, [position]);
|
|
96
|
+
}, [position, portalHost, isModal]);
|
|
91
97
|
|
|
92
98
|
const moveFocus = (direction: 1 | -1) => {
|
|
93
99
|
const items = Array.from(menuRef.current?.querySelectorAll<HTMLElement>('[role="menuitem"]:not(:disabled)') ?? []);
|
|
@@ -101,7 +107,7 @@ function ContextMenuSurface({
|
|
|
101
107
|
|
|
102
108
|
return createPortal(
|
|
103
109
|
<div
|
|
104
|
-
className="
|
|
110
|
+
className={cn("pointer-events-auto inset-0 z-[var(--z-tooltip)]", isModal ? "absolute" : "fixed")}
|
|
105
111
|
onContextMenu={(event) => event.preventDefault()}
|
|
106
112
|
onPointerDown={() => onClose(true)}
|
|
107
113
|
>
|
|
@@ -110,12 +116,13 @@ function ContextMenuSurface({
|
|
|
110
116
|
role="menu"
|
|
111
117
|
data-theme-overlay="menu"
|
|
112
118
|
aria-label={label}
|
|
113
|
-
className="
|
|
119
|
+
className={cn("min-w-52 max-w-72 overflow-y-auto rounded-xl border border-border bg-popover p-1 text-popover-foreground shadow-[0_18px_48px_-20px_rgba(15,23,42,0.42)]", isModal ? "absolute" : "fixed")}
|
|
114
120
|
style={{ left: position.x, top: position.y }}
|
|
115
121
|
onPointerDown={(event) => event.stopPropagation()}
|
|
116
122
|
onKeyDown={(event) => {
|
|
117
123
|
if (event.key === 'Escape') {
|
|
118
124
|
event.preventDefault();
|
|
125
|
+
event.stopPropagation();
|
|
119
126
|
onClose(true);
|
|
120
127
|
} else if (event.key === 'ArrowDown') {
|
|
121
128
|
event.preventDefault();
|
|
@@ -176,6 +183,7 @@ function ContextMenuSurface({
|
|
|
176
183
|
type="button"
|
|
177
184
|
role="menuitem"
|
|
178
185
|
disabled={item.disabled}
|
|
186
|
+
aria-pressed={item.pressed}
|
|
179
187
|
className={itemClassName}
|
|
180
188
|
onClick={() => {
|
|
181
189
|
item.onSelect?.();
|
|
@@ -190,7 +198,7 @@ function ContextMenuSurface({
|
|
|
190
198
|
))}
|
|
191
199
|
</div>
|
|
192
200
|
</div>,
|
|
193
|
-
|
|
201
|
+
portalHost,
|
|
194
202
|
);
|
|
195
203
|
}
|
|
196
204
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { beforeEach, expect, it } from "vitest";
|
|
2
|
+
import { WorkbenchSurfaceManager } from "@/shared/components/workbench/managers/workbench-surface.manager";
|
|
3
|
+
import { useWorkbenchSurfaceStore } from "@/shared/components/workbench/stores/workbench-surface.store";
|
|
4
|
+
import { resizeWorkbenchRect } from "@/shared/components/workbench/utils/workbench-surface-geometry.utils";
|
|
5
|
+
|
|
6
|
+
const manager = new WorkbenchSurfaceManager();
|
|
7
|
+
beforeEach(() => useWorkbenchSurfaceStore.setState({ surfaces: {} }));
|
|
8
|
+
|
|
9
|
+
it("keeps geometry and placement through maximize, collapse and restore", () => {
|
|
10
|
+
manager.place("file", "floating");
|
|
11
|
+
manager.move("file", manager.get("file").rect, 100, 20, {
|
|
12
|
+
width: 1400,
|
|
13
|
+
height: 1000,
|
|
14
|
+
});
|
|
15
|
+
const { rect } = manager.get("file");
|
|
16
|
+
manager.toggleMaximize("file");
|
|
17
|
+
expect(manager.get("file")).toMatchObject({
|
|
18
|
+
maximized: true,
|
|
19
|
+
placement: "floating",
|
|
20
|
+
rect,
|
|
21
|
+
});
|
|
22
|
+
manager.toggleMaximize("file");
|
|
23
|
+
manager.minimize("file");
|
|
24
|
+
manager.restore("file");
|
|
25
|
+
expect(manager.get("file")).toMatchObject({
|
|
26
|
+
minimized: false,
|
|
27
|
+
maximized: false,
|
|
28
|
+
rect,
|
|
29
|
+
});
|
|
30
|
+
manager.place("file", "docked");
|
|
31
|
+
manager.place("file", "floating");
|
|
32
|
+
expect(manager.get("file").rect).toEqual(rect);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("isolates scopes, orders focused windows and constrains after viewport shrink", () => {
|
|
36
|
+
manager.place("global", "floating");
|
|
37
|
+
manager.place("session", "floating");
|
|
38
|
+
manager.focus("global");
|
|
39
|
+
expect(manager.get("global").layer).toBeGreaterThan(
|
|
40
|
+
manager.get("session").layer,
|
|
41
|
+
);
|
|
42
|
+
manager.minimize("global");
|
|
43
|
+
expect(manager.get("session").minimized).toBe(false);
|
|
44
|
+
manager.constrain("global", { width: 280, height: 200 });
|
|
45
|
+
const { rect } = manager.get("global");
|
|
46
|
+
expect(rect.x).toBeGreaterThanOrEqual(0);
|
|
47
|
+
expect(rect.x + rect.w).toBeLessThanOrEqual(280);
|
|
48
|
+
expect(rect.y + rect.h).toBeLessThanOrEqual(200);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("anchors the opposite edge when resizing from left or top", () => {
|
|
52
|
+
const rect = { x: 100, y: 100, w: 560, h: 640 };
|
|
53
|
+
const next = resizeWorkbenchRect(rect, "top-left", 30, 40, {
|
|
54
|
+
width: 1400,
|
|
55
|
+
height: 1000,
|
|
56
|
+
});
|
|
57
|
+
expect(next.x + next.w).toBe(rect.x + rect.w);
|
|
58
|
+
expect(next.y + next.h).toBe(rect.y + rect.h);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("reloads validated layout without reviving transient maximized or collapsed state", async () => {
|
|
62
|
+
manager.place("global", "floating");
|
|
63
|
+
manager.minimize("global");
|
|
64
|
+
await useWorkbenchSurfaceStore.persist.rehydrate();
|
|
65
|
+
expect(manager.get("global")).toMatchObject({
|
|
66
|
+
placement: "floating",
|
|
67
|
+
minimized: false,
|
|
68
|
+
maximized: false,
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen, within } from "@testing-library/react";
|
|
2
|
+
import { beforeEach, expect, it, vi } from "vitest";
|
|
3
|
+
import { WorkbenchSurface } from "@/shared/components/workbench/workbench-surface";
|
|
4
|
+
import { WorkbenchSurfaceManager } from "@/shared/components/workbench/managers/workbench-surface.manager";
|
|
5
|
+
import { useWorkbenchSurfaceStore } from "@/shared/components/workbench/stores/workbench-surface.store";
|
|
6
|
+
|
|
7
|
+
const manager = new WorkbenchSurfaceManager();
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
useWorkbenchSurfaceStore.setState({ surfaces: {} });
|
|
10
|
+
Object.defineProperty(window, "innerWidth", {
|
|
11
|
+
configurable: true,
|
|
12
|
+
value: 1200,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("retains the exact input and iframe nodes through every presentation transition and hiding", () => {
|
|
17
|
+
const props = {
|
|
18
|
+
id: "resource",
|
|
19
|
+
title: "Resource",
|
|
20
|
+
manager,
|
|
21
|
+
onClose: vi.fn(),
|
|
22
|
+
};
|
|
23
|
+
const content = (
|
|
24
|
+
<>
|
|
25
|
+
<textarea aria-label="Draft" defaultValue="Keep me" />
|
|
26
|
+
<iframe title="App" src="about:blank" />
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
const view = render(
|
|
30
|
+
<WorkbenchSurface {...props}>{content}</WorkbenchSurface>,
|
|
31
|
+
);
|
|
32
|
+
const input = screen.getByRole("textbox");
|
|
33
|
+
const iframe = screen.getByTitle("App");
|
|
34
|
+
for (const action of [
|
|
35
|
+
"Float view group",
|
|
36
|
+
"Maximize",
|
|
37
|
+
"Restore size",
|
|
38
|
+
"Collapse view",
|
|
39
|
+
"Expand view",
|
|
40
|
+
"Dock to sidebar",
|
|
41
|
+
]) {
|
|
42
|
+
fireEvent.click(screen.getByRole("button", { name: action }));
|
|
43
|
+
expect(input.isConnected).toBe(true);
|
|
44
|
+
expect(iframe.isConnected).toBe(true);
|
|
45
|
+
expect(view.container.querySelector("textarea")).toBe(input);
|
|
46
|
+
expect(view.container.querySelector("iframe")).toBe(iframe);
|
|
47
|
+
}
|
|
48
|
+
view.rerender(
|
|
49
|
+
<WorkbenchSurface {...props} hidden>
|
|
50
|
+
{content}
|
|
51
|
+
</WorkbenchSurface>,
|
|
52
|
+
);
|
|
53
|
+
expect(screen.queryByRole("textbox")).toBeNull();
|
|
54
|
+
view.rerender(<WorkbenchSurface {...props}>{content}</WorkbenchSurface>);
|
|
55
|
+
expect(screen.getByRole("textbox")).toBe(input);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("restores size before collapsing on Escape and keeps close separate", () => {
|
|
59
|
+
const onClose = vi.fn();
|
|
60
|
+
manager.place("resource", "floating");
|
|
61
|
+
render(
|
|
62
|
+
<WorkbenchSurface
|
|
63
|
+
id="resource"
|
|
64
|
+
manager={manager}
|
|
65
|
+
title="Resource"
|
|
66
|
+
onClose={onClose}
|
|
67
|
+
>
|
|
68
|
+
<textarea />
|
|
69
|
+
</WorkbenchSurface>,
|
|
70
|
+
);
|
|
71
|
+
fireEvent.click(screen.getByRole("button", { name: "Maximize" }));
|
|
72
|
+
fireEvent.keyDown(screen.getByRole("textbox"), { key: "Escape" });
|
|
73
|
+
expect(manager.get("resource")).toMatchObject({
|
|
74
|
+
minimized: false,
|
|
75
|
+
maximized: false,
|
|
76
|
+
});
|
|
77
|
+
fireEvent.keyDown(screen.getByRole("textbox"), { key: "Escape" });
|
|
78
|
+
expect(manager.get("resource").minimized).toBe(true);
|
|
79
|
+
expect(onClose).not.toHaveBeenCalled();
|
|
80
|
+
fireEvent.click(screen.getByRole("button", { name: "Close view" }));
|
|
81
|
+
expect(onClose).toHaveBeenCalledOnce();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("offers keyboard resize and a compact viewport without unusable desktop controls", () => {
|
|
85
|
+
const onWidthCommit = vi.fn();
|
|
86
|
+
render(
|
|
87
|
+
<WorkbenchSurface
|
|
88
|
+
id="resource"
|
|
89
|
+
manager={manager}
|
|
90
|
+
title="Resource"
|
|
91
|
+
onClose={vi.fn()}
|
|
92
|
+
width={480}
|
|
93
|
+
onWidthCommit={onWidthCommit}
|
|
94
|
+
>
|
|
95
|
+
<input />
|
|
96
|
+
</WorkbenchSurface>,
|
|
97
|
+
);
|
|
98
|
+
fireEvent.keyDown(screen.getByRole("separator"), { key: "ArrowLeft" });
|
|
99
|
+
expect(onWidthCommit).toHaveBeenCalledWith(504);
|
|
100
|
+
act(() => {
|
|
101
|
+
Object.defineProperty(window, "innerWidth", {
|
|
102
|
+
configurable: true,
|
|
103
|
+
value: 375,
|
|
104
|
+
});
|
|
105
|
+
window.dispatchEvent(new Event("resize"));
|
|
106
|
+
});
|
|
107
|
+
const region = screen.getByRole("region");
|
|
108
|
+
expect(region.style.position).toBe("fixed");
|
|
109
|
+
expect(within(region).queryByRole("button", { name: "Maximize" })).toBeNull();
|
|
110
|
+
expect(within(region).queryByRole("separator")).toBeNull();
|
|
111
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useWorkbenchSurfaceStore } from "@/shared/components/workbench/stores/workbench-surface.store";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_WORKBENCH_SURFACE,
|
|
4
|
+
type WorkbenchPlacement,
|
|
5
|
+
type WorkbenchRect,
|
|
6
|
+
type WorkbenchResizeEdge,
|
|
7
|
+
type WorkbenchSurfaceState,
|
|
8
|
+
type WorkbenchViewport,
|
|
9
|
+
} from "@/shared/components/workbench/types/workbench-surface.types";
|
|
10
|
+
import {
|
|
11
|
+
constrainWorkbenchRect,
|
|
12
|
+
resizeWorkbenchRect,
|
|
13
|
+
} from "@/shared/components/workbench/utils/workbench-surface-geometry.utils";
|
|
14
|
+
|
|
15
|
+
export class WorkbenchSurfaceManager {
|
|
16
|
+
isVisible = (id: string): boolean =>
|
|
17
|
+
useWorkbenchSurfaceStore.getState().visibleSurfaceIds.includes(id);
|
|
18
|
+
|
|
19
|
+
setVisible = (id: string, visible: boolean): void => {
|
|
20
|
+
useWorkbenchSurfaceStore.setState(({ visibleSurfaceIds }) => ({
|
|
21
|
+
visibleSurfaceIds: visible
|
|
22
|
+
? [...new Set([...visibleSurfaceIds, id])]
|
|
23
|
+
: visibleSurfaceIds.filter((key) => key !== id),
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
get = (id: string): WorkbenchSurfaceState =>
|
|
28
|
+
useWorkbenchSurfaceStore.getState().surfaces[id] ??
|
|
29
|
+
DEFAULT_WORKBENCH_SURFACE;
|
|
30
|
+
|
|
31
|
+
private update = (
|
|
32
|
+
id: string,
|
|
33
|
+
patch: Partial<WorkbenchSurfaceState>,
|
|
34
|
+
): void => {
|
|
35
|
+
useWorkbenchSurfaceStore.setState(({ surfaces }) => ({
|
|
36
|
+
surfaces: { ...surfaces, [id]: { ...this.get(id), ...patch } },
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
place = (id: string, placement: WorkbenchPlacement): void => {
|
|
41
|
+
this.update(id, { placement, minimized: false, maximized: false });
|
|
42
|
+
this.focus(id);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
minimize = (id: string): void =>
|
|
46
|
+
this.update(id, { minimized: true, maximized: false });
|
|
47
|
+
restore = (id: string): void => this.update(id, { minimized: false });
|
|
48
|
+
toggleMaximize = (id: string): void => {
|
|
49
|
+
this.update(id, { maximized: !this.get(id).maximized, minimized: false });
|
|
50
|
+
this.focus(id);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
focus = (id: string): void => {
|
|
54
|
+
const { surfaces } = useWorkbenchSurfaceStore.getState();
|
|
55
|
+
const ids = Object.keys(surfaces).sort(
|
|
56
|
+
(left, right) => surfaces[left].layer - surfaces[right].layer,
|
|
57
|
+
);
|
|
58
|
+
if (ids.at(-1) === id && this.get(id).layer > 0) return;
|
|
59
|
+
const ordered = [...ids.filter((key) => key !== id), id];
|
|
60
|
+
useWorkbenchSurfaceStore.setState({
|
|
61
|
+
surfaces: Object.fromEntries(
|
|
62
|
+
ordered.map((key, index) => [
|
|
63
|
+
key,
|
|
64
|
+
{ ...this.get(key), layer: index + 1 },
|
|
65
|
+
]),
|
|
66
|
+
),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
reset = (id: string): void => {
|
|
71
|
+
useWorkbenchSurfaceStore.setState(({ surfaces }) => {
|
|
72
|
+
const next = { ...surfaces };
|
|
73
|
+
delete next[id];
|
|
74
|
+
return { surfaces: next };
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
constrain = (id: string, viewport: WorkbenchViewport): void => {
|
|
79
|
+
const current = this.get(id).rect;
|
|
80
|
+
const rect = constrainWorkbenchRect(current, viewport);
|
|
81
|
+
if (
|
|
82
|
+
Object.keys(rect).some(
|
|
83
|
+
(key) =>
|
|
84
|
+
rect[key as keyof WorkbenchRect] !==
|
|
85
|
+
current[key as keyof WorkbenchRect],
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
this.update(id, { rect });
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
move = (
|
|
92
|
+
id: string,
|
|
93
|
+
start: WorkbenchRect,
|
|
94
|
+
dx: number,
|
|
95
|
+
dy: number,
|
|
96
|
+
viewport: WorkbenchViewport,
|
|
97
|
+
): void => {
|
|
98
|
+
this.update(id, {
|
|
99
|
+
rect: constrainWorkbenchRect(
|
|
100
|
+
{ ...start, x: start.x + dx, y: start.y + dy },
|
|
101
|
+
viewport,
|
|
102
|
+
),
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
resize = (
|
|
107
|
+
id: string,
|
|
108
|
+
start: WorkbenchRect,
|
|
109
|
+
edge: WorkbenchResizeEdge,
|
|
110
|
+
dx: number,
|
|
111
|
+
dy: number,
|
|
112
|
+
viewport: WorkbenchViewport,
|
|
113
|
+
): void => {
|
|
114
|
+
this.update(id, {
|
|
115
|
+
rect: resizeWorkbenchRect(start, edge, dx, dy, viewport),
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const workbenchSurfaceManager = new WorkbenchSurfaceManager();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ViewMemoryStorage } from "@/shared/lib/navigation-history";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
import { createJSONStorage, persist } from "zustand/middleware";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_WORKBENCH_SURFACE,
|
|
6
|
+
GLOBAL_WORKBENCH_SURFACE,
|
|
7
|
+
type WorkbenchSurfaceState,
|
|
8
|
+
} from "@/shared/components/workbench/types/workbench-surface.types";
|
|
9
|
+
|
|
10
|
+
function restoreSurfaces(
|
|
11
|
+
value: unknown,
|
|
12
|
+
): Record<string, WorkbenchSurfaceState> {
|
|
13
|
+
if (
|
|
14
|
+
!value ||
|
|
15
|
+
typeof value !== "object" ||
|
|
16
|
+
!("surfaces" in value) ||
|
|
17
|
+
!value.surfaces ||
|
|
18
|
+
typeof value.surfaces !== "object"
|
|
19
|
+
)
|
|
20
|
+
return {};
|
|
21
|
+
const result: Record<string, WorkbenchSurfaceState> = {};
|
|
22
|
+
for (const [id, candidate] of Object.entries(value.surfaces).slice(-64)) {
|
|
23
|
+
if (!candidate || typeof candidate !== "object") continue;
|
|
24
|
+
const { placement, rect } = candidate;
|
|
25
|
+
if (
|
|
26
|
+
(placement !== "docked" && placement !== "floating") ||
|
|
27
|
+
!rect ||
|
|
28
|
+
!["x", "y", "w", "h"].every(
|
|
29
|
+
(key) => typeof rect[key] === "number" && Number.isFinite(rect[key]),
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
continue;
|
|
33
|
+
result[id] = { ...DEFAULT_WORKBENCH_SURFACE, placement, rect };
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function initialSurfaces(): Record<string, WorkbenchSurfaceState> {
|
|
39
|
+
// One-way import of the former browser-only placement. New writes have one owner.
|
|
40
|
+
try {
|
|
41
|
+
const legacy = JSON.parse(
|
|
42
|
+
window.localStorage.getItem("nextclaw.doc-browser.state") ?? "null",
|
|
43
|
+
);
|
|
44
|
+
if (legacy?.state?.snapshot?.mode === "floating")
|
|
45
|
+
return {
|
|
46
|
+
[GLOBAL_WORKBENCH_SURFACE]: {
|
|
47
|
+
...DEFAULT_WORKBENCH_SURFACE,
|
|
48
|
+
placement: "floating",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
} catch {
|
|
52
|
+
/* Storage may be unavailable. The default dock remains usable. */
|
|
53
|
+
}
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const useWorkbenchSurfaceStore = create<{
|
|
58
|
+
surfaces: Record<string, WorkbenchSurfaceState>;
|
|
59
|
+
visibleSurfaceIds: string[];
|
|
60
|
+
}>()(
|
|
61
|
+
persist(
|
|
62
|
+
() => ({ surfaces: initialSurfaces(), visibleSurfaceIds: [] as string[] }),
|
|
63
|
+
{
|
|
64
|
+
name: "nextclaw.workbench.layout",
|
|
65
|
+
version: 1,
|
|
66
|
+
storage: createJSONStorage(() => new ViewMemoryStorage()),
|
|
67
|
+
partialize: ({ surfaces }) => ({
|
|
68
|
+
surfaces: Object.fromEntries(
|
|
69
|
+
Object.entries(surfaces)
|
|
70
|
+
.slice(-64)
|
|
71
|
+
.map(([id, state]) => [
|
|
72
|
+
id,
|
|
73
|
+
{ ...state, minimized: false, maximized: false, layer: 0 },
|
|
74
|
+
]),
|
|
75
|
+
),
|
|
76
|
+
}),
|
|
77
|
+
merge: (persisted, current) => ({
|
|
78
|
+
...current,
|
|
79
|
+
surfaces: { ...current.surfaces, ...restoreSurfaces(persisted) },
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
),
|
|
83
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type WorkbenchPlacement = "docked" | "floating";
|
|
2
|
+
export type WorkbenchRect = { x: number; y: number; w: number; h: number };
|
|
3
|
+
export type WorkbenchResizeEdge =
|
|
4
|
+
| "left"
|
|
5
|
+
| "right"
|
|
6
|
+
| "top"
|
|
7
|
+
| "bottom"
|
|
8
|
+
| "top-left"
|
|
9
|
+
| "top-right"
|
|
10
|
+
| "bottom-left"
|
|
11
|
+
| "bottom-right";
|
|
12
|
+
export type WorkbenchViewport = { width: number; height: number };
|
|
13
|
+
|
|
14
|
+
/** Presentation only. Resources, tabs, drafts and execution remain with their domain owners. */
|
|
15
|
+
export type WorkbenchSurfaceState = {
|
|
16
|
+
placement: WorkbenchPlacement;
|
|
17
|
+
minimized: boolean;
|
|
18
|
+
maximized: boolean;
|
|
19
|
+
rect: WorkbenchRect;
|
|
20
|
+
layer: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const GLOBAL_WORKBENCH_SURFACE = "global-resources";
|
|
24
|
+
export const SESSION_WORKBENCH_SURFACE = "floating-conversation";
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_WORKBENCH_SURFACE: WorkbenchSurfaceState = {
|
|
27
|
+
placement: "docked",
|
|
28
|
+
minimized: false,
|
|
29
|
+
maximized: false,
|
|
30
|
+
rect: { x: 80, y: 80, w: 560, h: 640 },
|
|
31
|
+
layer: 0,
|
|
32
|
+
};
|