@jxsuite/studio 10.3.0 → 10.4.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/{add-new-flow-3tkn72ey.js → add-new-flow-v0pm96mr.js} +2 -2
- package/dist/chunks/content-source-g38w0d3f.js +4 -0
- package/dist/chunks/{convert-to-repeater-gwzh9gar.js → convert-to-repeater-r8sfxjjm.js} +2 -2
- package/dist/chunks/entry-commands-t13dyw3c.js +4 -0
- package/dist/chunks/{extension-sections-338ee35t.js → extension-sections-vjzw46xb.js} +2 -2
- package/dist/chunks/file-ops-1sghzgcr.js +4 -0
- package/dist/chunks/{files-t07yqqej.js → files-zrqtgt41.js} +2 -2
- package/dist/chunks/{format-host-5ja5gxyk.js → format-host-9gy76erh.js} +2 -2
- package/dist/chunks/fs-events-45rhg3me.js +4 -0
- package/dist/chunks/grid-open-t4fq6bbm.js +4 -0
- package/dist/chunks/{grid-view-w9nfy203.js → grid-view-2f03wcgw.js} +2 -2
- package/dist/chunks/{iframe-host-wsg0bn73.js → iframe-host-9aq8ze3q.js} +2 -2
- package/dist/chunks/{jx-validate-ttr5ewf0.js → jx-validate-r4ax11e3.js} +2 -2
- package/dist/chunks/layers-panel-zr92pwdp.js +4 -0
- package/dist/chunks/media-library-j74rt0w4.js +4 -0
- package/dist/chunks/{media-open-yp9jm834.js → media-open-mypr0k6b.js} +2 -2
- package/dist/chunks/{media-picker-s41ngdfr.js → media-picker-pemtbsjv.js} +2 -2
- package/dist/chunks/{monaco-setup-g9kterhx.js → monaco-setup-0hw9f835.js} +2 -2
- package/dist/chunks/publish-panel-vg1n880b.js +4 -0
- package/dist/chunks/{publish-quick-w3nxd7q4.js → publish-quick-4fwngwrw.js} +2 -2
- package/dist/chunks/publish-workspace-jv4w2bx2.js +4 -0
- package/dist/chunks/quick-search-nh29rt8a.js +4 -0
- package/dist/chunks/right-panel-3ws9f2w0.js +4 -0
- package/dist/chunks/{source-control-6fk72me2.js → source-control-h3hcs5gy.js} +2 -2
- package/dist/chunks/{studio-jeb7hth3.js → studio-1ctnw3xv.js} +2 -2
- package/dist/chunks/{studio-15hwqgd8.js → studio-1y9mab9m.js} +2 -2
- package/dist/chunks/{studio-s7t4vp1d.js → studio-2e4hry72.js} +3 -3
- package/dist/chunks/{studio-0w3541dg.js → studio-2kpxm0eh.js} +3 -3
- package/dist/chunks/{studio-3c10v2q1.js → studio-2pk7kc7z.js} +2 -2
- package/dist/chunks/{studio-nwynxqtb.js → studio-2x972v58.js} +2 -2
- package/dist/chunks/{studio-fspe7m9t.js → studio-2zz4qbv9.js} +2 -2
- package/dist/chunks/{studio-ggx3j7nd.js → studio-3pz4t5a2.js} +2 -2
- package/dist/chunks/{studio-waekn290.js → studio-4bgvvzhv.js} +2 -2
- package/dist/chunks/{studio-y1b86ast.js → studio-61rg2cz5.js} +2 -2
- package/dist/chunks/{studio-nskxe9q1.js → studio-9gr7xs9r.js} +2 -2
- package/dist/chunks/{studio-wse1rs8t.js → studio-a88ej93p.js} +3 -3
- package/dist/chunks/{studio-zfdbmhp3.js → studio-acer0g8w.js} +2 -2
- package/dist/chunks/{studio-423tfdte.js → studio-amaz545p.js} +2 -2
- package/dist/chunks/{studio-ea6r1zyr.js → studio-az3wvyh2.js} +2 -2
- package/dist/chunks/{studio-5n193zqd.js → studio-bg8pzprg.js} +2 -2
- package/dist/chunks/{studio-bct64zmj.js → studio-bnc50f9h.js} +2 -2
- package/dist/chunks/{studio-3xk9zdgb.js → studio-brh8d2pr.js} +2 -2
- package/dist/chunks/{studio-fkrr7kgg.js → studio-c2fa783p.js} +3 -3
- package/dist/chunks/{studio-yzpskb0j.js → studio-cqxj4fcy.js} +2 -2
- package/dist/chunks/{studio-b4e0ftkt.js → studio-cw11h078.js} +2 -2
- package/dist/chunks/{studio-f8tyeyzt.js → studio-dn56z7sn.js} +3 -3
- package/dist/chunks/{studio-nn4f9m9c.js → studio-evq47j2z.js} +2 -2
- package/dist/chunks/{studio-e7vjyp04.js → studio-frc16j8v.js} +3 -3
- package/dist/chunks/{studio-wfct4h6n.js → studio-gnazwtv3.js} +2 -2
- package/dist/chunks/{studio-thz5t120.js → studio-hfqpfmpk.js} +2 -2
- package/dist/chunks/{studio-fj6c905s.js → studio-j5fcp6gj.js} +2 -2
- package/dist/chunks/{studio-s9fng7m8.js → studio-jd1qb1st.js} +3 -3
- package/dist/chunks/{studio-p2a03pgm.js → studio-jma2q8r9.js} +2 -2
- package/dist/chunks/{studio-yrcrncev.js → studio-knsjyx7n.js} +2 -2
- package/dist/chunks/{studio-8kx6m0rg.js → studio-mrjtnm62.js} +2 -2
- package/dist/chunks/{studio-b68k0z00.js → studio-nwf0c32p.js} +2 -2
- package/dist/chunks/{studio-hfxttkyr.js → studio-pj216fmn.js} +2 -2
- package/dist/chunks/{studio-x0gsfr1d.js → studio-pwctzka3.js} +3 -3
- package/dist/chunks/{studio-aam8zt8z.js → studio-q9hx2qp0.js} +2 -2
- package/dist/chunks/{studio-wgc54sxf.js → studio-qrzmfaf6.js} +2 -2
- package/dist/chunks/{studio-3q7mhbgx.js → studio-r6mx7vm5.js} +2 -2
- package/dist/chunks/{studio-stahswgb.js → studio-rr00ex23.js} +2 -2
- package/dist/chunks/{studio-321ym1tt.js → studio-s24mhq0z.js} +2 -2
- package/dist/chunks/{studio-bz0b5brj.js → studio-tmfcn347.js} +2 -2
- package/dist/chunks/{studio-a65kbs2e.js → studio-v7a7yb5w.js} +2 -2
- package/dist/chunks/{studio-2ggfzrrd.js → studio-wmjmsw0p.js} +3 -3
- package/dist/chunks/studio-xva3hzkv.js +5 -0
- package/dist/chunks/{studio-nf8esxxc.js → studio-xx3r3sb0.js} +2 -2
- package/dist/chunks/{studio-9qx1ywbv.js → studio-z3fztxrp.js} +4 -4
- package/dist/chunks/{studio-r050sez0.js → studio-z9453ypn.js} +2 -2
- package/dist/chunks/{workspace-9btkc8tk.js → workspace-6ztqcrsh.js} +2 -2
- package/dist/chunks/workspace-home-rse9h8a0.js +4 -0
- package/dist/manifest.json +46 -46
- package/dist/studio.js +10 -10
- package/package.json +11 -11
- package/src/surfaces/inspector-dock.json +3 -3
- package/dist/chunks/content-source-1vzxq1ba.js +0 -4
- package/dist/chunks/entry-commands-mx2whrjx.js +0 -4
- package/dist/chunks/file-ops-9bxvk59j.js +0 -4
- package/dist/chunks/fs-events-3424ezp3.js +0 -4
- package/dist/chunks/grid-open-1mpq9mzb.js +0 -4
- package/dist/chunks/layers-panel-hvy2e549.js +0 -4
- package/dist/chunks/media-library-ae67q4at.js +0 -4
- package/dist/chunks/publish-panel-gzfxcm0t.js +0 -4
- package/dist/chunks/publish-workspace-dppd82tc.js +0 -4
- package/dist/chunks/quick-search-tdxaam55.js +0 -4
- package/dist/chunks/right-panel-0yrw4cgz.js +0 -4
- package/dist/chunks/studio-53wy9ek3.js +0 -5
- package/dist/chunks/workspace-home-qcc4z5ag.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{ae}from"./studio-wqfaqw4m.js";import{p}from"./studio-4fnb5648.js";import{cs}from"./studio-xpx91fby.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt}from"./studio-tpxcryf2.js";import{Zl,sA,Hb,RL,aA,Ri,jd}from"./studio-stahswgb.js";import{hb,AE}from"./studio-k1xqrgm5.js";import{C}from"./studio-4f7thq0p.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{Q}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";function Bl(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var w={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};E("publish",w);var D="https://github.com/apps/cloudflare-pages/installations/new";function I(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function j(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:I(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:D,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function k(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",m=!1,N=()=>{if(m)return;m=!0,e.onClosed()},P=()=>m,d=g({...j(e.view),closed:N,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{n="",e.onReplaceToken()},setAccount:(o)=>{d.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{d.branch=o,e.onField("branch",o)},setOwner:(o)=>{d.owner=o,e.onField("owner",o)},setProjectName:(o)=>{d.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{d.repo=o,e.onField("repo",o)},setToken:(o)=>{n=o},submit:()=>{e.onSubmit()},verify:()=>{let o=n;n="",e.onSaveToken(o)}}),y=null,A=R("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(P())return o.dispose(),u;if(await sn(u),P())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(Ve,vt("modal","publish")),Jt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Ut(o);y?.dispose(),y=null,n="",t.remove(),N()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return C?.projectConfig??null}function T(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function O(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function H(){let e=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Bl(e)??""}function L(){let e=Ri();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=Zl(),t=i==="loading"?null:i;return{accounts:h.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&Q(p().cfConnect),lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:b,supported:e,tokenStored:hb()!==""}}function s(){if(f){f.update(S());return}f=k({layer:dt("modal"),onClosed:B,onConnect:()=>{M()},onDisconnect:()=>{z()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:_,onRefresh:()=>{v()},onReplaceToken:()=>{b=!0,r="",s()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{V()},view:S()})}async function v(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){h=await sA(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ri();if(e)l=await Hb(e),jd(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function U(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}AE(t),b=!1,r="",await v()}function _(){ae()?.run("app.preferences",{section:"accounts"})}async function M(){c=!0,r="",s();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")r="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (ce("xb8vvt2h"),import("./cf-account-picker-xb8vvt2h.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,cs(),await v()}async function V(){let e=x();if(!e)return;if(!a.projectName||!a.owner||!a.repo||!a.accountId){r="Account, project name, and the GitHub owner/repo are all required.",s();return}c=!0,r="",s();try{let t=H(),n={accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo};if(t)n.rootDir=t;let m=await aA(e,n);l=await Hb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=x();if(!e)return;c=!0,s();try{await RL(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function B(){let e=f;f=null,e?.close()}function NE(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,jd(e.deployment),r="",c=!1,b=!1,s()}function cF(){let e=x(),{owner:t,repo:n}=O();i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:t,projectName:Ri()?.projectName??T(e?.name??""),repo:n},s(),v()}
|
|
1
|
+
import{ae}from"./studio-wqfaqw4m.js";import{p}from"./studio-4fnb5648.js";import{cs}from"./studio-xpx91fby.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt}from"./studio-tpxcryf2.js";import{Zl,sA,Hb,RL,aA,Ri,jd}from"./studio-rr00ex23.js";import{hb,AE}from"./studio-k1xqrgm5.js";import{C}from"./studio-4f7thq0p.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{Q}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";function Bl(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var w={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPublish",$description:"Publish: the one-click Cloudflare Pages flow, as a `jx-dialog` over the kit. Eight bodies, one at a time, because the reader is at exactly one point of a chain — a host that cannot reach Cloudflare at all, a question still in flight, a connection that lapsed, an invitation to connect, a stored token Cloudflare refused, a field to paste a replacement into, the create-and-connect form, and the connected status. `publish/publish-panel.ts` keeps every one of those decisions and the calls that settle them; this document knows only which of the eight it was told to draw. **The token is never painted.** The field below binds no `value` — it is written by the reader and read once, on its way to storage — so a stored secret cannot reach the attribute, the serialised HTML or the accessibility tree, which is `studio.md` §15 rule 1 written as a missing binding rather than as a rule somebody remembers.",tagName:"jx-dialog",$props:{headline:"Publish",confirmLabel:"",cancelLabel:"Close",size:"md"},attributes:{part:"publish"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What the five `.publish-*` names carried, keyed on `part`, and most of them do not survive the move. `.publish-modal` and its `.new-project-modal` base were a fixed card, a scroll body, a border, a shadow and a `z-index: 1000` — a modal `<dialog>` is every one of those, and the top layer is what the z-index was climbing towards. `.publish-field` was a label stacked over a control, which is `jx-field`'s whole shape. What is left is the column gap between bodies, the two button rows, the hint and the refusal. Nothing here uses `--spectrum-*`: those custom properties resolve only inside `<sp-theme>`, and a document mounted in a layer host is outside it, so each would silently have taken its hard-coded fallback.",'& [part="body"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="note"], & [part="status-line"], & [part="deployment"]':{margin:"0",lineHeight:"1.5"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="actions"]':{$description:'Wraps rather than overflows (studio-ui-guidelines.md §4.6): two buttons whose labels are whole phrases — "Verify & Connect", "Preferences › Accounts" — are wider than a narrow dialog at the sizes a reader may have set.',display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)"},'& [part="submit"]':{alignSelf:"flex-start"},'& [part="hint"]':{$description:"Publishing rides every commit, so the connected body's only job is to say what is already happening. Dim, because it is a standing fact rather than something to act on.",margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="failure"]':{$description:'`failure` and not `error`: `jx-textfield` and `jx-select` each draw a `[part="error"]` of their own inside this same tree, and the kit is light DOM — a scoped rule on that name would restyle the token field\'s refusal line too.',margin:"0",color:"var(--danger)",lineHeight:"1.5"},'& [part="link"], & [part="install-link"]':{color:"var(--accent)",textDecoration:"underline"},"& code":{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{unsupported:{tagName:"p",attributes:{part:"note"},children:["This platform cannot reach the Cloudflare API. Publish by committing and pushing — your host builds ",{tagName:"code",textContent:"bunx jx build"}," and serves ",{tagName:"code",textContent:"dist/"},"."]},loading:{tagName:"p",attributes:{part:"note"},textContent:"Checking Cloudflare connection…"},lapsed:{tagName:"div",attributes:{part:"lapsed",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Your Cloudflare connection has expired, so publishing cannot reach your account. Reconnect to restore it — this site's Pages project and its settings are untouched."},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"reconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"${state.connectLabel}"}]}]},hosted:{tagName:"div",attributes:{part:"hosted",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Connect your Cloudflare account to publish this site."},{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"connect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/connect"},value:[]}]},children:[{tagName:"span",textContent:"Connect Cloudflare"}]}]},stored:{tagName:"div",attributes:{part:"stored",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"A Cloudflare API token is stored on this machine, and Cloudflare did not accept it. It may have been revoked, or it may be missing the Account Settings Read and Pages Read/Write permissions."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"replace"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[]}]},children:[{tagName:"span",textContent:"Replace token"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},token:{tagName:"div",attributes:{part:"token-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},textContent:"Paste a Cloudflare API token (permissions: Account Settings Read, Pages Read/Write). It is stored on this machine and only sent to the same-origin proxy — Studio never renders it back."},{tagName:"jx-field",$props:{span:!0,label:"API token"},attributes:{part:"token-row","data-field":"token"},children:[{tagName:"jx-textfield",$description:"No `value` binding, and its absence is the contract: a secret may pass through a field the reader typed it into and may never be painted into one they did not. The draft lives in the adapter's closure until Verify reads it, so nothing here — not the attribute, not the accessibility tree, not a DOM dump — has ever held it.",$props:{type:"password",placeholder:"cf_..."},attributes:{part:"token"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setToken"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"verify"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/verify"},value:[]}]},children:[{tagName:"span",textContent:"Verify & Connect"}]},{tagName:"jx-button",$props:{quiet:!0},attributes:{part:"accounts"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAccounts"},value:[]}]},children:[{tagName:"span",textContent:"Preferences › Accounts"}]}]}]},form:{tagName:"div",attributes:{part:"connect-form",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"note"},children:["Create a Cloudflare Pages project connected to this repository. Every commit then builds and publishes automatically (",{tagName:"code",textContent:"bunx jx build"},")."]},{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Account"},attributes:{part:"row","data-field":"account"},children:[{tagName:"jx-select",$props:{options:{$ref:"#/state/accountOptions"},value:{$ref:"#/state/accountId"}},attributes:{part:"account"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setAccount"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Pages project name"},attributes:{part:"row","data-field":"projectName"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/projectName"}},attributes:{part:"project-name"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setProjectName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub owner"},attributes:{part:"row","data-field":"owner"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/owner"}},attributes:{part:"owner"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setOwner"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"GitHub repository"},attributes:{part:"row","data-field":"repo"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/repo"}},attributes:{part:"repo"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRepo"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Production branch"},attributes:{part:"row","data-field":"branch"},children:[{tagName:"jx-textfield",$props:{value:{$ref:"#/state/branch"}},attributes:{part:"branch"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setBranch"},value:[{$ref:"event#/target/value"}]}]}}]}]},{tagName:"jx-button",$props:{variant:"accent",disabled:{$ref:"#/state/busy"}},attributes:{part:"submit"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/submit"},value:[]}]},children:[{tagName:"span",textContent:"${state.submitLabel}"}]}]},status:{tagName:"div",attributes:{part:"status",role:"none"},style:{display:"contents"},children:[{tagName:"p",attributes:{part:"status-line"},children:["Connected to Pages project ",{tagName:"strong",attributes:{part:"project-name"},textContent:"${state.deployProject}"},{tagName:"span",attributes:{part:"site-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProductionUrl"},cases:{true:{tagName:"span",children:[" — ",{tagName:"a",attributes:{part:"link",href:"${state.productionUrl}",target:"_blank",rel:"noreferrer"},textContent:"${state.productionUrl}"}]}}}]},{tagName:"div",attributes:{part:"deployment-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasDeployment"},cases:{true:{tagName:"p",attributes:{part:"deployment"},children:["Latest deployment: ",{tagName:"strong",attributes:{part:"deployment-state"},textContent:"${state.deploymentState}"}," (${state.deploymentEnvironment}) — ",{tagName:"a",attributes:{part:"link",href:"${state.deploymentUrl}",target:"_blank",rel:"noreferrer"},textContent:"preview"}]},false:{tagName:"p",attributes:{part:"deployment"},textContent:"No deployments yet — the first commit after connecting triggers one."}}},{tagName:"p",attributes:{part:"hint"},textContent:"Publishing happens automatically on every commit."},{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{disabled:{$ref:"#/state/busy"}},attributes:{part:"refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}]},children:[{tagName:"span",textContent:"Refresh"}]},{tagName:"jx-button",$props:{variant:"negative",disabled:{$ref:"#/state/busy"}},attributes:{part:"disconnect"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/disconnect"},value:[]}]},children:[{tagName:"span",textContent:"Disconnect"}]}]}]}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFailure"},cases:{true:{tagName:"p",attributes:{part:"failure"},children:["${state.failure}",{tagName:"span",attributes:{part:"pages-app-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/needsPagesApp"},cases:{true:{tagName:"span",children:[" — if the Cloudflare Pages GitHub App is not installed on the repository, ",{tagName:"a",attributes:{part:"install-link",href:"${state.pagesAppUrl}",target:"_blank",rel:"noreferrer"},textContent:"install it"}," and retry."]}}}]}}}]}]};E("publish",w);var D="https://github.com/apps/cloudflare-pages/installations/new";function I(e){if(!e.supported)return"unsupported";if(e.loading)return"loading";if(e.connected&&e.lapsed)return"lapsed";if(!e.connected){if(e.hosted)return"hosted";return e.tokenStored&&!e.replacing?"stored":"token"}return e.deploy?"status":"form"}function j(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:I(e),branch:e.form.branch,busy:e.busy,connectLabel:e.busy?"Reconnecting…":"Reconnect Cloudflare",deploymentEnvironment:e.deployment?.environment??"",deploymentState:e.deployment?`${e.deployment.stage}: ${e.deployment.status}`:"",deploymentUrl:e.deployment?.url??"",deployProject:e.deploy?.projectName??"",failure:t,hasDeployment:e.deployment!==null,hasFailure:t!=="",hasProductionUrl:(e.deploy?.productionUrl??"")!=="",needsPagesApp:/github/i.test(t)&&/app|install|source|repo/i.test(t),owner:e.form.owner,pagesAppUrl:D,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function k(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",m=!1,N=()=>{if(m)return;m=!0,e.onClosed()},P=()=>m,d=g({...j(e.view),closed:N,connect:()=>{e.onConnect()},disconnect:()=>{e.onDisconnect()},openAccounts:()=>{e.onOpenAccounts()},refresh:()=>{e.onRefresh()},replace:()=>{n="",e.onReplaceToken()},setAccount:(o)=>{d.accountId=o,e.onField("accountId",o)},setBranch:(o)=>{d.branch=o,e.onField("branch",o)},setOwner:(o)=>{d.owner=o,e.onField("owner",o)},setProjectName:(o)=>{d.projectName=o,e.onField("projectName",o)},setRepo:(o)=>{d.repo=o,e.onField("repo",o)},setToken:(o)=>{n=o},submit:()=>{e.onSubmit()},verify:()=>{let o=n;n="",e.onSaveToken(o)}}),y=null,A=R("publish",d,t).then(async(o)=>{y=o;let u=o.root;if(P())return o.dispose(),u;if(await sn(u),P())return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(Ve,vt("modal","publish")),Jt(u),u});return{close(){let o=y?.root;if(o instanceof HTMLElement)Ut(o);y?.dispose(),y=null,n="",t.remove(),N()},host:t,ready:A,update(o){Object.assign(d,j(o))}}}var f=null,i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return C?.projectConfig??null}function T(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function O(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function H(){let e=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Bl(e)??""}function L(){let e=Ri();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function S(){let e=Zl(),t=i==="loading"?null:i;return{accounts:h.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:L(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&Q(p().cfConnect),lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:b,supported:e,tokenStored:hb()!==""}}function s(){if(f){f.update(S());return}f=k({layer:dt("modal"),onClosed:B,onConnect:()=>{M()},onDisconnect:()=>{z()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:_,onRefresh:()=>{v()},onReplaceToken:()=>{b=!0,r="",s()},onSaveToken:(e)=>{U(e)},onSubmit:()=>{V()},view:S()})}async function v(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){h=await sA(),a={...a,accountId:i.accountId??h[0]?.id??""};let e=Ri();if(e)l=await Hb(e),jd(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function U(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}AE(t),b=!1,r="",await v()}function _(){ae()?.run("app.preferences",{section:"accounts"})}async function M(){c=!0,r="",s();try{let e=await p().cfConnect?.()??null;if(e?.status==="timeout")r="The Cloudflare window didn't finish. Sign in there, then reconnect — nothing was changed.";else if(e?.status==="connected"&&!e.connection.accountId){let{openCfAccountPicker:t}=await (ce("xb8vvt2h"),import("./cf-account-picker-xb8vvt2h.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,cs(),await v()}async function V(){let e=x();if(!e)return;if(!a.projectName||!a.owner||!a.repo||!a.accountId){r="Account, project name, and the GitHub owner/repo are all required.",s();return}c=!0,r="",s();try{let t=H(),n={accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo};if(t)n.rootDir=t;let m=await aA(e,n);l=await Hb(m).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function z(){let e=x();if(!e)return;c=!0,s();try{await RL(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function B(){let e=f;f=null,e?.close()}function NE(e){i={accountId:e.accountId??"demo-account",connected:!0},h=[],l=e.deployment,jd(e.deployment),r="",c=!1,b=!1,s()}function cF(){let e=x(),{owner:t,repo:n}=O();i="loading",h=[],l=null,r="",c=!1,b=!1,a={accountId:"",branch:"main",owner:t,projectName:Ri()?.projectName??T(e?.name??""),repo:n},s(),v()}
|
|
2
2
|
export{Bl,NE,cF};
|
|
3
3
|
|
|
4
4
|
//# debugId=104942E4566EAE1F64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
5
|
+
//# sourceMappingURL=studio-evq47j2z.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{p}from"./studio-4fnb5648.js";import{Jd,m}from"./studio-
|
|
1
|
+
import{p}from"./studio-4fnb5648.js";import{Jd,m}from"./studio-knsjyx7n.js";import{jt,Wi,fn,wl,lr,Oa}from"./studio-q9hx2qp0.js";import{$o}from"./studio-nvcn2ykc.js";import{Ls,Ud}from"./studio-bnc50f9h.js";import{ax}from"./studio-xva3hzkv.js";import{ss,Ww,Vw,er,Fr}from"./studio-hfqpfmpk.js";import{C}from"./studio-4f7thq0p.js";import{g}from"./studio-3qr08sxq.js";import{n,Y,_,wf}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var Cs="draft",Tp="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function Jl(e){return e?.[Cs]===!0}function M(e){return e?.properties?.[Cs]?.type==="boolean"}function jc(e,t){return M(e)||Jl(t)}var k=g({includeDrafts:!1});function I(){return k.includeDrafts}function zN(e){k.includeDrafts=e}function T(e,t,r){return r?e:e.filter((o)=>!Jl(t(o)))}function W(e){let t=[],r=[],o="",s=!1,l=!1,u=()=>{r.push(o),o="",l=!1},x=()=>{if(u(),r.length===1&&r[0]===""){r=[];return}t.push(r),r=[]};for(let F=0;F<e.length;F++){let S=e[F];if(s){if(S==='"')if(e[F+1]==='"')o+='"',F+=1;else s=!1;else o+=S;continue}if(S==='"'&&!l)s=!0,l=!0;else if(S==='"')o+=S;else if(S===",")u();else if(S===`
|
|
2
2
|
`)x();else if(S==="\r"){if(e[F+1]===`
|
|
3
3
|
`)F+=1;x()}else o+=S,l=!0}if(o!==""||r.length>0)x();return t}function Fd(e){let t=(e.match(/\r\n/g)??[]).length,r=(e.match(/(?<!\r)\n/g)??[]).length,o=t>r?`\r
|
|
4
4
|
`:`
|
|
5
5
|
`,s=e.endsWith(`
|
|
6
|
-
`),l=W(e),u=l[0]??[],x=l.slice(1),F=Math.max(u.length,...x.map((S)=>S.length),0);while(u.length<F)u.push("");for(let S of x)while(S.length<F)S.push("");return{eol:o,headers:u,rows:x,trailingNewline:s}}function z(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function WT(e){return[e.headers,...e.rows].map((r)=>r.map((o)=>z(o)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}function q(e,t){let{headers:r,rows:o}=Fd(e),s=[t,"id","sku","slug","Slug"].flatMap((l)=>{let u=l===void 0?-1:r.indexOf(l);return u===-1?[]:[u]});return o.filter((l)=>l.some((u)=>u.trim()!=="")).map((l,u)=>{let x=s.find((F)=>(l[F]??"")!=="");return x===void 0?String(u):l[x]})}function B(e,t){let r;try{r=JSON.parse(e)}catch{return[]}let o=(s,l)=>{let u=_(s)&&!Array.isArray(s)?s.id:void 0;return n(u)||Y(u)?String(u):l};if(!Array.isArray(r))return[o(r,t)];return r.map((s,l)=>o(s,`${t}-${l}`))}function K(e,t,r){let o=e.toLowerCase();if(o.endsWith(".csv"))return q(t,r);if(o.endsWith(".json")){let s=(e.split("/").pop()??e).replace(/\.json$/i,"");return B(t,s)}return[]}var R="__path";function N(){return C?.projectConfig?.content??{}}function Rb(e){let t=N()[e];if(!t?.source)return null;let r=t.source.replace(/^\.\//,"").replace(/\/$/,""),o=t.format==="json"?".json":Wi(t.format)?.extensions[0]??lr()?.extensions[0]??".json";return{def:t,dir:r,ext:o,name:e}}function BS(){return Object.entries(N()).filter(([,e])=>{let t=e.source?.replace(/^\.\//,"")??"";return t!==""&&!/\.[a-z0-9]+$/i.test(t)}).map(([e,t])=>({dir:t.source.replace(/^\.\//,"").replace(/\/$/,""),name:e}))}async function O(e,t){let r=p(),o=[],s=async(l)=>{let u;try{u=await r.listDirectory(l)}catch{return}for(let x of u)if(x.type==="directory")await s(x.path);else if(t.some((F)=>x.path.endsWith(F)))o.push(x.path)};return await s(e),o.toSorted()}async function zS(e){let t=e.dir.indexOf($o);if(t===-1)return[e.dir];let r=e.dir.slice(0,t).replace(/\/$/,""),o=e.dir.slice(t+$o.length),s;try{s=await p().listDirectory(r)}catch{return[]}return s.filter((l)=>l.type==="directory").map((l)=>`${l.path}${o}`.replace(/\/$/,"")).filter((l)=>Jd(l)?.name===e.name).toSorted()}async function V(e){let t=await zS(e);return(await Promise.all(t.map((o)=>O(o,[e.ext])))).flat().toSorted()}async function H(e){let t=ax(e.name);if(t===null)return null;let r;try{r=await p().readFile(t)}catch{return[]}return K(t,r,e.def.idField)}async function Db(e){await jt().catch(()=>{});let t=Rb(e);if(!t)return[];let r=await H(t);if(r!==null)return r;return(await V(t)).map((s)=>{let l=s.split("/").pop()??s;return l.slice(0,l.length-t.ext.length)})}async function Q(e,t,r){let o=Array.from({length:e.length}),s=0,l=Array.from({length:Math.min(t,e.length)},async()=>{while(s<e.length){let u=s;s+=1,o[u]=await r(e[u])}});return await Promise.all(l),o}function j(e){if(e===void 0)return null;if(wf(e))return e;if(Array.isArray(e)&&e.every((t)=>!_(t)))return e.map(String);return JSON.stringify(e)}function A(e){for(let t of m.tabs.values())if(t.documentPath===e)return t;return null}function U(e,t){return e.every((r)=>{let o=r[t];return!n(o)||!o.startsWith("{")&&!o.startsWith("[")})}var L=new WeakSet;async function VT(){let e=[];for(let t of m.tabs.values()){let r=er(t);if(r&&L.has(r.source))e.push(r.load())}await Promise.all(e)}function J(e){let t=X(e);if(e.drafts)L.add(t);return t}function X(e){let t=new Map,r=null,o=null,s=(d=!1)=>{if(!d&&r)return r;return r=(async()=>{await jt().catch(()=>{});let h=p(),f=await e.list();t.clear(),o=null;let y=await Q(f,32,async(i)=>{try{let a=await h.readFile(i),c=await Fr(i,a);return{document:c.document,formatName:c.format.name,frontmatter:c.frontmatter,rawText:a}}catch{return null}});for(let[i,a]of f.entries()){let c=y[i];if(c)t.set(a,c)}})(),r},l=()=>{if(o)return o;let d={editable:!1,field:R,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},h=Ww(e.schema()),f=new Set([R,...h.map((a)=>a.field)]),y=[...t.values()].map((a)=>{let c={};for(let[w,b]of Object.entries(a.frontmatter))if(!f.has(w)&&!w.startsWith("$"))c[w]=j(b);return c}),i=Vw(y);for(let a of i)a.editable=a.kind!=="text"||U(y,a.field);if(e.priorityFields?.length){let a=(c)=>{let w=e.priorityFields.indexOf(c.field);return w===-1?e.priorityFields.length:w};i.sort((c,w)=>a(c)-a(w))}return o=x([d,...h,...i]),o},u=()=>{if(!e.drafts)return!1;let d=e.schema();return jc(d)||[...t.values()].some((h)=>jc(d,h.frontmatter))},x=(d)=>{let h=d.findIndex((y)=>y.field===Cs);if(h<1||!u())return d;let f=d.filter((y)=>y.field!==Cs);return[f[0],d[h],...f.slice(1)]},F=(d,h)=>{let f={[R]:d};for(let y of l()){if(y.field===R)continue;f[y.field]=j(h.frontmatter[y.field])}return{cells:f,fingerprint:h.rawText,key:d}},S=async(d,h,f)=>{let y=p(),i={...h.frontmatter};for(let b of f)if(b.value===null)delete i[b.field];else i[b.field]=b.value;let a=h.document,c={...i,...a,children:a.children??[]},w=await Oa(h.formatName,c,{mode:"roundtrip",source:h.rawText});Ls(d),await y.writeFile(d,w),t.set(d,{...h,frontmatter:i,rawText:w})};return{backingPaths:()=>new Map([...t.keys()].map((d)=>[d,d])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await s(),l()},async commit(d){await s();let h=p(),f={cells:[],deletes:[],inserts:[]},y=new Map;for(let i of d.cells){let a=y.get(i.rowKey)??[];a.push({field:i.field,value:i.value}),y.set(i.rowKey,a)}for(let[i,a]of y){let c=(P,D,v)=>{for(let G of a)f.cells.push({error:D,field:G.field,ok:P,rowKey:i,stale:v})},w=t.get(i);if(!w){c(!1,"Entry no longer loaded — refresh the grid");continue}let b=A(i);if(b?.doc.dirty){c(!1,"Open in a tab with unsaved changes — save or close it first");continue}let E=null;try{E=await h.readFile(i)}catch{E=null}if(E!==w.rawText&&!Ud(i)){c(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await S(i,w,a),c(!0),b){let{reloadFileInTab:P}=await (ce("
|
|
6
|
+
`),l=W(e),u=l[0]??[],x=l.slice(1),F=Math.max(u.length,...x.map((S)=>S.length),0);while(u.length<F)u.push("");for(let S of x)while(S.length<F)S.push("");return{eol:o,headers:u,rows:x,trailingNewline:s}}function z(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function WT(e){return[e.headers,...e.rows].map((r)=>r.map((o)=>z(o)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}function q(e,t){let{headers:r,rows:o}=Fd(e),s=[t,"id","sku","slug","Slug"].flatMap((l)=>{let u=l===void 0?-1:r.indexOf(l);return u===-1?[]:[u]});return o.filter((l)=>l.some((u)=>u.trim()!=="")).map((l,u)=>{let x=s.find((F)=>(l[F]??"")!=="");return x===void 0?String(u):l[x]})}function B(e,t){let r;try{r=JSON.parse(e)}catch{return[]}let o=(s,l)=>{let u=_(s)&&!Array.isArray(s)?s.id:void 0;return n(u)||Y(u)?String(u):l};if(!Array.isArray(r))return[o(r,t)];return r.map((s,l)=>o(s,`${t}-${l}`))}function K(e,t,r){let o=e.toLowerCase();if(o.endsWith(".csv"))return q(t,r);if(o.endsWith(".json")){let s=(e.split("/").pop()??e).replace(/\.json$/i,"");return B(t,s)}return[]}var R="__path";function N(){return C?.projectConfig?.content??{}}function Rb(e){let t=N()[e];if(!t?.source)return null;let r=t.source.replace(/^\.\//,"").replace(/\/$/,""),o=t.format==="json"?".json":Wi(t.format)?.extensions[0]??lr()?.extensions[0]??".json";return{def:t,dir:r,ext:o,name:e}}function BS(){return Object.entries(N()).filter(([,e])=>{let t=e.source?.replace(/^\.\//,"")??"";return t!==""&&!/\.[a-z0-9]+$/i.test(t)}).map(([e,t])=>({dir:t.source.replace(/^\.\//,"").replace(/\/$/,""),name:e}))}async function O(e,t){let r=p(),o=[],s=async(l)=>{let u;try{u=await r.listDirectory(l)}catch{return}for(let x of u)if(x.type==="directory")await s(x.path);else if(t.some((F)=>x.path.endsWith(F)))o.push(x.path)};return await s(e),o.toSorted()}async function zS(e){let t=e.dir.indexOf($o);if(t===-1)return[e.dir];let r=e.dir.slice(0,t).replace(/\/$/,""),o=e.dir.slice(t+$o.length),s;try{s=await p().listDirectory(r)}catch{return[]}return s.filter((l)=>l.type==="directory").map((l)=>`${l.path}${o}`.replace(/\/$/,"")).filter((l)=>Jd(l)?.name===e.name).toSorted()}async function V(e){let t=await zS(e);return(await Promise.all(t.map((o)=>O(o,[e.ext])))).flat().toSorted()}async function H(e){let t=ax(e.name);if(t===null)return null;let r;try{r=await p().readFile(t)}catch{return[]}return K(t,r,e.def.idField)}async function Db(e){await jt().catch(()=>{});let t=Rb(e);if(!t)return[];let r=await H(t);if(r!==null)return r;return(await V(t)).map((s)=>{let l=s.split("/").pop()??s;return l.slice(0,l.length-t.ext.length)})}async function Q(e,t,r){let o=Array.from({length:e.length}),s=0,l=Array.from({length:Math.min(t,e.length)},async()=>{while(s<e.length){let u=s;s+=1,o[u]=await r(e[u])}});return await Promise.all(l),o}function j(e){if(e===void 0)return null;if(wf(e))return e;if(Array.isArray(e)&&e.every((t)=>!_(t)))return e.map(String);return JSON.stringify(e)}function A(e){for(let t of m.tabs.values())if(t.documentPath===e)return t;return null}function U(e,t){return e.every((r)=>{let o=r[t];return!n(o)||!o.startsWith("{")&&!o.startsWith("[")})}var L=new WeakSet;async function VT(){let e=[];for(let t of m.tabs.values()){let r=er(t);if(r&&L.has(r.source))e.push(r.load())}await Promise.all(e)}function J(e){let t=X(e);if(e.drafts)L.add(t);return t}function X(e){let t=new Map,r=null,o=null,s=(d=!1)=>{if(!d&&r)return r;return r=(async()=>{await jt().catch(()=>{});let h=p(),f=await e.list();t.clear(),o=null;let y=await Q(f,32,async(i)=>{try{let a=await h.readFile(i),c=await Fr(i,a);return{document:c.document,formatName:c.format.name,frontmatter:c.frontmatter,rawText:a}}catch{return null}});for(let[i,a]of f.entries()){let c=y[i];if(c)t.set(a,c)}})(),r},l=()=>{if(o)return o;let d={editable:!1,field:R,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},h=Ww(e.schema()),f=new Set([R,...h.map((a)=>a.field)]),y=[...t.values()].map((a)=>{let c={};for(let[w,b]of Object.entries(a.frontmatter))if(!f.has(w)&&!w.startsWith("$"))c[w]=j(b);return c}),i=Vw(y);for(let a of i)a.editable=a.kind!=="text"||U(y,a.field);if(e.priorityFields?.length){let a=(c)=>{let w=e.priorityFields.indexOf(c.field);return w===-1?e.priorityFields.length:w};i.sort((c,w)=>a(c)-a(w))}return o=x([d,...h,...i]),o},u=()=>{if(!e.drafts)return!1;let d=e.schema();return jc(d)||[...t.values()].some((h)=>jc(d,h.frontmatter))},x=(d)=>{let h=d.findIndex((y)=>y.field===Cs);if(h<1||!u())return d;let f=d.filter((y)=>y.field!==Cs);return[f[0],d[h],...f.slice(1)]},F=(d,h)=>{let f={[R]:d};for(let y of l()){if(y.field===R)continue;f[y.field]=j(h.frontmatter[y.field])}return{cells:f,fingerprint:h.rawText,key:d}},S=async(d,h,f)=>{let y=p(),i={...h.frontmatter};for(let b of f)if(b.value===null)delete i[b.field];else i[b.field]=b.value;let a=h.document,c={...i,...a,children:a.children??[]},w=await Oa(h.formatName,c,{mode:"roundtrip",source:h.rawText});Ls(d),await y.writeFile(d,w),t.set(d,{...h,frontmatter:i,rawText:w})};return{backingPaths:()=>new Map([...t.keys()].map((d)=>[d,d])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await s(),l()},async commit(d){await s();let h=p(),f={cells:[],deletes:[],inserts:[]},y=new Map;for(let i of d.cells){let a=y.get(i.rowKey)??[];a.push({field:i.field,value:i.value}),y.set(i.rowKey,a)}for(let[i,a]of y){let c=(P,D,v)=>{for(let G of a)f.cells.push({error:D,field:G.field,ok:P,rowKey:i,stale:v})},w=t.get(i);if(!w){c(!1,"Entry no longer loaded — refresh the grid");continue}let b=A(i);if(b?.doc.dirty){c(!1,"Open in a tab with unsaved changes — save or close it first");continue}let E=null;try{E=await h.readFile(i)}catch{E=null}if(E!==w.rawText&&!Ud(i)){c(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await S(i,w,a),c(!0),b){let{reloadFileInTab:P}=await (ce("zrqtgt41"),import("./files-zrqtgt41.js"));P(i)}}catch(P){c(!1,P instanceof Error?P.message:String(P))}}for(let i of d.inserts){let a=i.cells[R];if(!n(a)||a.trim()===""){f.inserts.push({error:"Path is required",ok:!1,tempKey:i.tempKey});continue}let c=e.resolveInsertPath(a),w=t.has(c);if(!w)try{await h.readFile(c),w=!0}catch{w=!1}if(w){f.inserts.push({error:`${c} already exists`,ok:!1,tempKey:i.tempKey});continue}let b=e.insertFormatName(c);if(!b){f.inserts.push({error:`No format can serialize ${c}`,ok:!1,tempKey:i.tempKey});continue}try{let E={};for(let[v,G]of Object.entries(i.cells))if(v!==R&&G!==null)E[v]=G;let P=await Oa(b,{...E,children:[]},{frontmatter:Object.keys(E).length>0,mode:"roundtrip"});Ls(c),await h.writeFile(c,P);let D=await Fr(c,P);t.set(c,{document:D.document,formatName:D.format.name,frontmatter:D.frontmatter,rawText:P}),f.inserts.push({newKey:c,ok:!0,tempKey:i.tempKey})}catch(E){f.inserts.push({error:E instanceof Error?E.message:String(E),ok:!1,tempKey:i.tempKey})}}for(let i of d.deletes){if(A(i.rowKey)){f.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:i.rowKey});continue}try{Ls(i.rowKey),await h.deleteFile(i.rowKey),t.delete(i.rowKey),f.deletes.push({ok:!0,rowKey:i.rowKey})}catch(a){f.deletes.push({error:a instanceof Error?a.message:String(a),ok:!1,rowKey:i.rowKey})}}return f},id:e.id,label:e.label,async refresh(){await s(!0)},async rows(){await s();let h=(e.drafts?T([...t.entries()],([,f])=>f.frontmatter,I()):[...t.entries()]).map(([f,y])=>F(f,y));return{rows:h,total:h.length}}}}function UT(e){let t=()=>{let r=Rb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return J({drafts:!0,id:ss({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?Wi(o.def.format)?.name:void 0)??fn(r)?.name??lr()?.name??null},label:e,list:()=>V(t()),resolveInsertPath:(r)=>{let o=t(),s=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!s.includes("/"))s=`${o.dir}/${s}`;if(!s.endsWith(o.ext))s=`${s}${o.ext}`;return s},schema:()=>t().def.schema})}function qT(){let e=()=>{let t=wl("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return J({id:ss({kind:"pages"}),insertFormatName:(t)=>fn(t)?.name??null,label:"Pages",list:()=>O("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
7
7
|
export{Fd,WT,Cs,Tp,Jl,jc,zN,Rb,BS,zS,Db,VT,UT,qT};
|
|
8
8
|
|
|
9
9
|
//# debugId=1729A57C53001D0B64756E2164756E21
|
|
10
|
-
//# sourceMappingURL=studio-
|
|
10
|
+
//# sourceMappingURL=studio-frc16j8v.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-4fnb5648.js";import{w}from"./studio-sce30r7b.js";import{Gl,Ep}from"./studio-yzpskb0j.js";import{Ku}from"./studio-15hwqgd8.js";import{yT}from"./studio-b68k0z00.js";import{ic}from"./studio-x0gsfr1d.js";import{HN}from"./studio-fspe7m9t.js";import{C}from"./studio-4f7thq0p.js";import{Ve,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,Q,_,v}from"./studio-k3we3kqb.js";var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContributed",$description:'The generic settings section behind `$studio.settings` (specs/extensions.md §9.1), as a Jx document over the kit. One document serves both layouts an extension may declare: "form" is a single schema form over the whole section value, "map" is master-detail — the entry keys on the left, the selected entry\'s form on the right. The adapter (`surfaces/settings-contributed.ts`) hands in the title, the layout, the entry rows already marked as selected, and whatever the reader is part-way through typing; `settings/contributed-section.ts` decides what an entry may be named, what reaches `project.json`, and what the validator said about it. The schema form itself is an ISLAND: this document renders `form-host` and nothing inside it, because a form built from a JSON Schema is `ui/schema-form.ts`\'s surface rather than this one\'s — the section places the element that surface hands back. The actions row is the second island: `panels/data-grid.ts` contributes it, and that one is still lit over Spectrum.',tagName:"section",attributes:{part:"contributed"},style:{$description:"What `.settings-section-title`, `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state` and `.settings-inline-form` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This section was the LAST emitter of every one of them except `.settings-empty-state`, which `panels/settings-pane.ts` still writes when a project closes with the editor open — so those rules are dead in the stylesheet from here, and a central sweep removes them rather than this change, which owns no stylesheet. Two values could not come across. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so it would have taken its hard-coded fallback every time; the entry name is a kit textfield now and carries the kit's own type ramp. And `.entry-name-input`, `.settings-form-panel`, `.settings-section` and `.contributed-section` had no rule anywhere at all — they were four entries on `check-styles.ts`'s orphan ledger, which is the ledger's point.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="actions"]':{$description:"The host-contributed actions row — Test Connection, Push Schema, Open Data Grid on the data sections. `.data-section-actions` never had a rule anywhere, so the row was whatever the buttons stacked up to; it is a row with a gap under it now.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"12px"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on the page's own `--bg` with `--border` showing through the gap, so nothing draws a rule of its own. The panels are `--bg`, not `--bg-panel`, because the section is drawn on the Settings home, whose background is `--bg`: a second shade under one section of the form reads as a box nobody asked for.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg)",overflowY:"auto"},'& [part="entry"], & [part="new-open"]':{width:"100%"},'& [part="entry"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{$description:"`min-width: 0` is the one line `.settings-editor-panel` did not have and needed: a flex child's floor is its content, and the schema form inside this one is a whole form rather than the short cards Data Shapes puts here — so a long pointer or a wide row pushed the column past the right edge of the pane instead of scrolling inside it.",flex:"1",padding:"16px",background:"var(--bg)",overflowY:"auto",minWidth:"0"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="entry-name"]':{flex:"1",minWidth:"0",maxWidth:"220px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/actionsState"},cases:{slot:{$description:"An island: the host renders its own actions into this node and the document renders nothing inside it.",tagName:"div",attributes:{part:"actions"}}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layout"},cases:{form:{$description:"An island: `ui/schema-form.ts` draws the whole section value into this node.",tagName:"div",attributes:{part:"form-host"}},map:{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"entry","data-entry":"${$map.item.key}","data-jx-region":"${$map.item.region}"},$props:{label:"${$map.item.key}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.key}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"${state.newLabel}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"${state.newLabel}"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"${state.newFieldLabel}",placeholder:"${state.newPlaceholder}",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyText}"},editing:{tagName:"div",attributes:{part:"editor","data-jx-region":"${state.editorRegion}"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"jx-textfield",attributes:{part:"entry-name"},$props:{label:"Entry name",size:"sm",value:{$ref:"#/state/entryName"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}],Escape:[{operator:"call",target:{$ref:"#/state/cancelRename"},value:[{$ref:"event#/target/value"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"delete-entry"},$props:{label:"Delete entry",hint:"Delete entry",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeEntry"},value:[]}]}}]},{$description:"An island: `ui/schema-form.ts` draws the selected entry into this node.",tagName:"div",attributes:{part:"form-host"}}]}}}]}}}]};E("settings-contributed",L);function I(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:"",emptyText:"",newFieldLabel:"",newLabel:"",newPlaceholder:""}}function K(t){let r=n(t)?void 0:t.attributes?.part;return n(r)?r:""}function H(t,r,a){t.textContent="";let o=g({...I(),...r}),e=null,i=!1,c=R("settings-contributed",o,t,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let u=K(d);if(u==="form-host")a.formSlot(s);else if(u==="actions")a.actionsSlot(s)}}).then((s)=>{let l=s.root;if(i)return s.dispose(),l;return e=s,l});return{attached:()=>{if(i)return!1;let s=e?.root;return s===void 0?!0:s instanceof HTMLElement&&t.contains(s)},dispose(){i=!0,e?.dispose(),e=null},host:t,ready:c,update(s){o.actionsState=s.actionsState,o.editorRegion=s.editorRegion,o.editorState=s.editorState,o.entries=s.entries,o.entryName=s.entryName,o.layout=s.layout,o.newName=s.newName,o.newState=s.newState,o.title=s.title,o.emptyText=s.emptyText,o.newFieldLabel=s.newFieldLabel,o.newLabel=s.newLabel,o.newPlaceholder=s.newPlaceholder}}}var f=new Map,N=new Set,S=new Map;function xN(t,r){let a=C?.projectConfig?.[t],o=v(a)?a:{};if(!Object.hasOwn(o,r))return Object.keys(o);return f.set(t,r),null}var j=new Map;function q(t,r){let a={},o=[];for(let e of r){let i=e.indexOf(": "),c=i===-1?"":e.slice(0,i),s=i===-1?e:e.slice(i+2);if(c===t){o.push(s);continue}if(!c.startsWith(`${t}/`))continue;let[l]=c.slice(t.length+1).split("/");if(l&&a[l]===void 0)a[l]=s}return{fields:a,section:o}}async function k(t,r){let a=C?.projectConfig;if(!a)return;if(!(await ic()).ok)return;let e=[];try{e=await Ku(a)}catch(i){w.warn(`Could not validate project.json — ${X(i)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}j.set(t,q(t,e).fields),r()}function M(t,r){for(let[a,o]of Object.entries(r))if(o===void 0)delete t[a];else t[a]=o}function O(t){return t.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function U(t,r){if(!t)return{};let a=(e)=>{let i={};for(let[c,s]of Object.entries(e))i[c]=o(s);return i},o=(e)=>{if(n(e))return e.replaceAll("${key}",r);if(Array.isArray(e))return e.map((i)=>o(i));if(v(e))return a(e);return e};return a(t)}function A(t,r,a=null){let o=p(),e={fieldKeyPrefix:`$settings.${t}`,resolvePointer:(i,c)=>{let s={projectConfig:C?.projectConfig??{}};if(v(c))s.scope=c;if(r.formats!==void 0)s.formats=r.formats;return Ep(i,s)}};if(Q(o.setSecrets))e.commitSecret=async(i,c)=>{let s=HN(t,a,i);return await o.setSecrets({set:{[s]:c}}),s};return e}function b(t){let r=C?.projectConfig;if(!r)return null;let a=r[t];if(v(a))return a;let o={};return r[t]=o,o}function F(t,r){return`${t.closest(`[${Ve}]`)?.getAttribute(Ve)??yT("primary")}/${r}`}var J=new WeakMap;function m(t){bT(t.container,t.contribution,t.opts)}function P(t,r){t.echo=r,m(t)}var Y="entry";function B(t){let r=t?.trim().toLowerCase()||Y,a=`${r.charAt(0).toUpperCase()}${r.slice(1)}`;return{emptyText:`Select ${/^[aeiou]/u.test(r)?"an":"a"} ${r} or create one`,newFieldLabel:`${a} name`,newLabel:`New ${r}`,newPlaceholder:`${O(r)}-name`}}function G(t){let{contribution:r,opts:a}=t,o=r.key,e=r.title??o,i=a.actions?"slot":"none",c=F(t.container,"editor"),s=B(r.settings.entry?.noun);if((r.settings.layout??"form")!=="map")return{actionsState:i,editorRegion:c,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:e,...s};let l=b(o)??{},d=f.get(o)??null,u=d===null?void 0:l[d],h=d!==null&&_(u);return{actionsState:i,editorRegion:c,editorState:h?"editing":"empty",entries:Object.keys(l).map((x)=>({key:x,region:F(t.container,`entry:${x}`),selected:x===d})),entryName:t.echo??(h?d:""),layout:"map",newName:S.get(o)??"",newState:N.has(o)?"open":"closed",title:e,...s}}function V(t){let r=t.formHost;if(!r)return;let{contribution:a,opts:o}=t,e=a.key,i=a.settings.entry?.ui,c=()=>m(t),s=(y)=>{if(y.parentNode!==r)r.replaceChildren(y)};if((a.settings.layout??"form")!=="map"){let y=`/${e}`;s(Gl(`section:${e}`,a.entrySchema,b(e)??{},{context:A(e,o,null),errors:j.get(y)??{},onChange:(W)=>{let T=b(e);if(!T)return;M(T,W),c(),k(y,c)},rerender:c,...i!==void 0&&{ui:i}}));return}let l=b(e)??{},d=f.get(e)??null,u=d===null?void 0:l[d];if(d===null||!_(u)){r.replaceChildren();return}let h=u,x=`/${e}/${d}`;s(Gl(`section:${e}:${d}`,a.entrySchema,h,{context:A(e,o,d),errors:j.get(x)??{},onChange:(y)=>{M(h,y),c(),k(x,c)},rerender:c,...i!==void 0&&{ui:i}}))}function D(t){let r=t.actionsHost,{actions:a}=t.opts;if(!r)return;if(!a){r.replaceChildren();return}let o=t.contribution.key,e=(t.contribution.settings.layout??"form")==="map"?f.get(o)??null:null;a(r,{rerender:()=>m(t),sectionKey:o,selected:e})}function Z(t){let r=(e)=>{t.echo=null,m(t),k(e,()=>m(t))},a=()=>{t.echo=null,m(t)},o=()=>t.contribution.key;return{cancelNew(){N.delete(o()),S.delete(o()),m(t)},cancelRename(e){P(t,e),a()},createNew(){let e=o(),i=O(S.get(e)??""),c=b(e);if(!i||!c||c[i])return;c[i]=U(t.contribution.settings.entry?.newEntry,i),f.set(e,i),N.delete(e),S.delete(e),r(`/${e}`)},editNew(e){S.set(o(),e),m(t)},openNew(){N.add(o()),m(t)},removeEntry(){let e=o(),i=f.get(e)??null,c=b(e);if(!i||!c?.[i])return;delete c[i],f.set(e,null),r(`/${e}`)},renameEntry(e){P(t,e);let i=o(),c=f.get(i)??null,s=b(i),l=O(e.trim());if(!c||!s||!l||l===c||s[l]){a();return}let d={};for(let[u,h]of Object.entries(s))d[u===c?l:u]=h,delete s[u];Object.assign(s,d),f.set(i,l),r(`/${i}`)},select(e){f.set(o(),e),t.echo=null,m(t)}}}function bT(t,r,a={}){let o=J.get(t);if(o)o.contribution=r,o.opts=a;let e=o?.handle??null;if(!o||!e?.attached()){e?.dispose();let i={actionsHost:null,container:t,contribution:r,echo:null,formHost:null,handle:null,opts:a};J.set(t,i),e=H(t,Z(i),{actionsSlot:(c)=>{i.actionsHost=c,D(i)},formSlot:(c)=>{i.formHost=c,V(i)}}),i.handle=e,o=i}e.update(G(o)),D(o),V(o)}
|
|
1
|
+
import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-4fnb5648.js";import{w}from"./studio-sce30r7b.js";import{Gl,Ep}from"./studio-cqxj4fcy.js";import{Ku}from"./studio-1y9mab9m.js";import{yT}from"./studio-nwf0c32p.js";import{ic}from"./studio-pwctzka3.js";import{HN}from"./studio-2zz4qbv9.js";import{C}from"./studio-4f7thq0p.js";import{Ve,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,Q,_,v}from"./studio-k3we3kqb.js";var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContributed",$description:'The generic settings section behind `$studio.settings` (specs/extensions.md §9.1), as a Jx document over the kit. One document serves both layouts an extension may declare: "form" is a single schema form over the whole section value, "map" is master-detail — the entry keys on the left, the selected entry\'s form on the right. The adapter (`surfaces/settings-contributed.ts`) hands in the title, the layout, the entry rows already marked as selected, and whatever the reader is part-way through typing; `settings/contributed-section.ts` decides what an entry may be named, what reaches `project.json`, and what the validator said about it. The schema form itself is an ISLAND: this document renders `form-host` and nothing inside it, because a form built from a JSON Schema is `ui/schema-form.ts`\'s surface rather than this one\'s — the section places the element that surface hands back. The actions row is the second island: `panels/data-grid.ts` contributes it, and that one is still lit over Spectrum.',tagName:"section",attributes:{part:"contributed"},style:{$description:"What `.settings-section-title`, `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state` and `.settings-inline-form` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This section was the LAST emitter of every one of them except `.settings-empty-state`, which `panels/settings-pane.ts` still writes when a project closes with the editor open — so those rules are dead in the stylesheet from here, and a central sweep removes them rather than this change, which owns no stylesheet. Two values could not come across. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so it would have taken its hard-coded fallback every time; the entry name is a kit textfield now and carries the kit's own type ramp. And `.entry-name-input`, `.settings-form-panel`, `.settings-section` and `.contributed-section` had no rule anywhere at all — they were four entries on `check-styles.ts`'s orphan ledger, which is the ledger's point.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="actions"]':{$description:"The host-contributed actions row — Test Connection, Push Schema, Open Data Grid on the data sections. `.data-section-actions` never had a rule anywhere, so the row was whatever the buttons stacked up to; it is a row with a gap under it now.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"12px"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on the page's own `--bg` with `--border` showing through the gap, so nothing draws a rule of its own. The panels are `--bg`, not `--bg-panel`, because the section is drawn on the Settings home, whose background is `--bg`: a second shade under one section of the form reads as a box nobody asked for.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg)",overflowY:"auto"},'& [part="entry"], & [part="new-open"]':{width:"100%"},'& [part="entry"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{$description:"`min-width: 0` is the one line `.settings-editor-panel` did not have and needed: a flex child's floor is its content, and the schema form inside this one is a whole form rather than the short cards Data Shapes puts here — so a long pointer or a wide row pushed the column past the right edge of the pane instead of scrolling inside it.",flex:"1",padding:"16px",background:"var(--bg)",overflowY:"auto",minWidth:"0"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="entry-name"]':{flex:"1",minWidth:"0",maxWidth:"220px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/actionsState"},cases:{slot:{$description:"An island: the host renders its own actions into this node and the document renders nothing inside it.",tagName:"div",attributes:{part:"actions"}}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layout"},cases:{form:{$description:"An island: `ui/schema-form.ts` draws the whole section value into this node.",tagName:"div",attributes:{part:"form-host"}},map:{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"entry","data-entry":"${$map.item.key}","data-jx-region":"${$map.item.region}"},$props:{label:"${$map.item.key}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.key}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"${state.newLabel}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"${state.newLabel}"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"${state.newFieldLabel}",placeholder:"${state.newPlaceholder}",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyText}"},editing:{tagName:"div",attributes:{part:"editor","data-jx-region":"${state.editorRegion}"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"jx-textfield",attributes:{part:"entry-name"},$props:{label:"Entry name",size:"sm",value:{$ref:"#/state/entryName"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}],Escape:[{operator:"call",target:{$ref:"#/state/cancelRename"},value:[{$ref:"event#/target/value"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"delete-entry"},$props:{label:"Delete entry",hint:"Delete entry",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeEntry"},value:[]}]}}]},{$description:"An island: `ui/schema-form.ts` draws the selected entry into this node.",tagName:"div",attributes:{part:"form-host"}}]}}}]}}}]};E("settings-contributed",L);function I(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:"",emptyText:"",newFieldLabel:"",newLabel:"",newPlaceholder:""}}function K(t){let r=n(t)?void 0:t.attributes?.part;return n(r)?r:""}function H(t,r,a){t.textContent="";let o=g({...I(),...r}),e=null,i=!1,c=R("settings-contributed",o,t,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let u=K(d);if(u==="form-host")a.formSlot(s);else if(u==="actions")a.actionsSlot(s)}}).then((s)=>{let l=s.root;if(i)return s.dispose(),l;return e=s,l});return{attached:()=>{if(i)return!1;let s=e?.root;return s===void 0?!0:s instanceof HTMLElement&&t.contains(s)},dispose(){i=!0,e?.dispose(),e=null},host:t,ready:c,update(s){o.actionsState=s.actionsState,o.editorRegion=s.editorRegion,o.editorState=s.editorState,o.entries=s.entries,o.entryName=s.entryName,o.layout=s.layout,o.newName=s.newName,o.newState=s.newState,o.title=s.title,o.emptyText=s.emptyText,o.newFieldLabel=s.newFieldLabel,o.newLabel=s.newLabel,o.newPlaceholder=s.newPlaceholder}}}var f=new Map,N=new Set,S=new Map;function xN(t,r){let a=C?.projectConfig?.[t],o=v(a)?a:{};if(!Object.hasOwn(o,r))return Object.keys(o);return f.set(t,r),null}var j=new Map;function q(t,r){let a={},o=[];for(let e of r){let i=e.indexOf(": "),c=i===-1?"":e.slice(0,i),s=i===-1?e:e.slice(i+2);if(c===t){o.push(s);continue}if(!c.startsWith(`${t}/`))continue;let[l]=c.slice(t.length+1).split("/");if(l&&a[l]===void 0)a[l]=s}return{fields:a,section:o}}async function k(t,r){let a=C?.projectConfig;if(!a)return;if(!(await ic()).ok)return;let e=[];try{e=await Ku(a)}catch(i){w.warn(`Could not validate project.json — ${X(i)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}j.set(t,q(t,e).fields),r()}function M(t,r){for(let[a,o]of Object.entries(r))if(o===void 0)delete t[a];else t[a]=o}function O(t){return t.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function U(t,r){if(!t)return{};let a=(e)=>{let i={};for(let[c,s]of Object.entries(e))i[c]=o(s);return i},o=(e)=>{if(n(e))return e.replaceAll("${key}",r);if(Array.isArray(e))return e.map((i)=>o(i));if(v(e))return a(e);return e};return a(t)}function A(t,r,a=null){let o=p(),e={fieldKeyPrefix:`$settings.${t}`,resolvePointer:(i,c)=>{let s={projectConfig:C?.projectConfig??{}};if(v(c))s.scope=c;if(r.formats!==void 0)s.formats=r.formats;return Ep(i,s)}};if(Q(o.setSecrets))e.commitSecret=async(i,c)=>{let s=HN(t,a,i);return await o.setSecrets({set:{[s]:c}}),s};return e}function b(t){let r=C?.projectConfig;if(!r)return null;let a=r[t];if(v(a))return a;let o={};return r[t]=o,o}function F(t,r){return`${t.closest(`[${Ve}]`)?.getAttribute(Ve)??yT("primary")}/${r}`}var J=new WeakMap;function m(t){bT(t.container,t.contribution,t.opts)}function P(t,r){t.echo=r,m(t)}var Y="entry";function B(t){let r=t?.trim().toLowerCase()||Y,a=`${r.charAt(0).toUpperCase()}${r.slice(1)}`;return{emptyText:`Select ${/^[aeiou]/u.test(r)?"an":"a"} ${r} or create one`,newFieldLabel:`${a} name`,newLabel:`New ${r}`,newPlaceholder:`${O(r)}-name`}}function G(t){let{contribution:r,opts:a}=t,o=r.key,e=r.title??o,i=a.actions?"slot":"none",c=F(t.container,"editor"),s=B(r.settings.entry?.noun);if((r.settings.layout??"form")!=="map")return{actionsState:i,editorRegion:c,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:e,...s};let l=b(o)??{},d=f.get(o)??null,u=d===null?void 0:l[d],h=d!==null&&_(u);return{actionsState:i,editorRegion:c,editorState:h?"editing":"empty",entries:Object.keys(l).map((x)=>({key:x,region:F(t.container,`entry:${x}`),selected:x===d})),entryName:t.echo??(h?d:""),layout:"map",newName:S.get(o)??"",newState:N.has(o)?"open":"closed",title:e,...s}}function V(t){let r=t.formHost;if(!r)return;let{contribution:a,opts:o}=t,e=a.key,i=a.settings.entry?.ui,c=()=>m(t),s=(y)=>{if(y.parentNode!==r)r.replaceChildren(y)};if((a.settings.layout??"form")!=="map"){let y=`/${e}`;s(Gl(`section:${e}`,a.entrySchema,b(e)??{},{context:A(e,o,null),errors:j.get(y)??{},onChange:(W)=>{let T=b(e);if(!T)return;M(T,W),c(),k(y,c)},rerender:c,...i!==void 0&&{ui:i}}));return}let l=b(e)??{},d=f.get(e)??null,u=d===null?void 0:l[d];if(d===null||!_(u)){r.replaceChildren();return}let h=u,x=`/${e}/${d}`;s(Gl(`section:${e}:${d}`,a.entrySchema,h,{context:A(e,o,d),errors:j.get(x)??{},onChange:(y)=>{M(h,y),c(),k(x,c)},rerender:c,...i!==void 0&&{ui:i}}))}function D(t){let r=t.actionsHost,{actions:a}=t.opts;if(!r)return;if(!a){r.replaceChildren();return}let o=t.contribution.key,e=(t.contribution.settings.layout??"form")==="map"?f.get(o)??null:null;a(r,{rerender:()=>m(t),sectionKey:o,selected:e})}function Z(t){let r=(e)=>{t.echo=null,m(t),k(e,()=>m(t))},a=()=>{t.echo=null,m(t)},o=()=>t.contribution.key;return{cancelNew(){N.delete(o()),S.delete(o()),m(t)},cancelRename(e){P(t,e),a()},createNew(){let e=o(),i=O(S.get(e)??""),c=b(e);if(!i||!c||c[i])return;c[i]=U(t.contribution.settings.entry?.newEntry,i),f.set(e,i),N.delete(e),S.delete(e),r(`/${e}`)},editNew(e){S.set(o(),e),m(t)},openNew(){N.add(o()),m(t)},removeEntry(){let e=o(),i=f.get(e)??null,c=b(e);if(!i||!c?.[i])return;delete c[i],f.set(e,null),r(`/${e}`)},renameEntry(e){P(t,e);let i=o(),c=f.get(i)??null,s=b(i),l=O(e.trim());if(!c||!s||!l||l===c||s[l]){a();return}let d={};for(let[u,h]of Object.entries(s))d[u===c?l:u]=h,delete s[u];Object.assign(s,d),f.set(i,l),r(`/${i}`)},select(e){f.set(o(),e),t.echo=null,m(t)}}}function bT(t,r,a={}){let o=J.get(t);if(o)o.contribution=r,o.opts=a;let e=o?.handle??null;if(!o||!e?.attached()){e?.dispose();let i={actionsHost:null,container:t,contribution:r,echo:null,formHost:null,handle:null,opts:a};J.set(t,i),e=H(t,Z(i),{actionsSlot:(c)=>{i.actionsHost=c,D(i)},formSlot:(c)=>{i.formHost=c,V(i)}}),i.handle=e,o=i}e.update(G(o)),D(o),V(o)}
|
|
2
2
|
export{xN,bT};
|
|
3
3
|
|
|
4
4
|
//# debugId=B3D2426835C304AD64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
5
|
+
//# sourceMappingURL=studio-gnazwtv3.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p,ye}from"./studio-4fnb5648.js";import{X}from"./studio-9c6cbq2c.js";import{La,oI}from"./studio-4zd6an2b.js";import{w,yl,sf}from"./studio-sce30r7b.js";import{KO,ea,uI,Ra,Z,Zd,Zm,_r,i0,o0,m,h,Si}from"./studio-yrcrncev.js";import{jt,ou,Wi,lf,fn,lr,AI,Oa,OI}from"./studio-aam8zt8z.js";import{Ud}from"./studio-bct64zmj.js";import{zd}from"./studio-y1b86ast.js";import{ls,al,$L,Xu}from"./studio-ggx3j7nd.js";import{UI,t2,n2,Ah,Bv}from"./studio-nzemfbkk.js";import{qo}from"./studio-tpxcryf2.js";import{ka,DA,a$}from"./studio-53wy9ek3.js";import{Es,Co}from"./studio-x0gsfr1d.js";import{sl}from"./studio-a65kbs2e.js";import{KN}from"./studio-nskxe9q1.js";import{oe}from"./studio-v5wktj6f.js";import{me,ia,te,g,le}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v}from"./studio-k3we3kqb.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function VS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:Bv,popoverTags:Ah},D="Popover",Se={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){yl((d)=>d.source===D);let s=new Map,l=t2(e,se);for(let d of l){let c=d.fix===void 0?void 0:Se[d.fix],C={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:D,tier:"problem"};if(c!==void 0)C.action=c,C.actionArgs={path:d.path};if(o!==void 0)C.path=o;w(d.severity,d.message,C)}let r=DA(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:D,tier:"problem"};if(o!==void 0)c.path=o;w(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=h.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function xe(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);w.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:D})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=sf(D),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=n2(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Z(l,(C)=>{for(let b of c.base)Zm(C,r,b,"");for(let b of c.breakpoints)o0(C,r,[b],"display","");if(c.openDisplay!==null)i0(C,r,":popover-open","display",c.openDisplay)}),w.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:D})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Z(l,(d)=>{_r(d,r,"popovertarget"),_r(d,r,"popovertargetaction")}),w.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:D})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Z(l,(d)=>{_r(d,r,"popover",UI)}),w.success(`Set \`popover\` to "${UI}".`,{key:"popover.repaired.mode",source:D})},title:"Set popover to auto",when:(e)=>e.document.open}]}function WN(e){e.registerAll(xe())}function zw(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(_(e)&&_(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var N="grid://",Nb={children:[],tagName:"div"};function ss(e){switch(e.kind){case"pages":return`${N}pages`;case"collection":return`${N}collection/${encodeURIComponent(e.name)}`;default:return`${N}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function Pe(e){return e.startsWith(N)}function Yl(e){if(!Pe(e))return null;let o=e.slice(N.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function $m(e){let o=Yl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var ce=0;function de(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let u=r.errors.get(t);if(u)u.set(i,a);else r.errors.set(t,new Map([[i,a]]))},C=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},b=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let u=r.inserts.get(t);if(u){if(a===null)delete u[i];else u[i]=a;return}if(zw(a,e.resolveBaseline(t,i))){let f=r.pending.get(t);if(f?.delete(i),f?.size===0)r.pending.delete(t);return}let y=r.pending.get(t);if(y)y.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},P=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let u=r.pending.get(t)?.get(i);return u?u.value:e.resolveBaseline(t,i)},O=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},M=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let u of a)M(u,i);break}}},F=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},x=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},E=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let u=a.ops.map((y)=>i(y)).filter((y)=>y!==null);return u.length>0?{kind:"group",ops:u}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let u=r.pending.get(a.rowKey);if(u?.delete(a.field),u?.size===0)r.pending.delete(a.rowKey);C(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)E((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[u,y]of a)t.push({baseline:e.resolveBaseline(i,u),field:u,rowKey:i,value:y.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:O,cellState(t,i){if(O(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),b({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),b({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),E((i)=>i===t)},effectiveValue:P,beginGroup:F,endGroup:x,group(t){F();try{t()}finally{x()}},insertRow(t={}){ce+=1;let i=`__new-${ce}`;return r.inserts.set(i,{...t}),b({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return M(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let u=P(t,i);if(zw(u,a))return;k(t,i,a),b({after:a,at:s(),before:u,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return M(t,"undo"),r.redoStack.push(t),!0}}}var ue={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function fe(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Ge(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Ra(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function pe(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Ww(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,C])=>{let b=r.has(c)?"readonly":Ge(C),k=Array.isArray(C.enum)?Math.max(...C.enum.map((P)=>String(P).length),4):0;return{editable:b!=="readonly",field:c,kind:b,pk:c===o.idField,required:l.has(c),schema:C,title:pe(c),widthHint:b==="enum"?fe(k+3):ue[b]}});return d.sort((c,C)=>{let b=(P)=>P.pk?0:P.required?1:2,k=b(c)-b(C);return k===0?0:k}),d}function Vw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((b)=>{let k=b[r];return k===null||k===void 0||k===""?[]:[k]}),c=Re(d),C=Math.max(...d.map((b)=>Qo(b).length),r.length,4);return{editable:!0,field:r,kind:c,title:pe(r),widthHint:c==="string"||c==="text"?fe(C):ue[c]}})}function Re(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Ze(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Y(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function Lp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Y(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Ze(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function Qo(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(_(e))return e.$ref;return String(e)}var WS="__key",H=new WeakMap;function er(e){return e?H.get(le(e))??null:null}function $p(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=de({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),C=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},b=(t)=>{let i=l.columns.filter((y)=>y.required&&y.editable);if(i.length===0)return null;let a=t.cells.filter((y)=>y.value===null&&i.some((f)=>f.field===y.field)).map((y)=>({error:"Required",field:y.field,ok:!1,rowKey:y.rowKey})),u=t.inserts.filter((y)=>i.some((f)=>y.cells[f.field]===null||y.cells[f.field]===void 0)).map((y)=>({error:`Missing required: ${i.filter((G)=>y.cells[G.field]===null||y.cells[G.field]===void 0).map((G)=>G.field).join(", ")}`,ok:!1,tempKey:y.tempKey}));if(a.length===0&&u.length===0)return null;return{cells:a,deletes:[],inserts:u}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,P=(t,i,a)=>{if(a==="number")return(Y(t)?t:0)-(Y(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Qo(t).localeCompare(Qo(i))},O=()=>{let t=l.rows.map((u)=>u.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let u=l.columns.find((f)=>f.field===a)?.kind,y=i==="desc"?-1:1;t=t.toSorted((f,G)=>{let R=c.effectiveValue(f,a),U=c.effectiveValue(G,a);if(k(R)!==k(U))return k(R)?1:-1;return y*P(R,U,u)})}return l.grouping?[...M(t).values()].flat():t},M=(t)=>{let i=new Map;for(let a of t){let u=Qo(c.effectiveValue(a,l.grouping)),y=i.get(u);if(y)y.push(a);else i.set(u,[a])}return i},F=null,x=()=>F?.refreshData(),E={addRow(t={}){let i=c.insertRow(t);return x(),i},bindView(t){F=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),x()},discardRow(t){c.discardRow(t),x()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((f)=>f.editable&&(f.kind==="string"||f.kind==="text")),u=[...l.rows.map((f)=>f.key),...c.state.inserts.keys()],y=0;if(c.group(()=>{for(let f of u){if(c.rowState(f)==="pending-delete")continue;for(let G of a){let R=c.effectiveValue(f,G.field);if(n(R)&&R.includes(t))c.setCell(f,G.field,R.replaceAll(t,i)),y+=1}}}),y>0)x();return y},effectiveRows(){let t=(u)=>Array.isArray(u)?[...u]:_(u)?{$ref:u.$ref}:u,i=(u)=>{let y=[[WS,u]];for(let f of l.columns)y.push([f.field,t(c.effectiveValue(u,f.field))]);return Object.fromEntries(y)},a=O().map((u)=>i(u));for(let[u]of c.state.inserts)a.push(i(u));return a},groups(){if(!l.grouping)return[];return[...M(O())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await C()}catch(t){l.error=X(t)}finally{l.loading=!1}x()},async refresh(){if(c.isDirty()){if(!await qo("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){w.info("No grid changes to save.",{key:"grid.save"});return}let a=b(t);if(a){c.applyCommitResult(a),w.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await qo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let y=new Set(t.cells.map((f)=>f.rowKey)).size+t.inserts.length+t.deletes.length>5?sl({title:"Saving grid"}):null;l.saving=!0;try{let f=await o.commit(t),G=(S,j)=>`${S}\x00${j}`,R=new Map(t.cells.map((S)=>[G(S.rowKey,S.field),S]));for(let S of f.cells){let j=R.get(G(S.rowKey,S.field));if(S.ok&&j){let ne=r.get(S.rowKey);if(ne)ne.cells[S.field]=j.value}}if(c.applyCommitResult(f),f.inserts.some((S)=>S.ok)||f.deletes.some((S)=>S.ok))await C();let L=f.cells.filter((S)=>S.ok).length+f.inserts.filter((S)=>S.ok).length+f.deletes.filter((S)=>S.ok).length,ee=i-L,re=f.cells.filter((S)=>S.stale).length+f.deletes.filter((S)=>S.stale).length;if(ee===0)w.success(`Saved ${L} change(s).`,{key:"grid.save"});else w.error(`Saved ${L} · ${ee} failed${re?` (${re} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(f){w.error("Could not save the grid.",{action:"file.save",detail:X(f),key:"grid.save",source:"Data"})}finally{l.saving=!1,y?.done(),x()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await C()}catch(i){l.error=X(i)}finally{l.loading=!1}x()},setGrouping(t){l.grouping=t,x()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,x();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{te(()=>{e.doc.dirty=c.isDirty()}),Zd(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),x()},undo:()=>{c.undo(),x()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let u=o.backingPaths(),y=new Set;for(let f of a){if(f.isDir)continue;let G=f.path.replaceAll("\\","/"),R=u.get(G);if(R!==void 0&&!Ud(G))y.add(R)}if(y.size===0)return;if(c.isDirty()){let f=y.has("*")?l.rows.map((G)=>G.key):[...y];c.markStale(f),w.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),x()}else E.refresh()});ia(i)}ia(()=>{Zd(e,null),H.delete(le(e)),o.dispose?.()})}),H.set(le(e),E),E}async function Ju(e){let s=er(e)?.serializeForSource();if(s)return s;await jt();let l=Wi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Oa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=lr();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,C={...d,...e.doc.document};return Oa(r.name,C,{frontmatter:c,mode:"roundtrip"})}}return Co(KO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Ee=200,Te=500,Oe=2097152,A=new Map,V=!1,I=null,T=null,B=null,Q=null;function Me(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function ge(){if(!ye())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Me()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await Ju(s)}catch{continue}if(r.length>Oe)continue;if(o.add(l),A.get(l)===r)continue;A.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of A.keys())if(!o.has(s))A.delete(s),await e.clearPreviewOverlay(s)}function he(){if(!V)return;let e=Date.now();if(B??=e,T)clearTimeout(T);let o=e-B,s=Math.max(0,Math.min(Ee,Te-o));T=setTimeout(()=>{T=null,B=null,Q=ge().finally(()=>{Q=null})},s)}function VN(){he()}function UN(){if(V)return;V=!0,I=me(),I.run(()=>{te(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;he()})})}function qN(){if(V=!1,T)clearTimeout(T),T=null;B=null,I?.stop(),I=null,A.clear()}async function US(){if(!V)return;if(T)clearTimeout(T),T=null,B=null;await Q,await ge()}var we=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,$e=new Set(["vnd","prs","x"]);function Fe(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!we.test(r)||!we.test(d))return null;let c=d.lastIndexOf("+"),C=c===-1?null:d.slice(c+1),b=c===-1?d:d.slice(0,c);if(C==="")return null;let k=b.indexOf("."),P=k===-1?null:b.slice(0,k),O=P!==null&&$e.has(P)?P:null,M=O===null?b:b.slice(O.length+1);if(M==="")return null;let F={};for(let x of s){let E=x.indexOf("=");if(E===-1)return null;let t=x.slice(0,E).trim().toLowerCase(),i=x.slice(E+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);F[t]=i}return{parameters:F,subtype:M,suffix:C,tree:O,type:r}}function Uw(e){let o=Fe(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var be="text/markdown; variant=GFM",ve="application/yaml",Tt={".markdown":`${be}; charset=utf-8`,".md":`${be}; charset=utf-8`,".yaml":`${ve}; charset=utf-8`,".yml":`${ve}; charset=utf-8`};async function GN(e,o){let s=await AI(e.name,o);return OI(e,s)}async function Fr(e,o){await jt();let s=fn(e);if(!s||!s.capabilities.parse)throw lf(e);return{...await GN(s,o),format:s}}var KT=async(e,o)=>{if(e.documentPath&&fn(e.documentPath)){let l=await Fr(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=Es(o);return e.doc.layout=s.layout,{document:s.document}};function De(e){return"showOpenFilePicker"in e}function Ne(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function vF(){try{await jt();let e=ou(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[Uw(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let C=c?await KN(r):null,b=fn(r);if(b){let{document:k,frontmatter:P}=await GN(b,d);Si({document:k,documentPath:C,fileHandle:c,frontmatter:P,id:r,source:d,sourceFormat:b.name})}else if(r.endsWith(".json")){let{document:k,layout:P}=Es(d);Si({document:k,documentPath:C,fileHandle:c,id:r,layout:P})}else throw lf(r)};if(De(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))w.error("Could not open the file.",{detail:X(e),source:"Open File"})}}var Ce=()=>{};function JT(e){Ce=e}function K(e){let o=e.doc.document;Ce(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?VS(o):null;if(s)w.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ae(e){return!zd(e.documentPath??"")}async function Ip(e=h.value){if(!e)return!1;if(await a$(e.id),ea(e))return w.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ae(e)){if(ka(e)===ls||al(e))return $L(e);return w.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1}let o=er(e);if(o)return await o.save(),!e.doc.dirty;try{if(await uI(e))return K(e),!0;let s=await Ju(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return US(),K(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return K(e),!0}w.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))w.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:X(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Be(e){return Wi(e.doc.sourceFormat)??(e.doc.mode==="content"?lr():void 0)}async function YT(){let e=h.value;if(!e)return;try{await jt();let o=Be(e),s=await Ju(e),l=o?Uw(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(Ne(window)){let C=e.documentPath?e.documentPath.split("/").pop():c,b=await window.showSaveFilePicker({suggestedName:C,types:[{accept:{[l]:[r]},description:d}]}),k=await b.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,K(e),w.success(`Exported as ${b.name}.`)}else{let C=new Blob([s],{type:l}),b=URL.createObjectURL(C),k=document.createElement("a");k.href=b,k.download=c,k.click(),URL.revokeObjectURL(b),e.doc.dirty=!1,K(e),w.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))w.error("Could not export the document.",{detail:X(o),source:"Export"})}}async function ke(e,o){let s=zd(e)?await Xu(e):await La({path:e});return oI(s,o)??""}async function Ab(e){let o=await ke(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await qo("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function Ob(e,o="rename"){let s=await ke(e,o);return s===""?void 0:s}
|
|
1
|
+
import{p,ye}from"./studio-4fnb5648.js";import{X}from"./studio-9c6cbq2c.js";import{La,oI}from"./studio-4zd6an2b.js";import{w,yl,sf}from"./studio-sce30r7b.js";import{KO,ea,uI,Ra,Z,Zd,Zm,_r,i0,o0,m,h,Si}from"./studio-knsjyx7n.js";import{jt,ou,Wi,lf,fn,lr,AI,Oa,OI}from"./studio-q9hx2qp0.js";import{Ud}from"./studio-bnc50f9h.js";import{zd}from"./studio-61rg2cz5.js";import{ls,al,$L,Xu}from"./studio-3pz4t5a2.js";import{UI,t2,n2,Ah,Bv}from"./studio-nzemfbkk.js";import{qo}from"./studio-tpxcryf2.js";import{ka,DA,a$}from"./studio-xva3hzkv.js";import{Es,Co}from"./studio-pwctzka3.js";import{sl}from"./studio-v7a7yb5w.js";import{KN}from"./studio-9gr7xs9r.js";import{oe}from"./studio-v5wktj6f.js";import{me,ia,te,g,le}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v}from"./studio-k3we3kqb.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function VS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:Bv,popoverTags:Ah},D="Popover",Se={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){yl((d)=>d.source===D);let s=new Map,l=t2(e,se);for(let d of l){let c=d.fix===void 0?void 0:Se[d.fix],C={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:D,tier:"problem"};if(c!==void 0)C.action=c,C.actionArgs={path:d.path};if(o!==void 0)C.path=o;w(d.severity,d.message,C)}let r=DA(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:D,tier:"problem"};if(o!==void 0)c.path=o;w(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=h.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function xe(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);w.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:D})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=sf(D),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=n2(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Z(l,(C)=>{for(let b of c.base)Zm(C,r,b,"");for(let b of c.breakpoints)o0(C,r,[b],"display","");if(c.openDisplay!==null)i0(C,r,":popover-open","display",c.openDisplay)}),w.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:D})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Z(l,(d)=>{_r(d,r,"popovertarget"),_r(d,r,"popovertargetaction")}),w.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:D})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Z(l,(d)=>{_r(d,r,"popover",UI)}),w.success(`Set \`popover\` to "${UI}".`,{key:"popover.repaired.mode",source:D})},title:"Set popover to auto",when:(e)=>e.document.open}]}function WN(e){e.registerAll(xe())}function zw(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(_(e)&&_(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var N="grid://",Nb={children:[],tagName:"div"};function ss(e){switch(e.kind){case"pages":return`${N}pages`;case"collection":return`${N}collection/${encodeURIComponent(e.name)}`;default:return`${N}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function Pe(e){return e.startsWith(N)}function Yl(e){if(!Pe(e))return null;let o=e.slice(N.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function $m(e){let o=Yl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var ce=0;function de(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let u=r.errors.get(t);if(u)u.set(i,a);else r.errors.set(t,new Map([[i,a]]))},C=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},b=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let u=r.inserts.get(t);if(u){if(a===null)delete u[i];else u[i]=a;return}if(zw(a,e.resolveBaseline(t,i))){let f=r.pending.get(t);if(f?.delete(i),f?.size===0)r.pending.delete(t);return}let y=r.pending.get(t);if(y)y.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},P=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let u=r.pending.get(t)?.get(i);return u?u.value:e.resolveBaseline(t,i)},O=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},M=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let u of a)M(u,i);break}}},F=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},x=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},E=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let u=a.ops.map((y)=>i(y)).filter((y)=>y!==null);return u.length>0?{kind:"group",ops:u}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let u=r.pending.get(a.rowKey);if(u?.delete(a.field),u?.size===0)r.pending.delete(a.rowKey);C(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)E((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[u,y]of a)t.push({baseline:e.resolveBaseline(i,u),field:u,rowKey:i,value:y.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:O,cellState(t,i){if(O(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),b({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),b({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),E((i)=>i===t)},effectiveValue:P,beginGroup:F,endGroup:x,group(t){F();try{t()}finally{x()}},insertRow(t={}){ce+=1;let i=`__new-${ce}`;return r.inserts.set(i,{...t}),b({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return M(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let u=P(t,i);if(zw(u,a))return;k(t,i,a),b({after:a,at:s(),before:u,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return M(t,"undo"),r.redoStack.push(t),!0}}}var ue={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function fe(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Ge(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Ra(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function pe(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Ww(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,C])=>{let b=r.has(c)?"readonly":Ge(C),k=Array.isArray(C.enum)?Math.max(...C.enum.map((P)=>String(P).length),4):0;return{editable:b!=="readonly",field:c,kind:b,pk:c===o.idField,required:l.has(c),schema:C,title:pe(c),widthHint:b==="enum"?fe(k+3):ue[b]}});return d.sort((c,C)=>{let b=(P)=>P.pk?0:P.required?1:2,k=b(c)-b(C);return k===0?0:k}),d}function Vw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((b)=>{let k=b[r];return k===null||k===void 0||k===""?[]:[k]}),c=Re(d),C=Math.max(...d.map((b)=>Qo(b).length),r.length,4);return{editable:!0,field:r,kind:c,title:pe(r),widthHint:c==="string"||c==="text"?fe(C):ue[c]}})}function Re(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Ze(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Y(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function Lp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Y(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Ze(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function Qo(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(_(e))return e.$ref;return String(e)}var WS="__key",H=new WeakMap;function er(e){return e?H.get(le(e))??null:null}function $p(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=de({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),C=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},b=(t)=>{let i=l.columns.filter((y)=>y.required&&y.editable);if(i.length===0)return null;let a=t.cells.filter((y)=>y.value===null&&i.some((f)=>f.field===y.field)).map((y)=>({error:"Required",field:y.field,ok:!1,rowKey:y.rowKey})),u=t.inserts.filter((y)=>i.some((f)=>y.cells[f.field]===null||y.cells[f.field]===void 0)).map((y)=>({error:`Missing required: ${i.filter((G)=>y.cells[G.field]===null||y.cells[G.field]===void 0).map((G)=>G.field).join(", ")}`,ok:!1,tempKey:y.tempKey}));if(a.length===0&&u.length===0)return null;return{cells:a,deletes:[],inserts:u}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,P=(t,i,a)=>{if(a==="number")return(Y(t)?t:0)-(Y(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Qo(t).localeCompare(Qo(i))},O=()=>{let t=l.rows.map((u)=>u.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let u=l.columns.find((f)=>f.field===a)?.kind,y=i==="desc"?-1:1;t=t.toSorted((f,G)=>{let R=c.effectiveValue(f,a),U=c.effectiveValue(G,a);if(k(R)!==k(U))return k(R)?1:-1;return y*P(R,U,u)})}return l.grouping?[...M(t).values()].flat():t},M=(t)=>{let i=new Map;for(let a of t){let u=Qo(c.effectiveValue(a,l.grouping)),y=i.get(u);if(y)y.push(a);else i.set(u,[a])}return i},F=null,x=()=>F?.refreshData(),E={addRow(t={}){let i=c.insertRow(t);return x(),i},bindView(t){F=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),x()},discardRow(t){c.discardRow(t),x()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((f)=>f.editable&&(f.kind==="string"||f.kind==="text")),u=[...l.rows.map((f)=>f.key),...c.state.inserts.keys()],y=0;if(c.group(()=>{for(let f of u){if(c.rowState(f)==="pending-delete")continue;for(let G of a){let R=c.effectiveValue(f,G.field);if(n(R)&&R.includes(t))c.setCell(f,G.field,R.replaceAll(t,i)),y+=1}}}),y>0)x();return y},effectiveRows(){let t=(u)=>Array.isArray(u)?[...u]:_(u)?{$ref:u.$ref}:u,i=(u)=>{let y=[[WS,u]];for(let f of l.columns)y.push([f.field,t(c.effectiveValue(u,f.field))]);return Object.fromEntries(y)},a=O().map((u)=>i(u));for(let[u]of c.state.inserts)a.push(i(u));return a},groups(){if(!l.grouping)return[];return[...M(O())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await C()}catch(t){l.error=X(t)}finally{l.loading=!1}x()},async refresh(){if(c.isDirty()){if(!await qo("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){w.info("No grid changes to save.",{key:"grid.save"});return}let a=b(t);if(a){c.applyCommitResult(a),w.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await qo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let y=new Set(t.cells.map((f)=>f.rowKey)).size+t.inserts.length+t.deletes.length>5?sl({title:"Saving grid"}):null;l.saving=!0;try{let f=await o.commit(t),G=(S,j)=>`${S}\x00${j}`,R=new Map(t.cells.map((S)=>[G(S.rowKey,S.field),S]));for(let S of f.cells){let j=R.get(G(S.rowKey,S.field));if(S.ok&&j){let ne=r.get(S.rowKey);if(ne)ne.cells[S.field]=j.value}}if(c.applyCommitResult(f),f.inserts.some((S)=>S.ok)||f.deletes.some((S)=>S.ok))await C();let L=f.cells.filter((S)=>S.ok).length+f.inserts.filter((S)=>S.ok).length+f.deletes.filter((S)=>S.ok).length,ee=i-L,re=f.cells.filter((S)=>S.stale).length+f.deletes.filter((S)=>S.stale).length;if(ee===0)w.success(`Saved ${L} change(s).`,{key:"grid.save"});else w.error(`Saved ${L} · ${ee} failed${re?` (${re} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(f){w.error("Could not save the grid.",{action:"file.save",detail:X(f),key:"grid.save",source:"Data"})}finally{l.saving=!1,y?.done(),x()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await C()}catch(i){l.error=X(i)}finally{l.loading=!1}x()},setGrouping(t){l.grouping=t,x()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,x();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{te(()=>{e.doc.dirty=c.isDirty()}),Zd(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),x()},undo:()=>{c.undo(),x()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let u=o.backingPaths(),y=new Set;for(let f of a){if(f.isDir)continue;let G=f.path.replaceAll("\\","/"),R=u.get(G);if(R!==void 0&&!Ud(G))y.add(R)}if(y.size===0)return;if(c.isDirty()){let f=y.has("*")?l.rows.map((G)=>G.key):[...y];c.markStale(f),w.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),x()}else E.refresh()});ia(i)}ia(()=>{Zd(e,null),H.delete(le(e)),o.dispose?.()})}),H.set(le(e),E),E}async function Ju(e){let s=er(e)?.serializeForSource();if(s)return s;await jt();let l=Wi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Oa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=lr();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,C={...d,...e.doc.document};return Oa(r.name,C,{frontmatter:c,mode:"roundtrip"})}}return Co(KO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Ee=200,Te=500,Oe=2097152,A=new Map,V=!1,I=null,T=null,B=null,Q=null;function Me(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function ge(){if(!ye())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Me()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await Ju(s)}catch{continue}if(r.length>Oe)continue;if(o.add(l),A.get(l)===r)continue;A.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of A.keys())if(!o.has(s))A.delete(s),await e.clearPreviewOverlay(s)}function he(){if(!V)return;let e=Date.now();if(B??=e,T)clearTimeout(T);let o=e-B,s=Math.max(0,Math.min(Ee,Te-o));T=setTimeout(()=>{T=null,B=null,Q=ge().finally(()=>{Q=null})},s)}function VN(){he()}function UN(){if(V)return;V=!0,I=me(),I.run(()=>{te(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;he()})})}function qN(){if(V=!1,T)clearTimeout(T),T=null;B=null,I?.stop(),I=null,A.clear()}async function US(){if(!V)return;if(T)clearTimeout(T),T=null,B=null;await Q,await ge()}var we=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,$e=new Set(["vnd","prs","x"]);function Fe(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!we.test(r)||!we.test(d))return null;let c=d.lastIndexOf("+"),C=c===-1?null:d.slice(c+1),b=c===-1?d:d.slice(0,c);if(C==="")return null;let k=b.indexOf("."),P=k===-1?null:b.slice(0,k),O=P!==null&&$e.has(P)?P:null,M=O===null?b:b.slice(O.length+1);if(M==="")return null;let F={};for(let x of s){let E=x.indexOf("=");if(E===-1)return null;let t=x.slice(0,E).trim().toLowerCase(),i=x.slice(E+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);F[t]=i}return{parameters:F,subtype:M,suffix:C,tree:O,type:r}}function Uw(e){let o=Fe(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var be="text/markdown; variant=GFM",ve="application/yaml",Tt={".markdown":`${be}; charset=utf-8`,".md":`${be}; charset=utf-8`,".yaml":`${ve}; charset=utf-8`,".yml":`${ve}; charset=utf-8`};async function GN(e,o){let s=await AI(e.name,o);return OI(e,s)}async function Fr(e,o){await jt();let s=fn(e);if(!s||!s.capabilities.parse)throw lf(e);return{...await GN(s,o),format:s}}var KT=async(e,o)=>{if(e.documentPath&&fn(e.documentPath)){let l=await Fr(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=Es(o);return e.doc.layout=s.layout,{document:s.document}};function De(e){return"showOpenFilePicker"in e}function Ne(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function vF(){try{await jt();let e=ou(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[Uw(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let C=c?await KN(r):null,b=fn(r);if(b){let{document:k,frontmatter:P}=await GN(b,d);Si({document:k,documentPath:C,fileHandle:c,frontmatter:P,id:r,source:d,sourceFormat:b.name})}else if(r.endsWith(".json")){let{document:k,layout:P}=Es(d);Si({document:k,documentPath:C,fileHandle:c,id:r,layout:P})}else throw lf(r)};if(De(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))w.error("Could not open the file.",{detail:X(e),source:"Open File"})}}var Ce=()=>{};function JT(e){Ce=e}function K(e){let o=e.doc.document;Ce(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?VS(o):null;if(s)w.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ae(e){return!zd(e.documentPath??"")}async function Ip(e=h.value){if(!e)return!1;if(await a$(e.id),ea(e))return w.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ae(e)){if(ka(e)===ls||al(e))return $L(e);return w.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1}let o=er(e);if(o)return await o.save(),!e.doc.dirty;try{if(await uI(e))return K(e),!0;let s=await Ju(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return US(),K(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return K(e),!0}w.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))w.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:X(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Be(e){return Wi(e.doc.sourceFormat)??(e.doc.mode==="content"?lr():void 0)}async function YT(){let e=h.value;if(!e)return;try{await jt();let o=Be(e),s=await Ju(e),l=o?Uw(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(Ne(window)){let C=e.documentPath?e.documentPath.split("/").pop():c,b=await window.showSaveFilePicker({suggestedName:C,types:[{accept:{[l]:[r]},description:d}]}),k=await b.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,K(e),w.success(`Exported as ${b.name}.`)}else{let C=new Blob([s],{type:l}),b=URL.createObjectURL(C),k=document.createElement("a");k.href=b,k.download=c,k.click(),URL.revokeObjectURL(b),e.doc.dirty=!1,K(e),w.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))w.error("Could not export the document.",{detail:X(o),source:"Export"})}}async function ke(e,o){let s=zd(e)?await Xu(e):await La({path:e});return oI(s,o)??""}async function Ab(e){let o=await ke(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await qo("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function Ob(e,o="rename"){let s=await ke(e,o);return s===""?void 0:s}
|
|
2
2
|
export{zw,Nb,ss,Yl,$m,Ww,Vw,Lp,Qo,WS,er,$p,VS,WN,Ju,VN,UN,qN,US,Uw,GN,Fr,KT,vF,JT,Ip,YT,Ab,Ob};
|
|
3
3
|
|
|
4
4
|
//# debugId=14BFBE1DB1928FD864756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
5
|
+
//# sourceMappingURL=studio-hfqpfmpk.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Bx,$a,ml,m,Si,Ft}from"./studio-
|
|
1
|
+
import{Bx,$a,ml,m,Si,Ft}from"./studio-knsjyx7n.js";import{cS,vw,JE}from"./studio-2x972v58.js";import{IE,RE,ID}from"./studio-2kpxm0eh.js";import{Y_,Z_,FE}from"./studio-2pk7kc7z.js";import{wT,xT,EN}from"./studio-nwf0c32p.js";var n={children:[],tagName:"div"},jP=new Set(Object.values(Bx));function z_(e){return jP.has(e)}function uE(e){let r=$a(e),o=m.tabs.get(r);if(o)return Ft(r),o;return Si({capabilities:{modes:[Bx[e]]},document:structuredClone(n),documentPath:null,id:r})}function hE(e,r){Si({background:!0,capabilities:{modes:[Bx[e]]},document:structuredClone(n),documentPath:null,id:$a(e),paneId:r})}function W_(e,r){let o=ml(r.id);if(o==="media")return cS(e,r);if(o==="content")return IE(e,r);if(o==="settings")return wT(e,r);return Y_(e,r)}function ob(e){vw(e),RE(e),Z_(e),xT(e)}function pE(e,r){let{paneId:o}=e;if(W_(o,r))return;ob(o);let t=ml(r.id);if(t==="media"){JE(e,r);return}if(t==="content"){ID(e,r);return}if(t==="settings"){EN(e,r);return}FE(e,r)}
|
|
2
2
|
export{jP,z_,uE,hE,W_,ob,pE};
|
|
3
3
|
|
|
4
4
|
//# debugId=1E3536E9E5D7AB6E64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
5
|
+
//# sourceMappingURL=studio-j5fcp6gj.js.map
|