@kabmo-labs/kabmo 0.61.0 → 0.62.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/README.md +53 -49
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +1157 -825
- package/dist/client/static/js/{Body-ab8wswhm.js → Body-z6kstvk6.js} +3 -3
- package/dist/client/static/js/{CsvGrid-czssywvz.js → CsvGrid-f73c0s4e.js} +2 -2
- package/dist/client/static/js/{DocxView-ke0dwdmt.js → DocxView-a1pb7nsb.js} +3 -3
- package/dist/client/static/js/{DrawioView-a1whhy84.js → DrawioView-r61gcg24.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-dr32dwjy.js → HtmlPreview-vt7j0b05.js} +1 -1
- package/dist/client/static/js/ImageView-4nhr5dtm.js +1 -0
- package/dist/client/static/js/LayoutWrapper-vwhy0vhj.js +2 -0
- package/dist/client/static/js/MergeDiffView-f4h9ss71.js +1 -0
- package/dist/client/static/js/Modal-cadmjkak.js +60 -0
- package/dist/client/static/js/{PdfView-2kdn91f9.js → PdfView-mppt2gkd.js} +1 -1
- package/dist/client/static/js/SessionsView-vvsaw9f0.js +1 -0
- package/dist/client/static/js/{SheetView-ettr9pdw.js → SheetView-5s9zfx9g.js} +9 -9
- package/dist/client/static/js/{SvgPreview-hzcejjry.js → SvgPreview-ff78xn3e.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-kdmv4y72.js → abnfDiagram-O67JEVCF-p29sh3w2.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-83w3kytq.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-qyrwaq0x.js → architectureDiagram-NJMV4G6O-nbpdyea3.js} +3 -3
- package/dist/client/static/js/{astro-yphdvdty.js → astro-qtfmc8x7.js} +1 -1
- package/dist/client/static/js/bash-wcy12qjx.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-tszxy2g7.js → blockDiagram-BEXU5L5S-t8xbexa6.js} +6 -6
- package/dist/client/static/js/c-vvantfth.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-0ye36hhv.js → c4Diagram-YGBWAQC7-9fwf2zxk.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-szgk1shv.js → classDiagram-v2-NBCMYWYE-nbapgqbs.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-0s9s4mmv.js → cose-bilkent-JH36ORCC-k54mmydp.js} +1 -1
- package/dist/client/static/js/cpp-5x63r6g0.js +1 -0
- package/dist/client/static/js/css-j2j6f03w.js +1 -0
- package/dist/client/static/js/css-qk59j6rj.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-80z02zrj.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-664g28ze.js → cynefinDiagram-VND7K2PF-qdg32wah.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-ga4rp1jx.js → dagre-6A5THRUB-qzshg1vs.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aagj46ty.js → diagram-22UHCM2B-197hemfa.js} +11 -11
- package/dist/client/static/js/{diagram-3UASUU5V-20qk6whk.js → diagram-3UASUU5V-236gnjr6.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1vg1tfca.js → diagram-ATOU4E4O-vjgpyaaq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-90d6jrqs.js → diagram-CDSNMT55-ywvzcx7z.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-8je4z8m1.js → diagram-MLGK6HIB-9ey7ev7j.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-0kzpexsj.js → diagram-MPIPVDR6-vrqbb6r7.js} +2 -2
- package/dist/client/static/js/{dockerfile-5nrbr0ef.js → dockerfile-4nked309.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-47yg36zx.js → ebnfDiagram-ZINNZB2B-hvnkevqy.js} +1 -1
- package/dist/client/static/js/{elixir-3nwnd9yw.js → elixir-3jvh6v4k.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-5hqp6r2d.js → elk-276RUBZZ-nej6yy1c.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-bt9te7r0.js → erDiagram-OPXOYQCR-ww453xcy.js} +5 -5
- package/dist/client/static/js/{erlang-p5c4n3t0.js → erlang-4fz73a1q.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-y9pq2709.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-e6v7513q.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-kzc13swm.js → ganttDiagram-FUAMR5RP-abc5wy70.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-fzaf9azs.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-bjf8aa3j.js → gitGraphDiagram-X574FWY7-4acqzj2h.js} +7 -7
- package/dist/client/static/js/graphql-hpkvdvk7.js +1 -0
- package/dist/client/static/js/html-x12gb1wk.js +1 -0
- package/dist/client/static/js/{index-v88m5sva.js → index-0g82ph6h.js} +2 -2
- package/dist/client/static/js/{index-1fmjhm2d.js → index-0w1jzang.js} +5 -5
- package/dist/client/static/js/{index-kj70d2q9.js → index-1svt0cdw.js} +2 -2
- package/dist/client/static/js/{index-m24sebb0.js → index-1tb4py5v.js} +2 -2
- package/dist/client/static/js/index-2gt9krtj.js +4 -0
- package/dist/client/static/js/index-2x9m7s1a.js +1 -0
- package/dist/client/static/js/index-3fvqmz3m.js +4 -0
- package/dist/client/static/js/{index-k9yf2txw.js → index-42wvbkm5.js} +2 -2
- package/dist/client/static/js/index-477vtt51.js +2 -0
- package/dist/client/static/js/{index-ca6tmamh.js → index-4px56qaz.js} +2 -2
- package/dist/client/static/js/{index-excgtjhx.js → index-5anvw7xg.js} +36 -36
- package/dist/client/static/js/index-5nb9k2ph.js +1 -0
- package/dist/client/static/js/{index-97sw4d9n.js → index-615je3km.js} +2 -2
- package/dist/client/static/js/{index-jz4012t5.js → index-66qxrh5n.js} +1 -1
- package/dist/client/static/js/{index-a145x0w2.js → index-7kct1sz1.js} +2 -2
- package/dist/client/static/js/{index-hwv7bfxc.js → index-8e0d8y30.js} +2 -2
- package/dist/client/static/js/{index-s4j2ghmx.js → index-90bq56xw.js} +2 -2
- package/dist/client/static/js/{index-wsy6y5em.js → index-b1gzh60t.js} +11 -11
- package/dist/client/static/js/{index-10vzyga1.js → index-bypkmjrz.js} +2 -2
- package/dist/client/static/js/{index-n8r7r86r.js → index-c1vd63yd.js} +2 -2
- package/dist/client/static/js/index-c9f0hejv.js +3 -0
- package/dist/client/static/js/{index-2dmew334.js → index-cgqj15g0.js} +2 -2
- package/dist/client/static/js/{index-mtav0rpf.js → index-cts5re1t.js} +2 -2
- package/dist/client/static/js/index-dxc14kmm.js +1 -0
- package/dist/client/static/js/{index-krdz5vby.js → index-dxyjxhm1.js} +2 -2
- package/dist/client/static/js/{index-zr3965k9.js → index-edpyqz9f.js} +1 -1
- package/dist/client/static/js/{index-h7agc069.js → index-eesepb70.js} +2 -2
- package/dist/client/static/js/{index-r38e0rya.js → index-evh437bz.js} +2 -2
- package/dist/client/static/js/index-ey6v4t5b.js +1 -0
- package/dist/client/static/js/{index-025s3fp8.js → index-fsd7n336.js} +2 -2
- package/dist/client/static/js/{index-yfcy4cf6.js → index-h7a7fqag.js} +2 -2
- package/dist/client/static/js/{index-11qn05g9.js → index-hffgwnvz.js} +2 -2
- package/dist/client/static/js/index-j734ev6q.js +482 -0
- package/dist/client/static/js/{index-9g2nzgpx.js → index-jcbp1d9d.js} +6 -6
- package/dist/client/static/js/index-jg5h18sm.js +2 -0
- package/dist/client/static/js/{index-bq9f0mxp.js → index-jtdve6xw.js} +7 -7
- package/dist/client/static/js/{index-kyr612aa.js → index-k0bqrb1y.js} +1 -1
- package/dist/client/static/js/{index-bdtftrym.js → index-kegevd10.js} +2 -2
- package/dist/client/static/js/{index-fr6wsqk8.js → index-kqcfxkch.js} +2 -2
- package/dist/client/static/js/{index-sr14vwn5.js → index-kv1xnem9.js} +2 -2
- package/dist/client/static/js/{index-xy0m8te9.js → index-m54ctmxr.js} +1 -1
- package/dist/client/static/js/index-mgzbypt5.js +314 -0
- package/dist/client/static/js/{index-85jfn1fz.js → index-mh52531j.js} +2 -2
- package/dist/client/static/js/{index-776n5n29.js → index-mhz5ywa4.js} +5 -5
- package/dist/client/static/js/{index-3j2he86h.js → index-nnwdbg3t.js} +2 -2
- package/dist/client/static/js/{index-3x7cbxwq.js → index-nxd6z7f9.js} +2 -2
- package/dist/client/static/js/{index-dabnbvbc.js → index-pjrbt77c.js} +2 -2
- package/dist/client/static/js/index-r7h4pm42.js +2 -0
- package/dist/client/static/js/index-ratrdgc9.js +2 -0
- package/dist/client/static/js/{index-475dc6h9.js → index-rhmvh9w5.js} +2 -2
- package/dist/client/static/js/{index-twwsn91p.js → index-sqzjwy9h.js} +2 -2
- package/dist/client/static/js/{index-z5s9tmj8.js → index-tckzkw0f.js} +2 -2
- package/dist/client/static/js/index-tza9h3q6.css +1 -0
- package/dist/client/static/js/{index-qccydkze.js → index-vhjfr093.js} +2 -2
- package/dist/client/static/js/{index-653x8zdq.js → index-w0j96eyy.js} +8 -8
- package/dist/client/static/js/{index-24a40rw8.js → index-ws04kxy9.js} +1 -1
- package/dist/client/static/js/{index-a3bpmw2r.js → index-x1yqmzpr.js} +2 -2
- package/dist/client/static/js/{index-fb2fjndj.js → index-x2f7wykb.js} +6 -6
- package/dist/client/static/js/index-y8405hdg.js +10 -0
- package/dist/client/static/js/{index-sx83ans2.js → index-yxk7dgnb.js} +2 -2
- package/dist/client/static/js/{index-bkn6jtn1.js → index-zavecxak.js} +2 -2
- package/dist/client/static/js/{index-vn59zz0k.js → index-zg7q3kcb.js} +2 -2
- package/dist/client/static/js/{index-enm77k5z.js → index-zhn9vv3z.js} +2 -2
- package/dist/client/static/js/{index-vgcw01yk.js → index-zy963qbh.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-t7pbg7rt.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-jy5zvvj8.js → infoDiagram-VRGFBTTK-9pe7w3r5.js} +2 -2
- package/dist/client/static/js/ini-522adp5a.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-pfky1nnf.js → ishikawaDiagram-OU5B5YK6-38arfrx5.js} +2 -2
- package/dist/client/static/js/java-z0rgs7v6.js +1 -0
- package/dist/client/static/js/javascript-fv87f565.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-mvaf7rfh.js → journeyDiagram-ZHPQQLJL-kcwzjgtz.js} +4 -4
- package/dist/client/static/js/json-1czq1ped.js +1 -0
- package/dist/client/static/js/jsx-1fch2jyr.js +1 -0
- package/dist/client/static/js/{julia-rpd1y9vh.js → julia-pzzxbptm.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-hw2xwe6e.js → kanban-definition-PNTS6WVX-nmegwy9w.js} +15 -15
- package/dist/client/static/js/lua-nn8bpjev.js +1 -0
- package/dist/client/static/js/markdown-38tqrgkn.js +1 -0
- package/dist/client/static/js/{mermaid.core-hsw87hmq.js → mermaid.core-3aae27b9.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-wfe4d846.js → mindmap-definition-NLK3R4M7-zsaq4e65.js} +12 -12
- package/dist/client/static/js/one-dark-pro-trnff03z.js +1 -0
- package/dist/client/static/js/one-light-ck31ptqs.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-rwac7scq.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-cvnmxgst.js → pegDiagram-GJSIUBJH-2b6whj1p.js} +1 -1
- package/dist/client/static/js/{perl-kmtz9dnv.js → perl-zdkbbjd2.js} +1 -1
- package/dist/client/static/js/{php-bttrsbxy.js → php-ktaxff6g.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-gjz20apz.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-0n3gz7sv.js → pieDiagram-5QR66LMP-y09ar7vz.js} +3 -3
- package/dist/client/static/js/properties-kncqeqhn.js +1 -0
- package/dist/client/static/js/python-gx8ggmyh.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-9qqh6xvv.js → quadrantDiagram-O4NWA36T-mapfzs06.js} +3 -3
- package/dist/client/static/js/r-x8rftkm3.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-akwdknab.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-m5v4rfhx.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-k2gmqcjb.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zdsfjf4.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-e98evqb6.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-5f3x3762.js → railroadDiagram-XR7U4H2S-70qy7qdh.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-a68bv6kh.js → requirementDiagram-PLB6GJNP-2vb2gp3e.js} +3 -3
- package/dist/client/static/js/{ruby-dve3y59w.js → ruby-ytqv3pqz.js} +1 -1
- package/dist/client/static/js/{rust-qjhdt4b0.js → rust-6sddyxnt.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ry7xcphh.js → sankeyDiagram-IPEJSGJF-9jd8ebrn.js} +3 -3
- package/dist/client/static/js/{sass-emxqt5p2.js → sass-dvbra5b6.js} +1 -1
- package/dist/client/static/js/{scss-4j4t3r6y.js → scss-sy7w8916.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-mekzzhet.js → sequenceDiagram-PO4LG4MO-w7z84f80.js} +7 -7
- package/dist/client/static/js/{sizeCapture-INFHLROL-pvc16ame.js → sizeCapture-INFHLROL-q8w7ehgx.js} +1 -1
- package/dist/client/static/js/sql-99y0qnag.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-3ytxby83.js → stateDiagram-v2-GCMORJYK-4978hapr.js} +3 -3
- package/dist/client/static/js/{svelte-dbsx1ehx.js → svelte-xvs3fkza.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-c2zfp416.js → swimlanes-2SLR337P-eshg5fjy.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-914e28hd.js +8 -0
- package/dist/client/static/js/timeline-definition-EJHVYXUP-5h5q357k.js +120 -0
- package/dist/client/static/js/treeView-Q6P3EWNA-fkm3a7gx.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-hm4ktxjf.js +1 -0
- package/dist/client/static/js/tsx-phngprp0.js +1 -0
- package/dist/client/static/js/typescript-m62a7zr2.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-sz6b7bnv.js → usecaseDiagram-POWQR4AR-4j69y3zx.js} +20 -20
- package/dist/client/static/js/vennDiagram-UO4OBE2U-pa9p5jpw.js +34 -0
- package/dist/client/static/js/{vue-hyr58df9.js → vue-p4g4avm3.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-3y2rvdmy.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-xvtyvde9.js → wardleyDiagram-VNRHLVJA-hjddd656.js} +3 -3
- package/dist/client/static/js/xml-59n0cjn6.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-jcs20s84.js → xychartDiagram-PMCCYNJV-8ng5m849.js} +4 -4
- package/dist/client/static/js/yaml-9fw908s4.js +1 -0
- package/dist/client/tailwindcss-oxide.linux-x64-gnu-c0fa36dv.node +0 -0
- package/dist/client/tailwindcss-oxide.linux-x64-musl-kr04sh0e.node +0 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/app.tsx +2 -5
- package/marketplace/plugins/command-runner/src/panel/CustomForm.tsx +35 -52
- package/marketplace/plugins/command-runner/src/panel/Groups.tsx +6 -5
- package/marketplace/plugins/command-runner/src/panel/Header.tsx +18 -54
- package/marketplace/plugins/command-runner/src/panel/Output.tsx +3 -7
- package/marketplace/plugins/command-runner/src/panel/Row.tsx +19 -38
- package/marketplace/plugins/command-runner/src/panel/index.tsx +1 -4
- package/marketplace/plugins/git-forge/package.json +2 -2
- package/marketplace/plugins/git-forge/src/app.tsx +2 -0
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +8 -15
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +35 -66
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +7 -13
- package/marketplace/plugins/git-forge/src/panel/List.tsx +28 -56
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +7 -9
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +21 -31
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +26 -40
- package/marketplace/plugins/git-forge/src/panel/index.tsx +0 -1
- package/marketplace/plugins/github-actions/package.json +2 -2
- package/marketplace/plugins/github-actions/src/app.tsx +2 -0
- package/marketplace/plugins/github-actions/src/panel/Actions.tsx +9 -17
- package/marketplace/plugins/github-actions/src/panel/LogView.tsx +4 -13
- package/marketplace/plugins/github-actions/src/panel/Row.tsx +4 -5
- package/marketplace/plugins/github-actions/src/panel/RunView.tsx +8 -15
- package/marketplace/plugins/github-actions/src/panel/index.test.tsx +3 -2
- package/marketplace/plugins/github-actions/src/panel/index.tsx +31 -37
- package/marketplace/plugins/kanban/package.json +2 -2
- package/marketplace/plugins/kanban/src/app.tsx +2 -0
- package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +88 -98
- package/marketplace/plugins/kanban/src/panel/CardTile.tsx +6 -10
- package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +22 -18
- package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +59 -70
- package/marketplace/plugins/kanban/src/panel/index.tsx +37 -52
- package/marketplace/plugins/kanban/src/panel/use-board.ts +2 -0
- package/marketplace/plugins/session-info/package.json +2 -2
- package/marketplace/plugins/session-info/src/app.tsx +6 -3
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/KillConfirm.test.tsx +6 -4
- package/marketplace/plugins/stats/src/KillConfirm.tsx +26 -76
- package/marketplace/plugins/stats/src/ProcessTable.tsx +8 -6
- package/marketplace/plugins/stats/src/RefreshButton.tsx +7 -5
- package/marketplace/plugins/stats/src/app.tsx +11 -9
- package/package.json +10 -10
- package/src/cli/lib/commands/plugin.js +8 -5
- package/src/client/bootstrap.d.ts +5 -0
- package/src/client/chat-title-overlay.test.ts +53 -0
- package/src/client/components/auth/login-screen/index.tsx +31 -3
- package/src/client/components/common/SignOutButton.tsx +4 -5
- package/src/client/components/common/account-badge/index.tsx +31 -0
- package/src/client/components/common/footer-version/index.tsx +40 -0
- package/src/client/components/common/fullscreen-viewer/fullscreen-viewer.test.tsx +24 -0
- package/src/client/components/common/fullscreen-viewer/index.tsx +22 -31
- package/src/client/components/common/header-controls/MoreMenu.tsx +5 -56
- package/src/client/components/common/header-controls/index.test.tsx +2 -6
- package/src/client/components/common/header-controls/index.tsx +9 -25
- package/src/client/components/common/header-controls/phone-row.test.tsx +3 -16
- package/src/client/components/common/shell-update-button/index.tsx +2 -2
- package/src/client/components/common/zoom-pan-stage/index.tsx +54 -50
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +4 -5
- package/src/client/components/layout/desktop-layout/index.tsx +2 -4
- package/src/client/components/layout/left-bar/index.tsx +25 -3
- package/src/client/components/layout/rail-toggle.test.tsx +112 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.accent.test.tsx +81 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +11 -3
- package/src/client/components/layout/session-sidebar/Footer.test.tsx +36 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +42 -61
- package/src/client/components/layout/session-sidebar/FooterHost.tsx +5 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +30 -10
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +4 -0
- package/src/client/components/layout/session-sidebar/modern/index.tsx +8 -1
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +25 -4
- package/src/client/components/layout/session-title-bar/index.tsx +13 -5
- package/src/client/components/layout/top-bars.test.tsx +4 -2
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/RightSidebar.tsx +12 -3
- package/src/client/components/mobile/SessionSidebar.tsx +6 -2
- package/src/client/components/mobile/drawer-layout.test.tsx +7 -3
- package/src/client/components/mobile/drawer-strip.tsx +9 -2
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +29 -9
- package/src/client/components/mobile/mobile-main-view/Header.tsx +43 -12
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +12 -1
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +1 -0
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +9 -1
- package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +4 -2
- package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +48 -46
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +18 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.test.tsx +4 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +4 -6
- package/src/client/components/mobile/right-drawer-nav.test.tsx +53 -1
- package/src/client/components/settings/Band.tsx +5 -2
- package/src/client/components/settings/Modal.tsx +8 -5
- package/src/client/components/settings/Sidebar.tsx +5 -3
- package/src/client/components/settings/apply-side-effects.ts +5 -0
- package/src/client/components/settings/categories/AccountSettings.tsx +266 -0
- package/src/client/components/settings/categories/ProjectSettings.tsx +2 -0
- package/src/client/components/settings/categories/account-settings/Dialogs.tsx +223 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +3 -4
- package/src/client/components/settings/categories/appearance-settings/ChromeStyleSection.tsx +66 -39
- package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +7 -4
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +14 -1
- package/src/client/components/settings/categories/project-settings/ProjectSharing.tsx +130 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +5 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/SessionSkeleton.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.test.ts +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +34 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +4 -1
- package/src/client/components/workspace/editor/Tab.tsx +19 -26
- package/src/client/components/workspace/editor/Tabs.test.ts +13 -7
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -0
- package/src/client/components/workspace/git-panel/commit-modal/floating.test.ts +46 -0
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -0
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +4 -5
- package/src/client/components/workspace/panel-tabs/TabChip.tsx +40 -39
- package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +76 -58
- package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +9 -9
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +14 -1
- package/src/client/components/workspace/panel-tabs/index.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +22 -5
- package/src/client/components/workspace/plugin-panel/chrome.test.tsx +89 -0
- package/src/client/components/workspace/plugin-panel/chrome.tsx +62 -0
- package/src/client/data/settings/omp-schema.json +40 -4
- package/src/client/floating-phone.test.ts +189 -0
- package/src/client/floating.css +205 -2
- package/src/client/floating.test.ts +43 -0
- package/src/client/glass.css +47 -0
- package/src/client/hooks/chat/omp/index.ts +6 -5
- package/src/client/hooks/chat/omp/prompt-send.test.ts +18 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +26 -8
- package/src/client/hooks/chat/omp/session-list.tsx +20 -8
- package/src/client/hooks/chat/timeline/deferred-model.ts +13 -5
- package/src/client/hooks/chat/timeline/index.ts +2 -0
- package/src/client/hooks/chat/timeline/send-props.ts +14 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +11 -2
- package/src/client/hooks/chat/timeline/send-switch.test.ts +92 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +37 -7
- package/src/client/hooks/chat/timeline/send.test.ts +11 -2
- package/src/client/hooks/chat/timeline/send.ts +62 -42
- package/src/client/hooks/editor/image-generation.ts +24 -0
- package/src/client/hooks/editor/resolve-viewer.test.ts +26 -20
- package/src/client/hooks/editor/resolve-viewer.ts +14 -5
- package/src/client/hooks/editor/use-file-editor.test.ts +34 -0
- package/src/client/hooks/editor/use-file-editor.ts +6 -2
- package/src/client/hooks/settings/accounts.ts +162 -0
- package/src/client/hooks/ui/auth.ts +58 -3
- package/src/client/hooks/ui/border-style.test.ts +5 -4
- package/src/client/hooks/ui/border-style.ts +3 -2
- package/src/client/hooks/ui/mobile-chrome-style.ts +68 -0
- package/src/client/hooks/ui/navbar-controls.test.ts +1 -2
- package/src/client/hooks/ui/navbar-controls.ts +0 -3
- package/src/client/hooks/ui/zoom-gesture.ts +104 -0
- package/src/client/lib/desktop/titlebar.test.ts +21 -0
- package/src/client/lib/desktop/titlebar.ts +34 -0
- package/src/client/lib/plugins/bootstrap.test.ts +20 -0
- package/src/client/lib/plugins/bootstrap.tsx +10 -15
- package/src/client/lib/plugins/kit-components.test.tsx +119 -0
- package/src/client/lib/plugins/kit-components.tsx +79 -0
- package/src/client/lib/plugins/kit.ts +8 -0
- package/src/client/lib/plugins/slots.test.ts +34 -0
- package/src/client/lib/plugins/slots.ts +31 -4
- package/src/client/lib/plugins/stylesheets.ts +10 -11
- package/src/client/lib/ui/pinch.test.ts +74 -0
- package/src/client/lib/ui/pinch.ts +104 -0
- package/src/client/lib/ui/safe-area.test.ts +25 -0
- package/src/client/lib/ui/safe-area.ts +23 -0
- package/src/client/main.tsx +8 -1
- package/src/client/tailwind.css +54 -1
- package/src/server/index.ts +2 -0
- package/src/server/lib/assets/shell-attributes.server.ts +12 -4
- package/src/server/lib/assets/shell-attributes.test.ts +19 -18
- package/src/server/lib/auth/client-address.test.ts +2 -2
- package/src/server/lib/auth/guard.test.ts +2 -2
- package/src/server/lib/auth/guard.ts +81 -97
- package/src/server/lib/auth/handover-guard.test.ts +1 -1
- package/src/server/lib/auth/rate-limit.test.ts +2 -2
- package/src/server/lib/auth/token.test.ts +1 -1
- package/src/server/lib/auth/workspace-gate.server.ts +34 -0
- package/src/server/lib/bundler/css.test.ts +16 -0
- package/src/server/lib/connect/devices.server.test.ts +12 -0
- package/src/server/lib/connect/devices.server.ts +63 -19
- package/src/server/lib/connect/pairing.server.ts +5 -3
- package/src/server/lib/connect/status.server.ts +2 -2
- package/src/server/lib/db/schema.test.ts +3 -3
- package/src/server/lib/db/schema.ts +6 -0
- package/src/server/lib/harness/update-spawn.server.test.ts +97 -0
- package/src/server/lib/harness/update-spawn.server.ts +10 -0
- package/src/server/lib/models/provider-icon-override.server.test.ts +140 -0
- package/src/server/lib/models/provider-icon-override.server.ts +197 -0
- package/src/server/lib/models/provider-icon-store.server.ts +8 -0
- package/src/server/lib/models/provider-icon.server.ts +31 -6
- package/src/server/lib/omp/session/artifacts.server.test.ts +11 -7
- package/src/server/lib/omp/session/artifacts.server.ts +21 -17
- package/src/server/lib/panels/build.server.ts +19 -2
- package/src/server/lib/panels/css.server.test.ts +141 -0
- package/src/server/lib/panels/css.server.ts +255 -0
- package/src/server/lib/panels/plugin-ui-contract.test.ts +64 -0
- package/src/server/lib/panels/registry-stylesheet.server.test.ts +69 -0
- package/src/server/lib/panels/scan.server.ts +13 -7
- package/src/server/lib/panels/source-warnings.server.test.ts +65 -0
- package/src/server/lib/panels/source-warnings.server.ts +71 -0
- package/src/server/lib/realtime/topics/catalog.server.ts +3 -0
- package/src/server/lib/realtime/topics.server.ts +14 -0
- package/src/server/lib/sessions/last-opened-client.server.ts +1 -1
- package/src/server/lib/workspace/access.server.ts +108 -0
- package/src/server/lib/workspace/project-patch.server.ts +4 -2
- package/src/server/lib/workspace/register-folder.server.ts +19 -5
- package/src/server/lib/workspace/session-access.server.ts +55 -0
- package/src/server/lib/workspace/tenancy-schema.server.ts +40 -0
- package/src/server/plugins/ssr.ts +19 -3
- package/src/server/routes/accounts/index.ts +8 -0
- package/src/server/routes/accounts/management.test.ts +174 -0
- package/src/server/routes/accounts/management.ts +166 -0
- package/src/server/routes/auth/login.ts +22 -8
- package/src/server/routes/auth/logout.ts +1 -1
- package/src/server/routes/auth/password.ts +40 -33
- package/src/server/routes/auth/revoke.test.ts +1 -1
- package/src/server/routes/auth/revoke.ts +26 -8
- package/src/server/routes/auth/routes.test.ts +3 -3
- package/src/server/routes/auth/state.ts +14 -7
- package/src/server/routes/connect/devices.ts +7 -4
- package/src/server/routes/connect/pair.ts +4 -3
- package/src/server/routes/connect/status.ts +4 -2
- package/src/server/routes/connect/tunnels.ts +2 -1
- package/src/server/routes/folders/batch-delete.ts +12 -0
- package/src/server/routes/folders/clone.ts +7 -2
- package/src/server/routes/folders/create.ts +3 -1
- package/src/server/routes/folders/folder.ts +44 -4
- package/src/server/routes/folders/index.ts +3 -0
- package/src/server/routes/folders/shares.ts +62 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/panels/build.ts +1 -1
- package/src/server/routes/panels/css.test.ts +22 -0
- package/src/server/routes/panels/css.ts +5 -7
- package/src/server/routes/realtime/ws.ts +16 -1
- package/src/server/routes/sessions/list.ts +3 -2
- package/src/server/routes/settings/projects.ts +46 -7
- package/src/server/routes/settings/provider-icon.ts +18 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.test.ts +2 -2
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +6 -3
- package/src/shared/lib/icons/tint-hues.generated.ts +38 -37
- package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +27 -1
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +1 -1
- package/src/shared/lib/realtime/protocol.ts +16 -0
- package/src/shared/lib/settings/defaults.ts +2 -1
- package/src/shared/lib/settings/sections.ts +1 -1
- package/src/shared/lib/theme/border-style.test.ts +11 -9
- package/src/shared/lib/theme/border-style.ts +7 -7
- package/src/shared/lib/theme/chrome-style.test.ts +15 -0
- package/src/shared/lib/theme/chrome-style.ts +16 -1
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/state.ts +6 -5
- package/src/test-support/file-editor.test-util.ts +25 -6
- package/tsconfig.json +21 -0
- package/dist/client/static/js/ImageView-zf4kh5wp.js +0 -1
- package/dist/client/static/js/LayoutWrapper-dncbzcea.js +0 -2
- package/dist/client/static/js/MergeDiffView-btdx9yb9.js +0 -1
- package/dist/client/static/js/Modal-5cxfw2rv.js +0 -60
- package/dist/client/static/js/SessionsView-vbn0nvx4.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-sxrkxwbq.js +0 -1
- package/dist/client/static/js/bash-bcbct9gc.js +0 -1
- package/dist/client/static/js/c-fn9jz26e.js +0 -1
- package/dist/client/static/js/cpp-a1q64mke.js +0 -1
- package/dist/client/static/js/css-b92azee8.js +0 -1
- package/dist/client/static/js/css-sn00sq6v.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-g1xwa8b9.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-05p61bka.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-500fcx2a.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-z1yehwys.js +0 -1
- package/dist/client/static/js/graphql-8d8bn59j.js +0 -1
- package/dist/client/static/js/html-6hdrwtz2.js +0 -1
- package/dist/client/static/js/index-0kcnghxn.js +0 -4
- package/dist/client/static/js/index-2zhmmtye.js +0 -2
- package/dist/client/static/js/index-4vtc4xct.js +0 -481
- package/dist/client/static/js/index-5srvxsht.js +0 -2
- package/dist/client/static/js/index-6c1s0v4b.js +0 -1
- package/dist/client/static/js/index-cvm2ha01.js +0 -1
- package/dist/client/static/js/index-d11mbz2q.js +0 -4
- package/dist/client/static/js/index-fen0x3qh.js +0 -1
- package/dist/client/static/js/index-gwgh27h3.js +0 -314
- package/dist/client/static/js/index-hxy1sadd.js +0 -2
- package/dist/client/static/js/index-pg87cgpy.js +0 -2
- package/dist/client/static/js/index-q1a40v20.js +0 -3
- package/dist/client/static/js/index-qmvstmvh.js +0 -1
- package/dist/client/static/js/index-t6nqy2n5.css +0 -1
- package/dist/client/static/js/index-wf5j0009.js +0 -10
- package/dist/client/static/js/index-y6zbkh4p.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-dqyaxjc1.js +0 -1
- package/dist/client/static/js/ini-g6a5xsaw.js +0 -1
- package/dist/client/static/js/java-n596am4c.js +0 -1
- package/dist/client/static/js/javascript-zc1qnyyp.js +0 -1
- package/dist/client/static/js/json-7k70qbkj.js +0 -1
- package/dist/client/static/js/jsx-sndenqrc.js +0 -1
- package/dist/client/static/js/lua-djd3g9q5.js +0 -1
- package/dist/client/static/js/markdown-r2tpvxpn.js +0 -1
- package/dist/client/static/js/one-dark-pro-ckq5capv.js +0 -1
- package/dist/client/static/js/one-light-a908z398.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-7jxzax4z.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wc9wxr7f.js +0 -1
- package/dist/client/static/js/properties-brn72zdk.js +0 -1
- package/dist/client/static/js/python-g9mghwgm.js +0 -1
- package/dist/client/static/js/r-e247x4mw.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-kwj5padj.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-h8sdx3w5.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2wmwx246.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-h4cdgw3y.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-q7m0tfd0.js +0 -1
- package/dist/client/static/js/sql-0kar81jy.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-9gm67sq4.js +0 -8
- package/dist/client/static/js/timeline-definition-EJHVYXUP-xtvv4za2.js +0 -120
- package/dist/client/static/js/treeView-Q6P3EWNA-yv9640h3.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-7kpzjg21.js +0 -1
- package/dist/client/static/js/tsx-gjxfjnbk.js +0 -1
- package/dist/client/static/js/typescript-bm89v3gk.js +0 -1
- package/dist/client/static/js/vennDiagram-UO4OBE2U-56q0qs51.js +0 -34
- package/dist/client/static/js/wardley-WFR3VGLG-mggay64p.js +0 -1
- package/dist/client/static/js/xml-b7824nx0.js +0 -1
- package/dist/client/static/js/yaml-kqqktdv1.js +0 -1
- package/src/server/lib/auth/client-address.ts +0 -89
- package/src/server/lib/auth/config.ts +0 -133
- package/src/server/lib/auth/rate-limit.ts +0 -146
- package/src/server/lib/auth/token.ts +0 -220
|
@@ -47,42 +47,37 @@ export function PluginBootstrap({ workspacePath }: { workspacePath: string | nul
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Load
|
|
51
|
-
* generation, and unload it when it does not.
|
|
50
|
+
* Load every live plugin's stylesheet, and unload it when the plugin goes.
|
|
52
51
|
*
|
|
53
|
-
* A plugin's imported CSS is otherwise inert (see `stylesheets.ts`), so
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* needs
|
|
52
|
+
* A plugin's imported CSS is otherwise inert (see `stylesheets.ts`), so the
|
|
53
|
+
* registry's `cssUrl` is what makes a stylesheet do anything at all. It is
|
|
54
|
+
* loaded for EVERY panel, not only one with a content script: the stylesheet is
|
|
55
|
+
* now the plugin's own compiled Tailwind (`dist/plugin.css`), and a plugin that
|
|
56
|
+
* renders only into a slot still needs the utilities its markup names. Gating
|
|
57
|
+
* that on a content script was how a panel-only plugin ended up with no CSS.
|
|
58
58
|
*
|
|
59
59
|
* Reconciled from the whole registry payload rather than per plugin, so a
|
|
60
60
|
* plugin that was disabled or removed loses its `<link>` in the same pass. The
|
|
61
|
-
* RULES are scoped
|
|
61
|
+
* RULES are scoped (the server wraps every stylesheet in
|
|
62
62
|
* `@scope ([data-plugin-surface="<id>"])`), but the link still has to go: a
|
|
63
63
|
* switched-off plugin must stop shipping bytes, and an unloaded one must not
|
|
64
64
|
* keep a stale stylesheet alive.
|
|
65
65
|
*/
|
|
66
66
|
function usePluginStylesheets(): void {
|
|
67
67
|
const { panels } = usePanelRegistry();
|
|
68
|
-
const rows = useListSlotRows<ContentScriptRegistration>('contentScript');
|
|
69
68
|
// A stable signature: the same live set must not churn the links on every
|
|
70
69
|
// render, and a rebuild's new URL is already handled by the loader.
|
|
71
|
-
const livePlugins = [...new Set(rows.map((row) => row.pluginId))].sort().join('|');
|
|
72
70
|
const signature = panels
|
|
73
71
|
.map((panel) => `${panel.pluginId}:${panel.cssUrl ?? ''}`)
|
|
74
72
|
.sort()
|
|
75
73
|
.join('|');
|
|
76
74
|
|
|
77
75
|
useEffect(() => {
|
|
78
|
-
const withContentScripts = new Set(livePlugins ? livePlugins.split('|') : []);
|
|
79
76
|
reconcilePluginStylesheets(
|
|
80
|
-
panels
|
|
81
|
-
.filter((panel) => withContentScripts.has(panel.pluginId))
|
|
82
|
-
.map((panel) => ({ pluginId: panel.pluginId, cssUrl: panel.cssUrl })),
|
|
77
|
+
panels.map((panel) => ({ pluginId: panel.pluginId, cssUrl: panel.cssUrl })),
|
|
83
78
|
);
|
|
84
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
-
}, [signature
|
|
80
|
+
}, [signature]);
|
|
86
81
|
}
|
|
87
82
|
|
|
88
83
|
/**
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The adapters that hand the HOST's controls to the kit.
|
|
8
|
+
*
|
|
9
|
+
* The kit's `Dialog`, `Checkbox` and `Picker` are only as consistent as these
|
|
10
|
+
* three components: if an adapter rendered a different shell, the plugin would
|
|
11
|
+
* get the copy this seam exists to avoid. The assertions are the host's own
|
|
12
|
+
* identity — the modal scrim, the portalled picker's combobox trigger, the
|
|
13
|
+
* palette's checkbox class.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { Window } from 'happy-dom';
|
|
18
|
+
import { h, render } from 'preact';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
import { HostCheckbox, HostDialog, HostPicker } from '@/client/lib/plugins/kit-components';
|
|
21
|
+
|
|
22
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event', 'KeyboardEvent'] as const;
|
|
23
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
24
|
+
let window_: Window | null = null;
|
|
25
|
+
let container: HTMLDivElement;
|
|
26
|
+
|
|
27
|
+
function installDom(): void {
|
|
28
|
+
window_ = new Window();
|
|
29
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
30
|
+
const source = window_ as unknown as Record<string, unknown>;
|
|
31
|
+
for (const key of DOM_GLOBALS) {
|
|
32
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
|
|
33
|
+
target[key] = source[key];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function restoreDom(): void {
|
|
38
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
39
|
+
for (const key of DOM_GLOBALS) {
|
|
40
|
+
const value = nativeGlobals[key];
|
|
41
|
+
if (value === undefined) delete target[key];
|
|
42
|
+
else target[key] = value;
|
|
43
|
+
}
|
|
44
|
+
window_ = null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
installDom();
|
|
49
|
+
container = document.createElement('div');
|
|
50
|
+
document.body.appendChild(container);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
afterEach(() => {
|
|
54
|
+
render(null, container);
|
|
55
|
+
container.remove();
|
|
56
|
+
restoreDom();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('HostDialog', () => {
|
|
60
|
+
test('renders the app modal shell, not a plugin copy', async () => {
|
|
61
|
+
await act(async () => {
|
|
62
|
+
render(
|
|
63
|
+
h(HostDialog, {
|
|
64
|
+
title: 'Add command',
|
|
65
|
+
onClose: () => {},
|
|
66
|
+
footer: h('button', { id: 'save' }, 'Save'),
|
|
67
|
+
children: h('p', { id: 'body' }, 'body'),
|
|
68
|
+
}),
|
|
69
|
+
container,
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const dialog = container.querySelector('[role="dialog"]');
|
|
74
|
+
expect(dialog).not.toBeNull();
|
|
75
|
+
// The shared shell's scrim class is what proves it is the host's modal.
|
|
76
|
+
expect(container.querySelector('.modal-scrim')).not.toBeNull();
|
|
77
|
+
expect(dialog?.querySelector('button[aria-label="Close"]')).not.toBeNull();
|
|
78
|
+
expect(container.querySelector('#body')).not.toBeNull();
|
|
79
|
+
expect(container.querySelector('#save')).not.toBeNull();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('HostPicker', () => {
|
|
84
|
+
test('renders the host searchable select as a combobox', async () => {
|
|
85
|
+
await act(async () => {
|
|
86
|
+
render(
|
|
87
|
+
h(HostPicker, {
|
|
88
|
+
value: 'b',
|
|
89
|
+
options: [
|
|
90
|
+
{ value: 'a', label: 'Alpha' },
|
|
91
|
+
{ value: 'b', label: 'Beta' },
|
|
92
|
+
],
|
|
93
|
+
placeholder: 'Pick one',
|
|
94
|
+
ariaLabel: 'Demo',
|
|
95
|
+
searchable: false,
|
|
96
|
+
allowEmpty: false,
|
|
97
|
+
onChange: () => {},
|
|
98
|
+
}),
|
|
99
|
+
container,
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const trigger = container.querySelector('[role="combobox"]');
|
|
104
|
+
expect(trigger).not.toBeNull();
|
|
105
|
+
expect(trigger?.textContent).toContain('Beta');
|
|
106
|
+
// The native control must not be what a Kabmo plugin sees.
|
|
107
|
+
expect(container.querySelector('select')).toBeNull();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('HostCheckbox', () => {
|
|
112
|
+
test('renders the palette checkbox', () => {
|
|
113
|
+
render(h(HostCheckbox, { checked: false, ariaLabel: 'hidden', onChange: () => {} }), container);
|
|
114
|
+
|
|
115
|
+
const input = container.querySelector('input[type="checkbox"]');
|
|
116
|
+
expect(input?.className).toContain('kabmo-checkbox');
|
|
117
|
+
expect(input?.getAttribute('aria-label')).toBe('hidden');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The host's UI primitives, handed to the kit.
|
|
8
|
+
*
|
|
9
|
+
* `@kabmo-labs/kabmo-ui` is published and cannot import Kabmo's source, so the
|
|
10
|
+
* kit's `Dialog`, `Checkbox` and `Picker` render these adapters instead of
|
|
11
|
+
* reimplementing them. One implementation of each control is the whole point:
|
|
12
|
+
* a plugin dialog gets the same focus trap and Escape handling as the app's,
|
|
13
|
+
* a plugin checkbox the same contrast-solved box, and a plugin picker the same
|
|
14
|
+
* portalled searchable list.
|
|
15
|
+
*
|
|
16
|
+
* The adapters are deliberately thin — types come from the kit's contracts,
|
|
17
|
+
* rendering from the host's component. Nothing here decides how a control looks.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { CheckboxProps, DialogProps, PickerProps, ToastTone } from '@kabmo-labs/kabmo-ui';
|
|
21
|
+
import { Modal } from '@/client/components/common/Modal';
|
|
22
|
+
import { SearchSelect } from '@/client/components/common/search-select';
|
|
23
|
+
import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
|
|
24
|
+
import { pushToast } from '@/client/hooks/ui/toasts';
|
|
25
|
+
|
|
26
|
+
/** The host's modal shell, with the kit's title header. */
|
|
27
|
+
export function HostDialog({
|
|
28
|
+
title,
|
|
29
|
+
onClose,
|
|
30
|
+
children,
|
|
31
|
+
footer,
|
|
32
|
+
maxWidthClass,
|
|
33
|
+
form,
|
|
34
|
+
ariaLabel,
|
|
35
|
+
}: DialogProps) {
|
|
36
|
+
return (
|
|
37
|
+
<Modal
|
|
38
|
+
onClose={onClose}
|
|
39
|
+
header={<span class="text-xs font-semibold uppercase tracking-wider text-ink">{title}</span>}
|
|
40
|
+
{...(footer !== undefined ? { footer } : {})}
|
|
41
|
+
{...(maxWidthClass !== undefined ? { maxWidthClass } : {})}
|
|
42
|
+
ariaLabel={ariaLabel ?? title}
|
|
43
|
+
{...(form
|
|
44
|
+
? {
|
|
45
|
+
form: {
|
|
46
|
+
onSubmit: (event: Event) => form.onSubmit(event),
|
|
47
|
+
className: form.className ?? '',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
: {})}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</Modal>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The host's checkbox, which is a native input with the palette's own box. */
|
|
58
|
+
export function HostCheckbox({ checked, onChange, disabled, ariaLabel }: CheckboxProps) {
|
|
59
|
+
return (
|
|
60
|
+
<input
|
|
61
|
+
type="checkbox"
|
|
62
|
+
class={`${CHECKBOX_CLASS} size-3.5 accent-ink`}
|
|
63
|
+
checked={checked}
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
aria-label={ariaLabel}
|
|
66
|
+
onChange={(event) => onChange(event.currentTarget.checked)}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The host's one picker: portalled, searchable and keyboard-complete. */
|
|
72
|
+
export function HostPicker(props: PickerProps) {
|
|
73
|
+
return <SearchSelect {...props} />;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The host's toast stack, so a plugin's message lands with the app's. */
|
|
77
|
+
export function hostToast(message: string, tone: ToastTone = 'error'): void {
|
|
78
|
+
pushToast(message, tone);
|
|
79
|
+
}
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
} from '@/client/lib/plugins/sidebar-bridge';
|
|
44
44
|
import { repoScopeServices } from '@/client/lib/plugins/repo-scope-service';
|
|
45
45
|
import { awaitPluginPlatformReady } from '@/client/lib/plugins/readiness';
|
|
46
|
+
import { HostCheckbox, HostDialog, HostPicker, hostToast } from '@/client/lib/plugins/kit-components';
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Read a text file inside the active workspace, through Kabmo's own fs
|
|
@@ -151,6 +152,13 @@ export function installUiKit(): void {
|
|
|
151
152
|
// The Kabmo's markdown renderer, so a plugin does not bundle a second
|
|
152
153
|
// copy of the marked / KaTeX / mermaid / Shiki pipeline.
|
|
153
154
|
markdown: () => MarkdownRenderer,
|
|
155
|
+
// The controls a plugin cannot draw the same way twice: the host's modal
|
|
156
|
+
// shell, checkbox and searchable picker, plus its toast stack. The kit's
|
|
157
|
+
// wrappers render these through the same service seam as Markdown.
|
|
158
|
+
dialog: () => HostDialog,
|
|
159
|
+
checkbox: () => HostCheckbox,
|
|
160
|
+
picker: () => HostPicker,
|
|
161
|
+
toast: hostToast,
|
|
154
162
|
|
|
155
163
|
// The participant seam: RPC, the plugin's own topic, and the composer.
|
|
156
164
|
// The id arrives as an ARGUMENT, supplied by the kit hook from the context
|
|
@@ -48,6 +48,40 @@ describe('registerPluginBundle', () => {
|
|
|
48
48
|
expect(pluginSlotState().failures).toEqual([]);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
+
test('warns once when a right panel predates host chrome', () => {
|
|
52
|
+
const warnings: string[] = [];
|
|
53
|
+
const original = console.warn;
|
|
54
|
+
console.warn = (message: unknown) => warnings.push(String(message));
|
|
55
|
+
try {
|
|
56
|
+
const legacy = definePluginApp((app) => app.rightPanel({ id: 'r', component: Noop }));
|
|
57
|
+
registerPluginBundle('legacy', { default: legacy });
|
|
58
|
+
// A rebuild re-runs setup; the migration note must not repeat.
|
|
59
|
+
registerPluginBundle('legacy', { default: legacy });
|
|
60
|
+
} finally {
|
|
61
|
+
console.warn = original;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const chromeWarnings = warnings.filter((line) => line.includes("chrome: 'host'"));
|
|
65
|
+
expect(chromeWarnings).toHaveLength(1);
|
|
66
|
+
expect(chromeWarnings[0]).toContain('[plugin:legacy]');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('records host chrome, and leaves the old contract as the default', () => {
|
|
70
|
+
registerPluginBundle('demo', {
|
|
71
|
+
default: definePluginApp((app) =>
|
|
72
|
+
app.rightPanel({ id: 'r', component: Noop, chrome: 'host' }),
|
|
73
|
+
),
|
|
74
|
+
});
|
|
75
|
+
registerPluginBundle('own', {
|
|
76
|
+
default: definePluginApp((app) => app.rightPanel({ id: 'r', component: Noop })),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
expect(pluginSlotState().slots.get('demo')!.chrome.rightPanel).toBe('host');
|
|
80
|
+
// Absent is `'plugin'`: a bundle built before the option existed keeps
|
|
81
|
+
// drawing its own header instead of getting a second one from the host.
|
|
82
|
+
expect(pluginSlotState().slots.get('own')!.chrome.rightPanel).toBeUndefined();
|
|
83
|
+
});
|
|
84
|
+
|
|
51
85
|
test('reads each slot through its own accessor', () => {
|
|
52
86
|
registerPluginBundle(
|
|
53
87
|
'demo',
|
|
@@ -57,6 +57,8 @@ export interface PluginSlots {
|
|
|
57
57
|
titles: Partial<Record<SlotName, string>>;
|
|
58
58
|
/** Sizing the bundle declared for its panels, where it declared any. */
|
|
59
59
|
sizing: Partial<Record<'rightPanel' | 'panel', { minWidth?: number; defaultFraction?: number }>>;
|
|
60
|
+
/** Who draws each panel's title row; absent means the plugin does. */
|
|
61
|
+
chrome: Partial<Record<'rightPanel' | 'panel', 'host' | 'plugin'>>;
|
|
60
62
|
/**
|
|
61
63
|
* The header's dropdown, when it declared one.
|
|
62
64
|
*
|
|
@@ -157,6 +159,7 @@ export function registerPluginBundle(pluginId: string, module: unknown): void {
|
|
|
157
159
|
const components: PluginSlots['components'] = {};
|
|
158
160
|
const titles: PluginSlots['titles'] = {};
|
|
159
161
|
const sizing: PluginSlots['sizing'] = {};
|
|
162
|
+
const chrome: PluginSlots['chrome'] = {};
|
|
160
163
|
let headerDropdown: unknown;
|
|
161
164
|
let headerOpensPanel: 'rightPanel' | 'panel' | undefined;
|
|
162
165
|
|
|
@@ -172,6 +175,7 @@ export function registerPluginBundle(pluginId: string, module: unknown): void {
|
|
|
172
175
|
id: string,
|
|
173
176
|
title?: string,
|
|
174
177
|
size?: { minWidth?: number; defaultFraction?: number },
|
|
178
|
+
panelChrome?: 'host' | 'plugin',
|
|
175
179
|
) => {
|
|
176
180
|
if (typeof component !== 'function' && typeof component !== 'object') {
|
|
177
181
|
throw new Error(`${slot} "${id}" has no component`);
|
|
@@ -180,14 +184,15 @@ export function registerPluginBundle(pluginId: string, module: unknown): void {
|
|
|
180
184
|
components[slot] = component;
|
|
181
185
|
if (title) titles[slot] = title;
|
|
182
186
|
if (size && (slot === 'rightPanel' || slot === 'panel')) sizing[slot] = size;
|
|
187
|
+
if (panelChrome && (slot === 'rightPanel' || slot === 'panel')) chrome[slot] = panelChrome;
|
|
183
188
|
};
|
|
184
189
|
|
|
185
190
|
const app: PluginApp = {
|
|
186
191
|
pluginId,
|
|
187
|
-
rightPanel: ({ id, title, component, minWidth, defaultFraction }) =>
|
|
188
|
-
register('rightPanel', component, id, title, { minWidth, defaultFraction }),
|
|
189
|
-
panel: ({ id, title, component, minWidth, defaultFraction }) =>
|
|
190
|
-
register('panel', component, id, title, { minWidth, defaultFraction }),
|
|
192
|
+
rightPanel: ({ id, title, component, minWidth, defaultFraction, chrome: panelChrome }) =>
|
|
193
|
+
register('rightPanel', component, id, title, { minWidth, defaultFraction }, panelChrome),
|
|
194
|
+
panel: ({ id, title, component, minWidth, defaultFraction, chrome: panelChrome }) =>
|
|
195
|
+
register('panel', component, id, title, { minWidth, defaultFraction }, panelChrome),
|
|
191
196
|
headerPanel: ({ id, title, component, dropdown, opensPanel }) => {
|
|
192
197
|
register('headerPanel', component, id, title);
|
|
193
198
|
if (dropdown && opensPanel) {
|
|
@@ -241,18 +246,39 @@ export function registerPluginBundle(pluginId: string, module: unknown): void {
|
|
|
241
246
|
return;
|
|
242
247
|
}
|
|
243
248
|
|
|
249
|
+
if (components.rightPanel && chrome.rightPanel !== 'host') warnMissingChrome(pluginId);
|
|
250
|
+
|
|
244
251
|
const slots = new Map(state.slots);
|
|
245
252
|
slots.set(pluginId, {
|
|
246
253
|
pluginId,
|
|
247
254
|
components,
|
|
248
255
|
titles,
|
|
249
256
|
sizing,
|
|
257
|
+
chrome,
|
|
250
258
|
...(headerDropdown ? { headerDropdown } : {}),
|
|
251
259
|
...(headerOpensPanel ? { headerOpensPanel } : {}),
|
|
252
260
|
});
|
|
253
261
|
publish({ slots, failures: state.failures.filter((entry) => entry.pluginId !== pluginId) });
|
|
254
262
|
}
|
|
255
263
|
|
|
264
|
+
/**
|
|
265
|
+
* One warning per plugin, for a bundle that predates host chrome.
|
|
266
|
+
*
|
|
267
|
+
* This is a MIGRATION note, not a refusal: the plugin still renders under the
|
|
268
|
+
* old contract. Re-registering the bundle on every rebuild must not repeat it,
|
|
269
|
+
* so the set is module-scoped and cleared by `resetPluginSlots`.
|
|
270
|
+
*/
|
|
271
|
+
const warnedMissingChrome = new Set<string>();
|
|
272
|
+
|
|
273
|
+
function warnMissingChrome(pluginId: string): void {
|
|
274
|
+
if (warnedMissingChrome.has(pluginId)) return;
|
|
275
|
+
warnedMissingChrome.add(pluginId);
|
|
276
|
+
console.warn(
|
|
277
|
+
`[plugin:${pluginId}] rightPanel has no chrome: 'host'; it draws its own title row. ` +
|
|
278
|
+
`Register chrome: 'host' and remove the local header to match the host's panels.`,
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
256
282
|
/** Record a bundle that could not load. Reported in the pane, never silent. */
|
|
257
283
|
export function failPluginBundle(pluginId: string, reason: string): void {
|
|
258
284
|
publish({
|
|
@@ -263,5 +289,6 @@ export function failPluginBundle(pluginId: string, reason: string): void {
|
|
|
263
289
|
|
|
264
290
|
/** Drop everything — used by the loader before a re-import, and by tests. */
|
|
265
291
|
export function resetPluginSlots(): void {
|
|
292
|
+
warnedMissingChrome.clear();
|
|
266
293
|
publish(EMPTY);
|
|
267
294
|
}
|
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* A plugin's stylesheet, loaded while
|
|
7
|
+
* A plugin's stylesheet, loaded while the plugin is live.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* A plugin's CSS is otherwise INERT: `Bun.build` emits it beside the bundle and
|
|
10
|
+
* the emitted JS never references it, so nothing fetches it. The server builds
|
|
11
|
+
* it (`dist/plugin.css`) and the registry publishes its URL; this module is the
|
|
12
|
+
* half that puts a `<link>` in the document.
|
|
13
13
|
*
|
|
14
|
-
* The lifecycle is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* which is the documented path and needs no CSS of its own.
|
|
14
|
+
* The lifecycle is tied to the plugin's presence in the registry, NOT to a
|
|
15
|
+
* content script. Every plugin surface — panel, header readout, editor takeover
|
|
16
|
+
* — renders markup with the plugin's own classes, so a panel-only plugin needs
|
|
17
|
+
* its sheet exactly as much as one with a content script. The link is removed
|
|
18
|
+
* when the plugin leaves the payload (disabled, removed, or failed).
|
|
20
19
|
*
|
|
21
20
|
* Two properties are load-bearing:
|
|
22
21
|
*
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
import { PinchTracker } from '@/client/lib/ui/pinch';
|
|
8
|
+
|
|
9
|
+
describe('PinchTracker', () => {
|
|
10
|
+
test('one contact is a pan, never a pinch', () => {
|
|
11
|
+
const tracker = new PinchTracker();
|
|
12
|
+
tracker.begin(1, 10, 10);
|
|
13
|
+
expect(tracker.pinching).toBe(false);
|
|
14
|
+
expect(tracker.move(1, 40, 50)).toBeNull();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('contacts moving apart scale by the distance ratio', () => {
|
|
18
|
+
const tracker = new PinchTracker();
|
|
19
|
+
tracker.begin(1, 100, 100);
|
|
20
|
+
tracker.begin(2, 200, 100);
|
|
21
|
+
const frame = tracker.move(2, 300, 100);
|
|
22
|
+
expect(frame).not.toBeNull();
|
|
23
|
+
expect(frame?.scale).toBeCloseTo(2);
|
|
24
|
+
// The midpoint is the anchor: it moved 50px right with the two fingers.
|
|
25
|
+
expect(frame?.x).toBeCloseTo(200);
|
|
26
|
+
expect(frame?.y).toBeCloseTo(100);
|
|
27
|
+
expect(frame?.dx).toBeCloseTo(50);
|
|
28
|
+
expect(frame?.dy).toBeCloseTo(0);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('both contacts moving together pan without scaling', () => {
|
|
32
|
+
const tracker = new PinchTracker();
|
|
33
|
+
tracker.begin(1, 100, 100);
|
|
34
|
+
tracker.begin(2, 200, 100);
|
|
35
|
+
// A touchscreen reports one contact per event, so the pair is only back to
|
|
36
|
+
// its original span on the second event; the product of the frames is the
|
|
37
|
+
// gesture's actual zoom, and both midpoints contribute their pan.
|
|
38
|
+
const first = tracker.move(1, 130, 140);
|
|
39
|
+
const second = tracker.move(2, 230, 140);
|
|
40
|
+
expect(first).not.toBeNull();
|
|
41
|
+
expect(second).not.toBeNull();
|
|
42
|
+
expect((first?.scale ?? 0) * (second?.scale ?? 0)).toBeCloseTo(1);
|
|
43
|
+
expect((first?.dx ?? 0) + (second?.dx ?? 0)).toBeCloseTo(30);
|
|
44
|
+
expect((first?.dy ?? 0) + (second?.dy ?? 0)).toBeCloseTo(40);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('lifting one contact hands the remaining one back for panning', () => {
|
|
48
|
+
const tracker = new PinchTracker();
|
|
49
|
+
tracker.begin(1, 100, 100);
|
|
50
|
+
tracker.begin(2, 200, 100);
|
|
51
|
+
expect(tracker.pinching).toBe(true);
|
|
52
|
+
expect(tracker.end(2)).toEqual({ id: 1, x: 100, y: 100 });
|
|
53
|
+
expect(tracker.pinching).toBe(false);
|
|
54
|
+
expect(tracker.move(1, 120, 100)).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('releasing a pointer that never pressed is not a handoff', () => {
|
|
58
|
+
const tracker = new PinchTracker();
|
|
59
|
+
tracker.begin(1, 100, 100);
|
|
60
|
+
tracker.begin(2, 200, 100);
|
|
61
|
+
// A mouse release while two fingers are down must not restart the pan.
|
|
62
|
+
expect(tracker.end(9)).toBeNull();
|
|
63
|
+
expect(tracker.pinching).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('reset forgets contacts still captured', () => {
|
|
67
|
+
const tracker = new PinchTracker();
|
|
68
|
+
tracker.begin(1, 0, 0);
|
|
69
|
+
tracker.begin(2, 50, 0);
|
|
70
|
+
tracker.reset();
|
|
71
|
+
expect(tracker.pinching).toBe(false);
|
|
72
|
+
expect(tracker.move(1, 90, 0)).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Two-finger pinch arithmetic for the zoom surfaces.
|
|
8
|
+
*
|
|
9
|
+
* A pinch is two contacts and the change between two samples, not a library.
|
|
10
|
+
* Keeping the numbers here is what lets the editor stage and the full-screen
|
|
11
|
+
* viewer answer a pinch identically; wiring the midpoint math twice is how one
|
|
12
|
+
* of them ends up zooming about a corner.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export interface PinchFrame {
|
|
16
|
+
/** Distance ratio between the two contacts since the previous frame. */
|
|
17
|
+
scale: number;
|
|
18
|
+
/** Midpoint of the contacts, in client coordinates — the zoom anchor. */
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
/** Midpoint movement since the previous frame, in client px. */
|
|
22
|
+
dx: number;
|
|
23
|
+
dy: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PinchContact {
|
|
27
|
+
id: number;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface Sample {
|
|
33
|
+
distance: number;
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class PinchTracker {
|
|
39
|
+
private contacts = new Map<number, { x: number; y: number }>();
|
|
40
|
+
private previous: Sample | null = null;
|
|
41
|
+
|
|
42
|
+
/** Two contacts are down: a pinch, not a drag. */
|
|
43
|
+
get pinching(): boolean {
|
|
44
|
+
return this.contacts.size >= 2;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Record a contact. The first two contacts are the ones a pinch measures. */
|
|
48
|
+
begin(id: number, x: number, y: number): void {
|
|
49
|
+
this.contacts.set(id, { x, y });
|
|
50
|
+
this.previous = this.sample();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Move a contact; a frame exists only while two contacts are down. */
|
|
54
|
+
move(id: number, x: number, y: number): PinchFrame | null {
|
|
55
|
+
const contact = this.contacts.get(id);
|
|
56
|
+
if (!contact) return null;
|
|
57
|
+
contact.x = x;
|
|
58
|
+
contact.y = y;
|
|
59
|
+
if (this.contacts.size < 2) return null;
|
|
60
|
+
const now = this.sample();
|
|
61
|
+
if (!now) return null;
|
|
62
|
+
const previous = this.previous;
|
|
63
|
+
this.previous = now;
|
|
64
|
+
// A midpoint that has not moved yet (a contact landing, not moving) has no
|
|
65
|
+
// distance to compare, so it contributes pan only.
|
|
66
|
+
return {
|
|
67
|
+
scale: previous && previous.distance > 0 ? now.distance / previous.distance : 1,
|
|
68
|
+
x: now.x,
|
|
69
|
+
y: now.y,
|
|
70
|
+
dx: previous ? now.x - previous.x : 0,
|
|
71
|
+
dy: previous ? now.y - previous.y : 0,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Drop a contact. Returns the contact still down, if any, so panning
|
|
77
|
+
* continues from the finger the reader kept instead of waiting for a press.
|
|
78
|
+
*/
|
|
79
|
+
end(id: number): PinchContact | null {
|
|
80
|
+
// A mouse release arrives here too; only a tracked contact may hand panning
|
|
81
|
+
// to another finger.
|
|
82
|
+
if (!this.contacts.delete(id)) return null;
|
|
83
|
+
this.previous = this.sample();
|
|
84
|
+
const remaining = this.contacts.entries().next();
|
|
85
|
+
if (remaining.done) return null;
|
|
86
|
+
const [remainingId, point] = remaining.value;
|
|
87
|
+
return { id: remainingId, x: point.x, y: point.y };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
reset(): void {
|
|
91
|
+
this.contacts.clear();
|
|
92
|
+
this.previous = null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private sample(): Sample | null {
|
|
96
|
+
const [first, second] = [...this.contacts.values()];
|
|
97
|
+
if (!first || !second) return null;
|
|
98
|
+
return {
|
|
99
|
+
distance: Math.hypot(second.x - first.x, second.y - first.y),
|
|
100
|
+
x: (first.x + second.x) / 2,
|
|
101
|
+
y: (first.y + second.y) / 2,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
|
|
8
|
+
import { SAFE_BOTTOM, safeBottom } from '@/client/lib/ui/safe-area';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The bottom inset is ONE shared source, and every surface that can reach the
|
|
12
|
+
* phone's bottom edge takes it through these two values. A caller that writes
|
|
13
|
+
* `env(safe-area-inset-bottom)` itself clips behind the Android navigation bar
|
|
14
|
+
* on the APK's WebView, where that env is 0.
|
|
15
|
+
*/
|
|
16
|
+
describe('safe-area bottom', () => {
|
|
17
|
+
test('points at the shared CSS value', () => {
|
|
18
|
+
expect(SAFE_BOTTOM).toBe('var(--kabmo-safe-bottom)');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('a floor never replaces the system inset, it only raises it', () => {
|
|
22
|
+
expect(safeBottom('0.75rem')).toBe('max(0.75rem, var(--kabmo-safe-bottom))');
|
|
23
|
+
expect(safeBottom('1rem')).toBe('max(1rem, var(--kabmo-safe-bottom))');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The bottom safe area every phone surface keeps clear.
|
|
8
|
+
*
|
|
9
|
+
* The value is defined once in `tailwind.css` as
|
|
10
|
+
* `max(env(safe-area-inset-bottom, 0px), var(--kabmo-inset-bottom, 0px))`:
|
|
11
|
+
* `env()` is the browser's answer, and `--kabmo-inset-bottom` is the Android
|
|
12
|
+
* shell's, because WebViews before 136 report the navigation bar as 0 even
|
|
13
|
+
* while Android 15 draws the page edge-to-edge behind it.
|
|
14
|
+
*
|
|
15
|
+
* A `max`, not a sum: on a WebView that reports both, the two sources describe
|
|
16
|
+
* the SAME bar, and adding them would double the pad.
|
|
17
|
+
*/
|
|
18
|
+
export const SAFE_BOTTOM = 'var(--kabmo-safe-bottom)';
|
|
19
|
+
|
|
20
|
+
/** The inset with a surface's own floor, for an inline `padding-bottom`. */
|
|
21
|
+
export function safeBottom(min: string): string {
|
|
22
|
+
return `max(${min}, ${SAFE_BOTTOM})`;
|
|
23
|
+
}
|