@jxsuite/studio 8.0.1 → 8.1.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/chunks/{2020-5wtzce5g.js → 2020-dg097k3e.js} +3 -3
- package/dist/chunks/adapter-tck81zft.js +4 -0
- package/dist/chunks/{add-new-flow-psym14sn.js → add-new-flow-a1w0bnm6.js} +3 -3
- package/dist/chunks/{cf-account-picker-haqazq5r.js → cf-account-picker-ce3kp3x1.js} +3 -3
- package/dist/chunks/cf-settings-7ye6x7g2.js +4 -0
- package/dist/chunks/color-4gj49xq6.js +4 -0
- package/dist/chunks/{color-area-6rbra5dy.js → color-area-vh9cew51.js} +2 -2
- package/dist/chunks/{color-field-gy56c94g.js → color-field-e78f16bs.js} +3 -3
- package/dist/chunks/{color-slider-sqqdyf6c.js → color-slider-fg4yhvk6.js} +2 -2
- package/dist/chunks/{combobox-72h32ejk.js → combobox-6hs00996.js} +2 -2
- package/dist/chunks/components-qce0v93f.js +4 -0
- package/dist/chunks/content-source-jjx8kgzr.js +4 -0
- package/dist/chunks/{convert-to-repeater-he70fc2b.js → convert-to-repeater-grnmea6c.js} +3 -3
- package/dist/chunks/editor-bkja5dbv.js +4 -0
- package/dist/chunks/entry-commands-1wh0btvg.js +4 -0
- package/dist/chunks/{extension-sections-0egb88dm.js → extension-sections-rp7fkega.js} +3 -3
- package/dist/chunks/file-ops-6pe4z7an.js +4 -0
- package/dist/chunks/files-ybpp3j38.js +4 -0
- package/dist/chunks/format-host-3mtbhxk1.js +4 -0
- package/dist/chunks/fs-events-xfanfxds.js +4 -0
- package/dist/chunks/grid-open-dg5qmnaj.js +4 -0
- package/dist/chunks/{grid-view-qg1b5eqx.js → grid-view-x26rfpz1.js} +16 -15
- package/dist/chunks/{icons-63bjtbs7.js → icons-853n6qt3.js} +2 -2
- package/dist/chunks/{iframe-entry-2zggzajv.js → iframe-entry-02wzcyvy.js} +4 -4
- package/dist/chunks/{iframe-entry-99nr5zfb.js → iframe-entry-42hpmwz5.js} +4 -4
- package/dist/chunks/{iframe-entry-76j8vwwx.js → iframe-entry-b5qgggyp.js} +2 -2
- package/dist/chunks/iframe-host-j2bk2xkc.js +4 -0
- package/dist/chunks/{index-32eqzv1k.js → index-203h71wy.js} +3 -3
- package/dist/chunks/index-fkrm7pdk.js +4 -0
- package/dist/chunks/{javascript-pjp734q4.js → javascript-ww5pv5ae.js} +2 -2
- package/dist/chunks/{jsonMode-njkvsa02.js → jsonMode-vwbdwwq3.js} +6 -6
- package/dist/chunks/jx-validate-w7v32f6a.js +4 -0
- package/dist/chunks/layers-g7j732cm.js +4 -0
- package/dist/chunks/layers-panel-gjrsxcck.js +4 -0
- package/dist/chunks/{listbox-c421cf8c.js → listbox-7gka1h86.js} +2 -2
- package/dist/chunks/lit-html-jdfz9rhc.js +4 -0
- package/dist/chunks/media-library-9j0v4wmk.js +4 -0
- package/dist/chunks/media-picker-cpyyt2m0.js +4 -0
- package/dist/chunks/{menu-bdpzbfvs.js → menu-d2jxpgma.js} +2 -2
- package/dist/chunks/{monaco-binding-vq1hgnn0.js → monaco-binding-63tqze27.js} +3 -3
- package/dist/chunks/monaco-buffer-9wcme176.js +4 -0
- package/dist/chunks/{monaco-setup-xrd2cbkp.js → monaco-setup-zyyynnj8.js} +3 -3
- package/dist/chunks/notify-rahnnnv4.js +4 -0
- package/dist/chunks/platform-b2aqv7v5.js +4 -0
- package/dist/chunks/{popover-b89sfej7.js → popover-9tf4cjrk.js} +2 -2
- package/dist/chunks/publish-panel-4yk2461b.js +4 -0
- package/dist/chunks/{publish-quick-qx2455cj.js → publish-quick-ajzdhhs6.js} +3 -3
- package/dist/chunks/publish-workspace-mxestzcf.js +4 -0
- package/dist/chunks/quick-search-9g6z65b0.js +4 -0
- package/dist/chunks/references-c26enpxs.js +4 -0
- package/dist/chunks/right-panel-9d0e0yg7.js +4 -0
- package/dist/chunks/source-control-xyn3a8ds.js +4 -0
- package/dist/chunks/{split-c9zfdgxf.js → split-m5rwn31z.js} +2 -2
- package/dist/chunks/{studio-x9hsze61.js → studio-02phtmqn.js} +4 -4
- package/dist/chunks/{studio-4hp8pkyt.js → studio-0khd0xdw.js} +4 -4
- package/dist/chunks/studio-1fvzq9vs.js +5 -0
- package/dist/chunks/studio-1gdfsr49.js +12 -0
- package/dist/chunks/{studio-3q40e3rj.js → studio-1meqbxns.js} +4 -4
- package/dist/chunks/{studio-q0tccd43.js → studio-1yhz0s8p.js} +4 -4
- package/dist/chunks/studio-25a5by3h.js +5 -0
- package/dist/chunks/{studio-k3xxbagr.js → studio-2b8443ms.js} +3 -3
- package/dist/chunks/{studio-3qqjeep5.js → studio-2c2mjyzj.js} +5 -5
- package/dist/chunks/studio-2dtc90zs.js +10 -0
- package/dist/chunks/{studio-9tmebf0s.js → studio-332hesdk.js} +4 -4
- package/dist/chunks/{studio-03ct6yfv.js → studio-3pndhat0.js} +8 -8
- package/dist/chunks/{studio-s32578pn.js → studio-3q6n9qvq.js} +4 -4
- package/dist/chunks/studio-4dsdnan2.js +9 -0
- package/dist/chunks/{studio-ed1hp6zf.js → studio-4fjqdzrb.js} +5 -5
- package/dist/chunks/{studio-jcnsdaep.js → studio-533py3yy.js} +4 -4
- package/dist/chunks/studio-5abge3wy.js +5 -0
- package/dist/chunks/{studio-8tr6cfrc.js → studio-6vrxzkba.js} +4 -4
- package/dist/chunks/{studio-jaaz8ce9.js → studio-73wz63nn.js} +4 -4
- package/dist/chunks/{studio-bavb31r0.js → studio-74nzv280.js} +4 -4
- package/dist/chunks/{studio-q7rtx6zq.js → studio-7cg75gtj.js} +7 -7
- package/dist/chunks/studio-89cwmnae.js +5 -0
- package/dist/chunks/studio-8m1t83kn.js +7 -0
- package/dist/chunks/{studio-q0mvbaq6.js → studio-8nyw10dp.js} +4 -4
- package/dist/chunks/{studio-83mk4bgg.js → studio-94ppxeqy.js} +8 -8
- package/dist/chunks/{studio-qmn1xc24.js → studio-957jg8g3.js} +4 -4
- package/dist/chunks/{studio-r5qy30vx.js → studio-9wyqyfqy.js} +4 -4
- package/dist/chunks/studio-a3evp7f6.js +6 -0
- package/dist/chunks/{studio-n0c5h6mf.js → studio-a6x058ew.js} +4 -4
- package/dist/chunks/studio-ana67wax.js +5 -0
- package/dist/chunks/studio-b4xhpcwy.js +4 -0
- package/dist/chunks/studio-bf0rgyf7.js +5 -0
- package/dist/chunks/{studio-x1x167jh.js → studio-bqgs90r8.js} +4 -4
- package/dist/chunks/{studio-qwdqwkj0.js → studio-c4rcaftm.js} +4 -4
- package/dist/chunks/{studio-mn0476ag.js → studio-c5dj3dzk.js} +4 -4
- package/dist/chunks/studio-cgjt1zce.js +5 -0
- package/dist/chunks/{studio-bbe4c90a.js → studio-cpdzrdgp.js} +4 -4
- package/dist/chunks/studio-cq87hree.js +5 -0
- package/dist/chunks/studio-d140sy8e.js +5 -0
- package/dist/chunks/{studio-jsgf2q5k.js → studio-dmn7gpba.js} +5 -5
- package/dist/chunks/studio-e8pzjjhf.js +5 -0
- package/dist/chunks/{studio-dgk4dqtx.js → studio-f8kz3krj.js} +5 -5
- package/dist/chunks/{studio-qgh13jtz.js → studio-fqs1a22a.js} +4 -4
- package/dist/chunks/{studio-syreb644.js → studio-fw3jp9m7.js} +4 -4
- package/dist/chunks/{studio-ed3xx40h.js → studio-g6ysm05p.js} +6 -6
- package/dist/chunks/studio-gmhd0j3f.js +5 -0
- package/dist/chunks/{studio-p4nrkvqr.js → studio-gqpty626.js} +4 -4
- package/dist/chunks/{studio-kt3pjkwd.js → studio-grp684wx.js} +4 -4
- package/dist/chunks/{studio-df0baea9.js → studio-h98520qr.js} +4 -4
- package/dist/chunks/{studio-8m0y2qe7.js → studio-hnx1h1pr.js} +4 -4
- package/dist/chunks/studio-hvxt8z79.js +5 -0
- package/dist/chunks/{studio-43sd2mam.js → studio-hw60n5dh.js} +3 -3
- package/dist/chunks/{studio-wbcjbhy1.js → studio-hxq1ebp0.js} +6 -6
- package/dist/chunks/{studio-wys23mxz.js → studio-j4e627w1.js} +4 -4
- package/dist/chunks/{studio-ccv2svc6.js → studio-j5jqvyn3.js} +4 -4
- package/dist/chunks/{studio-881z1xrx.js → studio-jqrg9xxg.js} +4 -4
- package/dist/chunks/{studio-b7y5mr30.js → studio-kdseew9m.js} +4 -4
- package/dist/chunks/studio-kt2j51sa.js +5 -0
- package/dist/chunks/{studio-d5grtb9e.js → studio-m4w6sygj.js} +9 -9
- package/dist/chunks/{studio-zz9qe3rw.js → studio-mmqr9awv.js} +37 -37
- package/dist/chunks/{studio-5g0rprdt.js → studio-nm9qev4p.js} +5 -5
- package/dist/chunks/{studio-tft6r105.js → studio-nsv7g1qn.js} +4 -4
- package/dist/chunks/{studio-3e54qh39.js → studio-p89w12s2.js} +5 -5
- package/dist/chunks/{studio-y3ahhdpx.js → studio-pbagym4j.js} +4 -4
- package/dist/chunks/{studio-w4rz9hdk.js → studio-pr23qhrw.js} +4 -4
- package/dist/chunks/{studio-6m380wp7.js → studio-r4ya3sb2.js} +4 -4
- package/dist/chunks/studio-rdnezzkd.js +6 -0
- package/dist/chunks/{studio-f14e1zdj.js → studio-rm9m3z60.js} +4 -4
- package/dist/chunks/studio-tpmnbgmt.js +5 -0
- package/dist/chunks/studio-ttxhq5yt.js +5 -0
- package/dist/chunks/{studio-nh6d342n.js → studio-txkx6586.js} +6 -6
- package/dist/chunks/{studio-a2bvaptz.js → studio-v0gsjav0.js} +4 -4
- package/dist/chunks/{studio-fbhxxc5f.js → studio-v2ek69cb.js} +4 -4
- package/dist/chunks/{studio-y0n7yxea.js → studio-wcakp5bt.js} +7 -7
- package/dist/chunks/{studio-k7evxqh4.js → studio-x3ge4rts.js} +4 -4
- package/dist/chunks/{studio-pbxa5fpc.js → studio-xddgbwhe.js} +3 -3
- package/dist/chunks/{studio-c05wdnt3.js → studio-y1x65h5r.js} +4 -4
- package/dist/chunks/{studio-rthyg42z.js → studio-z42kysg7.js} +169 -169
- package/dist/chunks/studio-zf188hnd.js +5 -0
- package/dist/chunks/{studio-tfkznv39.js → studio-zht0x0v3.js} +4 -4
- package/dist/chunks/{studio-svb7yyve.js → studio-zm7dnr9g.js} +4 -4
- package/dist/chunks/{tooltip-yypz28gq.js → tooltip-dj1pvgz7.js} +2 -2
- package/dist/chunks/{tree-9xa4hm7n.js → tree-j0ebwr5s.js} +2 -2
- package/dist/chunks/{tsMode-epyfz1hv.js → tsMode-vra2hh7y.js} +5 -5
- package/dist/chunks/workspace-3nt93k48.js +4 -0
- package/dist/chunks/workspace-home-zbgyqqws.js +4 -0
- package/dist/chunks/{ws-client-bv552sfx.js → ws-client-72x5n99j.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +75 -75
- package/dist/studio.js +80 -80
- package/package.json +11 -11
- package/src/browse/component-examples.ts +15 -224
- package/src/browse/library-preview.ts +6 -13
- package/src/browse/preview-root.ts +7 -4
- package/src/canvas/canvas-utils.ts +18 -4
- package/src/canvas/iframe-editable-root.ts +13 -4
- package/src/canvas/iframe-entry.ts +3 -1
- package/src/canvas/iframe-interaction.ts +11 -2
- package/src/canvas/iframe-render.ts +25 -3
- package/src/canvas/preview-placeholder.ts +120 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/panels/component-preview.ts +5 -0
- package/src/panels/pane-context.ts +43 -18
- package/src/panels/site-model.ts +7 -19
- package/src/panels/site-panel.ts +2 -25
- package/src/panels/stylebook-doc.ts +2 -53
- package/src/services/references.ts +0 -0
- package/src/style/stylebook-specimens.ts +11 -15
- package/src/surfaces/pane-context.json +286 -265
- package/src/surfaces/pane-context.ts +17 -8
- package/src/tabs/tab.ts +5 -6
- package/src/utils/geometry.ts +49 -2
- package/dist/chunks/adapter-5tphg7xe.js +0 -4
- package/dist/chunks/cf-settings-h2wrh6hq.js +0 -4
- package/dist/chunks/color-m7r1vk54.js +0 -4
- package/dist/chunks/components-r22xca09.js +0 -4
- package/dist/chunks/content-source-mmppmcyg.js +0 -4
- package/dist/chunks/editor-ccd9jwsa.js +0 -4
- package/dist/chunks/entry-commands-6qxz9e8p.js +0 -4
- package/dist/chunks/file-ops-qnab36ek.js +0 -4
- package/dist/chunks/files-rcn56qvm.js +0 -4
- package/dist/chunks/format-host-yxz0kjjs.js +0 -4
- package/dist/chunks/fs-events-d1qxq4z4.js +0 -4
- package/dist/chunks/grid-open-4z1g062t.js +0 -4
- package/dist/chunks/iframe-host-ssv7kyj0.js +0 -4
- package/dist/chunks/index-f0jn7nnp.js +0 -4
- package/dist/chunks/jx-validate-ttasrbh7.js +0 -4
- package/dist/chunks/layers-bgyr11tr.js +0 -4
- package/dist/chunks/layers-panel-7ez66zeq.js +0 -4
- package/dist/chunks/lit-html-v9gh687x.js +0 -4
- package/dist/chunks/media-library-sq468wts.js +0 -4
- package/dist/chunks/media-picker-shfe59pt.js +0 -4
- package/dist/chunks/monaco-buffer-3afgwvbp.js +0 -4
- package/dist/chunks/notify-kzrjr3fv.js +0 -4
- package/dist/chunks/platform-7v4rtd7m.js +0 -4
- package/dist/chunks/publish-panel-2z9gw8ee.js +0 -4
- package/dist/chunks/publish-workspace-wrc1dgwx.js +0 -4
- package/dist/chunks/quick-search-n0t0eqxb.js +0 -4
- package/dist/chunks/references-9547rg5s.js +0 -4
- package/dist/chunks/right-panel-wsgnr9pn.js +0 -4
- package/dist/chunks/source-control-kwktr9y6.js +0 -4
- package/dist/chunks/studio-07rcfje3.js +0 -5
- package/dist/chunks/studio-3exxhz5g.js +0 -5
- package/dist/chunks/studio-3qeh9t0h.js +0 -6
- package/dist/chunks/studio-58xg6j2q.js +0 -9
- package/dist/chunks/studio-80jyh1xh.js +0 -4
- package/dist/chunks/studio-8vcvfs7r.js +0 -6
- package/dist/chunks/studio-fyh0jc96.js +0 -5
- package/dist/chunks/studio-gcxk20n7.js +0 -5
- package/dist/chunks/studio-m8g16bgz.js +0 -5
- package/dist/chunks/studio-mx1smyq0.js +0 -5
- package/dist/chunks/studio-pgmvdv7z.js +0 -7
- package/dist/chunks/studio-ph84avkf.js +0 -5
- package/dist/chunks/studio-rj9eamf8.js +0 -5
- package/dist/chunks/studio-rptgsk96.js +0 -5
- package/dist/chunks/studio-s19tp1xr.js +0 -5
- package/dist/chunks/studio-tf9jryb1.js +0 -10
- package/dist/chunks/studio-txf2kysx.js +0 -5
- package/dist/chunks/studio-v8867ddv.js +0 -12
- package/dist/chunks/studio-vxq7fcvv.js +0 -5
- package/dist/chunks/studio-wc649wss.js +0 -5
- package/dist/chunks/studio-z97c48fk.js +0 -5
- package/dist/chunks/studio-zat62m0c.js +0 -5
- package/dist/chunks/studio-zcd2e7yz.js +0 -5
- package/dist/chunks/workspace-dz7nxfhv.js +0 -4
- package/dist/chunks/workspace-home-xsd7hkjw.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Q}from"./studio-nqxqf8p2.js";import{cI,p,_e}from"./studio-w4rz9hdk.js";import{Ys,on}from"./studio-ph84avkf.js";import{cn}from"./studio-z97c48fk.js";import{Ln,m,u,_i,Bt}from"./studio-c05wdnt3.js";import{g,dr,C}from"./studio-43sd2mam.js";import{Pt,Nt}from"./studio-q7rtx6zq.js";import{Tw}from"./studio-x1x167jh.js";import{h}from"./studio-d5grtb9e.js";import{qe,ft,T,R,Jt,tt,Ko,xi,w$}from"./studio-x9hsze61.js";import{dS}from"./studio-dgk4dqtx.js";import{Us,aN,tl}from"./studio-y0n7yxea.js";import{ci,mm,Ul,bL,yL,Db}from"./studio-rj9eamf8.js";import{KD}from"./studio-s19tp1xr.js";import{VO,x,GO,cr}from"./studio-gcxk20n7.js";import{n,te,S,v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var wt={children:[],tagName:"div"},vt=new Set(["bunfig.json","jsconfig.json","package-lock.json","package.json","tsconfig.json","wrangler.json"]);function ub(t){let e=t.slice(t.lastIndexOf("/")+1);if(vt.has(e)||e.endsWith(".schema.json"))return!1;return t.endsWith(".json")||Boolean(cn(t))}function B(t,e){if(t.startsWith("../")||t.includes("/../"))return`"${t}" is outside this project, so its comparison belongs to the project that owns it.`;if(e==="R")return"A renamed file's comparison needs both paths, and Studio does not model the old name yet.";if(Tw(t))return`"${t}" is an image or media file, and a comparison of one is not text.`;return null}function xt(){return["git-diff"]}function St(t){let e=m.tabs.get(t);if(e)return Bt(t),e;return _i({capabilities:{modes:xt()},document:structuredClone(wt),documentPath:t,id:t,sourceFormat:null})}async function V(t){if(!ub(t))return St(t);let e=await (le("rcn56qvm"),import("./files-rcn56qvm.js"));return await e.openFileInTab(t,{canvasMode:"git-diff"}),[...m.tabs.values()].find((o)=>o.documentPath===t)??null}var W={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubPublish",$description:"Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",tagName:"jx-dialog",$props:{headline:"Create GitHub Repository",confirmLabel:"Create Repository",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-publish"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.','& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Repository name"},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{placeholder:"my-project",value:{$ref:"#/state/name"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description (optional)"},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{placeholder:"A brief description",value:{$ref:"#/state/description"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Visibility"},attributes:{part:"row","data-field":"visibility"},children:[{tagName:"div",$description:'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',attributes:{part:"visibility-row"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{checked:{$ref:"#/state/isPrivate"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setPrivate"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Private repository"}]}]}]}]}]};T("github-publish",W);function q(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(qe,ft("dialog","github-publish")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm({description:a.description,isPrivate:a.isPrivate,name:a.name})},description:"",isPrivate:!0,name:t.name,setDescription:(l)=>{a.description=l},setName:(l)=>{a.name=l},setPrivate:(l)=>{a.isPrivate=l}}),s=null,d=R("github-publish",a,e).then(async(l)=>{s=l;let f=l.root;if(i())return l.dispose(),f;if(await Jt(f),i())return f;return Pt(f),f});return{close(){if(o)return;let l=s?.root;if(l instanceof HTMLElement)Nt(l);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}var j=["Create the repository","Add the remote","Push"];function kt(t){return new Promise((e)=>{let o=!1,r=(a)=>{if(o)return;o=!0,e(a)},i=q({layer:tt("dialog"),name:t,onCancel:()=>{i.close()},onClosed:()=>{r(null)},onConfirm:(a)=>{r({...a,name:a.name||t}),i.close()}})})}async function z({projectName:t}){let e=await dS();if(!e)return!1;let o=await kt(t);if(!o)return!1;let r=Us({source:"Source Control",status:`Creating ${o.name}…`,steps:[...j],title:"Create GitHub repository"});r.step(j[0]);let i;try{i=await fetch("https://api.github.com/user/repos",{body:JSON.stringify({auto_init:!1,description:o.description,name:o.name,private:o.isPrivate}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"})}catch(c){return r.log(Q(c)),r.fail("Could not reach GitHub to create the repository.",{action:"git.createGithubRepository"}),!1}if(!i.ok){let c=await i.json();return r.log(c.errors?.[0]?.message||c.message||`GitHub answered ${i.status}.`),r.fail("Could not create the GitHub repository.",{action:"git.createGithubRepository"}),!1}let a=await i.json();r.log(`Created ${a.html_url}`);let s=p();r.step(j[1]);try{await s.gitAddRemote("origin",a.clone_url)}catch(c){return r.log(Q(c)),r.fail("The repository was created, but the remote could not be added.",{action:"view.setWorkspace",actionArgs:{workspace:"publish"}}),!1}r.step(j[2]);try{await s.gitPush({setUpstream:!0})}catch(c){return r.log(Q(c)),r.fail("The repository was created, but the push failed.",{action:"git.push"}),!1}let{refreshGitStatus:d}=await (le("kwktr9y6"),import("./source-control-kwktr9y6.js"));return await d(),r.done(a.html_url),C.success(`Repository created: ${a.html_url}`,{key:"github.repo"}),!0}var w=[];function jt(){return _e()&&te(p().listProjects)}async function rS(){if(!jt()){w=[];return}try{w=await p().listProjects?.()??[]}catch{w=[]}}function UD(){return w}function X(t){w=t}var K=2,Rt=1e4;class Z extends Error{blockedBy;constructor(t,e){super(t.length===0?`Studio did not report ${K} consecutive quiet frames within ${e}ms`:`Studio was not idle after ${e}ms — blocked by ${t.join("; ")}`);this.name="NotIdleError",this.blockedBy=t}}function Y(){return[{blockers:()=>{let t=GO();return t>0?[`render: ${t} renderer(s) mid-paint`]:[]},name:"render"},{blockers:bL,name:"canvas"},{blockers:()=>{let t=cI();if(t.length===0)return[];return[`platform: ${t.length} in-flight (${[...new Set(t)].join(", ")})`]},name:"platform"},{blockers:w$,name:"overlay"},{blockers:aN,name:"activity"},{blockers:KD,name:"grid"}]}function At(t=Y()){let e=[];for(let o of t)e.push(...o.blockers());return e}function et(t={}){let{frames:e=K,now:o=()=>Date.now(),raf:r=(s)=>{requestAnimationFrame(()=>s())},sources:i=Y(),timeoutMs:a=Rt}=t;return new Promise((s,d)=>{let c=o()+a,l=0,f=!1,J=[],H=()=>{if(f)return;let k=At(i);if(k.length>0)J=k,l=0;else if(l+=1,l>=e){f=!0,s();return}if(o()>=c){f=!0,d(new Z(k.length>0?k:J,a));return}r(H)};r(H)})}var ot=/\.toggle[A-Z]/;function $t(t){return t.replace(/\.toggle([A-Z])/,(e,o)=>`.set${o}`)}function rt(t){return!ot.test(t.id)}var Dt={"file.contextMenu":{disposition:"refused",note:"opening a menu to press an item names a control; the ITEM is the command"},"layers.contextMenu":{disposition:"refused",note:"matched RENDERED TEXT, which R1 of scripts/screenshots/README.md forbids; a row is addressed by its data-jx-path"},"project.showWelcome":{disposition:"refused",note:"cold start is a startup profile (?profile=fresh), not an action"},"settings.setSection":{disposition:"refused",note:`mirrored the section registry's LABELS; say settings.open { section: "contexts" }`},"view.setStatus":{disposition:"refused",note:"the status bar is not staged — if a capture needs a calm shell, the app must BE calm"}},Et=new Map(Object.entries(Dt)),Tt={openSettings:'a user opens Settings — run("settings.open")',select:'a user selects a node — run("selection.set", { path })',setActivity:'a user picks a Navigator panel — run("navigator.showPanel", { panel })',setRightTab:'a user picks an Inspector tab — run("inspector.setTab", { tab })',setStatus:"the status bar reports what the app just did; staging it is the one lie the Remote Rule (studio.md §13.5) names outright",setZoom:'a user zooms — run("canvas.setZoom", { zoom })'},Gt=new Map(Object.entries(Tt));function U(t,e){let o=t[e];if(o===void 0)return[];if(!Array.isArray(o))throw TypeError(`seed argument "${e}" must be an array`);return o}function It(t,e){let o=t[e];if(!S(o))throw TypeError(`seed argument "${e}" must be an object`);return o}function Ut(t,e){let o=t[e];if(o===void 0)return;if(!n(o))throw TypeError(`seed argument "${e}" must be a string`);return o}function Lt(t){return[{boundary:"the assistant's model stream",id:"seed.assistant",run:(e)=>{t.seedAssistantMessages(U(e,"messages"))}},{boundary:"the collaboration websocket (awareness + sync)",id:"seed.collab",run:(e)=>{let o=u.value;if(!o)return;let r=Ln(o);r.status="synced",r.active=!0;let i=[];for(let a of U(e,"peers")){let s={...a.state};s.focusedPath??=o.documentPath,i.push({...a,state:s})}r.peers=i,cr()}},{boundary:"the Cloudflare Pages API",id:"seed.publish",run:(e)=>{let o=Ut(e,"accountId"),r={deployment:It(e,"deployment")};if(o)r.accountId=o;t.seedPublishConnected(r)}},{boundary:"the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",id:"seed.git",run:(e)=>{let{status:o,branches:r,log:i}=e;h.git.status=o??null,h.git.branches=r??null,h.git.logEntries=i??null,h.git.loading=!1,h.git.error=null,cr()}},{boundary:"the platform's recent-projects store (desktop IPC / cloud API)",id:"seed.projectList",run:(e)=>{X(U(e,"projects")),cr()}}]}class L extends Error{id;constructor(t,e){super(`automation refuses "${t}" — ${e}`);this.name="AutomationRefusedError",this.id=t}}function Mt(t){let e=[];for(let o of t.visible()){if(!rt(o))continue;let r=t.disabledReason(o.id),i={enabled:r===void 0,id:o.id,title:o.title};if(o.args)i.args=o.args;if(r!==void 0)i.requires=r;e.push(i)}return e}function Ot(t,e,o){if(o.has(t))return`"${t}" is a seed, not a command — call seed("${t}", …)`;let r=Et.get(t);if(r)return`"${t}" is refused by spec §13.5: ${r.note}`;let i=e.list().filter((a)=>rt(a)).map((a)=>a.id);return`unknown command "${t}" — the registry declares ${i.length} scriptable id(s)`}function Ft(t){let e=new Map(Lt(t).map((r)=>[r.id,r])),o=new Set(e.keys());return{probe:{commands:()=>Mt(t.registry),idle:(r={})=>et(r),pointAt:(r)=>yL(r.path),revealPath:(r)=>Db(r),seeds:()=>[...e.values()].map((r)=>({boundary:r.boundary,id:r.id})),state:()=>t.registry.context()},async run(r,i={}){if(ot.test(r))throw new L(r,`it names a delta against state the caller cannot observe; call "${$t(r)}"`);let{registry:a}=t;if(!a.get(r))throw Error(Ot(r,a,o));await a.run(r,i)},async seed(r,i={}){let a=r.startsWith("seed.")?r.slice(5):r,s=Gt.get(a);if(s)throw new L(r,`a seed stands in for a remote, never for a user: ${s}`);let d=e.get(r.startsWith("seed.")?r:`seed.${r}`);if(!d)throw Error(`unknown seed "${r}" — declared seeds are ${[...e.keys()].join(", ")}`);await d.run(i)}}}function bw(t){return new URLSearchParams(t).get("automation")==="1"}function qD(t){if(!bw(location.search))return!1;return globalThis.__jxAutomation=Ft(t),!0}var nt={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJxsuiteUpdate",$description:"The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",tagName:"jx-dialog",$props:{headline:"Update @jxsuite packages?",confirmLabel:"Update",cancelLabel:"Not now",size:"sm"},attributes:{part:"jxsuite-update"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.','& [part="offer"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="lede"]':{margin:"0"},'& [part="list"]':{$description:"Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",maxHeight:"240px",overflowY:"auto"},'& [part="package"]':{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)"},'& [part="package-name"]':{color:"var(--fg)"},'& [part="package-move"]':{$description:"Tabular figures, so a column of versions does not jitter between rows of different widths.",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"}},children:[{tagName:"div",attributes:{part:"offer"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Newer versions of these packages have been published. Update the project to them?"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package","data-package":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-move"},textContent:"${$map.item.current} → ${$map.item.target}"}]}}]}]}]};T("jxsuite-update",nt);function it(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(qe,ft("dialog","jxsuite-update")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm()},packages:t.packages}),s=null,d=R("jxsuite-update",a,e).then(async(c)=>{s=c;let l=c.root;if(i())return c.dispose(),l;if(await Jt(l),i())return l;return Pt(l),l});return{close(){let c=s?.root;if(c instanceof HTMLElement)Nt(c);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}function vw(t){return t.replace(/^[\^~>=<v\s]+/,"").trim().split(/\s+/)[0]??""}function at(t){if(t.includes(":"))return!1;return/^\d+\.\d+/.test(vw(t))}function st(t){let e=vw(t).split(/[-+]/)[0]??"",[o=0,r=0,i=0]=e.split(".").map((a)=>Math.trunc(Number(a))||0);return[o,r,i]}function Ht(t,e){let o=st(t),r=st(e);for(let i=0;i<3;i++){let a=o[i]??0,s=r[i]??0;if(a!==s)return a<s?-1:1}return 0}function sS(t,e){if(!at(t)||!at(e))return!1;return Ht(e,t)>0}var M="@jxsuite/";async function N(){let t=p();if(!t.packageVersions)return[];let e;try{e=await t.packageVersions()}catch{return[]}let o=[];for(let r of e)if(r.name.startsWith(M)&&sS(r.current,r.latest))o.push({current:r.current,dev:Boolean(r.dev),latest:r.latest,name:r.name});return o}function ct(t,e){let o=e.map((r)=>`${r.name}@${r.latest}`).toSorted().join(",");return`jx:jxsuite-update-dismissed:${t}:${o}`}function Vt(t,e){try{return localStorage.getItem(ct(t,e))==="1"}catch{return!1}}function Wt(t,e){try{localStorage.setItem(ct(t,e),"1")}catch{}}async function O(t){let e=p();if(!e.setPackageVersions||t.length===0)return;let o=tl({status:"Updating @jxsuite packages…",title:"Updating dependencies"});try{let r=await e.setPackageVersions(t.map((i)=>({dev:i.dev,name:i.name,version:`^${i.latest}`})));if(r.ok)o.done(),C.success(`Updated ${t.length} @jxsuite package(s) to their latest versions.`);else o.fail(r.log??"Update failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}}function qt(t){return new Promise((e)=>{let o=!1,r=(d)=>{if(o)return;o=!0,e(d)},i=!1,a=()=>{if(i)return;i=!0,s.close()},s=it({layer:tt("dialog"),onCancel:()=>{a()},onClosed:()=>{r(!1),a()},onConfirm:()=>{r(!0),a()},packages:t.map((d)=>({current:d.current,name:d.name,target:`^${d.latest}`}))})})}async function um(t){if(bw(location.search))return;if(!p().setPackageVersions)return;let o=await N();if(o.length===0||Vt(t,o))return;if(!await qt(o)){Wt(t,o);return}await O(o)}var A=["package.json","bun.lock","bun.lockb"],zt=new Set(["??","U"]),Xt=25;function D(t){if(Array.isArray(t))return t.map((e)=>D(e));if(v(t)){let e={};for(let[o,r]of Object.entries(t).toSorted(([i],[a])=>i<a?-1:1))e[o]=D(r);return e}return t}function lt(t){let e={...t};for(let o of["dependencies","devDependencies"]){let r=e[o];if(!v(r))continue;let i={...r};for(let a of Object.keys(i))if(a.startsWith(M))i[a]="*";e[o]=i}return e}function Kt(t,e){if(t===null||e===null)return!1;let o,r;try{o=JSON.parse(t),r=JSON.parse(e)}catch{return!1}if(!v(o)||!v(r))return!1;return JSON.stringify(D(lt(o)))===JSON.stringify(D(lt(r)))}async function E(t,e){try{return await p().gitShow({path:t,ref:e})}catch{return null}}async function pt(t){try{return await p().readFile(t)}catch{return null}}async function dt(t){let e=[],o=[],r=!0;for(let i of A){let a=t.files.filter((c)=>c.path===i);if(a.length===0)continue;let s=await E(i,"@{u}");if(a.every((c)=>zt.has(c.status))){if(s!==null)o.push(i);continue}let d=await E(i,"HEAD");if(s===null||s===d)continue;if(e.push(i),i==="package.json")r&&=Kt(d,await pt(i))}return{automated:r,discard:e,removeUntracked:o}}function mt(t){return t.discard.length===0&&t.removeUntracked.length===0}async function Zt(t){let e=[...new Set(t.files.filter((o)=>!A.includes(o.path)).map((o)=>o.path))];if(e.length>Xt)return!0;for(let o of e){let r=await E(o,"@{u}");if(r!==null&&r!==await E(o,"HEAD"))return!0}return!1}async function Qt(t){let e=p();if(t.discard.length>0)await e.gitUnstage(t.discard),await e.gitDiscard(t.discard);for(let o of t.removeUntracked)await e.deleteFile(o)}async function F(){let t=p(),e=[];try{e=await N()}catch{e=[]}if(e.length>0&&t.setPackageVersions){await O(e);return}if(!t.installDependencies)return;let o=tl({status:"Running bun install…",title:"Syncing dependencies"});try{let r=await t.installDependencies();if(r.ok)o.done();else o.fail(r.log??"bun install failed")}catch(r){o.fail(Q(r))}}async function gt(t){let e=p();try{await Qt(t)}catch(o){throw Error(`Could not reset local package files: ${Q(o)}`,{cause:o})}try{await e.gitPull()}catch(o){throw await F(),o}C.warn("Local package updates were superseded by pulled changes.",{source:"Source Control"}),await F()}async function Yt(t){let e=p(),o;try{o=await e.gitStatus()}catch{throw t}if(!(o.behind>0))throw t;let r=await dt(o);if(mt(r)||await Zt(o))throw t;if(!r.automated){if(!await Ko("Discard local package changes?","package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?",{confirmLabel:"Discard and pull",destructive:!0}))throw t}await gt(r)}async function ut(){let t;try{let e=await p().listDirectory("");t=new Set(e.filter((o)=>o.type==="file").map((o)=>o.name))}catch{t=new Set(A)}return Promise.all(A.map((e)=>t.has(e)?pt(e):Promise.resolve(null)))}async function _(){let t=p(),e=await ut(),o=null;try{await t.gitFetch(),o=await t.gitStatus()}catch{o=null}if(o&&o.behind>0){let i=await dt(o);if(!mt(i)&&i.automated){await gt(i);return}}try{await t.gitPull()}catch(i){await Yt(i);return}let r=await ut();if(e.some((i,a)=>i!==r[a]))await F()}async function hm(){let t=p();try{let e=await t.gitStatus();if(!e.isRepo||!Array.isArray(e.remotes)||e.remotes.length===0)return}catch{return}C.info("Syncing project…",{key:"project.sync",source:"Source Control"});try{await _()}catch(e){C.warn("The project could not be synced with its remote.",{detail:Q(e),key:"project.sync",source:"Source Control",tier:"problem"})}}async function ee(){let t=p(),{git:e}=h,o;try{o=await t.gitStatus()}catch(r){e.error=Q(r);return}if(e.status=o,!o.isRepo){e.branches=null;return}try{e.branches=await t.gitBranches()}catch(r){e.error=Q(r)}}async function Vs(){if(!x)return;let{git:t}=h;t.loading=!0,t.error=null;try{if(await ee(),t.lastUpdated=dr(),t.rev+=1,await oe(),t.logEntries!==null)await aS()}catch(e){t.error=Q(e)}finally{t.loading=!1}}async function oe(){let t=h.git.diffState;if(!t)return;let e=h.git.status?.files.find((o)=>o.path===t.filePath);if(!e||!ht(e.status)){h.git.diffState=null;return}try{h.git.diffState=await I(t.filePath,e.status)}catch{}}async function rT(t){if(h.git.rev+=1,!h.git.loading)Vs();let e=h.git.diffState;if(!t||e?.filePath!==t)return;try{h.git.diffState=await I(t,e.fileStatus)}catch{}}async function aS(){try{h.git.logEntries=await p().gitLog(30)}catch(t){h.git.error=Q(t)}}async function lS(t){let e=p();if(!e.gitClone){C.warn("Cloning is not supported on this platform.",{source:"Source Control"});return}let o=await xi("Clone Git Repository",{confirmLabel:"Clone",message:"Repository URL",placeholder:"https://github.com/user/repo.git",validate:(r)=>r.trim()?"":"Enter a repository URL."});if(!o)return;try{C.info("Cloning repository…",{key:"git.clone",source:"Source Control"});let r=await e.gitClone(o);if(r.root)C.success("Clone complete.",{key:"git.clone"}),await t.openRecentProject(r.root)}catch(r){C.error("Could not clone the repository.",{detail:Q(r),key:"git.clone",source:"Source Control"})}}function hb(){return _e()&&Boolean(p().gitClone)}function xa(){return _e()&&p().gitHosted===!0}function sT(){return _e()&&te(p().createPullRequest)}var re=new Map([["A","added"],["D","deleted"],["M","modified"],["R","renamed"],["U","untracked"]]);function ne(t){return re.get(t)??"changed"}var ie=new Map([["A","NEW"],["D","DELETED"],["M","EDIT"],["R","RENAMED"],["U","NEW"]]);function aT(t){return ie.get(t)??"EDIT"}var ae=new Set(["M","A","U","D"]);function ht(t){return ae.has(t)}async function I(t,e){let o=p(),r=e!=="A"&&e!=="U",i=e!=="D",[a,s]=await Promise.all([r?o.gitShow({path:t,ref:"HEAD"}):Promise.resolve(""),i?o.readFile(t):Promise.resolve("")]);return{currentContent:s,filePath:t,fileStatus:e,originalContent:a}}async function lT(t,e){try{return await I(t,e)}catch(o){return console.warn("loadDiffForLens:",Q(o)),null}}var G={};function cT(t){G=t}function dT(){G.cloneRepository?.()}function yt(t){return h.git.status?.files.find((e)=>e.path===t)}async function uT(t){let e=yt(t);if(!e)return;let o=ht(e.status)?B(e.path,e.status):`"${e.path}" has no change this view can open.`;if(o){h.git.error=o;return}try{h.git.loading=!0;let r=await I(e.path,e.status);h.git.diffState=r,G.setGitDiffState?.(r);let i=await V(e.path);if(i)G.setCanvasMode?.(i,"git-diff")}catch(r){h.git.error=`Failed to load diff: ${Q(r)}`}finally{h.git.loading=!1}}async function y(t){let e=p();h.git.loading=!0,h.git.error=null;try{return await t(e),await Vs(),!0}catch(o){return h.git.error=Q(o),h.git.loading=!1,!1}}async function se(){try{C.info("Initializing repository…",{key:"git.init"}),await p().gitInit(),C.success("Repository initialized.",{key:"git.init"})}catch(t){C.error("Could not initialize the repository.",{action:"git.init",detail:Q(t),key:"git.init",source:"Source Control"});return}await Vs()}async function ce(){await y((t)=>t.gitPush())}async function hT(){await y((t)=>t.gitFetch())}async function pT(){h.git.loading=!0,h.git.error=null;try{await _(),await Vs()}catch(t){h.git.error=Q(t),h.git.loading=!1}}async function ue(){await z({projectName:x?.name||"my-project"})}async function pe(){if(await dS())C.success("Signed in to GitHub.",{key:"github.auth"})}async function fT(t,e){await y((o)=>e?o.gitStage([t]):o.gitUnstage([t]))}async function mT(t){let e=(h.git.status?.files??[]).filter((o)=>Boolean(o.staged)!==t).map((o)=>o.path);if(e.length===0)return;await y((o)=>t?o.gitStage(e):o.gitUnstage(e))}var b={paths:new Set,root:""};function de(){let t=x?.projectRoot??"";if(b.root!==t)b={paths:new Set,root:t};let e=h.git.status?.files??[],o=new Set(e.map((i)=>i.path));for(let i of b.paths)if(!o.has(i))b.paths.delete(i);let r=e.filter((i)=>!b.paths.has(i.path));for(let i of r)b.paths.add(i.path);return r.filter((i)=>!i.staged).map((i)=>i.path)}async function gT(){if(h.git.loading||!h.git.status?.isRepo)return;let t=de();if(t.length>0)await y((e)=>e.gitStage(t))}async function bT(t){if(yt(t)?.status==="U")return;if(!await Ko("Discard Changes",`Discard changes to ${t}?`,{confirmLabel:"Discard",destructive:!0}))return;await y((o)=>o.gitDiscard([t]))}async function vT(){let{branches:t,status:e}=h.git,o=await xi("New Branch",{confirmLabel:"Create",message:`Branching from ${t?.current||e?.branch||"the current branch"}.`,placeholder:"feature/my-change",validate:(r)=>r.trim()?"":"Enter a branch name."});if(o)await y((r)=>r.gitCreateBranch(o.trim()))}async function yT(t){if(t===h.git.branches?.current)return;if(xa()){if(!await Ko("Switch Branch",`Each branch opens in its own session, so switching to ${t} reloads Studio on that branch.`,{confirmLabel:"Switch and reload"}))return}await y((e)=>e.gitCheckout(t))}function cS(t){let e=t.path.split("/"),o=e.pop()??t.path,r=e.join("/"),i=ne(t.status);return{cannotDiscard:t.status==="U",dir:r,hasDir:r!=="",included:Boolean(t.staged),key:t.path,label:`${t.path}, ${i}`,name:o,path:t.path,status:t.status,statusWord:i}}var bt=[["components","Components"],["layouts","Layouts"],["styles","Styles"]];function me(t){let e=Ul(t);if(e!==null)return e;let[o]=t.split("/");if(o==="pages")return ci;if(bt.some(([r])=>r===o))return`folder:${o}`;return Ys.has(on(t))?"media":"other"}function wT(t){let e=[...mm().map((r)=>[r.key,r.title]),...bt.map(([r,i])=>[`folder:${r}`,i]),["media","Media"],["other","Other"]],o=new Map;for(let r of t){let i=me(r.path);o.set(i,[...o.get(i)??[],r])}return e.flatMap(([r,i])=>{let a=o.get(r);return a?[{files:a.map((s)=>cS(s)),key:r,name:i}]:[]})}function xT(t){return{hash:t.hash.slice(0,7),key:t.hash,message:t.message,meta:`${t.author} · ${yw(t.date)}`}}function yw(t){let e=new Date(t),o=dr()-e.getTime(),r=Math.floor(o/60000);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;return e.toLocaleDateString()}function _T(t){return t?`Last updated ${new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}var P=null;function ST(){if(P)return;P=setInterval(()=>{if(h.workspace==="publish"&&!h.git.loading)Vs()},VO)}function pb(){if(P)clearInterval(P),P=null;b={paths:new Set,root:""}}function fe(){return[{category:"Source Control",id:"git.init",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"an open project that git is not already tracking",when:(t)=>t.project.open,enablement:(t)=>!t.project.isRepo,run:async()=>{await se()},title:"Initialize Repository"},{category:"Source Control",id:"git.createGithubRepository",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ue()},title:"Create GitHub Repository"},{category:"Source Control",id:"git.push",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ce()},title:"Push"},{category:"Source Control",id:"git.signInToGithub",level:"application",menus:["palette"],group:"7_scm",run:async()=>{await pe()},title:"Sign In to GitHub"}]}function CT(t){t.registerAll(fe())}
|
|
2
|
-
export{
|
|
1
|
+
import{Q}from"./studio-nqxqf8p2.js";import{oI,p,_e}from"./studio-pr23qhrw.js";import{Js,nn}from"./studio-gmhd0j3f.js";import{fn}from"./studio-tpmnbgmt.js";import{Tn,m,u,_i,Ht}from"./studio-y1x65h5r.js";import{g,lr,C}from"./studio-hw60n5dh.js";import{Mt,Nt}from"./studio-7cg75gtj.js";import{Sw}from"./studio-bqgs90r8.js";import{h}from"./studio-m4w6sygj.js";import{qe,ft,T,R,Jt,tt,Ko,xi,f$}from"./studio-02phtmqn.js";import{aS}from"./studio-f8kz3krj.js";import{Vs,nN,tl}from"./studio-wcakp5bt.js";import{ci,gm,Vl,uL,pL,$b}from"./studio-5abge3wy.js";import{WD}from"./studio-zf188hnd.js";import{jO,S,zO,ar}from"./studio-ana67wax.js";import{n,te,_,v}from"./studio-kt2j51sa.js";import{le}from"./studio-fqs1a22a.js";var wt={children:[],tagName:"div"},vt=new Set(["bunfig.json","jsconfig.json","package-lock.json","package.json","tsconfig.json","wrangler.json"]);function db(t){let e=t.slice(t.lastIndexOf("/")+1);if(vt.has(e)||e.endsWith(".schema.json"))return!1;return t.endsWith(".json")||Boolean(fn(t))}function B(t,e){if(t.startsWith("../")||t.includes("/../"))return`"${t}" is outside this project, so its comparison belongs to the project that owns it.`;if(e==="R")return"A renamed file's comparison needs both paths, and Studio does not model the old name yet.";if(Sw(t))return`"${t}" is an image or media file, and a comparison of one is not text.`;return null}function xt(){return["git-diff"]}function Pt(t){let e=m.tabs.get(t);if(e)return Ht(t),e;return _i({capabilities:{modes:xt()},document:structuredClone(wt),documentPath:t,id:t,sourceFormat:null})}async function V(t){if(!db(t))return Pt(t);let e=await (le("ybpp3j38"),import("./files-ybpp3j38.js"));return await e.openFileInTab(t,{canvasMode:"git-diff"}),[...m.tabs.values()].find((o)=>o.documentPath===t)??null}var W={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubPublish",$description:"Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",tagName:"jx-dialog",$props:{headline:"Create GitHub Repository",confirmLabel:"Create Repository",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-publish"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.','& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Repository name"},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{placeholder:"my-project",value:{$ref:"#/state/name"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description (optional)"},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{placeholder:"A brief description",value:{$ref:"#/state/description"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Visibility"},attributes:{part:"row","data-field":"visibility"},children:[{tagName:"div",$description:'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',attributes:{part:"visibility-row"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{checked:{$ref:"#/state/isPrivate"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setPrivate"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Private repository"}]}]}]}]}]};T("github-publish",W);function q(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(qe,ft("dialog","github-publish")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm({description:a.description,isPrivate:a.isPrivate,name:a.name})},description:"",isPrivate:!0,name:t.name,setDescription:(l)=>{a.description=l},setName:(l)=>{a.name=l},setPrivate:(l)=>{a.isPrivate=l}}),s=null,d=R("github-publish",a,e).then(async(l)=>{s=l;let f=l.root;if(i())return l.dispose(),f;if(await Jt(f),i())return f;return Mt(f),f});return{close(){if(o)return;let l=s?.root;if(l instanceof HTMLElement)Nt(l);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}var k=["Create the repository","Add the remote","Push"];function Ct(t){return new Promise((e)=>{let o=!1,r=(a)=>{if(o)return;o=!0,e(a)},i=q({layer:tt("dialog"),name:t,onCancel:()=>{i.close()},onClosed:()=>{r(null)},onConfirm:(a)=>{r({...a,name:a.name||t}),i.close()}})})}async function z({projectName:t}){let e=await aS();if(!e)return!1;let o=await Ct(t);if(!o)return!1;let r=Vs({source:"Source Control",status:`Creating ${o.name}…`,steps:[...k],title:"Create GitHub repository"});r.step(k[0]);let i;try{i=await fetch("https://api.github.com/user/repos",{body:JSON.stringify({auto_init:!1,description:o.description,name:o.name,private:o.isPrivate}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"})}catch(c){return r.log(Q(c)),r.fail("Could not reach GitHub to create the repository.",{action:"git.createGithubRepository"}),!1}if(!i.ok){let c=await i.json();return r.log(c.errors?.[0]?.message||c.message||`GitHub answered ${i.status}.`),r.fail("Could not create the GitHub repository.",{action:"git.createGithubRepository"}),!1}let a=await i.json();r.log(`Created ${a.html_url}`);let s=p();r.step(k[1]);try{await s.gitAddRemote("origin",a.clone_url)}catch(c){return r.log(Q(c)),r.fail("The repository was created, but the remote could not be added.",{action:"view.setWorkspace",actionArgs:{workspace:"publish"}}),!1}r.step(k[2]);try{await s.gitPush({setUpstream:!0})}catch(c){return r.log(Q(c)),r.fail("The repository was created, but the push failed.",{action:"git.push"}),!1}let{refreshGitStatus:d}=await (le("xyn3a8ds"),import("./source-control-xyn3a8ds.js"));return await d(),r.done(a.html_url),C.success(`Repository created: ${a.html_url}`,{key:"github.repo"}),!0}var w=[];function kt(){return _e()&&te(p().listProjects)}async function nS(){if(!kt()){w=[];return}try{w=await p().listProjects?.()??[]}catch{w=[]}}function HD(){return w}function X(t){w=t}var K=2,jt=1e4;class Z extends Error{blockedBy;constructor(t,e){super(t.length===0?`Studio did not report ${K} consecutive quiet frames within ${e}ms`:`Studio was not idle after ${e}ms — blocked by ${t.join("; ")}`);this.name="NotIdleError",this.blockedBy=t}}function Y(){return[{blockers:()=>{let t=zO();return t>0?[`render: ${t} renderer(s) mid-paint`]:[]},name:"render"},{blockers:uL,name:"canvas"},{blockers:()=>{let t=oI();if(t.length===0)return[];return[`platform: ${t.length} in-flight (${[...new Set(t)].join(", ")})`]},name:"platform"},{blockers:f$,name:"overlay"},{blockers:nN,name:"activity"},{blockers:WD,name:"grid"}]}function Rt(t=Y()){let e=[];for(let o of t)e.push(...o.blockers());return e}function et(t={}){let{frames:e=K,now:o=()=>Date.now(),raf:r=(s)=>{requestAnimationFrame(()=>s())},sources:i=Y(),timeoutMs:a=jt}=t;return new Promise((s,d)=>{let c=o()+a,l=0,f=!1,J=[],H=()=>{if(f)return;let P=Rt(i);if(P.length>0)J=P,l=0;else if(l+=1,l>=e){f=!0,s();return}if(o()>=c){f=!0,d(new Z(P.length>0?P:J,a));return}r(H)};r(H)})}var ot=/\.toggle[A-Z]/;function At(t){return t.replace(/\.toggle([A-Z])/,(e,o)=>`.set${o}`)}function rt(t){return!ot.test(t.id)}var $t={"file.contextMenu":{disposition:"refused",note:"opening a menu to press an item names a control; the ITEM is the command"},"layers.contextMenu":{disposition:"refused",note:"matched RENDERED TEXT, which R1 of scripts/screenshots/README.md forbids; a row is addressed by its data-jx-path"},"project.showWelcome":{disposition:"refused",note:"cold start is a startup profile (?profile=fresh), not an action"},"settings.setSection":{disposition:"refused",note:`mirrored the section registry's LABELS; say settings.open { section: "contexts" }`},"view.setStatus":{disposition:"refused",note:"the status bar is not staged — if a capture needs a calm shell, the app must BE calm"}},Dt=new Map(Object.entries($t)),Et={openSettings:'a user opens Settings — run("settings.open")',select:'a user selects a node — run("selection.set", { path })',setActivity:'a user picks a Navigator panel — run("navigator.showPanel", { panel })',setRightTab:'a user picks an Inspector tab — run("inspector.setTab", { tab })',setStatus:"the status bar reports what the app just did; staging it is the one lie the Remote Rule (studio.md §13.5) names outright",setZoom:'a user zooms — run("canvas.setZoom", { zoom })'},Tt=new Map(Object.entries(Et));function I(t,e){let o=t[e];if(o===void 0)return[];if(!Array.isArray(o))throw TypeError(`seed argument "${e}" must be an array`);return o}function Gt(t,e){let o=t[e];if(!_(o))throw TypeError(`seed argument "${e}" must be an object`);return o}function It(t,e){let o=t[e];if(o===void 0)return;if(!n(o))throw TypeError(`seed argument "${e}" must be a string`);return o}function Ut(t){return[{boundary:"the assistant's model stream",id:"seed.assistant",run:(e)=>{t.seedAssistantMessages(I(e,"messages"))}},{boundary:"the collaboration websocket (awareness + sync)",id:"seed.collab",run:(e)=>{let o=u.value;if(!o)return;let r=Tn(o);r.status="synced",r.active=!0;let i=[];for(let a of I(e,"peers")){let s={...a.state};s.focusedPath??=o.documentPath,i.push({...a,state:s})}r.peers=i,ar()}},{boundary:"the Cloudflare Pages API",id:"seed.publish",run:(e)=>{let o=It(e,"accountId"),r={deployment:Gt(e,"deployment")};if(o)r.accountId=o;t.seedPublishConnected(r)}},{boundary:"the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",id:"seed.git",run:(e)=>{let{status:o,branches:r,log:i}=e;h.git.status=o??null,h.git.branches=r??null,h.git.logEntries=i??null,h.git.loading=!1,h.git.error=null,ar()}},{boundary:"the platform's recent-projects store (desktop IPC / cloud API)",id:"seed.projectList",run:(e)=>{X(I(e,"projects")),ar()}}]}class U extends Error{id;constructor(t,e){super(`automation refuses "${t}" — ${e}`);this.name="AutomationRefusedError",this.id=t}}function Lt(t){let e=[];for(let o of t.visible()){if(!rt(o))continue;let r=t.disabledReason(o.id),i={enabled:r===void 0,id:o.id,title:o.title};if(o.args)i.args=o.args;if(r!==void 0)i.requires=r;e.push(i)}return e}function Ot(t,e,o){if(o.has(t))return`"${t}" is a seed, not a command — call seed("${t}", …)`;let r=Dt.get(t);if(r)return`"${t}" is refused by spec §13.5: ${r.note}`;let i=e.list().filter((a)=>rt(a)).map((a)=>a.id);return`unknown command "${t}" — the registry declares ${i.length} scriptable id(s)`}function Ft(t){let e=new Map(Ut(t).map((r)=>[r.id,r])),o=new Set(e.keys());return{probe:{commands:()=>Lt(t.registry),idle:(r={})=>et(r),pointAt:(r)=>pL(r.path),revealPath:(r)=>$b(r),seeds:()=>[...e.values()].map((r)=>({boundary:r.boundary,id:r.id})),state:()=>t.registry.context()},async run(r,i={}){if(ot.test(r))throw new U(r,`it names a delta against state the caller cannot observe; call "${At(r)}"`);let{registry:a}=t;if(!a.get(r))throw Error(Ot(r,a,o));await a.run(r,i)},async seed(r,i={}){let a=r.startsWith("seed.")?r.slice(5):r,s=Tt.get(a);if(s)throw new U(r,`a seed stands in for a remote, never for a user: ${s}`);let d=e.get(r.startsWith("seed.")?r:`seed.${r}`);if(!d)throw Error(`unknown seed "${r}" — declared seeds are ${[...e.keys()].join(", ")}`);await d.run(i)}}}function fw(t){return new URLSearchParams(t).get("automation")==="1"}function BD(t){if(!fw(location.search))return!1;return globalThis.__jxAutomation=Ft(t),!0}var nt={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJxsuiteUpdate",$description:"The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",tagName:"jx-dialog",$props:{headline:"Update @jxsuite packages?",confirmLabel:"Update",cancelLabel:"Not now",size:"sm"},attributes:{part:"jxsuite-update"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.','& [part="offer"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="lede"]':{margin:"0"},'& [part="list"]':{$description:"Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",maxHeight:"240px",overflowY:"auto"},'& [part="package"]':{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)"},'& [part="package-name"]':{color:"var(--fg)"},'& [part="package-move"]':{$description:"Tabular figures, so a column of versions does not jitter between rows of different widths.",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"}},children:[{tagName:"div",attributes:{part:"offer"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Newer versions of these packages have been published. Update the project to them?"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package","data-package":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-move"},textContent:"${$map.item.current} → ${$map.item.target}"}]}}]}]}]};T("jxsuite-update",nt);function it(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(qe,ft("dialog","jxsuite-update")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm()},packages:t.packages}),s=null,d=R("jxsuite-update",a,e).then(async(c)=>{s=c;let l=c.root;if(i())return c.dispose(),l;if(await Jt(l),i())return l;return Mt(l),l});return{close(){let c=s?.root;if(c instanceof HTMLElement)Nt(c);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}function mw(t){return t.replace(/^[\^~>=<v\s]+/,"").trim().split(/\s+/)[0]??""}function at(t){if(t.includes(":"))return!1;return/^\d+\.\d+/.test(mw(t))}function st(t){let e=mw(t).split(/[-+]/)[0]??"",[o=0,r=0,i=0]=e.split(".").map((a)=>Math.trunc(Number(a))||0);return[o,r,i]}function Bt(t,e){let o=st(t),r=st(e);for(let i=0;i<3;i++){let a=o[i]??0,s=r[i]??0;if(a!==s)return a<s?-1:1}return 0}function iS(t,e){if(!at(t)||!at(e))return!1;return Bt(e,t)>0}var L="@jxsuite/";async function M(){let t=p();if(!t.packageVersions)return[];let e;try{e=await t.packageVersions()}catch{return[]}let o=[];for(let r of e)if(r.name.startsWith(L)&&iS(r.current,r.latest))o.push({current:r.current,dev:Boolean(r.dev),latest:r.latest,name:r.name});return o}function ct(t,e){let o=e.map((r)=>`${r.name}@${r.latest}`).toSorted().join(",");return`jx:jxsuite-update-dismissed:${t}:${o}`}function Vt(t,e){try{return localStorage.getItem(ct(t,e))==="1"}catch{return!1}}function Wt(t,e){try{localStorage.setItem(ct(t,e),"1")}catch{}}async function N(t){let e=p();if(!e.setPackageVersions||t.length===0)return;let o=tl({status:"Updating @jxsuite packages…",title:"Updating dependencies"});try{let r=await e.setPackageVersions(t.map((i)=>({dev:i.dev,name:i.name,version:`^${i.latest}`})));if(r.ok)o.done(),C.success(`Updated ${t.length} @jxsuite package(s) to their latest versions.`);else o.fail(r.log??"Update failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}}function qt(t){return new Promise((e)=>{let o=!1,r=(d)=>{if(o)return;o=!0,e(d)},i=!1,a=()=>{if(i)return;i=!0,s.close()},s=it({layer:tt("dialog"),onCancel:()=>{a()},onClosed:()=>{r(!1),a()},onConfirm:()=>{r(!0),a()},packages:t.map((d)=>({current:d.current,name:d.name,target:`^${d.latest}`}))})})}async function hm(t){if(fw(location.search))return;if(!p().setPackageVersions)return;let o=await M();if(o.length===0||Vt(t,o))return;if(!await qt(o)){Wt(t,o);return}await N(o)}var j=["package.json","bun.lock","bun.lockb"],zt=new Set(["??","U"]),Xt=25;function A(t){if(Array.isArray(t))return t.map((e)=>A(e));if(v(t)){let e={};for(let[o,r]of Object.entries(t).toSorted(([i],[a])=>i<a?-1:1))e[o]=A(r);return e}return t}function lt(t){let e={...t};for(let o of["dependencies","devDependencies"]){let r=e[o];if(!v(r))continue;let i={...r};for(let a of Object.keys(i))if(a.startsWith(L))i[a]="*";e[o]=i}return e}function Kt(t,e){if(t===null||e===null)return!1;let o,r;try{o=JSON.parse(t),r=JSON.parse(e)}catch{return!1}if(!v(o)||!v(r))return!1;return JSON.stringify(A(lt(o)))===JSON.stringify(A(lt(r)))}async function D(t,e){try{return await p().gitShow({path:t,ref:e})}catch{return null}}async function pt(t){try{return await p().readFile(t)}catch{return null}}async function dt(t){let e=[],o=[],r=!0;for(let i of j){let a=t.files.filter((c)=>c.path===i);if(a.length===0)continue;let s=await D(i,"@{u}");if(a.every((c)=>zt.has(c.status))){if(s!==null)o.push(i);continue}let d=await D(i,"HEAD");if(s===null||s===d)continue;if(e.push(i),i==="package.json")r&&=Kt(d,await pt(i))}return{automated:r,discard:e,removeUntracked:o}}function mt(t){return t.discard.length===0&&t.removeUntracked.length===0}async function Zt(t){let e=[...new Set(t.files.filter((o)=>!j.includes(o.path)).map((o)=>o.path))];if(e.length>Xt)return!0;for(let o of e){let r=await D(o,"@{u}");if(r!==null&&r!==await D(o,"HEAD"))return!0}return!1}async function Qt(t){let e=p();if(t.discard.length>0)await e.gitUnstage(t.discard),await e.gitDiscard(t.discard);for(let o of t.removeUntracked)await e.deleteFile(o)}async function O(){let t=p(),e=[];try{e=await M()}catch{e=[]}if(e.length>0&&t.setPackageVersions){await N(e);return}if(!t.installDependencies)return;let o=tl({status:"Running bun install…",title:"Syncing dependencies"});try{let r=await t.installDependencies();if(r.ok)o.done();else o.fail(r.log??"bun install failed")}catch(r){o.fail(Q(r))}}async function gt(t){let e=p();try{await Qt(t)}catch(o){throw Error(`Could not reset local package files: ${Q(o)}`,{cause:o})}try{await e.gitPull()}catch(o){throw await O(),o}C.warn("Local package updates were superseded by pulled changes.",{source:"Source Control"}),await O()}async function Yt(t){let e=p(),o;try{o=await e.gitStatus()}catch{throw t}if(!(o.behind>0))throw t;let r=await dt(o);if(mt(r)||await Zt(o))throw t;if(!r.automated){if(!await Ko("Discard local package changes?","package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?",{confirmLabel:"Discard and pull",destructive:!0}))throw t}await gt(r)}async function ut(){let t;try{let e=await p().listDirectory("");t=new Set(e.filter((o)=>o.type==="file").map((o)=>o.name))}catch{t=new Set(j)}return Promise.all(j.map((e)=>t.has(e)?pt(e):Promise.resolve(null)))}async function F(){let t=p(),e=await ut(),o=null;try{await t.gitFetch(),o=await t.gitStatus()}catch{o=null}if(o&&o.behind>0){let i=await dt(o);if(!mt(i)&&i.automated){await gt(i);return}}try{await t.gitPull()}catch(i){await Yt(i);return}let r=await ut();if(e.some((i,a)=>i!==r[a]))await O()}async function pm(){let t=p();try{let e=await t.gitStatus();if(!e.isRepo||!Array.isArray(e.remotes)||e.remotes.length===0)return}catch{return}C.info("Syncing project…",{key:"project.sync",source:"Source Control"});try{await F()}catch(e){C.warn("The project could not be synced with its remote.",{detail:Q(e),key:"project.sync",source:"Source Control",tier:"problem"})}}async function ee(){let t=p(),{git:e}=h,o;try{o=await t.gitStatus()}catch(r){e.error=Q(r);return}if(e.status=o,!o.isRepo){e.branches=null;return}try{e.branches=await t.gitBranches()}catch(r){e.error=Q(r)}}async function Ws(){if(!S)return;let{git:t}=h;t.loading=!0,t.error=null;try{if(await ee(),t.lastUpdated=lr(),t.rev+=1,await oe(),t.logEntries!==null)await oS()}catch(e){t.error=Q(e)}finally{t.loading=!1}}async function oe(){let t=h.git.diffState;if(!t)return;let e=h.git.status?.files.find((o)=>o.path===t.filePath);if(!e||!ht(e.status)){h.git.diffState=null;return}try{h.git.diffState=await G(t.filePath,e.status)}catch{}}async function QE(t){if(h.git.rev+=1,!h.git.loading)Ws();let e=h.git.diffState;if(!t||e?.filePath!==t)return;try{h.git.diffState=await G(t,e.fileStatus)}catch{}}async function oS(){try{h.git.logEntries=await p().gitLog(30)}catch(t){h.git.error=Q(t)}}async function rS(t){let e=p();if(!e.gitClone){C.warn("Cloning is not supported on this platform.",{source:"Source Control"});return}let o=await xi("Clone Git Repository",{confirmLabel:"Clone",message:"Repository URL",placeholder:"https://github.com/user/repo.git",validate:(r)=>r.trim()?"":"Enter a repository URL."});if(!o)return;try{C.info("Cloning repository…",{key:"git.clone",source:"Source Control"});let r=await e.gitClone(o);if(r.root)C.success("Clone complete.",{key:"git.clone"}),await t.openRecentProject(r.root)}catch(r){C.error("Could not clone the repository.",{detail:Q(r),key:"git.clone",source:"Source Control"})}}function ub(){return _e()&&Boolean(p().gitClone)}function wa(){return _e()&&p().gitHosted===!0}function eT(){return _e()&&te(p().createPullRequest)}var re=new Map([["A","added"],["D","deleted"],["M","modified"],["R","renamed"],["U","untracked"]]);function ne(t){return re.get(t)??"changed"}var ie=new Map([["A","NEW"],["D","DELETED"],["M","EDIT"],["R","RENAMED"],["U","NEW"]]);function tT(t){return ie.get(t)??"EDIT"}var ae=new Set(["M","A","U","D"]);function ht(t){return ae.has(t)}async function G(t,e){let o=p(),r=e!=="A"&&e!=="U",i=e!=="D",[a,s]=await Promise.all([r?o.gitShow({path:t,ref:"HEAD"}):Promise.resolve(""),i?o.readFile(t):Promise.resolve("")]);return{currentContent:s,filePath:t,fileStatus:e,originalContent:a}}async function nT(t,e){try{return await G(t,e)}catch(o){return console.warn("loadDiffForLens:",Q(o)),null}}var E={};function iT(t){E=t}function oT(){E.cloneRepository?.()}function yt(t){return h.git.status?.files.find((e)=>e.path===t)}async function rT(t){let e=yt(t);if(!e)return;let o=ht(e.status)?B(e.path,e.status):`"${e.path}" has no change this view can open.`;if(o){h.git.error=o;return}try{h.git.loading=!0;let r=await G(e.path,e.status);h.git.diffState=r,E.setGitDiffState?.(r);let i=await V(e.path);if(i)E.setCanvasMode?.(i,"git-diff")}catch(r){h.git.error=`Failed to load diff: ${Q(r)}`}finally{h.git.loading=!1}}async function y(t){let e=p();h.git.loading=!0,h.git.error=null;try{return await t(e),await Ws(),!0}catch(o){return h.git.error=Q(o),h.git.loading=!1,!1}}async function se(){try{C.info("Initializing repository…",{key:"git.init"}),await p().gitInit(),C.success("Repository initialized.",{key:"git.init"})}catch(t){C.error("Could not initialize the repository.",{action:"git.init",detail:Q(t),key:"git.init",source:"Source Control"});return}await Ws()}async function ce(){await y((t)=>t.gitPush())}async function sT(){await y((t)=>t.gitFetch())}async function aT(){h.git.loading=!0,h.git.error=null;try{await F(),await Ws()}catch(t){h.git.error=Q(t),h.git.loading=!1}}async function ue(){await z({projectName:S?.name||"my-project"})}async function pe(){if(await aS())C.success("Signed in to GitHub.",{key:"github.auth"})}async function lT(t,e){await y((o)=>e?o.gitStage([t]):o.gitUnstage([t]))}async function cT(t){let e=(h.git.status?.files??[]).filter((o)=>Boolean(o.staged)!==t).map((o)=>o.path);if(e.length===0)return;await y((o)=>t?o.gitStage(e):o.gitUnstage(e))}var b={paths:new Set,root:""};function de(){let t=S?.projectRoot??"";if(b.root!==t)b={paths:new Set,root:t};let e=h.git.status?.files??[],o=new Set(e.map((i)=>i.path));for(let i of b.paths)if(!o.has(i))b.paths.delete(i);let r=e.filter((i)=>!b.paths.has(i.path));for(let i of r)b.paths.add(i.path);return r.filter((i)=>!i.staged).map((i)=>i.path)}async function dT(){if(h.git.loading||!h.git.status?.isRepo)return;let t=de();if(t.length>0)await y((e)=>e.gitStage(t))}async function uT(t){if(yt(t)?.status==="U")return;if(!await Ko("Discard Changes",`Discard changes to ${t}?`,{confirmLabel:"Discard",destructive:!0}))return;await y((o)=>o.gitDiscard([t]))}async function hT(){let{branches:t,status:e}=h.git,o=await xi("New Branch",{confirmLabel:"Create",message:`Branching from ${t?.current||e?.branch||"the current branch"}.`,placeholder:"feature/my-change",validate:(r)=>r.trim()?"":"Enter a branch name."});if(o)await y((r)=>r.gitCreateBranch(o.trim()))}async function pT(t){if(t===h.git.branches?.current)return;if(wa()){if(!await Ko("Switch Branch",`Each branch opens in its own session, so switching to ${t} reloads Studio on that branch.`,{confirmLabel:"Switch and reload"}))return}await y((e)=>e.gitCheckout(t))}function sS(t){let e=t.path.split("/"),o=e.pop()??t.path,r=e.join("/"),i=ne(t.status);return{cannotDiscard:t.status==="U",dir:r,hasDir:r!=="",included:Boolean(t.staged),key:t.path,label:`${t.path}, ${i}`,name:o,path:t.path,status:t.status,statusWord:i}}var bt=[["components","Components"],["layouts","Layouts"],["styles","Styles"]];function me(t){let e=Vl(t);if(e!==null)return e;let[o]=t.split("/");if(o==="pages")return ci;if(bt.some(([r])=>r===o))return`folder:${o}`;return Js.has(nn(t))?"media":"other"}function fT(t){let e=[...gm().map((r)=>[r.key,r.title]),...bt.map(([r,i])=>[`folder:${r}`,i]),["media","Media"],["other","Other"]],o=new Map;for(let r of t){let i=me(r.path);o.set(i,[...o.get(i)??[],r])}return e.flatMap(([r,i])=>{let a=o.get(r);return a?[{files:a.map((s)=>sS(s)),key:r,name:i}]:[]})}function mT(t){return{hash:t.hash.slice(0,7),key:t.hash,message:t.message,meta:`${t.author} · ${gw(t.date)}`}}function gw(t){let e=new Date(t),o=lr()-e.getTime(),r=Math.floor(o/60000);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;return e.toLocaleDateString()}function gT(t){return t?`Last updated ${new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}var x=null;function bT(){if(x)return;x=setInterval(()=>{if(h.workspace==="publish"&&!h.git.loading)Ws()},jO)}function hb(){if(x)clearInterval(x),x=null;b={paths:new Set,root:""}}function fe(){return[{category:"Source Control",id:"git.init",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"an open project that git is not already tracking",when:(t)=>t.project.open,enablement:(t)=>!t.project.isRepo,run:async()=>{await se()},title:"Initialize Repository"},{category:"Source Control",id:"git.createGithubRepository",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ue()},title:"Create GitHub Repository"},{category:"Source Control",id:"git.push",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ce()},title:"Push"},{category:"Source Control",id:"git.signInToGithub",level:"application",menus:["palette"],group:"7_scm",run:async()=>{await pe()},title:"Sign In to GitHub"}]}function vT(t){t.registerAll(fe())}
|
|
2
|
+
export{nS,HD,fw,BD,mw,iS,hm,pm,db,Ws,QE,oS,rS,ub,wa,eT,tT,nT,iT,oT,rT,sT,aT,lT,cT,dT,uT,hT,pT,sS,fT,mT,gw,gT,bT,hb,vT};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=73808A3211DCF93A64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-fw3jp9m7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{mt}from"./studio-k3xxbagr.js";import{Q}from"./studio-nqxqf8p2.js";import{ae}from"./studio-q7rtx6zq.js";import{T,R,Tn,rt,xi}from"./studio-x9hsze61.js";import{g,dr,C}from"./studio-43sd2mam.js";import{p,_e}from"./studio-w4rz9hdk.js";import{Ot,$h,ic,tu,Aa,nf,cn,hl}from"./studio-z97c48fk.js";import{Er}from"./studio-fyh0jc96.js";import{hs,Rm}from"./studio-8m0y2qe7.js";import{Vt,Qt,Hi,Am,lv,Jd,Un,ui,m,Ql,ec,tc,_i,q$,Bt,pv,zx}from"./studio-c05wdnt3.js";import{zp,QA,eO,$a}from"./studio-r5qy30vx.js";import{pt,Go,Cr}from"./studio-s32578pn.js";import{Es,tA,ZL,rA,sx,ax}from"./studio-d5grtb9e.js";import{tl}from"./studio-y0n7yxea.js";import{Zn}from"./studio-5g0rprdt.js";import{_a}from"./studio-fbhxxc5f.js";import{Dp}from"./studio-ph84avkf.js";import{Vr,Gs,Ks,Ur}from"./studio-nh6d342n.js";import{bw,um,hm,pb}from"./studio-syreb644.js";import{qc,Ca}from"./studio-3exxhz5g.js";import{tT,oS}from"./studio-bavb31r0.js";import{iN,or,vb,yb}from"./studio-q0tccd43.js";import{Tw,fb}from"./studio-x1x167jh.js";import{Xt}from"./studio-pbxa5fpc.js";import{pw,fw,mw}from"./studio-wys23mxz.js";import{Ac}from"./studio-mx1smyq0.js";import{tS,XE,QE,db}from"./studio-tft6r105.js";import{Ws}from"./studio-tfkznv39.js";import{x,id,wn}from"./studio-gcxk20n7.js";import{n,S}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";async function ab(){if(bw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=tl({status:"Running bun install…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"bun install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function M(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=M(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function Y(e){return Le.some((t)=>e.includes(t))}function He(e){let t=x?.projectConfig?.layout;if(!n(t))return!1;return M(t).toLowerCase()===M(e).toLowerCase()}function K_(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of hl(e)){let r=Aa(o,"parse");if(r&&Aa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...tu().flatMap((e)=>e.extensions)])}function J_(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Un(e))return[];let o=cn(e);if(!(o?Boolean(o.capabilities.parse)&&Y(o.documentKinds):M(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of hl()){let s=Aa(i,"serialize");if(!s||s.name===o?.name||!Y(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function ND(){let e=new Set([".json"]);for(let t of tu()){if(!t.capabilities.serialize||!Y(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var X="jx-studio-recent-projects",ce="jx-studio-recent-files",se=8,We=10,D=[];function A(){if(!_e())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function Ve(){try{let e=localStorage.getItem(X);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Z(){return A()?D:Ve()}function de(e){D=e;let t=A();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(X,JSON.stringify(e))}catch{}}async function AD(){let e=A();if(!e)return;try{D=await e.getRecentProjects()}catch{D=[]}}function dw(){return Z().toSorted((e,t)=>t.timestamp-e.timestamp)}function uw(e,t){let o=Z().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:dr()}),o.length>se)o.length=se;de(o)}function Y_(e){de(Z().filter((t)=>t.root!==e))}function OD(){D=[];let e=A();if(e)e.saveRecentProjects([]);else localStorage.removeItem(X)}function pe(){try{let e=localStorage.getItem(ce);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function MD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function lb(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:dr()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(ce,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function H(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Be(e){let t=e?.$map,o=S(t)&&"item"in t?t.item:void 0;if(!S(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...H(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,u,d)=>{if(i||!(l instanceof HTMLElement))return;let b=qe(u);if(b==="tree"){o.treeHost(l);return}if(b!=="row")return;let v=Be(d);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function zs(e){if(!x)return;try{let t=p(),[o]=await Promise.all([hs(()=>t.listDirectory(e)),QA(e)]);x.dirs.set(e,o)}catch{x.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function cm(){if(!x)return;await zs(".");let e=[];for(let t of x.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),x.expanded.add(t.path||t.name),await zs(t.path||t.name);x.projectDirs=e}async function jE(e){let t=new Set(x?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await cm(),!0}function HE(){return Go(pt.showIgnoredFiles)==="true"}function C2(e){Cr(pt.showIgnoredFiles,e?"true":"")}async function BE(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if($h(),Ot(),ic(e),zp(),Rm(),id({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)tc(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(uw(wn().name,o.root),await hm(),await ab())$h(),await Ot(),ic(e);await cm(),await _a(),await cb(),um(o.root)}}catch{}}async function zE({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject();if(!r)return!1;let{config:a,handle:i}=r;if(q$({document:{children:[],tagName:"div"},id:"initial"}),iN(),$h(),Ot(),ic(o),zp(),Rm(),id({...x,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),tc(i.root,a),await hm(),await ab())$h(),await Ot(),ic(o);return await cm(),await _a(),pb(),ax(),t?.(),uw(wn().name,wn().projectRoot),e(),await cb(),um(wn().projectRoot),!0}catch(o){return C.error("Could not open the project.",{detail:Q(o),source:"Open Project"}),!1}}async function WE(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(o){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:Q(o),source:"Source Control"}),!1}}async function Z_(){await Ot();let e=[...hl("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function k2(){let e=await Z_();if(e)await yi(e)}async function cb(){let e=rA(m.projectRoot),t=ZL(m.projectRoot),o=await Ue(e);return ge?.(t),o}var ge=null;function VE(e){ge=e}async function Ue(e){if(sx(m.projectRoot),e){if(await tA(e,{ensureSecondPane:()=>{ec(ui)},openFile:(o,r)=>yi(o,{focus:!1,paneId:r})})>0)return!0}return await k2(),!1}function Ge(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&Dp(r)?"image":"file"}}var E2=24,f=[],E=null,j=new Map,_=null,we=null;function ne(){for(let e of j.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return E2}function Ke(){for(let[e,t]of j)if(!t.isConnected)j.delete(e),$e(t)}function ve(e){let t=j.get(e);return t?.isConnected===!0?t:null}function U(e){return f.find((t)=>!t.loading&&t.path===e)}function ye(e,t,o,r){let a=wn().dirs.get(e);if(!a){zs(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((u,d)=>{if(u.type==="directory"&&d.type!=="directory")return-1;if(u.type!=="directory"&&d.type==="directory")return 1;return u.name.localeCompare(d.name)}),s=HE()?i:i.filter((u)=>!eO(e,u.path,u.type==="directory")),l=wn().searchQuery.toLowerCase(),c=l?s.filter((u)=>u.type==="directory"||u.name.toLowerCase().includes(l)):s;for(let[u,d]of c.entries()){let v=d.type==="directory"&&wn().expanded.has(d.path);if(o.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:Hi(d.path,r)??void 0,posInSet:u+1,setSize:c.length,type:d.type}),v)ye(d.path,t+1,o,r)}}function be(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function W(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ye(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Qe(){if(E?.isConnected!==!0||k!=="")return;queueMicrotask(h)}function te(){let e=E;if(e===null)return;_=mw(_,e,{count:()=>f.length,onChange:Qe,rowHeight:ne})}function Xe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ge(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Vt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Ze(){if(Ke(),!x){f=[];let l={...H(),view:"none"};return y=l,l}if(!x.isSiteProject&&x.projectRoot==="."){f=[];let l={...H(),view:"welcome"};return y=l,l}let e=wn();f=[];let{i18n:t}=Qt(e.projectConfig??{});ye(".",0,f,t);let o=pw(E,{count:f.length,rowHeight:ne()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&U(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=HE(),s={currentPath:a,dragPath:k,dropPath:O,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:G,rows:r.map((l)=>Xe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function oe(){if(!w||!y)return;y={...y,dragPath:k,dropPath:O,rootDrop:G},w.handle.update(y)}function h(){we?.()}async function et(){let e=wn();e.dirs.clear(),zp(),await zs(".");for(let t of e.expanded)await zs(t);h()}function tt(e){let t=U(e);if(!t)return;if(t.type==="directory"){Fe(e).then(()=>h());return}yi(e)}function ot(e,t){let o=wn();if(U(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}Fe(e).then(()=>h())}function xe(e){if(!x||wn().selectedPath===e)return;wn().selectedPath=e,h()}function nt(e,t){let o=be(e),r;switch(t){case"Home":{r=W(-1,1);break}case"End":{r=W(f.length,-1);break}case"ArrowUp":{r=W(o,-1);break}case"ArrowLeft":{r=Ye(o);break}case"ArrowDown":case"ArrowRight":{r=W(o,1);break}default:return}Pe(r)}function at(e,t){let o=be(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Pe(i);return}}}function Pe(e){let t=f[e];if(!t)return;if(xe(t.path),ve(t.path))return;fw(E,e,ne()),h()}async function Fe(e){let t=wn();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await zs(e)}var I=new Map,V=null,k="",J="",O="",q=!1,G="";function T2(e){return[...e.dataTransfer?.types??[]].includes("Files")}function je(e,t,o){let r=(s)=>{if(!T2(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),PD(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function UE(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return B(o)!==r}function ee(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&UE(r,t)}function F(e,t){let o=t?e:"";if(J===e&&O===o)return;J=e,O=o,Se()}function z(e){if(q===e)return;q=e,Se()}function Se(){G=q&&J===""?"true":"",oe()}async function PD(e,t,o){if((await Ca([...e],{dir:t})).length===0)return;if(t!==".")wn().expanded.add(t);o()}function L2(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=qc(),o.addEventListener("change",()=>{if(o.files?.length)PD(o.files,e,t)}),o.click()}function it(e,t,o){$e(e),j.set(t,e);let r=[Ur({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){k=t,oe()},onDrop(){k="",F("",!1),oe()}}),je(e,o==="directory"?t:B(t),(a)=>{F(a?t:"",a)}),Gs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return ee(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){F(t,ee(a,t,o))},onDragEnter({source:a}){F(t,ee(a,t,o))},onDragLeave(){F("",!1)},onDrop(){F("",!1)}})];I.set(e,Vr(...r))}function $e(e){let t=I.get(e);if(t)t(),I.delete(e)}function st(e){if(V?.element===e)return;Re(),E=e;let t=Gs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&UE(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){z(!0)},onDragLeave(){z(!1)},onDrop(){z(!1)}}),o=Ks({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!UE(s,l))return;let c=s.split("/").pop(),u=l==="."?c:`${l}/${c}`;lt(s,u,h)}});V={cleanup:Vr(t,o,je(e,".",z)),element:e},te()}function Re(){V?.cleanup(),V=null;for(let e of I.values())e();I.clear(),_?.window.destroy(),_=null,E=null,k="",J="",O="",q=!1,G=""}async function lt(e,t,o){let r=p();$a(e,t);try{let a=await r.renameFile(e,t);Er();for(let[l]of m.tabs.entries())if(l===e)zx(e,t,t);else if(l.startsWith(`${e}/`)){let c=t+l.slice(e.length);zx(l,c,c)}let i=B(e),s=B(t);if(await zs(i),s!==i)await zs(s);if(s!==".")wn().expanded.add(s);Te(a,t),o(),FD(`Moved to ${t}`,a,t)}catch(a){C.error(`Could not move ${e}.`,{detail:Q(a),path:e,source:"Files"})}}function B(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function ke(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Jd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Ac(e.path))t.path=e.path;if(J_(e.path).length>0)t.source=e.path;return t}function P(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?P(a.id,a.title,()=>{Tn(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function ut(e){let t=e.type==="directory",o=[];if(t){if(o.push(P("files.newFile","New File…",()=>{Ee(e.path,h)}),P("files.upload","Upload Files…",()=>{L2(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(P("files.pagesGrid","Edit Pages in Grid",()=>{oS()}))}else o.push(P("files.open","Open",()=>{yi(e.path)}));return o.push(...dt(e),P("files.rename","Rename…",()=>{bt(e,h)},{dividerAbove:!0}),P("files.delete","Delete",()=>{xt(e,h)},{destructive:!0})),o}function ft(e,t,o){let r=U(e);if(!r)return;ke();let a=ve(e);N=Xt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:ut({name:r.name,path:r.path,type:r.type})})}var ht=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function gt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Aa(e.ext)?.name??e.ext} (${e.ext})`}]:K_(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:tS}]}function wt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=XE(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??tS}async function $2(e){let{dir:t,format:o,source:r="Files"}=e;await Ot();let a=await hw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:gt(i),l=i===null||s===null?"":wt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},u=(K,Oe)=>db(K,Oe,c),d=l,b={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:u,value:e.suggestedName??"untitled.json"};if(s!==null)b.choice={initial:l,label:"Format",onChange:(K)=>{d=K},options:()=>s};if(e.suggestedName!==void 0)b.placeholder=e.suggestedName;let v=await xi(e.title??"New File",b);if(!v)return null;let L=QE(v,d,o),De=t==="."?L:`${t}/${L}`,re=cn(L),Ne=e.content,Ce=o!==void 0&&d!==tS,Ie=Ne??re?.studio?.newFileTemplate??(re?"":L.toLowerCase().endsWith(".json")?Ce?ht:`{}
|
|
2
|
-
`:"");return
|
|
3
|
-
`),path:o,source:"Files"})}function Te(e,t){for(let o of e.references?.files??[])if(o.path!==t&&m.tabs.has(o.path))
|
|
4
|
-
export{
|
|
1
|
+
import{mt}from"./studio-2b8443ms.js";import{Q}from"./studio-nqxqf8p2.js";import{ae}from"./studio-7cg75gtj.js";import{T,R,En,rt,xi}from"./studio-02phtmqn.js";import{g,lr,C}from"./studio-hw60n5dh.js";import{p,_e}from"./studio-pr23qhrw.js";import{Bt,$h,tc,eu,Aa,of,fn,ul}from"./studio-tpmnbgmt.js";import{Cr}from"./studio-cq87hree.js";import{us,Rm}from"./studio-hnx1h1pr.js";import{Vt,ln,go,Nm,rv,Kd,Vn,ui,m,Zl,Xl,Ql,_i,B$,Ht,dv,jx}from"./studio-y1x65h5r.js";import{zp,KA,JA,La}from"./studio-9wyqyfqy.js";import{pt,Go,_r}from"./studio-3q6n9qvq.js";import{ks,YN,UL,eA,ix,ox}from"./studio-m4w6sygj.js";import{tl}from"./studio-wcakp5bt.js";import{Zn}from"./studio-nm9qev4p.js";import{xa}from"./studio-v2ek69cb.js";import{Dp}from"./studio-gmhd0j3f.js";import{Wr,qs,Gs,Vr}from"./studio-txkx6586.js";import{fw,hm,pm,hb}from"./studio-fw3jp9m7.js";import{Wc,Sa}from"./studio-hvxt8z79.js";import{JE,tS}from"./studio-74nzv280.js";import{XD,Hr,bb,vb}from"./studio-1yhz0s8p.js";import{Sw,pb}from"./studio-bqgs90r8.js";import{Xt}from"./studio-xddgbwhe.js";import{dw,uw,hw}from"./studio-j4e627w1.js";import{Rc}from"./studio-d140sy8e.js";import{X_,qE,GE,cb}from"./studio-nsv7g1qn.js";import{zs}from"./studio-zht0x0v3.js";import{S,ed,wn}from"./studio-ana67wax.js";import{n,_}from"./studio-kt2j51sa.js";import{le}from"./studio-fqs1a22a.js";async function sb(){if(fw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=tl({status:"Running bun install…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"bun install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function L(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=L(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function Y(e){return Le.some((t)=>e.includes(t))}function He(e){let t=S?.projectConfig?.layout;if(!n(t))return!1;return L(t).toLowerCase()===L(e).toLowerCase()}function U_(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of ul(e)){let r=Aa(o,"parse");if(r&&Aa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...eu().flatMap((e)=>e.extensions)])}function q_(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Vn(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&Y(o.documentKinds):L(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of ul()){let s=Aa(i,"serialize");if(!s||s.name===o?.name||!Y(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function LD(){let e=new Set([".json"]);for(let t of eu()){if(!t.capabilities.serialize||!Y(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var X="jx-studio-recent-projects",ce="jx-studio-recent-files",se=8,We=10,E=[];function M(){if(!_e())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function Ve(){try{let e=localStorage.getItem(X);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Z(){return M()?E:Ve()}function de(e){E=e;let t=M();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(X,JSON.stringify(e))}catch{}}async function $D(){let e=M();if(!e)return;try{E=await e.getRecentProjects()}catch{E=[]}}function aw(){return Z().toSorted((e,t)=>t.timestamp-e.timestamp)}function lw(e,t){let o=Z().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:lr()}),o.length>se)o.length=se;de(o)}function G_(e){de(Z().filter((t)=>t.root!==e))}function ID(){E=[];let e=M();if(e)e.saveRecentProjects([]);else localStorage.removeItem(X)}function pe(){try{let e=localStorage.getItem(ce);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function RD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function ab(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:lr()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(ce,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function A(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function qe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Be(e){let t=e?.$map,o=_(t)&&"item"in t?t.item:void 0;if(!_(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...A(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,u,d)=>{if(i||!(l instanceof HTMLElement))return;let b=qe(u);if(b==="tree"){o.treeHost(l);return}if(b!=="row")return;let v=Be(d);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function Bs(e){if(!S)return;try{let t=p(),[o]=await Promise.all([us(()=>t.listDirectory(e)),KA(e)]);S.dirs.set(e,o)}catch{S.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function dm(){if(!S)return;await Bs(".");let e=[];for(let t of S.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),S.expanded.add(t.path||t.name),await Bs(t.path||t.name);S.projectDirs=e}async function NE(e){let t=new Set(S?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await dm(),!0}function AE(){return Go(pt.showIgnoredFiles)==="true"}function y2(e){_r(pt.showIgnoredFiles,e?"true":"")}async function OE(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if($h(),Bt(),tc(e),zp(),Rm(),ed({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)Ql(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(lw(wn().name,o.root),await pm(),await sb())$h(),await Bt(),tc(e);await dm(),await xa(),await lb(),hm(o.root)}}catch{}}async function ME({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject();if(!r)return!1;let{config:a,handle:i}=r;if(B$({document:{children:[],tagName:"div"},id:"initial"}),XD(),$h(),Bt(),tc(o),zp(),Rm(),ed({...S,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),Ql(i.root,a),await pm(),await sb())$h(),await Bt(),tc(o);return await dm(),await xa(),hb(),ox(),t?.(),lw(wn().name,wn().projectRoot),e(),await lb(),hm(wn().projectRoot),!0}catch(o){return C.error("Could not open the project.",{detail:Q(o),source:"Open Project"}),!1}}async function PE(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(o){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:Q(o),source:"Source Control"}),!1}}async function K_(){await Bt();let e=[...ul("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function w2(){let e=await K_();if(e)await yi(e)}async function lb(){let e=eA(m.projectRoot),t=UL(m.projectRoot),o=await Ue(e);return ge?.(t),o}var ge=null;function FE(e){ge=e}async function Ue(e){if(ix(m.projectRoot),e){if(await YN(e,{ensureSecondPane:()=>{Xl(ui)},openFile:(o,r)=>yi(o,{focus:!1,paneId:r})})>0)return!0}return await w2(),!1}function Ge(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&Dp(r)?"image":"file"}}var x2=24,f=[],k=null,F=new Map,z=null,we=null;function ne(){for(let e of F.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return x2}function Ke(){for(let[e,t]of F)if(!t.isConnected)F.delete(e),$e(t)}function ve(e){let t=F.get(e);return t?.isConnected===!0?t:null}function U(e){return f.find((t)=>!t.loading&&t.path===e)}function ye(e,t,o,r){let a=wn().dirs.get(e);if(!a){Bs(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((u,d)=>{if(u.type==="directory"&&d.type!=="directory")return-1;if(u.type!=="directory"&&d.type==="directory")return 1;return u.name.localeCompare(d.name)}),s=AE()?i:i.filter((u)=>!JA(e,u.path,u.type==="directory")),l=wn().searchQuery.toLowerCase(),c=l?s.filter((u)=>u.type==="directory"||u.name.toLowerCase().includes(l)):s;for(let[u,d]of c.entries()){let v=d.type==="directory"&&wn().expanded.has(d.path);if(o.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:go(d.path,r)??void 0,posInSet:u+1,setSize:c.length,type:d.type}),v)ye(d.path,t+1,o,r)}}function be(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function H(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ye(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Qe(){if(k?.isConnected!==!0||j!=="")return;queueMicrotask(h)}function te(){let e=k;if(e===null)return;z=hw(z,e,{count:()=>f.length,onChange:Qe,rowHeight:ne})}function Xe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ge(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Vt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Ze(){if(Ke(),!S){f=[];let l={...A(),view:"none"};return y=l,l}if(!S.isSiteProject&&S.projectRoot==="."){f=[];let l={...A(),view:"welcome"};return y=l,l}let e=wn();f=[];let{i18n:t}=ln(e.projectConfig??{});ye(".",0,f,t);let o=dw(k,{count:f.length,rowHeight:ne()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&U(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=AE(),s={currentPath:a,dragPath:j,dropPath:I,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:G,rows:r.map((l)=>Xe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function oe(){if(!w||!y)return;y={...y,dragPath:j,dropPath:I,rootDrop:G},w.handle.update(y)}function h(){we?.()}async function et(){let e=wn();e.dirs.clear(),zp(),await Bs(".");for(let t of e.expanded)await Bs(t);h()}function tt(e){let t=U(e);if(!t)return;if(t.type==="directory"){Fe(e).then(()=>h());return}yi(e)}function ot(e,t){let o=wn();if(U(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}Fe(e).then(()=>h())}function xe(e){if(!S||wn().selectedPath===e)return;wn().selectedPath=e,h()}function nt(e,t){let o=be(e),r;switch(t){case"Home":{r=H(-1,1);break}case"End":{r=H(f.length,-1);break}case"ArrowUp":{r=H(o,-1);break}case"ArrowLeft":{r=Ye(o);break}case"ArrowDown":case"ArrowRight":{r=H(o,1);break}default:return}Pe(r)}function at(e,t){let o=be(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Pe(i);return}}}function Pe(e){let t=f[e];if(!t)return;if(xe(t.path),ve(t.path))return;uw(k,e,ne()),h()}async function Fe(e){let t=wn();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await Bs(e)}var N=new Map,V=null,j="",J="",I="",q=!1,G="";function _2(e){return[...e.dataTransfer?.types??[]].includes("Files")}function je(e,t,o){let r=(s)=>{if(!_2(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),DD(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function jE(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return B(o)!==r}function ee(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&jE(r,t)}function P(e,t){let o=t?e:"";if(J===e&&I===o)return;J=e,I=o,Se()}function W(e){if(q===e)return;q=e,Se()}function Se(){G=q&&J===""?"true":"",oe()}async function DD(e,t,o){if((await Sa([...e],{dir:t})).length===0)return;if(t!==".")wn().expanded.add(t);o()}function S2(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=Wc(),o.addEventListener("change",()=>{if(o.files?.length)DD(o.files,e,t)}),o.click()}function it(e,t,o){$e(e),F.set(t,e);let r=[Vr({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){j=t,oe()},onDrop(){j="",P("",!1),oe()}}),je(e,o==="directory"?t:B(t),(a)=>{P(a?t:"",a)}),qs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return ee(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){P(t,ee(a,t,o))},onDragEnter({source:a}){P(t,ee(a,t,o))},onDragLeave(){P("",!1)},onDrop(){P("",!1)}})];N.set(e,Wr(...r))}function $e(e){let t=N.get(e);if(t)t(),N.delete(e)}function st(e){if(V?.element===e)return;Re(),k=e;let t=qs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&jE(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){W(!0)},onDragLeave(){W(!1)},onDrop(){W(!1)}}),o=Gs({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!jE(s,l))return;let c=s.split("/").pop(),u=l==="."?c:`${l}/${c}`;lt(s,u,h)}});V={cleanup:Wr(t,o,je(e,".",W)),element:e},te()}function Re(){V?.cleanup(),V=null;for(let e of N.values())e();N.clear(),z?.window.destroy(),z=null,k=null,j="",J="",I="",q=!1,G=""}async function lt(e,t,o){let r=p();La(e,t);try{let a=await r.renameFile(e,t);Cr();for(let[l]of m.tabs.entries())if(l===e)jx(e,t,t);else if(l.startsWith(`${e}/`)){let c=t+l.slice(e.length);jx(l,c,c)}let i=B(e),s=B(t);if(await Bs(i),s!==i)await Bs(s);if(s!==".")wn().expanded.add(s);Te(a,t),o(),ND(`Moved to ${t}`,a,t)}catch(a){C.error(`Could not move ${e}.`,{detail:Q(a),path:e,source:"Files"})}}function B(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var D=null;function ke(){D?.close(),D=null}function ct(e){let t={};if(e.type==="directory"){let o=Kd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Rc(e.path))t.path=e.path;if(q_(e.path).length>0)t.source=e.path;return t}function x(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?x(a.id,a.title,()=>{En(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function ut(e){let t=e.type==="directory",o=[];if(t){if(o.push(x("files.newFile","New File…",()=>{Ee(e.path,h)}),x("files.upload","Upload Files…",()=>{S2(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(x("files.pagesGrid","Edit Pages in Grid",()=>{tS()}))}else o.push(x("files.open","Open",()=>{yi(e.path)}));return o.push(...dt(e),x("files.rename","Rename…",()=>{bt(e,h)},{dividerAbove:!0}),x("files.delete","Delete",()=>{xt(e,h)},{destructive:!0})),o}function ft(e,t,o){let r=U(e);if(!r)return;ke();let a=ve(e);D=Xt({label:"File actions",onClosed:(i)=>{if(D===i)D=null},opener:a,origin:{x:t,y:o},region:"files",rows:ut({name:r.name,path:r.path,type:r.type})})}var ht=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function gt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Aa(e.ext)?.name??e.ext} (${e.ext})`}]:U_(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:X_}]}function wt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=qE(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??X_}async function C2(e){let{dir:t,format:o,source:r="Files"}=e;await Bt();let a=await cw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:gt(i),l=i===null||s===null?"":wt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},u=(K,Oe)=>cb(K,Oe,c),d=l,b={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:u,value:e.suggestedName??"untitled.json"};if(s!==null)b.choice={initial:l,label:"Format",onChange:(K)=>{d=K},options:()=>s};if(e.suggestedName!==void 0)b.placeholder=e.suggestedName;let v=await xi(e.title??"New File",b);if(!v)return null;let O=GE(v,d,o),De=t==="."?O:`${t}/${O}`,re=fn(O),Ne=e.content,Ce=o!==void 0&&d!==X_,Ie=Ne??re?.studio?.newFileTemplate??(re?"":O.toLowerCase().endsWith(".json")?Ce?ht:`{}
|
|
2
|
+
`:"");return J_(De,Ie,{dir:t,source:r})}async function cw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function J_(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");La(e);try{if(await p().writeFile(e,t),await Bs(r),o.quiet!==!0)C.success(`Created ${e}`);return e}catch(a){return C.error(`Could not create ${e}.`,{detail:Q(a),path:e,source:o.source??"Files"}),null}}async function Ee(e,t){await Bt();let o=Kd(e);if(o?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (le("1wh0btvg"),import("./entry-commands-1wh0btvg.js"));i=await s(o.name,{dir:e})}else i=await C2({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function vt(e,t){let o=await vb(t),r={confirmLabel:"Rename",select:"stem",validate:(a)=>a.trim()?"":"Enter a file name.",value:e};if(o!==void 0)r.message=o;return xi("Rename",r)}function yt(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function ND(e,t,o){let r=t.errors??[];if(r.length===0){C.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;C.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
|
|
3
|
+
`),path:o,source:"Files"})}function Te(e,t){for(let o of e.references?.files??[])if(o.path!==t&&m.tabs.has(o.path))um(o.path)}function HE(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function k2(e,t,o){Cr();let r=HE(e),a=HE(t);if(await Bs(r),a!==r)await Bs(a);if(wn().selectedPath===e)wn().selectedPath=t;Te(o,t)}async function bt(e,t){let o=await vt(e.name,e.path);if(!o||o===e.name)return;let r=HE(e.path),a=r==="."?o:`${r}/${o}`;La(e.path,a);try{let s=await p().renameFile(e.path,a);if(m.tabs.has(e.path))jx(e.path,a,a);await k2(e.path,a,s),t(),ND(yt(o,s),s,a)}catch(i){C.error(`Could not rename ${e.name}.`,{detail:Q(i),path:e.path,source:"Files"})}}async function xt(e,t){if(!await bb(e))return;try{let r=p();La(e.path),await r.deleteFile(e.path),Cr();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await Bs(i),wn().selectedPath===e.path)wn().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(r){C.error(`Could not delete ${e.name}.`,{detail:Q(r),path:e.path,source:"Files"})}}function Pt(e,t){let o=t.paneId,r=Zl(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;dv(e,o)}Ht(e,{focus:t.focus!==!1})}async function yi(e,t={}){let o=t.focus!==!1;for(let[a,i]of m.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(Pt(a,t),o)wn().selectedPath=e;return}if(Sw(e)){if(pb(e,t),o)wn().selectedPath=e;ab({name:e.split("/").pop()||e,path:e,root:wn().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await JE(e,t),o)wn().selectedPath=e;ab({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:Q(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await Bt(),!fn(e)&&!e.toLowerCase().endsWith(".json"))throw of(e);return}await Bt();let i,s,l=null,c=fn(e);if(c){let d=await Hr(e,a);({document:i}=d),{frontmatter:s}=d}else if(e.endsWith(".json"))({document:i,layout:l}=ks(a));else throw of(e);if(_i({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)wn().selectedPath=e;ab({name:e.split("/").pop()||e,path:e,root:wn().projectRoot})}catch(a){C.error(`Could not open ${e}.`,{detail:Q(a),path:e,source:"Open File"})}}async function Y_(e,t){await yi(t,{focus:!1,paneId:e,preview:!0})}function BE(e){if(rv(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){um(e);return}}function zE(e){for(let t of e)um(t,{onlyIfChanged:!0})}async function um(e,t={}){for(let[,o]of m.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||rv(e);try{let s=await r.readFile(e);if(!s)return;if(await Bt(),i())return;if(fn(e)){let{document:l,frontmatter:c}=await Hr(e,s);if(i())return;if(t.onlyIfChanged&&zs(l,o.doc.document)&&zs(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=ks(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Nm(c),t.onlyIfChanged&&zs(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){C.error(`Could not reload ${e} after it changed on disk.`,{detail:Q(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function WE(){Zn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>mt,afterRender:(e,t)=>{E2(t,e.rerender)}})}var Ft={activate:tt,contextMenu:ft,expand:ot,move:nt,newFile:()=>{Ee(".",h)},openProject:()=>{rt("project.open",void 0,"Files")},refresh:()=>{et()},rowHost:it,search:(e)=>{wn().searchQuery=e,h()},select:xe,toggleIgnored:()=>{y2(!AE()),h()},treeHost:st,typeahead:at},w=null,y=null;function E2(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,w&&(w.host!==o||!w.handle.connected()))T2();let r=Ze();if(w)w.handle.update(r);else{let a=me(o,r,Ft);w={handle:a,host:o},a.ready.then(te)}queueMicrotask(te)}function T2(){ke(),w?.handle.dispose(),w=null,y=null,Re(),F.clear(),f=[]}
|
|
4
|
+
export{sb,U_,q_,LD,$D,aw,lw,G_,ID,RD,ab,Bs,dm,NE,AE,y2,OE,ME,PE,K_,w2,lb,FE,x2,_2,jE,DD,S2,C2,cw,J_,ND,HE,k2,yi,Y_,BE,zE,um,WE,E2,T2};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=623E85BF130CF4D164756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-g6ysm05p.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p,_e}from"./studio-pr23qhrw.js";import{UO,qO}from"./studio-6vrxzkba.js";import{fh}from"./studio-hnx1h1pr.js";import{ln,sv,av,u}from"./studio-y1x65h5r.js";import{S}from"./studio-ana67wax.js";function i(t){return t.ownerDocument.defaultView?.getComputedStyle(t).display==="contents"}function He(t){let e=t.getBoundingClientRect();if(e.width>0||e.height>0||!t.hasChildNodes()||!i(t))return e;let n=null;for(let r of t.childNodes){let o=null;if(r instanceof Element)o=He(r);else if(r.nodeType===Node.TEXT_NODE){let s=t.ownerDocument.createRange();s.selectNodeContents(r),o=s.getBoundingClientRect()}if(!o||o.width===0&&o.height===0)continue;n=n?{bottom:Math.max(n.bottom,o.bottom),left:Math.min(n.left,o.left),right:Math.max(n.right,o.right),top:Math.min(n.top,o.top)}:{bottom:o.bottom,left:o.left,right:o.right,top:o.top}}return n?new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top):e}function rx(t,e,n=document){return n.elementFromPoint(t,e)}var Ks=new Set([".jpg",".jpeg",".png",".gif",".svg",".webp",".avif",".ico"]),XL=new Set([".mp4",".webm",".mov",".m4v"]),QL=new Set([".mp3",".wav",".ogg",".m4a",".flac"]),Js=new Set([...Ks,...XL,...QL,".pdf",".woff",".woff2",".ttf",".otf"]);function nn(t){let e=t.lastIndexOf(".");return e>0?t.slice(e).toLowerCase():""}function Dp(t){return Ks.has(t.startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`)}function sh(){let t=_e()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function Mb(){let t=_e()?p().canvasUrl:void 0;if(!t)return null;let e=new URL(t,location.href);return e.origin===location.origin?e.searchParams.get("rpcToken"):null}function Fd(t){let e=sh(),n=_e()?p().documentBaseUrl:void 0;if(n){let o=n.endsWith("/")?n:`${n}/`;return new URL(o,`${e}/`).href}let r=t||"";return`${e}/${r?`${r}/`:""}`}function nC(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let e=sh();if((e.startsWith("http:")||e.startsWith("https:"))&&e!==location.origin)return`${e}/${t.replace(/^\.?\//,"")}`;return t}function e$(){return ln(S?.projectConfig??{}).i18n?.locales??[]}function Pb(t,e){let n=e?.space??"site",r=sv(t,S?.projectConfig?.content,e$());if(n==="site"&&!r)return null;let o={documentDir:qO(t??""),lanes:UO,mounts:r?[r]:[],space:n};if(e?.fileBaseUrl!==void 0)o.fileBaseUrl=e.fileBaseUrl;return o}function Uc(t){return Fb(t,u.value?.documentPath)}function Fb(t,e){if(!t)return t;let n=Pb(e,ah()),r=n&&{...n,versions:fh()};return nC(av(t,r)??t)}function ah(){let t={fileBaseUrl:Fd(S?.projectRoot)};if(_e())t.space=p().assetSpace;return t}
|
|
2
|
+
export{He,rx,Ks,XL,QL,Js,nn,Dp,sh,Mb,Fd,nC,e$,Pb,Uc,Fb,ah};
|
|
3
|
+
|
|
4
|
+
//# debugId=B21A20860F5AE38564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-gmhd0j3f.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Z,
|
|
2
|
-
export{$e,oe,
|
|
1
|
+
import{Z,_}from"./studio-kt2j51sa.js";function p(t){return JSON.parse(JSON.stringify(t))}function $e(t){return t===void 0||t===null?t:p(t)}function oe(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function mv(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function gv(t,e){let{op:n}=e;switch(e.op){case"set-key":{let r=oe(t,e.path);if(!r)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);if(e.value===void 0)delete r[e.key];else r[e.key]=$e(e.value);return}case"insert-child":{i(t,e.parentPath).splice(e.index,0,$e(e.node));return}case"remove-child":{i(t,e.parentPath).splice(e.index,1);return}case"set-child":{i(t,e.parentPath).splice(e.index,1,$e(e.node));return}case"move-child":{x(e);let r=i(t,e.fromParentPath),o=i(t,e.toParentPath),[a]=r.splice(e.fromIndex,1);o.splice(e.toIndex,0,a);return}default:break}throw Error(`unknown-doc-op:${n}`)}function i(t,e){let n=oe(t,e);if(n==null)throw TypeError(`doc-op-node-not-found:${e.join("/")}`);return mv(n)}function h(t,e,n,r,o){let a=t.length,m=a<e.length&&t.every((J,b)=>J===e[b]),d=e[a+1];if(!m||e[a]!=="children"||!Z(d))return e;if(o?d<n:d<=n)return e;let c=[...e];return c[a+1]=d+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function u(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function Z$(t,e){let{op:n}=e;switch(e.op){case"set-key":{let r=oe(t,e.path);if(!r)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let o=$e(r[e.key]);return o===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:o}}case"insert-child":{let{length:r}=l(t,e.parentPath);return{index:u(e.index,r),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let r=s(t,e.parentPath,e.index);return{index:e.index,node:r,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let r=s(t,e.parentPath,e.index);return{index:e.index,node:r,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let r=f(t,e.fromParentPath);P(r,e.fromParentPath,e.fromIndex);let o=l(t,e.toParentPath),a=u(e.toIndex,o.length-(o===r?1:0));return{fromIndex:a,fromParentPath:h(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:h(e.toParentPath,e.fromParentPath,a,1,!0)}}default:break}throw Error(`unknown-doc-op:${n}`)}function f(t,e){let n=oe(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function s(t,e,n){let r=f(t,e);return P(r,e,n),$e(r[n])}function l(t,e){let n=oe(t,e);if(!_(n)||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
|
|
2
|
+
export{$e,oe,mv,gv,Z$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=31CE358D47D96AFA64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-gqpty626.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{he,C}from"./studio-
|
|
2
|
-
export{st,
|
|
1
|
+
import{he,C}from"./studio-hw60n5dh.js";import{te,_}from"./studio-kt2j51sa.js";var st={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function OO(){return m+=1,m}var l=new Map;function vo(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function xh(e){return e.wrap}function Gp(){return[...l.values()]}function Qc(e){if(!e)return null;for(let r of l.values())if(xh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function MO(e,r){let t=vo(e);return t.wrap=r,g(t),t}function PO(e){if(l.get(e))W$(e);let t=v(e);return l.set(e,t),t}var S=null;function FO(e){S=e}function W$(e){let r=l.get(e);if(!r)return;S?.(r),g(r),y(e)}function y(e){l.delete(e)}var Kp="commit";function b(e){return _(e)&&te(e.then)}function uv(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!b(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var T={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=T[r],n=t?{detail:h(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return C.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function h(e){return e instanceof Error?e.stack??e.message:String(e)}function hv(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(Kp)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),b(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function V$(e){e?._writes?.cancel()}function Zd(e){return Boolean(e?.getModel())}function Jp(e,r){if(!Zd(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function w(e){let r=he(e);return[...Gp().map((o)=>o.monacoEditor),st.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&he(o._editingTab)===r&&Zd(o))}async function Xd(e){for(let r of w(e)){if(!Zd(r))continue;try{await r._writes?.flush(Kp)}catch(t){let o={detail:h(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;C.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function Yp(e){return w(e).some((r)=>r._writes?.typed()===!0)}
|
|
2
|
+
export{st,OO,vo,xh,Gp,Qc,MO,PO,FO,W$,Kp,uv,hv,V$,Zd,Jp,Xd,Yp};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=57B15817412EC47D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-grp684wx.js.map
|