@kabmo-labs/kabmo 0.46.1 → 0.47.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 +439 -435
- package/dist/client/static/js/{CsvGrid-qdkmv8bj.js → CsvGrid-vfgttmym.js} +2 -2
- package/dist/client/static/js/{DocxView-k84ns803.js → DocxView-dc41t6rp.js} +2 -2
- package/dist/client/static/js/{DrawioView-r1n717f7.js → DrawioView-wpwr38d9.js} +2 -2
- package/dist/client/static/js/HtmlPreview-23n7t5cs.js +1 -0
- package/dist/client/static/js/ImageView-mvjb3qh1.js +1 -0
- package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +2 -0
- package/dist/client/static/js/{Modal-xe6h99jn.js → Modal-dsqhas10.js} +13 -13
- package/dist/client/static/js/{PdfView-ffg4mccg.js → PdfView-cpvsbfk0.js} +1 -1
- package/dist/client/static/js/{SessionsView-cdcbsee9.js → SessionsView-s0crtcm8.js} +1 -1
- package/dist/client/static/js/{SheetView-89sscpz6.js → SheetView-n6mst0hq.js} +13 -13
- package/dist/client/static/js/{SvgPreview-68c0ccbv.js → SvgPreview-g2aqq812.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-h3a5s259.js → abnfDiagram-O67JEVCF-3vac8sq4.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-983p0jgn.js → architectureDiagram-NJMV4G6O-1nh4htz2.js} +3 -3
- package/dist/client/static/js/{astro-hyj5wege.js → astro-63zcysj7.js} +1 -1
- package/dist/client/static/js/bash-hv3167gh.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-16pse5mh.js → blockDiagram-BEXU5L5S-62z6kaar.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-mvnb00zt.js → c4Diagram-YGBWAQC7-rts5zgx4.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-kmpd91xb.js → classDiagram-v2-NBCMYWYE-tnpww186.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-3ek5r5se.js → cose-bilkent-JH36ORCC-8vsjbzwa.js} +1 -1
- package/dist/client/static/js/cpp-v2mqp8j7.js +1 -0
- package/dist/client/static/js/css-x7gyc3ta.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-jkbh84zn.js → cynefinDiagram-VND7K2PF-005gc8km.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-4fdc0sgn.js → dagre-6A5THRUB-41zsteyd.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-hbk61nq9.js → diagram-22UHCM2B-prsm18a1.js} +3 -3
- package/dist/client/static/js/{diagram-3UASUU5V-hfpbr9qh.js → diagram-3UASUU5V-5nx9wf04.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-fn0nt71a.js → diagram-ATOU4E4O-k3d4z3aq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-ssswxjeb.js → diagram-CDSNMT55-x2c5x5j2.js} +2 -2
- package/dist/client/static/js/{diagram-MLGK6HIB-whnzxv6f.js → diagram-MLGK6HIB-nvr76jqh.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-hk1chzxk.js → diagram-MPIPVDR6-v1jpzp9p.js} +1 -1
- package/dist/client/static/js/{dockerfile-zmsj8r4g.js → dockerfile-vz6va73h.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-q1vkg5mr.js → ebnfDiagram-ZINNZB2B-0v4tqr9v.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-kt98vg8j.js → elk-276RUBZZ-qfn4r7xj.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-ey3avsn9.js → erDiagram-OPXOYQCR-cd667n9f.js} +4 -4
- package/dist/client/static/js/{erlang-814e8qy5.js → erlang-vk66vt7q.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-a9k1at43.js → ganttDiagram-FUAMR5RP-ps0h3drm.js} +1 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-gnekjfym.js → gitGraphDiagram-X574FWY7-fts23jer.js} +2 -2
- package/dist/client/static/js/graphql-a4gbqpj9.js +1 -0
- package/dist/client/static/js/{index-xq5f3nxa.js → index-0dkc6z8e.js} +2 -2
- package/dist/client/static/js/{index-m4k054wz.js → index-1d8bxjsz.js} +3 -3
- package/dist/client/static/js/{index-kty4ncsr.js → index-1whzs9kb.js} +2 -2
- package/dist/client/static/js/{index-qfxn7yh5.js → index-396r53n0.js} +2 -2
- package/dist/client/static/js/{index-kbhrvep8.js → index-39d8zbkx.js} +3 -3
- package/dist/client/static/js/{index-dn7hg4em.js → index-3nsrnyqr.js} +2 -2
- package/dist/client/static/js/{index-1ax52p0q.js → index-4jzsr1ky.js} +2 -2
- package/dist/client/static/js/{index-2a6qp9y6.js → index-4wnzs76g.js} +1 -1
- package/dist/client/static/js/{index-hgzntg2j.js → index-4x9p7hf9.js} +2 -2
- package/dist/client/static/js/{index-fzngzhww.js → index-52nd4hgm.js} +1 -1
- package/dist/client/static/js/{index-pavvxrsz.js → index-54mkp2r2.js} +1 -1
- package/dist/client/static/js/{index-abs635a1.js → index-56rtb871.js} +25 -25
- package/dist/client/static/js/{index-dxvtjn6a.js → index-5f4b44ay.js} +2 -2
- package/dist/client/static/js/{index-q9ytjey8.js → index-6009v8jf.js} +1 -1
- package/dist/client/static/js/{index-e9cxje00.js → index-62jgcgfd.js} +5 -5
- package/dist/client/static/js/{index-nw5mvcaj.js → index-64p1dncg.js} +2 -2
- package/dist/client/static/js/{index-fj5rsp5v.js → index-6d6hxwb5.js} +2 -2
- package/dist/client/static/js/{index-19x11s5w.js → index-70g527sb.js} +2 -2
- package/dist/client/static/js/{index-ykm7a3cp.js → index-7zeah164.js} +2 -2
- package/dist/client/static/js/{index-z25ss7xj.js → index-7zedprz3.js} +1 -1
- package/dist/client/static/js/{index-g7s0wsag.js → index-9ab6xaxd.js} +2 -2
- package/dist/client/static/js/index-9vqkyj58.js +3 -0
- package/dist/client/static/js/{index-60v30k5h.js → index-9xsf8162.js} +35 -35
- package/dist/client/static/js/{index-3x7h2eqj.js → index-a4h5np9r.js} +2 -2
- package/dist/client/static/js/{index-9vv7wr1n.js → index-an2wv33f.js} +2 -2
- package/dist/client/static/js/{index-64sqfr4a.js → index-c5hjht5e.js} +2 -2
- package/dist/client/static/js/{index-84fyq5a6.js → index-c63qyysm.js} +1 -1
- package/dist/client/static/js/{index-atq9q1s7.js → index-ccgzzydx.js} +1 -1
- package/dist/client/static/js/{index-b5dfvget.js → index-cra9mgkq.js} +4 -4
- package/dist/client/static/js/index-cvyqp8nz.css +1 -0
- package/dist/client/static/js/index-d2xtbabt.js +2 -0
- package/dist/client/static/js/{index-wrcdc9vz.js → index-dxkefysk.js} +1 -1
- package/dist/client/static/js/index-dxp2yvy7.js +2 -0
- package/dist/client/static/js/{index-vjmg7kn5.js → index-dyc886cc.js} +1 -1
- package/dist/client/static/js/{index-5wz0y88c.js → index-dzeyd153.js} +2 -2
- package/dist/client/static/js/{index-qf3y3ahx.js → index-e5j5gc4h.js} +2 -2
- package/dist/client/static/js/{index-2ks0m8ss.js → index-evmcc5qh.js} +2 -2
- package/dist/client/static/js/{index-b2e5pwx7.js → index-f2ahkev0.js} +5 -5
- package/dist/client/static/js/{index-65afr75v.js → index-fjex1y0t.js} +2 -2
- package/dist/client/static/js/{index-kb14dhrx.js → index-fxd8dfj4.js} +2 -2
- package/dist/client/static/js/{index-trvqvb1v.js → index-g4kkapka.js} +2 -2
- package/dist/client/static/js/{index-561gkvve.js → index-gzkzwgzv.js} +2 -2
- package/dist/client/static/js/{index-yf93db65.js → index-n1yr4khe.js} +1 -1
- package/dist/client/static/js/{index-d23eacf2.js → index-nkahe229.js} +2 -2
- package/dist/client/static/js/{index-dt6q3rws.js → index-p6s3fz6b.js} +11 -11
- package/dist/client/static/js/{index-hnb66d3s.js → index-q4ke39rh.js} +2 -2
- package/dist/client/static/js/index-qtd0e38d.js +1 -0
- package/dist/client/static/js/{index-x9r7zfp4.js → index-tqgj7rd9.js} +2 -2
- package/dist/client/static/js/{index-wbws16ag.js → index-x0xspam4.js} +2 -2
- package/dist/client/static/js/{index-4cag7w6k.js → index-x2v1zmth.js} +185 -185
- package/dist/client/static/js/{index-amsa0tfs.js → index-x9hfvbz6.js} +1 -1
- package/dist/client/static/js/{index-8g7q8mz4.js → index-xk1cqjkn.js} +3 -3
- package/dist/client/static/js/{index-c9e417cs.js → index-y6ke70e6.js} +2 -2
- package/dist/client/static/js/{index-bsr7wmj2.js → index-zhjjpvcc.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-r1p25738.js → infoDiagram-VRGFBTTK-88qbtpq5.js} +1 -1
- package/dist/client/static/js/ini-80p6sp79.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-afgrqdrt.js → ishikawaDiagram-OU5B5YK6-s8bagk00.js} +1 -1
- package/dist/client/static/js/java-mm2b3s9b.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hepa4wk7.js → journeyDiagram-ZHPQQLJL-hz8z0b9x.js} +2 -2
- package/dist/client/static/js/json-fzy76fkw.js +1 -0
- package/dist/client/static/js/jsx-c7v2f8s7.js +1 -0
- package/dist/client/static/js/{julia-yv2j8qd0.js → julia-dm0j9apa.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-jysft8ya.js → kanban-definition-PNTS6WVX-sjjnjb51.js} +1 -1
- package/dist/client/static/js/lua-ppfdxrmv.js +1 -0
- package/dist/client/static/js/markdown-xed7y3ds.js +1 -0
- package/dist/client/static/js/{mermaid.core-0m90b0s8.js → mermaid.core-zvwygxbh.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-x2rrzpvr.js → mindmap-definition-NLK3R4M7-kgj8enan.js} +2 -2
- package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +1 -0
- package/dist/client/static/js/one-light-pt6t6vax.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-z7vb7f1z.js → pegDiagram-GJSIUBJH-gxzw1qwa.js} +1 -1
- package/dist/client/static/js/{perl-917pjq5a.js → perl-4jcm2jxv.js} +1 -1
- package/dist/client/static/js/{php-hwz75qzt.js → php-q32mec74.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-jqv6v4e6.js → pieDiagram-5QR66LMP-pdqwyqcm.js} +1 -1
- package/dist/client/static/js/properties-8ysbq2n2.js +1 -0
- package/dist/client/static/js/python-4ysexc8s.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-w2h8yxrv.js → quadrantDiagram-O4NWA36T-yx2t364p.js} +1 -1
- package/dist/client/static/js/r-hrsw5arc.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nd09yac3.js → railroadDiagram-XR7U4H2S-800fdzkr.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t61zxh5v.js → requirementDiagram-PLB6GJNP-vc5rpgtm.js} +1 -1
- package/dist/client/static/js/{ruby-er7ayhte.js → ruby-npmpb290.js} +1 -1
- package/dist/client/static/js/{rust-avnkhh0p.js → rust-waks43wh.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2f7h2cmw.js → sankeyDiagram-IPEJSGJF-ccjk8zgn.js} +2 -2
- package/dist/client/static/js/{sass-n47tt136.js → sass-502a4r7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-kfb5d7zd.js → sequenceDiagram-PO4LG4MO-c0tk7gfn.js} +6 -6
- package/dist/client/static/js/{sizeCapture-INFHLROL-amfg19se.js → sizeCapture-INFHLROL-fma9p1vy.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-k5hx7btx.js → stateDiagram-v2-GCMORJYK-d8f24b7j.js} +2 -2
- package/dist/client/static/js/{svelte-2pmz35vx.js → svelte-c15d0421.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-wv3rp8kk.js → swimlanes-2SLR337P-sdt7qy36.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-0re95wtn.js → timeline-definition-EJHVYXUP-rv8qyr8b.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +1 -0
- package/dist/client/static/js/tsx-xjp2ds8g.js +1 -0
- package/dist/client/static/js/typescript-yg97da8h.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yrje14qp.js → usecaseDiagram-POWQR4AR-w6ew1red.js} +2 -2
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-jxkmrfy5.js → vennDiagram-UO4OBE2U-p9axw7ch.js} +1 -1
- package/dist/client/static/js/{vue-d5gpjfgn.js → vue-xpemy62d.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-d3v2m9b1.js → wardleyDiagram-VNRHLVJA-5ewc8s4p.js} +1 -1
- package/dist/client/static/js/xml-nrb23phz.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9a1s1rjt.js → xychartDiagram-PMCCYNJV-7n4gn7k6.js} +2 -2
- package/dist/client/static/js/yaml-sqs6pjpx.js +1 -0
- package/marketplace/marketplace.json +34 -7
- package/marketplace/plugins/kanban/README.md +143 -0
- package/marketplace/plugins/kanban/icon.svg +5 -0
- package/marketplace/plugins/kanban/package.json +30 -0
- package/marketplace/plugins/kanban/src/app.tsx +34 -0
- package/marketplace/plugins/kanban/src/mcp-tools.ts +296 -0
- package/marketplace/plugins/kanban/src/mcp.test.ts +199 -0
- package/marketplace/plugins/kanban/src/mcp.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +319 -0
- package/marketplace/plugins/kanban/src/panel/CardTile.tsx +97 -0
- package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +116 -0
- package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +249 -0
- package/marketplace/plugins/kanban/src/panel/catalogs.ts +114 -0
- package/marketplace/plugins/kanban/src/panel/index.tsx +327 -0
- package/marketplace/plugins/kanban/src/panel/panel.test.ts +219 -0
- package/marketplace/plugins/kanban/src/panel/start-work.ts +132 -0
- package/marketplace/plugins/kanban/src/panel/use-board.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/use-card-detail.ts +70 -0
- package/marketplace/plugins/kanban/src/panel/use-writes.ts +123 -0
- package/marketplace/plugins/kanban/src/protocol.ts +180 -0
- package/marketplace/plugins/kanban/src/server.test.ts +113 -0
- package/marketplace/plugins/kanban/src/server.ts +227 -0
- package/marketplace/plugins/kanban/src/store/board.test.ts +311 -0
- package/marketplace/plugins/kanban/src/store/board.ts +147 -0
- package/marketplace/plugins/kanban/src/store/cards.ts +228 -0
- package/marketplace/plugins/kanban/src/store/fs.ts +159 -0
- package/marketplace/plugins/kanban/src/store/ops.ts +245 -0
- package/marketplace/plugins/kanban/src/store/resolve.test.ts +82 -0
- package/marketplace/plugins/kanban/src/store/resolve.ts +135 -0
- package/marketplace/plugins/kanban/tsconfig.json +26 -0
- package/package.json +2 -2
- package/src/client/components/common/file-icon/index.tsx +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +12 -3
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +34 -7
- package/src/client/components/layout/desktop-layout/index.tsx +17 -22
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +2 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +11 -3
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +21 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +8 -4
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +8 -2
- package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +15 -4
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +21 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +7 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +1 -1
- package/src/client/components/workspace/editor/FilePane.tsx +4 -2
- package/src/client/components/workspace/editor/Tabs.tsx +7 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +7 -1
- package/src/client/components/workspace/editor/chrome-rows.test.tsx +126 -0
- package/src/client/components/workspace/editor/viewers/HtmlPreview.test.tsx +94 -0
- package/src/client/components/workspace/editor/viewers/HtmlPreview.tsx +71 -0
- package/src/client/components/workspace/editor/viewers/bytes.ts +1 -1
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +14 -1
- package/src/client/components/workspace/panel-header/index.test.tsx +2 -1
- package/src/client/components/workspace/panel-header/index.tsx +6 -4
- package/src/client/hooks/editor/resolve-viewer.ts +1 -1
- package/src/client/hooks/editor/use-editor-drop.ts +14 -0
- package/src/client/hooks/editor/use-editor-tab-state.ts +5 -4
- package/src/client/hooks/ui/media-query.ts +27 -0
- package/src/client/hooks/workspace/file-tabs.ts +10 -0
- package/src/client/hooks/workspace/right-panel-presence.test.ts +152 -0
- package/src/client/hooks/workspace/right-panel-presence.ts +119 -0
- package/src/client/lib/router/search-params.test.ts +83 -0
- package/src/client/lib/router/search-params.ts +14 -3
- package/src/server/lib/mcp/session-mcp.test.ts +64 -1
- package/src/server/lib/mcp/session-overlay.server.ts +7 -4
- package/src/server/lib/omp/rpc/constants.test.ts +31 -0
- package/src/server/lib/omp/rpc/constants.ts +19 -0
- package/src/server/lib/omp/rpc/session-new.ts +78 -0
- package/src/server/lib/omp/rpc/session-registry.ts +22 -49
- package/src/server/lib/omp/rpc/spawn-mcp.ts +8 -1
- package/src/server/lib/omp/session/blobs.server.ts +2 -1
- package/src/server/lib/plugins/e2e.test.ts +71 -2
- package/src/server/lib/plugins/loader.server.ts +20 -1
- package/src/server/lib/plugins/module-import.server.ts +45 -0
- package/src/server/routes/agent/new-prompt.test.ts +81 -0
- package/src/server/routes/agent/new.ts +78 -4
- package/src/server/routes/fs/raw.test.ts +12 -0
- package/src/server/routes/fs/raw.ts +2 -6
- package/src/server/routes/wiki/asset.ts +1 -1
- package/src/shared/lib/fs/document-kind.test.ts +39 -2
- package/src/shared/lib/fs/document-kind.ts +49 -1
- package/src/shared/lib/fs/file-kind.test.ts +30 -3
- package/src/shared/lib/fs/file-kind.ts +7 -104
- package/src/shared/lib/fs/mime.ts +159 -0
- package/src/shared/lib/workspace/sidebar-width.test.ts +34 -0
- package/src/shared/lib/workspace/sidebar-width.ts +33 -0
- package/src/shared/lib/workspace/workspace-panel-widths.test.ts +124 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +115 -18
- package/dist/client/static/js/ImageView-jkrdrq8v.js +0 -1
- package/dist/client/static/js/LayoutWrapper-sh634350.js +0 -2
- package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +0 -1
- package/dist/client/static/js/bash-8d8z8zrg.js +0 -1
- package/dist/client/static/js/cpp-620mvjkk.js +0 -1
- package/dist/client/static/js/css-bt76kxbq.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +0 -1
- package/dist/client/static/js/graphql-j1a6zp7m.js +0 -1
- package/dist/client/static/js/index-5ka2tyf9.js +0 -3
- package/dist/client/static/js/index-83rkg916.js +0 -2
- package/dist/client/static/js/index-dpy3ewrn.css +0 -1
- package/dist/client/static/js/index-vkqb4dnt.js +0 -1
- package/dist/client/static/js/index-xwjbq003.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +0 -1
- package/dist/client/static/js/ini-5f4zqtqr.js +0 -1
- package/dist/client/static/js/java-jj41mty3.js +0 -1
- package/dist/client/static/js/json-rnh2h17x.js +0 -1
- package/dist/client/static/js/jsx-4gecrt29.js +0 -1
- package/dist/client/static/js/lua-zszaw2f7.js +0 -1
- package/dist/client/static/js/markdown-nm6gw4v4.js +0 -1
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +0 -1
- package/dist/client/static/js/one-light-g3ednt6p.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +0 -1
- package/dist/client/static/js/properties-rkptax7r.js +0 -1
- package/dist/client/static/js/python-qf1se1mj.js +0 -1
- package/dist/client/static/js/r-ms0cygq2.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +0 -1
- package/dist/client/static/js/tsx-gx7td06z.js +0 -1
- package/dist/client/static/js/typescript-1a808spn.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +0 -1
- package/dist/client/static/js/xml-3117mxd9.js +0 -1
- package/dist/client/static/js/yaml-dmvh8vyt.js +0 -1
|
@@ -13,13 +13,24 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { describe, expect, test } from 'bun:test';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BINARY_VIEWERS,
|
|
18
|
+
DEFAULT_PREVIEW,
|
|
19
|
+
RENDERED_VIEWERS,
|
|
20
|
+
VIEWER_LABELS,
|
|
21
|
+
opensInPreview,
|
|
22
|
+
viewerKindFor,
|
|
23
|
+
type ViewerKind,
|
|
24
|
+
} from '@/shared/lib/fs/document-kind';
|
|
17
25
|
import { MAX_CSV_COLUMNS, MAX_CSV_ROWS, parseCsv, sniffDelimiter } from '@/shared/lib/fs/csv';
|
|
18
26
|
|
|
19
27
|
describe('viewerKindFor', () => {
|
|
20
28
|
test('each family maps to its viewer', () => {
|
|
21
29
|
expect(viewerKindFor('a.md')).toBe('markdown');
|
|
22
30
|
expect(viewerKindFor('a.markdown')).toBe('markdown');
|
|
31
|
+
expect(viewerKindFor('page.html')).toBe('html');
|
|
32
|
+
expect(viewerKindFor('page.htm')).toBe('html');
|
|
33
|
+
expect(viewerKindFor('PAGE.HTML')).toBe('html');
|
|
23
34
|
expect(viewerKindFor('a.csv')).toBe('csv');
|
|
24
35
|
expect(viewerKindFor('a.tsv')).toBe('csv');
|
|
25
36
|
expect(viewerKindFor('a.png')).toBe('image');
|
|
@@ -59,10 +70,11 @@ describe('viewerKindFor', () => {
|
|
|
59
70
|
});
|
|
60
71
|
|
|
61
72
|
test('every kind has a row in both lookup tables', () => {
|
|
62
|
-
const kinds: ViewerKind[] = ['code', 'markdown', 'svg', 'csv', 'image', 'pdf', 'docx', 'spreadsheet', 'drawio'];
|
|
73
|
+
const kinds: ViewerKind[] = ['code', 'markdown', 'html', 'svg', 'csv', 'image', 'pdf', 'docx', 'spreadsheet', 'drawio'];
|
|
63
74
|
for (const kind of kinds) {
|
|
64
75
|
expect(kind in BINARY_VIEWERS).toBe(true);
|
|
65
76
|
expect(kind in RENDERED_VIEWERS).toBe(true);
|
|
77
|
+
expect(kind in DEFAULT_PREVIEW).toBe(true);
|
|
66
78
|
// The status strip's word has to exist for every kind too, or a byte
|
|
67
79
|
// viewer's footer prints `undefined` where the viewer's name belongs.
|
|
68
80
|
expect(VIEWER_LABELS[kind].length).toBeGreaterThan(0);
|
|
@@ -78,6 +90,10 @@ describe('viewerKindFor', () => {
|
|
|
78
90
|
// form — the eye toggle's pair — and no byte fetch.
|
|
79
91
|
expect(RENDERED_VIEWERS.drawio).toBe(true);
|
|
80
92
|
expect(BINARY_VIEWERS.drawio).toBeUndefined();
|
|
93
|
+
// An HTML page is editable text with a rendered form, exactly like markdown.
|
|
94
|
+
expect(RENDERED_VIEWERS.html).toBe(true);
|
|
95
|
+
expect(BINARY_VIEWERS.html).toBeUndefined();
|
|
96
|
+
expect(VIEWER_LABELS.html).toBe('HTML');
|
|
81
97
|
// A byte viewer's label is its document kind, never the language badge the
|
|
82
98
|
// empty buffer would otherwise produce.
|
|
83
99
|
expect(VIEWER_LABELS.pdf).toBe('PDF');
|
|
@@ -85,6 +101,27 @@ describe('viewerKindFor', () => {
|
|
|
85
101
|
});
|
|
86
102
|
});
|
|
87
103
|
|
|
104
|
+
describe('opensInPreview', () => {
|
|
105
|
+
// What the user opened the file to READ opens rendered; an HTML page opens
|
|
106
|
+
// its source, because editing one is the common case and a page that runs
|
|
107
|
+
// scripts must not start doing so the instant the tab appears.
|
|
108
|
+
test('a document opens rendered; an html page opens its source', () => {
|
|
109
|
+
for (const kind of ['markdown', 'svg', 'csv', 'drawio'] as const) {
|
|
110
|
+
expect(opensInPreview(kind)).toBe(true);
|
|
111
|
+
}
|
|
112
|
+
expect(opensInPreview('html')).toBe(false);
|
|
113
|
+
expect(opensInPreview('code')).toBe(false);
|
|
114
|
+
expect(opensInPreview('pdf')).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// The two tables answer different questions, and collapsing them would hide
|
|
118
|
+
// the eye button on the one kind whose default is the source.
|
|
119
|
+
test('html keeps its toggle even though it opens on source', () => {
|
|
120
|
+
expect(RENDERED_VIEWERS.html).toBe(true);
|
|
121
|
+
expect(DEFAULT_PREVIEW.html).toBeUndefined();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
88
125
|
describe('sniffDelimiter', () => {
|
|
89
126
|
test('a .tsv extension wins outright', () => {
|
|
90
127
|
expect(sniffDelimiter('a,b,c', 'x.tsv')).toBe('\t');
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* file has a rendered form.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/
|
|
23
|
+
import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/mime';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The surface that draws a file.
|
|
@@ -31,6 +31,7 @@ import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/file-kind';
|
|
|
31
31
|
export type ViewerKind =
|
|
32
32
|
| 'code'
|
|
33
33
|
| 'markdown'
|
|
34
|
+
| 'html'
|
|
34
35
|
| 'svg'
|
|
35
36
|
| 'csv'
|
|
36
37
|
| 'image'
|
|
@@ -55,6 +56,9 @@ const CSV_EXTENSIONS: Record<string, true> = { csv: true, tsv: true };
|
|
|
55
56
|
/** Markdown, whose preview is the rendered document. */
|
|
56
57
|
const MARKDOWN_EXTENSIONS: Record<string, true> = { md: true, markdown: true, mdx: true };
|
|
57
58
|
|
|
59
|
+
/** Web pages, whose preview is the document the browser draws. */
|
|
60
|
+
const HTML_EXTENSIONS: Record<string, true> = { html: true, htm: true };
|
|
61
|
+
|
|
58
62
|
/**
|
|
59
63
|
* drawio diagrams. `.dio` is the same format under the older extension; the
|
|
60
64
|
* `.drawio.svg`/`.drawio.png` exports are NOT here — those are an SVG and a
|
|
@@ -78,6 +82,7 @@ export const BINARY_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
78
82
|
spreadsheet: true,
|
|
79
83
|
code: undefined,
|
|
80
84
|
markdown: undefined,
|
|
85
|
+
html: undefined,
|
|
81
86
|
svg: undefined,
|
|
82
87
|
csv: undefined,
|
|
83
88
|
drawio: undefined,
|
|
@@ -90,12 +95,41 @@ export const BINARY_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
90
95
|
* the preview and the raw text is the code surface, which is exactly the pair
|
|
91
96
|
* the toggle switches between. `image` and the document kinds are not — they
|
|
92
97
|
* have no text form to toggle to.
|
|
98
|
+
*
|
|
99
|
+
* This answers "is there a toggle", NOT "which side opens first" — that is
|
|
100
|
+
* `DEFAULT_PREVIEW`, and an HTML page is the case where the two answers differ.
|
|
93
101
|
*/
|
|
94
102
|
export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
103
|
+
markdown: true,
|
|
104
|
+
html: true,
|
|
105
|
+
svg: true,
|
|
106
|
+
csv: true,
|
|
107
|
+
drawio: true,
|
|
108
|
+
code: undefined,
|
|
109
|
+
image: undefined,
|
|
110
|
+
pdf: undefined,
|
|
111
|
+
docx: undefined,
|
|
112
|
+
spreadsheet: undefined,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The side a rendered kind opens on, when the user has not chosen one.
|
|
117
|
+
*
|
|
118
|
+
* A markdown page, a CSV grid, an SVG and a drawio diagram open RENDERED: that
|
|
119
|
+
* is what the user opened them to read. An HTML page opens its SOURCE instead,
|
|
120
|
+
* because editing one is the common case and a page that runs scripts would
|
|
121
|
+
* otherwise start doing so the instant the tab appears.
|
|
122
|
+
*
|
|
123
|
+
* Kept separate from `RENDERED_VIEWERS` because the two questions are different
|
|
124
|
+
* and collapsing them makes the eye button disappear from the one kind whose
|
|
125
|
+
* default is the source.
|
|
126
|
+
*/
|
|
127
|
+
export const DEFAULT_PREVIEW: Record<ViewerKind, true | undefined> = {
|
|
95
128
|
markdown: true,
|
|
96
129
|
svg: true,
|
|
97
130
|
csv: true,
|
|
98
131
|
drawio: true,
|
|
132
|
+
html: undefined,
|
|
99
133
|
code: undefined,
|
|
100
134
|
image: undefined,
|
|
101
135
|
pdf: undefined,
|
|
@@ -103,6 +137,18 @@ export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
103
137
|
spreadsheet: undefined,
|
|
104
138
|
};
|
|
105
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Whether a kind opens on its rendered side when the user has not chosen.
|
|
142
|
+
*
|
|
143
|
+
* The single spelling of `DEFAULT_PREVIEW[kind] === true`, because both editors
|
|
144
|
+
* need the answer and "the table's entry is undefined" is not a fact a call site
|
|
145
|
+
* should have to re-derive: one of them would eventually write `?? hasPreview`
|
|
146
|
+
* and quietly turn HTML back into a preview-on-open file.
|
|
147
|
+
*/
|
|
148
|
+
export function opensInPreview(kind: ViewerKind): boolean {
|
|
149
|
+
return DEFAULT_PREVIEW[kind] === true;
|
|
150
|
+
}
|
|
151
|
+
|
|
106
152
|
/**
|
|
107
153
|
* The word a status strip prints for a viewer kind.
|
|
108
154
|
*
|
|
@@ -115,6 +161,7 @@ export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
115
161
|
export const VIEWER_LABELS: Record<ViewerKind, string> = {
|
|
116
162
|
code: 'Text',
|
|
117
163
|
markdown: 'Markdown',
|
|
164
|
+
html: 'HTML',
|
|
118
165
|
svg: 'SVG',
|
|
119
166
|
csv: 'CSV',
|
|
120
167
|
image: 'Image',
|
|
@@ -139,6 +186,7 @@ export function viewerKindFor(filePath: string | undefined | null): ViewerKind {
|
|
|
139
186
|
if (ext === 'svg') return 'svg';
|
|
140
187
|
if (DRAWIO_EXTENSIONS[ext]) return 'drawio';
|
|
141
188
|
if (MARKDOWN_EXTENSIONS[ext]) return 'markdown';
|
|
189
|
+
if (HTML_EXTENSIONS[ext]) return 'html';
|
|
142
190
|
if (getImageMimeType(filePath)) return 'image';
|
|
143
191
|
if (ext === 'pdf') return 'pdf';
|
|
144
192
|
if (DOCX_EXTENSIONS[ext]) return 'docx';
|
|
@@ -17,18 +17,24 @@
|
|
|
17
17
|
|
|
18
18
|
import { describe, expect, test } from 'bun:test';
|
|
19
19
|
|
|
20
|
+
import {
|
|
21
|
+
classifyEditorFile,
|
|
22
|
+
getImageMimeFromBytes,
|
|
23
|
+
looksLikeSvg,
|
|
24
|
+
} from '@/shared/lib/fs/file-kind';
|
|
25
|
+
// The MIME answers live in `mime.ts`; they are asserted here because the
|
|
26
|
+
// classifier is their consumer and a wrong table is what makes a picture paint
|
|
27
|
+
// as mojibake.
|
|
20
28
|
import {
|
|
21
29
|
DOCUMENT_MIME_BY_EXT,
|
|
22
30
|
getDocumentMimeType,
|
|
23
31
|
getFileExtension,
|
|
24
|
-
getImageMimeFromBytes,
|
|
25
32
|
getImageMimeType,
|
|
26
33
|
getPaintableImageMimeType,
|
|
27
34
|
getRawContentType,
|
|
28
35
|
IMAGE_MIME_BY_EXT,
|
|
29
|
-
looksLikeSvg,
|
|
30
36
|
SVG_MIME,
|
|
31
|
-
} from '@/shared/lib/fs/
|
|
37
|
+
} from '@/shared/lib/fs/mime';
|
|
32
38
|
|
|
33
39
|
const bytes = (...values: number[]): Uint8Array => new Uint8Array(values);
|
|
34
40
|
|
|
@@ -180,6 +186,27 @@ describe('getRawContentType', () => {
|
|
|
180
186
|
expect(getRawContentType('a.ts')).toBeNull();
|
|
181
187
|
expect(getRawContentType(undefined)).toBeNull();
|
|
182
188
|
});
|
|
189
|
+
|
|
190
|
+
// The HTML preview's frame is sandboxed, and a sandboxed frame is an opaque
|
|
191
|
+
// origin where the browser applies strict MIME checking: a stylesheet or
|
|
192
|
+
// script answered as `application/octet-stream` is refused, so a page with a
|
|
193
|
+
// relative `<link>` or `<script>` painted unstyled.
|
|
194
|
+
test('a web asset a rendered page loads is named', () => {
|
|
195
|
+
expect(getRawContentType('style.css')).toBe('text/css; charset=utf-8');
|
|
196
|
+
expect(getRawContentType('app.js')).toBe('text/javascript; charset=utf-8');
|
|
197
|
+
expect(getRawContentType('app.mjs')).toBe('text/javascript; charset=utf-8');
|
|
198
|
+
expect(getRawContentType('data.json')).toBe('application/json; charset=utf-8');
|
|
199
|
+
expect(getRawContentType('font.woff2')).toBe('font/woff2');
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// And naming them here must NOT reclassify them: a stylesheet stays an
|
|
203
|
+
// editable text file rather than becoming a byte document the editor refuses
|
|
204
|
+
// to edit.
|
|
205
|
+
test('a web asset is still classified as text', () => {
|
|
206
|
+
expect(getDocumentMimeType('style.css')).toBeNull();
|
|
207
|
+
expect(classifyEditorFile({ path: 'style.css', size: 64 })).toBe('text');
|
|
208
|
+
expect(classifyEditorFile({ path: 'app.js', size: 64 })).toBe('text');
|
|
209
|
+
});
|
|
183
210
|
});
|
|
184
211
|
|
|
185
212
|
describe('getPaintableImageMimeType', () => {
|
|
@@ -4,114 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { formatBytes } from '@/shared/lib/format/number';
|
|
7
|
-
import {
|
|
7
|
+
import { getDocumentMimeType, getFileExtension, getImageMimeType, SVG_MIME } from '@/shared/lib/fs/mime';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* A raster image is not text: decoding its bytes as UTF-8 yields replacement
|
|
14
|
-
* characters, so the editor used to paint a PNG as mojibake. The extension is
|
|
15
|
-
* the only signal available before reading the file, and it is the same signal
|
|
16
|
-
* the Files panel already uses to pick an icon — keeping it in one module means
|
|
17
|
-
* the reader, the icon, and the viewer can never disagree about which files are
|
|
18
|
-
* pictures.
|
|
19
|
-
*
|
|
20
|
-
* SVG is deliberately absent: it is editable XML text and stays on the
|
|
21
|
-
* syntax-highlighted code path.
|
|
22
|
-
*/
|
|
23
|
-
export const IMAGE_MIME_BY_EXT: Record<string, string> = {
|
|
24
|
-
png: 'image/png',
|
|
25
|
-
apng: 'image/apng',
|
|
26
|
-
jpg: 'image/jpeg',
|
|
27
|
-
jpeg: 'image/jpeg',
|
|
28
|
-
jfif: 'image/jpeg',
|
|
29
|
-
gif: 'image/gif',
|
|
30
|
-
webp: 'image/webp',
|
|
31
|
-
avif: 'image/avif',
|
|
32
|
-
bmp: 'image/bmp',
|
|
33
|
-
ico: 'image/x-icon',
|
|
34
|
-
tif: 'image/tiff',
|
|
35
|
-
tiff: 'image/tiff',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/** Lower-cased extension of a path or name, query/fragment/line suffix removed. */
|
|
39
|
-
export function getFileExtension(filePath: string | undefined | null): string {
|
|
40
|
-
if (!filePath) return '';
|
|
41
|
-
const clean = stripReadSelector(filePath).split(/[/\\]/).pop() ?? '';
|
|
42
|
-
const dot = clean.lastIndexOf('.');
|
|
43
|
-
return dot > 0 ? clean.slice(dot + 1).toLowerCase() : '';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* MIME types for the documents the editor renders rather than edits — the ones
|
|
48
|
-
* `/api/fs/raw` must label correctly, because the browser decides whether to
|
|
49
|
-
* paint or download from `content-type`.
|
|
50
|
-
*
|
|
51
|
-
* These are NOT in `IMAGE_MIME_BY_EXT`: an image is classified `image` (streamed,
|
|
52
|
-
* size-exempt) while these are classified `document` (bytes fetched whole by the
|
|
53
|
-
* viewer, size-checked like text). One table for the MIME, one list for the
|
|
54
|
-
* classification, so the two questions cannot drift.
|
|
55
|
-
*/
|
|
56
|
-
export const DOCUMENT_MIME_BY_EXT: Record<string, string> = {
|
|
57
|
-
pdf: 'application/pdf',
|
|
58
|
-
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
59
|
-
xls: 'application/vnd.ms-excel',
|
|
60
|
-
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
61
|
-
xlsm: 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* SVG's MIME. Kept out of every classification table on purpose: an SVG is
|
|
66
|
-
* editable XML text and stays on the code path (see the module doc), but
|
|
67
|
-
* `/api/fs/raw` still has to name it, or an `<img>` pointed at it downloads the
|
|
68
|
-
* file instead of painting it.
|
|
69
|
-
*/
|
|
70
|
-
export const SVG_MIME = 'image/svg+xml';
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* MIME type for a raster image path, or null when the extension is not one.
|
|
74
|
-
* Null is the "treat as text" answer, so every caller branches on this single
|
|
75
|
-
* check instead of re-deriving the extension list.
|
|
76
|
-
*/
|
|
77
|
-
export function getImageMimeType(filePath: string | undefined | null): string | null {
|
|
78
|
-
return IMAGE_MIME_BY_EXT[getFileExtension(filePath)] ?? null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* MIME type for a document the viewer paints (PDF, DOCX, XLSX/XLSM), or null.
|
|
83
|
-
* Null is the "not one of those" answer, the same shape `getImageMimeType` uses.
|
|
84
|
-
*/
|
|
85
|
-
export function getDocumentMimeType(filePath: string | undefined | null): string | null {
|
|
86
|
-
return DOCUMENT_MIME_BY_EXT[getFileExtension(filePath)] ?? null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* MIME type for a path an `<img>` can PAINT — every raster image plus SVG — or
|
|
91
|
-
* null.
|
|
92
|
-
*
|
|
93
|
-
* The chat `read` card is the caller that needs this third answer: it paints the
|
|
94
|
-
* file a tool returned, and an SVG is a picture there even though the editor
|
|
95
|
-
* keeps it on the code path (`getImageMimeType` stays raster-only for that
|
|
96
|
-
* reason). One function, so the read panel and `/api/fs/raw` cannot disagree
|
|
97
|
-
* about which files are previewable.
|
|
98
|
-
*/
|
|
99
|
-
export function getPaintableImageMimeType(filePath: string | undefined | null): string | null {
|
|
100
|
-
return getImageMimeType(filePath) ?? (getFileExtension(filePath) === 'svg' ? SVG_MIME : null);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The `content-type` `/api/fs/raw` should answer a path with, or null when the
|
|
105
|
-
* bytes have no picture/document type (the route falls back to
|
|
106
|
-
* `application/octet-stream`).
|
|
10
|
+
* What the editor can DO with a file, decided from the path, its size and its
|
|
11
|
+
* leading bytes — the ONE classification the read route, the editor surface and
|
|
12
|
+
* the drop target all branch on.
|
|
107
13
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
14
|
+
* The MIME tables this reads live in `mime.ts`, which is the module the icon,
|
|
15
|
+
* the viewer and `/api/fs/raw` also read, so "which files are pictures" has one
|
|
16
|
+
* answer.
|
|
111
17
|
*/
|
|
112
|
-
export function getRawContentType(filePath: string | undefined | null): string | null {
|
|
113
|
-
return getPaintableImageMimeType(filePath) ?? getDocumentMimeType(filePath);
|
|
114
|
-
}
|
|
115
18
|
|
|
116
19
|
/** Leading bytes → MIME, longest signature first so `webp`'s `RIFF`/`WEBP`
|
|
117
20
|
* pair is checked before a bare container match could accept it. */
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The MIME tables, and the only functions that read them.
|
|
8
|
+
*
|
|
9
|
+
* Split from `file-kind` for the per-file ceiling, and it earns the boundary:
|
|
10
|
+
* every question here is "what does this PATH's extension say it is", while
|
|
11
|
+
* `file-kind` answers "what can the editor DO with these bytes". They are read
|
|
12
|
+
* by different halves of the app — the icon, the viewer, `/api/fs/raw`, the
|
|
13
|
+
* blob store — and every one of them must give the same answer, which is why
|
|
14
|
+
* there is exactly one table per question and one getter per table.
|
|
15
|
+
*
|
|
16
|
+
* A raster image is not text: decoding its bytes as UTF-8 yields replacement
|
|
17
|
+
* characters, so the editor used to paint a PNG as mojibake. The extension is
|
|
18
|
+
* the only signal available before reading the file, and it is the same signal
|
|
19
|
+
* the Files panel already uses to pick an icon — keeping it in one module means
|
|
20
|
+
* the reader, the icon, and the viewer can never disagree about which files are
|
|
21
|
+
* pictures.
|
|
22
|
+
*
|
|
23
|
+
* SVG is deliberately absent from the image table: it is editable XML text and
|
|
24
|
+
* stays on the syntax-highlighted code path.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { stripReadSelector } from '@/shared/lib/fs/paths';
|
|
28
|
+
|
|
29
|
+
export const IMAGE_MIME_BY_EXT: Record<string, string> = {
|
|
30
|
+
png: 'image/png',
|
|
31
|
+
apng: 'image/apng',
|
|
32
|
+
jpg: 'image/jpeg',
|
|
33
|
+
jpeg: 'image/jpeg',
|
|
34
|
+
jfif: 'image/jpeg',
|
|
35
|
+
gif: 'image/gif',
|
|
36
|
+
webp: 'image/webp',
|
|
37
|
+
avif: 'image/avif',
|
|
38
|
+
bmp: 'image/bmp',
|
|
39
|
+
ico: 'image/x-icon',
|
|
40
|
+
tif: 'image/tiff',
|
|
41
|
+
tiff: 'image/tiff',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Lower-cased extension of a path or name, query/fragment/line suffix removed. */
|
|
45
|
+
export function getFileExtension(filePath: string | undefined | null): string {
|
|
46
|
+
if (!filePath) return '';
|
|
47
|
+
const clean = stripReadSelector(filePath).split(/[/\\]/).pop() ?? '';
|
|
48
|
+
const dot = clean.lastIndexOf('.');
|
|
49
|
+
return dot > 0 ? clean.slice(dot + 1).toLowerCase() : '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* MIME types for the documents the editor renders rather than edits — the ones
|
|
54
|
+
* `/api/fs/raw` must label correctly, because the browser decides whether to
|
|
55
|
+
* paint or download from `content-type`.
|
|
56
|
+
*
|
|
57
|
+
* These are NOT in `IMAGE_MIME_BY_EXT`: an image is classified `image` (streamed,
|
|
58
|
+
* size-exempt) while these are classified `document` (bytes fetched whole by the
|
|
59
|
+
* viewer, size-checked like text). One table for the MIME, one list for the
|
|
60
|
+
* classification, so the two questions cannot drift.
|
|
61
|
+
*/
|
|
62
|
+
export const DOCUMENT_MIME_BY_EXT: Record<string, string> = {
|
|
63
|
+
pdf: 'application/pdf',
|
|
64
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
65
|
+
xls: 'application/vnd.ms-excel',
|
|
66
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
67
|
+
xlsm: 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SVG's MIME. Kept out of every classification table on purpose: an SVG is
|
|
72
|
+
* editable XML text and stays on the code path (see the module doc), but
|
|
73
|
+
* `/api/fs/raw` still has to name it, or an `<img>` pointed at it downloads the
|
|
74
|
+
* file instead of painting it.
|
|
75
|
+
*/
|
|
76
|
+
export const SVG_MIME = 'image/svg+xml';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* MIME types for the assets a rendered web page loads, served by `/api/fs/raw`.
|
|
80
|
+
*
|
|
81
|
+
* The HTML preview hands a page to a sandboxed frame, and the browser applies
|
|
82
|
+
* STRICT MIME checking there: a `<link rel="stylesheet">` answered as
|
|
83
|
+
* `application/octet-stream` is refused ("MIME type ('application/octet-stream')
|
|
84
|
+
* is not a supported stylesheet MIME type"), and a `<script>` likewise. So a
|
|
85
|
+
* page with a relative stylesheet or script — every page that is not a single
|
|
86
|
+
* self-contained file — painted unstyled until this table existed.
|
|
87
|
+
*
|
|
88
|
+
* Deliberately NOT part of `DOCUMENT_MIME_BY_EXT`: that table's members are
|
|
89
|
+
* classified `document` by `classifyEditorFile`, which would take `.css` and
|
|
90
|
+
* `.js` off the editable text path. These files stay text; only the raw
|
|
91
|
+
* route's `content-type` needs to name them.
|
|
92
|
+
*/
|
|
93
|
+
export const WEB_ASSET_MIME_BY_EXT: Record<string, string> = {
|
|
94
|
+
css: 'text/css; charset=utf-8',
|
|
95
|
+
js: 'text/javascript; charset=utf-8',
|
|
96
|
+
mjs: 'text/javascript; charset=utf-8',
|
|
97
|
+
cjs: 'text/javascript; charset=utf-8',
|
|
98
|
+
json: 'application/json; charset=utf-8',
|
|
99
|
+
map: 'application/json; charset=utf-8',
|
|
100
|
+
webmanifest: 'application/manifest+json; charset=utf-8',
|
|
101
|
+
woff: 'font/woff',
|
|
102
|
+
woff2: 'font/woff2',
|
|
103
|
+
ttf: 'font/ttf',
|
|
104
|
+
otf: 'font/otf',
|
|
105
|
+
wasm: 'application/wasm',
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* MIME type for a raster image path, or null when the extension is not one.
|
|
110
|
+
* Null is the "treat as text" answer, so every caller branches on this single
|
|
111
|
+
* check instead of re-deriving the extension list.
|
|
112
|
+
*/
|
|
113
|
+
export function getImageMimeType(filePath: string | undefined | null): string | null {
|
|
114
|
+
return IMAGE_MIME_BY_EXT[getFileExtension(filePath)] ?? null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* MIME type for a document the viewer paints (PDF, DOCX, XLSX/XLSM), or null.
|
|
119
|
+
* Null is the "not one of those" answer, the same shape `getImageMimeType` uses.
|
|
120
|
+
*/
|
|
121
|
+
export function getDocumentMimeType(filePath: string | undefined | null): string | null {
|
|
122
|
+
return DOCUMENT_MIME_BY_EXT[getFileExtension(filePath)] ?? null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* MIME type for a path an `<img>` can PAINT — every raster image plus SVG — or
|
|
127
|
+
* null.
|
|
128
|
+
*
|
|
129
|
+
* The chat `read` card is the caller that needs this third answer: it paints the
|
|
130
|
+
* file a tool returned, and an SVG is a picture there even though the editor
|
|
131
|
+
* keeps it on the code path (`getImageMimeType` stays raster-only for that
|
|
132
|
+
* reason). One function, so the read panel and `/api/fs/raw` cannot disagree
|
|
133
|
+
* about which files are previewable.
|
|
134
|
+
*/
|
|
135
|
+
export function getPaintableImageMimeType(filePath: string | undefined | null): string | null {
|
|
136
|
+
return getImageMimeType(filePath) ?? (getFileExtension(filePath) === 'svg' ? SVG_MIME : null);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The `content-type` `/api/fs/raw` should answer a path with, or null when the
|
|
141
|
+
* bytes have no picture/document type (the route falls back to
|
|
142
|
+
* `application/octet-stream`).
|
|
143
|
+
*
|
|
144
|
+
* SVG is named through `getPaintableImageMimeType` rather than by
|
|
145
|
+
* `getImageMimeType` because the classifier must keep it on the text path while
|
|
146
|
+
* the raw route serves it to an `<img>`.
|
|
147
|
+
*
|
|
148
|
+
* The web-asset table is last because it is the least specific answer: a page's
|
|
149
|
+
* stylesheet, script, font or wasm module still needs a real `content-type`, or
|
|
150
|
+
* the sandboxed preview frame refuses it under strict MIME checking.
|
|
151
|
+
*/
|
|
152
|
+
export function getRawContentType(filePath: string | undefined | null): string | null {
|
|
153
|
+
return (
|
|
154
|
+
getPaintableImageMimeType(filePath) ??
|
|
155
|
+
getDocumentMimeType(filePath) ??
|
|
156
|
+
WEB_ASSET_MIME_BY_EXT[getFileExtension(filePath)] ??
|
|
157
|
+
null
|
|
158
|
+
);
|
|
159
|
+
}
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
MIN_LEFT_PANEL_WIDTH,
|
|
30
30
|
resolveSidebarWidth,
|
|
31
31
|
saveSidebarWidth,
|
|
32
|
+
sidebarWidthForViewport,
|
|
32
33
|
} from '@/shared/lib/workspace/sidebar-width';
|
|
33
34
|
|
|
34
35
|
const WIDTH_KEY = 'omp_sidebar_width';
|
|
@@ -109,3 +110,36 @@ describe('sidebar-width', () => {
|
|
|
109
110
|
expect(resolveSidebarWidth()).toBe(334);
|
|
110
111
|
});
|
|
111
112
|
});
|
|
113
|
+
|
|
114
|
+
describe('the width a narrow WINDOW may give the column', () => {
|
|
115
|
+
/**
|
|
116
|
+
* A width dragged on a 1440px display is still 414px on a 768px window, where
|
|
117
|
+
* it took 54% of the screen and left the chat 148px with a 116px composer
|
|
118
|
+
* (measured on the running console). The cap is a share of the viewport, and
|
|
119
|
+
* it is applied to the RENDERED width so the chosen one comes back on a wider
|
|
120
|
+
* window.
|
|
121
|
+
*/
|
|
122
|
+
test('a wide window keeps the stored width untouched', () => {
|
|
123
|
+
expect(sidebarWidthForViewport(414, 1440)).toBe(414);
|
|
124
|
+
expect(sidebarWidthForViewport(DEFAULT_LEFT_PANEL_WIDTH, 1920)).toBe(DEFAULT_LEFT_PANEL_WIDTH);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('a narrow window caps it as a share of the viewport', () => {
|
|
128
|
+
expect(sidebarWidthForViewport(414, 1024)).toBe(328);
|
|
129
|
+
expect(sidebarWidthForViewport(414, 900)).toBe(288);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('the column floor wins over the share, so the list stays usable', () => {
|
|
133
|
+
// 0.32 x 768 is 246 and 0.32 x 600 is 192, both under the 264 floor the
|
|
134
|
+
// session list reads at — below ~825 the floor is what binds, and 768 is
|
|
135
|
+
// the narrowest window the DESKTOP layout is drawn in at all.
|
|
136
|
+
expect(sidebarWidthForViewport(414, 768)).toBe(MIN_LEFT_PANEL_WIDTH);
|
|
137
|
+
expect(sidebarWidthForViewport(414, 600)).toBe(MIN_LEFT_PANEL_WIDTH);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('an unmeasured viewport leaves the width alone', () => {
|
|
141
|
+
// The first paint can happen before any window is measured; a 0 would
|
|
142
|
+
// otherwise collapse the column to its floor.
|
|
143
|
+
expect(sidebarWidthForViewport(414, 0)).toBe(414);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
@@ -51,6 +51,39 @@ export const DEFAULT_LEFT_PANEL_WIDTH = 280;
|
|
|
51
51
|
export const MIN_LEFT_PANEL_WIDTH = 264;
|
|
52
52
|
export const MAX_LEFT_PANEL_WIDTH = 500;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* The most of the WINDOW the left column may take.
|
|
56
|
+
*
|
|
57
|
+
* The 264–500 range above is a statement about the column, not about the
|
|
58
|
+
* screen: a width the user dragged on a 1440px display is still 414px on a
|
|
59
|
+
* 900px one, where it is 46% of the window. Measured on this install
|
|
60
|
+
* (`omp_left_dock_widths.sessions = 414`) at a 768px window: sidebar 414, chat
|
|
61
|
+
* 148, composer 116 — the toolbar was a stack of clipped chips. The panel that
|
|
62
|
+
* has to give way on a narrow window is the one that is not the conversation.
|
|
63
|
+
*
|
|
64
|
+
* 0.32 leaves the chat and the workspace two thirds of the window at every
|
|
65
|
+
* width: 1024 → 328, 900 → 288, and the floor takes over below ~825. It never
|
|
66
|
+
* touches the shipped 280 default until the window is under 875px, and it
|
|
67
|
+
* never overrides the user's own 414 until the window is under 1294px — where
|
|
68
|
+
* that width would cost the chat more than a third of the screen.
|
|
69
|
+
*
|
|
70
|
+
* Applied to the RENDERED width and to the separator's ceiling, never to the
|
|
71
|
+
* stored value: the width the user chose comes back on a wider window.
|
|
72
|
+
*/
|
|
73
|
+
export const MAX_SIDEBAR_VIEWPORT_SHARE = 0.32;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The sidebar's width for the window it is being drawn in.
|
|
77
|
+
*
|
|
78
|
+
* A pure function of the stored width and the viewport, so the panel, the
|
|
79
|
+
* separator's ceiling and the tests cannot disagree about the cap.
|
|
80
|
+
*/
|
|
81
|
+
export function sidebarWidthForViewport(px: number, viewportWidth: number): number {
|
|
82
|
+
if (!Number.isFinite(viewportWidth) || viewportWidth <= 0) return Math.round(px);
|
|
83
|
+
const cap = Math.max(MIN_LEFT_PANEL_WIDTH, Math.round(viewportWidth * MAX_SIDEBAR_VIEWPORT_SHARE));
|
|
84
|
+
return Math.min(Math.round(px), cap);
|
|
85
|
+
}
|
|
86
|
+
|
|
54
87
|
/**
|
|
55
88
|
* Every read and every write of this slot is clamped, so a value from an older
|
|
56
89
|
* build cannot open the panel outside the range its separator allows.
|