@kabmo-labs/kabmo 0.43.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +337 -337
- package/dist/client/static/js/{CsvGrid-g67pk2zy.js → CsvGrid-z74weshk.js} +2 -2
- package/dist/client/static/js/{DocxView-pyh6p2kb.js → DocxView-dpe5x9ab.js} +5 -5
- package/dist/client/static/js/{DrawioView-g48r6y2m.js → DrawioView-ftzwjf8v.js} +2 -2
- package/dist/client/static/js/ImageView-vchn6wyq.js +1 -0
- package/dist/client/static/js/LayoutWrapper-1x0gnppc.js +2 -0
- package/dist/client/static/js/{Modal-edw446r8.js → Modal-tteg7vtb.js} +20 -20
- package/dist/client/static/js/{PdfView-6z3cgj37.js → PdfView-vjec8z3z.js} +1 -1
- package/dist/client/static/js/SessionsView-g7z3fxbp.js +1 -0
- package/dist/client/static/js/{SheetView-64076z1j.js → SheetView-hhtfkdhe.js} +25 -25
- package/dist/client/static/js/{SvgPreview-dmpgavgd.js → SvgPreview-48n3ex6p.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-nfz5z1vw.js → abnfDiagram-O67JEVCF-bpvzdara.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-jra2jyzw.js → architectureDiagram-NJMV4G6O-xw62cr7j.js} +11 -11
- package/dist/client/static/js/{astro-dpfdhc5e.js → astro-56b0as3q.js} +1 -1
- package/dist/client/static/js/bash-mevzaywf.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-3szktxam.js → blockDiagram-BEXU5L5S-x3a6cgar.js} +6 -6
- package/dist/client/static/js/c-y1y6v00q.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-xe9vbppt.js → c4Diagram-YGBWAQC7-katvaxbj.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-egzhj1xn.js → classDiagram-v2-NBCMYWYE-bjz4mqqh.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-dfrk1wnr.js → cose-bilkent-JH36ORCC-fsn80psf.js} +1 -1
- package/dist/client/static/js/cpp-wk9z0c5g.js +1 -0
- package/dist/client/static/js/css-3w3p9s67.js +1 -0
- package/dist/client/static/js/css-g85rwzty.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-xefpcmpg.js → cynefinDiagram-VND7K2PF-cfhbsnkm.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-vtzjnrt9.js → dagre-6A5THRUB-j2wt7ns6.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-4vvn790v.js → diagram-22UHCM2B-abrdj714.js} +21 -21
- package/dist/client/static/js/{diagram-3UASUU5V-tmht3bew.js → diagram-3UASUU5V-dbn15bxn.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-p5wa5ztx.js → diagram-ATOU4E4O-y79pwf7w.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-8myesjfc.js → diagram-CDSNMT55-f8ryt86n.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-9t3x2d5f.js → diagram-MLGK6HIB-ws7wn3q9.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-8ahgnmhy.js → diagram-MPIPVDR6-zmznrg13.js} +2 -2
- package/dist/client/static/js/{dockerfile-x8aa0543.js → dockerfile-qgc921kw.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5semw111.js → ebnfDiagram-ZINNZB2B-y5q7hy1v.js} +1 -1
- package/dist/client/static/js/{elixir-5ewfhvfh.js → elixir-12pgbgtq.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-jmhs58ww.js → elk-276RUBZZ-vddwbn6q.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-31wvbpdr.js → erDiagram-OPXOYQCR-qdqcx4g4.js} +6 -6
- package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-811btv6p.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nh2tb65b.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-c2dycjrf.js → ganttDiagram-FUAMR5RP-763hk9rm.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y4k4pdd8.js → gitGraphDiagram-X574FWY7-bgx1q5nw.js} +10 -10
- package/dist/client/static/js/graphql-027z8sc0.js +1 -0
- package/dist/client/static/js/html-fqda6wxx.js +1 -0
- package/dist/client/static/js/{index-38v0781h.js → index-03j5j1j0.js} +2 -2
- package/dist/client/static/js/{index-3588r3wg.js → index-05hx4ftf.js} +2 -2
- package/dist/client/static/js/index-0vk6v4y4.js +2 -0
- package/dist/client/static/js/{index-7dp90ad1.js → index-1nwwvv29.js} +2 -2
- package/dist/client/static/js/{index-aar68x31.js → index-228yzebd.js} +5 -5
- package/dist/client/static/js/{index-xf36nmbm.js → index-2b1wnvez.js} +2 -2
- package/dist/client/static/js/index-34ff2vq6.js +2 -0
- package/dist/client/static/js/{index-6fpd55cq.js → index-3d21hpk7.js} +2 -2
- package/dist/client/static/js/{index-181p91hf.js → index-3h2mr90j.js} +2 -2
- package/dist/client/static/js/{index-efra065v.js → index-3sqndc9n.js} +2 -2
- package/dist/client/static/js/{index-kc5znr75.js → index-47wn2gjx.js} +2 -2
- package/dist/client/static/js/{index-nt7nhchn.js → index-4b5b6g0k.js} +1 -1
- package/dist/client/static/js/index-5b2vsbcf.js +1 -0
- package/dist/client/static/js/index-5mrqfs82.js +12 -0
- package/dist/client/static/js/{index-m94f4ngb.js → index-61j9qkck.js} +3 -3
- package/dist/client/static/js/index-6bm4pw90.css +1 -0
- package/dist/client/static/js/{index-qhytrsyb.js → index-6sqmhdyv.js} +2 -2
- package/dist/client/static/js/{index-jz93j0at.js → index-8dtp7mt0.js} +2 -2
- package/dist/client/static/js/index-a11ptyzf.js +1 -0
- package/dist/client/static/js/index-acphtw1r.js +2 -0
- package/dist/client/static/js/{index-s78n0dtv.js → index-as1wptfa.js} +2 -2
- package/dist/client/static/js/index-cj39b26c.js +1 -0
- package/dist/client/static/js/index-dgjerk4w.js +3 -0
- package/dist/client/static/js/{index-sesghshh.js → index-dmv2zasz.js} +2 -2
- package/dist/client/static/js/index-dn6pqym4.js +9 -0
- package/dist/client/static/js/{index-ynaxep06.js → index-ehg2ftnp.js} +2 -2
- package/dist/client/static/js/{index-e7yf273s.js → index-f51jxezc.js} +2 -2
- package/dist/client/static/js/index-f7paep2f.js +2 -0
- package/dist/client/static/js/index-f98dhbt4.js +4 -0
- package/dist/client/static/js/{index-ys0xpw3q.js → index-fbct0jcf.js} +2 -2
- package/dist/client/static/js/index-fqatn0vh.js +1 -0
- package/dist/client/static/js/{index-bvjct7sp.js → index-gcwmpfr4.js} +2 -2
- package/dist/client/static/js/{index-cgzw43bc.js → index-gmq5pbcv.js} +67 -67
- package/dist/client/static/js/{index-q81rxwh7.js → index-gzafyqsr.js} +43 -43
- package/dist/client/static/js/{index-gmnmnfm0.js → index-gzp4j2h5.js} +2 -2
- package/dist/client/static/js/{index-cjhvtzdd.js → index-h0rmkz9n.js} +2 -2
- package/dist/client/static/js/{index-sk9ej289.js → index-jaqjvk22.js} +2 -2
- package/dist/client/static/js/{index-pt8440xh.js → index-jpp0zm7t.js} +15 -15
- package/dist/client/static/js/index-kg2sk8cf.js +1 -0
- package/dist/client/static/js/index-mrw7qweg.js +1 -0
- package/dist/client/static/js/index-mwm8aptp.js +1 -0
- package/dist/client/static/js/{index-yvgbr7ek.js → index-n1ga63de.js} +2 -2
- package/dist/client/static/js/{index-cqnpsw2m.js → index-nzhwd6t3.js} +2 -2
- package/dist/client/static/js/{index-vyw4tbn8.js → index-p21mvqc2.js} +2 -2
- package/dist/client/static/js/{index-fjnkzk12.js → index-pfj3sd1n.js} +3 -3
- package/dist/client/static/js/{index-fg965t62.js → index-pxq4v81r.js} +2 -2
- package/dist/client/static/js/index-q76jfb54.js +1 -0
- package/dist/client/static/js/{index-m9s9rg5k.js → index-qt9jc4ck.js} +2 -2
- package/dist/client/static/js/{index-48pb18zj.js → index-r6e44vkx.js} +2 -2
- package/dist/client/static/js/{index-2cbnjc32.js → index-szk3vk8h.js} +2 -2
- package/dist/client/static/js/{index-ycks7gyg.js → index-t0yv1375.js} +2 -2
- package/dist/client/static/js/{index-0c6vpk89.js → index-vgcm2g0g.js} +2 -2
- package/dist/client/static/js/{index-f7djda1g.js → index-vkerrwpa.js} +2 -2
- package/dist/client/static/js/{index-dkwhs38j.js → index-w57zbym7.js} +2 -2
- package/dist/client/static/js/{index-n9scbxy5.js → index-wqrdgt1g.js} +2 -2
- package/dist/client/static/js/{index-j17h4z6f.js → index-x2wvq4ae.js} +2 -2
- package/dist/client/static/js/{index-2b46dzw8.js → index-x7rfmwg8.js} +4 -4
- package/dist/client/static/js/{index-f77c3ag0.js → index-xkwybnf3.js} +200 -200
- package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-z3pqx7w8.js → infoDiagram-VRGFBTTK-e66pw8d9.js} +1 -1
- package/dist/client/static/js/ini-3cx6tmv4.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-f5v6z8yr.js → ishikawaDiagram-OU5B5YK6-ehc0q24d.js} +3 -3
- package/dist/client/static/js/java-zs6qh1dm.js +1 -0
- package/dist/client/static/js/javascript-b9mkygak.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-js1yxatk.js → journeyDiagram-ZHPQQLJL-hye05qtd.js} +5 -5
- package/dist/client/static/js/json-qn73s8xb.js +1 -0
- package/dist/client/static/js/jsx-gahhfczw.js +1 -0
- package/dist/client/static/js/{julia-0h9krgsd.js → julia-mgsev9df.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-m0a6069c.js → kanban-definition-PNTS6WVX-vce614m8.js} +7 -7
- package/dist/client/static/js/lua-d8enp14s.js +1 -0
- package/dist/client/static/js/markdown-qetaj4vp.js +1 -0
- package/dist/client/static/js/{mermaid.core-6xvbnm63.js → mermaid.core-gc79re5p.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-a9f9yzc0.js → mindmap-definition-NLK3R4M7-ft1whaf5.js} +3 -3
- package/dist/client/static/js/one-dark-pro-rvg5xm1a.js +1 -0
- package/dist/client/static/js/one-light-2b5w3ksh.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-4v4pf1h1.js → pegDiagram-GJSIUBJH-2s4ykhaa.js} +1 -1
- package/dist/client/static/js/{perl-rptyx23q.js → perl-6n93vjsa.js} +1 -1
- package/dist/client/static/js/{php-sagvq3wz.js → php-w23nmbtc.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-a54yrmfm.js → pieDiagram-5QR66LMP-7h8dp0z3.js} +2 -2
- package/dist/client/static/js/properties-g6tpq003.js +1 -0
- package/dist/client/static/js/python-cy06fzhg.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-1twhvnp2.js → quadrantDiagram-O4NWA36T-pteyxjxr.js} +6 -6
- package/dist/client/static/js/r-vw8berfv.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-83tqfdcy.js → railroadDiagram-XR7U4H2S-68z9wdt0.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-73e3pzw6.js → requirementDiagram-PLB6GJNP-c08nmey6.js} +4 -4
- package/dist/client/static/js/{ruby-9qyx7knh.js → ruby-ag3b3t9t.js} +1 -1
- package/dist/client/static/js/{rust-jds4e4r7.js → rust-ke5ec0w5.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-1bzwj6sb.js → sankeyDiagram-IPEJSGJF-2r3kvjs5.js} +5 -5
- package/dist/client/static/js/{sass-07rteya0.js → sass-x0eez0kp.js} +1 -1
- package/dist/client/static/js/{scss-e2dndbfa.js → scss-qycakpjn.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yh3h988k.js → sequenceDiagram-PO4LG4MO-ctjycd88.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-1n121yp6.js → sizeCapture-INFHLROL-97ndea95.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-0tdrzn06.js → stateDiagram-v2-GCMORJYK-aqnmsb96.js} +5 -5
- package/dist/client/static/js/{svelte-w365cpwa.js → svelte-tg19by0f.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-77n1ttdw.js → swimlanes-2SLR337P-v50cx1nx.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-e227mz39.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-b6r0k3e8.js → timeline-definition-EJHVYXUP-1ggrtdcj.js} +7 -7
- package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +1 -0
- package/dist/client/static/js/tsx-3dzv8h6k.js +1 -0
- package/dist/client/static/js/typescript-44vs0wn4.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-efq58m3m.js → usecaseDiagram-POWQR4AR-ybcwhpzs.js} +39 -39
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-ad4gvd5r.js → vennDiagram-UO4OBE2U-p9ggrt07.js} +8 -8
- package/dist/client/static/js/{vue-d6cesny1.js → vue-mhj4sme0.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-v89tys2p.js → wardleyDiagram-VNRHLVJA-v79nb9kx.js} +4 -4
- package/dist/client/static/js/xml-yvv5fn3k.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-xtgzmknw.js → xychartDiagram-PMCCYNJV-43thqscz.js} +5 -5
- package/dist/client/static/js/yaml-avewh7n5.js +1 -0
- package/marketplace/marketplace.json +7 -0
- package/marketplace/plugins/github-actions/README.md +142 -0
- package/marketplace/plugins/github-actions/icon.svg +12 -0
- package/marketplace/plugins/github-actions/package.json +30 -0
- package/marketplace/plugins/github-actions/settings-schema.json +27 -0
- package/marketplace/plugins/github-actions/src/app.tsx +32 -0
- package/marketplace/plugins/github-actions/src/panel/Actions.tsx +105 -0
- package/marketplace/plugins/github-actions/src/panel/LogView.tsx +76 -0
- package/marketplace/plugins/github-actions/src/panel/Row.tsx +59 -0
- package/marketplace/plugins/github-actions/src/panel/RunView.tsx +197 -0
- package/marketplace/plugins/github-actions/src/panel/format.ts +74 -0
- package/marketplace/plugins/github-actions/src/panel/index.test.tsx +86 -0
- package/marketplace/plugins/github-actions/src/panel/index.tsx +256 -0
- package/marketplace/plugins/github-actions/src/panel/picker.test.tsx +68 -0
- package/marketplace/plugins/github-actions/src/panel/test-fixtures.ts +98 -0
- package/marketplace/plugins/github-actions/src/panel/test-harness.tsx +175 -0
- package/marketplace/plugins/github-actions/src/protocol.ts +156 -0
- package/marketplace/plugins/github-actions/src/server/github.test.ts +264 -0
- package/marketplace/plugins/github-actions/src/server/github.ts +309 -0
- package/marketplace/plugins/github-actions/src/server/http.test.ts +150 -0
- package/marketplace/plugins/github-actions/src/server/http.ts +202 -0
- package/marketplace/plugins/github-actions/src/server/json.ts +44 -0
- package/marketplace/plugins/github-actions/src/server/logtext.test.ts +84 -0
- package/marketplace/plugins/github-actions/src/server/logtext.ts +59 -0
- package/marketplace/plugins/github-actions/src/server/progress.test.ts +96 -0
- package/marketplace/plugins/github-actions/src/server/progress.ts +62 -0
- package/marketplace/plugins/github-actions/src/server/remote.ts +84 -0
- package/marketplace/plugins/github-actions/src/server/scope.ts +51 -0
- package/marketplace/plugins/github-actions/src/server/token.ts +84 -0
- package/marketplace/plugins/github-actions/src/server.ts +163 -0
- package/marketplace/plugins/github-actions/src/state.test.ts +55 -0
- package/marketplace/plugins/github-actions/src/state.ts +63 -0
- package/marketplace/plugins/github-actions/tsconfig.json +16 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/proc/identity.ts +4 -3
- package/package.json +2 -2
- package/src/client/App.tsx +1 -1
- package/src/client/borders.css +143 -0
- package/src/client/components/common/context-usage-button/Ring.tsx +34 -9
- package/src/client/components/common/context-usage-button/index.test.tsx +19 -2
- package/src/client/components/common/context-usage-button/index.tsx +4 -4
- package/src/client/components/common/header-controls/index.test.tsx +26 -59
- package/src/client/components/common/header-controls/index.tsx +41 -52
- package/src/client/components/common/header-controls/phone-row.test.tsx +265 -0
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +25 -3
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +2 -2
- package/src/client/components/layout/LeftDock.tsx +7 -0
- package/src/client/components/layout/desktop-layout/DesktopOverlays.tsx +51 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +117 -15
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +257 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +23 -24
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +50 -78
- package/src/client/components/layout/desktop-layout/index.tsx +73 -73
- package/src/client/components/layout/session-sidebar/Footer.test.tsx +20 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +24 -2
- package/src/client/components/layout/session-sidebar/Header.test.ts +10 -0
- package/src/client/components/layout/session-sidebar/Header.tsx +2 -2
- package/src/client/components/mobile/RightSidebar.tsx +164 -66
- package/src/client/components/mobile/header-titlebar.test.tsx +92 -0
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +2 -3
- package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -10
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +179 -0
- package/src/client/components/mobile/panel-chips.test.tsx +12 -0
- package/src/client/components/mobile/panel-chips.tsx +5 -1
- package/src/client/components/mobile/right-drawer-nav.test.tsx +258 -0
- package/src/client/components/settings/Modal.tsx +14 -9
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +18 -6
- package/src/client/components/settings/SettingsSidebarList.tsx +2 -1
- package/src/client/components/settings/Sidebar.tsx +6 -4
- package/src/client/components/settings/apply-side-effects.test.ts +17 -0
- package/src/client/components/settings/apply-side-effects.ts +32 -5
- package/src/client/components/settings/band-height.test.tsx +122 -0
- package/src/client/components/settings/categories/AppearanceSettings.test.tsx +144 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +81 -39
- package/src/client/components/settings/categories/ChatSettings.tsx +9 -15
- package/src/client/components/settings/categories/UsageSettings.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +101 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +134 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +5 -5
- package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +6 -6
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +288 -0
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/ThemeSection.tsx +42 -0
- package/src/client/components/settings/categories/appearance-settings/TrayIconSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/groups.test.ts +47 -0
- package/src/client/components/settings/categories/appearance-settings/groups.ts +95 -0
- package/src/client/components/settings/categories/chat-settings/LayoutSection.tsx +31 -14
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +2 -1
- package/src/client/components/settings/master-detail/GroupDetail.tsx +38 -0
- package/src/client/components/settings/{categories/chat-settings/SidebarList.tsx → master-detail/GroupSidebar.tsx} +35 -12
- package/src/client/components/settings/master-detail/index.tsx +3 -1
- package/src/client/components/settings/pane-header.ts +25 -0
- package/src/client/components/workspace/browser-toolbar/index.test.tsx +39 -1
- package/src/client/components/workspace/browser-toolbar/index.tsx +53 -17
- package/src/client/components/workspace/chat-timeline/ColumnResizeHandle.tsx +107 -0
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +9 -3
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +35 -26
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/column-resize.test.tsx +292 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +5 -3
- package/src/client/components/workspace/context-panel/index.tsx +10 -4
- package/src/client/components/workspace/editor/EditorHideButton.tsx +41 -0
- package/src/client/components/workspace/editor/EmptyEditor.tsx +11 -2
- package/src/client/components/workspace/editor/PluginColumn.tsx +11 -1
- package/src/client/components/workspace/editor/Tabs.tsx +8 -0
- package/src/client/components/workspace/editor/editor-hide-button.test.ts +144 -0
- package/src/client/components/workspace/editor/index.tsx +8 -2
- package/src/client/components/workspace/editor/props.ts +9 -0
- package/src/client/components/workspace/file-explorer/RowLabel.test.tsx +90 -0
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -4
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +52 -46
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +41 -21
- package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +6 -5
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +19 -22
- package/src/client/components/workspace/panel-header/title-policy.test.tsx +62 -0
- package/src/client/components/workspace/panel-header/title-policy.tsx +83 -0
- package/src/client/components/workspace/panel-tabs/Home.density.test.tsx +122 -0
- package/src/client/components/workspace/panel-tabs/Home.test.tsx +137 -0
- package/src/client/components/workspace/panel-tabs/Home.tsx +118 -0
- package/src/client/components/workspace/panel-tabs/TabChip.tsx +173 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +339 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +302 -0
- package/src/client/components/workspace/panel-tabs/index.tsx +105 -0
- package/src/client/components/workspace/panels/builtin.tsx +9 -0
- package/src/client/components/workspace/plan-panel/index.tsx +7 -2
- package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
- package/src/client/components/workspace/repo-picker/index.test.tsx +32 -8
- package/src/client/components/workspace/repo-picker/index.tsx +2 -2
- package/src/client/components/workspace/search-panel/Body.tsx +7 -1
- package/src/client/components/workspace/search-panel/index.tsx +2 -1
- package/src/client/components/workspace/terminal-panel/Header.tsx +10 -3
- package/src/client/components/workspace/terminal-panel/index.tsx +4 -1
- package/src/client/components/workspace/todo-panel/index.tsx +6 -1
- package/src/client/components/workspace/usage-panel/index.tsx +7 -2
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +43 -4
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +101 -45
- package/src/client/components/workspace/user-browser-panel/TabStrip.tsx +107 -0
- package/src/client/components/workspace/user-browser-panel/index.tsx +31 -6
- package/src/client/glass.test.ts +1 -1
- package/src/client/hooks/browser/use-annotate.ts +6 -5
- package/src/client/hooks/browser/use-user-browser.test.tsx +279 -0
- package/src/client/hooks/browser/use-user-browser.ts +190 -44
- package/src/client/hooks/chat/timeline/column-drag.ts +171 -0
- package/src/client/hooks/chat/timeline/width-mode.test.ts +112 -11
- package/src/client/hooks/chat/timeline/width-mode.ts +91 -18
- package/src/client/hooks/ui/border-style.test.ts +172 -0
- package/src/client/hooks/ui/border-style.ts +60 -0
- package/src/client/hooks/ui/navbar-controls.test.ts +27 -1
- package/src/client/hooks/ui/navbar-controls.ts +95 -20
- package/src/client/hooks/ui/style-attributes.test.ts +2 -0
- package/src/client/hooks/workspace/active-project.ts +46 -0
- package/src/client/hooks/workspace/commit-expansion.test.ts +135 -0
- package/src/client/hooks/workspace/commit-expansion.ts +56 -0
- package/src/client/hooks/workspace/mobile-right-panel-nav.ts +63 -0
- package/src/client/hooks/workspace/panel-nav.test.ts +140 -0
- package/src/client/hooks/workspace/panel-nav.ts +95 -0
- package/src/client/hooks/workspace/panel-tabs.session.test.tsx +235 -0
- package/src/client/hooks/workspace/panel-tabs.ts +194 -0
- package/src/client/hooks/workspace/right-open-request.ts +53 -0
- package/src/client/hooks/workspace/right-side.test.ts +204 -0
- package/src/client/hooks/workspace/right-side.ts +142 -0
- package/src/client/lib/ui/control-plate.ts +33 -0
- package/src/client/main.tsx +9 -4
- package/src/client/tailwind.css +6 -0
- package/src/server/lib/assets/shell-attributes.server.ts +26 -10
- package/src/server/lib/assets/shell-attributes.test.ts +26 -0
- package/src/server/lib/bundler/titlebar-css.test.ts +5 -3
- package/src/server/lib/harness/acp/background-replay.test.ts +16 -1
- package/src/server/lib/harness/acp/background-replay.ts +6 -1
- package/src/server/lib/harness/acp/background-work.ts +44 -31
- package/src/server/lib/harness/acp/session-turns.ts +4 -3
- package/src/server/lib/harness/acp/session-wiring.test.ts +53 -0
- package/src/server/lib/harness/acp/session-wiring.ts +11 -2
- package/src/server/lib/harness/session-lease.server.ts +3 -2
- package/src/server/lib/omp/session/lease-probe.server.test.ts +82 -0
- package/src/server/lib/omp/session/lease-probe.server.ts +180 -0
- package/src/server/lib/omp/session/ownership.server.test.ts +17 -6
- package/src/server/lib/omp/session/ownership.server.ts +7 -5
- package/src/server/plugins/ssr.ts +6 -3
- package/src/shared/lib/browser/user-tabs.test.ts +165 -0
- package/src/shared/lib/browser/user-tabs.ts +172 -0
- package/src/shared/lib/chat/timeline/width-mode.test.ts +34 -2
- package/src/shared/lib/chat/timeline/width-mode.ts +71 -22
- package/src/shared/lib/commands/catalog.ts +2 -2
- package/src/shared/lib/fs/git-status.test.ts +23 -0
- package/src/shared/lib/fs/git-status.ts +15 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +20 -20
- package/src/shared/lib/settings/defaults.ts +8 -1
- package/src/shared/lib/theme/border-style.test.ts +83 -0
- package/src/shared/lib/theme/border-style.ts +122 -0
- package/src/shared/lib/workspace/keymap.ts +2 -1
- package/src/shared/lib/workspace/panel-nav.test.ts +198 -0
- package/src/shared/lib/workspace/panel-nav.ts +148 -0
- package/src/shared/lib/workspace/panel-tabs-close.test.ts +154 -0
- package/src/shared/lib/workspace/panel-tabs.ts +105 -0
- package/src/shared/lib/workspace/session-state/cache.ts +22 -0
- package/src/shared/lib/workspace/session-state/merge.ts +6 -0
- package/src/shared/lib/workspace/session-state/store.ts +23 -0
- package/src/shared/types/settings/state.ts +58 -3
- package/src/test-support/header-controls-harness.ts +22 -0
- package/src/test-support/peer-harness.ts +2 -2
- package/dist/client/static/js/ImageView-rnzf5tve.js +0 -1
- package/dist/client/static/js/LayoutWrapper-rekrgth6.js +0 -2
- package/dist/client/static/js/SessionsView-e84tjbcr.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +0 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
- package/dist/client/static/js/c-8jf64j6h.js +0 -1
- package/dist/client/static/js/cpp-vh94zee0.js +0 -1
- package/dist/client/static/js/css-a13jmmnc.js +0 -1
- package/dist/client/static/js/css-p57h1fme.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +0 -1
- package/dist/client/static/js/graphql-kesh8gk0.js +0 -1
- package/dist/client/static/js/html-sxpfydga.js +0 -1
- package/dist/client/static/js/index-0q2qfcjn.js +0 -1
- package/dist/client/static/js/index-48gh56ka.js +0 -3
- package/dist/client/static/js/index-4rv388z7.js +0 -2
- package/dist/client/static/js/index-52xmdeh2.js +0 -1
- package/dist/client/static/js/index-8kqepehd.js +0 -12
- package/dist/client/static/js/index-cje5gg45.js +0 -1
- package/dist/client/static/js/index-fbcg8y95.js +0 -1
- package/dist/client/static/js/index-g3shdymf.js +0 -1
- package/dist/client/static/js/index-h5n1btqy.js +0 -1
- package/dist/client/static/js/index-m1n4v0z7.js +0 -9
- package/dist/client/static/js/index-rn8w29pv.js +0 -2
- package/dist/client/static/js/index-s00j9042.js +0 -2
- package/dist/client/static/js/index-s7rfbydk.js +0 -4
- package/dist/client/static/js/index-sg6sz3g8.js +0 -1
- package/dist/client/static/js/index-vcrh95gf.css +0 -1
- package/dist/client/static/js/index-w5rw8f7w.js +0 -1
- package/dist/client/static/js/index-x6v37h3j.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +0 -1
- package/dist/client/static/js/ini-1x0ad976.js +0 -1
- package/dist/client/static/js/java-3944nq02.js +0 -1
- package/dist/client/static/js/javascript-zegm06a1.js +0 -1
- package/dist/client/static/js/json-g5ggnd94.js +0 -1
- package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
- package/dist/client/static/js/lua-edn2b3wn.js +0 -1
- package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
- package/dist/client/static/js/one-dark-pro-hteqzfb0.js +0 -1
- package/dist/client/static/js/one-light-dapnh0rs.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +0 -1
- package/dist/client/static/js/properties-fcmj08pv.js +0 -1
- package/dist/client/static/js/python-532d8ezm.js +0 -1
- package/dist/client/static/js/r-ptmdxs2a.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +0 -1
- package/dist/client/static/js/tsx-zfy727zs.js +0 -1
- package/dist/client/static/js/typescript-683kkkaw.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +0 -1
- package/dist/client/static/js/xml-6ct32gys.js +0 -1
- package/dist/client/static/js/yaml-1d5m3bfj.js +0 -1
- package/src/server/lib/omp/session/lease-flock.server.ts +0 -117
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The panel-navigation setting's live-apply half.
|
|
8
|
+
*
|
|
9
|
+
* Two columns, two keys, and the failure this file exists to prevent:
|
|
10
|
+
* **a change addressed to one column re-mounting the other's tree.** The left
|
|
11
|
+
* column's mount owns the session list's expansion, scroll and batch selection;
|
|
12
|
+
* the right column's owns a terminal's PTY. An event that repainted both would
|
|
13
|
+
* cost one of them for a setting that did not touch it.
|
|
14
|
+
*
|
|
15
|
+
* `applyPanelNav` is idempotent in the only sense that matters here — it resolves
|
|
16
|
+
* the value and announces the resolved one — so a settings path that fires twice
|
|
17
|
+
* with the same value repaints the same tree with the same style.
|
|
18
|
+
*
|
|
19
|
+
* No database: this module reads the primed client snapshot and dispatches a
|
|
20
|
+
* window event. The write is the settings modal's own `writeKabmoSettings`.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
24
|
+
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
25
|
+
import {
|
|
26
|
+
PANEL_NAV_CHANGED_EVENT,
|
|
27
|
+
PANEL_NAV_SETTING_KEY,
|
|
28
|
+
applyPanelNav,
|
|
29
|
+
currentPanelNav,
|
|
30
|
+
} from '@/client/hooks/workspace/panel-nav';
|
|
31
|
+
import {
|
|
32
|
+
MOBILE_RIGHT_PANEL_NAV_CHANGED_EVENT,
|
|
33
|
+
MOBILE_RIGHT_PANEL_NAV_SETTING_KEY,
|
|
34
|
+
applyMobileRightPanelNav,
|
|
35
|
+
currentMobileRightPanelNav,
|
|
36
|
+
} from '@/client/hooks/workspace/mobile-right-panel-nav';
|
|
37
|
+
|
|
38
|
+
/** The events dispatched while the current test ran; `detail` may be absent. */
|
|
39
|
+
const dispatched: unknown[] = [];
|
|
40
|
+
|
|
41
|
+
// `applyPanelNav` bails out in a process with no window; give this file one so
|
|
42
|
+
// the dispatch path is the real one, and stand in for the settings write.
|
|
43
|
+
const fakeWindow = globalThis as unknown as {
|
|
44
|
+
window?: unknown;
|
|
45
|
+
CustomEvent?: unknown;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
fakeWindow.window ??= {
|
|
49
|
+
dispatchEvent: (event: { detail?: { side?: unknown; style?: unknown } }) => {
|
|
50
|
+
dispatched.push(event.detail ?? {});
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
fakeWindow.CustomEvent ??= class {
|
|
55
|
+
detail: unknown;
|
|
56
|
+
constructor(_type: string, init?: { detail?: unknown }) {
|
|
57
|
+
this.detail = init?.detail;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
afterEach(() => dispatched.length = 0);
|
|
62
|
+
|
|
63
|
+
describe('currentPanelNav', () => {
|
|
64
|
+
test('reads each column from its own key', () => {
|
|
65
|
+
primeKabmoSettings({ leftPanelNav: 'tabs', rightPanelNav: 'rail' });
|
|
66
|
+
expect(currentPanelNav('left')).toBe('tabs');
|
|
67
|
+
expect(currentPanelNav('right')).toBe('rail');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('the two keys are independent, so one choice cannot carry to the other', () => {
|
|
71
|
+
primeKabmoSettings({ leftPanelNav: 'rail', rightPanelNav: 'tabs' });
|
|
72
|
+
expect(currentPanelNav('left')).toBe('rail');
|
|
73
|
+
expect(currentPanelNav('right')).toBe('tabs');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('an unset or unreadable value resolves to the rail, which is what ships', () => {
|
|
77
|
+
primeKabmoSettings({ leftPanelNav: 'from-a-newer-build' });
|
|
78
|
+
expect(currentPanelNav('left')).toBe('rail');
|
|
79
|
+
expect(currentPanelNav('right')).toBe('rail');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('the keys it reads are the settings fields the app persists', () => {
|
|
83
|
+
expect(PANEL_NAV_SETTING_KEY.left).toBe('leftPanelNav');
|
|
84
|
+
expect(PANEL_NAV_SETTING_KEY.right).toBe('rightPanelNav');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('applyPanelNav', () => {
|
|
89
|
+
test('announces the SIDE and the resolved style', () => {
|
|
90
|
+
applyPanelNav('right', 'tabs');
|
|
91
|
+
expect(dispatched).toEqual([{ side: 'right', style: 'tabs' }]);
|
|
92
|
+
expect(PANEL_NAV_CHANGED_EVENT).toBe('omp:panel-nav-changed');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('an unreadable value is announced as the shipped default, never as itself', () => {
|
|
96
|
+
applyPanelNav('left', 'whatever');
|
|
97
|
+
expect(dispatched).toEqual([{ side: 'left', style: 'rail' }]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('two changes addressed to different columns stay separate events', () => {
|
|
101
|
+
applyPanelNav('left', 'tabs');
|
|
102
|
+
applyPanelNav('right', 'tabs');
|
|
103
|
+
expect(dispatched).toEqual([
|
|
104
|
+
{ side: 'left', style: 'tabs' },
|
|
105
|
+
{ side: 'right', style: 'tabs' },
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('the phone drawer setting', () => {
|
|
111
|
+
afterEach(() => dispatched.length = 0);
|
|
112
|
+
|
|
113
|
+
test('reads its own key, so a desktop column cannot answer for it', () => {
|
|
114
|
+
primeKabmoSettings({ leftPanelNav: 'tabs', rightPanelNav: 'tabs', mobileRightPanelNav: 'classic' });
|
|
115
|
+
expect(currentMobileRightPanelNav()).toBe('classic');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('an unset or unreadable value is the shipped default', () => {
|
|
119
|
+
primeKabmoSettings({ mobileRightPanelNav: 'from-a-newer-build' });
|
|
120
|
+
expect(currentMobileRightPanelNav()).toBe('classic');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('the key matches the settings field it persists under', () => {
|
|
124
|
+
expect(MOBILE_RIGHT_PANEL_NAV_SETTING_KEY).toBe('mobileRightPanelNav');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('it announces on its OWN event, not the desktop one', () => {
|
|
128
|
+
applyMobileRightPanelNav('tabs');
|
|
129
|
+
// Its detail is the resolved STYLE, not `{side, style}`: the phone has one
|
|
130
|
+
// drawer, so there is no side for the listener to compare.
|
|
131
|
+
expect(dispatched).toEqual(['tabs']);
|
|
132
|
+
expect(MOBILE_RIGHT_PANEL_NAV_CHANGED_EVENT).toBe('omp:mobile-right-panel-nav-changed');
|
|
133
|
+
expect(MOBILE_RIGHT_PANEL_NAV_CHANGED_EVENT).not.toBe(PANEL_NAV_CHANGED_EVENT);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('an unreadable value is announced as the default, never as itself', () => {
|
|
137
|
+
applyMobileRightPanelNav('whatever');
|
|
138
|
+
expect(dispatched).toEqual(['classic']);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The one reader/writer of the desktop panel navigation style, per column.
|
|
8
|
+
*
|
|
9
|
+
* A style picks a COMPONENT TREE (`LeftColumn`/`RightColumn`'s switch between
|
|
10
|
+
* the rail and the tab strip), so something in JavaScript must re-render when
|
|
11
|
+
* it changes — `appSettings` is a boot-time prop and would only show a new
|
|
12
|
+
* style after a reload. The settings modal calls `applyPanelNav` when a value
|
|
13
|
+
* moves, which announces `omp:panel-nav-changed` with the SIDE and the resolved
|
|
14
|
+
* style; `usePanelNav(side)` is the single subscriber per column.
|
|
15
|
+
*
|
|
16
|
+
* Two independent values, because the columns answer different questions. The
|
|
17
|
+
* event carries the side so a change on the left cannot repaint the right into a
|
|
18
|
+
* tree it was not asked for.
|
|
19
|
+
*
|
|
20
|
+
* The initial value comes from the primed settings snapshot
|
|
21
|
+
* (`primeKabmoSettings` in `main.tsx`), so a mounted column draws the stored
|
|
22
|
+
* style on its first render — no flash of the other chrome.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { useCallback, useState } from 'preact/hooks';
|
|
26
|
+
import { readKabmoSetting } from '@/shared/lib/settings/client';
|
|
27
|
+
import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
28
|
+
import type { SettingsState } from '@/shared/types';
|
|
29
|
+
import {
|
|
30
|
+
PANEL_NAV_SETTING_KEYS,
|
|
31
|
+
isPanelNavSide,
|
|
32
|
+
resolvePanelNav,
|
|
33
|
+
type PanelNavSide,
|
|
34
|
+
type PanelNavStyle,
|
|
35
|
+
} from '@/shared/lib/workspace/panel-nav';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `app_settings` keys holding each column's style (in the `kabmo_settings`
|
|
39
|
+
* blob).
|
|
40
|
+
*
|
|
41
|
+
* `satisfies keyof SettingsState` because the key and the field name must be the
|
|
42
|
+
* same string for persistence to work at all — renaming a field without this
|
|
43
|
+
* line would leave the setting silently unsaved.
|
|
44
|
+
*/
|
|
45
|
+
export const PANEL_NAV_SETTING_KEY: Record<PanelNavSide, keyof SettingsState> = {
|
|
46
|
+
left: PANEL_NAV_SETTING_KEYS.left satisfies keyof SettingsState,
|
|
47
|
+
right: PANEL_NAV_SETTING_KEYS.right satisfies keyof SettingsState,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** Window event carrying `{ side, style }` as `detail`. */
|
|
51
|
+
export const PANEL_NAV_CHANGED_EVENT = 'omp:panel-nav-changed';
|
|
52
|
+
|
|
53
|
+
/** The stored style for one column, resolved against what this build can draw. */
|
|
54
|
+
export function currentPanelNav(
|
|
55
|
+
side: PanelNavSide,
|
|
56
|
+
appSettings?: Record<string, any>,
|
|
57
|
+
): PanelNavStyle {
|
|
58
|
+
return resolvePanelNav(readKabmoSetting<unknown>(PANEL_NAV_SETTING_KEY[side], appSettings));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Announce a new style for one column. Called by the settings modal when the
|
|
63
|
+
* value changes — the persisted copy is written by the modal's own
|
|
64
|
+
* `writeKabmoSettings`, so this function only has to make the mounted column
|
|
65
|
+
* re-render.
|
|
66
|
+
*/
|
|
67
|
+
export function applyPanelNav(side: PanelNavSide, style: unknown): void {
|
|
68
|
+
if (typeof window === 'undefined') return;
|
|
69
|
+
window.dispatchEvent(
|
|
70
|
+
new CustomEvent(PANEL_NAV_CHANGED_EVENT, {
|
|
71
|
+
detail: { side, style: resolvePanelNav(style) },
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The style one column should draw, kept live across settings edits. */
|
|
77
|
+
export function usePanelNav(side: PanelNavSide): PanelNavStyle {
|
|
78
|
+
const [style, setStyle] = useState<PanelNavStyle>(() => currentPanelNav(side));
|
|
79
|
+
|
|
80
|
+
useKabmoEvent(PANEL_NAV_CHANGED_EVENT, (event) => {
|
|
81
|
+
const detail = (event as CustomEvent<{ side?: unknown; style?: unknown }>).detail;
|
|
82
|
+
// A change addressed to the other column is not this column's news: an
|
|
83
|
+
// unconditional set would repaint both, and a column that re-mounts its
|
|
84
|
+
// tree loses whatever the user had open in it.
|
|
85
|
+
if (!isPanelNavSide(detail?.side) || detail.side !== side) return;
|
|
86
|
+
setStyle(resolvePanelNav(detail.style));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return style;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A writer the settings modal can hand a single column's change to. */
|
|
93
|
+
export function usePanelNavApply(): (side: PanelNavSide, style: unknown) => void {
|
|
94
|
+
return useCallback((side: PanelNavSide, style: unknown) => applyPanelNav(side, style), []);
|
|
95
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The tab strip's opening state: EMPTY, per session, and restored as itself.
|
|
8
|
+
*
|
|
9
|
+
* Three claims that the UI depends on and that a pure-function test cannot make,
|
|
10
|
+
* because they are about the session slot:
|
|
11
|
+
*
|
|
12
|
+
* 1. **A session that has never opened a tab is on the HOME PAGE.** This is what
|
|
13
|
+
* makes the tab style different from the rail, whose default is a view: a
|
|
14
|
+
* column with no view still has to show something, while a strip's empty
|
|
15
|
+
* state is its catalog. The stored `layout.activeRightPanel` (`files`) must
|
|
16
|
+
* not seed a tab — that path is `useRightOpenRequest`.
|
|
17
|
+
* 2. **Tabs are PER SESSION.** Two chats may be doing different work; carrying
|
|
18
|
+
* one chat's strip into another is the same mistake the sidebar's pending row
|
|
19
|
+
* made when it was derived from the active session.
|
|
20
|
+
* 3. **The round trip is lossless**, including the home flag: closing every tab
|
|
21
|
+
* must come back as `home`, not as `active: null` on a strip that has tabs.
|
|
22
|
+
*
|
|
23
|
+
* Rendered against happy-dom with the real `SessionStateProvider`, and the store
|
|
24
|
+
* is read directly for the persisted shape.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
28
|
+
import { Window } from 'happy-dom';
|
|
29
|
+
import { h, render } from 'preact';
|
|
30
|
+
import { act } from 'preact/test-utils';
|
|
31
|
+
import { SessionStateProvider } from '@/client/components/common/session-state-provider/index';
|
|
32
|
+
import { usePanelTabs } from '@/client/hooks/workspace/panel-tabs';
|
|
33
|
+
import { getSessionState, getSessionValue, hydrateSession, resetSessionStateStore, setSessionKey } from '@/shared/lib/workspace/session-state/store';
|
|
34
|
+
|
|
35
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent'] as const;
|
|
36
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
37
|
+
const nativeFetch = Bun.fetch;
|
|
38
|
+
|
|
39
|
+
let container: HTMLElement;
|
|
40
|
+
|
|
41
|
+
/** What the probe last rendered, so a test can read the hook's whole shape. */
|
|
42
|
+
let seen: { tabs: readonly string[]; active: string | null; home: boolean } | null = null;
|
|
43
|
+
/** The probe's writer, so a test can drive an action from outside. */
|
|
44
|
+
let actions: { open: (id: string) => void; close: (id: string) => void; showHome: () => void } | null = null;
|
|
45
|
+
|
|
46
|
+
/** The right column's strip, rendered as the column renders it. */
|
|
47
|
+
function Probe() {
|
|
48
|
+
const tabs = usePanelTabs('right', new Set(['files', 'git', 'todo']), null);
|
|
49
|
+
seen = { tabs: tabs.tabs, active: tabs.active, home: tabs.home };
|
|
50
|
+
actions = { open: tabs.open, close: tabs.close, showHome: tabs.showHome };
|
|
51
|
+
return h('div', null, JSON.stringify(seen));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function mount(sessionId: string) {
|
|
55
|
+
container = document.createElement('div');
|
|
56
|
+
document.body.appendChild(container);
|
|
57
|
+
act(() => {
|
|
58
|
+
render(h(SessionStateProvider, { sessionId, children: h(Probe, null) }), container);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
beforeAll(() => {
|
|
63
|
+
const win = new Window({ url: 'http://localhost' });
|
|
64
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
65
|
+
for (const key of DOM_GLOBALS) {
|
|
66
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
|
|
67
|
+
target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
68
|
+
}
|
|
69
|
+
// The stub stands in for the SERVER, and the server answers what it was
|
|
70
|
+
// persisted — so the GET returns the session's own entry rather than `{}`.
|
|
71
|
+
//
|
|
72
|
+
// Returning `{}` made `loadSession` adopt an empty blob over the value
|
|
73
|
+
// `hydrateSession` had just seeded, and `mount()` only awaits the effects of
|
|
74
|
+
// the first commit: whether the clearing fetch had settled by the assertion
|
|
75
|
+
// depended on the event loop's timing, not on the code. That passed locally
|
|
76
|
+
// and failed 100% of the time in CI (both the Linux and the Windows leg, the
|
|
77
|
+
// same single case), because the response landed before the first read there.
|
|
78
|
+
target.fetch = async (input: unknown, init?: { method?: string; body?: unknown }) => {
|
|
79
|
+
const method = init?.method ?? 'GET';
|
|
80
|
+
const sessionId = String(input).split('/sessions/')[1]?.split('/')[0] ?? 'x';
|
|
81
|
+
if (method === 'POST') return new Response(JSON.stringify({ success: true }), { status: 200, headers: { 'content-type': 'application/json' } });
|
|
82
|
+
return new Response(
|
|
83
|
+
JSON.stringify({ sessionId, state: { ...(getSessionState(sessionId) ?? {}) } }),
|
|
84
|
+
{ status: 200, headers: { 'content-type': 'application/json' } },
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
afterAll(() => {
|
|
89
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
90
|
+
for (const key of DOM_GLOBALS) {
|
|
91
|
+
if (nativeGlobals[key] === undefined) delete target[key];
|
|
92
|
+
else target[key] = nativeGlobals[key];
|
|
93
|
+
}
|
|
94
|
+
target.fetch = nativeFetch;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Every case starts on an EMPTY cache.
|
|
99
|
+
*
|
|
100
|
+
* The store is a module singleton, and `bun test` runs every suite in one
|
|
101
|
+
* process: a suite that writes a slot and does not forget it leaves an entry
|
|
102
|
+
* behind, so by the time this file runs the 10-entry LRU can already be full of
|
|
103
|
+
* other suites' leaked — and often DIRTY, therefore permanently un-evictable —
|
|
104
|
+
* sessions. Hydrating `s-a` and then `s-b` then evicts `s-a`, and this suite
|
|
105
|
+
* fails on a case that passes in isolation. Measured in CI on a full run: the
|
|
106
|
+
* cache evicted `s-a` at size 11.
|
|
107
|
+
*/
|
|
108
|
+
beforeEach(() => {
|
|
109
|
+
resetSessionStateStore();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
afterEach(() => {
|
|
113
|
+
render(null, container);
|
|
114
|
+
container.remove();
|
|
115
|
+
seen = null;
|
|
116
|
+
actions = null;
|
|
117
|
+
});
|
|
118
|
+
describe('a session that never opened a tab', () => {
|
|
119
|
+
test('starts on the home page with an empty strip, NOT on the stored right view', () => {
|
|
120
|
+
hydrateSession('s-new', {});
|
|
121
|
+
mount('s-new');
|
|
122
|
+
expect(seen).toEqual({ tabs: [], active: null, home: true });
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('a stored `layout.activeRightPanel` does not seed a tab', () => {
|
|
126
|
+
// The rail's default is `files`; the strip's default is nothing, and the
|
|
127
|
+
// stored selection is not a request to open it.
|
|
128
|
+
hydrateSession('s-rail', { 'layout.activeRightPanel': 'files' });
|
|
129
|
+
mount('s-rail');
|
|
130
|
+
expect(seen?.tabs).toEqual([]);
|
|
131
|
+
expect(seen?.home).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('tabs are per session', () => {
|
|
136
|
+
test('two sessions keep different strips', () => {
|
|
137
|
+
// Each session is hydrated and asserted BEFORE the next one is seeded.
|
|
138
|
+
//
|
|
139
|
+
// The store is a process-wide LRU capped at 10 sessions, so seeding both up
|
|
140
|
+
// front let the second `hydrateSession` evict the first when the cache was
|
|
141
|
+
// already full of other suites' sessions — and `evictIfNeeded` skips dirty
|
|
142
|
+
// entries, so a leaked entry that never persisted held a slot permanently.
|
|
143
|
+
// That made this case pass in isolation and fail on every CI leg. Nothing
|
|
144
|
+
// here depends on two entries co-residing, and the claim under test — one
|
|
145
|
+
// session's strip is not another's — is unchanged.
|
|
146
|
+
hydrateSession('s-a', { 'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false } });
|
|
147
|
+
mount('s-a');
|
|
148
|
+
expect(seen?.tabs).toEqual(['files']);
|
|
149
|
+
render(null, container);
|
|
150
|
+
container.remove();
|
|
151
|
+
|
|
152
|
+
hydrateSession('s-b', { 'layout.rightPanelTabs': { tabs: ['git', 'todo'], active: 'todo', home: false } });
|
|
153
|
+
mount('s-b');
|
|
154
|
+
expect(seen?.tabs).toEqual(['git', 'todo']);
|
|
155
|
+
expect(seen?.active).toBe('todo');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('a session with no blob is unaffected by another session that has one', () => {
|
|
159
|
+
hydrateSession('s-has', { 'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false } });
|
|
160
|
+
hydrateSession('s-empty', {});
|
|
161
|
+
mount('s-empty');
|
|
162
|
+
expect(seen).toEqual({ tabs: [], active: null, home: true });
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('the round trip', () => {
|
|
167
|
+
test('opening a tab persists under layout.rightPanelTabs', () => {
|
|
168
|
+
hydrateSession('s-w', {});
|
|
169
|
+
mount('s-w');
|
|
170
|
+
act(() => actions!.open('git'));
|
|
171
|
+
const stored = getSessionValue<{ tabs: string[]; active: string; home: boolean }>('s-w', 'layout.rightPanelTabs');
|
|
172
|
+
expect(stored).toEqual({ tabs: ['git'], active: 'git', home: false });
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('closing the last tab persists the HOME page, not a bare null', () => {
|
|
176
|
+
hydrateSession('s-c', {});
|
|
177
|
+
mount('s-c');
|
|
178
|
+
act(() => actions!.open('files'));
|
|
179
|
+
act(() => actions!.close('files'));
|
|
180
|
+
const stored = getSessionValue<{ tabs: string[]; active: string | null; home: boolean }>('s-c', 'layout.rightPanelTabs');
|
|
181
|
+
expect(stored).toEqual({ tabs: [], active: null, home: true });
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test('a stored home flag is restored as home even while tabs are open', () => {
|
|
185
|
+
hydrateSession('s-h', {
|
|
186
|
+
'layout.rightPanelTabs': { tabs: ['files', 'git'], active: 'git', home: true },
|
|
187
|
+
});
|
|
188
|
+
mount('s-h');
|
|
189
|
+
expect(seen).toEqual({ tabs: ['files', 'git'], active: 'git', home: true });
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test('the store key carries the layout prefix every other layout slot uses', () => {
|
|
193
|
+
hydrateSession('s-k', {});
|
|
194
|
+
mount('s-k');
|
|
195
|
+
act(() => actions!.open('todo'));
|
|
196
|
+
// One prefix for per-session UI, beside `layout.openedFiles` and
|
|
197
|
+
// `layout.showRightPanel`; a key without it was the one inconsistency here.
|
|
198
|
+
expect(getSessionValue('s-k', 'layout.rightPanelTabs')).not.toBeUndefined();
|
|
199
|
+
expect(getSessionValue('s-k', 'rightPanelTabs')).toBeUndefined();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test('an id this build cannot draw is dropped, leaving the home page', () => {
|
|
203
|
+
hydrateSession('s-x', {
|
|
204
|
+
'layout.rightPanelTabs': { tabs: ['ghost'], active: 'ghost', home: false },
|
|
205
|
+
});
|
|
206
|
+
mount('s-x');
|
|
207
|
+
expect(seen).toEqual({ tabs: [], active: null, home: true });
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test('a corrupted blob is the empty page, not a crash', () => {
|
|
211
|
+
hydrateSession('s-bad', { 'layout.rightPanelTabs': 'not-an-object' });
|
|
212
|
+
mount('s-bad');
|
|
213
|
+
expect(seen).toEqual({ tabs: [], active: null, home: true });
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test('showHome keeps the strip and only changes the page', () => {
|
|
217
|
+
hydrateSession('s-home', {
|
|
218
|
+
'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false },
|
|
219
|
+
});
|
|
220
|
+
mount('s-home');
|
|
221
|
+
act(() => actions!.showHome());
|
|
222
|
+
expect(seen).toEqual({ tabs: ['files'], active: 'files', home: true });
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
/** Keeps the store honest about a write it never received. */
|
|
227
|
+
test('setSessionKey is the writer the hook goes through', () => {
|
|
228
|
+
hydrateSession('s-direct', {});
|
|
229
|
+
setSessionKey('s-direct', 'layout.rightPanelTabs', { tabs: ['git'], active: 'git', home: false });
|
|
230
|
+
expect(getSessionValue('s-direct', 'layout.rightPanelTabs')).toEqual({
|
|
231
|
+
tabs: ['git'],
|
|
232
|
+
active: 'git',
|
|
233
|
+
home: false,
|
|
234
|
+
});
|
|
235
|
+
});
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A desktop panel column's open-tab state, per session.
|
|
8
|
+
*
|
|
9
|
+
* Per SESSION, not global: the working set is what the user is doing in THIS
|
|
10
|
+
* chat — the files they are reading, the terminal they left running — so
|
|
11
|
+
* switching chats must not carry another chat's tabs into this one. The
|
|
12
|
+
* placement and the navigation STYLE stay global (`omp_left_panels`,
|
|
13
|
+
* `leftPanelNav`/`rightPanelNav`), because those describe the person's
|
|
14
|
+
* arrangement rather than one conversation's work.
|
|
15
|
+
*
|
|
16
|
+
* **`home` is a state of its own, not `active === null`.** The left column pins
|
|
17
|
+
* the session list, so that column always HAS a view to show; if the home page
|
|
18
|
+
* were spelled by "nothing selected" it could never open, and if it were spelled
|
|
19
|
+
* by "the pinned tab is not selected" the pinned view would be a tab the user
|
|
20
|
+
* cannot look at. One boolean says the catalog is on screen, and the selection
|
|
21
|
+
* survives behind it.
|
|
22
|
+
*
|
|
23
|
+
* ONE stored value, not two: two keys would let a close write the list before
|
|
24
|
+
* the selection landed and leave the column resolving an id that is no longer in
|
|
25
|
+
* it.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { useCallback, useMemo } from 'preact/hooks';
|
|
29
|
+
import { useSessionState } from '@/client/hooks/workspace/session-state';
|
|
30
|
+
import {
|
|
31
|
+
closePanelTab,
|
|
32
|
+
nextActiveTab,
|
|
33
|
+
openPanelTab,
|
|
34
|
+
visiblePanelTabs,
|
|
35
|
+
withPinnedTab,
|
|
36
|
+
type PanelTabs,
|
|
37
|
+
} from '@/shared/lib/workspace/panel-tabs';
|
|
38
|
+
import type { PanelNavSide } from '@/shared/lib/workspace/panel-nav';
|
|
39
|
+
|
|
40
|
+
export interface PanelTabsHandle {
|
|
41
|
+
/** The ids currently open, in strip order — already filtered to drawable ones. */
|
|
42
|
+
tabs: PanelTabs;
|
|
43
|
+
/** The tab the column shows, or `null` when nothing is open at all. */
|
|
44
|
+
active: string | null;
|
|
45
|
+
/** The catalog is on screen. The strip and the selection stay behind it. */
|
|
46
|
+
home: boolean;
|
|
47
|
+
/** Open a view (or focus it when it is already open) and select it. */
|
|
48
|
+
open: (id: string) => void;
|
|
49
|
+
/** Select a tab that is already open; a no-op for an id that is not. */
|
|
50
|
+
select: (id: string) => void;
|
|
51
|
+
/** Close a tab. The pinned view and unknown ids are refused. */
|
|
52
|
+
close: (id: string) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Adopt a new strip order after a drag.
|
|
55
|
+
*
|
|
56
|
+
* The order is SESSION state like the list itself, not the column's global
|
|
57
|
+
* placement: two chats may keep the same views in a different order, and a
|
|
58
|
+
* drag on one chat's strip must not rearrange another's. The pinned view is
|
|
59
|
+
* put back in front by `withPinnedTab`, so a drop can never move the column's
|
|
60
|
+
* own view out of first place.
|
|
61
|
+
*/
|
|
62
|
+
setOrder: (ids: readonly string[]) => void;
|
|
63
|
+
/** Show the catalog without closing anything. */
|
|
64
|
+
showHome: () => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface ColumnTabs {
|
|
68
|
+
tabs: PanelTabs;
|
|
69
|
+
active: string | null;
|
|
70
|
+
home: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A session that has never opened a tab: an EMPTY strip on the HOME PAGE.
|
|
75
|
+
*
|
|
76
|
+
* This is the default for every new chat, and it is what makes the tab style
|
|
77
|
+
* differ from the rail's default (which opens `Files`). A rail has to show
|
|
78
|
+
* something — a column with no view is a column of buttons over nothing — while
|
|
79
|
+
* a strip's empty state is its catalog, which is a real answer. So the stored
|
|
80
|
+
* `layout.activeRightPanel` (`files`) does NOT seed a tab; only an explicit
|
|
81
|
+
* request does (`useRightOpenRequest`).
|
|
82
|
+
*/
|
|
83
|
+
const EMPTY: ColumnTabs = { tabs: [], active: null, home: false };
|
|
84
|
+
|
|
85
|
+
/** A stored value from another build, a corrupted blob, or nothing at all. */
|
|
86
|
+
function readStored(value: unknown): ColumnTabs {
|
|
87
|
+
if (typeof value !== 'object' || value === null) return EMPTY;
|
|
88
|
+
const raw = value as { tabs?: unknown; active?: unknown; home?: unknown };
|
|
89
|
+
const tabs = Array.isArray(raw.tabs)
|
|
90
|
+
? raw.tabs.filter((id): id is string => typeof id === 'string')
|
|
91
|
+
: [];
|
|
92
|
+
if (tabs.length === 0) return EMPTY;
|
|
93
|
+
const active = typeof raw.active === 'string' ? raw.active : null;
|
|
94
|
+
return { tabs, active, home: raw.home === true };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* One column's tabs.
|
|
99
|
+
*
|
|
100
|
+
* `known` is every id the column could draw right now (the catalog's ids). A
|
|
101
|
+
* stored id that is no longer in it — a disabled panel, an uninstalled plugin, a
|
|
102
|
+
* bundle mid-import — is dropped on sight rather than left to render an empty
|
|
103
|
+
* body, and a column whose whole set vanished lands on its home page.
|
|
104
|
+
*/
|
|
105
|
+
export function usePanelTabs(
|
|
106
|
+
side: PanelNavSide,
|
|
107
|
+
known: ReadonlySet<string>,
|
|
108
|
+
pinned: string | null,
|
|
109
|
+
): PanelTabsHandle {
|
|
110
|
+
// `layout.*` like every other layout slot (`layout.openedFiles`,
|
|
111
|
+
// `layout.showRightPanel`, `layout.rightSideHidden`): the prefix is what tells
|
|
112
|
+
// a reader of the stored blob that this is per-session UI, not a setting, and
|
|
113
|
+
// a key without it was the one thing this hook did differently.
|
|
114
|
+
const [storedValue, setStored] = useSessionState<unknown>(`layout.${side}PanelTabs`, EMPTY);
|
|
115
|
+
|
|
116
|
+
const stored = useMemo(() => readStored(storedValue), [storedValue]);
|
|
117
|
+
|
|
118
|
+
const tabs = useMemo(() => {
|
|
119
|
+
const visible = visiblePanelTabs(stored.tabs, known);
|
|
120
|
+
return pinned === null ? visible : withPinnedTab(visible, pinned);
|
|
121
|
+
}, [stored.tabs, known, pinned]);
|
|
122
|
+
|
|
123
|
+
// The selection is DERIVED, not stored blindly: a stored id that was closed,
|
|
124
|
+
// disabled or never drawable resolves through the same rule a close uses, so a
|
|
125
|
+
// panel switched off while its tab was open lands on a neighbour rather than
|
|
126
|
+
// on a blank body. A pinned view is what a column with no choice shows.
|
|
127
|
+
const active = useMemo(() => {
|
|
128
|
+
if (tabs.length === 0) return null;
|
|
129
|
+
if (stored.active !== null && tabs.includes(stored.active)) return stored.active;
|
|
130
|
+
return tabs[0] ?? null;
|
|
131
|
+
}, [stored.active, tabs]);
|
|
132
|
+
|
|
133
|
+
// The home page needs something to go back to. A column that lost every tab
|
|
134
|
+
// (all switched off) shows the catalog instead of a blank body, and so does a
|
|
135
|
+
// pinned column that was closed down to its pinned tab only if the user asked
|
|
136
|
+
// for it — which is the stored `home` flag, not a consequence.
|
|
137
|
+
const home = stored.home || tabs.length === 0;
|
|
138
|
+
|
|
139
|
+
const write = useCallback((next: ColumnTabs) => setStored(next), [setStored]);
|
|
140
|
+
|
|
141
|
+
const open = useCallback(
|
|
142
|
+
(id: string) => {
|
|
143
|
+
// Idempotent, and that is load-bearing rather than tidy: callers open a
|
|
144
|
+
// view from an EFFECT (`omp:open-panel`, a restored selection), and a
|
|
145
|
+
// write with the same content still produces a new object — which
|
|
146
|
+
// re-renders the column, re-runs the effect and writes again. The guard is
|
|
147
|
+
// what makes "open" safe to call from a render-driven path at all.
|
|
148
|
+
if (tabs.includes(id) && active === id && !home) return;
|
|
149
|
+
const opened = openPanelTab(tabs, id);
|
|
150
|
+
write({ tabs: pinned === null ? opened : withPinnedTab(opened, pinned), active: id, home: false });
|
|
151
|
+
},
|
|
152
|
+
[tabs, active, home, pinned, write],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const select = useCallback(
|
|
156
|
+
(id: string) => {
|
|
157
|
+
if (!tabs.includes(id)) return;
|
|
158
|
+
write({ tabs, active: id, home: false });
|
|
159
|
+
},
|
|
160
|
+
[tabs, write],
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const close = useCallback(
|
|
164
|
+
(id: string) => {
|
|
165
|
+
const next = closePanelTab(tabs, id, pinned ?? undefined);
|
|
166
|
+
if (next === tabs) return;
|
|
167
|
+
// `nextActiveTab` owns the neighbour rule, so a close never leaves a stored
|
|
168
|
+
// id pointing at a closed tab; an empty list is the home page.
|
|
169
|
+
write({ tabs: next, active: nextActiveTab(tabs, next, active), home: next.length === 0 });
|
|
170
|
+
},
|
|
171
|
+
[tabs, active, pinned, write],
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const showHome = useCallback(() => write({ tabs, active, home: true }), [tabs, active, write]);
|
|
175
|
+
|
|
176
|
+
const setOrder = useCallback(
|
|
177
|
+
(ids: readonly string[]) => {
|
|
178
|
+
// The dropped list must be a PERMUTATION of the open set. A length check
|
|
179
|
+
// is not enough: `['files','files']` has the right length for
|
|
180
|
+
// `['files','git']` and would silently drop `git` while duplicating a chip.
|
|
181
|
+
// A view closed mid-gesture (another window, a plugin that unloaded) makes
|
|
182
|
+
// the drop not the user's arrangement, so it is refused outright.
|
|
183
|
+
if (ids.length !== tabs.length) return;
|
|
184
|
+
const open = new Set(tabs);
|
|
185
|
+
const next = ids.filter((id) => open.has(id));
|
|
186
|
+
if (next.length !== tabs.length || new Set(next).size !== tabs.length) return;
|
|
187
|
+
const ordered = pinned === null ? next : withPinnedTab(next, pinned);
|
|
188
|
+
write({ tabs: ordered, active, home });
|
|
189
|
+
},
|
|
190
|
+
[tabs, active, home, pinned, write],
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return { tabs, active, home, open, select, close, setOrder, showHome };
|
|
194
|
+
}
|