@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
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The editor column's two chrome rows and the right column's header are ONE
|
|
8
|
+
* height.
|
|
9
|
+
*
|
|
10
|
+
* Measured in Chromium at 1365x768 before this test existed: the editor strip
|
|
11
|
+
* sized itself from its own chips (`py-1.5` + `border-t-2` = 31px) and its
|
|
12
|
+
* toolbar from `py-2` around 27px of controls (43px), against the right
|
|
13
|
+
* column's 40px strip and 40px header. The first separator landed at y=71 in
|
|
14
|
+
* one column and y=80 in the other, and the document began at 114 against 120 —
|
|
15
|
+
* which reads as two panels that are not on the same grid.
|
|
16
|
+
*
|
|
17
|
+
* happy-dom lays nothing out, so the assertion is the CLASS the rows carry: all
|
|
18
|
+
* three read `CONTROL_ROW_HEIGHT.desktop`, and that constant is 40px. A row that
|
|
19
|
+
* invents its own padding again fails here.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { Window } from 'happy-dom';
|
|
24
|
+
import { h, render } from 'preact';
|
|
25
|
+
import type { ComponentChildren } from 'preact';
|
|
26
|
+
import { act } from 'preact/test-utils';
|
|
27
|
+
|
|
28
|
+
import { SessionStateContext } from '@/client/hooks/workspace/session-state/context';
|
|
29
|
+
import { CONTROL_ROW_HEIGHT } from '@/client/lib/ui/control-plate';
|
|
30
|
+
import { PanelHeader } from '@/client/components/workspace/panel-header';
|
|
31
|
+
import { EditorTabs } from '@/client/components/workspace/editor/Tabs';
|
|
32
|
+
import { EditorToolbar } from '@/client/components/workspace/editor/Toolbar';
|
|
33
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
34
|
+
import type { OpenedFile } from '@/shared/types/fs';
|
|
35
|
+
|
|
36
|
+
const FILES: OpenedFile[] = [{ id: 1, name: 'keep.ts', path: 'src/keep.ts' }];
|
|
37
|
+
|
|
38
|
+
let container: HTMLElement;
|
|
39
|
+
|
|
40
|
+
beforeAll(() => {
|
|
41
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterAll(() => {
|
|
45
|
+
restoreDomGlobals();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
if (!container) return;
|
|
50
|
+
render(null, container);
|
|
51
|
+
container.remove();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
async function mount(children: ComponentChildren): Promise<HTMLElement> {
|
|
55
|
+
container = document.createElement('div');
|
|
56
|
+
document.body.appendChild(container);
|
|
57
|
+
await act(async () => {
|
|
58
|
+
render(
|
|
59
|
+
h(
|
|
60
|
+
SessionStateContext.Provider,
|
|
61
|
+
{ value: { sessionId: 'chrome-rows', ready: false } },
|
|
62
|
+
children,
|
|
63
|
+
),
|
|
64
|
+
container,
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
return container;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function toolbar() {
|
|
71
|
+
return h(EditorToolbar, {
|
|
72
|
+
path: 'src/keep.ts',
|
|
73
|
+
saveStatus: 'idle',
|
|
74
|
+
wordWrap: false,
|
|
75
|
+
hasPreview: false,
|
|
76
|
+
isPreview: false,
|
|
77
|
+
hasReview: false,
|
|
78
|
+
isReviewing: false,
|
|
79
|
+
copied: false,
|
|
80
|
+
canReload: true,
|
|
81
|
+
reloadDiscardsEdits: false,
|
|
82
|
+
onToggleFind: () => {},
|
|
83
|
+
onSave: () => {},
|
|
84
|
+
onTogglePreview: () => {},
|
|
85
|
+
onToggleReview: () => {},
|
|
86
|
+
onToggleWordWrap: () => {},
|
|
87
|
+
onZoomIn: () => {},
|
|
88
|
+
onZoomOut: () => {},
|
|
89
|
+
onCopy: () => {},
|
|
90
|
+
onDownload: () => {},
|
|
91
|
+
onReload: () => {},
|
|
92
|
+
onSaveAs: () => {},
|
|
93
|
+
onToggleMaximize: () => {},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
describe('editor chrome rows', () => {
|
|
98
|
+
test('the shared row height is the 40px chrome row', () => {
|
|
99
|
+
expect(CONTROL_ROW_HEIGHT.desktop).toBe('h-10');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('the tab strip is that row', async () => {
|
|
103
|
+
const el = await mount(
|
|
104
|
+
h(EditorTabs, {
|
|
105
|
+
openedFiles: FILES,
|
|
106
|
+
activeFileId: 1,
|
|
107
|
+
onSelectFile: () => {},
|
|
108
|
+
onCloseFile: () => {},
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
const strip = el.firstElementChild as HTMLElement;
|
|
112
|
+
expect(strip.className).toContain(CONTROL_ROW_HEIGHT.desktop);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('the toolbar is that row, so it ends on the right panel header line', async () => {
|
|
116
|
+
const el = await mount(toolbar());
|
|
117
|
+
const row = el.firstElementChild as HTMLElement;
|
|
118
|
+
expect(row.className).toContain(CONTROL_ROW_HEIGHT.desktop);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('the right panel header is that row', async () => {
|
|
122
|
+
const el = await mount(h(PanelHeader, { left: h('span', null, 'picker') }));
|
|
123
|
+
const strip = el.firstElementChild as HTMLElement;
|
|
124
|
+
expect(strip.className).toContain(CONTROL_ROW_HEIGHT.desktop);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The HTML preview's two load-bearing claims.
|
|
8
|
+
*
|
|
9
|
+
* A preview that drops the sandbox is a script from the opened file running in
|
|
10
|
+
* this app's origin, and a preview that ignores the file's folder fetches every
|
|
11
|
+
* relative `src` from the console's own root — both fail silently, because the
|
|
12
|
+
* frame still paints something.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
16
|
+
import { Window } from 'happy-dom';
|
|
17
|
+
import { h, render } from 'preact';
|
|
18
|
+
import { act } from 'preact/test-utils';
|
|
19
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
20
|
+
import { HtmlPreview } from '@/client/components/workspace/editor/viewers/HtmlPreview';
|
|
21
|
+
|
|
22
|
+
let container: HTMLElement;
|
|
23
|
+
|
|
24
|
+
beforeAll(() => {
|
|
25
|
+
const win = new Window({ url: 'http://localhost' });
|
|
26
|
+
installDomGlobals(win);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterAll(() => restoreDomGlobals());
|
|
30
|
+
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
if (container) render(null, container);
|
|
33
|
+
container?.remove();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function mount(node: unknown): Promise<void> {
|
|
37
|
+
container = document.createElement('div');
|
|
38
|
+
document.body.appendChild(container);
|
|
39
|
+
await act(async () => {
|
|
40
|
+
render(node as never, container);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function frame(): HTMLIFrameElement {
|
|
45
|
+
const element = container.querySelector('iframe');
|
|
46
|
+
if (!element) throw new Error('no iframe mounted');
|
|
47
|
+
return element as HTMLIFrameElement;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe('HtmlPreview', () => {
|
|
51
|
+
test('renders the page in a frame that scripts cannot use to reach this app', async () => {
|
|
52
|
+
await mount(
|
|
53
|
+
h(HtmlPreview, {
|
|
54
|
+
content: '<!doctype html><style>body{background:red}</style><h1>Hi</h1>',
|
|
55
|
+
name: 'page.html',
|
|
56
|
+
path: 'page.html',
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect(frame().getAttribute('srcdoc')).toContain('<h1>Hi</h1>');
|
|
61
|
+
const sandbox = frame().getAttribute('sandbox') ?? '';
|
|
62
|
+
expect(sandbox).toContain('allow-scripts');
|
|
63
|
+
expect(sandbox).not.toContain('allow-same-origin');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('resolves a relative reference against the file folder, not the app root', async () => {
|
|
67
|
+
await mount(
|
|
68
|
+
h(HtmlPreview, {
|
|
69
|
+
content: '<link rel="stylesheet" href="./app.css"><img src="logo.png">',
|
|
70
|
+
name: 'index.html',
|
|
71
|
+
path: 'site/pages/index.html',
|
|
72
|
+
root: '/workspace',
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const html = frame().getAttribute('srcdoc') ?? '';
|
|
77
|
+
// `&` is an entity inside an attribute value; the browser reads it back as
|
|
78
|
+
// the separator.
|
|
79
|
+
expect(html).toContain('/api/fs/raw?path=site%2Fpages%2Fapp.css&root=%2Fworkspace');
|
|
80
|
+
expect(html).toContain('/api/fs/raw?path=site%2Fpages%2Flogo.png&root=%2Fworkspace');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('leaves the markup alone when the file has no server-reachable scope', async () => {
|
|
84
|
+
await mount(
|
|
85
|
+
h(HtmlPreview, {
|
|
86
|
+
content: '<img src="logo.png">',
|
|
87
|
+
name: 'dropped.html',
|
|
88
|
+
path: 'dropped.html',
|
|
89
|
+
}),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(frame().getAttribute('srcdoc')).toContain('src="logo.png"');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An HTML file, drawn as the page it is.
|
|
8
|
+
*
|
|
9
|
+
* Built on the TEXT buffer like `SvgPreview`, so an edit in the source updates
|
|
10
|
+
* the page without a second fetch. The document is handed to a sandboxed
|
|
11
|
+
* `<iframe>` through `srcdoc` rather than injected as `innerHTML`: a page
|
|
12
|
+
* carries its own `<style>`, `<script>` and `<body>` semantics, and putting
|
|
13
|
+
* those in the app's document would let the file restyle — or script — the
|
|
14
|
+
* console around it.
|
|
15
|
+
*
|
|
16
|
+
* `allow-same-origin` is deliberately ABSENT. With it, a script in the file
|
|
17
|
+
* could reach `parent` and this app's storage, which is the isolation the
|
|
18
|
+
* sandbox exists for; without it the frame is an opaque origin. Scripts still
|
|
19
|
+
* run (`allow-scripts`) because a page that builds its own DOM is exactly what
|
|
20
|
+
* the preview is for.
|
|
21
|
+
*
|
|
22
|
+
* Relative references are resolved against the FILE's folder through the same
|
|
23
|
+
* `rewriteDocumentReferences` the markdown preview uses. An `srcdoc` document
|
|
24
|
+
* inherits the PARENT page's base URL, so `./style.css` would otherwise be
|
|
25
|
+
* fetched from the console's own root instead of the file's directory. The
|
|
26
|
+
* rewrite covers `src`/`href` attributes; a CSS `url()` or a script that
|
|
27
|
+
* fetches a relative path is out of its reach, which is a limit of previewing
|
|
28
|
+
* a file that was written to be served by a web server.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { useMemo } from 'preact/hooks';
|
|
32
|
+
import { rewriteDocumentReferences } from '@/shared/lib/markdown/document-urls';
|
|
33
|
+
|
|
34
|
+
interface HtmlPreviewProps {
|
|
35
|
+
content: string;
|
|
36
|
+
name: string;
|
|
37
|
+
/** The file's path inside its scope, for resolving relative references. */
|
|
38
|
+
path: string;
|
|
39
|
+
root?: string | null;
|
|
40
|
+
repo?: string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* What the page may do. No `allow-same-origin`, so the frame cannot touch this
|
|
45
|
+
* app; `allow-popups` and `allow-downloads` keep an ordinary page's links and
|
|
46
|
+
* downloads working.
|
|
47
|
+
*/
|
|
48
|
+
const SANDBOX = 'allow-scripts allow-forms allow-modals allow-popups allow-downloads';
|
|
49
|
+
|
|
50
|
+
export function HtmlPreview({ content, name, path, root = null, repo = null }: HtmlPreviewProps) {
|
|
51
|
+
const html = useMemo(
|
|
52
|
+
() =>
|
|
53
|
+
// A handle-backed or device file has no server-reachable path, so a raw
|
|
54
|
+
// URL built from its display name would fetch an unrelated file. Its
|
|
55
|
+
// markup is shown as written.
|
|
56
|
+
root || repo
|
|
57
|
+
? rewriteDocumentReferences(content, { path, root: root ?? undefined, repo: repo ?? undefined })
|
|
58
|
+
: content,
|
|
59
|
+
[content, path, root, repo],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<iframe
|
|
64
|
+
title={name}
|
|
65
|
+
srcDoc={html}
|
|
66
|
+
sandbox={SANDBOX}
|
|
67
|
+
referrerPolicy="no-referrer"
|
|
68
|
+
className="h-full w-full flex-1 border-0 bg-white"
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
import { deviceFileFor } from '@/client/lib/launch/device-files';
|
|
33
33
|
import { fileHandleFor } from '@/client/lib/launch/file-handlers';
|
|
34
|
-
import { getRawContentType } from '@/shared/lib/fs/
|
|
34
|
+
import { getRawContentType } from '@/shared/lib/fs/mime';
|
|
35
35
|
|
|
36
36
|
export interface ByteSource {
|
|
37
37
|
/** Stable identity of the file these bytes come from. */
|
|
@@ -45,6 +45,9 @@ const ImageView = lazy(() =>
|
|
|
45
45
|
const DrawioView = lazy(() =>
|
|
46
46
|
import('@/client/components/workspace/editor/viewers/DrawioView').then((m) => ({ default: m.DrawioView })),
|
|
47
47
|
);
|
|
48
|
+
const HtmlPreview = lazy(() =>
|
|
49
|
+
import('@/client/components/workspace/editor/viewers/HtmlPreview').then((m) => ({ default: m.HtmlPreview })),
|
|
50
|
+
);
|
|
48
51
|
|
|
49
52
|
/** What a viewer is handed: the file's identity, its bytes and its text. */
|
|
50
53
|
export interface ViewerProps {
|
|
@@ -54,8 +57,11 @@ export interface ViewerProps {
|
|
|
54
57
|
name: string;
|
|
55
58
|
/** Byte source for the byte-drawing viewers. */
|
|
56
59
|
source: ByteSource;
|
|
57
|
-
/** Text buffer, for the viewers that read it (CSV, SVG). */
|
|
60
|
+
/** Text buffer, for the viewers that read it (CSV, SVG, HTML). */
|
|
58
61
|
content: string;
|
|
62
|
+
/** The file's workspace scope, so a rendered document resolves its relatives. */
|
|
63
|
+
root?: string | null;
|
|
64
|
+
repo?: string | null;
|
|
59
65
|
/** Bumped to force a re-parse (a workspace refresh). */
|
|
60
66
|
revision: number;
|
|
61
67
|
/** Write an edited TEXT buffer back (the CSV grid's cells are text). */
|
|
@@ -75,7 +81,8 @@ export function hasViewerSurface(kind: ViewerKind): boolean {
|
|
|
75
81
|
kind === 'spreadsheet' ||
|
|
76
82
|
kind === 'csv' ||
|
|
77
83
|
kind === 'svg' ||
|
|
78
|
-
kind === 'drawio'
|
|
84
|
+
kind === 'drawio' ||
|
|
85
|
+
kind === 'html'
|
|
79
86
|
);
|
|
80
87
|
}
|
|
81
88
|
|
|
@@ -98,6 +105,8 @@ export function ViewerSurface({
|
|
|
98
105
|
name,
|
|
99
106
|
source,
|
|
100
107
|
content,
|
|
108
|
+
root = null,
|
|
109
|
+
repo = null,
|
|
101
110
|
revision,
|
|
102
111
|
onContentChange,
|
|
103
112
|
onSaveBytes,
|
|
@@ -159,5 +168,12 @@ export function ViewerSurface({
|
|
|
159
168
|
</Suspense>
|
|
160
169
|
);
|
|
161
170
|
}
|
|
171
|
+
if (kind === 'html') {
|
|
172
|
+
return (
|
|
173
|
+
<Suspense fallback={<Loading />}>
|
|
174
|
+
<HtmlPreview content={content} name={name} path={path} root={root} repo={repo} />
|
|
175
|
+
</Suspense>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
162
178
|
return null;
|
|
163
179
|
}
|
|
@@ -52,6 +52,10 @@ beforeAll(async () => {
|
|
|
52
52
|
({ DocxView } = await import('@/client/components/workspace/editor/viewers/DocxView'));
|
|
53
53
|
({ SheetView } = await import('@/client/components/workspace/editor/viewers/SheetView'));
|
|
54
54
|
({ DrawioView } = await import('@/client/components/workspace/editor/viewers/DrawioView'));
|
|
55
|
+
// Evaluated here for the same reason every viewer above is: the module binds
|
|
56
|
+
// DOM globals at load time, which `installDomGlobals` only just installed.
|
|
57
|
+
// Importing it also lets the lazy branch in `dispatch` resolve immediately.
|
|
58
|
+
await import('@/client/components/workspace/editor/viewers/HtmlPreview');
|
|
55
59
|
({ ViewerSurface, hasViewerSurface } = await import('@/client/components/workspace/editor/viewers/dispatch'));
|
|
56
60
|
});
|
|
57
61
|
|
|
@@ -228,7 +232,7 @@ describe('DocxView', () => {
|
|
|
228
232
|
|
|
229
233
|
describe('hasViewerSurface', () => {
|
|
230
234
|
test('the drawn kinds have a surface; text kinds do not', () => {
|
|
231
|
-
for (const kind of ['image', 'pdf', 'docx', 'spreadsheet', 'csv', 'svg', 'drawio'] as const) {
|
|
235
|
+
for (const kind of ['image', 'pdf', 'docx', 'spreadsheet', 'csv', 'svg', 'drawio', 'html'] as const) {
|
|
232
236
|
expect(hasViewerSurface(kind)).toBe(true);
|
|
233
237
|
}
|
|
234
238
|
for (const kind of ['code', 'markdown'] as const) {
|
|
@@ -266,6 +270,15 @@ describe('ViewerSurface routing', () => {
|
|
|
266
270
|
expect(container.querySelector('.drawio-preview svg')).not.toBeNull();
|
|
267
271
|
});
|
|
268
272
|
|
|
273
|
+
// An HTML page reads the TEXT buffer and paints in a sandboxed frame, so the
|
|
274
|
+
// dispatch must reach HtmlPreview with no byte source at all.
|
|
275
|
+
test('an html kind draws the page in a frame from the text buffer', async () => {
|
|
276
|
+
await mount(
|
|
277
|
+
h(ViewerSurface, { kind: 'html', path: 'page.html', name: 'page.html', source: noSource, content: '<h1>Hi</h1>', revision: 0 }),
|
|
278
|
+
);
|
|
279
|
+
expect(container.querySelector('iframe')?.getAttribute('srcdoc')).toContain('<h1>Hi</h1>');
|
|
280
|
+
});
|
|
281
|
+
|
|
269
282
|
test('a kind with no surface here renders nothing', async () => {
|
|
270
283
|
await mount(h(ViewerSurface, { kind: 'code', path: 'a.ts', name: 'a.ts', source: noSource, content: 'x', revision: 0 }));
|
|
271
284
|
expect(container.textContent).toBe('');
|
|
@@ -20,6 +20,7 @@ import type { ComponentChildren } from 'preact';
|
|
|
20
20
|
import { act } from 'preact/test-utils';
|
|
21
21
|
|
|
22
22
|
import { PanelHeader } from '@/client/components/workspace/panel-header';
|
|
23
|
+
import { CONTROL_ROW_HEIGHT } from '@/client/lib/ui/control-plate';
|
|
23
24
|
|
|
24
25
|
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
|
|
25
26
|
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
@@ -75,6 +76,6 @@ describe('PanelHeader', () => {
|
|
|
75
76
|
const el = await mount(h('span', null, 'picker'), undefined, 'border-b-0');
|
|
76
77
|
const strip = el.firstElementChild as HTMLElement;
|
|
77
78
|
expect(strip.className).toContain('border-b-0');
|
|
78
|
-
expect(strip.className).toContain(
|
|
79
|
+
expect(strip.className).toContain(CONTROL_ROW_HEIGHT.desktop);
|
|
79
80
|
});
|
|
80
81
|
});
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* Every right-panel view drew its own header, and each picked its own height
|
|
10
10
|
* and padding: `p-3` on three of them, `p-4` on Context, `px-3.5 py-2.5` on
|
|
11
11
|
* Usage and Todos, `py-1.5` on the wiki. The repo picker is the same control in
|
|
12
|
-
* all of them, so the row around it is one fact: a 40px strip
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* all of them, so the row around it is one fact: a 40px strip
|
|
13
|
+
* (`CONTROL_ROW_HEIGHT.desktop`, the same constant the panel tab strips read)
|
|
14
|
+
* whose centre is the activity rail's first mark. Stating it once is what keeps
|
|
15
|
+
* the picker on the same line as the rail when a view is switched.
|
|
15
16
|
*
|
|
16
17
|
* The icon controls in `right` are `HeaderButton`/`RefreshButton` from
|
|
17
18
|
* `common/header-button`, so the reload glyph is the same box in a settings
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
import type { ReactNode } from 'preact/compat';
|
|
28
|
+
import { CONTROL_ROW_HEIGHT } from '@/client/lib/ui/control-plate';
|
|
27
29
|
|
|
28
30
|
interface PanelHeaderProps {
|
|
29
31
|
/** The picker and the view's own leading content. */
|
|
@@ -37,7 +39,7 @@ interface PanelHeaderProps {
|
|
|
37
39
|
export function PanelHeader({ left, right, className = '' }: PanelHeaderProps) {
|
|
38
40
|
return (
|
|
39
41
|
<div
|
|
40
|
-
className={
|
|
42
|
+
className={`${CONTROL_ROW_HEIGHT.desktop} flex-shrink-0 px-3 border-b border-ink/10 bg-paper flex items-center justify-between gap-2 select-none ${className}`}
|
|
41
43
|
>
|
|
42
44
|
<div className="flex items-center gap-2 min-w-0">{left}</div>
|
|
43
45
|
{right ? <div className="flex items-center gap-1 flex-shrink-0">{right}</div> : null}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* object.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { getImageMimeType } from '@/shared/lib/fs/
|
|
24
|
+
import { getImageMimeType } from '@/shared/lib/fs/mime';
|
|
25
25
|
import { BINARY_VIEWERS, viewerKindFor, type ViewerKind } from '@/shared/lib/fs/document-kind';
|
|
26
26
|
import { buildFsRawUrl } from '@/shared/lib/fs/paths';
|
|
27
27
|
import { byteSourceFor, type ByteSource } from '@/client/components/workspace/editor/viewers/bytes';
|
|
@@ -55,6 +55,20 @@ export interface EditorDropResult {
|
|
|
55
55
|
message: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* The toast a drop outcome earns.
|
|
60
|
+
*
|
|
61
|
+
* A refused drop names its reason ("outside every workspace", "not text") — a
|
|
62
|
+
* silent no-op reads as a broken target, which is the one thing a drop zone
|
|
63
|
+
* cannot afford. The TARGET that produced the result is `WorkspacePanels`, so
|
|
64
|
+
* the layout only relays what it reported.
|
|
65
|
+
*/
|
|
66
|
+
export function useDropOutcomeToast(
|
|
67
|
+
pushToast: (message: string, tone?: 'success' | 'error' | 'warning') => void,
|
|
68
|
+
): (result: EditorDropResult) => void {
|
|
69
|
+
return useCallback((result: EditorDropResult) => pushToast(result.message, result.ok ? 'success' : 'error'), [pushToast]);
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
export interface UseEditorDropOptions {
|
|
59
73
|
/** False when the column has no workspace to resolve against. */
|
|
60
74
|
enabled?: boolean;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
import { useEffect } from 'preact/hooks';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import { opensInPreview, viewerKindFor } from '@/shared/lib/fs/document-kind';
|
|
26
26
|
import { getSessionValue } from '@/shared/lib/workspace/session-state/store';
|
|
27
27
|
import { setDirtyTabs } from '@/client/lib/editor-dirty-tabs';
|
|
28
28
|
import type { OpenedFile } from '@/shared/types/fs';
|
|
@@ -57,9 +57,10 @@ export function useEditorTabState({
|
|
|
57
57
|
if (!previewReady) return;
|
|
58
58
|
const id = activeFile?.id;
|
|
59
59
|
if (!activeFile || id === undefined || id === null) return;
|
|
60
|
-
// Only a file
|
|
61
|
-
// no preview to open
|
|
62
|
-
|
|
60
|
+
// Only a file that OPENS rendered has a default worth setting; a code file
|
|
61
|
+
// has no preview to open, and an HTML page defaults to its source even
|
|
62
|
+
// though it has one.
|
|
63
|
+
if (!opensInPreview(viewerKindFor(activeFile.name))) return;
|
|
63
64
|
const stored = getSessionValue<Record<string | number, boolean>>(sessionId, 'editor.previewMode');
|
|
64
65
|
if (stored && stored[id] !== undefined) return;
|
|
65
66
|
setPreviewMode((previous) => (previous[id] === undefined ? { ...previous, [id]: true } : previous));
|
|
@@ -21,6 +21,33 @@
|
|
|
21
21
|
|
|
22
22
|
import { useEffect, useState } from 'preact/hooks';
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The window's current width, subscribed.
|
|
26
|
+
*
|
|
27
|
+
* `useViewportAtLeast` answers a yes/no question, which is all a control that
|
|
28
|
+
* folds or not needs. The desktop sidebar asks a different one — how many
|
|
29
|
+
* pixels the window has, so its own width can be capped as a SHARE of them
|
|
30
|
+
* (`sidebarWidthForViewport`) — and a boolean cannot answer that.
|
|
31
|
+
*/
|
|
32
|
+
export function useViewportWidth(): number {
|
|
33
|
+
const [width, setWidth] = useState(() => (typeof window === 'undefined' ? 0 : window.innerWidth));
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const update = () => setWidth(window.innerWidth);
|
|
37
|
+
// Read once on the way in: a window resized between the first render and
|
|
38
|
+
// this effect would otherwise keep the stale value until the next resize.
|
|
39
|
+
update();
|
|
40
|
+
window.addEventListener('resize', update);
|
|
41
|
+
window.addEventListener('orientationchange', update);
|
|
42
|
+
return () => {
|
|
43
|
+
window.removeEventListener('resize', update);
|
|
44
|
+
window.removeEventListener('orientationchange', update);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
return width;
|
|
49
|
+
}
|
|
50
|
+
|
|
24
51
|
export function useViewportAtLeast(px: number): boolean {
|
|
25
52
|
const query = `(min-width: ${px}px)`;
|
|
26
53
|
const [matches, setMatches] = useState(() =>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EditorWidthMode } from '@/shared/lib/workspace/panel-widths';
|
|
1
2
|
import { useCallback, useEffect, useRef } from 'preact/hooks';
|
|
2
3
|
import { useSessionState } from '@/client/hooks/workspace/session-state';
|
|
3
4
|
import { useSessionStateContext } from '@/client/hooks/workspace/session-state/context';
|
|
@@ -303,9 +304,18 @@ export function useFileTabs(
|
|
|
303
304
|
handleOpenDiff(customEvent.detail);
|
|
304
305
|
});
|
|
305
306
|
|
|
307
|
+
// A diff wants room a source file does not, so the editor panel keeps a
|
|
308
|
+
// separate remembered width per tab kind. Derived HERE because it is a
|
|
309
|
+
// property of the tab list: the layout was recomputing it from the same two
|
|
310
|
+
// values on every render.
|
|
311
|
+
const widthMode: EditorWidthMode = openedFiles.find((f) => String(f.id) === String(activeFileId))?.isDiff
|
|
312
|
+
? 'diff'
|
|
313
|
+
: 'editor';
|
|
314
|
+
|
|
306
315
|
return {
|
|
307
316
|
openedFiles,
|
|
308
317
|
activeFileId,
|
|
318
|
+
widthMode,
|
|
309
319
|
setActiveFileId,
|
|
310
320
|
handleOpenFile,
|
|
311
321
|
handleOpenDiff,
|