@kabmo-labs/kabmo 0.43.1 → 0.44.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-1t2q46rg.js} +2 -2
- package/dist/client/static/js/{DocxView-pyh6p2kb.js → DocxView-301hxnwk.js} +4 -4
- package/dist/client/static/js/{DrawioView-g48r6y2m.js → DrawioView-47bwea5t.js} +2 -2
- package/dist/client/static/js/ImageView-68zdx5ex.js +1 -0
- package/dist/client/static/js/LayoutWrapper-vw54s8ra.js +2 -0
- package/dist/client/static/js/{Modal-edw446r8.js → Modal-fb9b4gq6.js} +18 -18
- package/dist/client/static/js/{PdfView-6z3cgj37.js → PdfView-m64ksepp.js} +1 -1
- package/dist/client/static/js/SessionsView-zyjwhpzm.js +1 -0
- package/dist/client/static/js/{SheetView-64076z1j.js → SheetView-e88sqprx.js} +13 -13
- package/dist/client/static/js/{SvgPreview-dmpgavgd.js → SvgPreview-hs9a713t.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-nfz5z1vw.js → abnfDiagram-O67JEVCF-fnr5kyqk.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-mq93vqx9.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-jra2jyzw.js → architectureDiagram-NJMV4G6O-7v003363.js} +11 -11
- package/dist/client/static/js/{astro-dpfdhc5e.js → astro-t9vjc0mc.js} +1 -1
- package/dist/client/static/js/bash-fjzhxy10.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-3szktxam.js → blockDiagram-BEXU5L5S-k4mwbw3d.js} +5 -5
- package/dist/client/static/js/c-y1y6v00q.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-xe9vbppt.js → c4Diagram-YGBWAQC7-688zq6f4.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-egzhj1xn.js → classDiagram-v2-NBCMYWYE-h0s16pxr.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-dfrk1wnr.js → cose-bilkent-JH36ORCC-qb2t8qq5.js} +1 -1
- package/dist/client/static/js/cpp-9f6zkdd4.js +1 -0
- package/dist/client/static/js/css-g85rwzty.js +1 -0
- package/dist/client/static/js/css-y4y3qtsb.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-qyg5rjr5.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-xefpcmpg.js → cynefinDiagram-VND7K2PF-syhtcr7b.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-vtzjnrt9.js → dagre-6A5THRUB-7wgbx6cm.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-4vvn790v.js → diagram-22UHCM2B-951cmp5h.js} +21 -21
- package/dist/client/static/js/{diagram-3UASUU5V-tmht3bew.js → diagram-3UASUU5V-mvdbqt7b.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-p5wa5ztx.js → diagram-ATOU4E4O-hkvdtgdm.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-8myesjfc.js → diagram-CDSNMT55-bkkz35ca.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-9t3x2d5f.js → diagram-MLGK6HIB-z6pcrkc3.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-8ahgnmhy.js → diagram-MPIPVDR6-mkwf8j4m.js} +1 -1
- package/dist/client/static/js/{dockerfile-x8aa0543.js → dockerfile-7gd570bm.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5semw111.js → ebnfDiagram-ZINNZB2B-trym26ts.js} +1 -1
- package/dist/client/static/js/{elixir-5ewfhvfh.js → elixir-z77c7tfn.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-jmhs58ww.js → elk-276RUBZZ-gkhz67v6.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-31wvbpdr.js → erDiagram-OPXOYQCR-gkyr5cqs.js} +7 -7
- package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-6vrvh2m6.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-15yz245z.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-n1sapfye.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-c2dycjrf.js → ganttDiagram-FUAMR5RP-1qpme6ks.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-xtjwv160.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y4k4pdd8.js → gitGraphDiagram-X574FWY7-wbg3kqak.js} +10 -10
- package/dist/client/static/js/graphql-amk52c95.js +1 -0
- package/dist/client/static/js/html-2y935m7r.js +1 -0
- package/dist/client/static/js/index-07yh7qx0.js +1 -0
- package/dist/client/static/js/{index-6fpd55cq.js → index-1923aj4g.js} +2 -2
- package/dist/client/static/js/{index-s00j9042.js → index-19ffgf9a.js} +1 -1
- package/dist/client/static/js/index-204ae4vs.js +2 -0
- package/dist/client/static/js/{index-cqnpsw2m.js → index-22whvfdw.js} +2 -2
- package/dist/client/static/js/{index-2cbnjc32.js → index-232nsp2c.js} +2 -2
- package/dist/client/static/js/{index-aar68x31.js → index-31hntzse.js} +5 -5
- package/dist/client/static/js/{index-2b46dzw8.js → index-3w845q50.js} +4 -4
- package/dist/client/static/js/{index-gmnmnfm0.js → index-4y4hshcx.js} +2 -2
- package/dist/client/static/js/index-53ysgsd2.js +1 -0
- package/dist/client/static/js/{index-m94f4ngb.js → index-62ng8tkj.js} +3 -3
- package/dist/client/static/js/{index-nt7nhchn.js → index-6ah5sj5y.js} +1 -1
- package/dist/client/static/js/{index-kc5znr75.js → index-6gyk52ff.js} +2 -2
- package/dist/client/static/js/{index-m9s9rg5k.js → index-6s4mrdew.js} +2 -2
- package/dist/client/static/js/index-6t21c6jt.js +2 -0
- package/dist/client/static/js/{index-7dp90ad1.js → index-83pwa9c0.js} +2 -2
- package/dist/client/static/js/{index-pt8440xh.js → index-8trggh1z.js} +15 -15
- package/dist/client/static/js/{index-ys0xpw3q.js → index-92n96mgd.js} +2 -2
- package/dist/client/static/js/index-ad4x44d6.js +9 -0
- package/dist/client/static/js/{index-s78n0dtv.js → index-as1wptfa.js} +2 -2
- package/dist/client/static/js/{index-j17h4z6f.js → index-barbpakv.js} +2 -2
- package/dist/client/static/js/index-bjqz7swa.js +1 -0
- package/dist/client/static/js/{index-yvgbr7ek.js → index-c3v62nvt.js} +2 -2
- package/dist/client/static/js/{index-f77c3ag0.js → index-cq98p2rb.js} +200 -200
- package/dist/client/static/js/{index-3588r3wg.js → index-czedkbmb.js} +2 -2
- package/dist/client/static/js/{index-sesghshh.js → index-dmv2zasz.js} +2 -2
- package/dist/client/static/js/{index-ycks7gyg.js → index-e6rm5xzj.js} +2 -2
- package/dist/client/static/js/{index-48pb18zj.js → index-ehacfgwm.js} +2 -2
- package/dist/client/static/js/{index-q81rxwh7.js → index-fbpc1wx6.js} +41 -41
- package/dist/client/static/js/{index-qhytrsyb.js → index-fj4k07zt.js} +2 -2
- package/dist/client/static/js/{index-jz93j0at.js → index-gtkhz0hj.js} +2 -2
- package/dist/client/static/js/{index-181p91hf.js → index-hfsvwfgw.js} +2 -2
- package/dist/client/static/js/{index-sk9ej289.js → index-jaqjvk22.js} +2 -2
- package/dist/client/static/js/{index-e7yf273s.js → index-jbkkwa2q.js} +2 -2
- package/dist/client/static/js/{index-38v0781h.js → index-ks23y2cd.js} +2 -2
- package/dist/client/static/js/{index-f7djda1g.js → index-kwpaz891.js} +2 -2
- package/dist/client/static/js/{index-0c6vpk89.js → index-n0matkz9.js} +2 -2
- package/dist/client/static/js/index-n6fbd265.js +1 -0
- package/dist/client/static/js/{index-cjhvtzdd.js → index-nqjd3hh5.js} +2 -2
- package/dist/client/static/js/{index-ynaxep06.js → index-nr8s5xm9.js} +2 -2
- package/dist/client/static/js/index-nvevymac.js +2 -0
- package/dist/client/static/js/index-pxm44qfd.js +1 -0
- package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
- package/dist/client/static/js/index-qf9x7yet.js +1 -0
- package/dist/client/static/js/{index-s7rfbydk.js → index-qkjx6521.js} +4 -4
- package/dist/client/static/js/index-qm92sf9w.js +12 -0
- package/dist/client/static/js/{index-fjnkzk12.js → index-qsw5edtk.js} +5 -5
- package/dist/client/static/js/index-rpzxrr2d.js +1 -0
- package/dist/client/static/js/index-s8bktzpg.js +1 -0
- package/dist/client/static/js/index-sc7r305t.css +1 -0
- package/dist/client/static/js/{index-efra065v.js → index-svmzgtcx.js} +2 -2
- package/dist/client/static/js/{index-vyw4tbn8.js → index-tr2pkfs6.js} +2 -2
- package/dist/client/static/js/{index-bvjct7sp.js → index-tzdm1y3z.js} +2 -2
- package/dist/client/static/js/{index-cgzw43bc.js → index-v5npdwy2.js} +65 -65
- package/dist/client/static/js/{index-dkwhs38j.js → index-v7bcgh77.js} +2 -2
- package/dist/client/static/js/index-wytdbvax.js +3 -0
- package/dist/client/static/js/{index-n9scbxy5.js → index-yfjvx4yf.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-e31s2xvj.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-z3pqx7w8.js → infoDiagram-VRGFBTTK-yebngg8c.js} +1 -1
- package/dist/client/static/js/ini-kemnmt16.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-f5v6z8yr.js → ishikawaDiagram-OU5B5YK6-kh4nqj6q.js} +3 -3
- package/dist/client/static/js/java-caqpfm88.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-js1yxatk.js → journeyDiagram-ZHPQQLJL-4khnf8x1.js} +5 -5
- package/dist/client/static/js/json-qn73s8xb.js +1 -0
- package/dist/client/static/js/jsx-bvterpm5.js +1 -0
- package/dist/client/static/js/{julia-0h9krgsd.js → julia-svwxx41e.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-m0a6069c.js → kanban-definition-PNTS6WVX-snmq3wq4.js} +4 -4
- package/dist/client/static/js/lua-1hcfm8ya.js +1 -0
- package/dist/client/static/js/markdown-n6na4ykv.js +1 -0
- package/dist/client/static/js/{mermaid.core-6xvbnm63.js → mermaid.core-yctw30sk.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-a9f9yzc0.js → mindmap-definition-NLK3R4M7-atfv66wq.js} +3 -3
- package/dist/client/static/js/one-dark-pro-c1vnxka7.js +1 -0
- package/dist/client/static/js/one-light-mbxx52p5.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-mtzmsrk4.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-4v4pf1h1.js → pegDiagram-GJSIUBJH-hpbtxjht.js} +1 -1
- package/dist/client/static/js/{perl-rptyx23q.js → perl-mr0ds2ex.js} +1 -1
- package/dist/client/static/js/{php-sagvq3wz.js → php-5h3wt6tv.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-85nwadmj.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-a54yrmfm.js → pieDiagram-5QR66LMP-9zrtkdr2.js} +2 -2
- package/dist/client/static/js/properties-nxcks67c.js +1 -0
- package/dist/client/static/js/python-58p0gqn0.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-1twhvnp2.js → quadrantDiagram-O4NWA36T-xq970vx1.js} +6 -6
- package/dist/client/static/js/r-eyn8en0g.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-ae3jdajx.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-3m0s7cse.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-pz22c3eb.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-cgqgqq15.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-ts0nmcxb.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-83tqfdcy.js → railroadDiagram-XR7U4H2S-1g9jchbk.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-73e3pzw6.js → requirementDiagram-PLB6GJNP-ntt088y4.js} +4 -4
- package/dist/client/static/js/{ruby-9qyx7knh.js → ruby-nn836rtq.js} +1 -1
- package/dist/client/static/js/{rust-jds4e4r7.js → rust-eygk56y5.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-1bzwj6sb.js → sankeyDiagram-IPEJSGJF-95k8c5v6.js} +5 -5
- package/dist/client/static/js/{sass-07rteya0.js → sass-c2bk03e4.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-qfvxrwfa.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-1n121yp6.js → sizeCapture-INFHLROL-0m7dc5nd.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-0tdrzn06.js → stateDiagram-v2-GCMORJYK-femwcn7n.js} +5 -5
- package/dist/client/static/js/{svelte-w365cpwa.js → svelte-bfy1rq5g.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-77n1ttdw.js → swimlanes-2SLR337P-5n1qq48r.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-n85hawg8.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-b6r0k3e8.js → timeline-definition-EJHVYXUP-vdsj18be.js} +7 -7
- package/dist/client/static/js/treeView-Q6P3EWNA-fvpt3hm8.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-4z9s24je.js +1 -0
- package/dist/client/static/js/tsx-fnzxsv25.js +1 -0
- package/dist/client/static/js/typescript-0ppbqrb6.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-efq58m3m.js → usecaseDiagram-POWQR4AR-psjbrprk.js} +43 -43
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-ad4gvd5r.js → vennDiagram-UO4OBE2U-4yn9kac9.js} +7 -7
- package/dist/client/static/js/{vue-d6cesny1.js → vue-0fwtgwj4.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-73mrhkmy.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-v89tys2p.js → wardleyDiagram-VNRHLVJA-js0tbpca.js} +3 -3
- package/dist/client/static/js/xml-v1ytr8qz.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-xtgzmknw.js → xychartDiagram-PMCCYNJV-svr38ygh.js} +5 -5
- package/dist/client/static/js/yaml-txrqz62t.js +1 -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/mobile-main-view/Header.test.tsx +2 -3
- package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -10
- 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 +26 -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 +167 -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 +106 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +221 -0
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +315 -0
- package/src/client/components/workspace/panel-tabs/index.tsx +97 -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/panel-nav.test.ts +102 -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/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/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 +7 -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 +162 -0
- package/src/shared/lib/workspace/panel-nav.ts +105 -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 +50 -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-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/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
|
@@ -4,30 +4,36 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The single writer for the chat column's width
|
|
7
|
+
* The single writer for the chat column's width.
|
|
8
8
|
*
|
|
9
|
-
* The mode is an ATTRIBUTE on `<html
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* The preset mode is an ATTRIBUTE on `<html>` and the dragged width is an
|
|
10
|
+
* inline custom property on the same element; CSS is the only consumer: the
|
|
11
|
+
* column's `max-width` comes from `--chat-column-max` in
|
|
12
|
+
* `src/client/tailwind.css`, overridden inline for `custom`. That is why this
|
|
13
|
+
* module exports no hook — nothing in the timeline reads the width in
|
|
14
|
+
* JavaScript, and a hook would exist only to re-render a subtree that CSS
|
|
15
|
+
* already updates. The two places that need the NUMBER are the drag handle (it
|
|
16
|
+
* measures the DOM and writes through `commitChatColumnWidth`) and the settings
|
|
17
|
+
* card (it reads the stored value).
|
|
14
18
|
*
|
|
15
19
|
* The attribute is written at boot (`initChatWidthMode`, before the first
|
|
16
|
-
* render) and on every change from the settings modal
|
|
17
|
-
* (`applyChatWidthMode`)
|
|
18
|
-
*
|
|
19
|
-
* `resolveChatWidthMode`.
|
|
20
|
+
* render) and on every change — from the settings modal
|
|
21
|
+
* (`applyChatWidthMode`) and from a drag (`commitChatColumnWidth`). A stored
|
|
22
|
+
* value this build cannot draw resolves to the default rather than to an
|
|
23
|
+
* attribute no rule matches — see `resolveChatWidthMode`.
|
|
20
24
|
*
|
|
21
25
|
* There is deliberately no document observer here, unlike `theme.ts`: the theme
|
|
22
26
|
* has runtime consumers that cannot read CSS (the mermaid hydrator repaints
|
|
23
27
|
* diagrams), so it needs an event. A width has none.
|
|
24
28
|
*/
|
|
25
29
|
|
|
26
|
-
import { readKabmoSetting } from '@/shared/lib/settings/client';
|
|
30
|
+
import { readKabmoSetting, writeKabmoSettings } from '@/shared/lib/settings/client';
|
|
27
31
|
import type { SettingsState } from '@/shared/types';
|
|
28
32
|
import {
|
|
33
|
+
CHAT_COLUMN_MAX_VAR,
|
|
29
34
|
CHAT_WIDTH_ATTRIBUTE,
|
|
30
35
|
DEFAULT_CHAT_WIDTH_MODE,
|
|
36
|
+
resolveChatColumnWidth,
|
|
31
37
|
resolveChatWidthMode,
|
|
32
38
|
} from '@/shared/lib/chat/timeline/width-mode';
|
|
33
39
|
|
|
@@ -41,28 +47,95 @@ import {
|
|
|
41
47
|
export const CHAT_WIDTH_SETTING_KEY = 'chatWidthMode' satisfies keyof SettingsState;
|
|
42
48
|
|
|
43
49
|
/**
|
|
44
|
-
*
|
|
50
|
+
* The stored pixel width of a `custom` column. Kept even while a preset is
|
|
51
|
+
* active, so switching back to Custom restores the width the user dragged
|
|
52
|
+
* instead of a placeholder.
|
|
53
|
+
*/
|
|
54
|
+
export const CHAT_COLUMN_WIDTH_SETTING_KEY = 'chatColumnWidth' satisfies keyof SettingsState;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Point the document at `mode`, with `width` as the number behind `custom`.
|
|
45
58
|
*
|
|
46
59
|
* The default is REMOVED rather than written, so a document carrying `wide`
|
|
47
60
|
* and a document carrying nothing are the same state — which is what makes the
|
|
48
|
-
* `:root` fallback in CSS the single statement of the default width.
|
|
61
|
+
* `:root` fallback in CSS the single statement of the default width. The inline
|
|
62
|
+
* custom property is removed for every preset for the same reason: a leftover
|
|
63
|
+
* `--chat-column-max: 1120px` on `<html>` would beat every preset rule, because
|
|
64
|
+
* an inline declaration outranks a stylesheet one.
|
|
49
65
|
*/
|
|
50
|
-
export function applyChatWidthMode(mode: unknown): void {
|
|
66
|
+
export function applyChatWidthMode(mode: unknown, width?: unknown): void {
|
|
51
67
|
if (typeof document === 'undefined') return;
|
|
52
68
|
const root = document.documentElement;
|
|
53
69
|
const resolved = resolveChatWidthMode(mode);
|
|
70
|
+
root.style.removeProperty(CHAT_COLUMN_MAX_VAR);
|
|
71
|
+
|
|
72
|
+
if (resolved === 'custom') {
|
|
73
|
+
root.setAttribute(CHAT_WIDTH_ATTRIBUTE, 'custom');
|
|
74
|
+
root.style.setProperty(CHAT_COLUMN_MAX_VAR, `${resolveChatColumnWidth(width)}px`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
54
78
|
if (resolved === DEFAULT_CHAT_WIDTH_MODE) root.removeAttribute(CHAT_WIDTH_ATTRIBUTE);
|
|
55
79
|
else root.setAttribute(CHAT_WIDTH_ATTRIBUTE, resolved);
|
|
56
80
|
}
|
|
57
81
|
|
|
58
82
|
/**
|
|
59
|
-
*
|
|
83
|
+
* Draw a width while the pointer is still moving, WITHOUT storing it.
|
|
84
|
+
*
|
|
85
|
+
* The drag itself owns this: every `pointermove` repaints the transcript and
|
|
86
|
+
* the composer (one CSS variable), and only the release persists. Persisting
|
|
87
|
+
* per frame would POST to `/api/settings` dozens of times for a width the user
|
|
88
|
+
* is still choosing.
|
|
89
|
+
*
|
|
90
|
+
* Deliberately silent about the mode attribute: a drag is a `custom` width, but
|
|
91
|
+
* a drag that is abandoned (`pointercancel`, a window blur) must leave the
|
|
92
|
+
* stored preset intact, and the attribute is what the next render resolves
|
|
93
|
+
* against.
|
|
94
|
+
*/
|
|
95
|
+
export function previewChatColumnWidth(px: number): void {
|
|
96
|
+
if (typeof document === 'undefined') return;
|
|
97
|
+
document.documentElement.style.setProperty(CHAT_COLUMN_MAX_VAR, `${resolveChatColumnWidth(px)}px`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Commit a dragged width: `custom` mode plus its number, applied and stored.
|
|
102
|
+
*
|
|
103
|
+
* Both keys travel in ONE patch. Writing the mode first and the width second
|
|
104
|
+
* leaves a window (and a failed second request) where the document claims
|
|
105
|
+
* `custom` while the stored number is an older one — the column would jump on
|
|
106
|
+
* the next reload with no gesture to explain it.
|
|
107
|
+
*/
|
|
108
|
+
export function commitChatColumnWidth(px: number): number {
|
|
109
|
+
const width = resolveChatColumnWidth(px);
|
|
110
|
+
writeKabmoSettings({ [CHAT_WIDTH_SETTING_KEY]: 'custom', [CHAT_COLUMN_WIDTH_SETTING_KEY]: width });
|
|
111
|
+
applyChatWidthMode('custom', width);
|
|
112
|
+
return width;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Apply the stored width before the first render.
|
|
60
117
|
*
|
|
61
118
|
* Called from `main.tsx` right after `primeKabmoSettings`, because the boot
|
|
62
119
|
* payload is what `readKabmoSetting` answers from. Without it a user on
|
|
63
|
-
* `compact` would see the default column for
|
|
64
|
-
*
|
|
120
|
+
* `compact` (or on a dragged `custom` width) would see the default column for
|
|
121
|
+
* one frame and then watch it snap.
|
|
65
122
|
*/
|
|
66
123
|
export function initChatWidthMode(): void {
|
|
67
|
-
applyChatWidthMode(
|
|
124
|
+
applyChatWidthMode(
|
|
125
|
+
readKabmoSetting<unknown>(CHAT_WIDTH_SETTING_KEY),
|
|
126
|
+
readKabmoSetting<unknown>(CHAT_COLUMN_WIDTH_SETTING_KEY),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Put the document back on the STORED width, discarding a live preview.
|
|
132
|
+
*
|
|
133
|
+
* A drag paints the variable and stores nothing, so a gesture that ends without
|
|
134
|
+
* a commit (a cancelled pointer, a click on the grip with no movement, a window
|
|
135
|
+
* that lost the pointer) leaves an inline value that outranks every preset
|
|
136
|
+
* rule. Re-applying the stored mode is the one way back, and it is why the
|
|
137
|
+
* preview lives in this module rather than in the hook.
|
|
138
|
+
*/
|
|
139
|
+
export function restoreChatColumnWidth(): void {
|
|
140
|
+
initChatWidthMode();
|
|
68
141
|
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `data-borders` on `<html>`, and the CSS set it points at.
|
|
8
|
+
*
|
|
9
|
+
* Two facts a wrong implementation breaks silently, and neither is visible in a
|
|
10
|
+
* component test:
|
|
11
|
+
*
|
|
12
|
+
* 1. **`hairline` CLEARS the attribute.** It is the state CSS paints with no
|
|
13
|
+
* attribute, so writing `data-borders="hairline"` would make a reloaded
|
|
14
|
+
* document disagree with the one the server served.
|
|
15
|
+
* 2. **The CSS removes COLOUR, never width.** `box-sizing: border-box` is
|
|
16
|
+
* global, so a width of 0 would shorten every box by 2px and shift the whole
|
|
17
|
+
* layout — the defect this assertion exists to catch, because it would look
|
|
18
|
+
* like "the setting moved the panels" rather than "the setting is wrong".
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
22
|
+
import { Window } from 'happy-dom';
|
|
23
|
+
import { applyBorderStyle, initBorderStyle } from '@/client/hooks/ui/border-style';
|
|
24
|
+
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
25
|
+
import { DEFAULT_SETTINGS } from '@/shared/lib/settings/defaults';
|
|
26
|
+
import { BORDER_STYLE_SETTING_KEY } from '@/shared/lib/theme/border-style';
|
|
27
|
+
import { readClientCss, ruleBody } from '@/test-support/glass-css';
|
|
28
|
+
|
|
29
|
+
const DOM_GLOBALS = ['window', 'document'] as const;
|
|
30
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
const win = new Window({ url: 'http://localhost' });
|
|
34
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
35
|
+
for (const key of DOM_GLOBALS) {
|
|
36
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = win[key as keyof Window];
|
|
37
|
+
target[key] = win[key as keyof Window];
|
|
38
|
+
}
|
|
39
|
+
document.documentElement.removeAttribute('data-borders');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterAll(() => {
|
|
43
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
44
|
+
for (const key of DOM_GLOBALS) {
|
|
45
|
+
if (key in nativeGlobals) target[key] = nativeGlobals[key];
|
|
46
|
+
else delete target[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('applyBorderStyle', () => {
|
|
51
|
+
test('borderless is written as the attribute the CSS keys on', () => {
|
|
52
|
+
applyBorderStyle('borderless');
|
|
53
|
+
|
|
54
|
+
expect(document.documentElement.getAttribute('data-borders')).toBe('borderless');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('hairline CLEARS the attribute instead of writing it', () => {
|
|
58
|
+
applyBorderStyle('borderless');
|
|
59
|
+
applyBorderStyle('hairline');
|
|
60
|
+
|
|
61
|
+
expect(document.documentElement.hasAttribute('data-borders')).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('an unknown value resolves to hairline and therefore writes nothing', () => {
|
|
65
|
+
applyBorderStyle('borderless');
|
|
66
|
+
applyBorderStyle('naked');
|
|
67
|
+
|
|
68
|
+
expect(document.documentElement.hasAttribute('data-borders')).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('the boot path', () => {
|
|
73
|
+
test('a stored borderless style is applied from the primed snapshot', () => {
|
|
74
|
+
primeKabmoSettings({ kabmo_settings: { borderStyle: 'borderless' } });
|
|
75
|
+
initBorderStyle();
|
|
76
|
+
|
|
77
|
+
expect(document.documentElement.getAttribute('data-borders')).toBe('borderless');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('an install with no stored preference boots the ruled look', () => {
|
|
81
|
+
primeKabmoSettings({});
|
|
82
|
+
initBorderStyle();
|
|
83
|
+
|
|
84
|
+
expect(document.documentElement.hasAttribute('data-borders')).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('the settings key names a real field, so the write survives a reload', () => {
|
|
88
|
+
expect(Object.keys(DEFAULT_SETTINGS)).toContain(BORDER_STYLE_SETTING_KEY);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('borders.css', () => {
|
|
93
|
+
const rootSelector = ':root[data-borders="borderless"]';
|
|
94
|
+
|
|
95
|
+
/** The stylesheet without its comments, so prose about a property is not read as the property. */
|
|
96
|
+
const declarations = async (): Promise<string> => (await readClientCss('borders.css')).replace(/\/\*[\s\S]*?\*\//g, '');
|
|
97
|
+
|
|
98
|
+
/** Every rule's selector, multi-line selector lists included. */
|
|
99
|
+
const selectors = (css: string): string[] => {
|
|
100
|
+
const found: string[] = [];
|
|
101
|
+
let cursor = 0;
|
|
102
|
+
while ((cursor = css.indexOf('{', cursor)) >= 0) {
|
|
103
|
+
const start = css.lastIndexOf('}', cursor) + 1;
|
|
104
|
+
found.push(css.slice(start, cursor).trim());
|
|
105
|
+
cursor += 1;
|
|
106
|
+
}
|
|
107
|
+
return found;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
test('the whole set is scoped to the document attribute, so hairline is untouched', async () => {
|
|
111
|
+
const all = selectors(await declarations());
|
|
112
|
+
expect(all.length).toBeGreaterThan(2);
|
|
113
|
+
// A rule without the attribute would remove a border for EVERY install, not
|
|
114
|
+
// just a borderless one — the failure a template-literal selector invites.
|
|
115
|
+
for (const selector of all) {
|
|
116
|
+
expect({ selector, scoped: selector.startsWith(rootSelector) }).toEqual({ selector, scoped: true });
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('the hairline rungs are cleared by COLOUR, never by width', async () => {
|
|
121
|
+
const css = await declarations();
|
|
122
|
+
expect(css).toContain('border-color: transparent');
|
|
123
|
+
// `border-width: 0` / `border: none` would change every box's geometry.
|
|
124
|
+
expect(css).not.toMatch(/border-width\s*:\s*0/);
|
|
125
|
+
expect(css).not.toMatch(/border\s*:\s*(none|0)\b/);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('every structural rung is covered, and no interaction rung is', async () => {
|
|
129
|
+
const css = await declarations();
|
|
130
|
+
// `/5`–`/20` is the structural layer (a separator, a panel's edge, a card's
|
|
131
|
+
// outline). `/25` and up is hover / focus / active, which must keep working.
|
|
132
|
+
for (const rung of ['5', '6', '8', '10', '12', '15', '20']) {
|
|
133
|
+
expect({ rung, covered: new RegExp(`\\.border-ink\\\\/${rung}(?![\\d])`).test(css) })
|
|
134
|
+
.toEqual({ rung, covered: true });
|
|
135
|
+
}
|
|
136
|
+
for (const rung of ['25', '30', '40', '50', '60']) {
|
|
137
|
+
expect({ rung, listed: new RegExp(`border-ink\\\\/${rung}(?![\\d])`).test(css) })
|
|
138
|
+
.toEqual({ rung, listed: false });
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('a form control keeps its own edge through the exemption list', async () => {
|
|
143
|
+
const css = await declarations();
|
|
144
|
+
const rule = css.slice(css.indexOf(':is('), css.indexOf('border-color: transparent'));
|
|
145
|
+
// A field with no edge is a field you cannot find; a `button` is NOT exempt,
|
|
146
|
+
// because most of them are cards and chips whose outline is decoration.
|
|
147
|
+
for (const tag of ['input', 'textarea', 'select', 'kbd', '[role="switch"]', '[contenteditable="true"]']) {
|
|
148
|
+
expect({ tag, exempt: rule.includes(tag) }).toEqual({ tag, exempt: true });
|
|
149
|
+
}
|
|
150
|
+
expect(rule).not.toContain('button');
|
|
151
|
+
// A dashed box is an affordance, not a separator.
|
|
152
|
+
expect(rule).toContain('.border-dashed');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('a dialog keeps an edge via outline, never by replacing its shadow', async () => {
|
|
156
|
+
const css = await declarations();
|
|
157
|
+
const start = css.indexOf(':is(.glass-overlay, .glass-popover)');
|
|
158
|
+
expect(start).toBeGreaterThan(-1);
|
|
159
|
+
const rim = css.slice(start, css.indexOf('}', start));
|
|
160
|
+
// Every carrier states its own elevation (`shadow-2xl`, `--glass-shadow`).
|
|
161
|
+
// A `box-shadow` here would REPLACE it and flatten the dialog.
|
|
162
|
+
expect(rim).toContain('outline:');
|
|
163
|
+
expect(rim).not.toContain('box-shadow');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('the published hairline tokens are cleared with the rules', async () => {
|
|
167
|
+
const css = await declarations();
|
|
168
|
+
const tokens = ruleBody(css, rootSelector);
|
|
169
|
+
expect(tokens).toContain('--glass-hairline: transparent');
|
|
170
|
+
expect(tokens).toContain('--ink-hairline: transparent');
|
|
171
|
+
});
|
|
172
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The single writer for the app's border style.
|
|
8
|
+
*
|
|
9
|
+
* The style is an ATTRIBUTE on `<html>`, and CSS is its only consumer: the
|
|
10
|
+
* `[data-borders="borderless"]` tables live in `src/client/borders.css`. That is
|
|
11
|
+
* why this module exports no hook — nothing in the shell reads the value in
|
|
12
|
+
* JavaScript, and a hook would exist only to re-render subtrees CSS already
|
|
13
|
+
* repaints.
|
|
14
|
+
*
|
|
15
|
+
* The attribute is written at boot (`initBorderStyle`, before the first render)
|
|
16
|
+
* so a borderless document never paints one ruled frame first, and on every
|
|
17
|
+
* change from the settings modal (`applyBorderStyle`).
|
|
18
|
+
*
|
|
19
|
+
* There is deliberately no document observer, unlike `theme.ts`: the theme has
|
|
20
|
+
* runtime consumers that cannot read CSS (the mermaid hydrator repaints diagrams
|
|
21
|
+
* per palette), so it needs an event. A hairline has none.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { readKabmoSetting } from '@/shared/lib/settings/client';
|
|
25
|
+
import {
|
|
26
|
+
BORDER_ATTRIBUTE,
|
|
27
|
+
BORDER_STYLE_SETTING_KEY,
|
|
28
|
+
BORDER_STYLE_WITHOUT_ATTRIBUTE,
|
|
29
|
+
resolveBorderStyle,
|
|
30
|
+
} from '@/shared/lib/theme/border-style';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Point the document at `style`.
|
|
34
|
+
*
|
|
35
|
+
* The style CSS paints with no attribute is REMOVED rather than written, so a
|
|
36
|
+
* document carrying `hairline` and a document carrying nothing are the same
|
|
37
|
+
* state — which is what makes the rule set in `tailwind.css` the single
|
|
38
|
+
* statement of the ruled look. The comparison is against that ABSENT state, not
|
|
39
|
+
* against `DEFAULT_BORDER_STYLE`: if a later release makes `borderless` the
|
|
40
|
+
* default, omitting the attribute for it would paint rules while the setting
|
|
41
|
+
* says borderless.
|
|
42
|
+
*/
|
|
43
|
+
export function applyBorderStyle(style: unknown): void {
|
|
44
|
+
if (typeof document === 'undefined') return;
|
|
45
|
+
const root = document.documentElement;
|
|
46
|
+
const resolved = resolveBorderStyle(style);
|
|
47
|
+
if (resolved === BORDER_STYLE_WITHOUT_ATTRIBUTE) root.removeAttribute(BORDER_ATTRIBUTE);
|
|
48
|
+
else root.setAttribute(BORDER_ATTRIBUTE, resolved);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Apply the stored style before the first render.
|
|
53
|
+
*
|
|
54
|
+
* Called from `main.tsx` right after `primeKabmoSettings`, because the boot
|
|
55
|
+
* payload is what `readKabmoSetting` answers from. Without it a borderless
|
|
56
|
+
* install would paint the ruled shell for one frame and then swap it.
|
|
57
|
+
*/
|
|
58
|
+
export function initBorderStyle(): void {
|
|
59
|
+
applyBorderStyle(readKabmoSetting<unknown>(BORDER_STYLE_SETTING_KEY));
|
|
60
|
+
}
|
|
@@ -18,6 +18,8 @@ import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
|
18
18
|
import {
|
|
19
19
|
NAVBAR_CONTROLS,
|
|
20
20
|
NAVBAR_HIDDEN_SETTING_KEY,
|
|
21
|
+
navbarControlItems,
|
|
22
|
+
navbarPluginControlId,
|
|
21
23
|
readHiddenControls,
|
|
22
24
|
toggleHiddenControl,
|
|
23
25
|
} from '@/client/hooks/ui/navbar-controls';
|
|
@@ -43,8 +45,32 @@ describe('navbar controls', () => {
|
|
|
43
45
|
// The menu and the row share these ids; a row with no control would be a
|
|
44
46
|
// checkbox that hides nothing.
|
|
45
47
|
const ids = NAVBAR_CONTROLS.map((item) => item.id);
|
|
46
|
-
expect(ids).toEqual(['install', 'reload', 'context', 'signout', '
|
|
48
|
+
expect(ids).toEqual(['install', 'reload', 'context', 'signout', 'right-panel']);
|
|
47
49
|
primeKabmoSettings({ [NAVBAR_HIDDEN_SETTING_KEY]: ids });
|
|
48
50
|
expect(readHiddenControls()).toEqual(ids);
|
|
49
51
|
});
|
|
52
|
+
|
|
53
|
+
test('a plugin entry is `plugin:<pluginId>`, never one of its panel keys', () => {
|
|
54
|
+
expect(navbarPluginControlId('stats')).toBe('plugin:stats');
|
|
55
|
+
// An installed plugin's entry may be hidden before its bundle reports in,
|
|
56
|
+
// so the SHAPE is what validation keeps; a panel instance key is a
|
|
57
|
+
// different control and must not become a menu row.
|
|
58
|
+
primeKabmoSettings({
|
|
59
|
+
[NAVBAR_HIDDEN_SETTING_KEY]: ['plugin:stats', 'plugin:stats:rightPanel', 'plugin:'],
|
|
60
|
+
});
|
|
61
|
+
expect(readHiddenControls()).toEqual(['plugin:stats']);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('the menu puts a plugin entry where the row draws it', () => {
|
|
65
|
+
const items = navbarControlItems([{ pluginId: 'stats', title: 'Stats' }]);
|
|
66
|
+
expect(items.map((item) => item.id)).toEqual([
|
|
67
|
+
'install',
|
|
68
|
+
'plugin:stats',
|
|
69
|
+
'reload',
|
|
70
|
+
'context',
|
|
71
|
+
'signout',
|
|
72
|
+
'right-panel',
|
|
73
|
+
]);
|
|
74
|
+
expect(items[1]!.title).toBe('Stats');
|
|
75
|
+
});
|
|
50
76
|
});
|
|
@@ -15,13 +15,26 @@
|
|
|
15
15
|
* same row in every session, so a per-session set would move the user's own
|
|
16
16
|
* arrangement when they picked another chat.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* BOTH headers read this set: the desktop navbar's right-click and the phone's
|
|
19
|
+
* long-press open the same `VisibilityMenu`, so a control switched off on one
|
|
20
|
+
* layout is off on the other rather than silently returning after a resize.
|
|
21
|
+
*
|
|
22
|
+
* A PLUGIN's header entry is a control too. Its id is `plugin:<pluginId>` —
|
|
23
|
+
* the enablement key's own form — so the menu row, the stored set and the
|
|
24
|
+
* entry the plugin registered all name the same thing. A plugin's bundle may
|
|
25
|
+
* not have loaded yet when the set is read, which is why validation accepts
|
|
26
|
+
* the SHAPE of a plugin id instead of resolving it against the registry:
|
|
27
|
+
* dropping it on a slow import would switch the user's choice back on.
|
|
28
|
+
*
|
|
29
|
+
* The layout switch is NOT here either: it moved to the sidebar footer, where
|
|
30
|
+
* the phone's own mirror control ("Desktop") sits in the same slot. A control
|
|
31
|
+
* that lives in one layout's row and the other layout's footer has no single
|
|
32
|
+
* row for this menu to hide.
|
|
21
33
|
*/
|
|
22
34
|
|
|
23
35
|
import { useCallback, useSyncExternalStore } from 'preact/compat';
|
|
24
36
|
import { readKabmoSetting, writeSetting } from '@/shared/lib/settings/client';
|
|
37
|
+
import { PLUGIN_PANEL_PREFIX } from '@/shared/lib/workspace/panel-ids';
|
|
25
38
|
|
|
26
39
|
/** `app_settings` key holding the hidden control ids. */
|
|
27
40
|
export const NAVBAR_HIDDEN_SETTING_KEY = 'omp_navbar_hidden_controls';
|
|
@@ -37,20 +50,57 @@ export const NAVBAR_CONTROL = {
|
|
|
37
50
|
reload: 'reload',
|
|
38
51
|
context: 'context',
|
|
39
52
|
signout: 'signout',
|
|
40
|
-
editor: 'editor',
|
|
41
53
|
rightPanel: 'right-panel',
|
|
42
|
-
mobile: 'mobile',
|
|
43
54
|
} as const;
|
|
44
55
|
|
|
45
56
|
export type NavbarControlId = (typeof NAVBAR_CONTROL)[keyof typeof NAVBAR_CONTROL];
|
|
46
57
|
|
|
47
58
|
export interface NavbarControlItem {
|
|
48
|
-
id
|
|
59
|
+
/** A built-in control id, or `plugin:<pluginId>` for a plugin's entry. */
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A plugin entry the row can draw, as the menu needs to name it. */
|
|
65
|
+
export interface NavbarPluginEntry {
|
|
66
|
+
pluginId: string;
|
|
49
67
|
title: string;
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
/**
|
|
53
|
-
*
|
|
71
|
+
* The id a plugin's navbar entry is switched by: `plugin:<pluginId>`.
|
|
72
|
+
*
|
|
73
|
+
* The same string `pluginEnablementKey` produces, deliberately: one plugin is
|
|
74
|
+
* one id across the panel catalog, the enablement rows and this menu, so a
|
|
75
|
+
* stored choice cannot belong to a control that no longer exists under that
|
|
76
|
+
* name. It is NOT a `plugin:<pluginId>:<slot>` panel instance key — a header
|
|
77
|
+
* entry is the plugin's, not one of its panels.
|
|
78
|
+
*/
|
|
79
|
+
export function navbarPluginControlId(pluginId: string): string {
|
|
80
|
+
return `${PLUGIN_PANEL_PREFIX}${pluginId}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Whether an id names a plugin's navbar entry (and not one of its panels). */
|
|
84
|
+
export function isNavbarPluginControlId(id: string): boolean {
|
|
85
|
+
if (!id.startsWith(PLUGIN_PANEL_PREFIX)) return false;
|
|
86
|
+
const pluginId = id.slice(PLUGIN_PANEL_PREFIX.length);
|
|
87
|
+
return pluginId.length > 0 && !pluginId.includes(':');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Each built-in control's menu label. */
|
|
91
|
+
const CONTROL_TITLES: Record<NavbarControlId, string> = {
|
|
92
|
+
install: 'Install app',
|
|
93
|
+
reload: 'Reload page',
|
|
94
|
+
context: 'Context usage',
|
|
95
|
+
signout: 'Sign out',
|
|
96
|
+
'right-panel': 'Right side',
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The BUILT-IN controls the menu can switch, in the row's own order.
|
|
101
|
+
*
|
|
102
|
+
* The plugin entries are not here — they are a runtime fact, and
|
|
103
|
+
* `navbarControlItems` splices them where the row draws them.
|
|
54
104
|
*
|
|
55
105
|
* The window's caption buttons are not here: they are the window's, not the
|
|
56
106
|
* page's, and a hidden close button is a window the user cannot close. The
|
|
@@ -58,15 +108,32 @@ export interface NavbarControlItem {
|
|
|
58
108
|
* it is the only mouse way back, the same reason the rail pins its sessions
|
|
59
109
|
* view.
|
|
60
110
|
*/
|
|
61
|
-
export const NAVBAR_CONTROLS: NavbarControlItem[] =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
];
|
|
111
|
+
export const NAVBAR_CONTROLS: NavbarControlItem[] = (
|
|
112
|
+
[
|
|
113
|
+
NAVBAR_CONTROL.install,
|
|
114
|
+
NAVBAR_CONTROL.reload,
|
|
115
|
+
NAVBAR_CONTROL.context,
|
|
116
|
+
NAVBAR_CONTROL.signout,
|
|
117
|
+
NAVBAR_CONTROL.rightPanel,
|
|
118
|
+
] satisfies NavbarControlId[]
|
|
119
|
+
).map((id) => ({ id, title: CONTROL_TITLES[id] }));
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* What the menu lists, in the row's own order: install, the plugins' entries,
|
|
123
|
+
* then reload, context, sign-out and the right side.
|
|
124
|
+
*
|
|
125
|
+
* Built here rather than at each surface so the menu and the row cannot drift
|
|
126
|
+
* when a plugin is installed or removed: a plugin that adds a control adds a
|
|
127
|
+
* menu row, and the two headers that offer the menu list it in the same place
|
|
128
|
+
* the row draws it.
|
|
129
|
+
*/
|
|
130
|
+
export function navbarControlItems(plugins: readonly NavbarPluginEntry[]): NavbarControlItem[] {
|
|
131
|
+
return NAVBAR_CONTROLS.flatMap((item) =>
|
|
132
|
+
item.id === NAVBAR_CONTROL.install
|
|
133
|
+
? [item, ...plugins.map((plugin) => ({ id: navbarPluginControlId(plugin.pluginId), title: plugin.title }))]
|
|
134
|
+
: [item],
|
|
135
|
+
);
|
|
136
|
+
}
|
|
70
137
|
|
|
71
138
|
const listeners = new Set<() => void>();
|
|
72
139
|
|
|
@@ -82,9 +149,10 @@ function subscribe(listener: () => void): () => void {
|
|
|
82
149
|
/**
|
|
83
150
|
* The stored set, validated.
|
|
84
151
|
*
|
|
85
|
-
* An id this build does not know is DROPPED rather than kept
|
|
86
|
-
*
|
|
87
|
-
*
|
|
152
|
+
* An id this build does not know is DROPPED rather than kept, with ONE
|
|
153
|
+
* exception: a plugin's id is validated by its SHAPE (`plugin:<pluginId>`),
|
|
154
|
+
* because the set may be read before that plugin's bundle has loaded. Dropping
|
|
155
|
+
* it then would switch the user's choice back on at the next render.
|
|
88
156
|
*/
|
|
89
157
|
export function readHiddenControls(): string[] {
|
|
90
158
|
const source = readKabmoSetting<unknown>(NAVBAR_HIDDEN_SETTING_KEY);
|
|
@@ -92,7 +160,14 @@ export function readHiddenControls(): string[] {
|
|
|
92
160
|
lastSource = source;
|
|
93
161
|
const known = new Set<string>(NAVBAR_CONTROLS.map((item) => item.id));
|
|
94
162
|
cached = Array.isArray(source)
|
|
95
|
-
? [
|
|
163
|
+
? [
|
|
164
|
+
...new Set(
|
|
165
|
+
source.filter(
|
|
166
|
+
(id): id is string =>
|
|
167
|
+
typeof id === 'string' && (known.has(id) || isNavbarPluginControlId(id)),
|
|
168
|
+
),
|
|
169
|
+
),
|
|
170
|
+
]
|
|
96
171
|
: [];
|
|
97
172
|
return cached;
|
|
98
173
|
}
|
|
@@ -25,6 +25,7 @@ import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
|
25
25
|
import { DEFAULT_SETTINGS } from '@/shared/lib/settings/defaults';
|
|
26
26
|
import { SURFACE_STYLE_SETTING_KEY } from '@/shared/lib/theme/surface-style';
|
|
27
27
|
import { ICON_STYLE_SETTING_KEY } from '@/shared/lib/theme/icon-style';
|
|
28
|
+
import { BORDER_STYLE_SETTING_KEY } from '@/shared/lib/theme/border-style';
|
|
28
29
|
|
|
29
30
|
const DOM_GLOBALS = ['window', 'document'] as const;
|
|
30
31
|
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
@@ -54,6 +55,7 @@ describe('the stored keys', () => {
|
|
|
54
55
|
// other. `defaults.ts` proves the FIELDS exist; this proves the KEYS name them.
|
|
55
56
|
test('each key names a real settings field', () => {
|
|
56
57
|
expect(Object.keys(DEFAULT_SETTINGS)).toContain(SURFACE_STYLE_SETTING_KEY);
|
|
58
|
+
expect(Object.keys(DEFAULT_SETTINGS)).toContain(BORDER_STYLE_SETTING_KEY);
|
|
57
59
|
expect(Object.keys(DEFAULT_SETTINGS)).toContain(ICON_STYLE_SETTING_KEY);
|
|
58
60
|
});
|
|
59
61
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The workspace the open session belongs to: the project folder, its root, and
|
|
8
|
+
* whether one exists at all.
|
|
9
|
+
*
|
|
10
|
+
* Extracted from `DesktopLayout` for the repository's per-file ceiling, and it
|
|
11
|
+
* is one fact rather than three: the folder pick, the session's own root and
|
|
12
|
+
* `hasActiveContext` are the same question asked at three resolutions, and a
|
|
13
|
+
* layout that derived them separately let a worktree session read its original
|
|
14
|
+
* checkout.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { useMemo } from 'preact/hooks';
|
|
18
|
+
import { useSearchParams } from '@/client/lib/router/search-params';
|
|
19
|
+
import { activeProjectForSession, effectiveRootFor } from '@/shared/lib/workspace/active-project';
|
|
20
|
+
import type { WorkspaceFolderData } from '@/shared/types/workspace';
|
|
21
|
+
|
|
22
|
+
export interface ActiveWorkspaceProject {
|
|
23
|
+
folder: WorkspaceFolderData | null;
|
|
24
|
+
/** The root panels read: the session's own (a worktree) or its folder's. */
|
|
25
|
+
path: string | null;
|
|
26
|
+
hasActiveContext: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useActiveWorkspaceProject(folders: WorkspaceFolderData[], sessionId: string | null): ActiveWorkspaceProject {
|
|
30
|
+
const [searchParams] = useSearchParams();
|
|
31
|
+
const folderIdParam = searchParams.get('folderId');
|
|
32
|
+
const folder = useMemo(() => {
|
|
33
|
+
const sessionFolder = activeProjectForSession(folders, sessionId || '').folder;
|
|
34
|
+
if (sessionFolder) return sessionFolder;
|
|
35
|
+
if (folderIdParam) return folders.find((entry) => String(entry.id) === String(folderIdParam)) ?? null;
|
|
36
|
+
return null;
|
|
37
|
+
}, [folders, sessionId, folderIdParam]);
|
|
38
|
+
// A worktree session runs OUTSIDE its folder's project path, so the panels
|
|
39
|
+
// follow the session's own root — the checkout it left would otherwise be what
|
|
40
|
+
// Files, Search, Git and the terminal read.
|
|
41
|
+
const path = useMemo(
|
|
42
|
+
() => effectiveRootFor(folders, sessionId || '') ?? folder?.project_path ?? null,
|
|
43
|
+
[folders, sessionId, folder],
|
|
44
|
+
);
|
|
45
|
+
return { folder, path, hasActiveContext: !!folder };
|
|
46
|
+
}
|