@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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WorkbenchRect,
|
|
3
|
+
WorkbenchResizeEdge,
|
|
4
|
+
WorkbenchViewport,
|
|
5
|
+
} from "@/shared/components/workbench/types/workbench-surface.types";
|
|
6
|
+
|
|
7
|
+
const MARGIN = 12;
|
|
8
|
+
const clamp = (value: number, min: number, max: number) =>
|
|
9
|
+
Math.max(min, Math.min(max, value));
|
|
10
|
+
|
|
11
|
+
export function constrainWorkbenchRect(
|
|
12
|
+
rect: WorkbenchRect,
|
|
13
|
+
viewport: WorkbenchViewport,
|
|
14
|
+
): WorkbenchRect {
|
|
15
|
+
const maxWidth = Math.max(1, viewport.width - MARGIN * 2);
|
|
16
|
+
const maxHeight = Math.max(1, viewport.height - MARGIN * 2);
|
|
17
|
+
const w = clamp(rect.w, Math.min(320, maxWidth), maxWidth);
|
|
18
|
+
const h = clamp(rect.h, Math.min(240, maxHeight), maxHeight);
|
|
19
|
+
return {
|
|
20
|
+
w,
|
|
21
|
+
h,
|
|
22
|
+
x: clamp(rect.x, MARGIN, viewport.width - w - MARGIN),
|
|
23
|
+
y: clamp(rect.y, MARGIN, viewport.height - h - MARGIN),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function resizeWorkbenchRect(
|
|
28
|
+
rect: WorkbenchRect,
|
|
29
|
+
edge: WorkbenchResizeEdge,
|
|
30
|
+
dx: number,
|
|
31
|
+
dy: number,
|
|
32
|
+
viewport: WorkbenchViewport,
|
|
33
|
+
): WorkbenchRect {
|
|
34
|
+
const parts = edge.split("-");
|
|
35
|
+
const right = rect.x + rect.w;
|
|
36
|
+
const bottom = rect.y + rect.h;
|
|
37
|
+
const x = parts.includes("left")
|
|
38
|
+
? clamp(rect.x + dx, MARGIN, right - Math.min(320, rect.w))
|
|
39
|
+
: rect.x;
|
|
40
|
+
const y = parts.includes("top")
|
|
41
|
+
? clamp(rect.y + dy, MARGIN, bottom - Math.min(240, rect.h))
|
|
42
|
+
: rect.y;
|
|
43
|
+
const w = parts.includes("right") ? rect.w + dx : right - x;
|
|
44
|
+
const h = parts.includes("bottom") ? rect.h + dy : bottom - y;
|
|
45
|
+
return constrainWorkbenchRect({ x, y, w, h }, viewport);
|
|
46
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArrowUpRight,
|
|
3
|
+
Maximize2,
|
|
4
|
+
Minimize2,
|
|
5
|
+
Minus,
|
|
6
|
+
PanelRight,
|
|
7
|
+
PictureInPicture2,
|
|
8
|
+
X,
|
|
9
|
+
} from "lucide-react";
|
|
10
|
+
import { IconActionButton } from "@/shared/components/ui/actions/icon-action-button";
|
|
11
|
+
import { t } from "@/shared/lib/i18n";
|
|
12
|
+
import type { WorkbenchSurfaceState } from "./types/workbench-surface.types";
|
|
13
|
+
|
|
14
|
+
export function WorkbenchSurfaceToolbar({
|
|
15
|
+
state,
|
|
16
|
+
compact,
|
|
17
|
+
onPlace,
|
|
18
|
+
onMinimize,
|
|
19
|
+
onRestore,
|
|
20
|
+
onMaximize,
|
|
21
|
+
onClose,
|
|
22
|
+
closeLabel,
|
|
23
|
+
onOpenMain,
|
|
24
|
+
}: {
|
|
25
|
+
state: WorkbenchSurfaceState;
|
|
26
|
+
compact: boolean;
|
|
27
|
+
onPlace?: () => void;
|
|
28
|
+
onMinimize: () => void;
|
|
29
|
+
onRestore: () => void;
|
|
30
|
+
onMaximize: () => void;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
closeLabel: string;
|
|
33
|
+
onOpenMain?: () => void;
|
|
34
|
+
}) {
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
className="flex shrink-0 items-center gap-0.5"
|
|
38
|
+
data-workbench-actions=""
|
|
39
|
+
>
|
|
40
|
+
{onOpenMain && (
|
|
41
|
+
<IconActionButton
|
|
42
|
+
size="sm"
|
|
43
|
+
icon={<ArrowUpRight className="h-4 w-4" />}
|
|
44
|
+
label={t("workbenchOpenMain")}
|
|
45
|
+
onClick={onOpenMain}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
{!compact && onPlace && (
|
|
49
|
+
<IconActionButton
|
|
50
|
+
size="sm"
|
|
51
|
+
icon={
|
|
52
|
+
state.placement === "floating" ? (
|
|
53
|
+
<PanelRight className="h-4 w-4" />
|
|
54
|
+
) : (
|
|
55
|
+
<PictureInPicture2 className="h-4 w-4" />
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
label={t(
|
|
59
|
+
state.placement === "floating"
|
|
60
|
+
? "workbenchDock"
|
|
61
|
+
: "workbenchFloatGroup",
|
|
62
|
+
)}
|
|
63
|
+
onClick={onPlace}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
|
+
<IconActionButton
|
|
67
|
+
size="sm"
|
|
68
|
+
icon={
|
|
69
|
+
state.minimized ? (
|
|
70
|
+
<Maximize2 className="h-4 w-4" />
|
|
71
|
+
) : (
|
|
72
|
+
<Minus className="h-4 w-4" />
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
label={t(state.minimized ? "workbenchExpand" : "workbenchCollapse")}
|
|
76
|
+
onClick={state.minimized ? onRestore : onMinimize}
|
|
77
|
+
/>
|
|
78
|
+
{!compact && !state.minimized && (
|
|
79
|
+
<IconActionButton
|
|
80
|
+
size="sm"
|
|
81
|
+
icon={
|
|
82
|
+
state.maximized ? (
|
|
83
|
+
<Minimize2 className="h-4 w-4" />
|
|
84
|
+
) : (
|
|
85
|
+
<Maximize2 className="h-4 w-4" />
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
label={t(
|
|
89
|
+
state.maximized ? "workbenchRestoreSize" : "workbenchMaximize",
|
|
90
|
+
)}
|
|
91
|
+
onClick={onMaximize}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
<IconActionButton
|
|
95
|
+
size="sm"
|
|
96
|
+
icon={<X className="h-4 w-4" />}
|
|
97
|
+
label={closeLabel}
|
|
98
|
+
onClick={onClose}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useEffect,
|
|
3
|
+
useRef,
|
|
4
|
+
useState,
|
|
5
|
+
type CSSProperties,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
type PointerEvent as ReactPointerEvent,
|
|
8
|
+
} from "react";
|
|
9
|
+
import { useWorkbenchSurfaceStore } from "./stores/workbench-surface.store";
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_WORKBENCH_SURFACE,
|
|
12
|
+
type WorkbenchResizeEdge,
|
|
13
|
+
} from "./types/workbench-surface.types";
|
|
14
|
+
import type { WorkbenchSurfaceManager } from "./managers/workbench-surface.manager";
|
|
15
|
+
import { WorkbenchSurfaceToolbar } from "./workbench-surface-toolbar";
|
|
16
|
+
import { cn } from "@/shared/lib/utils";
|
|
17
|
+
import { t } from "@/shared/lib/i18n";
|
|
18
|
+
|
|
19
|
+
type WorkbenchSurfaceProps = {
|
|
20
|
+
id: string;
|
|
21
|
+
manager: WorkbenchSurfaceManager;
|
|
22
|
+
title: string;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
navigation?: ReactNode;
|
|
25
|
+
icon?: ReactNode;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
closeLabel?: string;
|
|
28
|
+
onPlace?: () => void;
|
|
29
|
+
onOpenMain?: () => void;
|
|
30
|
+
width?: number;
|
|
31
|
+
minWidth?: number;
|
|
32
|
+
maxWidth?: number;
|
|
33
|
+
onWidthCommit?: (width: number) => void;
|
|
34
|
+
fullscreen?: boolean;
|
|
35
|
+
hidden?: boolean;
|
|
36
|
+
testId?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
focusOnOpen?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const EDGE_CLASSES: Record<WorkbenchResizeEdge, string> = {
|
|
42
|
+
left: "left-0 top-3 bottom-3 w-1.5 cursor-ew-resize",
|
|
43
|
+
right: "right-0 top-3 bottom-3 w-1.5 cursor-ew-resize",
|
|
44
|
+
top: "top-0 left-3 right-3 h-1.5 cursor-ns-resize",
|
|
45
|
+
bottom: "bottom-0 left-3 right-3 h-1.5 cursor-ns-resize",
|
|
46
|
+
"top-left": "left-0 top-0 h-3 w-3 cursor-nwse-resize",
|
|
47
|
+
"top-right": "right-0 top-0 h-3 w-3 cursor-nesw-resize",
|
|
48
|
+
"bottom-left": "left-0 bottom-0 h-3 w-3 cursor-nesw-resize",
|
|
49
|
+
"bottom-right": "right-0 bottom-0 h-3 w-3 cursor-nwse-resize",
|
|
50
|
+
};
|
|
51
|
+
const viewport = () => ({
|
|
52
|
+
width: window.innerWidth,
|
|
53
|
+
height: window.innerHeight,
|
|
54
|
+
});
|
|
55
|
+
const blocksDrag = (target: EventTarget | null) =>
|
|
56
|
+
target instanceof Element &&
|
|
57
|
+
Boolean(
|
|
58
|
+
target.closest(
|
|
59
|
+
'button, a, input, textarea, select, [role="menu"], [data-compact-tab-item]',
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
/** One stable DOM parent across dock/float/maximize/collapse. Content never owns window mechanics. */
|
|
64
|
+
export function WorkbenchSurface({
|
|
65
|
+
id,
|
|
66
|
+
manager,
|
|
67
|
+
title,
|
|
68
|
+
icon,
|
|
69
|
+
navigation,
|
|
70
|
+
children,
|
|
71
|
+
onClose,
|
|
72
|
+
closeLabel = t("workbenchCloseView"),
|
|
73
|
+
onPlace,
|
|
74
|
+
onOpenMain,
|
|
75
|
+
width = 480,
|
|
76
|
+
minWidth = 320,
|
|
77
|
+
maxWidth = 960,
|
|
78
|
+
onWidthCommit,
|
|
79
|
+
fullscreen = false,
|
|
80
|
+
hidden = false,
|
|
81
|
+
testId,
|
|
82
|
+
className,
|
|
83
|
+
focusOnOpen = false,
|
|
84
|
+
}: WorkbenchSurfaceProps) {
|
|
85
|
+
const state = useWorkbenchSurfaceStore(
|
|
86
|
+
(store) => store.surfaces[id] ?? DEFAULT_WORKBENCH_SURFACE,
|
|
87
|
+
);
|
|
88
|
+
const panelRef = useRef<HTMLElement>(null);
|
|
89
|
+
const interactionCleanup = useRef<(() => void) | null>(null);
|
|
90
|
+
const openerRef = useRef<HTMLElement | null>(null);
|
|
91
|
+
const [compact, setCompact] = useState(() => window.innerWidth < 768);
|
|
92
|
+
const [interacting, setInteracting] = useState(false);
|
|
93
|
+
const [dragWidth, setDragWidth] = useState<number | null>(null);
|
|
94
|
+
const isCompact = compact || fullscreen;
|
|
95
|
+
const floating = state.placement === "floating";
|
|
96
|
+
const overlay = isCompact || state.maximized;
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
openerRef.current =
|
|
100
|
+
document.activeElement instanceof HTMLElement
|
|
101
|
+
? document.activeElement
|
|
102
|
+
: null;
|
|
103
|
+
if (focusOnOpen) panelRef.current?.focus();
|
|
104
|
+
const onResize = () => {
|
|
105
|
+
setCompact(window.innerWidth < 768);
|
|
106
|
+
manager.constrain(id, viewport());
|
|
107
|
+
};
|
|
108
|
+
onResize();
|
|
109
|
+
window.addEventListener("resize", onResize);
|
|
110
|
+
return () => {
|
|
111
|
+
window.removeEventListener("resize", onResize);
|
|
112
|
+
interactionCleanup.current?.();
|
|
113
|
+
};
|
|
114
|
+
}, [id, manager, focusOnOpen]);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
manager.setVisible(id, !hidden);
|
|
118
|
+
return () => manager.setVisible(id, false);
|
|
119
|
+
}, [hidden, id, manager]);
|
|
120
|
+
|
|
121
|
+
const focusControl = () => panelRef.current?.focus();
|
|
122
|
+
const close = () => {
|
|
123
|
+
onClose();
|
|
124
|
+
if (
|
|
125
|
+
openerRef.current?.isConnected &&
|
|
126
|
+
!panelRef.current?.contains(openerRef.current)
|
|
127
|
+
)
|
|
128
|
+
openerRef.current.focus();
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const startInteraction = (
|
|
132
|
+
event: ReactPointerEvent<HTMLElement>,
|
|
133
|
+
edge?: WorkbenchResizeEdge | "dock",
|
|
134
|
+
) => {
|
|
135
|
+
if (
|
|
136
|
+
event.button !== 0 ||
|
|
137
|
+
overlay ||
|
|
138
|
+
state.minimized ||
|
|
139
|
+
(!edge && blocksDrag(event.target))
|
|
140
|
+
)
|
|
141
|
+
return;
|
|
142
|
+
if (!edge && !floating) return;
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
146
|
+
interactionCleanup.current?.();
|
|
147
|
+
manager.focus(id);
|
|
148
|
+
setInteracting(true);
|
|
149
|
+
const start = {
|
|
150
|
+
x: event.clientX,
|
|
151
|
+
y: event.clientY,
|
|
152
|
+
rect: state.rect,
|
|
153
|
+
width,
|
|
154
|
+
};
|
|
155
|
+
let nextWidth = width;
|
|
156
|
+
const move = (next: PointerEvent) => {
|
|
157
|
+
const dx = next.clientX - start.x;
|
|
158
|
+
const dy = next.clientY - start.y;
|
|
159
|
+
if (edge === "dock") {
|
|
160
|
+
nextWidth = Math.max(
|
|
161
|
+
Math.min(minWidth, window.innerWidth),
|
|
162
|
+
Math.min(maxWidth, window.innerWidth, start.width - dx),
|
|
163
|
+
);
|
|
164
|
+
setDragWidth(nextWidth);
|
|
165
|
+
} else if (edge) manager.resize(id, start.rect, edge, dx, dy, viewport());
|
|
166
|
+
else manager.move(id, start.rect, dx, dy, viewport());
|
|
167
|
+
};
|
|
168
|
+
const cleanup = () => {
|
|
169
|
+
window.removeEventListener("pointermove", move);
|
|
170
|
+
window.removeEventListener("pointerup", end);
|
|
171
|
+
window.removeEventListener("pointercancel", end);
|
|
172
|
+
};
|
|
173
|
+
const end = () => {
|
|
174
|
+
cleanup();
|
|
175
|
+
interactionCleanup.current = null;
|
|
176
|
+
setInteracting(false);
|
|
177
|
+
setDragWidth(null);
|
|
178
|
+
if (edge === "dock") onWidthCommit?.(nextWidth);
|
|
179
|
+
};
|
|
180
|
+
interactionCleanup.current = cleanup;
|
|
181
|
+
window.addEventListener("pointermove", move);
|
|
182
|
+
window.addEventListener("pointerup", end);
|
|
183
|
+
window.addEventListener("pointercancel", end);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const minimizedIndex = useWorkbenchSurfaceStore((store) =>
|
|
187
|
+
store.visibleSurfaceIds
|
|
188
|
+
.filter((key) => store.surfaces[key]?.minimized)
|
|
189
|
+
.sort()
|
|
190
|
+
.indexOf(id),
|
|
191
|
+
);
|
|
192
|
+
const layer = useWorkbenchSurfaceStore(
|
|
193
|
+
(store) =>
|
|
194
|
+
store.visibleSurfaceIds.filter(
|
|
195
|
+
(key) => (store.surfaces[key]?.layer ?? 0) <= state.layer,
|
|
196
|
+
).length,
|
|
197
|
+
);
|
|
198
|
+
const style: CSSProperties = state.minimized
|
|
199
|
+
? {
|
|
200
|
+
position: "fixed",
|
|
201
|
+
bottom: 12 + Math.max(0, minimizedIndex) * 48,
|
|
202
|
+
right: 12,
|
|
203
|
+
width: "min(360px, calc(100vw - 24px))",
|
|
204
|
+
zIndex: 50 + layer,
|
|
205
|
+
}
|
|
206
|
+
: overlay
|
|
207
|
+
? {
|
|
208
|
+
position: "fixed",
|
|
209
|
+
inset: 0,
|
|
210
|
+
width: "100%",
|
|
211
|
+
height: "100dvh",
|
|
212
|
+
zIndex: 50 + layer,
|
|
213
|
+
}
|
|
214
|
+
: floating
|
|
215
|
+
? {
|
|
216
|
+
position: "fixed",
|
|
217
|
+
left: state.rect.x,
|
|
218
|
+
top: state.rect.y,
|
|
219
|
+
width: state.rect.w,
|
|
220
|
+
height: state.rect.h,
|
|
221
|
+
zIndex: 50 + layer,
|
|
222
|
+
}
|
|
223
|
+
: { width: dragWidth ?? width, height: "100%" };
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<aside
|
|
227
|
+
ref={panelRef}
|
|
228
|
+
role="region"
|
|
229
|
+
aria-label={title}
|
|
230
|
+
tabIndex={-1}
|
|
231
|
+
hidden={hidden}
|
|
232
|
+
data-testid={testId}
|
|
233
|
+
data-workbench-surface={id}
|
|
234
|
+
data-placement={state.placement}
|
|
235
|
+
data-maximized={state.maximized || undefined}
|
|
236
|
+
data-minimized={state.minimized || undefined}
|
|
237
|
+
data-theme-surface="workspace-panel"
|
|
238
|
+
className={cn(
|
|
239
|
+
"relative min-h-0 min-w-0 shrink-0 flex-col overflow-hidden bg-card text-card-foreground outline-none",
|
|
240
|
+
hidden ? "hidden" : "flex",
|
|
241
|
+
(floating || state.minimized) && !overlay
|
|
242
|
+
? "rounded-xl border border-border shadow-2xl"
|
|
243
|
+
: "border-l border-border",
|
|
244
|
+
className,
|
|
245
|
+
)}
|
|
246
|
+
style={style}
|
|
247
|
+
onPointerDownCapture={() => manager.focus(id)}
|
|
248
|
+
onFocusCapture={() => manager.focus(id)}
|
|
249
|
+
onKeyDown={(event) => {
|
|
250
|
+
if (
|
|
251
|
+
event.key !== "Escape" ||
|
|
252
|
+
event.defaultPrevented ||
|
|
253
|
+
event.nativeEvent.isComposing
|
|
254
|
+
)
|
|
255
|
+
return;
|
|
256
|
+
if (state.maximized) {
|
|
257
|
+
event.stopPropagation();
|
|
258
|
+
manager.toggleMaximize(id);
|
|
259
|
+
focusControl();
|
|
260
|
+
} else if (floating && !state.minimized) {
|
|
261
|
+
event.stopPropagation();
|
|
262
|
+
manager.minimize(id);
|
|
263
|
+
focusControl();
|
|
264
|
+
}
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<header
|
|
268
|
+
className="flex min-h-10 shrink-0 select-none items-center gap-2 border-b border-border/60 bg-muted/30 px-2"
|
|
269
|
+
style={{ touchAction: floating ? "none" : undefined }}
|
|
270
|
+
onPointerDown={(event) => startInteraction(event)}
|
|
271
|
+
onDoubleClick={(event) => {
|
|
272
|
+
if (!isCompact && !blocksDrag(event.target))
|
|
273
|
+
manager.toggleMaximize(id);
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<div
|
|
277
|
+
hidden={state.minimized}
|
|
278
|
+
className={cn(
|
|
279
|
+
"min-w-0 flex-1",
|
|
280
|
+
state.minimized || !navigation ? "hidden" : "flex",
|
|
281
|
+
)}
|
|
282
|
+
>
|
|
283
|
+
{navigation}
|
|
284
|
+
</div>
|
|
285
|
+
<span
|
|
286
|
+
className={cn(
|
|
287
|
+
"flex min-w-0 flex-1 items-center gap-2 px-1 text-xs font-medium",
|
|
288
|
+
floating && !overlay && "cursor-grab active:cursor-grabbing",
|
|
289
|
+
navigation && !state.minimized && "hidden",
|
|
290
|
+
)}
|
|
291
|
+
>
|
|
292
|
+
{icon}
|
|
293
|
+
<span className="truncate">{title}</span>
|
|
294
|
+
</span>
|
|
295
|
+
<WorkbenchSurfaceToolbar
|
|
296
|
+
state={state}
|
|
297
|
+
compact={isCompact}
|
|
298
|
+
onPlace={
|
|
299
|
+
onPlace ??
|
|
300
|
+
(() => manager.place(id, floating ? "docked" : "floating"))
|
|
301
|
+
}
|
|
302
|
+
onMinimize={() => {
|
|
303
|
+
manager.minimize(id);
|
|
304
|
+
focusControl();
|
|
305
|
+
}}
|
|
306
|
+
onRestore={() => manager.restore(id)}
|
|
307
|
+
onMaximize={() => manager.toggleMaximize(id)}
|
|
308
|
+
onClose={close}
|
|
309
|
+
closeLabel={closeLabel}
|
|
310
|
+
onOpenMain={onOpenMain}
|
|
311
|
+
/>
|
|
312
|
+
</header>
|
|
313
|
+
<div
|
|
314
|
+
hidden={state.minimized}
|
|
315
|
+
className={cn(
|
|
316
|
+
"min-h-0 min-w-0 flex-1 flex-col",
|
|
317
|
+
state.minimized ? "hidden" : "flex",
|
|
318
|
+
)}
|
|
319
|
+
>
|
|
320
|
+
{children}
|
|
321
|
+
</div>
|
|
322
|
+
{!overlay && !state.minimized && (
|
|
323
|
+
<WorkbenchResizeHandles
|
|
324
|
+
floating={floating}
|
|
325
|
+
width={dragWidth ?? width}
|
|
326
|
+
minWidth={minWidth}
|
|
327
|
+
maxWidth={maxWidth}
|
|
328
|
+
onWidthCommit={onWidthCommit}
|
|
329
|
+
onPointerDown={startInteraction}
|
|
330
|
+
/>
|
|
331
|
+
)}
|
|
332
|
+
{interacting && (
|
|
333
|
+
<div
|
|
334
|
+
className="fixed inset-0 z-30"
|
|
335
|
+
data-workbench-interaction-shield=""
|
|
336
|
+
/>
|
|
337
|
+
)}
|
|
338
|
+
</aside>
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function WorkbenchResizeHandles({
|
|
343
|
+
floating,
|
|
344
|
+
width,
|
|
345
|
+
minWidth,
|
|
346
|
+
maxWidth,
|
|
347
|
+
onWidthCommit,
|
|
348
|
+
onPointerDown,
|
|
349
|
+
}: {
|
|
350
|
+
floating: boolean;
|
|
351
|
+
width: number;
|
|
352
|
+
minWidth: number;
|
|
353
|
+
maxWidth: number;
|
|
354
|
+
onWidthCommit?: (width: number) => void;
|
|
355
|
+
onPointerDown: (
|
|
356
|
+
event: ReactPointerEvent<HTMLElement>,
|
|
357
|
+
edge: WorkbenchResizeEdge | "dock",
|
|
358
|
+
) => void;
|
|
359
|
+
}) {
|
|
360
|
+
return floating ? (
|
|
361
|
+
<>
|
|
362
|
+
{(Object.entries(EDGE_CLASSES) as [WorkbenchResizeEdge, string][]).map(
|
|
363
|
+
([edge, classes]) => (
|
|
364
|
+
<div
|
|
365
|
+
key={edge}
|
|
366
|
+
data-workbench-resize={edge}
|
|
367
|
+
className={cn("absolute z-20 touch-none", classes)}
|
|
368
|
+
onPointerDown={(event) => onPointerDown(event, edge)}
|
|
369
|
+
/>
|
|
370
|
+
),
|
|
371
|
+
)}
|
|
372
|
+
</>
|
|
373
|
+
) : onWidthCommit ? (
|
|
374
|
+
<div
|
|
375
|
+
role="separator"
|
|
376
|
+
aria-label={t("workbenchResize")}
|
|
377
|
+
aria-orientation="vertical"
|
|
378
|
+
aria-valuemin={minWidth}
|
|
379
|
+
aria-valuemax={maxWidth}
|
|
380
|
+
aria-valuenow={width}
|
|
381
|
+
tabIndex={0}
|
|
382
|
+
data-testid="resizable-right-panel-handle"
|
|
383
|
+
className="absolute bottom-0 left-0 top-0 z-20 w-1.5 cursor-ew-resize touch-none hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none"
|
|
384
|
+
onPointerDown={(event) => onPointerDown(event, "dock")}
|
|
385
|
+
onKeyDown={(event) => {
|
|
386
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key))
|
|
387
|
+
return;
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
const next =
|
|
390
|
+
event.key === "Home"
|
|
391
|
+
? minWidth
|
|
392
|
+
: event.key === "End"
|
|
393
|
+
? maxWidth
|
|
394
|
+
: width + (event.key === "ArrowLeft" ? 24 : -24);
|
|
395
|
+
onWidthCommit(
|
|
396
|
+
Math.max(minWidth, Math.min(maxWidth, window.innerWidth, next)),
|
|
397
|
+
);
|
|
398
|
+
}}
|
|
399
|
+
/>
|
|
400
|
+
) : null;
|
|
401
|
+
}
|
|
@@ -64,3 +64,22 @@ describe("usePanelAppScrollRestoration", () => {
|
|
|
64
64
|
expect(postMessage).not.toHaveBeenCalled();
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
it("keeps independent URL positions when navigating A to B and back to A", () => {
|
|
69
|
+
scrollRestorationManager.clear();
|
|
70
|
+
const view = render(<PanelAppFrame currentUrl="/a" />);
|
|
71
|
+
const frame = view.getByTestId('panel-app-frame') as HTMLIFrameElement;
|
|
72
|
+
const post = vi.spyOn(frame.contentWindow!, 'postMessage');
|
|
73
|
+
const record = (y: number) => window.dispatchEvent(new MessageEvent('message', {
|
|
74
|
+
source: frame.contentWindow, data: { type: PANEL_APP_SCROLL_RESTORATION_CONTRACT.scrollMessageType, version: PANEL_APP_SCROLL_RESTORATION_CONTRACT.version, target: { kind: 'document' }, x: 0, y },
|
|
75
|
+
}));
|
|
76
|
+
record(400);
|
|
77
|
+
view.rerender(<PanelAppFrame currentUrl="/b" />);
|
|
78
|
+
record(80);
|
|
79
|
+
view.rerender(<PanelAppFrame currentUrl="/a" />);
|
|
80
|
+
fireEvent.load(frame);
|
|
81
|
+
expect(post).toHaveBeenLastCalledWith(expect.objectContaining({ y: 400 }), '*');
|
|
82
|
+
view.rerender(<PanelAppFrame currentUrl="/b" />);
|
|
83
|
+
fireEvent.load(frame);
|
|
84
|
+
expect(post).toHaveBeenLastCalledWith(expect.objectContaining({ y: 80 }), '*');
|
|
85
|
+
});
|
|
@@ -74,13 +74,15 @@ export function usePanelAppScrollRestoration({
|
|
|
74
74
|
isEnabled,
|
|
75
75
|
restorationKey,
|
|
76
76
|
}: UsePanelAppScrollRestorationParams) {
|
|
77
|
+
const routeKey = restorationKey && currentUrl ? JSON.stringify([restorationKey, currentUrl]) : null;
|
|
77
78
|
useEffect(() => {
|
|
78
|
-
if (!currentUrl || !isEnabled || !
|
|
79
|
+
if (!currentUrl || !isEnabled || !routeKey) return;
|
|
80
|
+
const key = routeKey;
|
|
79
81
|
const onMessage = (event: MessageEvent) => {
|
|
80
82
|
if (event.source !== iframeRef.current?.contentWindow || !isScrollMessage(event.data)) {
|
|
81
83
|
return;
|
|
82
84
|
}
|
|
83
|
-
scrollRestorationManager.save(
|
|
85
|
+
scrollRestorationManager.save(key, {
|
|
84
86
|
x: event.data.x,
|
|
85
87
|
y: event.data.y,
|
|
86
88
|
payload: { currentUrl, target: event.data.target } satisfies PanelAppScrollSnapshot,
|
|
@@ -88,11 +90,11 @@ export function usePanelAppScrollRestoration({
|
|
|
88
90
|
};
|
|
89
91
|
window.addEventListener("message", onMessage);
|
|
90
92
|
return () => window.removeEventListener("message", onMessage);
|
|
91
|
-
}, [currentUrl, iframeRef, isEnabled,
|
|
93
|
+
}, [currentUrl, iframeRef, isEnabled, routeKey]);
|
|
92
94
|
|
|
93
95
|
return useCallback(() => {
|
|
94
|
-
if (!currentUrl || !isEnabled || !
|
|
95
|
-
const position = scrollRestorationManager.read(
|
|
96
|
+
if (!currentUrl || !isEnabled || !routeKey) return;
|
|
97
|
+
const position = scrollRestorationManager.read(routeKey);
|
|
96
98
|
if (!position || !isPanelAppScrollSnapshot(position.payload) || position.payload.currentUrl !== currentUrl) {
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
@@ -103,5 +105,5 @@ export function usePanelAppScrollRestoration({
|
|
|
103
105
|
x: position.x,
|
|
104
106
|
y: position.y,
|
|
105
107
|
}, "*");
|
|
106
|
-
}, [currentUrl, iframeRef, isEnabled,
|
|
108
|
+
}, [currentUrl, iframeRef, isEnabled, routeKey]);
|
|
107
109
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fireEvent, render } from "@testing-library/react";
|
|
2
|
-
import { beforeEach, describe, expect, it } from "vitest";
|
|
1
|
+
import { act, fireEvent, render } from "@testing-library/react";
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
3
|
import { useScrollRestoration } from "@/shared/hooks/use-scroll-restoration";
|
|
4
4
|
import { scrollRestorationManager } from "@/shared/lib/navigation-history";
|
|
5
5
|
|
|
@@ -60,3 +60,40 @@ describe("useScrollRestoration", () => {
|
|
|
60
60
|
expect(scrollRestorationManager.read("page:first")).toEqual({ x: 0, y: 144 });
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
+
|
|
64
|
+
it("retries delayed content, preserves hidden reading, and yields to explicit user scrolling", () => {
|
|
65
|
+
scrollRestorationManager.clear();
|
|
66
|
+
let notifyResize = () => {};
|
|
67
|
+
vi.stubGlobal("ResizeObserver", class { constructor(callback: () => void) { notifyResize = callback; } observe = () => {}; disconnect = () => {}; });
|
|
68
|
+
let height = 0;
|
|
69
|
+
let position = 0;
|
|
70
|
+
const descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, "scrollTop");
|
|
71
|
+
Object.defineProperty(HTMLElement.prototype, "scrollTop", { configurable: true, get: () => position, set: (value: number) => { position = Math.min(value, height); } });
|
|
72
|
+
try {
|
|
73
|
+
scrollRestorationManager.save("delayed", { x: 0, y: 400 });
|
|
74
|
+
const view = render(<ScrollSurface restorationKey="delayed" />);
|
|
75
|
+
const element = view.getByTestId("scroll-surface");
|
|
76
|
+
fireEvent.scroll(element);
|
|
77
|
+
expect(scrollRestorationManager.read("delayed")?.y).toBe(400);
|
|
78
|
+
height = 800;
|
|
79
|
+
act(() => notifyResize());
|
|
80
|
+
expect(element.scrollTop).toBe(400);
|
|
81
|
+
element.hidden = true;
|
|
82
|
+
element.scrollTop = 0;
|
|
83
|
+
fireEvent.scroll(element);
|
|
84
|
+
expect(scrollRestorationManager.read("delayed")?.y).toBe(400);
|
|
85
|
+
view.unmount();
|
|
86
|
+
|
|
87
|
+
height = 0;
|
|
88
|
+
const second = render(<ScrollSurface restorationKey="delayed" />);
|
|
89
|
+
fireEvent.wheel(second.getByTestId("scroll-surface"));
|
|
90
|
+
height = 800;
|
|
91
|
+
act(() => notifyResize());
|
|
92
|
+
expect(second.getByTestId("scroll-surface").scrollTop).toBe(0);
|
|
93
|
+
second.unmount();
|
|
94
|
+
} finally {
|
|
95
|
+
if (descriptor) Object.defineProperty(HTMLElement.prototype, "scrollTop", descriptor);
|
|
96
|
+
else Reflect.deleteProperty(HTMLElement.prototype, "scrollTop");
|
|
97
|
+
vi.unstubAllGlobals();
|
|
98
|
+
}
|
|
99
|
+
});
|