@jxsuite/studio 6.1.0 → 6.1.1
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-va2wwra4.js +4 -0
- package/dist/chunks/adapter-f93pafd7.js +4 -0
- package/dist/chunks/{cf-account-picker-n8hr38v7.js → cf-account-picker-af1h381v.js} +3 -3
- package/dist/chunks/cf-settings-125tdm0w.js +4 -0
- package/dist/chunks/components-ax2f1fnn.js +4 -0
- package/dist/chunks/content-source-108aqtk1.js +4 -0
- package/dist/chunks/{convert-to-repeater-7wns8kf1.js → convert-to-repeater-ry5rmppr.js} +3 -3
- package/dist/chunks/editor-pfgdmkb0.js +4 -0
- package/dist/chunks/entry-commands-t0k1q0kx.js +4 -0
- package/dist/chunks/{extension-sections-na7rj3nr.js → extension-sections-6mwh2hf8.js} +3 -3
- package/dist/chunks/file-ops-meej5mqf.js +4 -0
- package/dist/chunks/files-44vp8a2s.js +4 -0
- package/dist/chunks/format-host-7q1petb9.js +4 -0
- package/dist/chunks/fs-events-h2mwnxaz.js +4 -0
- package/dist/chunks/git-panel-zngbymvd.js +4 -0
- package/dist/chunks/{grid-view-7tt4bxw1.js → grid-view-sx9vynsp.js} +15 -15
- package/dist/chunks/icons-p44xhjf0.js +4 -0
- package/dist/chunks/iframe-host-qk3ycq87.js +4 -0
- package/dist/chunks/{index-gybvv7a6.js → index-2veqmnhr.js} +3 -3
- package/dist/chunks/index-wkyfjeqz.js +4 -0
- package/dist/chunks/{javascript-rnvdp3k4.js → javascript-8nbvs12s.js} +3 -3
- package/dist/chunks/jsonMode-s8kt9dsj.js +13 -0
- package/dist/chunks/jx-validate-psgd7vsx.js +4 -0
- package/dist/chunks/layers-panel-1kq2jyfk.js +4 -0
- package/dist/chunks/layers-xd92fg8d.js +4 -0
- package/dist/chunks/lit-html-ac4cwwr4.js +4 -0
- package/dist/chunks/media-picker-0svzkdyb.js +4 -0
- package/dist/chunks/menu-5c55ea3d.js +4 -0
- package/dist/chunks/{monaco-binding-2jnhjjvr.js → monaco-binding-z6r70pdt.js} +3 -3
- package/dist/chunks/monaco-buffer-fz6gq5y7.js +4 -0
- package/dist/chunks/monaco-setup-q4axkgj7.js +4 -0
- package/dist/chunks/notify-0xgtn8q1.js +4 -0
- package/dist/chunks/platform-v1qctbe6.js +4 -0
- package/dist/chunks/publish-panel-ym1fmgq5.js +4 -0
- package/dist/chunks/quick-search-a54e6t5n.js +4 -0
- package/dist/chunks/references-gmqp82fs.js +4 -0
- package/dist/chunks/right-panel-v7t9awbk.js +4 -0
- package/dist/chunks/section-registry-vhyf3zsr.js +4 -0
- package/dist/chunks/studio-0bhx5hz6.js +5 -0
- package/dist/chunks/studio-0k1ddnyy.js +6 -0
- package/dist/chunks/studio-1b04pd0j.js +64 -0
- package/dist/chunks/{studio-5g0ag7c0.js → studio-1q1sh2ax.js} +3 -3
- package/dist/chunks/studio-4dwbj6gb.js +5 -0
- package/dist/chunks/studio-4tanh828.js +5 -0
- package/dist/chunks/{studio-vzacdfsc.js → studio-55h4mstj.js} +3 -3
- package/dist/chunks/studio-5tnvjkz4.js +5 -0
- package/dist/chunks/{studio-rggdb3hm.js → studio-60dqgb0c.js} +4 -4
- package/dist/chunks/studio-61dp09qg.js +9 -0
- package/dist/chunks/studio-63epcrj2.js +5 -0
- package/dist/chunks/studio-74k29dy9.js +5 -0
- package/dist/chunks/{studio-qvasen3f.js → studio-7vg6jcd3.js} +4 -4
- package/dist/chunks/studio-7zx31knw.js +9 -0
- package/dist/chunks/studio-8bxk97km.js +5 -0
- package/dist/chunks/{studio-anyrgzvb.js → studio-8grwxtqk.js} +4 -4
- package/dist/chunks/studio-933e30n4.js +5 -0
- package/dist/chunks/{studio-h0xgswew.js → studio-98wnwhbg.js} +4 -4
- package/dist/chunks/studio-9mccjwjh.js +14 -0
- package/dist/chunks/studio-a2ke1e4t.js +5 -0
- package/dist/chunks/studio-e3a2a6v3.js +4 -0
- package/dist/chunks/{studio-vk9ezads.js → studio-e81q1vb9.js} +4 -4
- package/dist/chunks/{studio-z8w183sh.js → studio-epgrmqqm.js} +4 -4
- package/dist/chunks/studio-g1shz58g.js +5 -0
- package/dist/chunks/studio-gf0fz03c.js +5 -0
- package/dist/chunks/studio-gjtpe62q.js +6 -0
- package/dist/chunks/{studio-y78s8r2n.js → studio-gkskhg7m.js} +4 -4
- package/dist/chunks/studio-gx4dnjzd.js +5 -0
- package/dist/chunks/{studio-pxg4ap1e.js → studio-h46vtzk8.js} +4 -4
- package/dist/chunks/studio-j03zga3y.js +9 -0
- package/dist/chunks/{studio-ar8jcf2y.js → studio-jhpxeckz.js} +4 -4
- package/dist/chunks/{studio-w4c0xmrw.js → studio-k01r7ykp.js} +4 -4
- package/dist/chunks/{studio-cpxkgjrj.js → studio-kggey1jt.js} +4 -4
- package/dist/chunks/{studio-zxp13sss.js → studio-kk7h30ne.js} +6 -6
- package/dist/chunks/{studio-ecaz25vk.js → studio-kt1zqney.js} +4 -4
- package/dist/chunks/{studio-zygnmm01.js → studio-m3cwhvye.js} +4 -4
- package/dist/chunks/{studio-2sqcndak.js → studio-mcayt6hz.js} +4 -4
- package/dist/chunks/{studio-qqz8e5gk.js → studio-myjcghv3.js} +4 -4
- package/dist/chunks/studio-n8bxwc3y.js +4 -0
- package/dist/chunks/{studio-wfjqhhbk.js → studio-ngm8gvpb.js} +4 -4
- package/dist/chunks/{studio-zscd9ty4.js → studio-nj5a01jy.js} +196 -196
- package/dist/chunks/{studio-3bpdkq2s.js → studio-pcgz8heb.js} +4 -4
- package/dist/chunks/{studio-v2bvmbjj.js → studio-pre0skq6.js} +4 -4
- package/dist/chunks/{studio-ghkb32r8.js → studio-qcsq0t15.js} +4 -4
- package/dist/chunks/studio-qkstvve9.js +5 -0
- package/dist/chunks/studio-qv1pwd3c.js +5 -0
- package/dist/chunks/{studio-bmn4mn9j.js → studio-rc6dvxjb.js} +5 -5
- package/dist/chunks/{studio-qbj760tx.js → studio-rv11kfwa.js} +7 -7
- package/dist/chunks/studio-s8dmmz66.js +5 -0
- package/dist/chunks/studio-sp5xzbj4.js +6 -0
- package/dist/chunks/{studio-tyasmc39.js → studio-szsjbj0g.js} +4 -4
- package/dist/chunks/studio-t1xzawhr.js +16 -0
- package/dist/chunks/{studio-skprc6ef.js → studio-t6b6qe31.js} +4 -4
- package/dist/chunks/{studio-ghrhy2y7.js → studio-tdcprbqb.js} +4 -4
- package/dist/chunks/{studio-txjjzrsm.js → studio-vrmcjf9g.js} +5 -5
- package/dist/chunks/studio-vyc0b4he.js +10 -0
- package/dist/chunks/{studio-5g4t8v6w.js → studio-w0cgf6jg.js} +4 -4
- package/dist/chunks/{studio-acdksxx6.js → studio-w3hskzqk.js} +4 -4
- package/dist/chunks/{studio-0x3jyb8r.js → studio-wszjyh0j.js} +4 -4
- package/dist/chunks/studio-xgrgcdyh.js +9 -0
- package/dist/chunks/{studio-qpqa7vk3.js → studio-xz2yxfcb.js} +4 -4
- package/dist/chunks/{studio-77kt594t.js → studio-y6n42tgs.js} +4 -4
- package/dist/chunks/{studio-19x1c75w.js → studio-yb560vxr.js} +4 -4
- package/dist/chunks/{studio-wgh5kxpj.js → studio-yn9f8vtx.js} +4 -4
- package/dist/chunks/{studio-a2138x5k.js → studio-yw05w8f0.js} +5 -5
- package/dist/chunks/{studio-h9c4p2tx.js → studio-z16sgavc.js} +4 -4
- package/dist/chunks/studio-zey7zsdw.js +12 -0
- package/dist/chunks/{studio-g7nse7zb.js → studio-zyqn40w4.js} +4 -4
- package/dist/chunks/tsMode-2frah6h1.js +14 -0
- package/dist/chunks/workspace-zt81g1ms.js +4 -0
- package/dist/chunks/ws-client-n2bh4hkf.js +4 -0
- package/dist/iframe-entry.js +13 -13
- package/dist/manifest.json +62 -62
- package/dist/studio.js +77 -77
- package/dist/workers/ts.worker.js +3 -3
- package/package.json +10 -10
- package/src/canvas/canvas-render.ts +4 -1
- package/src/canvas/canvas-utils.ts +73 -15
- package/src/canvas/iframe-host.ts +67 -21
- package/src/canvas/iframe-inline-edit.ts +22 -4
- package/src/canvas/iframe-interaction.ts +7 -1
- package/src/canvas/iframe-protocol.ts +3 -0
- package/src/canvas/iframe-render.ts +5 -2
- package/src/commands/defaults.ts +4 -1
- package/src/commands/live-context.ts +3 -1
- package/src/editor/shortcuts.ts +55 -27
- package/src/files/media-paths.ts +3 -1
- package/src/panels/editors.ts +3 -1
- package/src/panels/style-panel.ts +36 -11
- package/src/platforms/devserver.ts +47 -12
- package/src/studio.ts +14 -2
- package/src/surfaces/library-pane.ts +6 -0
- package/src/surfaces/rail.json +126 -73
- package/src/surfaces/rail.ts +31 -5
- package/src/tabs/typing.ts +31 -0
- package/src/utils/edit-display.ts +30 -1
- package/src/workspace/workspace.ts +7 -0
- package/dist/chunks/2020-nkxms0ay.js +0 -4
- package/dist/chunks/adapter-m948ab5f.js +0 -4
- package/dist/chunks/cf-settings-356xdtne.js +0 -4
- package/dist/chunks/components-yk3t844e.js +0 -4
- package/dist/chunks/content-source-bawmyc09.js +0 -4
- package/dist/chunks/editor-6sc8nacq.js +0 -4
- package/dist/chunks/entry-commands-8ay9fh81.js +0 -4
- package/dist/chunks/file-ops-gye0qw56.js +0 -4
- package/dist/chunks/files-dmc2xvcq.js +0 -4
- package/dist/chunks/format-host-t76b53f8.js +0 -4
- package/dist/chunks/fs-events-cg4tpz06.js +0 -4
- package/dist/chunks/git-panel-yef7bshy.js +0 -4
- package/dist/chunks/icons-qbh8akb1.js +0 -4
- package/dist/chunks/iframe-host-tmz30gfp.js +0 -4
- package/dist/chunks/index-nag78a9h.js +0 -4
- package/dist/chunks/jsonMode-zhwsprqk.js +0 -13
- package/dist/chunks/jx-validate-3gbp5nkn.js +0 -4
- package/dist/chunks/layers-fvz99859.js +0 -4
- package/dist/chunks/layers-panel-gchmbf9p.js +0 -4
- package/dist/chunks/lit-html-9agdspkt.js +0 -4
- package/dist/chunks/media-picker-rhjvyy00.js +0 -4
- package/dist/chunks/menu-2e4y9j7b.js +0 -4
- package/dist/chunks/monaco-buffer-rp21359g.js +0 -4
- package/dist/chunks/monaco-setup-vhh7gayr.js +0 -4
- package/dist/chunks/notify-h3www560.js +0 -4
- package/dist/chunks/platform-hz34wcd7.js +0 -4
- package/dist/chunks/publish-panel-exsmjzyj.js +0 -4
- package/dist/chunks/quick-search-pgaqeh0m.js +0 -4
- package/dist/chunks/references-2cgdxnb8.js +0 -4
- package/dist/chunks/right-panel-jf856w5w.js +0 -4
- package/dist/chunks/section-registry-jnf8r5gy.js +0 -4
- package/dist/chunks/studio-0f55h9ye.js +0 -5
- package/dist/chunks/studio-0sqdhnew.js +0 -12
- package/dist/chunks/studio-3aey7dd3.js +0 -5
- package/dist/chunks/studio-47y6fbpf.js +0 -5
- package/dist/chunks/studio-4m3826v2.js +0 -5
- package/dist/chunks/studio-4nx2dj1g.js +0 -4
- package/dist/chunks/studio-4xv5s47r.js +0 -9
- package/dist/chunks/studio-5py436sf.js +0 -5
- package/dist/chunks/studio-8f87n763.js +0 -10
- package/dist/chunks/studio-8mb00b84.js +0 -5
- package/dist/chunks/studio-8p51gq2h.js +0 -6
- package/dist/chunks/studio-954ds834.js +0 -5
- package/dist/chunks/studio-9ft45c83.js +0 -9
- package/dist/chunks/studio-a9yzstqj.js +0 -5
- package/dist/chunks/studio-e7xxa0sj.js +0 -5
- package/dist/chunks/studio-fzdywr6p.js +0 -9
- package/dist/chunks/studio-g5fmf0c1.js +0 -5
- package/dist/chunks/studio-geq1ea6k.js +0 -14
- package/dist/chunks/studio-grawhey1.js +0 -5
- package/dist/chunks/studio-jyzj5cxs.js +0 -5
- package/dist/chunks/studio-mgx8yhnz.js +0 -64
- package/dist/chunks/studio-mpb04y1d.js +0 -6
- package/dist/chunks/studio-n17mty64.js +0 -5
- package/dist/chunks/studio-nwh2eqsk.js +0 -6
- package/dist/chunks/studio-q1h883bt.js +0 -16
- package/dist/chunks/studio-q4tv82h7.js +0 -9
- package/dist/chunks/studio-sghy936h.js +0 -4
- package/dist/chunks/studio-tt2nactf.js +0 -5
- package/dist/chunks/studio-xasj0796.js +0 -5
- package/dist/chunks/tsMode-gr0m4dzr.js +0 -14
- package/dist/chunks/workspace-m15qtcqp.js +0 -4
- package/dist/chunks/ws-client-nf61frr1.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
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{
|
|
1
|
+
import{p,Ve}from"./studio-xz2yxfcb.js";import{te}from"./studio-ery42sqr.js";import{Us,cC}from"./studio-yb560vxr.js";import{ge,dl,Q,y,oe,C,pl,_h}from"./studio-55h4mstj.js";import{q,Om,Pc,Zr,Ny,Oy,ka,Mm,d1,m,u}from"./studio-a2ke1e4t.js";import{Kt,_i,Up,Qt,Fo,E1,Zs,T1}from"./studio-5tnvjkz4.js";import{Tm}from"./studio-gx4dnjzd.js";import{B1,FR,jR,Xd,Qm}from"./studio-9mccjwjh.js";import{to}from"./studio-g1shz58g.js";import{Tc}from"./studio-t6b6qe31.js";import{ys,yo}from"./studio-t1xzawhr.js";import{ya,jb}from"./studio-7zx31knw.js";import{AT,_C}from"./studio-gf0fz03c.js";import{Pb}from"./studio-qcsq0t15.js";import{K}from"./studio-yn9f8vtx.js";var X={invokerTags:Qm,popoverTags:Xd},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){pl((l)=>l.source===M);let o=new Map,n=FR(e,X);for(let l of n){let g=l.fix===void 0?void 0:me[l.fix];C(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=AT(e,X);for(let l of a)C(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);C.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=_h(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=jR(l?.style);if(!g)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);q(n,(w)=>{for(let h of g.base)Pc(w,a,h,"");for(let h of g.breakpoints)Oy(w,a,[h],"display","");if(g.openDisplay!==null)Ny(w,a,":popover-open","display",g.openDisplay)}),C.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)=>{Zr(l,a,"popovertarget"),Zr(l,a,"popovertargetaction")}),C.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)=>{Zr(l,a,"popover",B1)}),C.success(`Set \`popover\` to "${B1}".`,{key:"popover.repaired.mode",source:M})},title:"Set popover to auto",when:(e)=>e.document.open}]}function nT(e){e.registerAll(ye())}function Nb(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 gs(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 cm(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 tx(e){let r=cm(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 re(e){let r=e.coalesceMs??800,o=e.now??(()=>Date.now()),n=y({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)},w=(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)},h=(t,i,s)=>{let d=n.inserts.get(t);if(d){if(s===null)delete d[i];else d[i]=s;return}if(Nb(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}]]))},v=(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":{h(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=[]},k=()=>{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),w({cells:s,kind:"drop-insert",tempKey:t});return}n.deletes.add(t),w({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:v,beginGroup:T,endGroup:k,group(t){T();try{t()}finally{k()}},insertRow(t={}){ee+=1;let i=`__new-${ee}`;return n.inserts.set(i,{...t}),w({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=v(t,i);if(Nb(d,s))return;h(t,i,s),w({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 ne={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(ka(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 Ob(e,r={}){let o=Object.entries(e?.properties??{}),n=new Set(e?.required),a=new Set(r.readonlyFields),l=o.map(([g,w])=>{let h=a.has(g)?"readonly":we(w),v=Array.isArray(w.enum)?Math.max(...w.enum.map((S)=>String(S).length),4):0;return{editable:h!=="readonly",field:g,kind:h,pk:g===r.idField,required:n.has(g),schema:w,title:se(g),widthHint:h==="enum"?ie(v+3):ne[h]}});return l.sort((g,w)=>{let h=(S)=>S.pk?0:S.required?1:2,v=h(g)-h(w);return v===0?0:v}),l}function Ab(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((h)=>h[a]).filter((h)=>h!==null&&h!==void 0&&h!==""),g=be(l),w=Math.max(...l.map((h)=>Dr(h).length),a.length,4);return{editable:!0,field:a,kind:g,title:se(a),widthHint:g==="string"||g==="text"?ie(w):ne[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 Vu(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 Dr(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 nx="__key",U=new WeakMap;function Za(e){return e?U.get(oe(e))??null:null}function zu(e,r){let o=y({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=re({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)},w=(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}},h=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,v=(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 Dr(t).localeCompare(Dr(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(h(P)!==h(j))return h(P)?1:-1;return f*v(P,j,d)})}return o.grouping?[...G(t).values()].flat():t},G=(t)=>{let i=new Map;for(let s of t){let d=Dr(l.effectiveValue(s,o.grouping)),f=i.get(d);if(f)f.push(s);else i.set(d,[s])}return i},T=null,k=()=>T?.refreshData(),R={addRow(t={}){let i=l.insertRow(t);return k(),i},bindView(t){T=t},buffer:l,deleteRows(t){if(t.length===0)return;l.group(()=>{for(let i of t)l.deleteRow(i)}),k()},discardRow(t){l.discardRow(t),k()},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)k();return f},effectiveRows(){let t=(d)=>Array.isArray(d)?[...d]:d!==null&&typeof d==="object"?{$ref:d.$ref}:d,i=(d)=>{let f={[nx]: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}k()},async refresh(){if(l.isDirty()){if(!await to("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){C.info("No grid changes to save.",{key:"grid.save"});return}let s=w(t);if(s){l.applyCommitResult(s),C.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 to("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?ya({title:"Saving grid"}):null;o.saving=!0;try{let c=await r.commit(t),x=(b,V)=>`${b}\x00${V}`,P=new Map(t.cells.map((b)=>[x(b.rowKey,b.field),b]));for(let b of c.cells){let V=P.get(x(b.rowKey,b.field));if(b.ok&&V){let Y=n.get(b.rowKey);if(Y)Y.cells[b.field]=V.value}}if(l.applyCommitResult(c),c.inserts.some((b)=>b.ok)||c.deletes.some((b)=>b.ok))await g();let I=c.cells.filter((b)=>b.ok).length+c.inserts.filter((b)=>b.ok).length+c.deletes.filter((b)=>b.ok).length,H=i-I,W=c.cells.filter((b)=>b.stale).length+c.deletes.filter((b)=>b.stale).length;if(H===0)C.success(`Saved ${I} change(s).`,{key:"grid.save"});else C.error(`Saved ${I} · ${H} failed${W?` (${W} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(c){C.error("Could not save the grid.",{action:"file.save",detail:te(c),key:"grid.save",source:"Data"})}finally{o.saving=!1,f?.done(),k()}},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}k()},setGrouping(t){o.grouping=t,k()},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,k();return}await this.setQuery(i)},source:r,state:o,tab:e};return e.scope.run(()=>{Q(()=>{e.doc.dirty=l.isDirty()}),Om(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo(),k()},undo:()=>{l.undo(),k()}});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&&!Tc(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),C.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),k()}else R.refresh()});dl(i)}dl(()=>{Om(e,null),U.delete(oe(e)),r.dispose?.()})}),U.set(oe(e),R),R}async function Td(e){let o=Za(e)?.serializeForSource();if(o)return o;await Kt();let n=_i(e.doc.sourceFormat);if(n?.capabilities.serialize){let a=e.doc.content?.frontmatter||{},l=e.doc.document,g={...a,...l,children:l.children??[]};return Zs(n.name,g,{mode:"roundtrip"})}if(e.doc.mode==="content"){let a=Fo();if(a){let l=e.doc.content?.frontmatter??{},g=Object.keys(l).length>0,w={...l,...e.doc.document};return Zs(a.name,w,{frontmatter:g,mode:"roundtrip"})}}return yo(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(!Ve())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 Td(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 iT(){ae()}function rT(){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 oT(){if(B=!1,E)clearTimeout(E),E=null;O=null,N?.stop(),N=null,D.clear()}async function ix(){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("+"),w=g===-1?null:l.slice(g+1),h=g===-1?l:l.slice(0,g);if(w==="")return null;let v=h.indexOf("."),S=v===-1?null:h.slice(0,v),G=S!==null&&Se.has(S)?S:null,T=G===null?h:h.slice(G.length+1);if(T==="")return null;let k={};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);k[i]=s}return{parameters:k,subtype:T,suffix:w,tree:G,type:a}}function rx(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 E1(e.name,r);return T1(e,o)}async function Do(e,r){await Kt();let o=Qt(e);if(!o||!o.capabilities.parse)throw Up(e);return{...await Ge(o,r),format:o}}var JS=async(e,r)=>{if(e.documentPath&&Qt(e.documentPath)){let n=await Do(e.documentPath,r);return{document:n.document,frontmatter:n.frontmatter}}let o=ys(r);return e.doc.layout=o.layout,{document:o.document}};var fe=()=>{};function YS(e){fe=e}function A(e){let r=e.doc.document;fe(e.documentPath,r);let o=typeof r.tagName==="string"&&r.tagName.includes("-")?Pb(r):null;if(o)C.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!Tm(e.documentPath??"")}async function yp(e=u.value){if(!e)return!1;if(await _C(e.id),Mm(e))return C.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 C.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=Za(e);if(r)return await r.save(),!e.doc.dirty;try{if(await d1(e))return A(e),!0;let o=await Td(e);if(e.documentPath)return await p().writeFile(e.documentPath,o),e.doc.dirty=!1,ix(),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}C.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))C.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 _i(e.doc.sourceFormat)??(e.doc.mode==="content"?Fo():void 0)}async function ZS(){let e=u.value;if(!e)return;try{await Kt();let r=Ee(e),o=await Td(e),n=r?rx(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 w=e.documentPath?e.documentPath.split("/").pop():g,h=await window.showSaveFilePicker({suggestedName:w,types:[{accept:{[n]:[a]},description:l}]}),v=await h.createWritable();await v.write(o),await v.close(),e.doc.dirty=!1,A(e),C.success(`Exported as ${h.name}.`)}else{let w=new Blob([o],{type:n}),h=URL.createObjectURL(w),v=document.createElement("a");v.href=h,v.download=g,v.click(),URL.revokeObjectURL(h),e.doc.dirty=!1,A(e),C.success(`Downloaded ${g}.`)}}catch(r){if(!(r instanceof Error&&r.name==="AbortError"))C.error("Could not export the document.",{detail:te(r),source:"Export"})}}async function pe(e,r){let o=Tm(e)?await jb(e):await Us({path:e});return cC(o,r)??""}async function dm(e){let r=await pe(e.path,"delete"),o=`Delete ${e.name}? This cannot be undone.`;return Boolean(await to("Delete File",r===""?o:`${o} ${r}`,{confirmLabel:"Delete",destructive:!0}))}async function um(e,r="rename"){let o=await pe(e,r);return o===""?void 0:o}
|
|
2
|
+
export{Nb,gs,cm,tx,Ob,Ab,Vu,Dr,nx,Za,zu,nT,Td,iT,rT,oT,ix,rx,Do,JS,YS,yp,ZS,dm,um};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B0789673446C505064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-7vg6jcd3.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{hi}from"./studio-zyqn40w4.js";import{ge,Q,y,jr,C}from"./studio-55h4mstj.js";import{Ic,Us,gm}from"./studio-yb560vxr.js";import{_o}from"./studio-1q1sh2ax.js";import{pn,an}from"./studio-9mccjwjh.js";import{ot,zt,T,I,An,Ct}from"./studio-g1shz58g.js";import{jd}from"./studio-t1xzawhr.js";import{gT}from"./studio-yw05w8f0.js";import{Kn}from"./studio-rc6dvxjb.js";var N={message:"no media file to look for",status:"failed"};function v(t){let e=hi(t);return e===""?null:{path:e}}function uT(t){let e=v(t);return e===null?null:Ic(e)}async function jb(t){let e=v(t);return e===null?N:Us(e)}function hT(t){if(t===null)return"Counting references…";switch(t.status){case"unsupported":return null;case"pending":return"Counting references…";case"failed":return"Usage unknown";default:return gm(t.result)}}var b={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelActivity",$description:'The Activity feed: one row per operation this session, newest last, drawn from the projection `panels/activity-panel.ts` hands in. A row is a glyph, a head line (what the operation is, who is running it, how long it has taken), the line it is doing now, the plan it declared, the log it captured and — only when the operation handed a callback over — its Cancel. Every conditional the row has is a boolean field on the projected item, because `$switch` over a value is the only conditional a document has and "is this entry cancellable" is a question the panel has already answered. Nothing here reads the activity store: the panel owns what an operation IS, and the surface owns what it looks like.',tagName:"div",attributes:{part:"panel"},style:{$description:"What `.activity-panel`, `.activity-actions`, `.activity-list`, `.activity-row`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-duration`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step-icon`, `.activity-log-toggle` and `.activity-log` said in `styles/panels.css`, keyed on `part`. Two rules were DELETED rather than moved: `.activity-clear` and `.activity-cancel` drew a small bordered button by hand, and `jx-button` is that button — so the sizes, the border, the hover fill and the disabled state are the kit's now. Three token names changed meaning on the way: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and this document is mounted into the Bottom dock's body where that element is not an ancestor — every one of them would silently have taken its px fallback. They are the kit's own scale here (`--jx-text-sm`, `--jx-text-md`, `--jx-radius-xs`), which is the step each of them was. The `.activity-*` rules stay in the stylesheet regardless: `publish/deploy-checklist.ts` still draws the checklist above this feed in that same vocabulary, and it is a lit template until it converts.",display:"flex",flexDirection:"column",gap:"8px",padding:"8px",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="feed"]':{display:"flex",flexDirection:"column",gap:"8px",minWidth:"0"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{$description:"The left border is the state, at 3px, which is the one thing that must be legible in a column of twenty rows without reading any of them. Its default is the dim foreground so a state nobody has a colour for still draws a border rather than a gap.",display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 8px",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-state="running"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-state="done"]':{borderLeftColor:"var(--success)"},'& [part="row"][data-state="failed"]':{borderLeftColor:"var(--danger)"},'& [part="row"][data-state="cancelled"]':{borderLeftColor:"var(--fg-dim)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] [part="icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] [part="icon"]':{color:"var(--success)"},'& [part="row"][data-state="failed"] [part="icon"]':{color:"var(--danger)"},'& [part="body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"8px",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"], & [part="duration"]':{flex:"none",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="duration"]':{$description:"Pushed to the far edge so a column of rows reads as a column of times.",marginLeft:"auto"},'& [part="status"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The plan, declared up front, so "which of the three steps is this on" is answered by looking rather than by reading the status line and remembering what came before it.',display:"flex",flexDirection:"column",gap:"1px",margin:"2px 0 0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-sm)"},'& [part="step"]':{display:"flex",gap:"6px",color:"var(--fg-dim)"},'& [part="step"][data-state="running"]':{color:"var(--fg)"},'& [part="step"][data-state="done"] [part="step-icon"]':{color:"var(--success)"},'& [part="step"][data-state="failed"] [part="step-icon"]':{color:"var(--danger)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="log-toggle"]':{$description:"A plain button rather than a kit one, and the one element here that is not the kit's. The control has to carry `aria-expanded` on the node the reader actually focuses, and a `jx-button` forwards a fixed set of ARIA properties to the control inside its shadow root — an attribute written on the host would name the wrapper and not the button. Its wording is the disclosure's whole state (`docs/studio/interface/problems-and-progress.md` calls it the Show log disclosure), so nothing else has to draw one.",alignSelf:"flex-start",padding:"0",border:"none",background:"none",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="log"]':{$description:"The captured output the progress modal used to show once and then lose. It scrolls inside the row rather than growing it, so one 400-line `bun install` failure does not become the whole panel. It is selectable against the root's `user-select: none`, the one part of an activity row that is: the output is what a reader pastes into a bug report, and the row offers no copy action.",userSelect:"text",maxHeight:"180px",margin:"2px 0 0",padding:"6px",overflow:"auto",borderRadius:"var(--jx-radius-xs)",background:"var(--bg)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap"},'& [part="cancel"]':{flex:"none"},'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template and a document cannot call one. What it says is what is kept — one sentence saying what the region is FOR, then where its content comes from — and this region's fill is an operation somebody else starts, so it offers no button.",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"24px",textAlign:"center",fontSize:"13px",color:"var(--fg-dim)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"}},children:[{tagName:"div",attributes:{part:"feed-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRows"},cases:{true:{tagName:"div",attributes:{part:"feed"},children:[{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFinished"},cases:{true:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{size:"sm",quiet:!0},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearFinished"}}]},children:[{tagName:"span",textContent:"${state.clearLabel}"}]}]}}},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"row","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSource"},cases:{true:{tagName:"span",attributes:{part:"source"},textContent:"${$map.item.source}"}}},{tagName:"span",attributes:{part:"duration"},textContent:"${$map.item.duration}"}]},{tagName:"div",attributes:{part:"status-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasStatus"},cases:{true:{tagName:"div",attributes:{part:"status"},textContent:"${$map.item.status}"}}},{tagName:"div",attributes:{part:"steps-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSteps"},cases:{true:{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"$map/item/steps"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"step","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-label"},textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"log-toggle-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasLog"},cases:{true:{tagName:"button",attributes:{part:"log-toggle",type:"button","aria-expanded":"${$map.item.expanded ? 'true' : 'false'}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleLog"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.logLabel}"}}},{tagName:"div",attributes:{part:"log-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/showLog"},cases:{true:{tagName:"pre",attributes:{part:"log"},textContent:"${$map.item.logText}"}}}]},{tagName:"div",attributes:{part:"cancel-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/cancellable"},cases:{true:{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"cancel",title:"Stop this operation"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"Cancel"}]}}}]}}]}]},false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Long operations show their progress, their log and their Cancel button here."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Installs, clones, publishes and imports report here while they run."}]}}}]};T("panel-activity",b);var g=null,h=null,p=null,d=null;function j(t,e){t.rows=e.rows,t.hasRows=e.hasRows,t.hasFinished=e.hasFinished,t.clearLabel=e.clearLabel}function H(t){if(g!==t)return!1;return d===null?p!==null:d.root.parentNode===t}function w(t,e){if(H(t))return;f(),g=t;let a=y({cancel:e.cancel,clearFinished:e.clearFinished,clearLabel:"",hasFinished:!1,hasRows:!1,rows:[],toggleLog:e.toggleLog});h=ge(),h.run(()=>{Q(()=>{j(a,e.project())})});let o=I("panel-activity",a,t);p=o,o.then((i)=>{if(p===o)d=i;else i.dispose()})}function f(){h?.stop(),h=null;let t=p;if(p=null,d)d.dispose(),d=null;else if(t)t.then((e)=>e.dispose());g=null}var s=y([]),R=20,u=new Map,x=0;function F(){return x+=1,`a${x}`}function c(t){return t.state!=="running"}function S(){let t=s.filter((e)=>c(e)).length-R;while(t>0){let e=s.findIndex((a)=>c(a));if(e===-1)return;u.delete(s[e].id),s.splice(e,1),t-=1}}function ba(t){let e={cancellable:t.cancel!==void 0,endedAt:null,expanded:!1,id:F(),log:[],startedAt:jr(),state:"running",status:t.status??"",steps:(t.steps??[]).map((i)=>({label:i,state:"pending"})),title:t.title,...t.source===void 0?{}:{source:t.source}};if(t.cancel)u.set(e.id,t.cancel);s.push(e);let a=s.at(-1);S();let o=(i,r)=>{if(c(a))return;if(a.state=i,a.endedAt=jr(),r!==void 0)a.status=r;for(let n of a.steps)n.state=n.state==="done"?"done":i==="done"?"done":"failed";a.cancellable=!1,u.delete(a.id),S()};return{done(i){o("done",i)},entry:a,fail(i,r={}){if(c(a))return;let n=a.log.join(`
|
|
2
|
+
`);o("failed",i),C.error(i,{source:a.source??a.title,...n===""?{}:{detail:n},...r.action===void 0?{}:{action:r.action},...r.path===void 0?{}:{path:r.path}})},id:a.id,log(i){let r=i.replace(/\s+$/,"");if(r!=="")a.log.push(r)},setStatus(i){if(!c(a))a.status=i},step(i){let r=a.steps.findIndex((n)=>n.label===i);if(r===-1)a.steps.push({label:i,state:"pending"}),r=a.steps.length-1;for(let[n,l]of a.steps.entries())l.state=n<r?"done":n===r?"running":l.state;a.status=i}}}function A(t){return s.find((e)=>e.id===t)}function m(){return s.filter((t)=>!c(t))}function P(t){let e=A(t),a=u.get(t);if(!e||!a||c(e))return!1;return a(),u.delete(t),e.state="cancelled",e.endedAt=jr(),e.cancellable=!1,e.status="Cancelled",!0}function M(){let t=s.filter((a)=>!c(a)),e=s.length-t.length;return s.splice(0,s.length,...t),e}function cT(){return m().map((t)=>`activity: ${t.title} — ${t.status||"running"}`)}var D={cancelled:"⊘",done:"✓",failed:"✕",running:"⋯"},V={done:"✓",failed:"✕",pending:"·",running:"⋯"};function z(t,e=jr()){let a=Math.max(0,(t.endedAt??e)-t.startedAt);if(a<1000)return`${a}ms`;let o=Math.round(a/1000);return o<60?`${o}s`:`${Math.floor(o/60)}m ${o%60}s`}function _(t,e){return{icon:V[t.state],key:`${e}:${t.label}`,label:t.label,state:t.state}}function O(t){let e=t.log.length;return{cancellable:t.cancellable,duration:z(t),expanded:t.expanded,hasLog:e>0,hasSource:(t.source??"")!=="",hasStatus:t.status!=="",hasSteps:t.steps.length>0,icon:D[t.state],id:t.id,logLabel:t.expanded?"Hide log":`Show log (${e} line(s))`,logText:t.log.join(`
|
|
3
|
+
`),showLog:t.expanded&&e>0,source:t.source??"",state:t.state,status:t.status,steps:t.steps.map((a,o)=>_(a,o)),title:t.title}}function U(){let t=s.filter((e)=>c(e)).length;return{clearLabel:`Clear ${t} finished`,hasFinished:t>0,hasRows:s.length>0,rows:s.map((e)=>O(e))}}var W={cancel:(t)=>{P(t)},clearFinished:()=>{M()},project:U,toggleLog:(t)=>{let e=A(t);if(e)e.expanded=!e.expanded}};function B(){return _o`<div data-deploy-checklist></div>
|
|
4
|
+
<div data-activity-surface></div>`}function q(t){let e=t.querySelector("[data-activity-surface]");if(!e){f();return}w(e,W)}function dT(){Kn({id:"activity",title:"Activity",level:"project",dock:"bottom",icon:"clock-counter-clockwise",rail:!1,badge:()=>m().length>0?m().length:null,render:()=>B(),afterRender:(t,e)=>{gT(e),q(e)}})}var k={$schema:"https://jxsuite.com/schema/v1",$id:"StudioProgressModal",$description:"The one surface in Studio that blocks while it works: the operation's name, a spinner, the line under it, and the two ways out. A `jx-dialog`, so the platform owns modality, the backdrop, focus restoration and Escape — which is what retired the `sp-underlay` this surface used to paint beside itself, and with it the fixed box, the panel, the shadow and the `z-index: 1000` that box needed to climb back out from under its own scrim. The two answers are the dialog's own: confirm is `Run in the background`, which stops the BLOCKING and leaves the work running in Activity, and the secondary answer is Cancel, drawn only when the operation handed one over. It is the secondary rather than the cancel answer for a reason that is behavioural, not cosmetic: the platform raises one `cancel` for Escape, for a light dismissal and for the cancel button alike, and a surface that cannot tell them apart would stop a dependency install on a keystroke. Escape therefore means what confirm means — stop blocking, not stop working — and the answer that stops the work is a button and only a button.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/title"},confirmLabel:"Run in the background",secondaryLabel:{$ref:"#/state/cancelLabel"},cancelLabel:"",size:"sm"},attributes:{part:"progress"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/background"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/background"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What is left once `jx-dialog` has drawn the dialog. `.progress-modal` is gone rather than moved — it positioned a fixed box, painted its panel, border, radius and shadow, capped its height and then lifted itself above the scrim it rendered beside — and a modal `<dialog>` in the top layer is every one of those. `.progress-title` went the same way: the operation's name is the dialog's headline, which is also its accessible name, so nothing here draws a title.",'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="status"]':{$description:"`anywhere`, because a status line is usually a path or a package spec with no space in it, and one of those would otherwise be the thing that decides how wide the dialog is. `min-width: 0` is what lets it wrap at all: a flex item's automatic minimum is its content, so without this the row refuses to shrink and the text overflows instead.",minWidth:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",overflowWrap:"anywhere"}},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"jx-spinner",attributes:{part:"busy"},$props:{size:"lg"}},{tagName:"span",attributes:{part:"status","aria-live":"polite"},textContent:"${state.status}"}]}]};T("progress-modal",k);function L(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(ot,zt("modal","progress")),t.layer.append(e);let a=!1,o=y({background:()=>{t.onBackground()},cancel:()=>{t.onCancel()},cancelLabel:t.cancellable?"Cancel":"",closed:()=>{t.onClosed()},status:t.status,title:t.title}),i=null,r=I("progress-modal",o,e).then(async(n)=>{let l=n.root;if(a)return n.dispose(),l;if(i=n,await An(l),a)return l;return pn(l),l});return{close(){if(a)return;a=!0;let n=i?.root;if(n instanceof HTMLElement)an(n);i?.dispose(),i=null,e.remove()},host:e,ready:r,setStatus(n){o.status=n}}}function ya(t){let e=!1,a=ba({title:t.title,...t.status===void 0?{}:{status:t.status},...t.source===void 0?{}:{source:t.source},...t.cancel===void 0?{}:{cancel:t.cancel}}),o=()=>{if(e)return;e=!0,r.close()},i=()=>{o(),jd("activity")},r=L({cancellable:t.cancel!==void 0,layer:Ct("modal"),onBackground:i,onCancel:()=>{o(),t.cancel?.()},onClosed:o,status:t.status??"",title:t.title});return{activity:a,done(){a.done(),o()},fail(n){let l=(n??"").trim();if(l===""||l.includes(`
|
|
5
|
+
`))a.log(l),a.fail(`${t.title} failed`);else a.fail(l);o()},log(n){a.log(n)},setStatus(n){if(a.setStatus(n),!e)r.setStatus(n)}}}
|
|
6
|
+
export{ba,cT,dT,ya,uT,jb,hT};
|
|
7
|
+
|
|
8
|
+
//# debugId=EA4F84741816E31364756E2164756E21
|
|
9
|
+
//# sourceMappingURL=studio-7zx31knw.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{RS,$S,IS}from"./studio-vrmcjf9g.js";import{p,Ve}from"./studio-xz2yxfcb.js";import{Uf,J0,Y0}from"./studio-933e30n4.js";import{yT,Hb,wa,kT,No,Xa,Vb}from"./studio-tdcprbqb.js";import{me}from"./studio-pre0skq6.js";var t="checking",i=null;function nb(){return Ve()&&Boolean(p().cfConnect)}async function zf(){if(!nb())return;i??=(async()=>{try{t=await p().cfConnection?.()??null}catch{t=null}i=null,sp()})(),await i}function Zk(){if(nb()&&t==="checking"&&!i)zf()}function Xk(){t="checking",i=null}async function d(){let n=await p().cfConnect?.();if(n?.status==="connected"&&!n.connection.accountId){let{openCfAccountPicker:e}=await (me("af1h381v"),import("./cf-account-picker-af1h381v.js"));await e()}No(),await zf()}function s(){let n={id:"disconnect",label:"Disconnect",run:async()=>{await p().cfDisconnect?.(),No(),await zf()},variant:"negative"},e=(r)=>({id:r==="Connect"?"connect":"reconnect",label:r,run:d,variant:"accent"}),o={id:"cloudflare",label:"Cloudflare",revoke:()=>{}};if(t==="checking")return{...o,actions:[],connected:!1,detail:"Checking your connection…"};if(!t?.connected)return{...o,actions:[e("Connect")],connected:!1,detail:"Not connected. Connecting publishes this site and runs the assistant on Workers AI."};let c=()=>{n.run()};if(t.needsReconnect)return{...o,actions:[e("Reconnect"),n],connected:!0,detail:"Connection expired. Reconnect to keep publishing and the assistant working.",revoke:c};if(t.needsAccount||!t.accountId)return{...o,actions:[{id:"choose-account",label:"Choose account",run:async()=>{let{openCfAccountPicker:r}=await (me("af1h381v"),import("./cf-account-picker-af1h381v.js"));if(await r())No(),await zf()},variant:"accent"},n],connected:!0,detail:"Connected, but no account is chosen yet — publishing and the assistant need one.",revoke:c};return{...o,actions:[n],connected:!0,detail:`Connected — ${t.accountName??t.accountId}.`,revoke:c}}function l(){let n=Uf(),e=J0();return{connected:Boolean(n),detail:n?`Connected${e?` — account ${e}`:""}.`:"Not connected. Publishing will ask when it needs it.",id:"cloudflare",label:"Cloudflare",revoke:Y0}}function u(n){let e={id:n.id,label:n.label,run:async()=>{await Vb(n)}};if(n.primary)e.variant="accent";return e}function f(n){return{actions:(n.actions??[]).map((e)=>u(e)),connected:n.connected??!1,detail:n.detail,id:`platform:${n.id}`,label:n.label,revoke:()=>{}}}function G0(){let n=RS(),e=Xa(),o=wa();return[{id:"github",label:"GitHub",detail:n?$S()==="desktop"?"Signed in — the token is in this app's config folder, readable only by you.":"Signed in — a device-flow token is stored in this browser.":"Not signed in. Cloning and pushing will ask when they need it.",connected:Boolean(n),revoke:IS},{id:"ai",label:"AI provider",detail:Hb()?`Key stored. Model ${e}${o?` via ${o}`:""}.`:"No key stored. The Assistant section is where one is entered.",connected:Hb(),revoke:kT},nb()?s():l(),...yT().map((c)=>f(c))]}function Qk(n){let e=G0().find((o)=>o.id===n);if(!e)return!1;return e.revoke(),sp(),!0}var a=new Set;function eE(n){return a.add(n),()=>{a.delete(n)}}function sp(){for(let n of a)n()}
|
|
2
|
+
export{nb,zf,Zk,Xk,G0,Qk,eE,sp};
|
|
3
|
+
|
|
4
|
+
//# debugId=97CF6214B79C962B64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-8bxk97km.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var n;function
|
|
2
|
-
export{
|
|
1
|
+
var n;function ZR(e){n=new URL("./",e).href}function ov(e){if(n===void 0)throw Error(`bundleUrl(${JSON.stringify(e)}) before setBundleBase(). An entry module (src/studio.ts or src/canvas/iframe-entry.ts) must call setBundleBase(import.meta.url) first; a test needs tests/with-dom.ts, which sets one.`);return new URL(e,n).href}
|
|
2
|
+
export{ZR,ov};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=2B3B80E01385F12F64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-8grwxtqk.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{St,Oo,Xo,eh}from"./studio-w0cgf6jg.js";function Uf(){return Oo(St.cfToken)}function K0(t){Xo(St.cfToken,t||"")}function J0(){return Oo(St.cfAccountId)}function RI(t){Xo(St.cfAccountId,t||"")}function Y0(){eh([St.cfToken,St.cfAccountId])}
|
|
2
|
+
export{Uf,K0,J0,RI,Y0};
|
|
3
|
+
|
|
4
|
+
//# debugId=6C77B9E400F50A4E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-933e30n4.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-qpqa7vk3.js";import{qt,Vs,Ja}from"./studio-tt2nactf.js";import{ne}from"./studio-geq1ea6k.js";import{T,R,on,$c,vs}from"./studio-e7xxa0sj.js";import{v}from"./studio-vzacdfsc.js";import{u}from"./studio-3aey7dd3.js";import{Qg,dE,jf,Lo}from"./studio-zxp13sss.js";import{Od,Zo,D}from"./studio-wgh5kxpj.js";var N={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var P=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(P.map((e)=>[e.mode,e])),E=P.filter((e)=>e.prefix!=="");function F(e){return X.get(e)??P[0]}function O(e,t,n){let r=E.find((i)=>t.startsWith(i.prefix));if(r)return O(r.mode,t.slice(1),n);let a=e;if(a==="picker"&&t.trim()!=="")a="files";if(a==="files"&&!n)a="projects";return{mode:a,query:t}}var Y=new Set(["/","-","_","."," "]);function V(e,t){if(t==="")return 0;let n=e.toLowerCase(),r=t.toLowerCase(),a=n.lastIndexOf("/")+1,i=0,o=0,x=-2;for(let G of r){let m=n.indexOf(G,o);if(m===-1)return null;if(m===x+1)i+=8;if(m===0||Y.has(n[m-1]??""))i+=6;if(m>=a)i+=4;x=m,o=m+1}return i-x*0.01-n.length*0.001}function k(e,t,n){let r=[];for(let[a,i]of e.entries()){let o=V(n(i),t);if(o!==null)r.push({index:a,item:i,score:o})}return r.toSorted((a,i)=>i.score-a.score||a.index-i.index).map((a)=>a.item)}function q(e){let t=e.args,n=t?.properties;if(!t||!n)return{kind:"none"};let r=Object.keys(n);if(r.length!==1)return{kind:"unsupported"};let a=r[0],i=n[a];if(i.enum)return{kind:"choice",name:a,choices:i.enum.map((o)=>({label:String(o),value:o}))};if(i.type==="boolean")return{kind:"choice",name:a,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function S(e){return`quick-search-option-${e}`}var _="jx-studio-recent-commands",Z=6;function L(){try{let e=JSON.parse(localStorage.getItem(_)||"[]");return Array.isArray(e)?e.filter((t)=>typeof t==="string"):[]}catch{return[]}}function ee(e){let t=[e,...L().filter((n)=>n!==e)].slice(0,Z);try{localStorage.setItem(_,JSON.stringify(t))}catch{}}var z=null,f=!1,g="picker",d="",c=0,b=null,w=!1,s=null;function H(){return vs("popover","quick-search")}function j_(e){z=e??null}function Df(e="files"){f=!0,g=e,d="",c=0,s=null,b=null,l(),ve(),C()}function y(){f=!1,s=null,l()}function J(){return D?D.projectRoot??null:null}function B(){return D!=null}function Q(){return O(g,d,B())}function W(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function te(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function C(){if(!f||b!==null||w||!B())return;w=!0,l();try{await qt(),b=(await p().searchFiles("",Ja())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:W(t.path),recent:!1}))}catch{b=[]}w=!1,l()}function oe(e){if(e.trim()==="")return dE(J()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:W(t.path),recent:!0}));return k(b??[],e.trim(),(t)=>t.path)}function re(e){let t=Qg().map((n)=>({kind:"project",root:n.root,name:n.name,detail:te(n.root)}));return k(t,e.trim(),(n)=>`${n.name}/${n.root}`)}function ae(e,t){let n=L(),r=[];for(let o of e.visible()){if(q(o).kind==="unsupported")continue;if(!(o.menus??["palette"]).includes("palette"))continue;r.push({kind:"command",id:o.id,name:`${o.category}: ${o.title}`,detail:e.disabledReason(o.id)??"",chord:e.keymap.formatBinding(o.id)??"",enabled:e.isEnabled(o.id),recent:n.includes(o.id)})}let a=k(r,t.trim(),(o)=>o.name);if(t.trim()!=="")return a;let i=n.map((o)=>a.find((x)=>x.id===o)).filter((o)=>o!==void 0);return[...i,...a.filter((o)=>!i.includes(o))]}function ie(e){let t=u.value;if(!t)return[];let n=Od(t.doc.document).map((r)=>({kind:"node",path:r.path,name:r.nodeType==="text"?String(r.node).slice(0,60):Zo(r.node),detail:r.nodeType}));return k(n,e.trim(),(r)=>r.name)}function se(){return P.filter((e)=>e.mode!=="picker").map((e)=>({kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}))}function ce(e){let t=s,n=t.choices.map((r)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:r.value,name:r.label,detail:`${t.command.title} → ${t.name}`}));return k(n,e.trim(),(r)=>r.name)}function de(){let{mode:e,query:t}=Q();if(s)return{rows:ce(t),showingRecent:!1};switch(e){case"commands":{let n=ne();return{rows:n?ae(n,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:ie(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:se(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function le(e){let t=E.find((n)=>e.startsWith(n.prefix));if(t)g=t.mode,d=e.slice(1);else d=e;if(c=0,e!==d)j().query=e;l(),C()}function pe(){g="picker",s=null,c=0,l()}function me(e){g=e,d="",c=0,l(),C()}function U(e,t){let n=ne();if(!n)return;ee(e.id),y(),on(n,e.id,t,"Palette")}function M(e){switch(e.kind){case"project":{y(),z?.openRecentProject(e.root);return}case"file":{y(),jf({name:e.name,path:e.path,root:J()??""}),Lo(e.path);return}case"mode":{me(e.mode);return}case"node":{y(),$c("selection.set",{path:e.path},"Palette");return}case"arg":{U(s.command,{[e.argName]:e.value});return}default:ue(e)}}function ue(e){let t=ne(),n=t?.get(e.id);if(!t||!n||!e.enabled)return;let r=q(n);if(r.kind==="choice"){s={choices:r.choices,command:n,name:r.name},d="",c=0,l();return}U(n)}function he(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Vs(t))return"file-text";return"file"}function fe(e){switch(e.kind){case"project":return"folder-open";case"file":return he(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function ge(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function xe(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function be(e,t){if(w)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return F(e).placeholder}}T("palette",N);var I=null,A=null,h=[];function j(){return I??=v({activate:()=>{let e=h[c];if(e)M(e)},activateRow:(e)=>{let t=h[Number(e)];if(t)M(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:pe,close:y,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{c=e,j().activeId=S(e)},input:le,isEmpty:!0,move:(e)=>{if(h.length===0)return;c=Math.max(0,Math.min(c+e,h.length-1)),j().activeId=S(c)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),I}function ve(){setTimeout(()=>{if(f)H().querySelector('[part="input"]')?.focus()},0)}function l(){let e=j();if(!A)A=R("palette",e,H());if(e.open=f,!f){h=[];return}let{mode:t,query:n}=Q(),{rows:r,showingRecent:a}=de(),i=F(t);h=r,e.placeholder=s?`Choose a ${s.name}…`:i.placeholder,e.hasChip=s!==null||t!=="picker",e.chipLabel=s?s.command.title:i.chip,e.query=d,e.canClearMode=d===""&&(s!==null||g!=="picker"),e.rows=r.map((o)=>({chord:(o.kind==="command"||o.kind==="mode")&&o.chord?o.chord:"",detail:o.detail,disabled:o.kind==="command"&&!o.enabled,icon:fe(o),key:xe(o),kind:o.kind,name:o.name,trailing:ge(o,a)})),e.expanded=r.length>0,e.activeId=r.length>0?S(c):"",e.isEmpty=r.length===0,e.emptyHint=be(t,n),e.showSection=a&&r.length>0,e.sectionLabel=s?`${s.command.title} — ${s.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./studio-xz2yxfcb.js";import{Kt,Ys,ol}from"./studio-5tnvjkz4.js";import{ne}from"./studio-9mccjwjh.js";import{T,I,sn,sl,Cs}from"./studio-g1shz58g.js";import{y}from"./studio-55h4mstj.js";import{u}from"./studio-a2ke1e4t.js";import{pb,kE,Qf,Ir}from"./studio-kk7h30ne.js";import{Gd,eo,D}from"./studio-yn9f8vtx.js";var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var R=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(R.map((e)=>[e.mode,e])),E=R.filter((e)=>e.prefix!=="");function F(e){return X.get(e)??R[0]}function O(e,t,n){let r=E.find((i)=>t.startsWith(i.prefix));if(r)return O(r.mode,t.slice(1),n);let a=e;if(a==="picker"&&t.trim()!=="")a="files";if(a==="files"&&!n)a="projects";return{mode:a,query:t}}var Y=new Set(["/","-","_","."," "]);function V(e,t){if(t==="")return 0;let n=e.toLowerCase(),r=t.toLowerCase(),a=n.lastIndexOf("/")+1,i=0,o=0,x=-2;for(let G of r){let m=n.indexOf(G,o);if(m===-1)return null;if(m===x+1)i+=8;if(m===0||Y.has(n[m-1]??""))i+=6;if(m>=a)i+=4;x=m,o=m+1}return i-x*0.01-n.length*0.001}function k(e,t,n){let r=[];for(let[a,i]of e.entries()){let o=V(n(i),t);if(o!==null)r.push({index:a,item:i,score:o})}return r.toSorted((a,i)=>i.score-a.score||a.index-i.index).map((a)=>a.item)}function q(e){let t=e.args,n=t?.properties;if(!t||!n)return{kind:"none"};let r=Object.keys(n);if(r.length!==1)return{kind:"unsupported"};let a=r[0],i=n[a];if(i.enum)return{kind:"choice",name:a,choices:i.enum.map((o)=>({label:String(o),value:o}))};if(i.type==="boolean")return{kind:"choice",name:a,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function P(e){return`quick-search-option-${e}`}var _="jx-studio-recent-commands",Z=6;function L(){try{let e=JSON.parse(localStorage.getItem(_)||"[]");return Array.isArray(e)?e.filter((t)=>typeof t==="string"):[]}catch{return[]}}function ee(e){let t=[e,...L().filter((n)=>n!==e)].slice(0,Z);try{localStorage.setItem(_,JSON.stringify(t))}catch{}}var z=null,f=!1,g="picker",d="",c=0,b=null,w=!1,s=null;function H(){return Cs("popover","quick-search")}function eS(e){z=e??null}function qf(e="files"){f=!0,g=e,d="",c=0,s=null,b=null,l(),ve(),S()}function v(){f=!1,s=null,l()}function J(){return D?D.projectRoot??null:null}function B(){return D!=null}function Q(){return O(g,d,B())}function W(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function te(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function S(){if(!f||b!==null||w||!B())return;w=!0,l();try{await Kt(),b=(await p().searchFiles("",ol())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:W(t.path),recent:!1}))}catch{b=[]}w=!1,l()}function oe(e){if(e.trim()==="")return kE(J()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:W(t.path),recent:!0}));return k(b??[],e.trim(),(t)=>t.path)}function re(e){let t=pb().map((n)=>({kind:"project",root:n.root,name:n.name,detail:te(n.root)}));return k(t,e.trim(),(n)=>`${n.name}/${n.root}`)}function ae(e,t){let n=L(),r=[];for(let o of e.visible()){if(q(o).kind==="unsupported")continue;if(!(o.menus??["palette"]).includes("palette"))continue;r.push({kind:"command",id:o.id,name:`${o.category}: ${o.title}`,detail:e.disabledReason(o.id)??"",chord:e.keymap.formatBinding(o.id)??"",enabled:e.isEnabled(o.id),recent:n.includes(o.id)})}let a=k(r,t.trim(),(o)=>o.name);if(t.trim()!=="")return a;let i=n.map((o)=>a.find((x)=>x.id===o)).filter((o)=>o!==void 0);return[...i,...a.filter((o)=>!i.includes(o))]}function ie(e){let t=u.value;if(!t)return[];let n=Gd(t.doc.document).map((r)=>({kind:"node",path:r.path,name:r.nodeType==="text"?String(r.node).slice(0,60):eo(r.node),detail:r.nodeType}));return k(n,e.trim(),(r)=>r.name)}function se(){return R.filter((e)=>e.mode!=="picker").map((e)=>({kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}))}function ce(e){let t=s,n=t.choices.map((r)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:r.value,name:r.label,detail:`${t.command.title} → ${t.name}`}));return k(n,e.trim(),(r)=>r.name)}function de(){let{mode:e,query:t}=Q();if(s)return{rows:ce(t),showingRecent:!1};switch(e){case"commands":{let n=ne();return{rows:n?ae(n,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:ie(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:se(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function le(e){let t=E.find((n)=>e.startsWith(n.prefix));if(t)g=t.mode,d=e.slice(1);else d=e;if(c=0,e!==d)j().query=e;l(),S()}function pe(){g="picker",s=null,c=0,l()}function me(e){g=e,d="",c=0,l(),S()}function U(e,t){let n=ne();if(!n)return;ee(e.id),v(),sn(n,e.id,t,"Palette")}function N(e){switch(e.kind){case"project":{v(),z?.openRecentProject(e.root);return}case"file":{v(),Qf({name:e.name,path:e.path,root:J()??""}),Ir(e.path);return}case"mode":{me(e.mode);return}case"node":{v(),sl("selection.set",{path:e.path},"Palette");return}case"arg":{U(s.command,{[e.argName]:e.value});return}default:ue(e)}}function ue(e){let t=ne(),n=t?.get(e.id);if(!t||!n||!e.enabled)return;let r=q(n);if(r.kind==="choice"){s={choices:r.choices,command:n,name:r.name},d="",c=0,l();return}U(n)}function he(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Ys(t))return"file-text";return"file"}function fe(e){switch(e.kind){case"project":return"folder-open";case"file":return he(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function ge(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function xe(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function be(e,t){if(w)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return F(e).placeholder}}T("palette",C);var M=null,A=null,h=[];function j(){return M??=y({activate:()=>{let e=h[c];if(e)N(e)},activateRow:(e)=>{let t=h[Number(e)];if(t)N(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:pe,close:v,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{c=e,j().activeId=P(e)},input:le,isEmpty:!0,move:(e)=>{if(h.length===0)return;c=Math.max(0,Math.min(c+e,h.length-1)),j().activeId=P(c)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),M}function ve(){setTimeout(()=>{if(f)H().querySelector('[part="input"]')?.focus()},0)}function l(){let e=j();if(!A)A=I("palette",e,H());if(e.open=f,!f){h=[];return}let{mode:t,query:n}=Q(),{rows:r,showingRecent:a}=de(),i=F(t);h=r,e.placeholder=s?`Choose a ${s.name}…`:i.placeholder,e.hasChip=s!==null||t!=="picker",e.chipLabel=s?s.command.title:i.chip,e.query=d,e.canClearMode=d===""&&(s!==null||g!=="picker"),e.rows=r.map((o)=>({chord:(o.kind==="command"||o.kind==="mode")&&o.chord?o.chord:"",detail:o.detail,disabled:o.kind==="command"&&!o.enabled,icon:fe(o),key:xe(o),kind:o.kind,name:o.name,trailing:ge(o,a)})),e.expanded=r.length>0,e.activeId=r.length>0?P(c):"",e.isEmpty=r.length===0,e.emptyHint=be(t,n),e.showSection=a&&r.length>0,e.sectionLabel=s?`${s.command.title} — ${s.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
|
|
2
|
+
export{eS,qf};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B42559211C1ED9C564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-98wnwhbg.js.map
|