@jxsuite/studio 5.6.0 → 6.0.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-bb2yq946.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-t0q184js.js +4 -0
- package/dist/chunks/{convert-to-repeater-x19jr6c7.js → convert-to-repeater-vqkt7s3s.js} +3 -3
- package/dist/chunks/editor-j5sq149q.js +4 -0
- package/dist/chunks/entry-commands-fxzgcc4k.js +4 -0
- package/dist/chunks/{extension-sections-y90sa0n4.js → extension-sections-8beq9ac3.js} +3 -3
- package/dist/chunks/file-ops-2n77759h.js +4 -0
- package/dist/chunks/files-fjy7zpxt.js +4 -0
- package/dist/chunks/format-host-wj3mf3n8.js +4 -0
- package/dist/chunks/fs-events-7kcgn4e9.js +4 -0
- package/dist/chunks/git-panel-7z2mpt2d.js +4 -0
- package/dist/chunks/{grid-view-d9mybhn0.js → grid-view-ca10def6.js} +10 -10
- package/dist/chunks/iframe-host-a0zjd6xp.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-p677nrh5.js +4 -0
- package/dist/chunks/layers-panel-y4w1dq90.js +4 -0
- package/dist/chunks/lit-html-cfn61dn7.js +4 -0
- package/dist/chunks/media-picker-xg7yjpz9.js +4 -0
- package/dist/chunks/menu-fpekzj6w.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-xtbfgg2r.js +4 -0
- package/dist/chunks/quick-search-d3a6m7j3.js +4 -0
- package/dist/chunks/references-99ws0b0m.js +4 -0
- package/dist/chunks/right-panel-31vbk5xp.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-1a99w39s.js +5 -0
- package/dist/chunks/studio-1q6amtph.js +5 -0
- package/dist/chunks/{studio-eegyf5vg.js → studio-1wvfxkyy.js} +4 -4
- package/dist/chunks/{studio-z47mm077.js → studio-3ck2a5c4.js} +6 -6
- package/dist/chunks/{studio-ymsjnvp9.js → studio-4fde4a0x.js} +4 -4
- package/dist/chunks/{studio-je15p5v8.js → studio-4jj9gme2.js} +5 -5
- package/dist/chunks/{studio-w8w9frjy.js → studio-4m50vh74.js} +12 -12
- package/dist/chunks/{studio-891t1tv9.js → studio-4r0sjtx8.js} +4 -4
- package/dist/chunks/{studio-6exg5z4x.js → studio-4xppwncr.js} +3 -3
- package/dist/chunks/{studio-011em5cf.js → studio-5d7wfmnp.js} +4 -4
- package/dist/chunks/{studio-zkkdbbvd.js → studio-5e9zsamh.js} +6 -6
- package/dist/chunks/{studio-pvj970st.js → studio-5gs9th4b.js} +4 -4
- package/dist/chunks/{studio-dtmdjmqb.js → studio-5vy2wfm5.js} +4 -4
- package/dist/chunks/{studio-654fxcr0.js → studio-7pgy3xaf.js} +4 -4
- package/dist/chunks/{studio-z1vdxq0e.js → studio-7qvs7v0m.js} +4 -4
- package/dist/chunks/studio-84rtc120.js +5 -0
- package/dist/chunks/{studio-ks0ecgjx.js → studio-8xcwewjq.js} +4 -4
- package/dist/chunks/{studio-sadckcpp.js → studio-aekhcdzw.js} +5 -5
- package/dist/chunks/{studio-mf41717j.js → studio-aje966s9.js} +4 -4
- package/dist/chunks/studio-aqmph6k4.js +5 -0
- package/dist/chunks/{studio-28pz4s1k.js → studio-bftp4n4b.js} +4 -4
- package/dist/chunks/{studio-tzs6njnb.js → studio-c6zdm25z.js} +7 -7
- package/dist/chunks/{studio-sgzss898.js → studio-capk0583.js} +7 -7
- package/dist/chunks/{studio-805fwp9k.js → studio-cbr9czkn.js} +4 -4
- package/dist/chunks/{studio-1pxvgx1t.js → studio-chdmwwzw.js} +4 -4
- package/dist/chunks/{studio-dknr8m7b.js → studio-cp1gbff9.js} +7 -7
- package/dist/chunks/{studio-ft8pfpp0.js → studio-cqmtbg2p.js} +4 -4
- package/dist/chunks/studio-e47215hh.js +5 -0
- package/dist/chunks/{studio-9n2j9nqk.js → studio-edbtvcd1.js} +4 -4
- package/dist/chunks/{studio-mm8x32gg.js → studio-evwgp1ym.js} +4 -4
- package/dist/chunks/{studio-02y9cb4h.js → studio-fbx6twps.js} +5 -5
- package/dist/chunks/{studio-0nm2skex.js → studio-fqq890ap.js} +3 -3
- package/dist/chunks/studio-fthwn4kf.js +5 -0
- package/dist/chunks/{studio-s85vah66.js → studio-g8dsj3d2.js} +5 -5
- package/dist/chunks/{studio-0c3fpdqj.js → studio-ge5fqjth.js} +5 -5
- package/dist/chunks/{studio-ebt49j3c.js → studio-gjknvzam.js} +5 -5
- 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-d007j0z3.js → studio-hnvnfbdv.js} +6 -6
- package/dist/chunks/{studio-b5rxwkj2.js → studio-mk00zd5d.js} +4 -4
- package/dist/chunks/{studio-36s6qjgq.js → studio-n78gjfy8.js} +4 -4
- package/dist/chunks/studio-nbxqcgvf.js +5 -0
- package/dist/chunks/{studio-y164brht.js → studio-pwqfmt4p.js} +4 -4
- package/dist/chunks/studio-qa73881a.js +5 -0
- package/dist/chunks/{studio-6zyt56ek.js → studio-r3kaka4d.js} +4 -4
- package/dist/chunks/{studio-njmg0e73.js → studio-rmn2dz59.js} +5 -5
- package/dist/chunks/{studio-wr0pq67n.js → studio-rr4xkv81.js} +4 -4
- package/dist/chunks/{studio-tj28pxa1.js → studio-semd1s8s.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-9tkaykt5.js → studio-tmeq6mjb.js} +4 -4
- package/dist/chunks/{studio-153mwkyq.js → studio-tp642n5g.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-x5g1xk77.js +5 -0
- package/dist/chunks/studio-x92tgnee.js +64 -0
- package/dist/chunks/{studio-4yztve2t.js → studio-xg1942as.js} +4 -4
- package/dist/chunks/{studio-k9pwvmz8.js → studio-xkfs0dp2.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-jsr14n1s.js → studio-zev8ssp1.js} +4 -4
- package/dist/chunks/{studio-r7yeeqc4.js → studio-ztvcxm3w.js} +4 -4
- package/dist/chunks/{tsMode-eq26t9gs.js → tsMode-k9s9fcag.js} +4 -4
- package/dist/chunks/workspace-5vmgsagj.js +4 -0
- package/dist/chunks/{ws-client-3gxqp06s.js → ws-client-0ja08haa.js} +3 -3
- package/dist/iframe-entry.js +3 -3
- package/dist/manifest.json +62 -62
- package/dist/studio.js +95 -95
- package/package.json +12 -12
- 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/src/ui/schema-form.ts +6 -2
- 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-b29h7g7s.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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,
|
|
2
|
-
export{
|
|
1
|
+
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,bu=(a,b,c)=>{var i=a!=null&&typeof a==="object";if(i){var f=b?w??=new WeakMap:x??=new WeakMap,d=f.get(a);if(d)return d}c=a!=null?s(t(a)):{};let g=b||!a||!a.__esModule||!q.call(a,"default")?n(c,"default",{value:a,enumerable:!0}):c;if(a&&typeof a==="object"||typeof a==="function"){for(let e of u(a))if(!q.call(g,e))n(g,e,{get:v.bind(a,e),enumerable:!0})}if(i)f.set(a,g);return g};var ae=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var y=(a)=>a;function z(a,b){this[a]=y.bind(null,b)}var $i=(a,b)=>{for(var c in b)n(a,c,{get:b[c],enumerable:!0,configurable:!0,set:z.bind(b,c)})};var r,o,m,me=(a,b)=>{for(var[c,i,f]of r||[])for(var d=[a],g=globalThis,e=g.document,p,k,l,h,j;k=d.pop();)if(!o[k]&&(l=i[k])){o[k]=1;for(h=1;h<l.length;h++)d.push(f[l[h]]);if(!b&&k!==a&&(p=e&&e.head)){if(m===void 0)m=(h=e.querySelector("meta[property=csp-nonce]"))&&(h.nonce||h.getAttribute("nonce"))||"";if(j=e.createElement("link"),j.rel="modulepreload",j.crossOrigin="",m)j.nonce=m;j.href=new g.URL(l[0],c),p.appendChild(j)}}},d$=(a,b,c,i)=>{for(var f={},d=0;d<b.length;d++)f[b[d]]=c[d];(r||=[]).push([a,f,b]),o||={},me(b[i],1)};
|
|
2
|
+
export{bu,ae,$i,me,d$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=3B2A35D1EF97702D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-0bbxhhce.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{_t,Lr,qr,Hu}from"./studio-semd1s8s.js";function Rf(){return Lr(_t.cfToken)}function $_(t){qr(_t.cfToken,t||"")}function D_(){return Lr(_t.cfAccountId)}function h$(t){qr(_t.cfAccountId,t||"")}function A_(){Hu([_t.cfToken,_t.cfAccountId])}
|
|
2
|
+
export{Rf,$_,D_,h$,A_};
|
|
3
|
+
|
|
4
|
+
//# debugId=35E77CC9D5BD485E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-1a99w39s.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function f(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function p(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function SI(t,n){let e=u(n);for(let s of p(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let i=e.slice(r.length+1),{filter:o}=s;if(o&&!o(i))return null;let l=i.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${f(s.urlPrefix)}/${l}`}return null}function h(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of p(t,"urlPrefix")){let i=f(r.urlPrefix);if(!s.startsWith(`${i}/`))continue;let l=s.slice(i.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=r;if(c&&!c(l.join("/")))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var A=String.raw`"'\s<>()\\`;var Np="public";var EI=["mounts","public"];function Nv(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function Sk(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function di(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function TI(t){let n=di(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function Ek(t,n){let s=(t===""||t==="."?[]:di(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function d(t,n,e){let{path:s}=Nv(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let i=r.replace(/^\/+/,"");if(i===""||i.split("/").some((l)=>l==="."||l===".."))return[];let o=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))o.push(di(c));continue}o.push(l==="root"?i:`${Np}/${i}`)}return[...new Set(o)]}function LI(t,n,e,s){let{path:r}=Nv(t);if(r==="")return null;if(Sk(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let i;try{i=decodeURIComponent(r)}catch{return null}let o=Ek(n,i);if(o===null||o===""||o===di(n))return null;return o}function Ov(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function II(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let i=e;while(e<t.length&&t[e]!==",")e+=1;let o=t.slice(i,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:o,url:r})}return n}function RI(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
|
|
2
|
+
export{SI,Np,EI,Nv,Sk,di,TI,Ek,LI,Ov,II,RI};
|
|
3
|
+
|
|
4
|
+
//# debugId=A0086E366785683764756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-1q6amtph.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function v(s,n={}){let t=n.baseMs??1000,o=n.maxMs??30000,i=n.random??Math.random,e=Math.min(o,t*2**Math.max(0,s));return e/2+i()*e/2}function
|
|
2
|
-
export{
|
|
1
|
+
function v(s,n={}){let t=n.baseMs??1000,o=n.maxMs??30000,i=n.random??Math.random,e=Math.min(o,t*2**Math.max(0,s));return e/2+i()*e/2}function zg(s,n={}){let t=n.win??(typeof window>"u"?void 0:window),o=n.doc??(typeof document>"u"?void 0:document),i=0,e=null,r=!1,a=()=>{if(e=null,!r)s()},c=()=>{if(r||e===null)return;clearTimeout(e),i=0,a()},u=(d)=>{if(d.persisted)c()},l=()=>{if(o?.visibilityState==="visible")c()};return t?.addEventListener("online",c),t?.addEventListener("pageshow",u),o?.addEventListener("visibilitychange",l),{dispose(){if(r)return;if(r=!0,e!==null)clearTimeout(e),e=null;t?.removeEventListener("online",c),t?.removeEventListener("pageshow",u),o?.removeEventListener("visibilitychange",l)},opened(){i=0},scheduleRetry(){if(r||e!==null)return;let d=v(i,n);i+=1,e=setTimeout(a,d)},wake:c}}
|
|
2
|
+
export{zg};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=34607FEE061EF8D964756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-1wvfxkyy.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{v}from"./studio-
|
|
1
|
+
import{v}from"./studio-fqq890ap.js";import{$o,bL,ot,Jo,Se,He,qu,m,No,ci}from"./studio-x5g1xk77.js";import{p}from"./studio-y7jehjrp.js";import{qt,Zt}from"./studio-cqmtbg2p.js";import{T,R,bs,Ct}from"./studio-7qvs7v0m.js";import{te}from"./studio-ery42sqr.js";import{Ir}from"./studio-xkfs0dp2.js";import{Ps,mc}from"./studio-mk00zd5d.js";import{Fw,R1,$1}from"./studio-xg1942as.js";import{Ld,Gi}from"./studio-e47215hh.js";import{ds,Kf,vb,yb,Iu,Io,Ru}from"./studio-qa73881a.js";import{D}from"./studio-tp642n5g.js";var I={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridOpen",$description:"Every grid-able source a project has, grouped by where it comes from: the project's own pages and content collections first, then each connection's tables. It is the ISLAND of a confirm dialog rather than a dialog of its own — `ui/layers.ts`'s dialog owns the headline, the cancel button, modality and focus, and this document is only the list — because a second answer to \"what is a dialog\" is a defect (studio-ui-guidelines.md §12.5). Group headings are why it is not the kit menu: a menu row can carry a divider above it and cannot carry a name for the run it opens.",tagName:"div",attributes:{part:"sources"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"1px",marginTop:"var(--jx-space-1)"},'& [part="source"]':{textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-2) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="source"]:hover':{background:"var(--bg-hover)"},'& [part="source"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="group-empty"]':{margin:"0",padding:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{$description:"One origin of grid-able sources. A connection with no tables says why it has none instead of drawing an empty box — an author who has not pushed a schema yet is exactly the reader who needs the sentence.",tagName:"section",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"rows"},$switch:{$ref:"$map/item/state"},cases:{listed:{tagName:"div",attributes:{part:"rows-list",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"source",type:"button","data-source":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.label}"}}]},empty:{tagName:"p",attributes:{part:"group-empty"},textContent:"${$map.item.emptyMessage}"}}}]}}]};T("grid-open",I);function j(e,r,t){let n=v({groups:r,open:t}),o=null,i=!1,s=R("grid-open",n,e).then((l)=>{if(i)return l.dispose(),l.root;return o=l,l.root});return{dispose(){i=!0,o?.dispose(),o=null},ready:s}}function S(){try{return p()}catch{return null}}function Rw(){return typeof S()?.dataRows==="function"}async function E(){let e=S();if(typeof e?.dataConnections!=="function")return null;return e.dataConnections()}async function SE(e){let r=S();if(typeof r?.dataConnectionTest!=="function")return{error:"Connection tests are not supported by this backend",ok:!1};try{return await r.dataConnectionTest(e)}catch(t){return{error:t instanceof Error?t.message:String(t),ok:!1}}}async function _1(e){let r=S();if(typeof r?.dataPush!=="function")return{applied:!1,errors:["Schema push is not supported by this backend"],plan:[]};try{return await r.dataPush(e)}catch(t){return{applied:!1,errors:[t instanceof Error?t.message:String(t)],plan:[]}}}function C(e){let t=S()?.[e];if(t===void 0||t===null)throw Error(`The ${String(e)} surface is not supported by this backend`);return t}function x(e){return C("dataRows")(e)}function M(e){return C("dataInsertRow")(e)}function A(e){return C("dataUpdateRow")(e)}function K(e){return C("dataDeleteRow")(e)}function EE(e,r,t){let n=(s)=>s.replaceAll(/([a-z0-9])([A-Z])/g,"$1_$2").replaceAll(/[^A-Za-z0-9]+/g,"_").replaceAll(/^_+|_+$/g,"").toUpperCase(),i=[r??e,t.replace(/Env$/,"")].map((s)=>n(s)).filter(Boolean).join("_")||"SECRET";return/^\d/.test(i)?`JX_${i}`:i}function W(e){let r=[],t=[],n="",o=!1,i=!1,s=()=>{t.push(n),n="",i=!1},l=()=>{if(s(),t.length===1&&t[0]===""){t=[];return}r.push(t),t=[]};for(let a=0;a<e.length;a++){let c=e[a];if(o){if(c==='"')if(e[a+1]==='"')n+='"',a+=1;else o=!1;else n+=c;continue}if(c==='"'&&!i)o=!0,i=!0;else if(c==='"')n+=c;else if(c===",")s();else if(c===`
|
|
2
2
|
`)l();else if(c==="\r"){if(e[a+1]===`
|
|
3
|
-
`)a+=1;l()}else n+=c,i=!0}if(n!==""||t.length>0)l();return r}function
|
|
3
|
+
`)a+=1;l()}else n+=c,i=!0}if(n!==""||t.length>0)l();return r}function $w(e){let r=(e.match(/\r\n/g)??[]).length,t=(e.match(/(?<!\r)\n/g)??[]).length,n=r>t?`\r
|
|
4
4
|
`:`
|
|
5
5
|
`,o=e.endsWith(`
|
|
6
|
-
`),i=W(e),s=i[0]??[],l=i.slice(1),a=Math.max(s.length,...l.map((c)=>c.length),0);while(s.length<a)s.push("");for(let c of l)while(c.length<a)c.push("");return{eol:n,headers:s,rows:l,trailingNewline:o}}function U(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function k(e){return[e.headers,...e.rows].map((t)=>t.map((n)=>U(n)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}var Q=["id","sku","slug","Slug"];function q(e){let r=new Set;return e.map((t,n)=>{let o=t.trim()===""?`column${n+1}`:t;if(r.has(o))o=`${o}__${n+1}`;return r.add(o),o})}function J(e,r){for(let t of Q){let n=e.indexOf(t);if(n===-1)continue;let o=r.rows.map((i)=>i[n]??"");if(o.every((i)=>i!=="")&&new Set(o).size===o.length)return t}return null}function O(e,r){let t=Rw(e),n=q(t.headers),o=J(n,t),i=o?n.indexOf(o):-1,s=t.rows.map((d,u)=>i===-1?String(u):d[i]),l=new Map(s.map((d,u)=>[d,u])),a=qu(r,D?.projectConfig),c=a?.schema?.properties??{},y=t.rows.slice(0,50).map((d)=>{let u={};for(let[h,w]of n.entries())u[w]=d[h]??"";return u}),f=new Map(xb(y).map((d)=>[d.field,d])),m=new Map(wb(a?.schema,{idField:o??void 0}).map((d)=>[d.field,d]));return{columns:n.map((d,u)=>{let w=(d in c?m.get(d):void 0)??f.get(d)??{editable:!0,field:d,kind:"string",title:t.headers[u]||d};return{...w,pk:d===o,title:t.headers[u]?.trim()||w.title}}),doc:t,fields:n,keys:s,keyToIndex:l,loadText:e}}function X(e,r){let t={},n=e.doc.rows[r]??[];for(let[o,i]of e.fields.entries()){let s=e.columns[o],l=n[o]??"";t[i]=s.kind==="string"||s.kind==="text"||s.kind==="readonly"?l:Lu(l,s)}return t}function _(e,r){let t=e.doc.rows.map((i)=>[...i]),n=(i)=>e.fields.indexOf(i);for(let i of r.cells){let s=e.keyToIndex.get(i.rowKey),l=n(i.field);if(s===void 0||l===-1)continue;t[s][l]=Ro(i.value)}for(let i of r.inserts){let s=e.fields.map((l)=>Ro(i.cells[l]??null));t.push(s)}let o=r.deletes.map((i)=>e.keyToIndex.get(i.rowKey)).filter((i)=>i!==void 0).toSorted((i,s)=>s-i);for(let i of o)t.splice(i,1);return{...e.doc,rows:t}}function N(e,r){return{cells:e.cells.map((t)=>({field:t.field,rowKey:t.rowKey,...r})),deletes:e.deletes.map((t)=>({rowKey:t.rowKey,...r})),inserts:e.inserts.map((t)=>({error:r.error,ok:r.ok,tempKey:t.tempKey}))}}function $w(e){let r=null,t=(n=!1)=>{if(!n&&r)return r;return r=p().readFile(e).then((o)=>O(o,e)),r};return{backingPaths:()=>new Map([[e,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return(await t()).columns},async commit(n){let o=await t(),i=p(),s=null;try{s=await i.readFile(e)}catch{s=null}if(s!==o.loadText&&!mc(e))return N(n,{error:"File changed on disk — refresh to reload",ok:!1,stale:!0});let l=_(o,n),a=k(l);return Ms(e),await i.writeFile(e,a),r=Promise.resolve(O(a,e)),N(n,{ok:!0})},id:e,label:e.split("/").pop()??e,async refresh(){await t(!0)},async rows(){let n=await t(),o=n.doc.rows.map((i,s)=>({cells:X(n,s),key:n.keys[s]}));return{rows:o,total:o.length}},async serializeForSource(n){let o=await t();return k(_(o,n))}}}var Z=50;function ee(e){let r=e.toLowerCase();if(/(int|real|floa|doub|num|dec)/.test(r))return"number";if(r.includes("bool"))return"boolean";if(/(timestamp|datetime|date)/.test(r))return"date";return"string"}function re(e){return!e.pk&&e.name!=="created_at"&&e.name!=="updated_at"}function ne(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;return JSON.stringify(e)}function B(e,r){let t=[],n="id",o=new Map,i=(a)=>{if(a.length>0)t=a,n=a.find((c)=>c.pk)?.name??"id"},s=(a)=>({table:r,...e?{connection:e}:{},limit:a?.limit??Z,offset:a?.offset??0,...a?.orderBy?{dir:a.dir??"asc",orderBy:a.orderBy}:{}}),l=(a,c)=>{let y=a[n];if(typeof y==="string"||typeof y==="number")return o.set(String(y),y),String(y);return`row-${c}`};return{capabilities:{delete:!0,insert:!0,remotePaging:!0,remoteSort:!0},async columns(){if(t.length===0){let a=await x(s({limit:1,offset:0}));i(a.columns)}return t.map((a)=>{let c=re(a)?ee(a.type):"readonly";return{editable:c!=="readonly",field:a.name,kind:c,pk:a.pk===!0,title:a.name,widthHint:a.pk?80:void 0}})},async commit(a){let c={cells:[],deletes:[],inserts:[]},y=new Map;for(let f of a.cells){let m=y.get(f.rowKey)??[];m.push({field:f.field,value:f.value}),y.set(f.rowKey,m)}for(let[f,m]of y){let b=o.get(f),d=(u,h)=>{for(let w of m)c.cells.push({error:h,field:w.field,ok:u,rowKey:f})};if(b===void 0){d(!1,"Row has no primary key — refresh the grid");continue}try{let u={};for(let h of m)u[h.field]=h.value;await A({pk:b,set:u,table:r,...e?{connection:e}:{}}),d(!0)}catch(u){d(!1,u instanceof Error?u.message:String(u))}}for(let f of a.inserts)try{let m={};for(let[h,w]of Object.entries(f.cells))if(w!==null)m[h]=w;let{row:b}=await M({table:r,values:m,...e?{connection:e}:{}}),d=b[n],u=typeof d==="string"||typeof d==="number"?String(d):void 0;if(u!==void 0&&(typeof d==="string"||typeof d==="number"))o.set(u,d);c.inserts.push({newKey:u,ok:!0,tempKey:f.tempKey})}catch(m){c.inserts.push({error:m instanceof Error?m.message:String(m),ok:!1,tempKey:f.tempKey})}for(let f of a.deletes){let m=o.get(f.rowKey);if(m===void 0){c.deletes.push({error:"Row has no primary key — refresh the grid",ok:!1,rowKey:f.rowKey});continue}try{await K({pk:m,table:r,...e?{connection:e}:{}}),c.deletes.push({ok:!0,rowKey:f.rowKey})}catch(b){c.deletes.push({error:b instanceof Error?b.message:String(b),ok:!1,rowKey:f.rowKey})}}return c},id:ds({connection:e??"default",kind:"data",table:r}),label:r,async refresh(){t=[],o.clear()},async rows(a){let c=await x(s(a));return i(c.columns),{rows:c.rows.map((f,m)=>{let b=l(f,m),d={};for(let u of t)d[u.name]=ne(f[u.name]);return{cells:d,key:b}}),total:c.total}}}}var mb=[{key:"all",label:"All"},{dir:"pages",key:"pages",label:"Pages"},{dir:"layouts",key:"layouts",label:"Layouts"},{dir:"components",key:"components",label:"Components"},{dir:"content",key:"content",label:"Content"},{dir:"public",key:"media",label:"Media"}],S1=mb.map((e)=>e.key);function Dw(e){return mb.find((r)=>r.key===e)}function k1(e){return Dw(e)?.dir}function oe(e,r){if(r&&Ld.has(r))return"Media";if(e.startsWith("pages"))return"Pages";if(e.startsWith("layouts"))return"Layouts";if(e.startsWith("components"))return"Components";if(e.startsWith("content"))return"Content";if(e.startsWith("public"))return"Media";if(e.startsWith("data"))return"Content";if(e.startsWith("styles"))return"Components";return"Other"}function ie(e){let r=D?.projectConfig?.content??{};for(let[t,n]of Object.entries(r)){if(!n.source)continue;let o=n.source.replace(/^\.\//,"").replace(/\/$/,"");if(e.startsWith(`${o}/`)||e===o)return t.charAt(0).toUpperCase()+t.slice(1)}return null}var se=new Set(["node_modules",".git",".jx","dist","build",".cache"]);async function H(e,r,t,n,o){let i;try{i=await Ir(()=>r.listDirectory(e))}catch(l){n.push({dir:e,error:te(l)});return}let s=[];for(let l of i){if(l.type==="directory"){if(!se.has(l.name))s.push(l.path);continue}let a=Gi(l.name),c=oe(l.path,a);t.push({category:c,ext:a,locale:kL(l.path,o)??void 0,modified:l.modified,name:l.name,path:l.path,size:l.size,type:c==="Content"?ie(l.path)??a??"file":a||"file"})}await Promise.all(s.map((l)=>H(l,r,t,n,o)))}async function Gf(e,r){let t=[],n=[],{i18n:o}=Do(D?.projectConfig??{});return await Promise.all(e.map((i)=>H(i,r,t,n,o))),t.sort((i,s)=>i.path.localeCompare(s.path)),{failures:n,files:t}}function RE(e,r){let t=e,n=Dw(r.category);if(n&&n.key!=="all")t=t.filter((s)=>s.category===n.label);let o=r.query.trim().toLowerCase();if(o)t=t.filter((s)=>s.name.toLowerCase().includes(o)||s.path.toLowerCase().includes(o));let i=r.locale?.trim();if(i)t=t.filter((s)=>s.locale===i);return t}var Kf=["table","cards","media","calendar","board"],Aw={board:"Board",calendar:"Calendar",cards:"Cards",media:"Media",table:"Table"};var $E=new Set(["cards","media"]),ae=/^(\d{4}-\d{2}-\d{2})/;function le(e){let r=ae.exec(e.name);if(r)return r[1];if(e.modified){let t=new Date(e.modified);if(!Number.isNaN(t.getTime()))return t.toISOString().slice(0,10)}return null}function E1(){return Do(D?.projectConfig??{}).i18n?.locales??[]}function DE(e){let r=new Set;for(let t of e)if(t.locale)r.add(t.locale);return E1().filter((t)=>r.has(t))}function AE(e){let r=new Map,t=[];for(let o of e){let i=le(o);if(i===null){t.push(o);continue}let s=r.get(i);if(s)s.push(o);else r.set(i,[o])}return{days:[...r.entries()].map(([o,i])=>({date:o,files:i})).toSorted((o,i)=>i.date.localeCompare(o.date)),undated:t}}function NE(e){let r=new Map;for(let n of e){let o=r.get(n.category);if(o)o.push(n);else r.set(n.category,[n])}let t=mb.map((n)=>n.label);return[...r.entries()].map(([n,o])=>({files:o,group:n})).toSorted((n,o)=>{let i=t.indexOf(n.group),s=t.indexOf(o.group);if(i===s)return n.group.localeCompare(o.group);return(i===-1?t.length:i)-(s===-1?t.length:s)})}var G="The Library lists files; it does not edit them. Rename, duplicate or delete from the file's context menu, or open the file to edit it.";function Nw(){return[{editable:!1,field:"name",kind:"string",pk:!0,title:"Name",widthHint:260},{editable:!1,field:"category",kind:"string",title:"Category",widthHint:120},{editable:!1,field:"locale",kind:"string",title:"Locale",widthHint:90},{editable:!1,field:"type",kind:"string",title:"Type",widthHint:120},{editable:!1,field:"size",kind:"number",title:"Size",widthHint:90},{editable:!1,field:"modified",kind:"date",title:"Modified",widthHint:160},{editable:!1,field:"path",kind:"readonly",title:"Path",widthHint:320}]}function ce(e){return{cells:{category:e.category,locale:e.locale??null,modified:e.modified??null,name:e.name,path:e.path,size:e.size??null,type:e.type},key:e.path}}function L(){return ds({kind:"library"})}function OE(e){let r=null,t=null,n=e??(()=>D?.projectDirs??[]);async function o(){if(r)return r;return t??=Gf(n(),p()).then((i)=>(r=i,t=null,i)),t}return{capabilities:{delete:!1,insert:!1,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(Nw()),commit(i){return Promise.resolve({cells:i.cells.map((s)=>({error:G,field:s.field,ok:!1,rowKey:s.rowKey})),deletes:i.deletes.map((s)=>({error:G,ok:!1,rowKey:s.rowKey})),inserts:i.inserts.map((s)=>({error:G,ok:!1,tempKey:s.tempKey}))})},failures:()=>r?.failures??[],files:()=>r?.files??[],id:L(),label:"Library",async refresh(){r=null,t=null,await o()},async rows(){let i=await o();return{rows:i.files.map((s)=>ce(s)),total:i.files.length}},scanned:()=>r!==null}}var P={children:[],tagName:"div"};async function ME(e,r={}){let t=g.tabs.get(e);if(t)return ci(e,{focus:r.focus!==!1}),t;try{await qt()}catch{}let n=$w(e),o=Oo({capabilities:{modes:["grid","source"]},document:structuredClone(P),documentPath:e,id:e,sourceFormat:Zt(e)?.name??null,...r.paneId!==void 0&&{paneId:r.paneId},...r.preview===!0&&{preview:!0},...r.focus===!1&&{focus:!1}});return Iu(o,n).load(),o}function F(e){let r=Oo({capabilities:{modes:["grid"]},document:structuredClone(P),documentPath:null,id:e.id});return Iu(r,e).load(),r}function z(e){let r=ds({kind:"collection",name:e}),t=g.tabs.get(r);if(t)return ci(r),t;return F($1(e))}function PE(){let e=L(),r=g.tabs.get(e);if(r)return ci(e),r;return Oo({capabilities:{modes:["manage"]},document:structuredClone(P),documentPath:null,id:e})}function T1(){let e=ds({kind:"pages"}),r=g.tabs.get(e);if(r)return ci(e),r;return F(D1())}function Y(e,r){let t=ds({connection:e??"default",kind:"data",table:r}),n=g.tabs.get(t);if(n)return ci(t),n;return F(B(e,r))}function de(e){let r=Yf(e);if(r?.kind==="pages")T1();else if(r?.kind==="collection")z(r.name);else if(r?.kind==="data")Y(r.connection,r.table)}function ue(e,r){return[{emptyMessage:"",key:"project",rows:[{id:ds({kind:"pages"}),label:"Pages"},...e.map(({name:t})=>({id:ds({kind:"collection",name:t}),label:`Collection: ${t}`}))],state:"listed",title:"Project"},...r.map((t)=>({emptyMessage:"No tables — push a schema first.",key:`data:${t.name}`,rows:t.tables.map((n)=>({id:ds({connection:t.name,kind:"data",table:n}),label:n})),state:t.tables.length===0?"empty":"listed",title:`Data · ${t.name}`}))]}async function FE(){let e=Pw(),r=[];if(Iw())r=(await E().catch(()=>null))?.connections??[];let t=null,n=bs({cancelLabel:"Cancel",confirmLabel:"",headline:"Open Grid",island:(o)=>{t=j(o,ue(e,r),(i)=>{n.close(),de(i)})},layer:Ct("dialog"),onCancel:()=>n.close(),onClosed:()=>{t?.dispose(),t=null},onConfirm:()=>{},region:"grid/open"});n.ready}function pe(){return[{args:ke({name:je("The content collection's name, as project.json declares it.")}),category:"Project",id:"collection.editInGrid",level:"project",menus:["context/file","palette"],group:"5_data",requires:"a project that declares content collections",when:(e)=>e.project.open,run:(e,r)=>{let t=ot("collection.editInGrid",r,"name"),n=Pw().map((o)=>o.name);if(!n.includes(t))throw RangeError(`command "collection.editInGrid" argument "name": "${t}" is not a content `+"collection this project declares — it declares: "+`${n.length>0?n.join(", "):"none"}`);z(t)},title:"Edit Collection in Grid"},{args:{additionalProperties:!1,properties:{connection:je('The connection name from project.json. Defaults to "default".'),table:je("The table to open.")},required:["table"],type:"object"},category:"Project",id:"data.openGrid",level:"project",menus:["palette"],group:"5_data",requires:"a platform that serves the data routes",when:(e)=>e.project.open,enablement:(e)=>e.capability.dataRows,run:(e,r)=>{let t=ot("data.openGrid",r,"table");Y(Zo("data.openGrid",r,"connection"),t)},title:"Open Data Grid"}]}function jE(e){e.registerAll(pe())}
|
|
7
|
-
export{
|
|
6
|
+
`),i=W(e),s=i[0]??[],l=i.slice(1),a=Math.max(s.length,...l.map((c)=>c.length),0);while(s.length<a)s.push("");for(let c of l)while(c.length<a)c.push("");return{eol:n,headers:s,rows:l,trailingNewline:o}}function U(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function k(e){return[e.headers,...e.rows].map((t)=>t.map((n)=>U(n)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}var Q=["id","sku","slug","Slug"];function q(e){let r=new Set;return e.map((t,n)=>{let o=t.trim()===""?`column${n+1}`:t;if(r.has(o))o=`${o}__${n+1}`;return r.add(o),o})}function J(e,r){for(let t of Q){let n=e.indexOf(t);if(n===-1)continue;let o=r.rows.map((i)=>i[n]??"");if(o.every((i)=>i!=="")&&new Set(o).size===o.length)return t}return null}function O(e,r){let t=$w(e),n=q(t.headers),o=J(n,t),i=o?n.indexOf(o):-1,s=t.rows.map((d,u)=>i===-1?String(u):d[i]),l=new Map(s.map((d,u)=>[d,u])),a=qu(r,D?.projectConfig),c=a?.schema?.properties??{},y=t.rows.slice(0,50).map((d)=>{let u={};for(let[h,w]of n.entries())u[w]=d[h]??"";return u}),f=new Map(yb(y).map((d)=>[d.field,d])),g=new Map(vb(a?.schema,{idField:o??void 0}).map((d)=>[d.field,d]));return{columns:n.map((d,u)=>{let w=(d in c?g.get(d):void 0)??f.get(d)??{editable:!0,field:d,kind:"string",title:t.headers[u]||d};return{...w,pk:d===o,title:t.headers[u]?.trim()||w.title}}),doc:t,fields:n,keys:s,keyToIndex:l,loadText:e}}function X(e,r){let t={},n=e.doc.rows[r]??[];for(let[o,i]of e.fields.entries()){let s=e.columns[o],l=n[o]??"";t[i]=s.kind==="string"||s.kind==="text"||s.kind==="readonly"?l:Iu(l,s)}return t}function _(e,r){let t=e.doc.rows.map((i)=>[...i]),n=(i)=>e.fields.indexOf(i);for(let i of r.cells){let s=e.keyToIndex.get(i.rowKey),l=n(i.field);if(s===void 0||l===-1)continue;t[s][l]=Io(i.value)}for(let i of r.inserts){let s=e.fields.map((l)=>Io(i.cells[l]??null));t.push(s)}let o=r.deletes.map((i)=>e.keyToIndex.get(i.rowKey)).filter((i)=>i!==void 0).toSorted((i,s)=>s-i);for(let i of o)t.splice(i,1);return{...e.doc,rows:t}}function N(e,r){return{cells:e.cells.map((t)=>({field:t.field,rowKey:t.rowKey,...r})),deletes:e.deletes.map((t)=>({rowKey:t.rowKey,...r})),inserts:e.inserts.map((t)=>({error:r.error,ok:r.ok,tempKey:t.tempKey}))}}function Dw(e){let r=null,t=(n=!1)=>{if(!n&&r)return r;return r=p().readFile(e).then((o)=>O(o,e)),r};return{backingPaths:()=>new Map([[e,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return(await t()).columns},async commit(n){let o=await t(),i=p(),s=null;try{s=await i.readFile(e)}catch{s=null}if(s!==o.loadText&&!mc(e))return N(n,{error:"File changed on disk — refresh to reload",ok:!1,stale:!0});let l=_(o,n),a=k(l);return Ps(e),await i.writeFile(e,a),r=Promise.resolve(O(a,e)),N(n,{ok:!0})},id:e,label:e.split("/").pop()??e,async refresh(){await t(!0)},async rows(){let n=await t(),o=n.doc.rows.map((i,s)=>({cells:X(n,s),key:n.keys[s]}));return{rows:o,total:o.length}},async serializeForSource(n){let o=await t();return k(_(o,n))}}}var Z=50;function ee(e){let r=e.toLowerCase();if(/(int|real|floa|doub|num|dec)/.test(r))return"number";if(r.includes("bool"))return"boolean";if(/(timestamp|datetime|date)/.test(r))return"date";return"string"}function re(e){return!e.pk&&e.name!=="created_at"&&e.name!=="updated_at"}function ne(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;return JSON.stringify(e)}function B(e,r){let t=[],n="id",o=new Map,i=(a)=>{if(a.length>0)t=a,n=a.find((c)=>c.pk)?.name??"id"},s=(a)=>({table:r,...e?{connection:e}:{},limit:a?.limit??Z,offset:a?.offset??0,...a?.orderBy?{dir:a.dir??"asc",orderBy:a.orderBy}:{}}),l=(a,c)=>{let y=a[n];if(typeof y==="string"||typeof y==="number")return o.set(String(y),y),String(y);return`row-${c}`};return{capabilities:{delete:!0,insert:!0,remotePaging:!0,remoteSort:!0},async columns(){if(t.length===0){let a=await x(s({limit:1,offset:0}));i(a.columns)}return t.map((a)=>{let c=re(a)?ee(a.type):"readonly";return{editable:c!=="readonly",field:a.name,kind:c,pk:a.pk===!0,title:a.name,widthHint:a.pk?80:void 0}})},async commit(a){let c={cells:[],deletes:[],inserts:[]},y=new Map;for(let f of a.cells){let g=y.get(f.rowKey)??[];g.push({field:f.field,value:f.value}),y.set(f.rowKey,g)}for(let[f,g]of y){let b=o.get(f),d=(u,h)=>{for(let w of g)c.cells.push({error:h,field:w.field,ok:u,rowKey:f})};if(b===void 0){d(!1,"Row has no primary key — refresh the grid");continue}try{let u={};for(let h of g)u[h.field]=h.value;await A({pk:b,set:u,table:r,...e?{connection:e}:{}}),d(!0)}catch(u){d(!1,u instanceof Error?u.message:String(u))}}for(let f of a.inserts)try{let g={};for(let[h,w]of Object.entries(f.cells))if(w!==null)g[h]=w;let{row:b}=await M({table:r,values:g,...e?{connection:e}:{}}),d=b[n],u=typeof d==="string"||typeof d==="number"?String(d):void 0;if(u!==void 0&&(typeof d==="string"||typeof d==="number"))o.set(u,d);c.inserts.push({newKey:u,ok:!0,tempKey:f.tempKey})}catch(g){c.inserts.push({error:g instanceof Error?g.message:String(g),ok:!1,tempKey:f.tempKey})}for(let f of a.deletes){let g=o.get(f.rowKey);if(g===void 0){c.deletes.push({error:"Row has no primary key — refresh the grid",ok:!1,rowKey:f.rowKey});continue}try{await K({pk:g,table:r,...e?{connection:e}:{}}),c.deletes.push({ok:!0,rowKey:f.rowKey})}catch(b){c.deletes.push({error:b instanceof Error?b.message:String(b),ok:!1,rowKey:f.rowKey})}}return c},id:ds({connection:e??"default",kind:"data",table:r}),label:r,async refresh(){t=[],o.clear()},async rows(a){let c=await x(s(a));return i(c.columns),{rows:c.rows.map((f,g)=>{let b=l(f,g),d={};for(let u of t)d[u.name]=ne(f[u.name]);return{cells:d,key:b}}),total:c.total}}}}var pb=[{key:"all",label:"All"},{dir:"pages",key:"pages",label:"Pages"},{dir:"layouts",key:"layouts",label:"Layouts"},{dir:"components",key:"components",label:"Components"},{dir:"content",key:"content",label:"Content"},{dir:"public",key:"media",label:"Media"}],C1=pb.map((e)=>e.key);function Aw(e){return pb.find((r)=>r.key===e)}function k1(e){return Aw(e)?.dir}function oe(e,r){if(r&&Ld.has(r))return"Media";if(e.startsWith("pages"))return"Pages";if(e.startsWith("layouts"))return"Layouts";if(e.startsWith("components"))return"Components";if(e.startsWith("content"))return"Content";if(e.startsWith("public"))return"Media";if(e.startsWith("data"))return"Content";if(e.startsWith("styles"))return"Components";return"Other"}function ie(e){let r=D?.projectConfig?.content??{};for(let[t,n]of Object.entries(r)){if(!n.source)continue;let o=n.source.replace(/^\.\//,"").replace(/\/$/,"");if(e.startsWith(`${o}/`)||e===o)return t.charAt(0).toUpperCase()+t.slice(1)}return null}var se=new Set(["node_modules",".git",".jx","dist","build",".cache"]);async function H(e,r,t,n,o){let i;try{i=await Ir(()=>r.listDirectory(e))}catch(l){n.push({dir:e,error:te(l)});return}let s=[];for(let l of i){if(l.type==="directory"){if(!se.has(l.name))s.push(l.path);continue}let a=Gi(l.name),c=oe(l.path,a);t.push({category:c,ext:a,locale:bL(l.path,o)??void 0,modified:l.modified,name:l.name,path:l.path,size:l.size,type:c==="Content"?ie(l.path)??a??"file":a||"file"})}await Promise.all(s.map((l)=>H(l,r,t,n,o)))}async function Uf(e,r){let t=[],n=[],{i18n:o}=$o(D?.projectConfig??{});return await Promise.all(e.map((i)=>H(i,r,t,n,o))),t.sort((i,s)=>i.path.localeCompare(s.path)),{failures:n,files:t}}function TE(e,r){let t=e,n=Aw(r.category);if(n&&n.key!=="all")t=t.filter((s)=>s.category===n.label);let o=r.query.trim().toLowerCase();if(o)t=t.filter((s)=>s.name.toLowerCase().includes(o)||s.path.toLowerCase().includes(o));let i=r.locale?.trim();if(i)t=t.filter((s)=>s.locale===i);return t}var qf=["table","cards","media","calendar","board"],Nw={board:"Board",calendar:"Calendar",cards:"Cards",media:"Media",table:"Table"};var LE=new Set(["cards","media"]),ae=/^(\d{4}-\d{2}-\d{2})/;function le(e){let r=ae.exec(e.name);if(r)return r[1];if(e.modified){let t=new Date(e.modified);if(!Number.isNaN(t.getTime()))return t.toISOString().slice(0,10)}return null}function S1(){return $o(D?.projectConfig??{}).i18n?.locales??[]}function IE(e){let r=new Set;for(let t of e)if(t.locale)r.add(t.locale);return S1().filter((t)=>r.has(t))}function RE(e){let r=new Map,t=[];for(let o of e){let i=le(o);if(i===null){t.push(o);continue}let s=r.get(i);if(s)s.push(o);else r.set(i,[o])}return{days:[...r.entries()].map(([o,i])=>({date:o,files:i})).toSorted((o,i)=>i.date.localeCompare(o.date)),undated:t}}function $E(e){let r=new Map;for(let n of e){let o=r.get(n.category);if(o)o.push(n);else r.set(n.category,[n])}let t=pb.map((n)=>n.label);return[...r.entries()].map(([n,o])=>({files:o,group:n})).toSorted((n,o)=>{let i=t.indexOf(n.group),s=t.indexOf(o.group);if(i===s)return n.group.localeCompare(o.group);return(i===-1?t.length:i)-(s===-1?t.length:s)})}var G="The Library lists files; it does not edit them. Rename, duplicate or delete from the file's context menu, or open the file to edit it.";function Ow(){return[{editable:!1,field:"name",kind:"string",pk:!0,title:"Name",widthHint:260},{editable:!1,field:"category",kind:"string",title:"Category",widthHint:120},{editable:!1,field:"locale",kind:"string",title:"Locale",widthHint:90},{editable:!1,field:"type",kind:"string",title:"Type",widthHint:120},{editable:!1,field:"size",kind:"number",title:"Size",widthHint:90},{editable:!1,field:"modified",kind:"date",title:"Modified",widthHint:160},{editable:!1,field:"path",kind:"readonly",title:"Path",widthHint:320}]}function ce(e){return{cells:{category:e.category,locale:e.locale??null,modified:e.modified??null,name:e.name,path:e.path,size:e.size??null,type:e.type},key:e.path}}function L(){return ds({kind:"library"})}function DE(e){let r=null,t=null,n=e??(()=>D?.projectDirs??[]);async function o(){if(r)return r;return t??=Uf(n(),p()).then((i)=>(r=i,t=null,i)),t}return{capabilities:{delete:!1,insert:!1,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(Ow()),commit(i){return Promise.resolve({cells:i.cells.map((s)=>({error:G,field:s.field,ok:!1,rowKey:s.rowKey})),deletes:i.deletes.map((s)=>({error:G,ok:!1,rowKey:s.rowKey})),inserts:i.inserts.map((s)=>({error:G,ok:!1,tempKey:s.tempKey}))})},failures:()=>r?.failures??[],files:()=>r?.files??[],id:L(),label:"Library",async refresh(){r=null,t=null,await o()},async rows(){let i=await o();return{rows:i.files.map((s)=>ce(s)),total:i.files.length}},scanned:()=>r!==null}}var P={children:[],tagName:"div"};async function AE(e,r={}){let t=m.tabs.get(e);if(t)return ci(e,{focus:r.focus!==!1}),t;try{await qt()}catch{}let n=Dw(e),o=No({capabilities:{modes:["grid","source"]},document:structuredClone(P),documentPath:e,id:e,sourceFormat:Zt(e)?.name??null,...r.paneId!==void 0&&{paneId:r.paneId},...r.preview===!0&&{preview:!0},...r.focus===!1&&{focus:!1}});return Ru(o,n).load(),o}function F(e){let r=No({capabilities:{modes:["grid"]},document:structuredClone(P),documentPath:null,id:e.id});return Ru(r,e).load(),r}function z(e){let r=ds({kind:"collection",name:e}),t=m.tabs.get(r);if(t)return ci(r),t;return F(R1(e))}function NE(){let e=L(),r=m.tabs.get(e);if(r)return ci(e),r;return No({capabilities:{modes:["manage"]},document:structuredClone(P),documentPath:null,id:e})}function E1(){let e=ds({kind:"pages"}),r=m.tabs.get(e);if(r)return ci(e),r;return F($1())}function Y(e,r){let t=ds({connection:e??"default",kind:"data",table:r}),n=m.tabs.get(t);if(n)return ci(t),n;return F(B(e,r))}function de(e){let r=Kf(e);if(r?.kind==="pages")E1();else if(r?.kind==="collection")z(r.name);else if(r?.kind==="data")Y(r.connection,r.table)}function ue(e,r){return[{emptyMessage:"",key:"project",rows:[{id:ds({kind:"pages"}),label:"Pages"},...e.map(({name:t})=>({id:ds({kind:"collection",name:t}),label:`Collection: ${t}`}))],state:"listed",title:"Project"},...r.map((t)=>({emptyMessage:"No tables — push a schema first.",key:`data:${t.name}`,rows:t.tables.map((n)=>({id:ds({connection:t.name,kind:"data",table:n}),label:n})),state:t.tables.length===0?"empty":"listed",title:`Data · ${t.name}`}))]}async function OE(){let e=Fw(),r=[];if(Rw())r=(await E().catch(()=>null))?.connections??[];let t=null,n=bs({cancelLabel:"Cancel",confirmLabel:"",headline:"Open Grid",island:(o)=>{t=j(o,ue(e,r),(i)=>{n.close(),de(i)})},layer:Ct("dialog"),onCancel:()=>n.close(),onClosed:()=>{t?.dispose(),t=null},onConfirm:()=>{},region:"grid/open"});n.ready}function pe(){return[{args:Se({name:He("The content collection's name, as project.json declares it.")}),category:"Project",id:"collection.editInGrid",level:"project",menus:["context/file","palette"],group:"5_data",requires:"a project that declares content collections",when:(e)=>e.project.open,run:(e,r)=>{let t=ot("collection.editInGrid",r,"name"),n=Fw().map((o)=>o.name);if(!n.includes(t))throw RangeError(`command "collection.editInGrid" argument "name": "${t}" is not a content `+"collection this project declares — it declares: "+`${n.length>0?n.join(", "):"none"}`);z(t)},title:"Edit Collection in Grid"},{args:{additionalProperties:!1,properties:{connection:He('The connection name from project.json. Defaults to "default".'),table:He("The table to open.")},required:["table"],type:"object"},category:"Project",id:"data.openGrid",level:"project",menus:["palette"],group:"5_data",requires:"a platform that serves the data routes",when:(e)=>e.project.open,enablement:(e)=>e.capability.dataRows,run:(e,r)=>{let t=ot("data.openGrid",r,"table");Y(Jo("data.openGrid",r,"connection"),t)},title:"Open Data Grid"}]}function ME(e){e.registerAll(pe())}
|
|
7
|
+
export{Rw,SE,_1,EE,$w,Dw,pb,C1,Aw,k1,Uf,TE,qf,Nw,LE,S1,IE,RE,$E,Ow,DE,AE,NE,E1,OE,ME};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
10
|
-
//# sourceMappingURL=studio-
|
|
9
|
+
//# debugId=5E34916DF590526664756E2164756E21
|
|
10
|
+
//# sourceMappingURL=studio-3ck2a5c4.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p1,f1
|
|
2
|
-
export{
|
|
1
|
+
import{h1,p1,f1}from"./studio-ge5fqjth.js";import{p,We}from"./studio-y7jehjrp.js";import{Rf,D_,A_}from"./studio-1a99w39s.js";import{tT,kb,da,lT,Tr,Ba,Tb}from"./studio-bftp4n4b.js";import{me}from"./studio-0bbxhhce.js";var t="checking",i=null;function Bg(){return We()&&Boolean(p().cfConnect)}async function If(){if(!Bg())return;i??=(async()=>{try{t=await p().cfConnection?.()??null}catch{t=null}i=null,qh()})(),await i}function NS(){if(Bg()&&t==="checking"&&!i)If()}function OS(){t="checking",i=null}async function d(){let n=await p().cfConnect?.();if(n?.status==="connected"&&!n.connection.accountId){let{openCfAccountPicker:e}=await (me("bb2yq946"),import("./cf-account-picker-bb2yq946.js"));await e()}Tr(),await If()}function s(){let n={id:"disconnect",label:"Disconnect",run:async()=>{await p().cfDisconnect?.(),Tr(),await If()},variant:"negative"},e=(r)=>({id:r==="Connect"?"connect":"reconnect",label:r,run:d,variant:"accent"}),o={id:"cloudflare",label:"Cloudflare",revoke:()=>{}};if(t==="checking")return{...o,actions:[],connected:!1,detail:"Checking your connection…"};if(!t?.connected)return{...o,actions:[e("Connect")],connected:!1,detail:"Not connected. Connecting publishes this site and runs the assistant on Workers AI."};let c=()=>{n.run()};if(t.needsReconnect)return{...o,actions:[e("Reconnect"),n],connected:!0,detail:"Connection expired. Reconnect to keep publishing and the assistant working.",revoke:c};if(t.needsAccount||!t.accountId)return{...o,actions:[{id:"choose-account",label:"Choose account",run:async()=>{let{openCfAccountPicker:r}=await (me("bb2yq946"),import("./cf-account-picker-bb2yq946.js"));if(await r())Tr(),await If()},variant:"accent"},n],connected:!0,detail:"Connected, but no account is chosen yet — publishing and the assistant need one.",revoke:c};return{...o,actions:[n],connected:!0,detail:`Connected — ${t.accountName??t.accountId}.`,revoke:c}}function l(){let n=Rf(),e=D_();return{connected:Boolean(n),detail:n?`Connected${e?` — account ${e}`:""}.`:"Not connected. Publishing will ask when it needs it.",id:"cloudflare",label:"Cloudflare",revoke:A_}}function u(n){let e={id:n.id,label:n.label,run:async()=>{await Tb(n)}};if(n.primary)e.variant="accent";return e}function f(n){return{actions:(n.actions??[]).map((e)=>u(e)),connected:n.connected??!1,detail:n.detail,id:`platform:${n.id}`,label:n.label,revoke:()=>{}}}function R_(){let n=h1(),e=Ba(),o=da();return[{id:"github",label:"GitHub",detail:n?p1()==="desktop"?"Signed in — the token is in this app's config folder, readable only by you.":"Signed in — a device-flow token is stored in this browser.":"Not signed in. Cloning and pushing will ask when they need it.",connected:Boolean(n),revoke:f1},{id:"ai",label:"AI provider",detail:kb()?`Key stored. Model ${e}${o?` via ${o}`:""}.`:"No key stored. The Assistant section is where one is entered.",connected:kb(),revoke:lT},Bg()?s():l(),...tT().map((c)=>f(c))]}function MS(n){let e=R_().find((o)=>o.id===n);if(!e)return!1;return e.revoke(),qh(),!0}var a=new Set;function PS(n){return a.add(n),()=>{a.delete(n)}}function qh(){for(let n of a)n()}
|
|
2
|
+
export{Bg,If,NS,OS,R_,MS,PS,qh};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=6D43ADF227123C3264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-4fde4a0x.js.map
|