@jxsuite/studio 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-zvax9fmb.js → 2020-cs2sb9t1.js} +3 -3
- package/dist/chunks/adapter-y5gdq19c.js +4 -0
- package/dist/chunks/{cf-account-picker-zfycs4k2.js → cf-account-picker-882a7ecm.js} +3 -3
- package/dist/chunks/cf-settings-20dznc3j.js +4 -0
- package/dist/chunks/components-q037dya7.js +4 -0
- package/dist/chunks/content-source-37x3vsap.js +4 -0
- package/dist/chunks/{convert-to-repeater-x19jr6c7.js → convert-to-repeater-grfep2w8.js} +3 -3
- package/dist/chunks/editor-j5sq149q.js +4 -0
- package/dist/chunks/entry-commands-c5h3nqck.js +4 -0
- package/dist/chunks/{extension-sections-y90sa0n4.js → extension-sections-dp8endhx.js} +3 -3
- package/dist/chunks/file-ops-937cvqk6.js +4 -0
- package/dist/chunks/files-tznwe1p1.js +4 -0
- package/dist/chunks/format-host-e2pjvd25.js +4 -0
- package/dist/chunks/fs-events-fv64ak3s.js +4 -0
- package/dist/chunks/git-panel-gb713ttc.js +4 -0
- package/dist/chunks/{grid-view-d9mybhn0.js → grid-view-5amhg604.js} +10 -10
- package/dist/chunks/iframe-host-t819mcg5.js +4 -0
- package/dist/chunks/{index-vnwy9d44.js → index-9ydfe04y.js} +3 -3
- package/dist/chunks/index-m0x5ztax.js +4 -0
- package/dist/chunks/{javascript-f0nrbdjb.js → javascript-d9pqgc2p.js} +2 -2
- package/dist/chunks/{jsonMode-nfa90dtf.js → jsonMode-800yvbem.js} +4 -4
- package/dist/chunks/jx-validate-zc9zp77s.js +4 -0
- package/dist/chunks/layers-4bsr82wz.js +4 -0
- package/dist/chunks/layers-panel-b6shnaax.js +4 -0
- package/dist/chunks/lit-html-cfn61dn7.js +4 -0
- package/dist/chunks/media-picker-ej0kdh1j.js +4 -0
- package/dist/chunks/menu-rtxf9chb.js +4 -0
- package/dist/chunks/{monaco-binding-antn79jf.js → monaco-binding-62dtmgbf.js} +3 -3
- package/dist/chunks/monaco-buffer-nn4dtx27.js +4 -0
- package/dist/chunks/{monaco-setup-k8s40vwg.js → monaco-setup-tj13ndtm.js} +3 -3
- package/dist/chunks/notify-ahs57a2z.js +4 -0
- package/dist/chunks/platform-v9xyfkbx.js +4 -0
- package/dist/chunks/publish-panel-bq36xcmj.js +4 -0
- package/dist/chunks/quick-search-zm00h9dh.js +4 -0
- package/dist/chunks/references-99ws0b0m.js +4 -0
- package/dist/chunks/right-panel-pq2f71q3.js +4 -0
- package/dist/chunks/section-registry-b2yzp9sw.js +4 -0
- package/dist/chunks/{studio-y17505ge.js → studio-01kbbqg3.js} +207 -207
- package/dist/chunks/{studio-gxna6yta.js → studio-01qza1n3.js} +4 -4
- package/dist/chunks/{studio-n2e133d6.js → studio-03wwfvyt.js} +4 -4
- package/dist/chunks/{studio-09n3fyy0.js → studio-0bbxhhce.js} +4 -4
- package/dist/chunks/{studio-dknr8m7b.js → studio-0k9mvpgj.js} +7 -7
- package/dist/chunks/{studio-s85vah66.js → studio-0scebvb9.js} +5 -5
- package/dist/chunks/studio-1a99w39s.js +5 -0
- package/dist/chunks/{studio-eegyf5vg.js → studio-1wvfxkyy.js} +4 -4
- package/dist/chunks/{studio-ft8pfpp0.js → studio-1x8x26k3.js} +4 -4
- package/dist/chunks/{studio-28pz4s1k.js → studio-222rqyyc.js} +4 -4
- package/dist/chunks/{studio-6exg5z4x.js → studio-4xppwncr.js} +3 -3
- package/dist/chunks/{studio-0c3fpdqj.js → studio-54g077x3.js} +5 -5
- package/dist/chunks/{studio-z47mm077.js → studio-56z7evx4.js} +6 -6
- package/dist/chunks/{studio-zkkdbbvd.js → studio-5e9zsamh.js} +6 -6
- package/dist/chunks/{studio-4yztve2t.js → studio-65fhspdd.js} +4 -4
- package/dist/chunks/{studio-b29h7g7s.js → studio-693nhyky.js} +4 -4
- package/dist/chunks/{studio-654fxcr0.js → studio-7pgy3xaf.js} +4 -4
- package/dist/chunks/{studio-k9pwvmz8.js → studio-888knnkc.js} +4 -4
- package/dist/chunks/{studio-b5rxwkj2.js → studio-9mqfamps.js} +4 -4
- package/dist/chunks/{studio-011em5cf.js → studio-a7xqhc3n.js} +4 -4
- package/dist/chunks/{studio-mf41717j.js → studio-aje966s9.js} +4 -4
- package/dist/chunks/studio-aqmph6k4.js +5 -0
- package/dist/chunks/studio-c6w3tq7t.js +5 -0
- package/dist/chunks/{studio-tzs6njnb.js → studio-c6zdm25z.js} +7 -7
- package/dist/chunks/{studio-1pxvgx1t.js → studio-c9d3pxf7.js} +4 -4
- package/dist/chunks/{studio-pvj970st.js → studio-ceb34dxj.js} +4 -4
- package/dist/chunks/studio-cvbkkfqb.js +5 -0
- package/dist/chunks/{studio-sadckcpp.js → studio-cxt150pj.js} +5 -5
- package/dist/chunks/{studio-891t1tv9.js → studio-dkn3x3hz.js} +4 -4
- package/dist/chunks/studio-e6re3rk1.js +5 -0
- package/dist/chunks/{studio-9n2j9nqk.js → studio-edbtvcd1.js} +4 -4
- package/dist/chunks/{studio-wr0pq67n.js → studio-eh0rac07.js} +4 -4
- package/dist/chunks/{studio-mm8x32gg.js → studio-evwgp1ym.js} +4 -4
- package/dist/chunks/{studio-9tkaykt5.js → studio-f195h2hq.js} +4 -4
- package/dist/chunks/{studio-0nm2skex.js → studio-fqq890ap.js} +3 -3
- package/dist/chunks/{studio-02y9cb4h.js → studio-frb0qbf7.js} +5 -5
- package/dist/chunks/{studio-je15p5v8.js → studio-gfn1kpxj.js} +5 -5
- package/dist/chunks/{studio-ymsjnvp9.js → studio-gh97gngt.js} +4 -4
- package/dist/chunks/{studio-zkvyd3ev.js → studio-gp02nqnw.js} +4 -4
- package/dist/chunks/{studio-5fc0728f.js → studio-hjbg8d5y.js} +7 -7
- package/dist/chunks/{studio-dtmdjmqb.js → studio-j6gnhvaa.js} +4 -4
- package/dist/chunks/{studio-d007j0z3.js → studio-mwxgyn9h.js} +6 -6
- package/dist/chunks/{studio-36s6qjgq.js → studio-n78gjfy8.js} +4 -4
- package/dist/chunks/studio-nbxqcgvf.js +5 -0
- package/dist/chunks/{studio-ks0ecgjx.js → studio-nt06yybj.js} +4 -4
- package/dist/chunks/{studio-ebt49j3c.js → studio-p7c1agz0.js} +5 -5
- package/dist/chunks/{studio-y164brht.js → studio-pwqfmt4p.js} +4 -4
- package/dist/chunks/{studio-6zyt56ek.js → studio-r3kaka4d.js} +4 -4
- package/dist/chunks/{studio-tj28pxa1.js → studio-semd1s8s.js} +4 -4
- package/dist/chunks/studio-skzanb0k.js +5 -0
- package/dist/chunks/{studio-z1vdxq0e.js → studio-spf2skgc.js} +4 -4
- package/dist/chunks/{studio-7w04zw8h.js → studio-st75kn99.js} +5 -5
- package/dist/chunks/{studio-dmymvk2j.js → studio-sxc0zvpt.js} +3 -3
- package/dist/chunks/studio-t1eedsyx.js +4 -0
- package/dist/chunks/{studio-153mwkyq.js → studio-tp642n5g.js} +4 -4
- package/dist/chunks/{studio-r7yeeqc4.js → studio-tw7rre6s.js} +4 -4
- package/dist/chunks/{studio-t0v47dpc.js → studio-tzegmy4w.js} +4 -4
- package/dist/chunks/studio-vavmwshr.js +5 -0
- package/dist/chunks/{studio-805fwp9k.js → studio-wma2c6g8.js} +4 -4
- package/dist/chunks/studio-x92tgnee.js +64 -0
- package/dist/chunks/studio-xk0z6msk.js +5 -0
- package/dist/chunks/{studio-njmg0e73.js → studio-xry7tk3z.js} +5 -5
- package/dist/chunks/{studio-sgzss898.js → studio-xta2vxp6.js} +7 -7
- package/dist/chunks/{studio-jsr14n1s.js → studio-xy3tv3az.js} +4 -4
- package/dist/chunks/{studio-6k1eswp9.js → studio-y7jehjrp.js} +4 -4
- package/dist/chunks/{studio-81twpmzj.js → studio-yr04mv2j.js} +4 -4
- package/dist/chunks/{studio-gj4j9e7k.js → studio-zd4kayn2.js} +4 -4
- package/dist/chunks/{studio-w8w9frjy.js → studio-zpnk016a.js} +12 -12
- package/dist/chunks/{tsMode-eq26t9gs.js → tsMode-k9s9fcag.js} +4 -4
- package/dist/chunks/workspace-b69mgm0e.js +4 -0
- package/dist/chunks/{ws-client-3gxqp06s.js → ws-client-0ja08haa.js} +3 -3
- package/dist/manifest.json +62 -62
- package/dist/studio.js +95 -95
- package/package.json +3 -3
- package/src/canvas/stage-scrollbar.ts +7 -7
- package/src/files/file-ops.ts +5 -8
- package/src/panels/jump-bar.ts +132 -158
- package/src/panels/pane-context.ts +8 -8
- package/src/panels/pane-grid.ts +18 -26
- package/src/panels/style-panel.ts +2 -2
- package/src/services/context-manager.ts +41 -70
- package/src/services/document-assistant.ts +12 -3
- package/src/services/harness/chat-reducer.ts +115 -0
- package/src/services/harness/turn-hooks.ts +50 -0
- package/src/services/tool-executor.ts +69 -288
- package/src/services/tool-outcomes.ts +12 -10
- package/src/studio.ts +2 -5
- package/src/surfaces/block-action-bar.json +6 -1
- package/src/surfaces/jump-bar.json +9 -12
- package/src/surfaces/jump-bar.ts +15 -16
- package/src/surfaces/pane-context.json +2 -2
- package/src/surfaces/pane-grid.json +8 -25
- package/src/surfaces/pane-grid.ts +7 -8
- package/src/surfaces/statusbar.json +71 -3
- package/src/surfaces/statusbar.ts +66 -139
- package/src/surfaces/style-panel.json +3 -3
- package/src/surfaces/style-panel.ts +11 -1
- package/dist/chunks/adapter-6zhjbpmd.js +0 -4
- package/dist/chunks/cf-settings-fpa485q3.js +0 -4
- package/dist/chunks/components-b0vh4sq8.js +0 -4
- package/dist/chunks/content-source-z5t0d0h9.js +0 -4
- package/dist/chunks/editor-7e23n4a8.js +0 -4
- package/dist/chunks/entry-commands-5cm6aba2.js +0 -4
- package/dist/chunks/file-ops-hv7gf757.js +0 -4
- package/dist/chunks/files-kb0epdxf.js +0 -4
- package/dist/chunks/format-host-eg1wy2bp.js +0 -4
- package/dist/chunks/fs-events-ky3vxfmh.js +0 -4
- package/dist/chunks/git-panel-yyg3bzp2.js +0 -4
- package/dist/chunks/iframe-host-9wdf0hes.js +0 -4
- package/dist/chunks/index-2tf0m2ne.js +0 -4
- package/dist/chunks/jx-validate-7w11db9v.js +0 -4
- package/dist/chunks/layers-7zasrpse.js +0 -4
- package/dist/chunks/layers-panel-9nzc4fdq.js +0 -4
- package/dist/chunks/lit-html-5qr7nbng.js +0 -4
- package/dist/chunks/media-picker-maevn9d4.js +0 -4
- package/dist/chunks/menu-wq6q0v3y.js +0 -4
- package/dist/chunks/monaco-buffer-9ry2rn5x.js +0 -4
- package/dist/chunks/notify-g91gjd6w.js +0 -4
- package/dist/chunks/platform-jdwjp2vt.js +0 -4
- package/dist/chunks/publish-panel-8yym447p.js +0 -4
- package/dist/chunks/quick-search-9bzm9kh3.js +0 -4
- package/dist/chunks/references-znssfqvq.js +0 -4
- package/dist/chunks/right-panel-czbzktm8.js +0 -4
- package/dist/chunks/section-registry-0rtq73qs.js +0 -4
- package/dist/chunks/studio-0mm38y62.js +0 -5
- package/dist/chunks/studio-27tc8q0h.js +0 -5
- package/dist/chunks/studio-7djymzt2.js +0 -5
- package/dist/chunks/studio-ant1zbp3.js +0 -5
- package/dist/chunks/studio-eb5sty2k.js +0 -5
- package/dist/chunks/studio-frv7vjhw.js +0 -5
- package/dist/chunks/studio-mb8jhtr4.js +0 -64
- package/dist/chunks/studio-nvykrgbj.js +0 -4
- package/dist/chunks/studio-nw4q9sdn.js +0 -5
- package/dist/chunks/studio-p6avneaq.js +0 -5
- package/dist/chunks/studio-vz7b43ng.js +0 -5
- package/dist/chunks/workspace-emt8454d.js +0 -4
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ge,Xa,Q,v,re,zd,k}from"./studio-fqq890ap.js";import{kp}from"./studio-7pgy3xaf.js";import{p}from"./studio-y7jehjrp.js";import{wi,Zt,Dr}from"./studio-1x8x26k3.js";import{K,Lm,ht,_n,Yo,qa,D}from"./studio-tp642n5g.js";import{Ae,Ic,Im,lk}from"./studio-evwgp1ym.js";import{va,oh,rh}from"./studio-nbxqcgvf.js";import{me}from"./studio-0bbxhhce.js";function vm(e,t){return{success:!0,data:e,summary:t}}function zi(e){return{success:!1,error:e}}function Ki({name:e,description:t,parameters:n,strict:o=!0,llmStrict:r=!1,interactive:i,execute:s}){return{name:e,description:t,parameters:n,strict:o,llmStrict:r,...i===void 0?{}:{interactive:i},execute:s}}function av(e){let t=[];return{record(n){t.push(n),e?.(n)},writes:t}}function Dd(e=null,t={}){let n=new Map(Object.entries(t));return{sessionId:e,get:(o)=>n.get(o),set:(o,r)=>{n.set(o,r)},toJSON:()=>Object.fromEntries(n)}}var Ot=new AbortController().signal;function lv(e={}){let t=e.session??Dd();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??av(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Ot}}function wL(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let n=()=>{t.abort(e.reason)};return e.addEventListener("abort",n,{once:!0}),{release:()=>{e.removeEventListener("abort",n)},signal:t.signal}}function zC(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>({type:"function",function:{name:t.name,description:t.description,parameters:t.parameters,...t.llmStrict===!0?{strict:!0}:{}}}))},getDefinition(t){return e.get(t)},validate(t,n){let o=e.get(t);if(!o)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!o.strict)return{valid:!0};let r=o.parameters;if(!r||!r.properties)return{valid:!0};let i=[],s=r.properties,a=r.required||[],l=n;for(let c of a)if(!(c in n)||l[c]===void 0||l[c]===null)i.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(l)){let g=s[c];if(!g)continue;let y=g.type;if(!y)continue;let b=Array.isArray(d)?"array":typeof d;if(y==="number"||y==="integer"){if(b==="number")continue;if(b==="string"){if(!Number.isNaN(Number(d)))continue;i.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}i.push(`Argument "${c}" should be a number, got ${b}`);continue}if(y==="string"&&b!=="string")i.push(`Argument "${c}" should be a string, got ${b}`);else if(y==="boolean"&&b!=="boolean")i.push(`Argument "${c}" should be a boolean, got ${b}`);else if(y==="array"&&b!=="array")i.push(`Argument "${c}" should be an array, got ${b}`);else if(y==="object"&&b!=="object")i.push(`Argument "${c}" should be an object, got ${b}`)}return i.length>0?{valid:!1,errors:i}:{valid:!0}},async execute(t,n,o=lv()){let r=e.get(t);if(!r)return zi(`Unknown tool: "${t}"`);let i=this.validate(t,n);if(!i.valid)return zi(`Validation failed: ${(i.errors||[]).join("; ")}`);try{return await r.execute(n,o)}catch(s){return zi(`Tool "${t}" execution error: ${s.message}`)}}}}function wt(e){return JSON.parse(JSON.stringify(e))}function St(e){if(!e)return{};let t=JSON.parse(e);if(t===null||typeof t!=="object"||Array.isArray(t)){let n=t===null?"null":Array.isArray(t)?"array":typeof t;throw TypeError(`arguments must be a JSON object, got ${n}`)}return t}async function xL(e,t,n){let o=!1,r;try{let i=St(t.argumentsText);o=!0,r=await e.execute(t.name,i,n)}catch(i){r=zi(`Failed to parse arguments: ${i.message}`)}try{return{status:"done",result:wt(r),executed:o}}catch(i){let s=i.message;return{status:"done",result:zi(`Tool "${t.name}" returned a result that cannot be serialized: ${s}`),executed:o}}}var F=[],Ct=50;function _L(e){return Object.assign(av(),{turnId:e})}function CL(e,t){if(t.length===0)return[];let n={id:e,writes:[...t]};F.push(n);while(F.length>Ct)F.shift();return n.writes}function Tx(e){return F.find((t)=>t.id===e)?.writes??[]}function kL(e){let t=e.filter((a)=>a.ok),n=new Set(t.map((a)=>a.path)),o=e.length-t.length;if(n.size===0)return o>0?`${o} change${o===1?"":"s"} failed`:"";let r=`Changed ${n.size} file${n.size===1?"":"s"}`,i=new Set(t.filter((a)=>a.disk).map((a)=>a.path)),s=[r];if(i.size>0)s.push(`${i.size} written to disk — undo cannot reach ${i.size===1?"it":"them"}`);if(o>0)s.push(`${o} failed`);return s.join(" · ")}function Lx(){F.splice(0)}function SL(e,t){let n=null;for(let o=e.length-1;o>=0;o--){let r=e[o];if(r.id===t)return n;let i=r.role==="assistant"&&(r.content||(r.toolCalls?.length??0)>0);if(n===null&&i)n=r.id}return t===void 0?n:null}var Rt=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),Sx="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Go(e){if(typeof e!=="string"||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function iv(e){return Go(e)!==null}function gL(e){let t=Go(e);if(t===null)return"ltr";let n=new Intl.Locale(t),o=n.script??n.maximize().script;return o!==void 0&&Rt.has(o)?"rtl":"ltr"}function dn(e){let t=Go(e);if(t===null)return typeof e==="string"?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var At="prefix-except-default";function $o(e){let t=e.i18n,n=[];if(!t||typeof t!=="object")return{errors:n,i18n:null};let o=Array.isArray(t.locales)?t.locales:[],r=[];for(let a of o){let l=Go(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!r.includes(l))r.push(l)}let i=Go(t.defaultLocale)??r[0]??null;if(t.defaultLocale!==void 0&&Go(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!r.includes(i))r.unshift(i);let s=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:At;return{errors:n,i18n:{defaultLocale:i,locales:r,routing:s}}}function zu(e,t){let n=se(W(e),t);if(n===-1||t===null)return null;return Go(W(e)[n])}function bL(e,t){let n=zu(e,t);if(n!==null||t===null||t.routing!=="prefix-except-default")return n;return W(e)[0]==="pages"?t.defaultLocale:null}function BC(e,t){let n=W(e),o=se(n,t);return o===-1?n.join("/"):n.filter((r,i)=>i!==o).join("/")}function Wu(e,t,n){if(n===null)return null;let o=Go(t);if(o===null||!n.locales.includes(o))return null;let r=W(e),i=se(r,n),s=i===-1?kt(r):i;if(s===-1)return null;let a=i===-1?r:r.filter((l,c)=>c!==i);if(o===n.defaultLocale&&n.routing==="prefix-except-default")return a.join("/");return a.toSpliced(s,0,o.toLowerCase()).join("/")}function W(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function se(e,t){if(t===null)return-1;return e.findIndex((n)=>{let o=Go(n);return o!==null&&t.locales.includes(o)})}function kt(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}var Dx="{locale}";function Re(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function B(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function ke(e){return e??D?.projectConfig??null}function Je(e){return e?.content??{}}function Jt(e){let t=$o(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function je(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Ie(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:Dr()?.extensions[0]??".json",unresolvedFormat:null};let t=wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function jt(e,t){let n=t===null?"[^/]+":`(?:${t.map((r)=>Re(r)).join("|")})`,o=B(e).split(Dx).map((r)=>Re(r)).join(n);return new RegExp(`^${o}(?:/|$)`,"i")}function It(e,t,n){let o=jt(e,n).exec(t);if(!o)return null;return o[0].replace(/\/$/,"")}function Dt(e){return B(e).replaceAll(Dx,"").length}function bp(e,t){if(e===null||e===void 0||e==="")return null;let n=ke(t),o=Jt(n),r=B(e),i=null,s=-1;for(let[a,l]of Object.entries(Je(n))){let{source:c}=l;if(c===void 0||c===""||je(c))continue;let d=Dt(c);if(d<=s)continue;let g=It(c,r,o);if(g===null)continue;i={def:l,dir:r,fileBacked:!1,isSourceRoot:r.length===g.length,name:a,...Ie(l)},s=d}return i}function Ax(e,t){if(e===null||e===void 0||e==="")return null;let n=ke(t),o=B(e),r=o.toLowerCase();for(let[i,s]of Object.entries(Je(n))){let{source:a}=s;if(a===void 0||a===""||!je(a))continue;let l=B(a).toLowerCase();if(r===l||r.endsWith(`/${l}`))return{def:s,dir:o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:i,...Ie(s)}}return bp(o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",n)}function Ml(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function xv(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function _v(e){return e.replaceAll(/(^|-)(\w)/g,(t,n,o)=>(n?" ":"")+o.toUpperCase())}function Nx(e,t){return e?.$label||Ml(t)}function KL(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(n,o,r)=>(o?" ":"")+r.toUpperCase());return Ml(t)}function ma(e){return e==="image"||e==="uri-reference"}function Ad(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(ma(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function qu(e,t){if(!e||!t?.content)return null;let n=Ax(e,t);if(!n||!n.def.schema)return null;if(!n.fileBacked){let o=n.ext??Dr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(o.toLowerCase()))return null}return{name:n.name,schema:n.def.schema}}function xm(e,t){let n=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!n)return"";return`${t}${n}`}function Cv(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(n)=>n.toUpperCase())||e}function JL(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((r)=>r[1])};return{kind:"text"}}function Ao(e){return JSON.parse(JSON.stringify(e))}function Le(e){return e&&e.length>0?e.at(-1):null}function LL(e){return e&&e.length>0?e[0]:null}function dv(e,t){if(!t||!e)return!1;return e.some((n)=>Yo(n,t))}function ms(e){return E(e)}function E(e){let t=[];for(let n of e)t.push([...n]);return t}function uv(e,t){if(dv(e,t))return E(e.filter((n)=>!Yo(n,t)));return[...E(e),[...t]]}function IL(e,t,n){let o=e.findIndex((s)=>Yo(s,n)),r=t?e.findIndex((s)=>Yo(s,t)):-1;if(o===-1||r===-1)return[[...n]];let i=r<=o?e.slice(r,o+1):e.slice(o,r+1).toReversed();return E(i)}function De(e,t){return E(e.filter((n)=>!qa(t,n)))}function Et(e,t){let n=Math.min(e.length,t.length);for(let o=0;o<n;o++){let r=e[o],i=t[o];if(r===i)continue;if(typeof r==="number"&&typeof i==="number")return r-i;return String(r)<String(i)?-1:1}return e.length-t.length}function Lt(e){return E(e.filter((t)=>!e.some((n)=>!Yo(n,t)&&qa(n,t))))}function Nl(e){return e.at(-2)==="children"&&typeof e.at(-1)==="number"}function hv(e){return Lt(e).filter((t)=>Nl(t)).toSorted((t,n)=>Et(n,t))}function RL(e){let t=[];for(let n of e)if(!t.some((o)=>Yo(o,n)))t.push([...n]);return t}function mp(e){if(e.length===0)return{mixed:!1,value:void 0};let t=e[0],n=JSON.stringify(t??null);for(let o=1;o<e.length;o++)if(JSON.stringify(e[o]??null)!==n)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var Ee=null;function $L(e){Ee=e}function Me(){return Ee}var V=null,U=null,G=null,ae=!0;function $e(){V=[],U=[],G=[],ae=!0}function f(e){if(V)V.push(e)}function vi(e){if(U)U.push(e)}function Ne(e){if(G)G.push(e)}function _e(){let e={docOps:U??[],fmOps:G??[],invertible:ae,ops:V??[]};return V=null,U=null,G=null,ae=!0,e}var Fe=100,Mt=20;function H(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function P(e,t,n,o){return{forward:{key:t,op:"set-key",path:e,value:o},inverse:{key:t,op:"set-key",path:e,value:n}}}function $t(e,t,n,o,r){let i=e.length;if(!(i<t.length&&e.every((c,d)=>c===t[d]))||t[i]!=="children"||typeof t[i+1]!=="number")return t;let a=t[i+1];if(r?a<n:a<=n)return t;let l=[...t];return l[i+1]=a+o,l}var We=null;function Be(e){We=e}var Ve=null;function Ke(e){Ve=e}function Nt(e,t,n,o){for(let r=t.docOps.length-1;r>=0;r--)Im(e.doc.document,re(t.docOps[r].inverse));for(let r=t.fmOps.length-1;r>=0;r--){let i=t.fmOps[r];de(e,i.field,i.before)}e.doc.document={...re(e.doc.document)},e.session.selection=n,e.doc.dirty=o}function q(e,t,{skipHistory:n=!1,origin:o="user",coalesceKey:r=null}={}){if(!e)return!1;if(o!=="remote"&&Ve?.(e,o))return!1;let i=ms(e.session.selection),s=e.doc.dirty;$e();let a,l=null;try{t(e)}catch(b){l={error:b}}finally{a=_e()}if(l)throw Nt(e,a,i,s),l.error;let c=re(e.doc.document),d={...c},g=Me(),y=g===null?{patchable:!1,reason:"no-patch-consumer"}:a.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:g.classify(e,a.ops);if(y.patchable)g.markConsumed(d,e);if(e.doc.document=d,y.patchable)try{g.apply(e,a.ops,a)}catch(b){g.escalate(`patch-apply-failed: ${b instanceof Error?b.message:String(b)}`,e)}if(!n&&!L)_t(e,c,a,i,r);return e.doc.dirty=!0,We?.(e,a,o),!0}function _t(e,t,n,o,r=null){let i=e.history.snapshots.slice(0,e.history.index+1),s=H()&&n.invertible&&(n.docOps.length>0||n.fmOps.length>0),a=i.at(-1);if(r&&s&&a&&a.coalesceKey===r&&a.inverseOps){if(a.forwardOps=[...a.forwardOps??[],...n.docOps.map((c)=>c.forward)],a.inverseOps=[...a.inverseOps,...n.docOps.map((c)=>c.inverse)],a.selection=ms(e.session.selection),a.document)a.document=Ao(t);e.history.snapshots=i,e.history.index=i.length-1;return}let l=!s||i.length%Mt===0;if(i.push({document:l?Ao(t):null,fmOps:s&&n.fmOps.length>0?n.fmOps:null,forwardOps:s?n.docOps.map((c)=>c.forward):null,inverseOps:s?n.docOps.map((c)=>c.inverse):null,coalesceKey:r,selection:ms(e.session.selection),selectionBefore:o}),i.length>Fe){if(!i[1].document)i[1].document=le(i,1);i.shift()}e.history.snapshots=i,e.history.index=i.length-1}function le(e,t){let n=t;while(n>=0&&!e[n].document)n-=1;if(n<0)throw Error("history-missing-checkpoint");let o=Ao(e[n].document);for(let r=n+1;r<=t;r++)for(let i of e[r].forwardOps??[])Im(o,i);return o}function Hs(e,t,n){return q(e,(o)=>t(o.doc.document),n)}function ce(e,t){q(e,(n)=>{for(let o of t)ue(n,o)},{origin:"remote",skipHistory:!0})}var Ft=new Set(["state","$media","$head","$elements","imports","$layout"]);function ue(e,t){let n=t.op==="set-key"?K(e.doc.document,t.path)?.[t.key]:null;switch(Im(e.doc.document,t),vi({forward:t,inverse:t}),t.op){case"set-key":{if(Ft.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let o=t.key.startsWith("on")&&(rh(t.value)||rh(n));f({isEvent:o,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var L=null,Ge=null;function qe(e){Ge=e}function pv(e){L=e}function fv(){let e=L;if(e&&!j.has(e)){let t=re(e.doc.document),n={document:Ao(t),selection:ms(e.session.selection)},o=e.history.snapshots.slice(0,e.history.index+1);if(o.push(n),o.length>Fe)o.shift();e.history.snapshots=o,e.history.index=o.length-1}if(L=null,e)Ge?.(e)}function Ix(){return L!==null}function DL(){return L}var j=new WeakMap;function ym(e,t){if(t)j.set(e,t);else j.delete(e)}function AL(e){let t=j.get(e);return t?t.canUndo(e):e.history.index>0}function NL(e){let t=j.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function ze(e,t){let{snapshots:n}=e.history;e.doc.document=le(n,t);let o=n[t];e.session.selection=ms(re(o.selection))}function Ye(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let n=JSON.stringify(le(e.history.snapshots,t)),o=JSON.stringify(Ao(re(e.doc.document)));if(n!==o)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function Rx(e){let t=j.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let n=e.history.snapshots[e.history.index],o=H()?n.inverseOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a=o.length-1;a>=0;a--)ue(s,re(o[a]));if(r)for(let a=r.length-1;a>=0;a--){let l=re(r[a]);de(s,l.field,l.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ms(re(n.selectionBefore??[])),e.history.index-=1,Ye(e,e.history.index)}else e.history.index-=1,ze(e,e.history.index);e.doc.dirty=!0}function OL(e){let t=j.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let n=e.history.snapshots[e.history.index+1],o=H()?n.forwardOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a of o)ue(s,re(a));if(r)for(let a of r){let l=re(a);de(s,l.field,l.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ms(re(n.selection)),e.history.index+=1,Ye(e,e.history.index)}else e.history.index+=1,ze(e,e.history.index);e.doc.dirty=!0}function Ji(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;Ic(r).splice(n,0,structuredClone(o)),f({index:n,op:"insert",parentPath:t}),vi({forward:{index:n,node:Ae(o),op:"insert-child",parentPath:t},inverse:{index:n,op:"remove-child",parentPath:t}})}function Vu(e,t){if(!t||!Nl(t))return;let n=ht(t),o=_n(t),[r]=K(e.doc.document,n).children.splice(o,1);f({op:"remove",path:t}),vi({forward:{index:o,op:"remove-child",parentPath:n},inverse:{index:o,node:Ae(r),op:"insert-child",parentPath:n}}),e.session.selection=De(e.session.selection,t)}function VC(e,t){if(!t||!Nl(t))return;let n=K(e.doc.document,t);if(!n)return;let o=ht(t),r=_n(t),i=structuredClone(re(n));K(e.doc.document,o).children.splice(r+1,0,i),f({index:r+1,op:"insert",parentPath:o}),vi({forward:{index:r+1,node:Ae(i),op:"insert-child",parentPath:o},inverse:{index:r+1,op:"remove-child",parentPath:o}}),e.session.selection=[[...o,"children",r+1]]}function gp(e,t){for(let n of hv(t))Vu(e,n)}function mv(e,t){let n=[];for(let o of hv(t)){let r=e.session.selection;VC(e,o);let i=Le(e.session.selection);if(!i||e.session.selection===r)continue;let s=ht(i),a=_n(i);n=n.map((l)=>$t(s,l,a,1,!0)),n.unshift(i)}if(n.length>0)e.session.selection=n}function ML(e,t,n="div"){if(!t||!Nl(t))return;let o=K(e.doc.document,t);if(!o)return;let r=ht(t),i=_n(t),s={children:[structuredClone(re(o))],tagName:n},a=Ae(o);K(e.doc.document,r).children.splice(i,1,s),f({op:"replace",path:t}),vi({forward:{index:i,node:Ae(s),op:"set-child",parentPath:r},inverse:{index:i,node:a,op:"set-child",parentPath:r}}),e.session.selection=[[...r,"children",i]]}function pa(e,t,n,o){let r=e.doc.document,i=ht(t),s=_n(t);if(!i||typeof s!=="number")return;let a=K(r,i),l=K(r,n);if(!a||!Array.isArray(a.children)||!l)return;if(a.children[s]===void 0)return;let c=o;if(a===l&&s<o)c-=1;let d={fromIndex:s,fromParentPath:i,op:"move-child",toIndex:c,toParentPath:n},g=lk(r,d),[y]=a.children.splice(s,1);if(Ic(l).splice(c,0,y),f({fromPath:t,op:"move",toIndex:c,toParentPath:n}),vi({forward:d,inverse:g}),Yo(Le(e.session.selection),t)){let b=o;if(i.length===n.length&&i.every((_,I)=>_===n[I])&&s<o)b=o-1;e.session.selection=[[...n,"children",b]]}}function Ue(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;let i=r[n],s=Ae(i);if(o===void 0||o===null||o==="")delete r[n];else r[n]=o;if(vi(P(t,n,s,Ae(r[n]))),n==="textContent")f({op:"set-text",path:t});else if(n==="style")f({op:"set-style",path:t});else{let a=o===void 0||o===null||o===""?i:o,l=n.startsWith("on")&&rh(a);f({isEvent:l,key:n,op:"set-prop",path:t})}}function kc(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.style);if(!r.style)r.style={};if(o===void 0||o==="")delete r.style[n];else r.style[n]=o;if(Object.keys(r.style).length===0)delete r.style;vi(P(t,"style",i,Ae(r.style))),f({op:"set-style",path:t})}function Ko(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.attributes);if(!r.attributes)r.attributes={};if(o===void 0||o==="")delete r.attributes[n];else r.attributes[n]=o;if(Object.keys(r.attributes).length===0)delete r.attributes;vi(P(t,"attributes",i,Ae(r.attributes))),f({attr:n,op:"set-attr",path:t})}function PL(e,t,n,o,r){if(!n)return kc(e,t,o,r);let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=`@${n}`,l=oh(i.style,a);if(r===void 0||r===""){if(delete l[o],Object.keys(l).length===0)delete i.style[a]}else l[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function gv(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=oh(i.style,n);if(r===void 0||r===""){if(delete a[o],Object.keys(a).length===0)delete i.style[n]}else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function FL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=oh(s.style,l),d=oh(c,o);if(i===void 0||i===""){if(delete d[r],Object.keys(d).length===0)delete c[o];if(Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;vi(P(t,"style",a,Ae(s.style))),f({op:"set-style",path:t})}function Ze(e,t){let n=[e];for(let o of t){let r=va(n.at(-1),o);if(!r)break;n.push(r)}for(let o=n.length-2;o>=0;o--){let r=n[o],i=t[o],s=va(r,i);if(s&&Object.keys(s).length===0)delete r[i]}}function bv(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=i.style;for(let l of n)a=oh(a,l);if(r===void 0||r==="")delete a[o],Ze(i.style,n);else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;vi(P(t,"style",s,Ae(i.style))),f({op:"set-style",path:t})}function jL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=oh(s.style,l),d=c;for(let g of o)d=oh(d,g);if(i===void 0||i===""){if(delete d[r],Ze(c,o),Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;vi(P(t,"style",a,Ae(s.style))),f({op:"set-style",path:t})}function HL(e,t,n){let o=K(e.doc.document,t),r=Ae(o.style);if(n&&Object.keys(n).length>0)o.style=n;else delete o.style;vi(P(t,"style",r,Ae(o.style))),f({op:"set-style",path:t})}function Bs(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};o.state[t]=n,vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function vv(e,t){let n=e.doc.document;if(n.state){let o=Ae(n.state);if(delete n.state[t],Object.keys(n.state).length===0)delete n.state;vi(P([],"state",o,Ae(n.state))),f({key:"state",op:"doc-meta"})}}function mr(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};let i=o.state[t],s=i==null?{}:typeof i!=="object"||Array.isArray(i)?{default:i}:i;o.state[t]=s,Object.assign(s,n);for(let a of Object.keys(s))if(s[a]===void 0||s[a]===null)delete s[a];vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function BL(e,t,n){let o=e.doc.document;if(!o.state||!o.state[t])return;let r=Ae(o.state);o.state[n]=o.state[t],delete o.state[t],vi(P([],"state",r,Ae(o.state))),f({key:"state",op:"doc-meta"})}function Uu(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.$props);if(!r.$props)r.$props={};if(o===void 0||o===null||o==="")delete r.$props[n];else r.$props[n]=o;if(Object.keys(r.$props).length===0)delete r.$props;vi(P(t,"$props",i,Ae(r.$props))),f({op:"replace",path:t})}function zL(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.cases);if(!r.cases)r.cases={};r.cases[n]=o||{tagName:"div",textContent:n},vi(P(t,"cases",i,Ae(r.cases))),f({op:"replace",path:t})}function WL(e,t,n){let o=K(e.doc.document,t);if(o.cases){let r=Ae(o.cases);delete o.cases[n],vi(P(t,"cases",r,Ae(o.cases))),f({op:"replace",path:t})}}function VL(e,t,n,o){let r=K(e.doc.document,t);if(!r.cases||!r.cases[n])return;let i=Ae(r.cases);r.cases[o]=r.cases[n],delete r.cases[n],vi(P(t,"cases",i,Ae(r.cases))),f({op:"replace",path:t})}function Ol(e,t,n){let o=e.doc.content.frontmatter,r=Object.hasOwn(o,t)?Ae(o[t]):void 0,i=n===void 0||n===null||n==="";if(i)delete o[t];else o[t]=n;let s=i?void 0:Ae(n);Ne({after:s,before:r,field:t}),e.doc.dirty=!0}function de(e,t,n){if(n===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=n}var Wt={design:"canvas",edit:"canvas",entry:"entry","git-diff":"diff",grid:"grid",manage:"library",media:"media",preview:"canvas",settings:"config",source:"code",stylebook:"config"},ov={canvas:"Canvas",code:"Code",config:"Project Styles",diff:"Diff",entry:"Entry",grid:"Grid",media:"Media",library:"Library",none:"None"};function ha(e){return Wt[e]??"canvas"}var Bt={design:"design",edit:"edit",preview:"preview"};function vL(e){return Bt[e]??"design"}var rv=(e)=>e.editor.kind==="canvas",$d=(e)=>rv(e)&&e.selection.count>0,sv=(e)=>$d(e)&&!e.selection.isRoot;function bm(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1}}}function Ex(e={}){let t=bm();for(let n of Object.keys(e)){let o=e[n];if(o)Object.assign(t[n],o)}return t}var Vt=["palette"],Kt=["caret","global"],Ut=["dock","global"],Gt=["canvas","global"],Ht=["grid","global"],qt=["code","global"],Xe=["global"];function yL(e){if(e.modal.open)return Vt;if(e.caret.active)return Kt;if(e.focus.region!=="pane")return Ut;switch(e.editor.kind){case"grid":return Ht;case"code":return qt;case"canvas":return e.canvas.view==="preview"?Xe:Gt;default:return Xe}}var ai="project.json";function zt(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Yt=["edit","design","preview","source","stylebook","git-diff"];function cv({id:e,documentPath:t=null,fileHandle:n=null,document:o,frontmatter:r,sourceFormat:i=null,capabilities:s,openedFrom:a=null,preview:l=!1,layout:c=null}){let d=ge();Lm(o);let g=s?.modes??Xt(t,i),y=g.find((I)=>I!=="preview")??"edit",b=g[0]==="preview";return d.run(()=>({capabilities:{modes:g},doc:v({content:{frontmatter:r||{}},dirty:!1,document:o,handlersSource:null,layout:c,mode:Qt(t,i),sourceFormat:i}),documentPath:t,fileHandle:n,history:v({index:0,snapshots:[{document:structuredClone(o),selection:[]}]}),id:e,pinned:!1,preview:l,scope:d,session:v({canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:a,selection:[],ui:zt(y,b)})}))}function Xt(e,t){if(e===ai)return["stylebook","source"];let n=wi(t)??Zt(e);if(n)return n.studio?.modes??["edit","design","preview","source"];return Yt}function Qt(e,t){let n=wi(t)??Zt(e);if(n)return n.studio?.documentMode?.default??"content";return"component"}function WC(e){return ha(e.session.ui.canvasMode)}function EL(e){let t=[];for(let n of e.capabilities.modes){if(n==="preview")continue;let o=ha(n);if(!t.includes(o))t.push(o)}return t}function TL(e,t){return e.capabilities.modes.find((n)=>n!=="preview"&&ha(n)===t)}function fp(e){e.scope.stop()}var Qe=new WeakMap,M=new Map;function xn(e){let t=re(e),n=Qe.get(t);if(!n)n=v({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Qe.set(t,n);return n}function et(e){M.set(e,(M.get(e)??0)+1)}function tt(e){let t=M.get(e)??0;if(t<=1)M.delete(e);else M.set(e,t-1)}function wm(e){return M.has(e.replaceAll("\\","/"))}var en=8000,tn=800,nn=2500,nt=null;function on(){return nt??=(me("m0x5ztax"),import("./index-m0x5ztax.js")),nt}function it(){try{return p()}catch{return null}}var N=null;function YL(e){N=e}var pe=null;function ZL(e){pe=e}var st=()=>{};function XL(e){st=e??(()=>{})}var be=new WeakMap;function at(e){return re(e)}function C(e){return be.get(at(e))}function xe(e){let t=at(e),n=be.get(t);if(!n)n={attaching:null,generation:0,optedOut:v({value:!1}),session:null,watcherInstalled:!1},be.set(t,n);return n}var rt=!1;function rn(){if(rt)return;rt=!0,Be(sn),qe(an),Ke((e)=>{if(C(e)?.session?.synced&&xn(e).sourceCanonical)return st("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function sn(e,t,n){let o=C(e)?.session;if(!o||!o.synced)return;if(o.lastSeenRef=re(e.doc.document),n==="remote"){ee(o);return}if(o.canWrite)ln(o,t),ee(o)}function an(e){let t=C(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:n,batchNeedsDiff:o}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),o)z(t);else if(n.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,n,t.collab.LOCAL_ORIGIN)}catch{z(t)}t.undoManager?.stopCapturing()}function ln(e,t){let n=t.docOps.map((o)=>o.forward);if(Ix()){if(e.batchOps??=[],n.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...n);return}if(n.length===0){z(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,n,e.collab.LOCAL_ORIGIN)}catch{z(e)}}function z(e){let{collab:t,handle:n,tab:o}=e,r=t.yDocToJson(n.doc),i=Ao(re(o.doc.document)),s=t.diffDocs(r,i);if(s===null)t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN);else if(s.length>0)try{t.applyDocOpsToY(n.doc,s,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN)}}function fe(e){let t=e.collab.yDocToJson(e.handle.doc);q(e.tab,(n)=>{let o=n.doc.document;for(let r of Object.keys(o))if(!(r in t))delete o[r];Object.assign(o,t)},{origin:"remote",skipHistory:!0})}function cn(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,n=t.clientID;for(let[o,r]of t.getStates())if(r.canWrite!==!1&&o<n)n=o;return n===e.handle.awareness.clientID}function ee(e){if(!N||!cn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=nn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,ye(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),ye(e)},tn)}async function ye(e){if(!N||!e.synced)return;try{let t=await N(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function lt(e){if(!pe||!e.synced||!e.canWrite)return;let{collab:t,handle:n,tab:o}=e,r=t.canonicalRevOf(n.doc),i=t.sourceText(n.doc).toString(),s;try{s=await pe(o,i)}catch{return}if(!e.synced||t.canonicalRevOf(n.doc)!==r)return;let a=t.diffDocs(t.yDocToJson(n.doc),s.document);if(a===null)t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(n.doc,a,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN)}let l=t.frontmatterMap(n.doc),c=s.frontmatter??{};n.doc.transact(()=>{let d=[...l.keys()];for(let g of d)if(!(g in c))l.delete(g);for(let[g,y]of Object.entries(c))if(!t.deepEqual(l.get(g),y))l.set(g,y)},t.MIRROR_ORIGIN)}function QL(e){let t=C(e)?.session;if(!t?.synced)return null;let{collab:n,handle:o}=t,r=null,i=()=>r!==null&&t.sourceLockOwner===r;return{awareness:o.awareness,enter:async()=>{r={},t.sourceLockOwner=r;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"source"});if(!t.canWrite)return;let a=null;if(N)try{a=await N(e)}catch{a=null}if(!i())return;n.acquireSourceCanonical(o.doc,a??n.sourceText(o.doc).toString(),n.LOCAL_ORIGIN)},leave:()=>{if(!i()){r=null;return}r=null,t.sourceLockOwner=null;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"structure"});if(!t.canWrite)return;if(n.otherSourceEditors(o.awareness,t.path,o.awareness.clientID).filter((l)=>o.awareness.getStates().get(l)?.canWrite!==!1).length===0)lt(t).then(()=>{n.releaseSourceCanonical(o.doc,n.LOCAL_ORIGIN)})},localOrigin:n.LOCAL_ORIGIN,readOnly:!t.canWrite,text:n.sourceText(o.doc)}}function _m(e){let t=xn(e);return t.active&&t.readOnly}async function GC(e){let t=C(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await ye(t),await t.handle.flush(),!0}async function KC(){for(let e of he)if(C(e)?.session?.synced)await GC(e)}var he=new Set;function Y(e){if(!it()?.collab||!e.documentPath||e.documentPath===ai)return;let n=xe(e);if(n.watcherInstalled)return;n.watcherInstalled=!0,rn(),he.add(e),e.scope.run(()=>{Q(()=>{if(n.optedOut.value)te(e);else ve(e)}),Xa(()=>{he.delete(e),te(e)})})}function JC(e,t){let n=xe(e);if(n.optedOut.value===!t)return;if(n.optedOut.value=!t,!n.watcherInstalled&&t)Y(e)}function YC(e){return C(e)?.optedOut.value!==!0}function ct(e){if(!C(e)?.watcherInstalled){Y(e);return}te(e),ve(e)}async function ve(e){let t=xe(e);if(t.session||t.attaching)return;let{documentPath:n}=e,o=it();if(!n||!o?.collab){xn(e).status="unavailable";return}let{generation:r}=t,i=xn(e);i.status="connecting",i.attachError="";let s=(async()=>{try{let[a,l]=await Promise.all([on(),o.collab(n)]);if(!l){i.status="detached";return}if(t.generation!==r){l.destroy();return}let c=null,d=new Promise((g,y)=>{c=setTimeout(()=>y(Error("collab-sync-timeout")),en)});try{await Promise.race([l.whenSynced,d])}finally{if(c)clearTimeout(c)}if(t.generation!==r){l.destroy();return}t.session=un(e,n,a,l),i.active=!0,i.status="synced",i.readOnly=!t.session.canWrite,i.attachError="",et(n)}catch(a){i.status="failed",i.active=!1,i.attachError=a instanceof Error?a.message:String(a),k.warn(`Live collaboration is not available for "${n}" — ${i.attachError}`,{key:`collab:${n}`,path:n,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=s,await s}function te(e){let t=C(e);if(!t)return;t.generation+=1;let{session:n}=t;t.session=null;let o=xn(e);if(o.active=!1,o.status="detached",o.attachError="",o.peers=[],!n)return;if(tt(n.path),n.mirrorTimer)clearTimeout(n.mirrorTimer);if(n.sourceParseTimer)clearTimeout(n.sourceParseTimer);for(let r of n.disposers)try{r()}catch{}ym(e,null),e.history.snapshots=[{document:Ao(re(e.doc.document)),selection:ms(e.session.selection)}],e.history.index=0,n.undoManager?.destroy(),n.handle.destroy()}function un(e,t,n,o){let r=o.identity(),i={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:r?r.permission!=="read":!0,collab:n,disposers:[],handle:o,lastSeenRef:re(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(n.metaMap(o.doc).get("structureSeeded")===!0){let h=n.yDocToJson(o.doc),x=Ao(re(e.doc.document));if(!n.deepEqual(h,x)){let w=n.diffDocs(x,h);if(w===null)i.synced=!0,fe(i),i.synced=!1;else if(w.length>0)ce(e,w)}i.applyingRemoteFrontmatter=!0;let T=n.frontmatterMap(o.doc);for(let[w,J]of T.entries())e.doc.content.frontmatter[w]=J;i.applyingRemoteFrontmatter=!1}else if(i.canWrite)n.seedStructure(o.doc,Ao(re(e.doc.document)),{frontmatter:Ao(re(e.doc.content.frontmatter)),origin:n.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});i.lastSeenRef=re(e.doc.document),i.disposers.push(o.onDirty((h)=>{e.doc.dirty=h})),o.awareness.setLocalState({canWrite:i.canWrite,focusedPath:t,structuralSelection:null,user:r?{avatarUrl:r.avatarUrl,color:r.color,login:r.login,name:r.name}:{color:n.colorForKey(String(o.awareness.clientID)),login:`guest-${o.awareness.clientID%1000}`}});let a=new n.UndoManager([n.structureMap(o.doc),n.frontmatterMap(o.doc)],{trackedOrigins:new Set([n.LOCAL_ORIGIN])});i.undoManager=a;let l=({stackItem:h})=>{h.meta.set("selection",ms(e.session.selection))},c=({stackItem:h})=>{let x=h.meta.get("selection");e.session.selection=ms(x??[])};a.on("stack-item-added",l),a.on("stack-item-popped",c),i.disposers.push(()=>{a.off("stack-item-added",l),a.off("stack-item-popped",c)}),ym(e,{canRedo:()=>a.canRedo(),canUndo:()=>a.canUndo(),redo:()=>{a.redo()},undo:()=>{a.undo()}});let d=n.structureMap(o.doc),g=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;let T=n.yEventsToDocOps(h);if(T===null){fe(i);return}if(T.length===0)return;try{ce(e,T)}catch{fe(i)}};d.observeDeep(g),i.disposers.push(()=>d.unobserveDeep(g));let y=xn(e);y.sourceCanonical=n.canonicalOf(o.doc)==="source";let b=n.metaMap(o.doc),_=()=>{y.sourceCanonical=n.canonicalOf(o.doc)==="source"};b.observe(_),i.disposers.push(()=>b.unobserve(_));let I=n.sourceText(o.doc),Oe=(h,x)=>{if(x.origin===n.MIRROR_ORIGIN||!i.synced)return;if(n.canonicalOf(o.doc)!=="source")return;if(!n.isSourceReconciler(o.awareness,i.path))return;if(i.sourceParseTimer)clearTimeout(i.sourceParseTimer);i.sourceParseTimer=setTimeout(()=>{i.sourceParseTimer=null,lt(i)},600)};I.observe(Oe),i.disposers.push(()=>I.unobserve(Oe));let A=n.frontmatterMap(o.doc),we=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;i.applyingRemoteFrontmatter=!0;try{for(let[T,w]of h.changes.keys)if(w.action==="delete")delete e.doc.content.frontmatter[T];else e.doc.content.frontmatter[T]=A.get(T)}finally{i.applyingRemoteFrontmatter=!1}};A.observe(we),i.disposers.push(()=>A.unobserve(we)),e.scope.run(()=>{let h=JSON.stringify(e.doc.content.frontmatter);Q(()=>{let x=JSON.stringify(e.doc.content.frontmatter);if(x===h)return;if(h=x,i.applyingRemoteFrontmatter||!i.synced||!i.canWrite)return;let T=JSON.parse(x);o.doc.transact(()=>{let w=[...A.keys()];for(let J of w)if(!(J in T))A.delete(J);for(let[J,Ce]of Object.entries(T))if(!n.deepEqual(A.get(J),Ce))A.set(J,Ce)},n.LOCAL_ORIGIN),ee(i)}),Q(()=>{let x=e.session.selection.length>0?ms(e.session.selection):null,T=o.awareness.getLocalState();if(T)o.awareness.setLocalState({...T,structuralSelection:x})}),Q(()=>{let x=re(e.doc.document);queueMicrotask(()=>{if(C(e)?.session!==i||!i.synced||!i.canWrite)return;let w=re(e.doc.document);if(w!==x||w===i.lastSeenRef)return;i.lastSeenRef=w,z(i),ee(i)})})});let oe=xn(e),ie=()=>{let h=[];for(let[x,T]of o.awareness.getStates())if(x!==o.awareness.clientID&&T.user)h.push({clientId:x,state:T});oe.peers=h};return ie(),o.awareness.on("change",ie),i.disposers.push(()=>o.awareness.off("change",ie),o.onStatus((h)=>{if(h==="offline"||h==="connecting")oe.status="offline";else if(i.synced)oe.status="synced"}),o.onReset(()=>{te(e),ve(e)})),i.synced=!0,i}function S(e,t,n){return RangeError(`command "${e}" argument "${t}": ${n}`)}function O(e){if(e===void 0)return"missing";return typeof e==="string"?`"${e}"`:`${typeof e} ${JSON.stringify(e)}`}function ot(e,t,n){let o=t[n];if(typeof o!=="string"||o==="")throw S(e,n,`expected a non-empty string, got ${O(o)}`);return o}function Jo(e,t,n){if(t[n]===void 0)return;return ot(e,t,n)}function dt(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isFinite(o))throw S(e,n,`expected a finite number, got ${O(o)}`);return o}function ut(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isInteger(o))throw S(e,n,`expected an integer, got ${O(o)}`);return o}function yv(e,t,n,o,r){let i=dt(e,t,n);if(i<o||i>r)throw S(e,n,`${i} is outside the supported range ${o}–${r}`);return i}function yi(e,t,n){let o=t[n];if(typeof o!=="boolean")throw S(e,n,`expected a boolean, got ${O(o)}`);return o}function li(e,t,n,o){let r=t[n];if(typeof r!=="string"||!o.includes(r))throw S(e,n,`${O(r)} is not declared — declared: ${o.join(", ")||"none"}`);return r}function $x(e,t,n){let o=t[n];if(!Array.isArray(o)||!o.every((r)=>typeof r==="string"||typeof r==="number"))throw S(e,n,`expected an array of path segments (strings or numbers), got ${O(o)}`);return o}function UL(e,t,n){if(t[n]===null)return null;return $x(e,t,n)}function UC(e,t,n){let o=t[n];if(!Array.isArray(o))throw S(e,n,`expected an array of document paths, got ${O(o)}`);return o.map((r,i)=>{if(!Array.isArray(r)||!r.every((s)=>typeof s==="string"||typeof s==="number"))throw S(e,n,`entry ${i} is not a document path — expected an array of segments, got ${O(r)}`);return r})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function Do(e,t){return{description:t,enum:[...e],type:"string"}}function fa(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function qC(e,t={}){return{description:e,type:"number",...t}}function oo(e){return{description:e,type:"boolean"}}function wv(e,t=!1){let n={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[n,{type:"null"}]}:{description:e,...n}}function qL(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function He(e){return{description:e,type:"string"}}function fn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Te(e){return Array.isArray(e)?e:[e]}function ft(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let n=t.items?.type;if(Array.isArray(n))return fn(n)?"path":"pass-through";return n==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function pt(e,t){switch(e){case"null":return t===null;case"boolean":return typeof t==="boolean";case"string":return typeof t==="string";case"number":return typeof t==="number"&&Number.isFinite(t);case"integer":return typeof t==="number"&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return typeof t==="object"&&t!==null&&!Array.isArray(t);default:break}return!1}function mt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function pn(e,t,n,o){let r=t[n];if(!o.some((i)=>pt(i,r)))throw S(e,n,`expected ${mt(o)}, got ${O(r)}`);return r}function gt(e){switch(ft(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>O(t)).join(" | ")}`;case"const":return`the constant ${O(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>gt(t)).join(" or ");case"typed":return mt(Te(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function mn(e,t,n,o){let r=t[n],i=[];for(let s of o){if(s.type!==void 0&&!Te(s.type).some((a)=>pt(a,r)))continue;try{return bt(e,t,n,s)}catch(a){i.push(a)}}if(i.length===1)throw i[0];throw S(e,n,`expected ${o.map((s)=>gt(s)).join(" or ")}, got ${O(r)}`)}function bt(e,t,n,o){switch(ft(o)){case"enum":return li(e,t,n,o.enum??[]);case"const":{let r=t[n];if(r!==o.const)throw S(e,n,`expected the constant ${O(o.const)}, got ${O(r)}`);return r}case"one-of":return mn(e,t,n,o.oneOf??[]);case"typed":return pn(e,t,n,Te(o.type??[]));case"boolean":return yi(e,t,n);case"bounded-number":{if(o.type==="integer")ut(e,t,n);return yv(e,t,n,o.minimum,o.maximum)}case"number":return dt(e,t,n);case"integer":return ut(e,t,n);case"string":return ot(e,t,n);case"path":return $x(e,t,n);case"path-list":return UC(e,t,n);default:return t[n]}}function GL(e,t,n){let o=t,r=o.properties??{},i=Object.keys(r),s=o.required??[],a={};for(let[l,c]of Object.entries(n)){if(c===void 0||Object.hasOwn(r,l))continue;if(o.additionalProperties===!1)throw S(e,l,`not declared — declared: ${i.join(", ")||"none"}`);a[l]=c}for(let l of i){if(n[l]===void 0&&!s.includes(l))continue;a[l]=bt(e,n,l,r[l])}return a}var gn=20,Qn="primary",vp="secondary",ZC=2,m=v({activePaneId:Qn,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:Qn,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Rr();return e.derived?.kind==="lens"?Hn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Rr().tabOrder}}),u=zd(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Rr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function Hn(e){return m.panes.find((t)=>t.id===e)}function Gu(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function $r(e){let t=Hn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,R();let{activeTabId:n}=t;if(n){Pe(n);let o=m.tabs.get(n);if(o)vt(o)}}function yp(e){return m.activePaneId===e}function Ox(e){let t=e??Rr().activeTabId,n=t?m.tabs.get(t):null;if(!t||!n)return null;let o=Gu(t);if(!o)return null;let r=Pl(o.id);return _p(t),Ku(r,t),r.activeTabId=t,m.activePaneId=r.id,R(),Pe(t),r}function Mx(e){return m.panes.find((t)=>t.id!==e)??bn(vp)}function Pl(e){let t=Mx(e);if(t.derived)t.derived=null;return t}function bn(e){let t=Hn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],Hn(e)}function wp(e){if(m.panes.length<2)return;let t=e===Qn?m.panes.find((r)=>r.id!==Qn)?.id:e,n=t===void 0?void 0:Hn(t),o=m.panes.find((r)=>r.id!==t);if(!n||!o)return;for(let r of n.tabOrder)Ku(o,r);if(o.activeTabId=m.activePaneId===n.id?n.activeTabId??o.activeTabId:o.activeTabId??n.activeTabId,m.activePaneId=o.id,o.derived?.sourcePaneId===n.id)o.derived=null;m.panes=m.panes.filter((r)=>r.id!==n.id),R()}function xp(e){return e.tabOrder.length===0&&e.derived===null}function _p(e){let t=[];for(let n of m.panes){if(!n.tabOrder.includes(e))continue;if(n.tabOrder=n.tabOrder.filter((o)=>o!==e),n.activeTabId===e)n.activeTabId=n.tabOrder.at(-1)??null;if(n.id!==Qn&&xp(n))t.push(n.id)}for(let n of t)wp(n)}function Ku(e,t,n){if(e.tabOrder.includes(t))return;let o=n??hn(e,t);e.tabOrder=[...e.tabOrder.slice(0,o),t,...e.tabOrder.slice(o)]}function yn(e){let t=0;for(let n of e.tabOrder){if(m.tabs.get(n)?.pinned!==!0)break;t+=1}return t}function hn(e,t){return m.tabs.get(t)?.pinned===!0?yn(e):e.tabOrder.length}function Ua(e,t=null){if(m.projectRoot&&e!==m.projectRoot)Lx();m.projectRoot=e,m.projectConfig=t}function Cp(e){let t=u.value;return e!==null&&t!==null&&re(t)===re(e)}function Sc(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&re(t)===re(e)}function Pe(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var ne=null,Z=0;function R(){ne=null,Z=0}function vt(e){if(D&&e.documentPath)D.selectedPath=e.documentPath}function X(e,t={}){let n=m.tabs.get(e),o=Gu(e);if(!n||!o)return;if(o.activeTabId=e,t.focus===!1)return;if(m.activePaneId=o.id,!t.cycling)R(),Pe(e);vt(n)}function No(e){let t=m.tabs.get(e.id),n=e.preview===!0&&t?.pinned!==!0,o=cv({...e,preview:n}),r=(e.paneId===void 0?void 0:Hn(e.paneId))??Rr(),i;if(t)o.pinned=t.pinned,fp(t);else{if(n){let a=yt(r),l=a?m.tabs.get(a):null;if(l)kp(l);Px()}let s=n?yt(r):null;if(s)i=r.tabOrder.indexOf(s),Fx(s);Ku(r,o.id,i)}return m.tabs.set(o.id,o),X(o.id,{focus:e.focus!==!1}),Y(o),o}function yt(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function Fl(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function Px(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)Fl(e)}function kv(e,t){let n=m.tabs.get(e),o=Gu(e);if(!n||!o)return;if(n.pinned=t,t)n.preview=!1;let r=o.tabOrder.filter((s)=>s!==e),i=r.filter((s)=>m.tabs.get(s)?.pinned===!0).length;o.tabOrder=[...r.slice(0,i),e,...r.slice(i)]}function XC(e,t){let n=m.tabs.get(e),o=Gu(e);if(!n||!o)return;o.tabOrder=Tt(o,e,t)}function Tt(e,t,n){let o=m.tabs.get(t);if(!o)return e.tabOrder;let r=e.tabOrder.filter((c)=>c!==t),i=r.filter((c)=>m.tabs.get(c)?.pinned===!0).length,s=o.pinned?0:i,a=o.pinned?i:r.length,l=Math.min(Math.max(n,s),a);return[...r.slice(0,l),t,...r.slice(l)]}function Fx(e){let t=m.tabs.get(e);if(!t)return;let n=Gu(e),o=n?.activeTabId===e;if(vn(t),fp(t),m.tabs.delete(e),_p(e),m.mruOrder=m.mruOrder.filter((s)=>s!==e),R(),n&&xp(n))wp(n.id);if(!o)return;let r=Rr(),i=m.mruOrder.find((s)=>r.tabOrder.includes(s))??r.tabOrder.at(-1)??null;if(i)X(i)}function QC(){let e=[...m.tabs.values()];m.tabs.clear(),Pt(),m.mruOrder=[],R();for(let t of e)fp(t)}function Pt(){m.panes=[{activeTabId:null,derived:null,id:Qn,tabOrder:[]}],m.activePaneId=Qn}function vn(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((n)=>n.documentPath!==t)].slice(0,gn)}function Tn(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function xt(e){if(!ne)ne=m.mruOrder.filter((o)=>m.tabs.has(o)),Z=0;let t=ne;if(t.length<2)return;Z=((Z+e)%t.length+t.length)%t.length;let n=t[Z];return X(n,{cycling:!0}),n}function ek(e){let t=[...m.tabs.keys()],n=[...m.tabs.values()],o=cv(e);m.tabs.set(o.id,o),Pt(),m.panes[0].tabOrder=[o.id],m.mruOrder=[],R(),X(o.id),Y(o);for(let r of t){if(r===o.id)continue;m.tabs.delete(r)}for(let r of n)fp(r);return o}function ci(e,t={}){X(e,t)}function Cm(e,t,n){let o=Hn(t);if(!o||!m.tabs.has(e))return null;if(o.tabOrder.includes(e)){if(n!==void 0)o.tabOrder=Tt(o,e,n);return o}return _p(e),Ku(o,e,n),o}function Sv(e,t,n){let o=m.tabs.get(e);if(!o)return;o.id=t,o.documentPath=n,m.tabs.delete(e),m.tabs.set(t,o);for(let r of m.panes)if(r.tabOrder=r.tabOrder.map((i)=>i===e?t:i),r.activeTabId===e)r.activeTabId=t;m.mruOrder=m.mruOrder.map((r)=>r===e?t:r),R(),ct(o)}function tk(e,t){e.registerAll([...Pn(t),...On(t)])}function Pn(e){let t=()=>m.tabs.size>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{xt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{xt(-1)}},{args:Se({path:He('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:n,args:o})=>{let r=ot("document.open",o,"path"),i=u.value?.documentPath??null;if(i!==r)return`Opened "${r}", but the active document is ${i===null?"none":`"${i}"`}.`;let s=n.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${ov[n.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${r}" is the active document, ${s}.`}},run:async(n,o)=>{let r=ot("document.open",o,"path");if(await e.openFile(r),![...m.tabs.values()].some((i)=>i.documentPath===r))throw RangeError(`command "document.open" argument "path": "${r}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:He('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",undo:"none",run:async(n,o)=>{let r=ot("document.openToSide",o,"file"),i=Pl(Rr().id);if(await e.openFile(r,{paneId:i.id}),![...m.tabs.values()].some((s)=>s.documentPath===r)){if(xp(i)&&i.id!==Qn)wp(i.id);throw RangeError(`command "document.openToSide" argument "file": "${r}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let n=Tn();if(n)await e.openFile(n)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:()=>{let n=m.activeTabId,o=n?m.tabs.get(n):null;if(n&&o)kv(n,!o.pinned)}},{args:Se({pinned:oo("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:(n,o)=>{let r=m.activeTabId;if(r&&m.tabs.get(r))kv(r,yi("document.setPinned",o,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,enablement:()=>{let n=m.activeTabId;return n!==null&&m.tabs.get(n)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let n=m.activeTabId;if(n)Fl(n)}}]}function On(e){let t=()=>m.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{Ox()}},{args:Se({path:He("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(n,o)=>{let r=ot("pane.compareWith",o,"path"),i=Rr();if((i.activeTabId?m.tabs.get(i.activeTabId):null)?.documentPath===r)throw RangeError(`command "pane.compareWith" argument "path": "${r}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Pl(i.id).id,r)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{$r(Qn)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{$r(vp)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:wn}]}function wn(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===Qn){if(e.derived=null,!xp(e))return}wp(e?.id??vp)}
|
|
2
|
+
export{Sx,Go,iv,gL,dn,$o,zu,bL,BC,Wu,ov,ha,vL,rv,$d,sv,bm,Ex,yL,vm,zi,Ki,av,Dd,lv,wL,zC,xL,_L,CL,Tx,kL,Lx,SL,ai,cv,WC,EL,TL,fp,Le,LL,dv,ms,uv,IL,Nl,hv,RL,mp,$L,vi,q,Hs,pv,fv,Ix,DL,ym,AL,NL,Rx,OL,Ji,Vu,VC,gp,mv,ML,pa,Ue,kc,Ko,PL,gv,FL,bv,jL,HL,Bs,vv,mr,BL,Uu,zL,WL,VL,Ol,xn,wm,ot,Jo,yv,yi,li,$x,UL,UC,Se,Do,fa,qC,oo,wv,qL,He,GL,Dx,bp,Ax,Ml,xv,_v,Nx,KL,ma,Ad,qu,xm,Cv,JL,Ao,YL,ZL,XL,QL,_m,GC,KC,JC,YC,Qn,vp,ZC,m,u,Rr,Hn,Gu,$r,yp,Ox,Mx,Pl,wp,xp,_p,Ku,Ua,Cp,Sc,No,Fl,Px,kv,XC,Fx,QC,ek,ci,Cm,Sv,tk};
|
|
3
|
+
|
|
4
|
+
//# debugId=D2F6E6849DBDB77464756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-cvbkkfqb.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
1
|
+
import{p}from"./studio-y7jehjrp.js";import{lp}from"./studio-222rqyyc.js";import{ge,Q,v,Hm}from"./studio-fqq890ap.js";import{ne}from"./studio-0k9mvpgj.js";import{T,R}from"./studio-spf2skgc.js";import{Bi,y}from"./studio-zpnk016a.js";import{D}from"./studio-tp642n5g.js";function k({slug:e,adapter:t}){let o=new Date().toISOString().slice(0,10);return`${JSON.stringify(t==="cloudflare-workers"?{assets:{binding:"ASSETS",directory:"./dist"},compatibility_date:o,compatibility_flags:["nodejs_compat"],main:"./dist/worker.js",name:e}:{compatibility_date:o,compatibility_flags:["nodejs_compat"],name:e,pages_build_output_dir:"./dist"},null,"\t")}
|
|
2
2
|
`}function m(e,{slug:t,adapter:o}){if(!e)return{content:k({adapter:o,slug:t}),patched:!0};let n;try{n=JSON.parse(e)}catch{return{content:e,patched:!1}}if(n.name=t,o==="cloudflare-workers")delete n.pages_build_output_dir,n.main="./dist/worker.js",n.assets={binding:"ASSETS",directory:"./dist"};else delete n.main,delete n.assets,n.pages_build_output_dir="./dist";return{content:`${JSON.stringify(n,null,"\t")}
|
|
3
|
-
`,patched:!0}}function gd(){try{return typeof p().cfApi==="function"}catch{return!1}}async function l(e,t){let o=p().cfApi;if(!o)throw Error("This platform cannot reach the Cloudflare API");try{return await o(e,t)}catch(n){throw lp(n),n}}async function oT(){return l("/accounts")}async function j(e,t){try{return await l(`/accounts/${e}/pages/projects/${t}`)}catch{return null}}async function C(e){return l(`/accounts/${e.accountId}/pages/projects`,{method:"POST",body:{name:e.projectName,production_branch:e.productionBranch,build_config:{build_command:"bunx jx build",destination_dir:"dist"},source:{type:"github",config:{owner:e.owner,repo_name:e.repo,production_branch:e.productionBranch,deployments_enabled:!0}}}})}async function em(e){let t=await l(`/accounts/${e.accountId}/pages/projects/${e.projectName}/deployments`),[o]=t;if(!o)return null;return{id:o.id,url:o.url,environment:o.environment,stage:o.latest_stage?.name??"unknown",status:o.latest_stage?.status??"unknown",createdOn:o.created_on}}async function j1(e,t){let o={...e.build};if(t===null)delete o.deploy;else o.deploy=t;if(await zi({build:o}),t!==null){let n=p(),i=null;try{i=await n.readFile("wrangler.jsonc")}catch{i=null}let w=o.adapter==="cloudflare-workers"?"cloudflare-workers":"cloudflare-pages",{content:x,patched:S}=m(i,{adapter:w,slug:t.projectName});if(S)await n.writeFile("wrangler.jsonc",x)}}async function rT(e,t){let n=await j(t.accountId,t.projectName)??await C(t),i={provider:"cloudflare-pages",accountId:t.accountId,projectName:t.projectName,...n.subdomain?{productionUrl:`https://${n.subdomain}`}:{}};return await j1(e,i),i}var h={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelDeployChecklist",$description:"The deploy checklist, drawn above the Activity feed in the Bottom dock's Activity tab: what is MISSING before this project can ship, as one row with the chain of prerequisites under it. `publish/deploy-checklist.ts` owns the chain — which link is forged, which is merely unasked, and which command forges the next one — and hands this document a row, four steps and at most one action. Nothing here reads source control, the project config or the command registry. It draws in the Activity tab's own vocabulary because a deploy is an ordered list of stages that finish, which is exactly what a row of that feed already is; a fifth visual idiom for it would be a second design of a thing the tab has.",tagName:"div",attributes:{part:"checklist"},style:{$description:"What `.activity-list`, `.activity-row`, `.activity-row--running`, `.activity-row--done`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step--done` and `.activity-step-icon` said in `styles/panels.css`, keyed on `part`. This is the LAST reader of those rules — `surfaces/panel-activity.json` carried its own copy when the feed converted, and left the stylesheet standing because this file still drew from it — so the whole `.problem-*, .activity-*` block is dead once this lands. Three token names could not travel: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and a document mounted into the dock body is outside it, so each would silently have taken its hard-coded px fallback. They are the kit's own scale here. One thing changed meaning on purpose: the step's `data-state` is the checklist's own three-valued state rather than the two CSS classes it used to collapse into, so `unknown` — \"nobody has asked\" — is a state the styling can tell apart from `todo` the day it should.",display:"block",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",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 without reading the row. 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:"var(--jx-space-2)",padding:"6px var(--jx-space-2)",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="state-icon"]':{$description:'Named `state-icon` rather than `icon`: `jx-button` puts `part="icon"` on the glyph slot of every button it draws, and the action button below is inside this same light-DOM tree — a rule on the bare name would reach into the kit\'s own drawing and a devtools query could not tell the two apart.',flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] > [part="state-icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] > [part="state-icon"]':{color:"var(--success)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",alignSelf:"stretch",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"]':{$description:"Pushed to the far edge, so the tab reads as a column of who raised what.",flex:"none",marginLeft:"auto",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="summary"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The chain, declared up front, so "which link is missing" is answered by looking rather than by reading the summary 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="done"] > [part="step-icon"]':{color:"var(--success)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="action"]':{marginTop:"var(--jx-space-1)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProject"},cases:{true:{tagName:"ul",attributes:{part:"list"},children:[{tagName:"li",attributes:{part:"row","data-state":"${state.rowState}"},children:[{tagName:"span",attributes:{part:"state-icon","aria-hidden":"true"},textContent:"${state.rowIcon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"Deploy checklist"},{tagName:"span",attributes:{part:"source"},textContent:"Publish"}]},{tagName:"div",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"#/state/steps"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"step","data-step":"${$map.item.id}","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-text"},textContent:"${$map.item.text}"}]}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAction"},cases:{true:{tagName:"jx-button",$description:"The recovery button wears the command's own title, so it reads as a verb rather than as a decoration, and a refused command is dimmed with the reason it names in its tooltip. A command the registry does not have, or whose `when` is false, draws NOTHING rather than a dead label — a surface may choose whether to show a command, never whether it exists (§13).",$props:{size:"sm",disabled:{$ref:"#/state/actionDisabled"}},attributes:{part:"action",title:"${state.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[]}]},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]}]}]}}}]};T("panel-deploy-checklist",h);var d=null,c=null,a=null,r=null;function A(e,t){e.hasProject=t.hasProject,e.rowState=t.rowState,e.rowIcon=t.rowIcon,e.summary=t.summary,e.steps=t.steps,e.hasAction=t.hasAction,e.actionLabel=t.actionLabel,e.actionTitle=t.actionTitle,e.actionDisabled=t.actionDisabled}function N(e){if(d!==e)return!1;return r===null?a!==null:r.root.parentNode===e}function f(e,t){if(N(e))return;u(),d=e;let o=v({actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",runAction:t.runAction,steps:[],summary:""});c=ge(),c.run(()=>{Q(()=>{A(o,t.project())})});let n=R("panel-deploy-checklist",o,e);a=n,n.then((i)=>{if(a===n)r=i;else i.dispose()})}function u(){c?.stop(),c=null;let e=a;if(a=null,r)r.dispose(),r=null;else if(e)e.then((t)=>t.dispose());d=null}function I(){return D?.projectConfig??null}function ca(){return I()?.build?.deploy}var s=Wm({asked:!1,observed:null});function rp(e){s.observed=e,s.asked=!0}function _(){let{status:e}=y.git;if(e===null)return{command:"git.init",detail:"Source control has not reported on this project yet.",id:"repo",label:"Track this project with git",state:"unknown"};return e.isRepo?{command:"git.init",detail:`Tracked${e.branch?` — on branch ${e.branch}`:""}.`,id:"repo",label:"Track this project with git",state:"done"}:{command:"git.init",detail:"A deploy ships what the repository holds, so the repository comes first.",id:"repo",label:"Track this project with git",state:"todo"}}function L(){let{status:e}=y.git;if(e===null||!e.isRepo)return{command:"git.createGithubRepository",detail:"A remote is where the provider builds from.",id:"remote",label:"Push to a remote",state:e===null?"unknown":"todo"};if((e.remotes??[]).length===0)return{command:"git.createGithubRepository",detail:"This repository is local only — nothing outside this machine can build it.",id:"remote",label:"Push to a remote",state:"todo"};return e.ahead>0?{command:"git.push",detail:`${e.ahead} commit(s) are not on ${e.remotes[0]} yet, so a build would ship the older tree.`,id:"remote",label:"Push to a remote",state:"todo"}:{command:"git.push",detail:`Up to date with ${e.remotes[0]}.`,id:"remote",label:"Push to a remote",state:"done"}}function O(){let e=ca();if(e)return{command:"publish.setUp",detail:`Cloudflare Pages project ${e.projectName}.`,id:"provider",label:"Connect a deploy provider",state:"done"};return gd()?{command:"publish.setUp",detail:"Connecting one makes every commit build and publish on its own.",id:"provider",label:"Connect a deploy provider",state:"todo"}:{command:"publish.setUp",detail:"This platform cannot reach the Cloudflare API. Commit and push instead — your host "+"runs bunx jx build and serves dist/.",id:"provider",label:"Connect a deploy provider",state:"unknown"}}function E(){if(!ca())return{command:"publish.deploy",detail:"Nothing has been deployed, because no provider is connected.",id:"deployed",label:"Deploy",state:"todo"};if(!s.asked)return{command:"publish.deploy",detail:"Cloudflare has not been asked yet, so this is not a claim that nothing shipped.",id:"deployed",label:"Deploy",state:"unknown"};if(s.observed===null)return{command:"publish.deploy",detail:"Cloudflare reports no deployments for this project.",id:"deployed",label:"Deploy",state:"todo"};let{observed:e}=s;return e.status==="success"?{command:"publish.deploy",detail:`${e.environment} — ${e.url}`,id:"deployed",label:"Deploy",state:"done"}:{command:"publish.deploy",detail:`Last deployment ${e.stage}: ${e.status}.`,id:"deployed",label:"Deploy",state:"todo"}}function g(){return[_(),L(),O(),E()]}function b(){return g().find((e)=>e.state!=="done")??null}function sT(){if(!D)return null;let e=b();if(e)return{command:e.command,label:e.label,title:e.detail};return{command:"publish.openDashboard",label:"Deployed",title:ca()?.productionUrl??"Everything this project needs to ship is in place."}}var W={done:"✓",todo:"·",unknown:"?"};function V(e){return{icon:W[e.state],id:e.id,state:e.state,text:e.state==="done"?e.label:`${e.label} — ${e.detail}`}}function H(e){let t={actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1};if(!e)return t;let o=ne(),n=o?.get(e.command);if(!o||!n||!o.isVisible(e.command))return t;let i=o.disabledReason(e.command);return{actionDisabled:i!==void 0,actionLabel:n.title,actionTitle:i?`${n.title} — requires ${i}`:n.title,hasAction:!0}}function J(){if(!D)return{actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",steps:[],summary:""};let e=g(),t=e.find((o)=>o.state!=="done")??null;return{...H(t),hasProject:!0,rowIcon:t?"⋯":"✓",rowState:t?"running":"done",steps:e.map((o)=>V(o)),summary:t?t.detail:"Everything this project needs to ship is in place."}}function B(){let e=b();if(!e)return;ne()?.run(e.command)}var F={project:J,runAction:B};function aT(e){let t=e.querySelector("[data-deploy-checklist]");if(!t){u();return}f(t,F)}
|
|
4
|
-
export{gd,
|
|
3
|
+
`,patched:!0}}function gd(){try{return typeof p().cfApi==="function"}catch{return!1}}async function l(e,t){let o=p().cfApi;if(!o)throw Error("This platform cannot reach the Cloudflare API");try{return await o(e,t)}catch(n){throw lp(n),n}}async function YE(){return l("/accounts")}async function j(e,t){try{return await l(`/accounts/${e}/pages/projects/${t}`)}catch{return null}}async function C(e){return l(`/accounts/${e.accountId}/pages/projects`,{method:"POST",body:{name:e.projectName,production_branch:e.productionBranch,build_config:{build_command:"bunx jx build",destination_dir:"dist"},source:{type:"github",config:{owner:e.owner,repo_name:e.repo,production_branch:e.productionBranch,deployments_enabled:!0}}}})}async function Zf(e){let t=await l(`/accounts/${e.accountId}/pages/projects/${e.projectName}/deployments`),[o]=t;if(!o)return null;return{id:o.id,url:o.url,environment:o.environment,stage:o.latest_stage?.name??"unknown",status:o.latest_stage?.status??"unknown",createdOn:o.created_on}}async function P1(e,t){let o={...e.build};if(t===null)delete o.deploy;else o.deploy=t;if(await Bi({build:o}),t!==null){let n=p(),i=null;try{i=await n.readFile("wrangler.jsonc")}catch{i=null}let w=o.adapter==="cloudflare-workers"?"cloudflare-workers":"cloudflare-pages",{content:x,patched:S}=m(i,{adapter:w,slug:t.projectName});if(S)await n.writeFile("wrangler.jsonc",x)}}async function ZE(e,t){let n=await j(t.accountId,t.projectName)??await C(t),i={provider:"cloudflare-pages",accountId:t.accountId,projectName:t.projectName,...n.subdomain?{productionUrl:`https://${n.subdomain}`}:{}};return await P1(e,i),i}var h={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelDeployChecklist",$description:"The deploy checklist, drawn above the Activity feed in the Bottom dock's Activity tab: what is MISSING before this project can ship, as one row with the chain of prerequisites under it. `publish/deploy-checklist.ts` owns the chain — which link is forged, which is merely unasked, and which command forges the next one — and hands this document a row, four steps and at most one action. Nothing here reads source control, the project config or the command registry. It draws in the Activity tab's own vocabulary because a deploy is an ordered list of stages that finish, which is exactly what a row of that feed already is; a fifth visual idiom for it would be a second design of a thing the tab has.",tagName:"div",attributes:{part:"checklist"},style:{$description:"What `.activity-list`, `.activity-row`, `.activity-row--running`, `.activity-row--done`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step--done` and `.activity-step-icon` said in `styles/panels.css`, keyed on `part`. This is the LAST reader of those rules — `surfaces/panel-activity.json` carried its own copy when the feed converted, and left the stylesheet standing because this file still drew from it — so the whole `.problem-*, .activity-*` block is dead once this lands. Three token names could not travel: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and a document mounted into the dock body is outside it, so each would silently have taken its hard-coded px fallback. They are the kit's own scale here. One thing changed meaning on purpose: the step's `data-state` is the checklist's own three-valued state rather than the two CSS classes it used to collapse into, so `unknown` — \"nobody has asked\" — is a state the styling can tell apart from `todo` the day it should.",display:"block",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",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 without reading the row. 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:"var(--jx-space-2)",padding:"6px var(--jx-space-2)",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="state-icon"]':{$description:'Named `state-icon` rather than `icon`: `jx-button` puts `part="icon"` on the glyph slot of every button it draws, and the action button below is inside this same light-DOM tree — a rule on the bare name would reach into the kit\'s own drawing and a devtools query could not tell the two apart.',flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] > [part="state-icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] > [part="state-icon"]':{color:"var(--success)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",alignSelf:"stretch",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"]':{$description:"Pushed to the far edge, so the tab reads as a column of who raised what.",flex:"none",marginLeft:"auto",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="summary"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The chain, declared up front, so "which link is missing" is answered by looking rather than by reading the summary 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="done"] > [part="step-icon"]':{color:"var(--success)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="action"]':{marginTop:"var(--jx-space-1)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProject"},cases:{true:{tagName:"ul",attributes:{part:"list"},children:[{tagName:"li",attributes:{part:"row","data-state":"${state.rowState}"},children:[{tagName:"span",attributes:{part:"state-icon","aria-hidden":"true"},textContent:"${state.rowIcon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"Deploy checklist"},{tagName:"span",attributes:{part:"source"},textContent:"Publish"}]},{tagName:"div",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"#/state/steps"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"step","data-step":"${$map.item.id}","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-text"},textContent:"${$map.item.text}"}]}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAction"},cases:{true:{tagName:"jx-button",$description:"The recovery button wears the command's own title, so it reads as a verb rather than as a decoration, and a refused command is dimmed with the reason it names in its tooltip. A command the registry does not have, or whose `when` is false, draws NOTHING rather than a dead label — a surface may choose whether to show a command, never whether it exists (§13).",$props:{size:"sm",disabled:{$ref:"#/state/actionDisabled"}},attributes:{part:"action",title:"${state.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[]}]},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]}]}]}}}]};T("panel-deploy-checklist",h);var d=null,c=null,a=null,r=null;function A(e,t){e.hasProject=t.hasProject,e.rowState=t.rowState,e.rowIcon=t.rowIcon,e.summary=t.summary,e.steps=t.steps,e.hasAction=t.hasAction,e.actionLabel=t.actionLabel,e.actionTitle=t.actionTitle,e.actionDisabled=t.actionDisabled}function N(e){if(d!==e)return!1;return r===null?a!==null:r.root.parentNode===e}function f(e,t){if(N(e))return;u(),d=e;let o=v({actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",runAction:t.runAction,steps:[],summary:""});c=ge(),c.run(()=>{Q(()=>{A(o,t.project())})});let n=R("panel-deploy-checklist",o,e);a=n,n.then((i)=>{if(a===n)r=i;else i.dispose()})}function u(){c?.stop(),c=null;let e=a;if(a=null,r)r.dispose(),r=null;else if(e)e.then((t)=>t.dispose());d=null}function I(){return D?.projectConfig??null}function ca(){return I()?.build?.deploy}var s=Hm({asked:!1,observed:null});function rp(e){s.observed=e,s.asked=!0}function _(){let{status:e}=y.git;if(e===null)return{command:"git.init",detail:"Source control has not reported on this project yet.",id:"repo",label:"Track this project with git",state:"unknown"};return e.isRepo?{command:"git.init",detail:`Tracked${e.branch?` — on branch ${e.branch}`:""}.`,id:"repo",label:"Track this project with git",state:"done"}:{command:"git.init",detail:"A deploy ships what the repository holds, so the repository comes first.",id:"repo",label:"Track this project with git",state:"todo"}}function L(){let{status:e}=y.git;if(e===null||!e.isRepo)return{command:"git.createGithubRepository",detail:"A remote is where the provider builds from.",id:"remote",label:"Push to a remote",state:e===null?"unknown":"todo"};if((e.remotes??[]).length===0)return{command:"git.createGithubRepository",detail:"This repository is local only — nothing outside this machine can build it.",id:"remote",label:"Push to a remote",state:"todo"};return e.ahead>0?{command:"git.push",detail:`${e.ahead} commit(s) are not on ${e.remotes[0]} yet, so a build would ship the older tree.`,id:"remote",label:"Push to a remote",state:"todo"}:{command:"git.push",detail:`Up to date with ${e.remotes[0]}.`,id:"remote",label:"Push to a remote",state:"done"}}function O(){let e=ca();if(e)return{command:"publish.setUp",detail:`Cloudflare Pages project ${e.projectName}.`,id:"provider",label:"Connect a deploy provider",state:"done"};return gd()?{command:"publish.setUp",detail:"Connecting one makes every commit build and publish on its own.",id:"provider",label:"Connect a deploy provider",state:"todo"}:{command:"publish.setUp",detail:"This platform cannot reach the Cloudflare API. Commit and push instead — your host "+"runs bunx jx build and serves dist/.",id:"provider",label:"Connect a deploy provider",state:"unknown"}}function E(){if(!ca())return{command:"publish.deploy",detail:"Nothing has been deployed, because no provider is connected.",id:"deployed",label:"Deploy",state:"todo"};if(!s.asked)return{command:"publish.deploy",detail:"Cloudflare has not been asked yet, so this is not a claim that nothing shipped.",id:"deployed",label:"Deploy",state:"unknown"};if(s.observed===null)return{command:"publish.deploy",detail:"Cloudflare reports no deployments for this project.",id:"deployed",label:"Deploy",state:"todo"};let{observed:e}=s;return e.status==="success"?{command:"publish.deploy",detail:`${e.environment} — ${e.url}`,id:"deployed",label:"Deploy",state:"done"}:{command:"publish.deploy",detail:`Last deployment ${e.stage}: ${e.status}.`,id:"deployed",label:"Deploy",state:"todo"}}function g(){return[_(),L(),O(),E()]}function b(){return g().find((e)=>e.state!=="done")??null}function XE(){if(!D)return null;let e=b();if(e)return{command:e.command,label:e.label,title:e.detail};return{command:"publish.openDashboard",label:"Deployed",title:ca()?.productionUrl??"Everything this project needs to ship is in place."}}var W={done:"✓",todo:"·",unknown:"?"};function V(e){return{icon:W[e.state],id:e.id,state:e.state,text:e.state==="done"?e.label:`${e.label} — ${e.detail}`}}function H(e){let t={actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1};if(!e)return t;let o=ne(),n=o?.get(e.command);if(!o||!n||!o.isVisible(e.command))return t;let i=o.disabledReason(e.command);return{actionDisabled:i!==void 0,actionLabel:n.title,actionTitle:i?`${n.title} — requires ${i}`:n.title,hasAction:!0}}function J(){if(!D)return{actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",steps:[],summary:""};let e=g(),t=e.find((o)=>o.state!=="done")??null;return{...H(t),hasProject:!0,rowIcon:t?"⋯":"✓",rowState:t?"running":"done",steps:e.map((o)=>V(o)),summary:t?t.detail:"Everything this project needs to ship is in place."}}function B(){let e=b();if(!e)return;ne()?.run(e.command)}var F={project:J,runAction:B};function QE(e){let t=e.querySelector("[data-deploy-checklist]");if(!t){u();return}f(t,F)}
|
|
4
|
+
export{gd,YE,Zf,P1,ZE,ca,rp,XE,QE};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=32A006FBA9B78D4764756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-cxt150pj.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-6k1eswp9.js";import{rt,zt,T,R,Ct}from"./studio-z1vdxq0e.js";import{v}from"./studio-0nm2skex.js";import{Ir}from"./studio-k9pwvmz8.js";import{Al,Ld,_c,Gi,Va,Id,Hu}from"./studio-ant1zbp3.js";import{lb,wE,cb,_E,CE}from"./studio-0mm38y62.js";import{Cc}from"./studio-011em5cf.js";import{Ev,Ni}from"./studio-153mwkyq.js";import{He}from"./studio-nw4q9sdn.js";var E={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, for the reason `doc-header.json` gives: a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",E);function O(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function j(t,e,r){let i=v({browse:r.browse,edit:r.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:r.upload,value:e.value,warm:r.warm}),a=null,o=!1;return R("media-field",i,t).then((n)=>{if(o){n.dispose();return}a=n}),{dispose(){o=!0,a?.dispose(),a=null},update:(n)=>O(i,n)}}function ld(t){let{anchor:e,name:r,scope:i,slot:a}=t,o=document.createElement("div");o.style.pointerEvents="auto",o.setAttribute(rt,zt("popover",a)),Ct("popover").append(o);let n=new AbortController,s=null,w=null,c=!1,F=(m)=>{if(c)return;if(c=!0,n.abort(),w?.dispose(),w=null,o.remove(),m)t.onDismissed?.()},A=(async()=>{let m=await R(r,i,o,{signal:n.signal,...t.onNodeCreated?{onNodeCreated:t.onNodeCreated}:{}});if(n.signal.aborted)return;if(w=m,s=m.root,s.setAttribute(rt,zt("popover",a)),s.addEventListener("toggle",(b)=>{if(b.newState==="closed")F(!0)}),!s.hasAttribute("popover"))await new Promise((b)=>{s?.addEventListener("jx-ready",()=>b(),{once:!0})});if(n.signal.aborted)return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();F(!1)},host:o,isOpen:()=>!c,ready:A}}var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so. Fifty rows is the cap the list has always had; the sentence is what keeps the cap from reading as "that is all there is".',tagName:"p",attributes:{part:"more"},textContent:"${state.moreLabel}"}}}]}]};T("media-browser",L);var D="media-picker";function V(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel}function N(t,e,r){let i=v({emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,x:t.x,y:t.y}),a=ld({anchor:r,name:"media-browser",scope:i,slot:D,...e.dismissed?{onDismissed:e.dismissed}:{}});return a.ready.then(()=>{if(a.isOpen())a.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:a.close,host:a.host,isOpen:a.isOpen,ready:a.ready,update:(o)=>V(i,o)}}var h=[],S=!1;async function P(t,e){let r=[];try{let i=await Ir(()=>e.listDirectory(t));wE(i);for(let a of i)if(a.type==="directory"){let o=await P(a.path,e);r.push(...o)}else{let o=Gi(a.name);if(Ld.has(o))r.push({file:a.path,isImage:Al.has(o),name:a.name,path:Id(a.path)})}}catch{}return r}async function g(){if(S)return;let t=p();h=await P("public",t),S=!0,Ni("leftPanel","rightPanel","frontmatterPanel")}function Z_(){h=[],S=!1,_E()}var y=50,d=null,u=null,l="",M={x:0,y:0};function k(){let t=l.toLowerCase(),e=t?h.filter((a)=>a.path.toLowerCase().includes(t)||a.name.toLowerCase().includes(t)):h,i=e.slice(0,y).map((a)=>{let o=CE(lb(a.file));return{caption:o,captionState:o?"shown":"hidden",file:a.file,key:a.file,name:a.name,path:a.path,thumbSrc:a.isImage?Hu(a.file):"",thumbState:a.isImage?"shown":"hidden"}});return{emptyLabel:"No matches",filter:l,moreLabel:`…${e.length-y} more`,moreState:e.length>y?"shown":"hidden",rows:i,rowsState:i.length>0?"listed":"empty",x:M.x,y:M.y}}function B(){let t=d;d=null,u=null,l="",t?.close()}var x=0;function z(t,e,r){if(!cb(t,e,r)||x!==0)return;x=requestAnimationFrame(()=>{x=0,d?.update(k())})}function o$(t,e){B(),u=e;let r=He(t);M={x:r.left,y:r.bottom+4},d=N(k(),{dismissed:()=>{d=null,u=null,l=""},measure:z,pick:(i)=>{let a=u;B(),a?.(i)},setFilter:(i)=>{l=i,d?.update(k())}},t)}async function r$(t,e){let r=await Va([...t]),[i]=r;if(i)e(i.ref)}function s$(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=_c(),e.addEventListener("change",()=>{if(e.files?.length)r$(e.files,t)}),e.click()}var _=400,f=new WeakMap;function H(t,e){let r=Al.has(Gi(e));return{label:t,thumbSrc:r&&e?Cc(e):"",thumbState:r&&e?"shown":"hidden",value:e}}function cd(t,e,r,i){g();let a=f.get(t);if(a){a.prop=e,a.commit=i,a.handle.update(H(e,r));return}let o={commit:i,handle:null,prop:e};o.handle=j(t,H(e,r),{browse:(n)=>{g(),o$(n,(s)=>o.commit(s))},edit:(n)=>Ev(`media:${o.prop}`,_,(s)=>o.commit(s))(n),upload:()=>s$((n)=>o.commit(n)),warm:()=>{g()}}),f.set(t,o)}function dw(t){let e=f.get(t);if(e)f.delete(t),e.handle.dispose()}
|
|
2
|
-
export{ld,
|
|
1
|
+
import{p}from"./studio-y7jehjrp.js";import{rt,zt,T,R,Ct}from"./studio-spf2skgc.js";import{v}from"./studio-fqq890ap.js";import{Ir}from"./studio-888knnkc.js";import{Al,Ld,_c,Gi,Va,Id,Bu}from"./studio-c6w3tq7t.js";import{sb,bE,ab,yE,wE}from"./studio-xk0z6msk.js";import{Cc}from"./studio-a7xqhc3n.js";import{Tv,Ai}from"./studio-tp642n5g.js";import{Oe}from"./studio-vavmwshr.js";var E={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, for the reason `doc-header.json` gives: a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",E);function O(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function j(t,e,r){let i=v({browse:r.browse,edit:r.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:r.upload,value:e.value,warm:r.warm}),a=null,o=!1;return R("media-field",i,t).then((n)=>{if(o){n.dispose();return}a=n}),{dispose(){o=!0,a?.dispose(),a=null},update:(n)=>O(i,n)}}function ld(t){let{anchor:e,name:r,scope:i,slot:a}=t,o=document.createElement("div");o.style.pointerEvents="auto",o.setAttribute(rt,zt("popover",a)),Ct("popover").append(o);let n=new AbortController,s=null,w=null,c=!1,F=(m)=>{if(c)return;if(c=!0,n.abort(),w?.dispose(),w=null,o.remove(),m)t.onDismissed?.()},A=(async()=>{let m=await R(r,i,o,{signal:n.signal,...t.onNodeCreated?{onNodeCreated:t.onNodeCreated}:{}});if(n.signal.aborted)return;if(w=m,s=m.root,s.setAttribute(rt,zt("popover",a)),s.addEventListener("toggle",(b)=>{if(b.newState==="closed")F(!0)}),!s.hasAttribute("popover"))await new Promise((b)=>{s?.addEventListener("jx-ready",()=>b(),{once:!0})});if(n.signal.aborted)return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();F(!1)},host:o,isOpen:()=>!c,ready:A}}var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so. Fifty rows is the cap the list has always had; the sentence is what keeps the cap from reading as "that is all there is".',tagName:"p",attributes:{part:"more"},textContent:"${state.moreLabel}"}}}]}]};T("media-browser",L);var D="media-picker";function V(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel}function N(t,e,r){let i=v({emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,x:t.x,y:t.y}),a=ld({anchor:r,name:"media-browser",scope:i,slot:D,...e.dismissed?{onDismissed:e.dismissed}:{}});return a.ready.then(()=>{if(a.isOpen())a.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:a.close,host:a.host,isOpen:a.isOpen,ready:a.ready,update:(o)=>V(i,o)}}var h=[],S=!1;async function P(t,e){let r=[];try{let i=await Ir(()=>e.listDirectory(t));bE(i);for(let a of i)if(a.type==="directory"){let o=await P(a.path,e);r.push(...o)}else{let o=Gi(a.name);if(Ld.has(o))r.push({file:a.path,isImage:Al.has(o),name:a.name,path:Id(a.path)})}}catch{}return r}async function g(){if(S)return;let t=p();h=await P("public",t),S=!0,Ai("leftPanel","rightPanel","frontmatterPanel")}function Y_(){h=[],S=!1,yE()}var y=50,d=null,u=null,l="",M={x:0,y:0};function k(){let t=l.toLowerCase(),e=t?h.filter((a)=>a.path.toLowerCase().includes(t)||a.name.toLowerCase().includes(t)):h,i=e.slice(0,y).map((a)=>{let o=wE(sb(a.file));return{caption:o,captionState:o?"shown":"hidden",file:a.file,key:a.file,name:a.name,path:a.path,thumbSrc:a.isImage?Bu(a.file):"",thumbState:a.isImage?"shown":"hidden"}});return{emptyLabel:"No matches",filter:l,moreLabel:`…${e.length-y} more`,moreState:e.length>y?"shown":"hidden",rows:i,rowsState:i.length>0?"listed":"empty",x:M.x,y:M.y}}function B(){let t=d;d=null,u=null,l="",t?.close()}var x=0;function z(t,e,r){if(!ab(t,e,r)||x!==0)return;x=requestAnimationFrame(()=>{x=0,d?.update(k())})}function XR(t,e){B(),u=e;let r=Oe(t);M={x:r.left,y:r.bottom+4},d=N(k(),{dismissed:()=>{d=null,u=null,l=""},measure:z,pick:(i)=>{let a=u;B(),a?.(i)},setFilter:(i)=>{l=i,d?.update(k())}},t)}async function QR(t,e){let r=await Va([...t]),[i]=r;if(i)e(i.ref)}function e$(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=_c(),e.addEventListener("change",()=>{if(e.files?.length)QR(e.files,t)}),e.click()}var _=400,f=new WeakMap;function H(t,e){let r=Al.has(Gi(e));return{label:t,thumbSrc:r&&e?Cc(e):"",thumbState:r&&e?"shown":"hidden",value:e}}function cd(t,e,r,i){g();let a=f.get(t);if(a){a.prop=e,a.commit=i,a.handle.update(H(e,r));return}let o={commit:i,handle:null,prop:e};o.handle=j(t,H(e,r),{browse:(n)=>{g(),XR(n,(s)=>o.commit(s))},edit:(n)=>Tv(`media:${o.prop}`,_,(s)=>o.commit(s))(n),upload:()=>e$((n)=>o.commit(n)),warm:()=>{g()}}),f.set(t,o)}function uw(t){let e=f.get(t);if(e)f.delete(t),e.handle.dispose()}
|
|
2
|
+
export{ld,Y_,XR,QR,e$,cd,uw};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=E3994757D515F61664756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-dkn3x3hz.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{qu}from"./studio-cvbkkfqb.js";import{gb}from"./studio-65fhspdd.js";import{D}from"./studio-tp642n5g.js";function c(){return Object.keys(D?.projectConfig?.content??{})}function Tw(e){let n=gb(e);if(!n)return null;if(/\.[a-z\d]+$/i.test(n.dir))return null;return{def:n.def,dir:n.dir,ext:n.ext,name:n.name,schema:n.def.schema??null}}function cb(){return c().map((e)=>Tw(e)).filter((e)=>e!==null)}function sa(e){let n=qu(e??null,D?.projectConfig);return n?Tw(n.name):null}function u(e){if(e===null||typeof e!=="object")return e;return JSON.parse(JSON.stringify(e))}function l(e){if(typeof e.$ref==="string")return"";switch(e.type){case"boolean":return!1;case"integer":case"number":return 0;case"array":return[];case"object":return y1(e);default:return""}}function y1(e){let n=e?.properties;if(!n)return{};let i=new Set(Array.isArray(e?.required)?e.required:[]),t={};for(let[r,o]of Object.entries(n))if(o.default!==void 0)t[r]=u(o.default);else if(i.has(r))t[r]=l(o);return t}function CE(e,n){return(Array.isArray(e?.required)?e.required:[]).filter((t)=>n[t]===void 0)}
|
|
2
|
+
export{Tw,cb,sa,y1,CE};
|
|
3
|
+
|
|
4
|
+
//# debugId=33EF567F57BD535C64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-e6re3rk1.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var n;function
|
|
2
|
-
export{
|
|
1
|
+
var n;function NI(e){n=new URL("./",e).href}function zv(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{NI,zv};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=498A34F958330ADF64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-edbtvcd1.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-6k1eswp9.js";import{qt,Vs,Ka}from"./studio-ft8pfpp0.js";import{ne}from"./studio-dknr8m7b.js";import{T,R,rn,Rc,vs}from"./studio-z1vdxq0e.js";import{v}from"./studio-0nm2skex.js";import{u}from"./studio-27tc8q0h.js";import{eb,uE,Hf,Io}from"./studio-d007j0z3.js";import{Ad,Mo,D}from"./studio-153mwkyq.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 F_(e){z=e??null}function Af(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("",Ka())).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 uE(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=eb().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=Ad(t.doc.document).map((r)=>({kind:"node",path:r.path,name:r.nodeType==="text"?String(r.node).slice(0,60):Mo(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(),rn(n,e.id,t,"Palette")}function M(e){switch(e.kind){case"project":{y(),z?.openRecentProject(e.root);return}case"file":{y(),Hf({name:e.name,path:e.path,root:J()??""}),Io(e.path);return}case"mode":{me(e.mode);return}case"node":{y(),Rc("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-y7jehjrp.js";import{qt,Vs,Ka}from"./studio-1x8x26k3.js";import{ne}from"./studio-0k9mvpgj.js";import{T,R,on,Rc,vs}from"./studio-spf2skgc.js";import{v}from"./studio-fqq890ap.js";import{u}from"./studio-cvbkkfqb.js";import{Xg,lE,Ff,Lo}from"./studio-mwxgyn9h.js";import{Nd,Zo,D}from"./studio-tp642n5g.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 P_(e){z=e??null}function $f(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("",Ka())).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 lE(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=Xg().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=Nd(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(),Ff({name:e.name,path:e.path,root:J()??""}),Lo(e.path);return}case"mode":{me(e.mode);return}case"node":{y(),Rc("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{P_,$f};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=8C60334715637D6264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-eh0rac07.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function p(t){return JSON.parse(JSON.stringify(t))}function Ae(t){return t===void 0||t===null?t:p(t)}function
|
|
2
|
-
export{Ae,
|
|
1
|
+
function p(t){return JSON.parse(JSON.stringify(t))}function Ae(t){return t===void 0||t===null?t:p(t)}function Od(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function Ic(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function Im(t,e){switch(e.op){case"set-key":{let n=Od(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=n;if(e.value===void 0)delete r[e.key];else r[e.key]=Ae(e.value);return}case"insert-child":{let n=Od(t,e.parentPath);Ic(n).splice(e.index,0,Ae(e.node));return}case"remove-child":{let n=Od(t,e.parentPath);Ic(n).splice(e.index,1);return}case"set-child":{let n=Od(t,e.parentPath);Ic(n).splice(e.index,1,Ae(e.node));return}case"move-child":{x(e);let n=Od(t,e.fromParentPath),r=Od(t,e.toParentPath),o=Ic(n),a=Ic(r),[s]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,s);return}default:break}throw Error(`unknown-doc-op:${e.op}`)}function d(t,e,n,r,o){let a=t.length;if(!(a<e.length&&t.every((m,J)=>m===e[J]))||e[a]!=="children"||typeof e[a+1]!=="number")return e;let i=e[a+1];if(o?i<n:i<=n)return e;let c=[...e];return c[a+1]=i+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function h(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function lk(t,e){switch(e.op){case"set-key":{let n=Od(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=Ae(n[e.key]);return r===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:r}}case"insert-child":{let{length:n}=l(t,e.parentPath);return{index:h(e.index,n),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let n=f(t,e.fromParentPath);P(n,e.fromParentPath,e.fromIndex);let r=l(t,e.toParentPath),o=h(e.toIndex,r.length-(r===n?1:0));return{fromIndex:o,fromParentPath:d(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:d(e.toParentPath,e.fromParentPath,o,1,!0)}}default:break}throw Error(`unknown-doc-op:${e.op}`)}function f(t,e){let n=Od(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function u(t,e,n){let r=f(t,e);return P(r,e,n),Ae(r[n])}function l(t,e){let n=Od(t,e);if(!n||typeof n!=="object"||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
|
|
2
|
+
export{Ae,Od,Ic,Im,lk};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=7BBF7FA2DA5E2E9F64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-evwgp1ym.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{te}from"./studio-ery42sqr.js";import{p}from"./studio-6k1eswp9.js";import{v,S}from"./studio-0nm2skex.js";import{fd,Eu}from"./studio-jsr14n1s.js";import{xi,T,R}from"./studio-z1vdxq0e.js";import{dd}from"./studio-gxna6yta.js";import{IE}from"./studio-z47mm077.js";import{Ab}from"./studio-pvj970st.js";import{Sd}from"./studio-w8w9frjy.js";import{D}from"./studio-153mwkyq.js";var N={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContributed",$description:'The generic settings section behind `$studio.settings` (specs/extensions.md §9.1), as a Jx document over the kit. One document serves both layouts an extension may declare: "form" is a single schema form over the whole section value, "map" is master-detail — the entry keys on the left, the selected entry\'s form on the right. The adapter (`surfaces/settings-contributed.ts`) hands in the title, the layout, the entry rows already marked as selected, and whatever the reader is part-way through typing; `settings/contributed-section.ts` decides what an entry may be named, what reaches `project.json`, and what the validator said about it. The schema form itself is an ISLAND: this document renders `form-host` and nothing inside it, because a form built from a JSON Schema is `ui/schema-form.ts`\'s surface rather than this one\'s — the section places the element that surface hands back. The actions row is the second island: `panels/data-grid.ts` contributes it, and that one is still lit over Spectrum.',tagName:"section",attributes:{part:"contributed"},style:{$description:"What `.settings-section-title`, `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state` and `.settings-inline-form` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This section was the LAST emitter of every one of them except `.settings-empty-state`, which `panels/settings-pane.ts` still writes when a project closes with the editor open — so those rules are dead in the stylesheet from here, and a central sweep removes them rather than this change, which owns no stylesheet. Two values could not come across. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so it would have taken its hard-coded fallback every time; the entry name is a kit textfield now and carries the kit's own type ramp. And `.entry-name-input`, `.settings-form-panel`, `.settings-section` and `.contributed-section` had no rule anywhere at all — they were four entries on `check-styles.ts`'s orphan ledger, which is the ledger's point.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="actions"]':{$description:"The host-contributed actions row — Test Connection, Push Schema, Open Data Grid on the data sections. `.data-section-actions` never had a rule anywhere, so the row was whatever the buttons stacked up to; it is a row with a gap under it now.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"12px"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="entry"], & [part="new-open"]':{width:"100%"},'& [part="entry"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{$description:"`min-width: 0` is the one line `.settings-editor-panel` did not have and needed: a flex child's floor is its content, and the schema form inside this one is a whole form rather than the short cards Data Shapes puts here — so a long pointer or a wide row pushed the column past the right edge of the pane instead of scrolling inside it.",flex:"1",padding:"16px",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="entry-name"]':{flex:"1",minWidth:"0",maxWidth:"220px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/actionsState"},cases:{slot:{$description:"An island: the host renders its own actions into this node and the document renders nothing inside it.",tagName:"div",attributes:{part:"actions"}}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layout"},cases:{form:{$description:"An island: `ui/schema-form.ts` draws the whole section value into this node.",tagName:"div",attributes:{part:"form-host"}},map:{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"entry","data-entry":"${$map.item.key}","data-jx-region":"${$map.item.region}"},$props:{label:"${$map.item.key}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.key}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"New Entry",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Entry"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New entry name",placeholder:"entry-name",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"Select or create an entry"},editing:{tagName:"div",attributes:{part:"editor","data-jx-region":"${state.editorRegion}"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"jx-textfield",attributes:{part:"entry-name"},$props:{label:"Entry name",size:"sm",value:{$ref:"#/state/entryName"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}],Escape:[{operator:"call",target:{$ref:"#/state/cancelRename"},value:[{$ref:"event#/target/value"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"delete-entry"},$props:{label:"Delete entry",hint:"Delete entry",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeEntry"},value:[]}]}}]},{$description:"An island: `ui/schema-form.ts` draws the selected entry into this node.",tagName:"div",attributes:{part:"form-host"}}]}}}]}}}]};T("settings-contributed",N);function V(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:""}}function W(e){let o=e?.attributes?.part;return typeof o==="string"?o:""}function j(e,i,o){e.textContent="";let n=v({...V(),...i}),t=null,r=!1,a=R("settings-contributed",n,e,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let c=W(d);if(c==="form-host")o.formSlot(s);else if(c==="actions")o.actionsSlot(s)}}).then((s)=>{if(r)return s.dispose(),s.root;return t=s,s.root});return{attached:()=>{if(r)return!1;let s=t?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){r=!0,t?.dispose(),t=null},host:e,ready:a,update(s){n.actionsState=s.actionsState,n.editorRegion=s.editorRegion,n.editorState=s.editorState,n.entries=s.entries,n.entryName=s.entryName,n.layout=s.layout,n.newName=s.newName,n.newState=s.newState,n.title=s.title}}}var f=new Map,b=new Set,w=new Map;function TE(e,i){let o=D?.projectConfig?.[e],n=o&&typeof o==="object"&&!Array.isArray(o)?o:{};if(!Object.hasOwn(n,i))return Object.keys(n);return f.set(e,i),null}var x=new Map;function I(e,i){let o={},n=[];for(let t of i){let r=t.indexOf(": "),a=r===-1?"":t.slice(0,r),s=r===-1?t:t.slice(r+2);if(a===e){n.push(s);continue}if(!a.startsWith(`${e}/`))continue;let[l]=a.slice(e.length+1).split("/");if(l&&o[l]===void 0)o[l]=s}return{fields:o,section:n}}async function k(e,i){let o=D.projectConfig;if(!(await Sd()).ok)return;let t=[];try{t=await dd(o)}catch(r){S.warn(`Could not validate project.json — ${te(r)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}x.set(e,I(e,t).fields),i()}function E(e,i){for(let[o,n]of Object.entries(i))if(n===void 0)delete e[o];else e[o]=n}function H(e){return e.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function J(e,i){if(!e)return{};let o=(n)=>{if(typeof n==="string")return n.replaceAll("${key}",i);if(Array.isArray(n))return n.map((t)=>o(t));if(n&&typeof n==="object"){let t={};for(let[r,a]of Object.entries(n))t[r]=o(a);return t}return n};return o(e)}function M(e,i,o=null){let n=p();return{fieldKeyPrefix:`$settings.${e}`,resolvePointer:(t,r)=>Eu(t,{projectConfig:D?.projectConfig??{},...r!==void 0&&{scope:r},...i.formats!==void 0&&{formats:i.formats}}),...typeof n.setSecrets==="function"?{commitSecret:async(t,r)=>{let a=IE(e,o,t);return await n.setSecrets({set:{[a]:r}}),a}}:{}}}function h(e){let i=D?.projectConfig;if(!i)return null;let o=i[e];if(o&&typeof o==="object"&&!Array.isArray(o))return o;let n={};return i[e]=n,n}var A=new WeakMap;function m(e){x1(e.container,e.contribution,e.opts)}function O(e,i){e.echo=i,m(e)}function K(e){let{container:i,contribution:o,opts:n}=e,t=o.key,r=o.title??t,a=n.actions?"slot":"none",s=Ab(i),l=xi(s,"editor");if((o.settings.layout??"form")!=="map")return{actionsState:a,editorRegion:l,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:r};let d=h(t)??{},c=f.get(t)??null,g=c===null?void 0:d[c],y=c!==null&&g!==void 0&&g!==null&&typeof g==="object";return{actionsState:a,editorRegion:l,editorState:y?"editing":"empty",entries:Object.keys(d).map((u)=>({key:u,region:xi(s,`entry:${u}`),selected:u===c})),entryName:e.echo??(y?c:""),layout:"map",newName:w.get(t)??"",newState:b.has(t)?"open":"closed",title:r}}function L(e){let i=e.formHost;if(!i)return;let{contribution:o,opts:n}=e,t=o.key,r=o.settings.entry?.ui,a=()=>m(e),s=(u)=>{if(u.parentNode!==i)i.replaceChildren(u)};if((o.settings.layout??"form")!=="map"){let u=`/${t}`;s(fd(`section:${t}`,o.entrySchema,h(t)??{},{context:M(t,n,null),errors:x.get(u)??{},onChange:(P)=>{let C=h(t);if(!C)return;E(C,P),a(),k(u,a)},rerender:a,...r!==void 0&&{ui:r}}));return}let l=h(t)??{},d=f.get(t)??null,c=d===null?void 0:l[d];if(d===null||!c||typeof c!=="object"){i.replaceChildren();return}let g=c,y=`/${t}/${d}`;s(fd(`section:${t}:${d}`,o.entrySchema,g,{context:M(t,n,d),errors:x.get(y)??{},onChange:(u)=>{E(g,u),a(),k(y,a)},rerender:a,...r!==void 0&&{ui:r}}))}function F(e){let i=e.actionsHost,{actions:o}=e.opts;if(!i)return;if(!o){i.replaceChildren();return}let n=e.contribution.key,t=(e.contribution.settings.layout??"form")==="map"?f.get(n)??null:null;o(i,{rerender:()=>m(e),sectionKey:n,selected:t})}function q(e){let i=(t)=>{e.echo=null,m(e),k(t,()=>m(e))},o=()=>{e.echo=null,m(e)},n=()=>e.contribution.key;return{cancelNew(){b.delete(n()),w.delete(n()),m(e)},cancelRename(t){O(e,t),o()},createNew(){let t=n(),r=H(w.get(t)??""),a=h(t);if(!r||!a||a[r])return;a[r]=J(e.contribution.settings.entry?.newEntry,r),f.set(t,r),b.delete(t),w.delete(t),i(`/${t}`)},editNew(t){w.set(n(),t),m(e)},openNew(){b.add(n()),m(e)},removeEntry(){let t=n(),r=f.get(t)??null,a=h(t);if(!r||!a?.[r])return;delete a[r],f.set(t,null),i(`/${t}`)},renameEntry(t){O(e,t);let r=n(),a=f.get(r)??null,s=h(r),l=H(t.trim());if(!a||!s||!l||l===a||s[l]){o();return}let d={};for(let[c,g]of Object.entries(s))d[c===a?l:c]=g,delete s[c];Object.assign(s,d),f.set(r,l),i(`/${r}`)},select(t){f.set(n(),t),e.echo=null,m(e)}}}function x1(e,i,o={}){let n=A.get(e);if(n)n.contribution=i,n.opts=o;if(!n?.handle.attached()){n?.handle.dispose();let t={actionsHost:null,container:e,contribution:i,echo:null,formHost:null,handle:void 0,opts:o};A.set(e,t),t.handle=j(e,q(t),{actionsSlot:(r)=>{t.actionsHost=r,F(t)},formSlot:(r)=>{t.formHost=r,L(t)}}),n=t}n.handle.update(K(n)),F(n),L(n)}
|
|
2
|
-
export{
|
|
1
|
+
import{te}from"./studio-ery42sqr.js";import{p}from"./studio-y7jehjrp.js";import{v,k}from"./studio-fqq890ap.js";import{fd,Tu}from"./studio-xy3tv3az.js";import{Zi,T,R}from"./studio-spf2skgc.js";import{dd}from"./studio-01qza1n3.js";import{EE}from"./studio-56z7evx4.js";import{$b}from"./studio-ceb34dxj.js";import{kd}from"./studio-zpnk016a.js";import{D}from"./studio-tp642n5g.js";var N={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContributed",$description:'The generic settings section behind `$studio.settings` (specs/extensions.md §9.1), as a Jx document over the kit. One document serves both layouts an extension may declare: "form" is a single schema form over the whole section value, "map" is master-detail — the entry keys on the left, the selected entry\'s form on the right. The adapter (`surfaces/settings-contributed.ts`) hands in the title, the layout, the entry rows already marked as selected, and whatever the reader is part-way through typing; `settings/contributed-section.ts` decides what an entry may be named, what reaches `project.json`, and what the validator said about it. The schema form itself is an ISLAND: this document renders `form-host` and nothing inside it, because a form built from a JSON Schema is `ui/schema-form.ts`\'s surface rather than this one\'s — the section places the element that surface hands back. The actions row is the second island: `panels/data-grid.ts` contributes it, and that one is still lit over Spectrum.',tagName:"section",attributes:{part:"contributed"},style:{$description:"What `.settings-section-title`, `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state` and `.settings-inline-form` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This section was the LAST emitter of every one of them except `.settings-empty-state`, which `panels/settings-pane.ts` still writes when a project closes with the editor open — so those rules are dead in the stylesheet from here, and a central sweep removes them rather than this change, which owns no stylesheet. Two values could not come across. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so it would have taken its hard-coded fallback every time; the entry name is a kit textfield now and carries the kit's own type ramp. And `.entry-name-input`, `.settings-form-panel`, `.settings-section` and `.contributed-section` had no rule anywhere at all — they were four entries on `check-styles.ts`'s orphan ledger, which is the ledger's point.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="actions"]':{$description:"The host-contributed actions row — Test Connection, Push Schema, Open Data Grid on the data sections. `.data-section-actions` never had a rule anywhere, so the row was whatever the buttons stacked up to; it is a row with a gap under it now.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"12px"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on `--bg-panel` with `--border` showing through the gap, so nothing draws a rule of its own.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg-panel)",overflowY:"auto"},'& [part="entry"], & [part="new-open"]':{width:"100%"},'& [part="entry"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-panel)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{$description:"`min-width: 0` is the one line `.settings-editor-panel` did not have and needed: a flex child's floor is its content, and the schema form inside this one is a whole form rather than the short cards Data Shapes puts here — so a long pointer or a wide row pushed the column past the right edge of the pane instead of scrolling inside it.",flex:"1",padding:"16px",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="entry-name"]':{flex:"1",minWidth:"0",maxWidth:"220px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/actionsState"},cases:{slot:{$description:"An island: the host renders its own actions into this node and the document renders nothing inside it.",tagName:"div",attributes:{part:"actions"}}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layout"},cases:{form:{$description:"An island: `ui/schema-form.ts` draws the whole section value into this node.",tagName:"div",attributes:{part:"form-host"}},map:{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"entry","data-entry":"${$map.item.key}","data-jx-region":"${$map.item.region}"},$props:{label:"${$map.item.key}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.key}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"New Entry",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"New Entry"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"New entry name",placeholder:"entry-name",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"Select or create an entry"},editing:{tagName:"div",attributes:{part:"editor","data-jx-region":"${state.editorRegion}"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"jx-textfield",attributes:{part:"entry-name"},$props:{label:"Entry name",size:"sm",value:{$ref:"#/state/entryName"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}],Escape:[{operator:"call",target:{$ref:"#/state/cancelRename"},value:[{$ref:"event#/target/value"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"delete-entry"},$props:{label:"Delete entry",hint:"Delete entry",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeEntry"},value:[]}]}}]},{$description:"An island: `ui/schema-form.ts` draws the selected entry into this node.",tagName:"div",attributes:{part:"form-host"}}]}}}]}}}]};T("settings-contributed",N);function V(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:""}}function W(e){let o=e?.attributes?.part;return typeof o==="string"?o:""}function j(e,i,o){e.textContent="";let n=v({...V(),...i}),t=null,r=!1,a=R("settings-contributed",n,e,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let c=W(d);if(c==="form-host")o.formSlot(s);else if(c==="actions")o.actionsSlot(s)}}).then((s)=>{if(r)return s.dispose(),s.root;return t=s,s.root});return{attached:()=>{if(r)return!1;let s=t?.root;return s===void 0?!0:s instanceof HTMLElement&&e.contains(s)},dispose(){r=!0,t?.dispose(),t=null},host:e,ready:a,update(s){n.actionsState=s.actionsState,n.editorRegion=s.editorRegion,n.editorState=s.editorState,n.entries=s.entries,n.entryName=s.entryName,n.layout=s.layout,n.newName=s.newName,n.newState=s.newState,n.title=s.title}}}var f=new Map,b=new Set,w=new Map;function kE(e,i){let o=D?.projectConfig?.[e],n=o&&typeof o==="object"&&!Array.isArray(o)?o:{};if(!Object.hasOwn(n,i))return Object.keys(n);return f.set(e,i),null}var x=new Map;function I(e,i){let o={},n=[];for(let t of i){let r=t.indexOf(": "),a=r===-1?"":t.slice(0,r),s=r===-1?t:t.slice(r+2);if(a===e){n.push(s);continue}if(!a.startsWith(`${e}/`))continue;let[l]=a.slice(e.length+1).split("/");if(l&&o[l]===void 0)o[l]=s}return{fields:o,section:n}}async function S(e,i){let o=D.projectConfig;if(!(await kd()).ok)return;let t=[];try{t=await dd(o)}catch(r){k.warn(`Could not validate project.json — ${te(r)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}x.set(e,I(e,t).fields),i()}function E(e,i){for(let[o,n]of Object.entries(i))if(n===void 0)delete e[o];else e[o]=n}function H(e){return e.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function J(e,i){if(!e)return{};let o=(n)=>{if(typeof n==="string")return n.replaceAll("${key}",i);if(Array.isArray(n))return n.map((t)=>o(t));if(n&&typeof n==="object"){let t={};for(let[r,a]of Object.entries(n))t[r]=o(a);return t}return n};return o(e)}function M(e,i,o=null){let n=p();return{fieldKeyPrefix:`$settings.${e}`,resolvePointer:(t,r)=>Tu(t,{projectConfig:D?.projectConfig??{},...r!==void 0&&{scope:r},...i.formats!==void 0&&{formats:i.formats}}),...typeof n.setSecrets==="function"?{commitSecret:async(t,r)=>{let a=EE(e,o,t);return await n.setSecrets({set:{[a]:r}}),a}}:{}}}function h(e){let i=D?.projectConfig;if(!i)return null;let o=i[e];if(o&&typeof o==="object"&&!Array.isArray(o))return o;let n={};return i[e]=n,n}var A=new WeakMap;function m(e){w1(e.container,e.contribution,e.opts)}function O(e,i){e.echo=i,m(e)}function K(e){let{container:i,contribution:o,opts:n}=e,t=o.key,r=o.title??t,a=n.actions?"slot":"none",s=$b(i),l=Zi(s,"editor");if((o.settings.layout??"form")!=="map")return{actionsState:a,editorRegion:l,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:r};let d=h(t)??{},c=f.get(t)??null,g=c===null?void 0:d[c],y=c!==null&&g!==void 0&&g!==null&&typeof g==="object";return{actionsState:a,editorRegion:l,editorState:y?"editing":"empty",entries:Object.keys(d).map((u)=>({key:u,region:Zi(s,`entry:${u}`),selected:u===c})),entryName:e.echo??(y?c:""),layout:"map",newName:w.get(t)??"",newState:b.has(t)?"open":"closed",title:r}}function L(e){let i=e.formHost;if(!i)return;let{contribution:o,opts:n}=e,t=o.key,r=o.settings.entry?.ui,a=()=>m(e),s=(u)=>{if(u.parentNode!==i)i.replaceChildren(u)};if((o.settings.layout??"form")!=="map"){let u=`/${t}`;s(fd(`section:${t}`,o.entrySchema,h(t)??{},{context:M(t,n,null),errors:x.get(u)??{},onChange:(P)=>{let C=h(t);if(!C)return;E(C,P),a(),S(u,a)},rerender:a,...r!==void 0&&{ui:r}}));return}let l=h(t)??{},d=f.get(t)??null,c=d===null?void 0:l[d];if(d===null||!c||typeof c!=="object"){i.replaceChildren();return}let g=c,y=`/${t}/${d}`;s(fd(`section:${t}:${d}`,o.entrySchema,g,{context:M(t,n,d),errors:x.get(y)??{},onChange:(u)=>{E(g,u),a(),S(y,a)},rerender:a,...r!==void 0&&{ui:r}}))}function F(e){let i=e.actionsHost,{actions:o}=e.opts;if(!i)return;if(!o){i.replaceChildren();return}let n=e.contribution.key,t=(e.contribution.settings.layout??"form")==="map"?f.get(n)??null:null;o(i,{rerender:()=>m(e),sectionKey:n,selected:t})}function q(e){let i=(t)=>{e.echo=null,m(e),S(t,()=>m(e))},o=()=>{e.echo=null,m(e)},n=()=>e.contribution.key;return{cancelNew(){b.delete(n()),w.delete(n()),m(e)},cancelRename(t){O(e,t),o()},createNew(){let t=n(),r=H(w.get(t)??""),a=h(t);if(!r||!a||a[r])return;a[r]=J(e.contribution.settings.entry?.newEntry,r),f.set(t,r),b.delete(t),w.delete(t),i(`/${t}`)},editNew(t){w.set(n(),t),m(e)},openNew(){b.add(n()),m(e)},removeEntry(){let t=n(),r=f.get(t)??null,a=h(t);if(!r||!a?.[r])return;delete a[r],f.set(t,null),i(`/${t}`)},renameEntry(t){O(e,t);let r=n(),a=f.get(r)??null,s=h(r),l=H(t.trim());if(!a||!s||!l||l===a||s[l]){o();return}let d={};for(let[c,g]of Object.entries(s))d[c===a?l:c]=g,delete s[c];Object.assign(s,d),f.set(r,l),i(`/${r}`)},select(t){f.set(n(),t),e.echo=null,m(e)}}}function w1(e,i,o={}){let n=A.get(e);if(n)n.contribution=i,n.opts=o;if(!n?.handle.attached()){n?.handle.dispose();let t={actionsHost:null,container:e,contribution:i,echo:null,formHost:null,handle:void 0,opts:o};A.set(e,t),t.handle=j(e,q(t),{actionsSlot:(r)=>{t.actionsHost=r,F(t)},formSlot:(r)=>{t.formHost=r,L(t)}}),n=t}n.handle.update(K(n)),F(n),L(n)}
|
|
2
|
+
export{kE,w1};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=4A09A7801D85A2D264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-f195h2hq.js.map
|