@jxsuite/studio 5.7.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-cs2sb9t1.js → 2020-nkxms0ay.js} +3 -3
- package/dist/chunks/adapter-m948ab5f.js +4 -0
- package/dist/chunks/{cf-account-picker-882a7ecm.js → cf-account-picker-n8hr38v7.js} +3 -3
- package/dist/chunks/cf-settings-356xdtne.js +4 -0
- package/dist/chunks/components-yk3t844e.js +4 -0
- package/dist/chunks/content-source-bawmyc09.js +4 -0
- package/dist/chunks/{convert-to-repeater-grfep2w8.js → convert-to-repeater-7wns8kf1.js} +3 -3
- package/dist/chunks/editor-6sc8nacq.js +4 -0
- package/dist/chunks/entry-commands-8ay9fh81.js +4 -0
- package/dist/chunks/{extension-sections-dp8endhx.js → extension-sections-na7rj3nr.js} +3 -3
- package/dist/chunks/file-ops-gye0qw56.js +4 -0
- package/dist/chunks/files-dmc2xvcq.js +4 -0
- package/dist/chunks/format-host-t76b53f8.js +4 -0
- package/dist/chunks/fs-events-cg4tpz06.js +4 -0
- package/dist/chunks/git-panel-yef7bshy.js +4 -0
- package/dist/chunks/{grid-view-5amhg604.js → grid-view-7tt4bxw1.js} +6 -6
- package/dist/chunks/iframe-host-tmz30gfp.js +4 -0
- package/dist/chunks/{index-9ydfe04y.js → index-gybvv7a6.js} +3 -3
- package/dist/chunks/index-nag78a9h.js +4 -0
- package/dist/chunks/{javascript-d9pqgc2p.js → javascript-rnvdp3k4.js} +2 -2
- package/dist/chunks/{jsonMode-800yvbem.js → jsonMode-zhwsprqk.js} +5 -5
- package/dist/chunks/jx-validate-3gbp5nkn.js +4 -0
- package/dist/chunks/layers-fvz99859.js +4 -0
- package/dist/chunks/layers-panel-gchmbf9p.js +4 -0
- package/dist/chunks/lit-html-9agdspkt.js +4 -0
- package/dist/chunks/media-picker-rhjvyy00.js +4 -0
- package/dist/chunks/menu-2e4y9j7b.js +4 -0
- package/dist/chunks/{monaco-binding-62dtmgbf.js → monaco-binding-2jnhjjvr.js} +3 -3
- package/dist/chunks/monaco-buffer-rp21359g.js +4 -0
- package/dist/chunks/{monaco-setup-tj13ndtm.js → monaco-setup-vhh7gayr.js} +3 -3
- package/dist/chunks/notify-h3www560.js +4 -0
- package/dist/chunks/platform-hz34wcd7.js +4 -0
- package/dist/chunks/publish-panel-exsmjzyj.js +4 -0
- package/dist/chunks/quick-search-pgaqeh0m.js +4 -0
- package/dist/chunks/references-2cgdxnb8.js +4 -0
- package/dist/chunks/right-panel-jf856w5w.js +4 -0
- package/dist/chunks/section-registry-jnf8r5gy.js +4 -0
- package/dist/chunks/studio-0f55h9ye.js +5 -0
- package/dist/chunks/{studio-hjbg8d5y.js → studio-0sqdhnew.js} +7 -7
- package/dist/chunks/{studio-1wvfxkyy.js → studio-0x3jyb8r.js} +4 -4
- package/dist/chunks/{studio-yr04mv2j.js → studio-19x1c75w.js} +4 -4
- package/dist/chunks/{studio-evwgp1ym.js → studio-2sqcndak.js} +4 -4
- package/dist/chunks/{studio-cvbkkfqb.js → studio-3aey7dd3.js} +4 -4
- package/dist/chunks/{studio-888knnkc.js → studio-3bpdkq2s.js} +4 -4
- package/dist/chunks/{studio-ceb34dxj.js → studio-47y6fbpf.js} +4 -4
- package/dist/chunks/{studio-c6w3tq7t.js → studio-4m3826v2.js} +4 -4
- package/dist/chunks/studio-4nx2dj1g.js +4 -0
- package/dist/chunks/{studio-p7c1agz0.js → studio-4xv5s47r.js} +5 -5
- package/dist/chunks/{studio-sxc0zvpt.js → studio-5g0ag7c0.js} +3 -3
- package/dist/chunks/{studio-semd1s8s.js → studio-5g4t8v6w.js} +4 -4
- package/dist/chunks/studio-5py436sf.js +5 -0
- package/dist/chunks/{studio-aje966s9.js → studio-77kt594t.js} +4 -4
- package/dist/chunks/{studio-56z7evx4.js → studio-8f87n763.js} +6 -6
- package/dist/chunks/studio-8mb00b84.js +5 -0
- package/dist/chunks/studio-8p51gq2h.js +6 -0
- package/dist/chunks/studio-954ds834.js +5 -0
- package/dist/chunks/{studio-xta2vxp6.js → studio-9ft45c83.js} +6 -6
- package/dist/chunks/studio-a2138x5k.js +7 -0
- package/dist/chunks/studio-a9yzstqj.js +5 -0
- package/dist/chunks/{studio-gp02nqnw.js → studio-acdksxx6.js} +4 -4
- package/dist/chunks/{studio-edbtvcd1.js → studio-anyrgzvb.js} +4 -4
- package/dist/chunks/{studio-dkn3x3hz.js → studio-ar8jcf2y.js} +4 -4
- package/dist/chunks/{studio-xry7tk3z.js → studio-bmn4mn9j.js} +5 -5
- package/dist/chunks/{studio-03wwfvyt.js → studio-cpxkgjrj.js} +4 -4
- package/dist/chunks/{studio-spf2skgc.js → studio-e7xxa0sj.js} +4 -4
- package/dist/chunks/{studio-01qza1n3.js → studio-ecaz25vk.js} +4 -4
- package/dist/chunks/{studio-5e9zsamh.js → studio-fzdywr6p.js} +6 -6
- package/dist/chunks/{studio-65fhspdd.js → studio-g5fmf0c1.js} +4 -4
- package/dist/chunks/studio-g7nse7zb.js +5 -0
- package/dist/chunks/studio-geq1ea6k.js +14 -0
- package/dist/chunks/{studio-n78gjfy8.js → studio-ghkb32r8.js} +4 -4
- package/dist/chunks/{studio-222rqyyc.js → studio-ghrhy2y7.js} +4 -4
- package/dist/chunks/{studio-a7xqhc3n.js → studio-grawhey1.js} +4 -4
- package/dist/chunks/{studio-eh0rac07.js → studio-h0xgswew.js} +4 -4
- package/dist/chunks/{studio-wma2c6g8.js → studio-h9c4p2tx.js} +4 -4
- package/dist/chunks/studio-jyzj5cxs.js +5 -0
- package/dist/chunks/{studio-x92tgnee.js → studio-mgx8yhnz.js} +31 -31
- package/dist/chunks/{studio-0scebvb9.js → studio-mpb04y1d.js} +5 -5
- package/dist/chunks/{studio-xy3tv3az.js → studio-n17mty64.js} +4 -4
- package/dist/chunks/{studio-gfn1kpxj.js → studio-nwh2eqsk.js} +5 -5
- package/dist/chunks/{studio-nt06yybj.js → studio-pxg4ap1e.js} +3 -3
- package/dist/chunks/{studio-zpnk016a.js → studio-q1h883bt.js} +5 -5
- package/dist/chunks/{studio-c6zdm25z.js → studio-q4tv82h7.js} +6 -6
- package/dist/chunks/{studio-st75kn99.js → studio-qbj760tx.js} +5 -5
- package/dist/chunks/{studio-y7jehjrp.js → studio-qpqa7vk3.js} +4 -4
- package/dist/chunks/{studio-j6gnhvaa.js → studio-qqz8e5gk.js} +4 -4
- package/dist/chunks/{studio-skzanb0k.js → studio-qvasen3f.js} +4 -4
- package/dist/chunks/studio-rggdb3hm.js +5 -0
- package/dist/chunks/{studio-4xppwncr.js → studio-sghy936h.js} +3 -3
- package/dist/chunks/{studio-9mqfamps.js → studio-skprc6ef.js} +4 -4
- package/dist/chunks/{studio-1x8x26k3.js → studio-tt2nactf.js} +4 -4
- package/dist/chunks/{studio-54g077x3.js → studio-txjjzrsm.js} +5 -5
- package/dist/chunks/{studio-f195h2hq.js → studio-tyasmc39.js} +4 -4
- package/dist/chunks/{studio-0bbxhhce.js → studio-v2bvmbjj.js} +4 -4
- package/dist/chunks/{studio-pwqfmt4p.js → studio-vk9ezads.js} +4 -4
- package/dist/chunks/{studio-fqq890ap.js → studio-vzacdfsc.js} +3 -3
- package/dist/chunks/{studio-zd4kayn2.js → studio-w4c0xmrw.js} +4 -4
- package/dist/chunks/{studio-tw7rre6s.js → studio-wfjqhhbk.js} +4 -4
- package/dist/chunks/{studio-tp642n5g.js → studio-wgh5kxpj.js} +4 -4
- package/dist/chunks/studio-xasj0796.js +5 -0
- package/dist/chunks/{studio-tzegmy4w.js → studio-y78s8r2n.js} +4 -4
- package/dist/chunks/{studio-7pgy3xaf.js → studio-z8w183sh.js} +4 -4
- package/dist/chunks/{studio-01kbbqg3.js → studio-zscd9ty4.js} +124 -124
- package/dist/chunks/{studio-mwxgyn9h.js → studio-zxp13sss.js} +6 -6
- package/dist/chunks/{studio-r3kaka4d.js → studio-zygnmm01.js} +4 -4
- package/dist/chunks/{tsMode-k9s9fcag.js → tsMode-gr0m4dzr.js} +5 -5
- package/dist/chunks/workspace-m15qtcqp.js +4 -0
- package/dist/chunks/{ws-client-0ja08haa.js → ws-client-nf61frr1.js} +3 -3
- package/dist/iframe-entry.js +3 -3
- package/dist/manifest.json +62 -62
- package/dist/studio.js +83 -83
- package/package.json +11 -11
- package/src/new-project/add-repo-modal.ts +459 -59
- package/src/platforms/cloud.ts +95 -18
- package/src/publish/pages-service.ts +7 -0
- package/src/publish/publish-panel.ts +16 -2
- package/src/surfaces/add-repo.json +721 -224
- package/src/surfaces/add-repo.ts +196 -31
- package/src/types.ts +42 -3
- package/src/ui/schema-form.ts +6 -2
- package/src/utils/project-dir.ts +24 -0
- package/dist/chunks/adapter-y5gdq19c.js +0 -4
- package/dist/chunks/cf-settings-20dznc3j.js +0 -4
- package/dist/chunks/components-q037dya7.js +0 -4
- package/dist/chunks/content-source-37x3vsap.js +0 -4
- package/dist/chunks/editor-j5sq149q.js +0 -4
- package/dist/chunks/entry-commands-c5h3nqck.js +0 -4
- package/dist/chunks/file-ops-937cvqk6.js +0 -4
- package/dist/chunks/files-tznwe1p1.js +0 -4
- package/dist/chunks/format-host-e2pjvd25.js +0 -4
- package/dist/chunks/fs-events-fv64ak3s.js +0 -4
- package/dist/chunks/git-panel-gb713ttc.js +0 -4
- package/dist/chunks/iframe-host-t819mcg5.js +0 -4
- package/dist/chunks/index-m0x5ztax.js +0 -4
- package/dist/chunks/jx-validate-zc9zp77s.js +0 -4
- package/dist/chunks/layers-4bsr82wz.js +0 -4
- package/dist/chunks/layers-panel-b6shnaax.js +0 -4
- package/dist/chunks/lit-html-cfn61dn7.js +0 -4
- package/dist/chunks/media-picker-ej0kdh1j.js +0 -4
- package/dist/chunks/menu-rtxf9chb.js +0 -4
- package/dist/chunks/monaco-buffer-nn4dtx27.js +0 -4
- package/dist/chunks/notify-ahs57a2z.js +0 -4
- package/dist/chunks/platform-v9xyfkbx.js +0 -4
- package/dist/chunks/publish-panel-bq36xcmj.js +0 -4
- package/dist/chunks/quick-search-zm00h9dh.js +0 -4
- package/dist/chunks/references-99ws0b0m.js +0 -4
- package/dist/chunks/right-panel-pq2f71q3.js +0 -4
- package/dist/chunks/section-registry-b2yzp9sw.js +0 -4
- package/dist/chunks/studio-0k9mvpgj.js +0 -14
- package/dist/chunks/studio-1a99w39s.js +0 -5
- package/dist/chunks/studio-693nhyky.js +0 -5
- package/dist/chunks/studio-aqmph6k4.js +0 -5
- package/dist/chunks/studio-c9d3pxf7.js +0 -5
- package/dist/chunks/studio-cxt150pj.js +0 -7
- package/dist/chunks/studio-e6re3rk1.js +0 -5
- package/dist/chunks/studio-frb0qbf7.js +0 -6
- package/dist/chunks/studio-gh97gngt.js +0 -5
- package/dist/chunks/studio-nbxqcgvf.js +0 -5
- package/dist/chunks/studio-t1eedsyx.js +0 -4
- package/dist/chunks/studio-vavmwshr.js +0 -5
- package/dist/chunks/studio-xk0z6msk.js +0 -5
- package/dist/chunks/workspace-b69mgm0e.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p,We}from"./studio-y7jehjrp.js";import{te}from"./studio-ery42sqr.js";import{js,q1}from"./studio-yr04mv2j.js";import{ge,Xa,Q,v,re,k,tl,lh}from"./studio-fqq890ap.js";import{q,ym,kc,Ko,gv,bv,ma,_m,GC,m,u}from"./studio-cvbkkfqb.js";import{qt,wi,Lp,Zt,Dr,ck,Us,dk}from"./studio-1x8x26k3.js";import{hm}from"./studio-c6w3tq7t.js";import{kk,xI,_I,jd,jm}from"./studio-0k9mvpgj.js";import{Xo}from"./studio-spf2skgc.js";import{mc}from"./studio-9mqfamps.js";import{hs,pr}from"./studio-zpnk016a.js";import{la,Cb}from"./studio-xta2vxp6.js";import{vT,rC}from"./studio-ceb34dxj.js";import{wb}from"./studio-n78gjfy8.js";import{K}from"./studio-tp642n5g.js";var X={invokerTags:jm,popoverTags:jd},M="Popover",me={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function Z(e,r,o,n){let a=`${r}.${o}.${n.join("/")}`,l=e.get(a)??0;return e.set(a,l+1),l===0?a:`${a}#${l}`}function L(e,r){tl((l)=>l.source===M);let o=new Map,n=xI(e,X);for(let l of n){let g=l.fix===void 0?void 0:me[l.fix];k(l.severity,l.message,{detail:l.detail,key:Z(o,"popover",l.rule,l.path),source:M,tier:"problem",...g===void 0?{}:{action:g,actionArgs:{path:l.path}},...r===void 0?{}:{path:r}})}let a=vT(e,X);for(let l of a)k(l.severity,l.message,{detail:l.detail,key:Z(o,"dialog",l.rule,l.path),source:M,tier:"problem",...r===void 0?{}:{path:r}});return n.length+a.length}function z(e,r){let o=r?.path;if(!Array.isArray(o))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return o}function _(e){let r=u.value;if(!r)throw RangeError(`command "${e}" needs an open document`);return r}function ye(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=_("document.checkPopovers"),r=L(e.doc.document,e.documentPath??void 0);k.success(r===0?"No popover problems found in this document.":`${r} popover problem(s) filed.`,{key:"popover.run",source:M})},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=lh(M),r=e.length;return{data:e,summary:r===0?"No popover problems found in this document.":`Filed ${r} popover problem${r===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,r)=>{let n=_("document.repairPopoverDisplay"),a=z("document.repairPopoverDisplay",r),l=K(n.doc.document,a),g=_I(l?.style);if(!g)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);q(n,(h)=>{for(let y of g.base)kc(h,a,y,"");for(let y of g.breakpoints)bv(h,a,[y],"display","");if(g.openDisplay!==null)gv(h,a,":popover-open","display",g.openDisplay)}),k.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:M})},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,r)=>{let n=_("document.repairPopoverInvoker"),a=z("document.repairPopoverInvoker",r);q(n,(l)=>{Ko(l,a,"popovertarget"),Ko(l,a,"popovertargetaction")}),k.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:M})},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,r)=>{let n=_("document.repairPopoverMode"),a=z("document.repairPopoverMode",r);q(n,(l)=>{Ko(l,a,"popover",kk)}),k.success(`Set \`popover\` to "${kk}".`,{key:"popover.repaired.mode",source:M})},title:"Set popover to auto",when:(e)=>e.document.open}]}function jE(e){e.registerAll(ye())}function bb(e,r){if(e===r)return!0;if(Array.isArray(e)&&Array.isArray(r))return e.length===r.length&&e.every((o,n)=>o===r[n]);if(e!==null&&r!==null&&typeof e==="object"&&typeof r==="object"&&!Array.isArray(e)&&!Array.isArray(r))return e.$ref===r.$ref;return!1}var F="grid://";function ds(e){switch(e.kind){case"pages":return`${F}pages`;case"library":return`${F}library`;case"collection":return`${F}collection/${encodeURIComponent(e.name)}`;default:return`${F}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function he(e){return e.startsWith(F)}function Kf(e){if(!he(e))return null;let r=e.slice(F.length).split("/");if(r[0]==="pages"&&r.length===1)return{kind:"pages"};if(r[0]==="library"&&r.length===1)return{kind:"library"};if(r[0]==="collection"&&r.length===2&&r[1])return{kind:"collection",name:decodeURIComponent(r[1])};if(r[0]==="data"&&r.length===3&&r[1]&&r[2])return{connection:decodeURIComponent(r[1]),kind:"data",table:decodeURIComponent(r[2])};return null}function jw(e){let r=Kf(e);if(!r)return null;switch(r.kind){case"pages":return"Pages · grid";case"library":return"Library";case"collection":return`${r.name} · grid`;default:return`${r.table} @ ${r.connection} · grid`}}var ee=0;function ne(e){let r=e.coalesceMs??800,o=e.now??(()=>Date.now()),n=v({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),a=null,l=(t,i,s)=>{let d=n.errors.get(t);if(d)d.set(i,s);else n.errors.set(t,new Map([[i,s]]))},g=(t,i)=>{let s=n.errors.get(t);if(s?.delete(i),s?.size===0)n.errors.delete(t)},h=(t)=>{if(n.redoStack.length=0,a){a.push(t);return}let i=n.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=r){i.after=t.after,i.at=t.at;return}n.undoStack.push(t)},y=(t,i,s)=>{let d=n.inserts.get(t);if(d){if(s===null)delete d[i];else d[i]=s;return}if(bb(s,e.resolveBaseline(t,i))){let c=n.pending.get(t);if(c?.delete(i),c?.size===0)n.pending.delete(t);return}let f=n.pending.get(t);if(f)f.set(i,{value:s});else n.pending.set(t,new Map([[i,{value:s}]]))},b=(t,i)=>{let s=n.inserts.get(t);if(s)return s[i]??null;let d=n.pending.get(t)?.get(i);return d?d.value:e.resolveBaseline(t,i)},S=(t,i)=>{let s=n.errors.get(t);return s?.get(i)??s?.get("*")??null},G=(t,i)=>{switch(t.kind){case"cell":{y(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")n.inserts.delete(t.tempKey);else n.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")n.inserts.set(t.tempKey,{...t.cells});else n.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")n.deletes.delete(t.rowKey);else n.deletes.add(t.rowKey);break}default:{let s=i==="undo"?t.ops.toReversed():t.ops;for(let d of s)G(d,i);break}}},T=()=>{if(a)throw Error("edit-buffer: groups may not nest");a=[]},C=()=>{let t=a;if(a=null,!t)return;if(t.length===1)n.undoStack.push(t[0]);else if(t.length>1)n.undoStack.push({kind:"group",ops:t})},R=(t)=>{let i=(s)=>{switch(s.kind){case"cell":return t(s.rowKey)?null:s;case"insert":case"drop-insert":return t(s.tempKey)?null:s;case"delete":return t(s.rowKey)?null:s;default:{let d=s.ops.map((f)=>i(f)).filter((f)=>f!==null);return d.length>0?{kind:"group",ops:d}:null}}};n.undoStack=n.undoStack.map(i).filter((s)=>s!==null),n.redoStack=n.redoStack.map(i).filter((s)=>s!==null)};return{applyCommitResult(t){let i=new Set;for(let s of t.cells)if(s.ok){let d=n.pending.get(s.rowKey);if(d?.delete(s.field),d?.size===0)n.pending.delete(s.rowKey);g(s.rowKey,s.field)}else if(l(s.rowKey,s.field,s.error??"Save failed"),s.stale)n.stale.add(s.rowKey);for(let s of t.inserts)if(s.ok)n.inserts.delete(s.tempKey),n.errors.delete(s.tempKey),i.add(s.tempKey);else l(s.tempKey,"*",s.error??"Insert failed");for(let s of t.deletes)if(s.ok)n.deletes.delete(s.rowKey),n.pending.delete(s.rowKey),n.errors.delete(s.rowKey),i.add(s.rowKey);else if(l(s.rowKey,"*",s.error??"Delete failed"),s.stale)n.stale.add(s.rowKey);for(let s of i)n.stale.delete(s);if(i.size>0)R((s)=>i.has(s))},buildBatch(){let t=[];for(let[i,s]of n.pending){if(n.deletes.has(i))continue;for(let[d,f]of s)t.push({baseline:e.resolveBaseline(i,d),field:d,rowKey:i,value:f.value})}return{cells:t,deletes:[...n.deletes].map((i)=>({rowKey:i})),inserts:[...n.inserts].map(([i,s])=>({cells:{...s},tempKey:i}))}},canRedo:()=>n.redoStack.length>0,canUndo:()=>n.undoStack.length>0,cellError:S,cellState(t,i){if(S(t,i)!==null)return"error";if(n.stale.has(t))return"stale";if(n.inserts.has(t)||n.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(n.deletes.has(t))return;let i=n.inserts.get(t);if(i){let s={...i};n.inserts.delete(t),n.errors.delete(t),n.stale.delete(t),h({cells:s,kind:"drop-insert",tempKey:t});return}n.deletes.add(t),h({kind:"delete",rowKey:t})},dirtyCount(){let t=n.inserts.size+n.deletes.size;for(let[i,s]of n.pending)if(!n.deletes.has(i))t+=s.size;return t},discardRow(t){n.pending.delete(t),n.deletes.delete(t),n.inserts.delete(t),n.errors.delete(t),n.stale.delete(t),R((i)=>i===t)},effectiveValue:b,beginGroup:T,endGroup:C,group(t){T();try{t()}finally{C()}},insertRow(t={}){ee+=1;let i=`__new-${ee}`;return n.inserts.set(i,{...t}),h({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>n.pending.size>0||n.inserts.size>0||n.deletes.size>0,isInsertKey:(t)=>n.inserts.has(t),markStale(t){for(let i of t)n.stale.add(i)},redo(){let t=n.redoStack.pop();if(!t)return!1;return G(t,"redo"),n.undoStack.push(t),!0},reset(){n.pending.clear(),n.inserts.clear(),n.deletes.clear(),n.errors.clear(),n.stale.clear(),n.undoStack.length=0,n.redoStack.length=0},rowState(t){if(n.deletes.has(t))return"pending-delete";if(n.inserts.has(t))return"pending-insert";if(n.stale.has(t))return"stale";if(n.pending.has(t)||n.errors.has(t))return"dirty";return"clean"},setCell(t,i,s){let d=b(t,i);if(bb(d,s))return;y(t,i,s),h({after:s,at:o(),before:d,field:i,kind:"cell",rowKey:t})},state:n,undo(){let t=n.undoStack.pop();if(!t)return!1;return G(t,"undo"),n.redoStack.push(t),!0}}}var oe={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function ie(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function we(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let r=e.type==="array"?void 0:e.format;if(ma(r))return"image";if(r==="date"||r==="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 se(e){let r=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return r.charAt(0).toUpperCase()+r.slice(1)}function vb(e,r={}){let o=Object.entries(e?.properties??{}),n=new Set(e?.required),a=new Set(r.readonlyFields),l=o.map(([g,h])=>{let y=a.has(g)?"readonly":we(h),b=Array.isArray(h.enum)?Math.max(...h.enum.map((S)=>String(S).length),4):0;return{editable:y!=="readonly",field:g,kind:y,pk:g===r.idField,required:n.has(g),schema:h,title:se(g),widthHint:y==="enum"?ie(b+3):oe[y]}});return l.sort((g,h)=>{let y=(S)=>S.pk?0:S.required?1:2,b=y(g)-y(h);return b===0?0:b}),l}function yb(e,r=50){let o=e.slice(0,r),n=[];for(let a of o)for(let l of Object.keys(a))if(!n.includes(l))n.push(l);return n.map((a)=>{let l=o.map((y)=>y[a]).filter((y)=>y!==null&&y!==void 0&&y!==""),g=be(l),h=Math.max(...l.map((y)=>Io(y).length),a.length,4);return{editable:!0,field:a,kind:g,title:se(a),widthHint:g==="string"||g==="text"?ie(h):oe[g]}})}function be(e){if(e.length===0)return"string";if(e.some((o)=>Array.isArray(o)))return"array";let r=e.map(String);if(e.every((o)=>typeof o==="boolean")||r.every((o)=>/^(true|false)$/i.test(o)))return"boolean";if(e.every((o)=>typeof o==="number")||r.every((o)=>o.trim()!==""&&!Number.isNaN(Number(o.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(r.every((o)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(o)))return"date";if(r.some((o)=>o.length>200))return"text";return"string"}function Iu(e,r){if(e===null||e===void 0)return null;switch(r.kind){case"number":{if(typeof e==="number")return Number.isNaN(e)?null:e;let o=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(o==="")return null;let n=Number(o);return Number.isNaN(n)?null:n}case"boolean":{if(typeof e==="boolean")return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let o=String(e).trim();return o===""?[]:o.split(",").map((n)=>n.trim()).filter(Boolean)}case"reference":{if(typeof e==="object"&&e!==null&&"$ref"in e){let n=e.$ref;return typeof n==="string"&&n!==""?n:null}let o=String(e).trim();return o===""?null:o}default:{let o=String(e);return o===""?null:o}}}function Io(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(typeof e==="object")return e.$ref;return String(e)}var Hw="__key",U=new WeakMap;function Ha(e){return e?U.get(re(e))??null:null}function Ru(e,r){let o=v({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),n=new Map,a=(t)=>{n=new Map(t.map((i)=>[i.key,i]))},l=ne({resolveBaseline:(t,i)=>n.get(t)?.cells[i]??null}),g=async()=>{let t=await r.rows(o.query);o.rows=t.rows,o.total=t.total,a(t.rows)},h=(t)=>{let i=o.columns.filter((f)=>f.required&&f.editable);if(i.length===0)return null;let s=t.cells.filter((f)=>f.value===null&&i.some((c)=>c.field===f.field)).map((f)=>({error:"Required",field:f.field,ok:!1,rowKey:f.rowKey})),d=t.inserts.filter((f)=>i.some((c)=>f.cells[c.field]===null||f.cells[c.field]===void 0)).map((f)=>({error:`Missing required: ${i.filter((x)=>f.cells[x.field]===null||f.cells[x.field]===void 0).map((x)=>x.field).join(", ")}`,ok:!1,tempKey:f.tempKey}));if(s.length===0&&d.length===0)return null;return{cells:s,deletes:[],inserts:d}},y=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,b=(t,i,s)=>{if(s==="number")return(typeof t==="number"?t:0)-(typeof i==="number"?i:0);if(s==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Io(t).localeCompare(Io(i))},S=()=>{let t=o.rows.map((d)=>d.key),{dir:i,orderBy:s}=o.query;if(s&&!r.capabilities.remoteSort){let d=o.columns.find((c)=>c.field===s)?.kind,f=i==="desc"?-1:1;t=t.toSorted((c,x)=>{let P=l.effectiveValue(c,s),j=l.effectiveValue(x,s);if(y(P)!==y(j))return y(P)?1:-1;return f*b(P,j,d)})}return o.grouping?[...G(t).values()].flat():t},G=(t)=>{let i=new Map;for(let s of t){let d=Io(l.effectiveValue(s,o.grouping)),f=i.get(d);if(f)f.push(s);else i.set(d,[s])}return i},T=null,C=()=>T?.refreshData(),R={addRow(t={}){let i=l.insertRow(t);return C(),i},bindView(t){T=t},buffer:l,deleteRows(t){if(t.length===0)return;l.group(()=>{for(let i of t)l.deleteRow(i)}),C()},discardRow(t){l.discardRow(t),C()},replaceAll(t,i){if(t==="")return 0;let s=o.columns.filter((c)=>c.editable&&(c.kind==="string"||c.kind==="text")),d=[...o.rows.map((c)=>c.key),...l.state.inserts.keys()],f=0;if(l.group(()=>{for(let c of d){if(l.rowState(c)==="pending-delete")continue;for(let x of s){let P=l.effectiveValue(c,x.field);if(typeof P==="string"&&P.includes(t))l.setCell(c,x.field,P.replaceAll(t,i)),f+=1}}}),f>0)C();return f},effectiveRows(){let t=(d)=>Array.isArray(d)?[...d]:d!==null&&typeof d==="object"?{$ref:d.$ref}:d,i=(d)=>{let f={[Hw]:d};for(let c of o.columns)f[c.field]=t(l.effectiveValue(d,c.field));return f},s=S().map((d)=>i(d));for(let[d]of l.state.inserts)s.push(i(d));return s},groups(){if(!o.grouping)return[];return[...G(S())].map(([t,i])=>({count:i.length,value:t}))},async load(){o.loading=!0,o.error=null;try{o.columns=await r.columns(),await g()}catch(t){o.error=te(t)}finally{o.loading=!1}C()},async refresh(){if(l.isDirty()){if(!await Xo("Refresh Grid",`Discard ${l.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}l.reset(),await r.refresh?.(),await this.load()},async save(){if(o.saving)return;let t=l.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){k.info("No grid changes to save.",{key:"grid.save"});return}let s=h(t);if(s){l.applyCommitResult(s),k.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 Xo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let f=new Set(t.cells.map((c)=>c.rowKey)).size+t.inserts.length+t.deletes.length>5?la({title:"Saving grid"}):null;o.saving=!0;try{let c=await r.commit(t),x=(w,V)=>`${w}\x00${V}`,P=new Map(t.cells.map((w)=>[x(w.rowKey,w.field),w]));for(let w of c.cells){let V=P.get(x(w.rowKey,w.field));if(w.ok&&V){let Y=n.get(w.rowKey);if(Y)Y.cells[w.field]=V.value}}if(l.applyCommitResult(c),c.inserts.some((w)=>w.ok)||c.deletes.some((w)=>w.ok))await g();let I=c.cells.filter((w)=>w.ok).length+c.inserts.filter((w)=>w.ok).length+c.deletes.filter((w)=>w.ok).length,H=i-I,W=c.cells.filter((w)=>w.stale).length+c.deletes.filter((w)=>w.stale).length;if(H===0)k.success(`Saved ${I} change(s).`,{key:"grid.save"});else k.error(`Saved ${I} · ${H} failed${W?` (${W} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(c){k.error("Could not save the grid.",{action:"file.save",detail:te(c),key:"grid.save",source:"Data"})}finally{o.saving=!1,f?.done(),C()}},serializeForSource(){if(!r.serializeForSource)return null;return r.serializeForSource(l.buildBatch())},async setQuery(t){o.query=t,o.loading=!0;try{await g()}catch(i){o.error=te(i)}finally{o.loading=!1}C()},setGrouping(t){o.grouping=t,C()},async setSort(t){let i={...o.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!r.capabilities.remoteSort){o.query=i,C();return}await this.setQuery(i)},source:r,state:o,tab:e};return e.scope.run(()=>{Q(()=>{e.doc.dirty=l.isDirty()}),ym(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo(),C()},undo:()=>{l.undo(),C()}});let t=p();if(t.subscribeFileEvents&&r.backingPaths){let i=t.subscribeFileEvents((s)=>{let d=r.backingPaths(),f=new Set;for(let c of s){if(c.isDir)continue;let x=c.path.replaceAll("\\","/"),P=d.get(x);if(P!==void 0&&!mc(x))f.add(P)}if(f.size===0)return;if(l.isDirty()){let c=f.has("*")?o.rows.map((x)=>x.key):[...f];l.markStale(c),k.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),C()}else R.refresh()});Xa(i)}Xa(()=>{ym(e,null),U.delete(re(e)),r.dispose?.()})}),U.set(re(e),R),R}async function md(e){let o=Ha(e)?.serializeForSource();if(o)return o;await qt();let n=wi(e.doc.sourceFormat);if(n?.capabilities.serialize){let a=e.doc.content?.frontmatter||{},l=e.doc.document,g={...a,...l,children:l.children??[]};return Us(n.name,g,{mode:"roundtrip"})}if(e.doc.mode==="content"){let a=Dr();if(a){let l=e.doc.content?.frontmatter??{},g=Object.keys(l).length>0,h={...l,...e.doc.document};return Us(a.name,h,{frontmatter:g,mode:"roundtrip"})}}return pr(e.doc.document,e.doc.layout??null)}var ve=200,ke=500,Ce=2097152,D=new Map,B=!1,N=null,E=null,O=null,J=null;function xe(){let e=[];for(let r of m.tabs.values())if(r.doc.dirty&&r.documentPath)e.push(r);return e}async function le(){if(!We())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let r=new Set;for(let o of xe()){let n=o.documentPath.replace(/^\.\//,""),a;try{a=await md(o)}catch{continue}if(a.length>Ce)continue;if(r.add(n),D.get(n)===a)continue;D.set(n,a),await e.setPreviewOverlay(n,a)}for(let o of D.keys())if(!r.has(o))D.delete(o),await e.clearPreviewOverlay(o)}function ae(){if(!B)return;let e=Date.now();if(O??=e,E)clearTimeout(E);let r=e-O,o=Math.max(0,Math.min(ve,ke-r));E=setTimeout(()=>{E=null,O=null,J=le().finally(()=>{J=null})},o)}function HE(){ae()}function BE(){if(B)return;B=!0,N=ge(),N.run(()=>{Q(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;ae()})})}function zE(){if(B=!1,E)clearTimeout(E),E=null;O=null,N?.stop(),N=null,D.clear()}async function Bw(){if(!B)return;if(E)clearTimeout(E),E=null,O=null;await J,await le()}var de=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Se=new Set(["vnd","prs","x"]);function Pe(e){if(typeof e!=="string")return null;let[r,...o]=e.split(";"),n=(r??"").indexOf("/");if(n===-1)return null;let a=(r??"").slice(0,n).trim().toLowerCase(),l=(r??"").slice(n+1).trim().toLowerCase();if(!de.test(a)||!de.test(l))return null;let g=l.lastIndexOf("+"),h=g===-1?null:l.slice(g+1),y=g===-1?l:l.slice(0,g);if(h==="")return null;let b=y.indexOf("."),S=b===-1?null:y.slice(0,b),G=S!==null&&Se.has(S)?S:null,T=G===null?y:y.slice(G.length+1);if(T==="")return null;let C={};for(let R of o){let t=R.indexOf("=");if(t===-1)return null;let i=R.slice(0,t).trim().toLowerCase(),s=R.slice(t+1).trim();if(i==="")return null;if(s.startsWith('"')&&s.endsWith('"')&&s.length>=2)s=s.slice(1,-1);C[i]=s}return{parameters:C,subtype:T,suffix:h,tree:G,type:a}}function zw(e){let r=Pe(e);if(r===null)return null;let o=r.tree===null?"":`${r.tree}.`,n=r.suffix===null?"":`+${r.suffix}`;return`${r.type}/${o}${r.subtype}${n}`}var ce="text/markdown; variant=GFM",ue="application/yaml",ct={".markdown":`${ce}; charset=utf-8`,".md":`${ce}; charset=utf-8`,".yaml":`${ue}; charset=utf-8`,".yml":`${ue}; charset=utf-8`};async function Ge(e,r){let o=await ck(e.name,r);return dk(e,o)}async function Er(e,r){await qt();let o=Zt(e);if(!o||!o.capabilities.parse)throw Lp(e);return{...await Ge(o,r),format:o}}var D1=async(e,r)=>{if(e.documentPath&&Zt(e.documentPath)){let n=await Er(e.documentPath,r);return{document:n.document,frontmatter:n.frontmatter}}let o=hs(r);return e.doc.layout=o.layout,{document:o.document}};var fe=()=>{};function A1(e){fe=e}function A(e){let r=e.doc.document;fe(e.documentPath,r);let o=typeof r.tagName==="string"&&r.tagName.includes("-")?wb(r):null;if(o)k.warn(o,{key:`slots:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Components",tier:"problem"});L(r,e.documentPath??void 0)}function Re(e){return!hm(e.documentPath??"")}async function op(e=u.value){if(!e)return!1;if(await rC(e.id),_m(e))return k.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Collaboration"}),!1;if(!Re(e))return k.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,{key:`save.notADocument:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Save"}),!1;let r=Ha(e);if(r)return await r.save(),!e.doc.dirty;try{if(await GC(e))return A(e),!0;let o=await md(e);if(e.documentPath)return await p().writeFile(e.documentPath,o),e.doc.dirty=!1,Bw(),A(e),!0;if(e.fileHandle&&"createWritable"in e.fileHandle){let n=await e.fileHandle.createWritable();return await n.write(o),await n.close(),e.doc.dirty=!1,A(e),!0}k.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))k.error(`Could not save ${e.documentPath??e.id}.`,{action:"file.save",detail:te(o),key:`save:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Save"})}return!1}function Ee(e){return wi(e.doc.sourceFormat)??(e.doc.mode==="content"?Dr():void 0)}async function N1(){let e=u.value;if(!e)return;try{await qt();let r=Ee(e),o=await md(e),n=r?zw(r.mediaType)??"text/plain":"application/json",a=r?r.extensions[0]:".json",l=r?r.name:"Jx Component",g=r?`content${a}`:"component.json";if("showSaveFilePicker"in window){let h=e.documentPath?e.documentPath.split("/").pop():g,y=await window.showSaveFilePicker({suggestedName:h,types:[{accept:{[n]:[a]},description:l}]}),b=await y.createWritable();await b.write(o),await b.close(),e.doc.dirty=!1,A(e),k.success(`Exported as ${y.name}.`)}else{let h=new Blob([o],{type:n}),y=URL.createObjectURL(h),b=document.createElement("a");b.href=y,b.download=g,b.click(),URL.revokeObjectURL(y),e.doc.dirty=!1,A(e),k.success(`Downloaded ${g}.`)}}catch(r){if(!(r instanceof Error&&r.name==="AbortError"))k.error("Could not export the document.",{detail:te(r),source:"Export"})}}async function pe(e,r){let o=hm(e)?await Cb(e):await js({path:e});return q1(o,r)??""}async function Jf(e){let r=await pe(e.path,"delete"),o=`Delete ${e.name}? This cannot be undone.`;return Boolean(await Xo("Delete File",r===""?o:`${o} ${r}`,{confirmLabel:"Delete",destructive:!0}))}async function Yf(e,r="rename"){let o=await pe(e,r);return o===""?void 0:o}
|
|
2
|
-
export{
|
|
1
|
+
import{p,We}from"./studio-qpqa7vk3.js";import{te}from"./studio-ery42sqr.js";import{js,K1}from"./studio-19x1c75w.js";import{ge,Qa,Q,v,re,k,nl,ch}from"./studio-vzacdfsc.js";import{q,wm,Sc,Ko,bv,vv,ma,Cm,JC,m,u}from"./studio-3aey7dd3.js";import{qt,wi,Ip,Zt,Dr,uk,Us,hk}from"./studio-tt2nactf.js";import{pm}from"./studio-4m3826v2.js";import{Ek,CI,kI,Hd,Hm}from"./studio-geq1ea6k.js";import{Xo}from"./studio-e7xxa0sj.js";import{gc}from"./studio-skprc6ef.js";import{hs,pr}from"./studio-q1h883bt.js";import{la,kb}from"./studio-9ft45c83.js";import{wT,aC}from"./studio-47y6fbpf.js";import{xb}from"./studio-ghkb32r8.js";import{K}from"./studio-wgh5kxpj.js";var X={invokerTags:Hm,popoverTags:Hd},M="Popover",me={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function Z(e,r,o,n){let a=`${r}.${o}.${n.join("/")}`,l=e.get(a)??0;return e.set(a,l+1),l===0?a:`${a}#${l}`}function L(e,r){nl((l)=>l.source===M);let o=new Map,n=CI(e,X);for(let l of n){let g=l.fix===void 0?void 0:me[l.fix];k(l.severity,l.message,{detail:l.detail,key:Z(o,"popover",l.rule,l.path),source:M,tier:"problem",...g===void 0?{}:{action:g,actionArgs:{path:l.path}},...r===void 0?{}:{path:r}})}let a=wT(e,X);for(let l of a)k(l.severity,l.message,{detail:l.detail,key:Z(o,"dialog",l.rule,l.path),source:M,tier:"problem",...r===void 0?{}:{path:r}});return n.length+a.length}function z(e,r){let o=r?.path;if(!Array.isArray(o))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return o}function _(e){let r=u.value;if(!r)throw RangeError(`command "${e}" needs an open document`);return r}function ye(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=_("document.checkPopovers"),r=L(e.doc.document,e.documentPath??void 0);k.success(r===0?"No popover problems found in this document.":`${r} popover problem(s) filed.`,{key:"popover.run",source:M})},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=ch(M),r=e.length;return{data:e,summary:r===0?"No popover problems found in this document.":`Filed ${r} popover problem${r===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,r)=>{let n=_("document.repairPopoverDisplay"),a=z("document.repairPopoverDisplay",r),l=K(n.doc.document,a),g=kI(l?.style);if(!g)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);q(n,(h)=>{for(let y of g.base)Sc(h,a,y,"");for(let y of g.breakpoints)vv(h,a,[y],"display","");if(g.openDisplay!==null)bv(h,a,":popover-open","display",g.openDisplay)}),k.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:M})},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,r)=>{let n=_("document.repairPopoverInvoker"),a=z("document.repairPopoverInvoker",r);q(n,(l)=>{Ko(l,a,"popovertarget"),Ko(l,a,"popovertargetaction")}),k.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:M})},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,r)=>{let n=_("document.repairPopoverMode"),a=z("document.repairPopoverMode",r);q(n,(l)=>{Ko(l,a,"popover",Ek)}),k.success(`Set \`popover\` to "${Ek}".`,{key:"popover.repaired.mode",source:M})},title:"Set popover to auto",when:(e)=>e.document.open}]}function BE(e){e.registerAll(ye())}function vb(e,r){if(e===r)return!0;if(Array.isArray(e)&&Array.isArray(r))return e.length===r.length&&e.every((o,n)=>o===r[n]);if(e!==null&&r!==null&&typeof e==="object"&&typeof r==="object"&&!Array.isArray(e)&&!Array.isArray(r))return e.$ref===r.$ref;return!1}var F="grid://";function ds(e){switch(e.kind){case"pages":return`${F}pages`;case"library":return`${F}library`;case"collection":return`${F}collection/${encodeURIComponent(e.name)}`;default:return`${F}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function he(e){return e.startsWith(F)}function Jf(e){if(!he(e))return null;let r=e.slice(F.length).split("/");if(r[0]==="pages"&&r.length===1)return{kind:"pages"};if(r[0]==="library"&&r.length===1)return{kind:"library"};if(r[0]==="collection"&&r.length===2&&r[1])return{kind:"collection",name:decodeURIComponent(r[1])};if(r[0]==="data"&&r.length===3&&r[1]&&r[2])return{connection:decodeURIComponent(r[1]),kind:"data",table:decodeURIComponent(r[2])};return null}function Hw(e){let r=Jf(e);if(!r)return null;switch(r.kind){case"pages":return"Pages · grid";case"library":return"Library";case"collection":return`${r.name} · grid`;default:return`${r.table} @ ${r.connection} · grid`}}var ee=0;function ne(e){let r=e.coalesceMs??800,o=e.now??(()=>Date.now()),n=v({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),a=null,l=(t,i,s)=>{let d=n.errors.get(t);if(d)d.set(i,s);else n.errors.set(t,new Map([[i,s]]))},g=(t,i)=>{let s=n.errors.get(t);if(s?.delete(i),s?.size===0)n.errors.delete(t)},h=(t)=>{if(n.redoStack.length=0,a){a.push(t);return}let i=n.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=r){i.after=t.after,i.at=t.at;return}n.undoStack.push(t)},y=(t,i,s)=>{let d=n.inserts.get(t);if(d){if(s===null)delete d[i];else d[i]=s;return}if(vb(s,e.resolveBaseline(t,i))){let c=n.pending.get(t);if(c?.delete(i),c?.size===0)n.pending.delete(t);return}let f=n.pending.get(t);if(f)f.set(i,{value:s});else n.pending.set(t,new Map([[i,{value:s}]]))},b=(t,i)=>{let s=n.inserts.get(t);if(s)return s[i]??null;let d=n.pending.get(t)?.get(i);return d?d.value:e.resolveBaseline(t,i)},S=(t,i)=>{let s=n.errors.get(t);return s?.get(i)??s?.get("*")??null},G=(t,i)=>{switch(t.kind){case"cell":{y(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")n.inserts.delete(t.tempKey);else n.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")n.inserts.set(t.tempKey,{...t.cells});else n.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")n.deletes.delete(t.rowKey);else n.deletes.add(t.rowKey);break}default:{let s=i==="undo"?t.ops.toReversed():t.ops;for(let d of s)G(d,i);break}}},T=()=>{if(a)throw Error("edit-buffer: groups may not nest");a=[]},C=()=>{let t=a;if(a=null,!t)return;if(t.length===1)n.undoStack.push(t[0]);else if(t.length>1)n.undoStack.push({kind:"group",ops:t})},R=(t)=>{let i=(s)=>{switch(s.kind){case"cell":return t(s.rowKey)?null:s;case"insert":case"drop-insert":return t(s.tempKey)?null:s;case"delete":return t(s.rowKey)?null:s;default:{let d=s.ops.map((f)=>i(f)).filter((f)=>f!==null);return d.length>0?{kind:"group",ops:d}:null}}};n.undoStack=n.undoStack.map(i).filter((s)=>s!==null),n.redoStack=n.redoStack.map(i).filter((s)=>s!==null)};return{applyCommitResult(t){let i=new Set;for(let s of t.cells)if(s.ok){let d=n.pending.get(s.rowKey);if(d?.delete(s.field),d?.size===0)n.pending.delete(s.rowKey);g(s.rowKey,s.field)}else if(l(s.rowKey,s.field,s.error??"Save failed"),s.stale)n.stale.add(s.rowKey);for(let s of t.inserts)if(s.ok)n.inserts.delete(s.tempKey),n.errors.delete(s.tempKey),i.add(s.tempKey);else l(s.tempKey,"*",s.error??"Insert failed");for(let s of t.deletes)if(s.ok)n.deletes.delete(s.rowKey),n.pending.delete(s.rowKey),n.errors.delete(s.rowKey),i.add(s.rowKey);else if(l(s.rowKey,"*",s.error??"Delete failed"),s.stale)n.stale.add(s.rowKey);for(let s of i)n.stale.delete(s);if(i.size>0)R((s)=>i.has(s))},buildBatch(){let t=[];for(let[i,s]of n.pending){if(n.deletes.has(i))continue;for(let[d,f]of s)t.push({baseline:e.resolveBaseline(i,d),field:d,rowKey:i,value:f.value})}return{cells:t,deletes:[...n.deletes].map((i)=>({rowKey:i})),inserts:[...n.inserts].map(([i,s])=>({cells:{...s},tempKey:i}))}},canRedo:()=>n.redoStack.length>0,canUndo:()=>n.undoStack.length>0,cellError:S,cellState(t,i){if(S(t,i)!==null)return"error";if(n.stale.has(t))return"stale";if(n.inserts.has(t)||n.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(n.deletes.has(t))return;let i=n.inserts.get(t);if(i){let s={...i};n.inserts.delete(t),n.errors.delete(t),n.stale.delete(t),h({cells:s,kind:"drop-insert",tempKey:t});return}n.deletes.add(t),h({kind:"delete",rowKey:t})},dirtyCount(){let t=n.inserts.size+n.deletes.size;for(let[i,s]of n.pending)if(!n.deletes.has(i))t+=s.size;return t},discardRow(t){n.pending.delete(t),n.deletes.delete(t),n.inserts.delete(t),n.errors.delete(t),n.stale.delete(t),R((i)=>i===t)},effectiveValue:b,beginGroup:T,endGroup:C,group(t){T();try{t()}finally{C()}},insertRow(t={}){ee+=1;let i=`__new-${ee}`;return n.inserts.set(i,{...t}),h({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>n.pending.size>0||n.inserts.size>0||n.deletes.size>0,isInsertKey:(t)=>n.inserts.has(t),markStale(t){for(let i of t)n.stale.add(i)},redo(){let t=n.redoStack.pop();if(!t)return!1;return G(t,"redo"),n.undoStack.push(t),!0},reset(){n.pending.clear(),n.inserts.clear(),n.deletes.clear(),n.errors.clear(),n.stale.clear(),n.undoStack.length=0,n.redoStack.length=0},rowState(t){if(n.deletes.has(t))return"pending-delete";if(n.inserts.has(t))return"pending-insert";if(n.stale.has(t))return"stale";if(n.pending.has(t)||n.errors.has(t))return"dirty";return"clean"},setCell(t,i,s){let d=b(t,i);if(vb(d,s))return;y(t,i,s),h({after:s,at:o(),before:d,field:i,kind:"cell",rowKey:t})},state:n,undo(){let t=n.undoStack.pop();if(!t)return!1;return G(t,"undo"),n.redoStack.push(t),!0}}}var oe={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function ie(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function we(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let r=e.type==="array"?void 0:e.format;if(ma(r))return"image";if(r==="date"||r==="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 se(e){let r=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return r.charAt(0).toUpperCase()+r.slice(1)}function yb(e,r={}){let o=Object.entries(e?.properties??{}),n=new Set(e?.required),a=new Set(r.readonlyFields),l=o.map(([g,h])=>{let y=a.has(g)?"readonly":we(h),b=Array.isArray(h.enum)?Math.max(...h.enum.map((S)=>String(S).length),4):0;return{editable:y!=="readonly",field:g,kind:y,pk:g===r.idField,required:n.has(g),schema:h,title:se(g),widthHint:y==="enum"?ie(b+3):oe[y]}});return l.sort((g,h)=>{let y=(S)=>S.pk?0:S.required?1:2,b=y(g)-y(h);return b===0?0:b}),l}function wb(e,r=50){let o=e.slice(0,r),n=[];for(let a of o)for(let l of Object.keys(a))if(!n.includes(l))n.push(l);return n.map((a)=>{let l=o.map((y)=>y[a]).filter((y)=>y!==null&&y!==void 0&&y!==""),g=be(l),h=Math.max(...l.map((y)=>Io(y).length),a.length,4);return{editable:!0,field:a,kind:g,title:se(a),widthHint:g==="string"||g==="text"?ie(h):oe[g]}})}function be(e){if(e.length===0)return"string";if(e.some((o)=>Array.isArray(o)))return"array";let r=e.map(String);if(e.every((o)=>typeof o==="boolean")||r.every((o)=>/^(true|false)$/i.test(o)))return"boolean";if(e.every((o)=>typeof o==="number")||r.every((o)=>o.trim()!==""&&!Number.isNaN(Number(o.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(r.every((o)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(o)))return"date";if(r.some((o)=>o.length>200))return"text";return"string"}function Ru(e,r){if(e===null||e===void 0)return null;switch(r.kind){case"number":{if(typeof e==="number")return Number.isNaN(e)?null:e;let o=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(o==="")return null;let n=Number(o);return Number.isNaN(n)?null:n}case"boolean":{if(typeof e==="boolean")return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let o=String(e).trim();return o===""?[]:o.split(",").map((n)=>n.trim()).filter(Boolean)}case"reference":{if(typeof e==="object"&&e!==null&&"$ref"in e){let n=e.$ref;return typeof n==="string"&&n!==""?n:null}let o=String(e).trim();return o===""?null:o}default:{let o=String(e);return o===""?null:o}}}function Io(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(typeof e==="object")return e.$ref;return String(e)}var Bw="__key",U=new WeakMap;function Ba(e){return e?U.get(re(e))??null:null}function $u(e,r){let o=v({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),n=new Map,a=(t)=>{n=new Map(t.map((i)=>[i.key,i]))},l=ne({resolveBaseline:(t,i)=>n.get(t)?.cells[i]??null}),g=async()=>{let t=await r.rows(o.query);o.rows=t.rows,o.total=t.total,a(t.rows)},h=(t)=>{let i=o.columns.filter((f)=>f.required&&f.editable);if(i.length===0)return null;let s=t.cells.filter((f)=>f.value===null&&i.some((c)=>c.field===f.field)).map((f)=>({error:"Required",field:f.field,ok:!1,rowKey:f.rowKey})),d=t.inserts.filter((f)=>i.some((c)=>f.cells[c.field]===null||f.cells[c.field]===void 0)).map((f)=>({error:`Missing required: ${i.filter((x)=>f.cells[x.field]===null||f.cells[x.field]===void 0).map((x)=>x.field).join(", ")}`,ok:!1,tempKey:f.tempKey}));if(s.length===0&&d.length===0)return null;return{cells:s,deletes:[],inserts:d}},y=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,b=(t,i,s)=>{if(s==="number")return(typeof t==="number"?t:0)-(typeof i==="number"?i:0);if(s==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Io(t).localeCompare(Io(i))},S=()=>{let t=o.rows.map((d)=>d.key),{dir:i,orderBy:s}=o.query;if(s&&!r.capabilities.remoteSort){let d=o.columns.find((c)=>c.field===s)?.kind,f=i==="desc"?-1:1;t=t.toSorted((c,x)=>{let P=l.effectiveValue(c,s),j=l.effectiveValue(x,s);if(y(P)!==y(j))return y(P)?1:-1;return f*b(P,j,d)})}return o.grouping?[...G(t).values()].flat():t},G=(t)=>{let i=new Map;for(let s of t){let d=Io(l.effectiveValue(s,o.grouping)),f=i.get(d);if(f)f.push(s);else i.set(d,[s])}return i},T=null,C=()=>T?.refreshData(),R={addRow(t={}){let i=l.insertRow(t);return C(),i},bindView(t){T=t},buffer:l,deleteRows(t){if(t.length===0)return;l.group(()=>{for(let i of t)l.deleteRow(i)}),C()},discardRow(t){l.discardRow(t),C()},replaceAll(t,i){if(t==="")return 0;let s=o.columns.filter((c)=>c.editable&&(c.kind==="string"||c.kind==="text")),d=[...o.rows.map((c)=>c.key),...l.state.inserts.keys()],f=0;if(l.group(()=>{for(let c of d){if(l.rowState(c)==="pending-delete")continue;for(let x of s){let P=l.effectiveValue(c,x.field);if(typeof P==="string"&&P.includes(t))l.setCell(c,x.field,P.replaceAll(t,i)),f+=1}}}),f>0)C();return f},effectiveRows(){let t=(d)=>Array.isArray(d)?[...d]:d!==null&&typeof d==="object"?{$ref:d.$ref}:d,i=(d)=>{let f={[Bw]:d};for(let c of o.columns)f[c.field]=t(l.effectiveValue(d,c.field));return f},s=S().map((d)=>i(d));for(let[d]of l.state.inserts)s.push(i(d));return s},groups(){if(!o.grouping)return[];return[...G(S())].map(([t,i])=>({count:i.length,value:t}))},async load(){o.loading=!0,o.error=null;try{o.columns=await r.columns(),await g()}catch(t){o.error=te(t)}finally{o.loading=!1}C()},async refresh(){if(l.isDirty()){if(!await Xo("Refresh Grid",`Discard ${l.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}l.reset(),await r.refresh?.(),await this.load()},async save(){if(o.saving)return;let t=l.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){k.info("No grid changes to save.",{key:"grid.save"});return}let s=h(t);if(s){l.applyCommitResult(s),k.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 Xo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let f=new Set(t.cells.map((c)=>c.rowKey)).size+t.inserts.length+t.deletes.length>5?la({title:"Saving grid"}):null;o.saving=!0;try{let c=await r.commit(t),x=(w,V)=>`${w}\x00${V}`,P=new Map(t.cells.map((w)=>[x(w.rowKey,w.field),w]));for(let w of c.cells){let V=P.get(x(w.rowKey,w.field));if(w.ok&&V){let Y=n.get(w.rowKey);if(Y)Y.cells[w.field]=V.value}}if(l.applyCommitResult(c),c.inserts.some((w)=>w.ok)||c.deletes.some((w)=>w.ok))await g();let I=c.cells.filter((w)=>w.ok).length+c.inserts.filter((w)=>w.ok).length+c.deletes.filter((w)=>w.ok).length,H=i-I,W=c.cells.filter((w)=>w.stale).length+c.deletes.filter((w)=>w.stale).length;if(H===0)k.success(`Saved ${I} change(s).`,{key:"grid.save"});else k.error(`Saved ${I} · ${H} failed${W?` (${W} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(c){k.error("Could not save the grid.",{action:"file.save",detail:te(c),key:"grid.save",source:"Data"})}finally{o.saving=!1,f?.done(),C()}},serializeForSource(){if(!r.serializeForSource)return null;return r.serializeForSource(l.buildBatch())},async setQuery(t){o.query=t,o.loading=!0;try{await g()}catch(i){o.error=te(i)}finally{o.loading=!1}C()},setGrouping(t){o.grouping=t,C()},async setSort(t){let i={...o.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!r.capabilities.remoteSort){o.query=i,C();return}await this.setQuery(i)},source:r,state:o,tab:e};return e.scope.run(()=>{Q(()=>{e.doc.dirty=l.isDirty()}),wm(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo(),C()},undo:()=>{l.undo(),C()}});let t=p();if(t.subscribeFileEvents&&r.backingPaths){let i=t.subscribeFileEvents((s)=>{let d=r.backingPaths(),f=new Set;for(let c of s){if(c.isDir)continue;let x=c.path.replaceAll("\\","/"),P=d.get(x);if(P!==void 0&&!gc(x))f.add(P)}if(f.size===0)return;if(l.isDirty()){let c=f.has("*")?o.rows.map((x)=>x.key):[...f];l.markStale(c),k.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),C()}else R.refresh()});Qa(i)}Qa(()=>{wm(e,null),U.delete(re(e)),r.dispose?.()})}),U.set(re(e),R),R}async function gd(e){let o=Ba(e)?.serializeForSource();if(o)return o;await qt();let n=wi(e.doc.sourceFormat);if(n?.capabilities.serialize){let a=e.doc.content?.frontmatter||{},l=e.doc.document,g={...a,...l,children:l.children??[]};return Us(n.name,g,{mode:"roundtrip"})}if(e.doc.mode==="content"){let a=Dr();if(a){let l=e.doc.content?.frontmatter??{},g=Object.keys(l).length>0,h={...l,...e.doc.document};return Us(a.name,h,{frontmatter:g,mode:"roundtrip"})}}return pr(e.doc.document,e.doc.layout??null)}var ve=200,ke=500,Ce=2097152,D=new Map,B=!1,N=null,E=null,O=null,J=null;function xe(){let e=[];for(let r of m.tabs.values())if(r.doc.dirty&&r.documentPath)e.push(r);return e}async function le(){if(!We())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let r=new Set;for(let o of xe()){let n=o.documentPath.replace(/^\.\//,""),a;try{a=await gd(o)}catch{continue}if(a.length>Ce)continue;if(r.add(n),D.get(n)===a)continue;D.set(n,a),await e.setPreviewOverlay(n,a)}for(let o of D.keys())if(!r.has(o))D.delete(o),await e.clearPreviewOverlay(o)}function ae(){if(!B)return;let e=Date.now();if(O??=e,E)clearTimeout(E);let r=e-O,o=Math.max(0,Math.min(ve,ke-r));E=setTimeout(()=>{E=null,O=null,J=le().finally(()=>{J=null})},o)}function zE(){ae()}function WE(){if(B)return;B=!0,N=ge(),N.run(()=>{Q(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;ae()})})}function VE(){if(B=!1,E)clearTimeout(E),E=null;O=null,N?.stop(),N=null,D.clear()}async function zw(){if(!B)return;if(E)clearTimeout(E),E=null,O=null;await J,await le()}var de=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Se=new Set(["vnd","prs","x"]);function Pe(e){if(typeof e!=="string")return null;let[r,...o]=e.split(";"),n=(r??"").indexOf("/");if(n===-1)return null;let a=(r??"").slice(0,n).trim().toLowerCase(),l=(r??"").slice(n+1).trim().toLowerCase();if(!de.test(a)||!de.test(l))return null;let g=l.lastIndexOf("+"),h=g===-1?null:l.slice(g+1),y=g===-1?l:l.slice(0,g);if(h==="")return null;let b=y.indexOf("."),S=b===-1?null:y.slice(0,b),G=S!==null&&Se.has(S)?S:null,T=G===null?y:y.slice(G.length+1);if(T==="")return null;let C={};for(let R of o){let t=R.indexOf("=");if(t===-1)return null;let i=R.slice(0,t).trim().toLowerCase(),s=R.slice(t+1).trim();if(i==="")return null;if(s.startsWith('"')&&s.endsWith('"')&&s.length>=2)s=s.slice(1,-1);C[i]=s}return{parameters:C,subtype:T,suffix:h,tree:G,type:a}}function Ww(e){let r=Pe(e);if(r===null)return null;let o=r.tree===null?"":`${r.tree}.`,n=r.suffix===null?"":`+${r.suffix}`;return`${r.type}/${o}${r.subtype}${n}`}var ce="text/markdown; variant=GFM",ue="application/yaml",ct={".markdown":`${ce}; charset=utf-8`,".md":`${ce}; charset=utf-8`,".yaml":`${ue}; charset=utf-8`,".yml":`${ue}; charset=utf-8`};async function Ge(e,r){let o=await uk(e.name,r);return hk(e,o)}async function Er(e,r){await qt();let o=Zt(e);if(!o||!o.capabilities.parse)throw Ip(e);return{...await Ge(o,r),format:o}}var N1=async(e,r)=>{if(e.documentPath&&Zt(e.documentPath)){let n=await Er(e.documentPath,r);return{document:n.document,frontmatter:n.frontmatter}}let o=hs(r);return e.doc.layout=o.layout,{document:o.document}};var fe=()=>{};function O1(e){fe=e}function A(e){let r=e.doc.document;fe(e.documentPath,r);let o=typeof r.tagName==="string"&&r.tagName.includes("-")?xb(r):null;if(o)k.warn(o,{key:`slots:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Components",tier:"problem"});L(r,e.documentPath??void 0)}function Re(e){return!pm(e.documentPath??"")}async function rp(e=u.value){if(!e)return!1;if(await aC(e.id),Cm(e))return k.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Collaboration"}),!1;if(!Re(e))return k.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,{key:`save.notADocument:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Save"}),!1;let r=Ba(e);if(r)return await r.save(),!e.doc.dirty;try{if(await JC(e))return A(e),!0;let o=await gd(e);if(e.documentPath)return await p().writeFile(e.documentPath,o),e.doc.dirty=!1,zw(),A(e),!0;if(e.fileHandle&&"createWritable"in e.fileHandle){let n=await e.fileHandle.createWritable();return await n.write(o),await n.close(),e.doc.dirty=!1,A(e),!0}k.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))k.error(`Could not save ${e.documentPath??e.id}.`,{action:"file.save",detail:te(o),key:`save:${e.documentPath??e.id}`,...e.documentPath===null?{}:{path:e.documentPath},source:"Save"})}return!1}function Ee(e){return wi(e.doc.sourceFormat)??(e.doc.mode==="content"?Dr():void 0)}async function M1(){let e=u.value;if(!e)return;try{await qt();let r=Ee(e),o=await gd(e),n=r?Ww(r.mediaType)??"text/plain":"application/json",a=r?r.extensions[0]:".json",l=r?r.name:"Jx Component",g=r?`content${a}`:"component.json";if("showSaveFilePicker"in window){let h=e.documentPath?e.documentPath.split("/").pop():g,y=await window.showSaveFilePicker({suggestedName:h,types:[{accept:{[n]:[a]},description:l}]}),b=await y.createWritable();await b.write(o),await b.close(),e.doc.dirty=!1,A(e),k.success(`Exported as ${y.name}.`)}else{let h=new Blob([o],{type:n}),y=URL.createObjectURL(h),b=document.createElement("a");b.href=y,b.download=g,b.click(),URL.revokeObjectURL(y),e.doc.dirty=!1,A(e),k.success(`Downloaded ${g}.`)}}catch(r){if(!(r instanceof Error&&r.name==="AbortError"))k.error("Could not export the document.",{detail:te(r),source:"Export"})}}async function pe(e,r){let o=pm(e)?await kb(e):await js({path:e});return K1(o,r)??""}async function Yf(e){let r=await pe(e.path,"delete"),o=`Delete ${e.name}? This cannot be undone.`;return Boolean(await Xo("Delete File",r===""?o:`${o} ${r}`,{confirmLabel:"Delete",destructive:!0}))}async function Zf(e,r="rename"){let o=await pe(e,r);return o===""?void 0:o}
|
|
2
|
+
export{vb,ds,Jf,Hw,yb,wb,Ru,Io,Bw,Ba,$u,BE,gd,zE,WE,VE,zw,Ww,Er,N1,O1,rp,M1,Yf,Zf};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=9BC1C3652F629A5F64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qvasen3f.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{un,rn,ne}from"./studio-geq1ea6k.js";import{p}from"./studio-qpqa7vk3.js";import{Tr}from"./studio-ghrhy2y7.js";import{v}from"./studio-vzacdfsc.js";import{rt,zt,T,R,An,Ct}from"./studio-e7xxa0sj.js";import{bd,XE,Xf,j1,QE,ca,sp}from"./studio-a2138x5k.js";import{$f,A_}from"./studio-xasj0796.js";import{D}from"./studio-wgh5kxpj.js";import{me}from"./studio-v2bvmbjj.js";function Pa(e){let t=e.trim().replaceAll("\\","/").split("/").filter((n)=>n!=="");return t.some((n)=>n==="."||n==="..")?null:t.join("/")}var P={$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."]}}}]}}}]}]};T("publish",P);var S="https://github.com/apps/cloudflare-pages/installations/new";function F(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 w(e){let{error:t}=e;return{accountId:e.form.accountId,accountOptions:e.accounts,body:F(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:S,productionUrl:e.deploy?.productionUrl??"",projectName:e.form.projectName,repo:e.form.repo,submitLabel:e.busy?"Connecting…":"Create & Connect"}}function j(e){let t=document.createElement("div");t.style.pointerEvents="auto",e.layer.append(t);let n="",g=!1,N=()=>{if(g)return;g=!0,e.onClosed()},d=v({...w(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)}}),b=null,k=R("publish",d,t).then(async(o)=>{b=o;let u=o.root;if(g)return o.dispose(),u;if(await An(u),g)return u;return(u.querySelector('dialog[part="dialog"]')??u).setAttribute(rt,zt("modal","publish")),un(u),u});return{close(){let o=b?.root;if(o instanceof HTMLElement)rn(o);b?.dispose(),b=null,n="",t.remove(),N()},host:t,ready:k,update(o){Object.assign(d,w(o))}}}var m=null,i="loading",f=[],l=null,r="",c=!1,h=!1,a={accountId:"",branch:"main",owner:"",projectName:"",repo:""};function x(){return D?.projectConfig??null}function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-+|-+$/g,"").slice(0,58)||"site"}function H(){let e=p().projectRoot,t=/^([\w.-]+)\/([\w.-]+)(?:@.+)?$/.exec(e);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}function L(){let e=/^[\w.-]+\/[\w.-]+@[^:]+:(.+)$/.exec(p().projectRoot)?.[1]??"";return Pa(e)??""}function U(){let e=ca();return e?{productionUrl:e.productionUrl??"",projectName:e.projectName}:null}function C(){let e=bd(),t=i==="loading"?null:i;return{accounts:f.map((n)=>({label:n.name,value:n.id})),busy:c,connected:t?.connected===!0,deploy:U(),deployment:l?{environment:l.environment,stage:l.stage,status:l.status,url:l.url}:null,error:r,form:{...a},hosted:e&&typeof p().cfConnect==="function",lapsed:t?.connected===!0&&t.needsReconnect===!0,loading:i==="loading",replacing:h,supported:e,tokenStored:$f()!==""}}function s(){if(m){m.update(C());return}m=j({layer:Ct("modal"),onClosed:z,onConnect:()=>{_()},onDisconnect:()=>{V()},onField:(e,t)=>{a={...a,[e]:t}},onOpenAccounts:O,onRefresh:()=>{y()},onReplaceToken:()=>{h=!0,r="",s()},onSaveToken:(e)=>{E(e)},onSubmit:()=>{M()},view:C()})}async function y(){i="loading",s();try{if(i=await p().cfConnection?.()??null,i?.connected&&!i.needsReconnect){f=await XE(),a={...a,accountId:i.accountId??f[0]?.id??""};let e=ca();if(e)l=await Xf(e),sp(l)}}catch(e){i=null,r=e instanceof Error?e.message:String(e)}s()}async function E(e){let t=e.trim();if(!t){r="Paste a token, or use Preferences › Accounts to forget the stored one.",s();return}A_(t),h=!1,r="",await y()}function O(){ne()?.run("app.preferences",{section:"accounts"})}async function _(){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 (me("n8hr38v7"),import("./cf-account-picker-n8hr38v7.js"));await t()}}catch(e){r=e instanceof Error?e.message:String(e)}c=!1,Tr(),await y()}async function M(){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=L(),n=await QE(e,{accountId:a.accountId,owner:a.owner,productionBranch:a.branch||"main",projectName:a.projectName,repo:a.repo,...t?{rootDir:t}:{}});l=await Xf(n).catch(()=>null)}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}async function V(){let e=x();if(!e)return;c=!0,s();try{await j1(e,null),l=null}catch(t){r=t instanceof Error?t.message:String(t)}c=!1,s()}function z(){let e=m;m=null,e?.close()}function k_(e){i={accountId:e.accountId??"demo-account",connected:!0},f=[],l=e.deployment,sp(e.deployment),r="",c=!1,h=!1,s()}function p$(){let e=x(),{owner:t,repo:n}=H();i="loading",f=[],l=null,r="",c=!1,h=!1,a={accountId:"",branch:"main",owner:t,projectName:ca()?.projectName??I(e?.name??""),repo:n},s(),y()}
|
|
2
|
+
export{Pa,k_,p$};
|
|
3
|
+
|
|
4
|
+
//# debugId=C6674ACD5D31449564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-rggdb3hm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pg,Os,Vy,Ur,Uy,as}from"./studio-q4tv82h7.js";var lS="meta",cS="frontmatter",dS="structure",uS="source",hS=2;function Qc(t){return t.getMap(lS)}function pS(t){return t.getMap(cS)}function Cf(t){return t.getMap(dS)}function fS(t){return t.getText(uS)}function f(t){return JSON.parse(JSON.stringify(t))}function h(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var y=new Set(["textContent"]),m=new Set(["style","attributes","$props"]);function g(t,e){let n=t.toString();if(n===e)return!1;let r=0,o=Math.min(n.length,e.length);while(r<o&&n[r]===e[r])r+=1;let i=n.length,a=e.length;while(i>r&&a>r&&n[i-1]===e[a-1])i-=1,a-=1;if(i>r)t.delete(r,i-r);if(a>r)t.insert(r,e.slice(r,a));return!0}function l(t){let e=new Ur;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;e.set(n,h(r)?l(r):f(r))}return e}function Y(t,e){for(let n of[...t.keys()])if(!(n in e)||e[n]===void 0)t.delete(n);for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=t.get(n);if(h(r))if(o instanceof Ur)Y(o,r);else t.set(n,l(r));else if(!b(o,r))t.set(n,f(r))}}function b(t,e){if(t===e)return!0;if(t instanceof Ur||t instanceof Os||t instanceof as)return!1;return JSON.stringify(t??null)===JSON.stringify(e??null)}function p(t){return typeof t==="string"?new as(t):mS(t)}function Vh(t){let e=new Os;return e.insert(0,t.map((n)=>p(n))),e}function mS(t){if(!h(t))throw TypeError("collab-schema: a document node must be a plain object");let e=new Ur;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;if(n==="children"&&Array.isArray(r))e.set(n,Vh(r));else if(y.has(n)&&typeof r==="string")e.set(n,new as(r));else if(m.has(n)&&h(r))e.set(n,l(r));else e.set(n,f(r))}return e}function ed(t){if(t instanceof Ur){let e={};for(let[n,r]of t.entries())e[n]=ed(r);return e}if(t instanceof Os)return t.toArray().map((e)=>ed(e));if(t instanceof as)return t.toString();return t}function jR(t){return ed(Cf(t))}function zy(t,e){let n=Cf(t);for(let r of e)if(n instanceof Ur)n=n.get(String(r));else if(n instanceof Os){let o=typeof r==="number"?r:Number(r);if(!Number.isInteger(o)||o<0||o>=n.length)return;n=n.get(o)}else return;return n}function b_(t,e,n){let r=fS(t);if(r.toString()===e)return!1;return t.transact(()=>{g(r,e)},n),!0}function HR(t,e,n={}){let r=Qc(t);if(r.get("structureSeeded")===!0)return!1;return t.transact(()=>{let o=Cf(t);for(let[a,s]of Object.entries(e)){if(s===void 0)continue;if(a==="children"&&Array.isArray(s))o.set(a,Vh(s));else o.set(a,f(s))}let i=pS(t);for(let[a,s]of Object.entries(n.frontmatter??{}))if(s!==void 0)i.set(a,f(s));r.set("schemaVersion",hS),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",n.sourceFormat??null),r.set("structureSeeded",!0)},n.origin),!0}var BR="jx-local",zR="jx-mirror",WR="jx-seed";class td extends Error{constructor(t){super(`collab-path-unresolved:${t.join("/")}`);this.name="CollabPathError"}}function w(t,e){let n=zy(t,e);if(!(n instanceof Ur))throw new td(e);return n}function d(t,e,n){let r=w(t,e),o=r.get("children");if(o instanceof Os)return o;if(n&&o===void 0){let i=new Os;return r.set("children",i),i}throw new td([...e,"children"])}function R(t){return JSON.parse(JSON.stringify(t))}function P(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function M(t,e,n){let r=t.get(e);if(e==="children"&&Array.isArray(n)){t.set(e,Vh(n));return}if(y.has(e)&&typeof n==="string"){if(r instanceof as)g(r,n);else t.set(e,new as(n));return}if(m.has(e)&&P(n)){if(r instanceof Ur)Y(r,n);else t.set(e,l(n));return}t.set(e,R(n))}function D(t,e){switch(e.op){case"set-key":{let n=w(t,e.path);if(e.value===void 0)n.delete(e.key);else M(n,e.key,e.value);return}case"insert-child":{let n=d(t,e.parentPath,!0);if(e.index<0||e.index>n.length)throw new td([...e.parentPath,"children",e.index]);n.insert(e.index,[p(e.node)]);return}case"remove-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new td([...e.parentPath,"children",e.index]);n.delete(e.index,1);return}case"set-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new td([...e.parentPath,"children",e.index]);let r=n.get(e.index);if(r instanceof as&&typeof e.node==="string"){g(r,e.node);return}n.delete(e.index,1),n.insert(e.index,[p(e.node)]);return}case"move-child":{let n=d(t,e.fromParentPath,!1),r=d(t,e.toParentPath,!0);if(e.fromIndex<0||e.fromIndex>=n.length)throw new td([...e.fromParentPath,"children",e.fromIndex]);let o=ed(n.get(e.fromIndex));if(n.delete(e.fromIndex,1),e.toIndex<0||e.toIndex>r.length)throw new td([...e.toParentPath,"children",e.toIndex]);r.insert(e.toIndex,[p(o)]);return}default:throw Error(`unknown-doc-op:${e.op}`)}}function VR(t,e,n){t.transact(()=>{for(let r of e)D(t,r)},n)}function C(t){for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=="string")continue;if(m.has(n))return{key:n,nodePath:t.slice(0,e)};if(y.has(n))return{key:n,nodePath:t.slice(0,e)}}return null}function J(t){return t.every((e)=>typeof e==="string"||typeof e==="number")}function UR(t){if(t.length===0)return[];let e=t.map((o)=>o.path);if(!e.every((o)=>J(o)))return null;for(let o=0;o<e.length;o++)for(let i=0;i<e.length;i++){if(o===i)continue;let a=e[o],s=e[i];if(a.length<=s.length&&a.every((c,u)=>c===s[u]))return null}if(t.filter((o)=>o instanceof Pg).length>1)return null;let r=[];for(let o of t){let i=o.path,a=C(i);if(a){let{doc:s}=o.target;if(!s)return null;let c=zy(s,[...a.nodePath,a.key]);if(c===void 0)return null;r.push({key:a.key,op:"set-key",path:a.nodePath,value:ed(c)});continue}if(o instanceof Uy){let s=i.at(-1);if(i.at(-2)==="children"&&typeof s==="number"){r.push({index:s,node:o.target.toString(),op:"set-child",parentPath:i.slice(0,-2)});continue}return null}if(o instanceof Vy){let s=o.target;for(let[c,u]of o.changes.keys)if(u.action==="delete")r.push({key:c,op:"set-key",path:i});else r.push({key:c,op:"set-key",path:i,value:ed(s.get(c))})}else if(o instanceof Pg){if(i.at(-1)!=="children")return null;let s=i.slice(0,-1),c=0;for(let u of o.changes.delta)if(u.retain!==void 0)c+=u.retain;else if(u.delete!==void 0)for(let x=0;x<u.delete;x++)r.push({index:c,op:"remove-child",parentPath:s});else if(u.insert!==void 0){let x=Array.isArray(u.insert)?u.insert:[u.insert];for(let O of x)r.push({index:c,node:ed(O),op:"insert-child",parentPath:s}),c+=1}}else return null}return r}function qR(t,e,n){t.transact(()=>{let r=Cf(t),o=e,i=[...r.keys()];for(let s of i)if(!(s in o)||o[s]===void 0)r.delete(s);for(let[s,c]of Object.entries(o)){if(c===void 0)continue;if(s==="children"&&Array.isArray(c))r.set(s,Vh(c));else r.set(s,JSON.parse(JSON.stringify(c)))}let a=Qc(t);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},n)}function v_(t){return Qc(t).get("canonical")==="source"?"source":"structure"}function y_(t){return Number(Qc(t).get("canonicalRev")??0)}function GR(t,e,n){if(v_(t)==="source")return!1;return t.transact(()=>{b_(t,e,n);let r=Qc(t);r.set("canonical","source"),r.set("canonicalRev",y_(t)+1)},n),!0}function KR(t,e){if(v_(t)!=="source")return!1;return t.transact(()=>{let n=Qc(t);n.set("canonical","structure"),n.set("canonicalRev",y_(t)+1)},e),!0}function JR(t,e,n){let r=[];for(let[o,i]of t.getStates()){let a=i;if(o!==n&&a.mode==="source"&&a.focusedPath===e)r.push(o)}return r}function YR(t,e){let n=t.clientID,r=t.getStates().get(n);if(r?.mode!=="source"||r.focusedPath!==e)return!1;let o=n;for(let[i,a]of t.getStates()){let s=a;if(s.mode==="source"&&s.focusedPath===e&&s.canWrite!==!1&&i<o)o=i}return o===n}var w_=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function ZR(t){let e=5381;for(let r=0;r<t.length;r++)e=Math.imul(e,33)+(t.codePointAt(r)??0);let n=Math.abs(e)%w_.length;return w_[n]}export{lS,cS,dS,uS,hS,Qc,pS,Cf,fS,Vh,mS,ed,jR,zy,b_,HR,BR,zR,WR,td,VR,UR,qR,v_,y_,GR,KR,JR,YR,w_,ZR};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
4
|
-
//# sourceMappingURL=studio-
|
|
3
|
+
//# debugId=783CC15231C5707564756E2164756E21
|
|
4
|
+
//# sourceMappingURL=studio-sghy936h.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./studio-qpqa7vk3.js";import{ua}from"./studio-19x1c75w.js";import{Ir,bm,zC}from"./studio-3bpdkq2s.js";import{xm,m}from"./studio-3aey7dd3.js";import{D}from"./studio-wgh5kxpj.js";var P=/[.*+?^${}()|[\]\\]/;function R(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=R(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=R(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function x(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let f=s===o.length-1;if(W(e,i,f?n:!0))return!0}return!1}var g=new Map,h=new Map;function Du(){g.clear(),h.clear()}async function w(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=g.get(e);if(t!==void 0)return Promise.resolve(t);let n=h.get(e);if(n)return n;let r=w(e).then((o)=>(g.set(e,o),h.delete(e),o));return h.set(e,r),r}async function v(){let e=[...g.keys()];h.clear();let t=await Promise.all(e.map((n)=>w(n)));g.clear();for(let[n,r]of e.entries())g.set(r,t[n]??null)}async function UE(e){await Promise.all(x(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of x(e)){let r=g.get(n);if(r)t.push(r)}return t}function qE(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,S={commit:0,open:1,reconnect:2},G=250,V=8,E=new Map,I=(e)=>e.replaceAll("\\","/");function Ps(...e){bm(e,e);let t=Date.now()+U;for(let n of e)if(n)E.set(I(n),t)}function gc(e){let t=I(e),n=E.get(t);if(n===void 0)return!1;if(Date.now()>n)return E.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((f)=>f.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let f=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))f.push(c);for(let c of f)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)bm(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let f=e.get(s);if(!f)return;let c=[...f],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid","manage"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of m.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!xm(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function P1(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=D,u=n.filter((d)=>!gc(d.path));if(n=[],!l||u.length===0)return;let y=B(l.dirs,l.expanded,u);if(e.onContentChange){for(let d of u)if(d.type==="change")e.onContentChange(d.path)}if(y.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let u=D;if(!u||!l)return;let y=H(u.dirs,(d)=>Ir(()=>t.listDirectory(d)));if(l==="reconnect")ua(),e.invalidateDerivedCaches?.(),await Promise.all([y,v()]);else await y;if(D!==u)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},f=(l)=>{if(l!=="commit")zC();if(!o||S[l]>S[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(ua(),e.invalidateDerivedCaches?.(),j(l),C(l.map((u)=>u.path)))v().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:f});return()=>{if(i)clearTimeout(i),i=null;c()}}
|
|
2
|
+
export{Du,UE,qE,Ps,gc,P1};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B4A9A736CBBC357964756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-skprc6ef.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./studio-qpqa7vk3.js";import{me}from"./studio-v2bvmbjj.js";var s=null,y=null,h=null,g=!1;function E(n){return h=n,g=!0,s?P():Promise.resolve()}async function P(){if(!g)return;g=!1;try{let{applyProjectSchemas:n}=await (me("vhh7gayr"),import("./monaco-setup-vhh7gayr.js"));n(h)}catch{}}function Tp(){if(s)return Promise.resolve(s);return y??=(async()=>{let[n]=await Promise.all([(me("6sc8nacq"),import("./editor-6sc8nacq.js")),(me("vhh7gayr"),import("./monaco-setup-vhh7gayr.js"))]);return s=n,await P(),s})(),y}function nh(){return s}function $m(n,t,o){if(!n?.isConnected||t)return!1;return o()}var r=[],l=null;function qt(){if(!l)l=(async()=>{try{r=await p().listFormats?.()??[]}catch{r=[]}return r})();return l}function Pd(){l=null,r=[],m=null,a=[],d=null,c=[]}var a=[],m=null;function Fd(){if(!m)m=(async()=>{try{a=await p().listExtensions?.()??[]}catch{a=[]}return a})();return m}function Dm(){return a}var c=[],d=null;function F(){if(!d)d=(async()=>{try{c=await p().listExtensionCatalog?.()??[]}catch{c=[]}return c})();return d}function Iv(){return c}async function M(n){let t=null;try{t=await n.fetchProjectSchemas?.()??null}catch{}E(t),await (me("3gbp5nkn"),import("./jx-validate-3gbp5nkn.js")).then(({applyProjectSchemas:o})=>o(t)).catch(()=>!1)}function Ka(n){M(n),F(),(me("na7rj3nr"),import("./extension-sections-na7rj3nr.js")).then(({syncExtensionSettingsSections:t})=>t()).catch(()=>{})}function Lp(){return r}function Vs(n,t){let o=n.startsWith(".")?n.toLowerCase():`.${n.toLowerCase()}`;return r.find((e)=>e.extensions.includes(o)&&(!t||e.capabilities[t]))}function wi(n){if(!n)return;return r.find((t)=>t.name===n)}function Ip(n){return Error(`No format class imported for "${n}" — add one to project.json imports `+`(e.g. "Markdown": "@jxsuite/parser/Markdown.class.json") and make sure the project's dependencies are installed`)}function Zt(n){if(!n)return;let t=n.lastIndexOf(".");if(t===-1)return;return Vs(n.slice(t))}function Ja(n){let t=new Set;for(let o of r){if(n&&!o.documentKinds.includes(n))continue;for(let e of o.extensions)t.add(e)}return t.delete(".json"),[...t]}function Dr(){return r.find((n)=>n.capabilities.serialize&&n.documentKinds.includes("content"))}async function k(n){let t=p();if(!t.formatAction)throw Error("Platform does not support format actions");return t.formatAction(n)}async function uk(n,t,o){return await k({action:"parse",format:n,options:o,source:t})}async function Us(n,t,o){return await k({action:"serialize",doc:t,format:n,options:o})}function hk(n,t){let o=n?.studio?.documentMode,e=o?.componentWhen;if(e?.frontmatterKey){let i=t[e.frontmatterKey],u=e.matches?new RegExp(e.matches):/./;if(typeof i==="string"&&u.test(i))return{document:t,frontmatter:{},mode:"component"}}if(o?.default==="component")return{document:t,frontmatter:{},mode:"component"};let f=t.children??[];if(f.length===0)f.push({children:[],tagName:"p"});let S=new Set(["state","imports"]),x={children:f},w={};for(let[i,u]of Object.entries(t)){if(i==="children")continue;if(S.has(i))x[i]=u;else w[i]=u}return{document:x,frontmatter:w,mode:"content"}}
|
|
2
|
+
export{Tp,nh,$m,qt,Pd,Fd,Dm,Iv,Ka,Lp,Vs,wi,Ip,Zt,Ja,Dr,uk,Us,hk};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B333ACF62027EC8064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-tt2nactf.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{te}from"./studio-ery42sqr.js";import{v,k}from"./studio-
|
|
1
|
+
import{te}from"./studio-ery42sqr.js";import{v,k}from"./studio-vzacdfsc.js";import{un,rn}from"./studio-geq1ea6k.js";import{rt,zt,T,R,An,Ct}from"./studio-e7xxa0sj.js";var S={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubAuth",$description:"The RFC 8628 device flow's waiting room: the code GitHub minted, the page to type it into, and a Cancel. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — and it is the reason the dialog has no confirm button at all: the answer arrives from GitHub over a poll rather than from anything the reader can press here, so a primary button would be a control with nothing to do. Nothing in this document talks to GitHub: `github/github-auth.ts` keeps the client id, the poll loop, its failure budget and every report the three outcomes raise.",tagName:"jx-dialog",$props:{headline:"Sign in to GitHub",confirmLabel:"",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-auth"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"Four `.github-auth-*` rules in `styles/overlays.css` become the parts below, and two things in them do not travel. `.github-auth-dialog`'s `padding: 16px 0` was the card's own body padding drawn by hand, and `jx-dialog` already pads its body; `.github-auth-dialog p { font-size: 13px }` was a body size this surface picked for itself, and what the paragraphs now inherit is the dialog's own `--jx-text-md`. The `8px 0` margins go with them — the column is a flex column with a gap, so a margin between two rows would be a second opinion about the same space. The code keeps its 24px, which is above the token scale on purpose: it is a string the reader has to copy onto another screen, and reading it out loud is the whole job of this dialog.",'& [part="device"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",textAlign:"center"},'& [part="lede"], & [part="waiting"]':{margin:"0"},'& [part="code"]':{$description:"`<code>`, not a styled `<div>`: this is a literal string to be transcribed, and the element that says so is also the one a reader's own stylesheet and a screen reader's character-by-character mode already know about. It is this dialog's message, and the one string in it the reader must carry to another screen, so it opts back in to selection against the root's `user-select: none`. `all` rather than `text`: one click selects the whole code, so a copy never leaves a character behind.",userSelect:"all",fontFamily:"var(--font-mono)",fontSize:"24px",fontWeight:"700",letterSpacing:"2px",padding:"var(--jx-space-3) var(--jx-space-4)",background:"var(--hover-bg)",borderRadius:"var(--radius)"},'& [part="link"]':{$description:"The blue this carried as a `var(--accent, …)` fallback is gone: `--accent` is declared on `:root` in `styles/tokens.css`, so the fallback could only ever have painted when the token was missing — which is a theme fault to fix rather than a colour to hard-code.",color:"var(--accent)",textDecoration:"underline"},'& [part="waiting"]':{color:"var(--fg-dim)",fontStyle:"italic"}},children:[{tagName:"div",attributes:{part:"device"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Enter this code on GitHub to authorize Jx Studio:"},{tagName:"code",attributes:{part:"code"},textContent:"${state.userCode}"},{tagName:"a",attributes:{part:"link",href:"${state.verificationUri}",target:"_blank",rel:"noreferrer"},textContent:"Open ${state.verificationUri}"},{tagName:"p",attributes:{part:"waiting"},textContent:"Waiting for authorization…"}]}]};T("github-auth",S);function A(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(rt,zt("dialog","github-auth")),e.layer.append(t);let r=!1,u=()=>{if(r)return;r=!0,e.onClosed()},f=v({cancel:()=>{e.onCancel()},closed:u,userCode:e.userCode,verificationUri:e.verificationUri}),s=null,c=R("github-auth",f,t).then(async(o)=>{s=o;let n=o.root;if(r)return o.dispose(),n;if(await An(n),r)return n;return un(n),n});return{close(){let o=s?.root;if(o instanceof HTMLElement)rn(o);s?.dispose(),s=null,t.remove(),u()},host:t,ready:c}}var _="jx_github_token";function p(){return globalThis.__jxPlatform?.githubAuth??null}var g=null,C=!1;function E(e){g=e}function f1(){return g!==null||C||localStorage.getItem("jx_github_token")!==null}function m1(){return p()?"desktop":"browser"}function b(){return g??localStorage.getItem("jx_github_token")}function g1(){g=null,C=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var H="Ov23liYVlMFpgjOEPXJH",O="github.auth",j="Source Control",N="git.signInToGithub",U=3,M="The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a "+"browser cannot call them directly — the desktop app can. A machine that is offline fails "+"identically, and the browser does not say which happened.";function D(e){k.error("Could not reach GitHub to sign in.",{action:N,detail:`${M}
|
|
2
2
|
|
|
3
|
-
${te(e)}`,key:O,source:j})}function y(e,t){k.warn(e,{action:N,detail:t,key:O,source:j})}async function Y(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:H,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return D(t),null}if(!e.ok)return y("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function
|
|
4
|
-
export{
|
|
3
|
+
${te(e)}`,key:O,source:j})}function y(e,t){k.warn(e,{action:N,detail:t,key:O,source:j})}async function Y(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:H,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return D(t),null}if(!e.ok)return y("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function kw(){let e=b();if(e)return e;let t=p();if(t)try{let{token:o}=await t.signIn();return E(o),o}catch(o){return y("GitHub sign-in was not completed.",te(o)),null}let r=await Y();if(!r)return null;let{device_code:u,user_code:f,verification_uri:s,interval:c=5}=r;return new Promise((o)=>{let n=!1,a=null,m=0,w=!1,I=(l)=>{if(w)return;if(w=!0,n=!0,a)clearTimeout(a),a=null;o(l)},x=!1,G=()=>{if(x)return;x=!0,L.close()},d=(l)=>{I(l),G()},h=async()=>{if(n)return;try{let i=await(await fetch("https://github.com/login/oauth/access_token",{body:JSON.stringify({client_id:H,device_code:u,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})).json();if(m=0,i.access_token){localStorage.setItem(_,i.access_token),d(i.access_token);return}if(i.error==="authorization_pending"){a=setTimeout(h,c*1000);return}if(i.error==="slow_down"){a=setTimeout(h,(c+5)*1000);return}y("GitHub sign-in was not completed.",i.error==="access_denied"?"The authorization was declined on GitHub.":i.error==="expired_token"?"The device code expired before it was entered.":`GitHub answered "${i.error??"an unrecognised response"}".`),d(null)}catch(l){if(m+=1,m>=U){D(l),d(null);return}a=setTimeout(h,c*1000)}},L=A({layer:Ct("dialog"),onCancel:()=>{G()},onClosed:()=>{d(null)},userCode:f,verificationUri:s});a=setTimeout(h,c*1000)})}
|
|
4
|
+
export{f1,m1,g1,kw};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=46078B9409049A5364756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-txjjzrsm.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{te}from"./studio-ery42sqr.js";import{p}from"./studio-y7jehjrp.js";import{v,k}from"./studio-fqq890ap.js";import{fd,Tu}from"./studio-xy3tv3az.js";import{Zi,T,R}from"./studio-spf2skgc.js";import{dd}from"./studio-01qza1n3.js";import{EE}from"./studio-56z7evx4.js";import{$b}from"./studio-ceb34dxj.js";import{kd}from"./studio-zpnk016a.js";import{D}from"./studio-tp642n5g.js";var N={$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 `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",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-panel)",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-panel)",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-panel)",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:"New Entry",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Entry"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New entry name",placeholder:"entry-name",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:"Select or create an entry"},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"}}]}}}]}}}]};T("settings-contributed",N);function V(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:""}}function W(e){let o=e?.attributes?.part;return typeof o==="string"?o:""}function j(e,i,o){e.textContent="";let n=v({...V(),...i}),t=null,r=!1,a=R("settings-contributed",n,e,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let c=W(d);if(c==="form-host")o.formSlot(s);else if(c==="actions")o.actionsSlot(s)}}).then((s)=>{if(r)return s.dispose(),s.root;return t=s,s.root});return{attached:()=>{if(r)return!1;let s=t?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){r=!0,t?.dispose(),t=null},host:e,ready:a,update(s){n.actionsState=s.actionsState,n.editorRegion=s.editorRegion,n.editorState=s.editorState,n.entries=s.entries,n.entryName=s.entryName,n.layout=s.layout,n.newName=s.newName,n.newState=s.newState,n.title=s.title}}}var f=new Map,b=new Set,w=new Map;function kE(e,i){let o=D?.projectConfig?.[e],n=o&&typeof o==="object"&&!Array.isArray(o)?o:{};if(!Object.hasOwn(n,i))return Object.keys(n);return f.set(e,i),null}var x=new Map;function I(e,i){let o={},n=[];for(let t of i){let r=t.indexOf(": "),a=r===-1?"":t.slice(0,r),s=r===-1?t:t.slice(r+2);if(a===e){n.push(s);continue}if(!a.startsWith(`${e}/`))continue;let[l]=a.slice(e.length+1).split("/");if(l&&o[l]===void 0)o[l]=s}return{fields:o,section:n}}async function S(e,i){let o=D.projectConfig;if(!(await kd()).ok)return;let t=[];try{t=await dd(o)}catch(r){k.warn(`Could not validate project.json — ${te(r)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}x.set(e,I(e,t).fields),i()}function E(e,i){for(let[o,n]of Object.entries(i))if(n===void 0)delete e[o];else e[o]=n}function H(e){return e.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function J(e,i){if(!e)return{};let o=(n)=>{if(typeof n==="string")return n.replaceAll("${key}",i);if(Array.isArray(n))return n.map((t)=>o(t));if(n&&typeof n==="object"){let t={};for(let[r,a]of Object.entries(n))t[r]=o(a);return t}return n};return o(e)}function M(e,i,o=null){let n=p();return{fieldKeyPrefix:`$settings.${e}`,resolvePointer:(t,r)=>Tu(t,{projectConfig:D?.projectConfig??{},...r!==void 0&&{scope:r},...i.formats!==void 0&&{formats:i.formats}}),...typeof n.setSecrets==="function"?{commitSecret:async(t,r)=>{let a=EE(e,o,t);return await n.setSecrets({set:{[a]:r}}),a}}:{}}}function h(e){let i=D?.projectConfig;if(!i)return null;let o=i[e];if(o&&typeof o==="object"&&!Array.isArray(o))return o;let n={};return i[e]=n,n}var A=new WeakMap;function m(e){w1(e.container,e.contribution,e.opts)}function O(e,i){e.echo=i,m(e)}function K(e){let{container:i,contribution:o,opts:n}=e,t=o.key,r=o.title??t,a=n.actions?"slot":"none",s=$b(i),l=Zi(s,"editor");if((o.settings.layout??"form")!=="map")return{actionsState:a,editorRegion:l,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:r};let d=h(t)??{},c=f.get(t)??null,g=c===null?void 0:d[c],y=c!==null&&g!==void 0&&g!==null&&typeof g==="object";return{actionsState:a,editorRegion:l,editorState:y?"editing":"empty",entries:Object.keys(d).map((u)=>({key:u,region:Zi(s,`entry:${u}`),selected:u===c})),entryName:e.echo??(y?c:""),layout:"map",newName:w.get(t)??"",newState:b.has(t)?"open":"closed",title:r}}function L(e){let i=e.formHost;if(!i)return;let{contribution:o,opts:n}=e,t=o.key,r=o.settings.entry?.ui,a=()=>m(e),s=(u)=>{if(u.parentNode!==i)i.replaceChildren(u)};if((o.settings.layout??"form")!=="map"){let u=`/${t}`;s(fd(`section:${t}`,o.entrySchema,h(t)??{},{context:M(t,n,null),errors:x.get(u)??{},onChange:(P)=>{let C=h(t);if(!C)return;E(C,P),a(),S(u,a)},rerender:a,...r!==void 0&&{ui:r}}));return}let l=h(t)??{},d=f.get(t)??null,c=d===null?void 0:l[d];if(d===null||!c||typeof c!=="object"){i.replaceChildren();return}let g=c,y=`/${t}/${d}`;s(fd(`section:${t}:${d}`,o.entrySchema,g,{context:M(t,n,d),errors:x.get(y)??{},onChange:(u)=>{E(g,u),a(),S(y,a)},rerender:a,...r!==void 0&&{ui:r}}))}function F(e){let i=e.actionsHost,{actions:o}=e.opts;if(!i)return;if(!o){i.replaceChildren();return}let n=e.contribution.key,t=(e.contribution.settings.layout??"form")==="map"?f.get(n)??null:null;o(i,{rerender:()=>m(e),sectionKey:n,selected:t})}function q(e){let i=(t)=>{e.echo=null,m(e),S(t,()=>m(e))},o=()=>{e.echo=null,m(e)},n=()=>e.contribution.key;return{cancelNew(){b.delete(n()),w.delete(n()),m(e)},cancelRename(t){O(e,t),o()},createNew(){let t=n(),r=H(w.get(t)??""),a=h(t);if(!r||!a||a[r])return;a[r]=J(e.contribution.settings.entry?.newEntry,r),f.set(t,r),b.delete(t),w.delete(t),i(`/${t}`)},editNew(t){w.set(n(),t),m(e)},openNew(){b.add(n()),m(e)},removeEntry(){let t=n(),r=f.get(t)??null,a=h(t);if(!r||!a?.[r])return;delete a[r],f.set(t,null),i(`/${t}`)},renameEntry(t){O(e,t);let r=n(),a=f.get(r)??null,s=h(r),l=H(t.trim());if(!a||!s||!l||l===a||s[l]){o();return}let d={};for(let[c,g]of Object.entries(s))d[c===a?l:c]=g,delete s[c];Object.assign(s,d),f.set(r,l),i(`/${r}`)},select(t){f.set(n(),t),e.echo=null,m(e)}}}function w1(e,i,o={}){let n=A.get(e);if(n)n.contribution=i,n.opts=o;if(!n?.handle.attached()){n?.handle.dispose();let t={actionsHost:null,container:e,contribution:i,echo:null,formHost:null,handle:void 0,opts:o};A.set(e,t),t.handle=j(e,q(t),{actionsSlot:(r)=>{t.actionsHost=r,F(t)},formSlot:(r)=>{t.formHost=r,L(t)}}),n=t}n.handle.update(K(n)),F(n),L(n)}
|
|
2
|
-
export{
|
|
1
|
+
import{te}from"./studio-ery42sqr.js";import{p}from"./studio-qpqa7vk3.js";import{v,k}from"./studio-vzacdfsc.js";import{md,Lu}from"./studio-n17mty64.js";import{Zi,T,R}from"./studio-e7xxa0sj.js";import{ud}from"./studio-ecaz25vk.js";import{LE}from"./studio-8f87n763.js";import{Db}from"./studio-47y6fbpf.js";import{Sd}from"./studio-q1h883bt.js";import{D}from"./studio-wgh5kxpj.js";var N={$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 `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",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-panel)",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-panel)",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-panel)",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:"New Entry",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Entry"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New entry name",placeholder:"entry-name",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:"Select or create an entry"},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"}}]}}}]}}}]};T("settings-contributed",N);function V(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:""}}function W(e){let o=e?.attributes?.part;return typeof o==="string"?o:""}function j(e,i,o){e.textContent="";let n=v({...V(),...i}),t=null,r=!1,a=R("settings-contributed",n,e,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let c=W(d);if(c==="form-host")o.formSlot(s);else if(c==="actions")o.actionsSlot(s)}}).then((s)=>{if(r)return s.dispose(),s.root;return t=s,s.root});return{attached:()=>{if(r)return!1;let s=t?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){r=!0,t?.dispose(),t=null},host:e,ready:a,update(s){n.actionsState=s.actionsState,n.editorRegion=s.editorRegion,n.editorState=s.editorState,n.entries=s.entries,n.entryName=s.entryName,n.layout=s.layout,n.newName=s.newName,n.newState=s.newState,n.title=s.title}}}var f=new Map,b=new Set,w=new Map;function EE(e,i){let o=D?.projectConfig?.[e],n=o&&typeof o==="object"&&!Array.isArray(o)?o:{};if(!Object.hasOwn(n,i))return Object.keys(n);return f.set(e,i),null}var x=new Map;function I(e,i){let o={},n=[];for(let t of i){let r=t.indexOf(": "),a=r===-1?"":t.slice(0,r),s=r===-1?t:t.slice(r+2);if(a===e){n.push(s);continue}if(!a.startsWith(`${e}/`))continue;let[l]=a.slice(e.length+1).split("/");if(l&&o[l]===void 0)o[l]=s}return{fields:o,section:n}}async function S(e,i){let o=D.projectConfig;if(!(await Sd()).ok)return;let t=[];try{t=await ud(o)}catch(r){k.warn(`Could not validate project.json — ${te(r)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}x.set(e,I(e,t).fields),i()}function E(e,i){for(let[o,n]of Object.entries(i))if(n===void 0)delete e[o];else e[o]=n}function H(e){return e.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function J(e,i){if(!e)return{};let o=(n)=>{if(typeof n==="string")return n.replaceAll("${key}",i);if(Array.isArray(n))return n.map((t)=>o(t));if(n&&typeof n==="object"){let t={};for(let[r,a]of Object.entries(n))t[r]=o(a);return t}return n};return o(e)}function M(e,i,o=null){let n=p();return{fieldKeyPrefix:`$settings.${e}`,resolvePointer:(t,r)=>Lu(t,{projectConfig:D?.projectConfig??{},...r!==void 0&&{scope:r},...i.formats!==void 0&&{formats:i.formats}}),...typeof n.setSecrets==="function"?{commitSecret:async(t,r)=>{let a=LE(e,o,t);return await n.setSecrets({set:{[a]:r}}),a}}:{}}}function h(e){let i=D?.projectConfig;if(!i)return null;let o=i[e];if(o&&typeof o==="object"&&!Array.isArray(o))return o;let n={};return i[e]=n,n}var A=new WeakMap;function m(e){_1(e.container,e.contribution,e.opts)}function O(e,i){e.echo=i,m(e)}function K(e){let{container:i,contribution:o,opts:n}=e,t=o.key,r=o.title??t,a=n.actions?"slot":"none",s=Db(i),l=Zi(s,"editor");if((o.settings.layout??"form")!=="map")return{actionsState:a,editorRegion:l,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:r};let d=h(t)??{},c=f.get(t)??null,g=c===null?void 0:d[c],y=c!==null&&g!==void 0&&g!==null&&typeof g==="object";return{actionsState:a,editorRegion:l,editorState:y?"editing":"empty",entries:Object.keys(d).map((u)=>({key:u,region:Zi(s,`entry:${u}`),selected:u===c})),entryName:e.echo??(y?c:""),layout:"map",newName:w.get(t)??"",newState:b.has(t)?"open":"closed",title:r}}function L(e){let i=e.formHost;if(!i)return;let{contribution:o,opts:n}=e,t=o.key,r=o.settings.entry?.ui,a=()=>m(e),s=(u)=>{if(u.parentNode!==i)i.replaceChildren(u)};if((o.settings.layout??"form")!=="map"){let u=`/${t}`;s(md(`section:${t}`,o.entrySchema,h(t)??{},{context:M(t,n,null),errors:x.get(u)??{},onChange:(P)=>{let C=h(t);if(!C)return;E(C,P),a(),S(u,a)},rerender:a,...r!==void 0&&{ui:r}}));return}let l=h(t)??{},d=f.get(t)??null,c=d===null?void 0:l[d];if(d===null||!c||typeof c!=="object"){i.replaceChildren();return}let g=c,y=`/${t}/${d}`;s(md(`section:${t}:${d}`,o.entrySchema,g,{context:M(t,n,d),errors:x.get(y)??{},onChange:(u)=>{E(g,u),a(),S(y,a)},rerender:a,...r!==void 0&&{ui:r}}))}function F(e){let i=e.actionsHost,{actions:o}=e.opts;if(!i)return;if(!o){i.replaceChildren();return}let n=e.contribution.key,t=(e.contribution.settings.layout??"form")==="map"?f.get(n)??null:null;o(i,{rerender:()=>m(e),sectionKey:n,selected:t})}function q(e){let i=(t)=>{e.echo=null,m(e),S(t,()=>m(e))},o=()=>{e.echo=null,m(e)},n=()=>e.contribution.key;return{cancelNew(){b.delete(n()),w.delete(n()),m(e)},cancelRename(t){O(e,t),o()},createNew(){let t=n(),r=H(w.get(t)??""),a=h(t);if(!r||!a||a[r])return;a[r]=J(e.contribution.settings.entry?.newEntry,r),f.set(t,r),b.delete(t),w.delete(t),i(`/${t}`)},editNew(t){w.set(n(),t),m(e)},openNew(){b.add(n()),m(e)},removeEntry(){let t=n(),r=f.get(t)??null,a=h(t);if(!r||!a?.[r])return;delete a[r],f.set(t,null),i(`/${t}`)},renameEntry(t){O(e,t);let r=n(),a=f.get(r)??null,s=h(r),l=H(t.trim());if(!a||!s||!l||l===a||s[l]){o();return}let d={};for(let[c,g]of Object.entries(s))d[c===a?l:c]=g,delete s[c];Object.assign(s,d),f.set(r,l),i(`/${r}`)},select(t){f.set(n(),t),e.echo=null,m(e)}}}function _1(e,i,o={}){let n=A.get(e);if(n)n.contribution=i,n.opts=o;if(!n?.handle.attached()){n?.handle.dispose();let t={actionsHost:null,container:e,contribution:i,echo:null,formHost:null,handle:void 0,opts:o};A.set(e,t),t.handle=j(e,q(t),{actionsSlot:(r)=>{t.actionsHost=r,F(t)},formSlot:(r)=>{t.formHost=r,L(t)}}),n=t}n.handle.update(K(n)),F(n),L(n)}
|
|
2
|
+
export{EE,_1};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=0FC7C3B1F10DE3E764756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-tyasmc39.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,
|
|
2
|
-
export{
|
|
1
|
+
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,vu=(a,b,c)=>{var i=a!=null&&typeof a==="object";if(i){var f=b?w??=new WeakMap:x??=new WeakMap,d=f.get(a);if(d)return d}c=a!=null?s(t(a)):{};let g=b||!a||!a.__esModule||!q.call(a,"default")?n(c,"default",{value:a,enumerable:!0}):c;if(a&&typeof a==="object"||typeof a==="function"){for(let e of u(a))if(!q.call(g,e))n(g,e,{get:v.bind(a,e),enumerable:!0})}if(i)f.set(a,g);return g};var ae=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var y=(a)=>a;function z(a,b){this[a]=y.bind(null,b)}var $i=(a,b)=>{for(var c in b)n(a,c,{get:b[c],enumerable:!0,configurable:!0,set:z.bind(b,c)})};var r,o,m,me=(a,b)=>{for(var[c,i,f]of r||[])for(var d=[a],g=globalThis,e=g.document,p,k,l,h,j;k=d.pop();)if(!o[k]&&(l=i[k])){o[k]=1;for(h=1;h<l.length;h++)d.push(f[l[h]]);if(!b&&k!==a&&(p=e&&e.head)){if(m===void 0)m=(h=e.querySelector("meta[property=csp-nonce]"))&&(h.nonce||h.getAttribute("nonce"))||"";if(j=e.createElement("link"),j.rel="modulepreload",j.crossOrigin="",m)j.nonce=m;j.href=new g.URL(l[0],c),p.appendChild(j)}}},h$=(a,b,c,i)=>{for(var f={},d=0;d<b.length;d++)f[b[d]]=c[d];(r||=[]).push([a,f,b]),o||={},me(b[i],1)};
|
|
2
|
+
export{vu,ae,$i,me,h$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=23BC9D2D23B8903164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-v2bvmbjj.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./studio-qpqa7vk3.js";import{D}from"./studio-wgh5kxpj.js";function u(n,r=[]){if(!n||typeof n!=="object"||Array.isArray(n))return r;let t=n;if(t.tagName==="slot"){let o=t.attributes?.name,l=typeof o==="string"?o.trim():"",{children:a}=t;r.push({name:l,...Array.isArray(a)&&a.length>0?{fallback:a}:{}})}if(Array.isArray(t.children))for(let e of t.children)u(e,r);return r}function m(n){if(n==null)return!1;if(typeof n!=="object")return!0;let r=n;return!r.$prototype&&!r.$handler&&!r.$compute}function kx(n,r){if(!n||typeof n!=="object"||Array.isArray(n))return null;let t=n,{tagName:e}=t;if(typeof e!=="string"||!e.includes("-"))return null;let o=u(t),l=t.state??{};return{$id:typeof t.$id==="string"&&t.$id?t.$id:null,hasElements:Array.isArray(t.$elements)&&t.$elements.length>0,path:r,props:Object.entries(l).filter(([,a])=>m(a)).map(([a,s])=>{if(typeof s!=="object"||s===null)return{default:s,name:a,type:typeof s};let i=s;return{default:i.default,format:i.format,name:a,type:i.type}}),...o.length>0?{slots:o}:{},tagName:e}}var st=[],c=!1;async function Al(){try{st=await p().discoverComponents(D?.projectRoot||void 0),c=!0}catch{c=!0}}function FC(n,r){if(!n)return!1;let t=st.findIndex((l)=>l.path===n),e=kx(r,n);if(!e){if(t===-1)return!1;return st.splice(t,1),!0}let o=e;if(t===-1)st.push(o);else st[t]=o;return!0}function hm(n){let r=Object.fromEntries((n.props??[]).map((e)=>[e.name,e.default!==void 0?e.default:""])),t=[];for(let e of n.slots??[])for(let o of structuredClone(e.fallback??[]))if(!e.name)t.push(o);else if(typeof o==="object"&&o!==null&&typeof o.tagName==="string")o.attributes={slot:e.name,...o.attributes},t.push(o);else t.push({attributes:{slot:e.name},children:[o],tagName:"span"});return{$props:r,tagName:n.tagName,...t.length>0?{children:t}:{}}}function _c(n,r){if(!n)return`./${r}`;let t=n.replaceAll("\\","/"),e=r.replaceAll("\\","/"),l=(t.includes("/")?t.slice(0,t.lastIndexOf("/")):"").split("/").filter(Boolean),a=e.split("/").filter(Boolean),s=0;while(s<l.length&&s<a.length&&l[s]===a[s])s+=1;let i=l.length-s,f=a.slice(s);return(i>0?"../".repeat(i):"./")+f.join("/")}
|
|
2
|
+
export{kx,st,Al,FC,hm,_c};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=07AA45E9055DA79664756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-vk9ezads.js.map
|