@jxsuite/studio 10.4.0 → 10.5.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-7sx2vexa.js +4 -0
- package/dist/chunks/adapter-12dxr3z7.js +4 -0
- package/dist/chunks/{add-new-flow-v0pm96mr.js → add-new-flow-any4pw2q.js} +3 -3
- package/dist/chunks/{cf-account-picker-xb8vvt2h.js → cf-account-picker-ajh60k54.js} +3 -3
- package/dist/chunks/cf-settings-hbj16kh3.js +4 -0
- package/dist/chunks/{color-area-h8dbasp1.js → color-area-gbcftzh3.js} +2 -2
- package/dist/chunks/{color-field-qv5r2b16.js → color-field-85136598.js} +3 -3
- package/dist/chunks/{color-slider-nz2mrzky.js → color-slider-w1s3ndd8.js} +2 -2
- package/dist/chunks/color-thzpppyc.js +4 -0
- package/dist/chunks/{combobox-6hs00996.js → combobox-dk98wc5x.js} +3 -3
- package/dist/chunks/components-a98hzqw9.js +4 -0
- package/dist/chunks/content-source-jq3fjs3w.js +4 -0
- package/dist/chunks/{convert-to-repeater-r8sfxjjm.js → convert-to-repeater-g66r6qp1.js} +3 -3
- package/dist/chunks/editor-rth1rzj8.js +4 -0
- package/dist/chunks/entry-commands-02j0s19w.js +4 -0
- package/dist/chunks/{extension-sections-vjzw46xb.js → extension-sections-rqrs7dr0.js} +3 -3
- package/dist/chunks/file-ops-6a49er4c.js +4 -0
- package/dist/chunks/files-b2p9y0yz.js +4 -0
- package/dist/chunks/format-host-7xe57k1s.js +4 -0
- package/dist/chunks/fs-events-0xsy168g.js +4 -0
- package/dist/chunks/grid-open-h3q4fjy5.js +4 -0
- package/dist/chunks/{grid-view-2f03wcgw.js → grid-view-0v4hjspb.js} +17 -17
- package/dist/chunks/{icons-gb967qc8.js → icons-j9eksgew.js} +2 -2
- package/dist/chunks/{iframe-entry-btck0e9s.js → iframe-entry-4zqtn3ry.js} +4 -4
- package/dist/chunks/{iframe-entry-b5qgggyp.js → iframe-entry-54kwwhmg.js} +4 -4
- package/dist/chunks/{iframe-entry-42hpmwz5.js → iframe-entry-m24fza30.js} +4 -4
- package/dist/chunks/iframe-host-8jcmaktg.js +4 -0
- package/dist/chunks/{image-bake-4afr4y6a.js → image-bake-m8gzaan9.js} +3 -3
- package/dist/chunks/{image-editor-x7t8jbjn.js → image-editor-0afyws7c.js} +3 -3
- package/dist/chunks/{index-yjrfeks8.js → index-2q88g57p.js} +3 -3
- package/dist/chunks/index-7nj2375a.js +4 -0
- package/dist/chunks/{javascript-hy2mws8v.js → javascript-5sxtr1g7.js} +3 -3
- package/dist/chunks/jsonMode-m6sf47hq.js +13 -0
- package/dist/chunks/jx-validate-808zgbgy.js +4 -0
- package/dist/chunks/layers-0ffdtqjn.js +4 -0
- package/dist/chunks/layers-panel-rw62wtvf.js +4 -0
- package/dist/chunks/{listbox-7gka1h86.js → listbox-k5p41049.js} +2 -2
- package/dist/chunks/lit-html-9bz9rcfv.js +4 -0
- package/dist/chunks/media-library-2a5hdbek.js +4 -0
- package/dist/chunks/media-open-069kzhj4.js +4 -0
- package/dist/chunks/media-picker-4p4pd28y.js +4 -0
- package/dist/chunks/menu-26nez152.js +4 -0
- package/dist/chunks/{monaco-binding-a51py33c.js → monaco-binding-1s2b8snq.js} +3 -3
- package/dist/chunks/monaco-buffer-m9fd2dka.js +4 -0
- package/dist/chunks/monaco-setup-e0crh3v6.js +4 -0
- package/dist/chunks/notify-re3js157.js +4 -0
- package/dist/chunks/platform-rywy3tkg.js +4 -0
- package/dist/chunks/popover-fhdnt4be.js +4 -0
- package/dist/chunks/publish-panel-czkpg8m4.js +4 -0
- package/dist/chunks/{publish-quick-4fwngwrw.js → publish-quick-b9wbhqj6.js} +3 -3
- package/dist/chunks/publish-workspace-yy6d23b7.js +4 -0
- package/dist/chunks/quick-search-tp7pjnmv.js +4 -0
- package/dist/chunks/references-wd2yj8s1.js +4 -0
- package/dist/chunks/right-panel-x971k0zc.js +4 -0
- package/dist/chunks/source-control-k4p00hpe.js +4 -0
- package/dist/chunks/{split-m5rwn31z.js → split-qh21j2b0.js} +2 -2
- package/dist/chunks/{studio-v5wktj6f.js → studio-151kgn69.js} +4 -4
- package/dist/chunks/studio-15mfah02.js +10 -0
- package/dist/chunks/studio-1a7zshnv.js +5 -0
- package/dist/chunks/studio-1d8m5s38.js +16 -0
- package/dist/chunks/studio-35pmfjtx.js +5 -0
- package/dist/chunks/{studio-3na1r48j.js → studio-3yr1zdp9.js} +8 -8
- package/dist/chunks/studio-43pynnhz.js +5 -0
- package/dist/chunks/studio-44xqe0b7.js +4 -0
- package/dist/chunks/{studio-hh394phe.js → studio-48yzqzqr.js} +4 -4
- package/dist/chunks/{studio-9gr7xs9r.js → studio-4jy967rj.js} +5 -5
- package/dist/chunks/{studio-4bgvvzhv.js → studio-4ncxzw5m.js} +4 -4
- package/dist/chunks/{studio-pm17wdc4.js → studio-4s5bka8t.js} +4 -4
- package/dist/chunks/{studio-5tet77de.js → studio-4z0cdh16.js} +3 -3
- package/dist/chunks/studio-5rq3e4q5.js +5 -0
- package/dist/chunks/{studio-wmjmsw0p.js → studio-69g6a0jn.js} +4 -4
- package/dist/chunks/studio-6hcfm9q3.js +5 -0
- package/dist/chunks/studio-6mf31e16.js +5 -0
- package/dist/chunks/studio-6sxnqqw8.js +5 -0
- package/dist/chunks/{studio-0939t1q1.js → studio-7qqb7hb8.js} +4 -4
- package/dist/chunks/{studio-bg8pzprg.js → studio-7qr8k0v2.js} +4 -4
- package/dist/chunks/{studio-0x6f3nk9.js → studio-8ncm9zwx.js} +4 -4
- package/dist/chunks/studio-8w5pa88p.js +7 -0
- package/dist/chunks/{studio-3qr08sxq.js → studio-9f5vcb4w.js} +3 -3
- package/dist/chunks/studio-aaw7wxv8.js +5 -0
- package/dist/chunks/studio-afx9brsc.js +5 -0
- package/dist/chunks/studio-ajfq4fmr.js +5 -0
- package/dist/chunks/{studio-evq47j2z.js → studio-ber1dgte.js} +4 -4
- package/dist/chunks/{studio-sce30r7b.js → studio-bk0anq3b.js} +3 -3
- package/dist/chunks/{studio-0gvvqj3h.js → studio-bmwgj8ez.js} +4 -4
- package/dist/chunks/{studio-s24mhq0z.js → studio-bpzwhn88.js} +4 -4
- package/dist/chunks/{studio-g9brbewz.js → studio-c72v1kwc.js} +4 -4
- package/dist/chunks/{studio-tpxcryf2.js → studio-cv6gnjqd.js} +4 -4
- package/dist/chunks/{studio-90zkgne5.js → studio-czpmzs9r.js} +7 -7
- package/dist/chunks/{studio-2pk7kc7z.js → studio-d5f7sskn.js} +4 -4
- package/dist/chunks/studio-dmgh2rrj.js +5 -0
- package/dist/chunks/{studio-nwf0c32p.js → studio-dst8y8vh.js} +4 -4
- package/dist/chunks/studio-ehj3csbm.js +6 -0
- package/dist/chunks/{studio-hfqpfmpk.js → studio-ek4fb4eb.js} +4 -4
- package/dist/chunks/studio-ep1384t9.js +5 -0
- package/dist/chunks/{studio-abh9kfdh.js → studio-eq5vqn1q.js} +4 -4
- package/dist/chunks/studio-erjccagy.js +5 -0
- package/dist/chunks/studio-ex1644g2.js +5 -0
- package/dist/chunks/studio-f3awr5nc.js +12 -0
- package/dist/chunks/studio-f69wcajk.js +9 -0
- package/dist/chunks/{studio-jma2q8r9.js → studio-g65t6svn.js} +4 -4
- package/dist/chunks/{studio-r6mx7vm5.js → studio-gw83z798.js} +5 -5
- package/dist/chunks/{studio-2x972v58.js → studio-hy936516.js} +4 -4
- package/dist/chunks/studio-j3bq30yz.js +5 -0
- package/dist/chunks/studio-j52ks8q7.js +5 -0
- package/dist/chunks/{studio-g0hxtcga.js → studio-jqvke4ac.js} +4 -4
- package/dist/chunks/{studio-bnc50f9h.js → studio-k05g7efh.js} +4 -4
- package/dist/chunks/studio-kefs4sz4.js +5 -0
- package/dist/chunks/{studio-2e4hry72.js → studio-ketrgtph.js} +5 -5
- package/dist/chunks/studio-m3jrjfhy.js +14 -0
- package/dist/chunks/{studio-45mj4jqe.js → studio-m8hesdrw.js} +4 -4
- package/dist/chunks/{studio-k0xzrse2.js → studio-n271vdsg.js} +36 -36
- package/dist/chunks/studio-n4pnf0sw.js +5 -0
- package/dist/chunks/{studio-gnazwtv3.js → studio-ncwx602y.js} +4 -4
- package/dist/chunks/{studio-amaz545p.js → studio-nngc45ct.js} +4 -4
- package/dist/chunks/{studio-eqcddvc2.js → studio-nv5eq0f7.js} +173 -173
- package/dist/chunks/{studio-az3wvyh2.js → studio-nzp0sqjg.js} +4 -4
- package/dist/chunks/{studio-k2evngrj.js → studio-pgze9p34.js} +5 -5
- package/dist/chunks/studio-ph17an19.js +5 -0
- package/dist/chunks/studio-pte5w7rf.js +9 -0
- package/dist/chunks/studio-pv1ts08p.js +6 -0
- package/dist/chunks/studio-q509sqt8.js +5 -0
- package/dist/chunks/{studio-rr00ex23.js → studio-qarg1xf9.js} +6 -6
- package/dist/chunks/studio-r5g7fx7q.js +9 -0
- package/dist/chunks/studio-s49y6m5b.js +5 -0
- package/dist/chunks/studio-s4k1v7dt.js +7 -0
- package/dist/chunks/studio-t46rt6gx.js +5 -0
- package/dist/chunks/{studio-61rg2cz5.js → studio-td3h1644.js} +4 -4
- package/dist/chunks/{studio-v7a7yb5w.js → studio-thgexj3w.js} +7 -7
- package/dist/chunks/{studio-vpevkfxw.js → studio-veh91hjv.js} +4 -4
- package/dist/chunks/studio-vswmz40d.js +6 -0
- package/dist/chunks/{studio-daksw8kh.js → studio-w3aafbpk.js} +4 -4
- package/dist/chunks/studio-w4mfaaam.js +5 -0
- package/dist/chunks/{studio-4zd6an2b.js → studio-wn2cmf9q.js} +4 -4
- package/dist/chunks/studio-x5ffyssw.js +5 -0
- package/dist/chunks/{studio-swedpd82.js → studio-x5py815g.js} +4 -4
- package/dist/chunks/{studio-4fnb5648.js → studio-xh6rf05g.js} +4 -4
- package/dist/chunks/studio-z6s56dzz.js +5 -0
- package/dist/chunks/{studio-nvcn2ykc.js → studio-zav9hgb3.js} +4 -4
- package/dist/chunks/{studio-a88ej93p.js → studio-ze1sm147.js} +6 -6
- package/dist/chunks/{studio-pj216fmn.js → studio-zkkt13qd.js} +4 -4
- package/dist/chunks/studio-zn7ysyzb.js +5 -0
- package/dist/chunks/{studio-xx3r3sb0.js → studio-ztzf8mce.js} +4 -4
- package/dist/chunks/{studio-1410q5dw.js → studio-zzgp5yka.js} +4 -4
- package/dist/chunks/{tooltip-dj1pvgz7.js → tooltip-gtx40bjg.js} +3 -3
- package/dist/chunks/{tree-j0ebwr5s.js → tree-a19s1c05.js} +2 -2
- package/dist/chunks/tsMode-3f116hth.js +14 -0
- package/dist/chunks/workspace-home-61n1jz3q.js +4 -0
- package/dist/chunks/workspace-sheek6zw.js +4 -0
- package/dist/chunks/{ws-client-arz2qsy9.js → ws-client-cb49m87s.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +82 -82
- package/dist/studio.js +97 -96
- package/dist/workers/ts.worker.js +3 -3
- package/package.json +11 -11
- package/src/browse/library-layouts.ts +9 -12
- package/src/browse/library-pane.ts +22 -16
- package/src/browse/library-source.ts +3 -4
- package/src/canvas/canvas-live-render.ts +2 -5
- package/src/canvas/canvas-page-context.ts +5 -0
- package/src/content/entry-commands.ts +32 -27
- package/src/content/entry-editor.ts +46 -44
- package/src/content/entry-inspector.ts +15 -12
- package/src/content/entry-model.ts +3 -3
- package/src/content/entry-summaries.ts +5 -5
- package/src/content/hold-state.ts +172 -0
- package/src/content/page-summaries.ts +10 -14
- package/src/editor/inline-edit.ts +6 -1
- package/src/editor/repeater-scope.ts +333 -74
- package/src/grid/sources/content-source.ts +42 -66
- package/src/panels/block-action-bar.ts +3 -4
- package/src/panels/events-panel.ts +6 -2
- package/src/panels/formula-workspace.ts +9 -0
- package/src/panels/properties-panel.ts +127 -35
- package/src/panels/statement-editor.ts +4 -0
- package/src/panels/tab-strip.ts +29 -26
- package/src/services/ai-project-tools.ts +3 -3
- package/src/services/ai-tools.ts +5 -5
- package/src/services/ai-write-report.ts +22 -4
- package/src/services/context-manager.ts +110 -2
- package/src/services/document-assistant.ts +2 -2
- package/src/services/harness/chat-reducer.ts +9 -4
- package/src/services/render-critic.ts +234 -12
- package/src/services/tool-executor.ts +16 -8
- package/src/surfaces/collections-panel.json +1 -1
- package/src/surfaces/collections-panel.ts +1 -1
- package/src/surfaces/entry-editor.json +10 -10
- package/src/surfaces/entry-editor.ts +22 -19
- package/src/surfaces/entry-inspector.json +11 -11
- package/src/surfaces/entry-inspector.ts +17 -10
- package/src/surfaces/tab-strip.json +5 -5
- package/src/surfaces/tab-strip.ts +2 -2
- package/src/types.ts +2 -0
- package/src/ui/expression-editor.ts +10 -5
- package/src/ui/schema-form.ts +18 -1
- package/src/utils/edit-display.ts +27 -1
- package/dist/chunks/2020-906vx2dq.js +0 -4
- package/dist/chunks/adapter-hnvad61x.js +0 -4
- package/dist/chunks/cf-settings-mkbcz4z2.js +0 -4
- package/dist/chunks/color-04361ttk.js +0 -4
- package/dist/chunks/components-w5zqwva1.js +0 -4
- package/dist/chunks/content-source-g38w0d3f.js +0 -4
- package/dist/chunks/editor-wvf5e6j9.js +0 -4
- package/dist/chunks/entry-commands-t13dyw3c.js +0 -4
- package/dist/chunks/file-ops-1sghzgcr.js +0 -4
- package/dist/chunks/files-zrqtgt41.js +0 -4
- package/dist/chunks/format-host-9gy76erh.js +0 -4
- package/dist/chunks/fs-events-45rhg3me.js +0 -4
- package/dist/chunks/grid-open-t4fq6bbm.js +0 -4
- package/dist/chunks/iframe-host-9aq8ze3q.js +0 -4
- package/dist/chunks/index-f9qr7kzh.js +0 -4
- package/dist/chunks/jsonMode-vj30te2h.js +0 -13
- package/dist/chunks/jx-validate-r4ax11e3.js +0 -4
- package/dist/chunks/layers-m49nmwvx.js +0 -4
- package/dist/chunks/layers-panel-zr92pwdp.js +0 -4
- package/dist/chunks/lit-html-k2mb9k0r.js +0 -4
- package/dist/chunks/media-library-j74rt0w4.js +0 -4
- package/dist/chunks/media-open-mypr0k6b.js +0 -4
- package/dist/chunks/media-picker-pemtbsjv.js +0 -4
- package/dist/chunks/menu-d2jxpgma.js +0 -4
- package/dist/chunks/monaco-buffer-pa0g6ax7.js +0 -4
- package/dist/chunks/monaco-setup-0hw9f835.js +0 -4
- package/dist/chunks/notify-bwehrp7q.js +0 -4
- package/dist/chunks/platform-kv0k65cy.js +0 -4
- package/dist/chunks/popover-9tf4cjrk.js +0 -4
- package/dist/chunks/publish-panel-vg1n880b.js +0 -4
- package/dist/chunks/publish-workspace-jv4w2bx2.js +0 -4
- package/dist/chunks/quick-search-nh29rt8a.js +0 -4
- package/dist/chunks/references-vqyr5s9x.js +0 -4
- package/dist/chunks/right-panel-3ws9f2w0.js +0 -4
- package/dist/chunks/source-control-h3hcs5gy.js +0 -4
- package/dist/chunks/studio-0khd8xtx.js +0 -4
- package/dist/chunks/studio-1ctnw3xv.js +0 -5
- package/dist/chunks/studio-1ks5d9y4.js +0 -5
- package/dist/chunks/studio-1y9mab9m.js +0 -5
- package/dist/chunks/studio-2kpxm0eh.js +0 -7
- package/dist/chunks/studio-2zz4qbv9.js +0 -5
- package/dist/chunks/studio-3pz4t5a2.js +0 -5
- package/dist/chunks/studio-4f7thq0p.js +0 -5
- package/dist/chunks/studio-7rrdbvex.js +0 -5
- package/dist/chunks/studio-9dq7rwc7.js +0 -5
- package/dist/chunks/studio-acer0g8w.js +0 -5
- package/dist/chunks/studio-brh8d2pr.js +0 -5
- package/dist/chunks/studio-c2fa783p.js +0 -9
- package/dist/chunks/studio-cfnn70h1.js +0 -5
- package/dist/chunks/studio-cqxj4fcy.js +0 -5
- package/dist/chunks/studio-cw11h078.js +0 -5
- package/dist/chunks/studio-dn56z7sn.js +0 -5
- package/dist/chunks/studio-egnjpyde.js +0 -9
- package/dist/chunks/studio-ejrypvmq.js +0 -5
- package/dist/chunks/studio-frc16j8v.js +0 -10
- package/dist/chunks/studio-j0zf5x2x.js +0 -5
- package/dist/chunks/studio-j5fcp6gj.js +0 -5
- package/dist/chunks/studio-jd1qb1st.js +0 -7
- package/dist/chunks/studio-k1xqrgm5.js +0 -5
- package/dist/chunks/studio-k3we3kqb.js +0 -5
- package/dist/chunks/studio-knsjyx7n.js +0 -5
- package/dist/chunks/studio-mrjtnm62.js +0 -5
- package/dist/chunks/studio-n9qba0gx.js +0 -5
- package/dist/chunks/studio-nzemfbkk.js +0 -14
- package/dist/chunks/studio-pwctzka3.js +0 -16
- package/dist/chunks/studio-q80fg1d6.js +0 -12
- package/dist/chunks/studio-q9hx2qp0.js +0 -5
- package/dist/chunks/studio-qrzmfaf6.js +0 -5
- package/dist/chunks/studio-tmfcn347.js +0 -6
- package/dist/chunks/studio-wqfaqw4m.js +0 -5
- package/dist/chunks/studio-xpx91fby.js +0 -6
- package/dist/chunks/studio-xva3hzkv.js +0 -5
- package/dist/chunks/studio-z3fztxrp.js +0 -9
- package/dist/chunks/studio-z9453ypn.js +0 -6
- package/dist/chunks/tsMode-jg1dtphj.js +0 -14
- package/dist/chunks/workspace-6ztqcrsh.js +0 -4
- package/dist/chunks/workspace-home-rse9h8a0.js +0 -4
- package/src/content/draft-state.ts +0 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var nI="content",$1=/^[\w.~-]+$/,Lr="{locale}";function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function p(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function f(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function bM(t,n){let e=u(n);for(let s of f(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let o=e.slice(r.length+1),{filter:i}=s;if(i&&!i(o))return null;let l=o.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${p(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 f(t,"urlPrefix")){let o=p(r.urlPrefix);if(!s.startsWith(`${o}/`))continue;let l=s.slice(o.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 m=String.raw`"'\s<>()\\`;var L1="public";var yM=["mounts","public"];function S_(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function iI(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function mi(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function vM(t){let n=mi(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function rI(t,n){let s=(t===""||t==="."?[]:mi(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}=S_(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let o=r.replace(/^\/+/,"");if(o===""||o.split("/").some((l)=>l==="."||l===".."))return[];let i=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))i.push(mi(c));continue}i.push(l==="root"?o:`${L1}/${o}`)}return[...new Set(i)]}function oI(t,n,e,s){let{path:r}=S_(t);if(r==="")return null;if(iI(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let o;try{o=decodeURIComponent(r)}catch{return null}let i=rI(n,o);if(i===null||i===""||i===mi(n))return null;return i}function Ky(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function wM(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 o=e;while(e<t.length&&t[e]!==",")e+=1;let i=t.slice(o,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:i,url:r})}return n}function xM(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
|
|
2
|
+
export{nI,$1,Lr,bM,L1,yM,S_,iI,mi,vM,rI,oI,Ky,wM,xM};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B1B73F4E949C60A464756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-zav9hgb3.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{ft}from"./studio-5tet77de.js";import{X}from"./studio-9c6cbq2c.js";import{Tn,nt,Fn}from"./studio-tpxcryf2.js";import{ar,w}from"./studio-sce30r7b.js";import{ae}from"./studio-wqfaqw4m.js";import{cf,p,ye}from"./studio-4fnb5648.js";import{jt,Ih,sc,ou,Aa,lf,fn,wl}from"./studio-q9hx2qp0.js";import{us}from"./studio-4zd6an2b.js";import{$s,Um}from"./studio-hh394phe.js";import{Wt,ln,go,Gm,wv,Jd,Gn,fi,m,Da,oc,rc,Si,SI,Ft,kv,CI}from"./studio-knsjyx7n.js";import{Wp,PO,FO,Ls}from"./studio-bnc50f9h.js";import{rt,Eo,xr}from"./studio-g9brbewz.js";import{Es,fO,z$,yO,Ix,Rx}from"./studio-pwctzka3.js";import{sl}from"./studio-v7a7yb5w.js";import{ei}from"./studio-r6mx7vm5.js";import{Ea}from"./studio-n9qba0gx.js";import{yf}from"./studio-1ks5d9y4.js";import{Br,Ks,Js,zr}from"./studio-90zkgne5.js";import{Kw,Im,Rm,Fb}from"./studio-mrjtnm62.js";import{UC,q$,G$,iv,Wm,Jc,Ys}from"./studio-61rg2cz5.js";import{HT,HS}from"./studio-2zz4qbv9.js";import{Qw}from"./studio-3pz4t5a2.js";import{qN,Fr,Ab,Ob}from"./studio-hfqpfmpk.js";import{jb,Zu}from"./studio-jma2q8r9.js";import{zt}from"./studio-daksw8kh.js";import{Fw,jw,Hw}from"./studio-g0hxtcga.js";import{Fc}from"./studio-qrzmfaf6.js";import{Vs}from"./studio-j0zf5x2x.js";import{C,id,_n}from"./studio-4f7thq0p.js";import{E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,_}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";async function Lb(){if(Kw(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=sl({status:"Installing dependencies…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"Install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function L(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=L(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function K(e){return Le.some((t)=>e.includes(t))}function He(e){let t=C?.projectConfig?.layout;if(!n(t))return!1;return L(t).toLowerCase()===L(e).toLowerCase()}function $S(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of wl(e)){let r=Aa(o,"parse");if(r&&Aa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...ou().flatMap((e)=>e.extensions)])}function IS(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Gn(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&K(o.documentKinds):L(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of wl()){let s=Aa(i,"serialize");if(!s||s.name===o?.name||!K(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function RN(){let e=new Set([".json"]);for(let t of ou()){if(!t.capabilities.serialize||!K(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var Y="jx-studio-recent-projects",le="jx-studio-recent-files",se=8,We=10,T=[];function M(){if(!ye())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function _e(){try{let e=localStorage.getItem(Y);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Q(){return M()?T:_e()}function de(e){T=e;let t=M();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(Y,JSON.stringify(e))}catch{}}async function DN(){let e=M();if(!e)return;try{T=await e.getRecentProjects()}catch{T=[]}}function Nw(){return Q().toSorted((e,t)=>t.timestamp-e.timestamp)}function Aw(e,t){let o=Q().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:ar()}),o.length>se)o.length=se;de(o)}function RS(e){de(Q().filter((t)=>t.root!==e))}function NN(){T=[];let e=M();if(e)e.saveRecentProjects([]);else localStorage.removeItem(Y)}function pe(){try{let e=localStorage.getItem(le);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function AN(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function $b(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:ar()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(le,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},address:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Add ?project= and a project folder's absolute path to this page's address to open it."}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};E("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function A(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function Je(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function qe(e){let t=e?.$map,o=_(t)&&"item"in t?t.item:void 0;if(!_(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=g({...A(),...o});fe(r,t);let a=null,i=!1,s=R("files-panel",r,e,{onNodeCreated:(l,c,d,u)=>{if(i||!(l instanceof HTMLElement))return;let x=Je(d);if(x==="tree"){o.treeHost(l);return}if(x!=="row")return;let y=qe(u);if(y)o.rowHost(l,y.path,y.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function rl(e){if(!C)return;try{let t=p(),[o]=await Promise.all([$s(()=>t.listDirectory(e)),PO(e)]);C.dirs.set(e,o)}catch{C.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function Em(){if(!C)return;await rl(".");let e=[];for(let t of C.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),C.expanded.add(t.path||t.name),await rl(t.path||t.name);C.projectDirs=e}async function TT(e){let t=new Set(C?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await Em(),!0}function LT(){return Eo(rt.showIgnoredFiles)==="true"}function VP(e){xr(rt.showIgnoredFiles,e?"true":"")}async function $T(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if(Ih(),jt(),sc(e),Wp(),Um(),id({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)rc(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(Aw(_n().name,o.root),await Rm(),await Lb())Ih(),await jt(),sc(e);await Em(),await Ea(),await Ib(),Im(o.root)}}catch{}}async function IT({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject?.();if(!r)return!1;let{config:a,handle:i}=r;if(SI({document:{children:[],tagName:"div"},id:"initial"}),qN(),Ih(),jt(),sc(o),Wp(),Um(),id({...C,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),rc(i.root,a),await Rm(),await Lb())Ih(),await jt(),sc(o);return await Em(),await Ea(),Fb(),Rx(),t?.(),Aw(_n().name,_n().projectRoot),e(),await Ib(),Im(_n().projectRoot),!0}catch(o){return w.error("Could not open the project.",{detail:X(o),source:"Open Project"}),!1}}async function RT(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),w.success("Initialized a git repository for this project."),!0}catch(o){return w.warn("Could not initialize a git repository — the project itself was written.",{detail:X(o),source:"Source Control"}),!1}}async function DS(){await jt();let e=[...wl("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function UP(){let e=await DS();if(e)await _i(e)}async function Ib(){let e=yO(m.projectRoot),t=z$(m.projectRoot),o=await Be(e);return ge?.(t),o}var ge=null;function DT(e){ge=e}async function Be(e){if(Ix(m.projectRoot),e){if(await fO(e,{ensureSecondPane:()=>{oc(fi)},openFile:(o,r)=>_i(o,{focus:!1,paneId:r})})>0)return!0}return await UP(),!1}function Ue(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&yf(r)?"image":"file"}}var qP=24,f=[],k=null,j=new Map,z=null,we=null;function oe(){for(let e of j.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return qP}function Ge(){for(let[e,t]of j)if(!t.isConnected)j.delete(e),Re(t)}function ve(e){let t=j.get(e);return t?.isConnected===!0?t:null}function B(e){return f.find((t)=>!t.loading&&t.path===e)}function be(e,t,o,r){let a=_n().dirs.get(e);if(!a){rl(e).then(()=>h()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((d,u)=>{if(d.type==="directory"&&u.type!=="directory")return-1;if(d.type!=="directory"&&u.type==="directory")return 1;return d.name.localeCompare(u.name)}),s=LT()?i:i.filter((d)=>!FO(e,d.path,d.type==="directory")),l=_n().searchQuery.toLowerCase(),c=l?s.filter((d)=>d.type==="directory"||d.name.toLowerCase().includes(l)):s;for(let[d,u]of c.entries()){let y=u.type==="directory"&&_n().expanded.has(u.path);if(o.push({depth:t,expanded:y,key:u.path,loading:!1,name:u.name,path:u.path,locale:go(u.path,r)??void 0,posInSet:d+1,setSize:c.length,type:u.type}),y)be(u.path,t+1,o,r)}}function xe(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function H(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ke(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Ye(){if(k?.isConnected!==!0||S!=="")return;queueMicrotask(h)}function ee(){let e=k;if(e===null)return;z=Hw(z,e,{count:()=>f.length,onChange:Ye,rowHeight:oe})}function Qe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ue(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Wt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Xe(){if(Ge(),!C){f=[];let l={...A(),view:"none"};return b=l,l}if(!C.isSiteProject&&C.projectRoot==="."){f=[];let l=cf(p())?"welcome":"address",c={...A(),view:l};return b=c,c}let e=_n();f=[];let{i18n:t}=ln(e.projectConfig??{});be(".",0,f,t);let o=Fw(k,{count:f.length,rowHeight:oe()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&B(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=LT(),s={currentPath:a,dragPath:S,dropPath:I,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:U,rows:r.map((l)=>Qe(l)),selectedPath:e.selectedPath??"",view:"tree"};return b=s,s}function te(){if(!v||!b)return;b={...b,dragPath:S,dropPath:I,rootDrop:U},v.handle.update(b)}function h(){we?.()}async function Ze(){let e=_n();e.dirs.clear(),Wp(),await rl(".");for(let t of e.expanded)await rl(t);h()}function et(e){let t=B(e);if(!t)return;if(t.type==="directory"){je(e).then(()=>h());return}_i(e)}function tt(e,t){let o=_n();if(B(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),h();return}je(e).then(()=>h())}function Pe(e){if(!C||_n().selectedPath===e)return;_n().selectedPath=e,h()}function ot(e,t){let o=xe(e),r;switch(t){case"Home":{r=H(-1,1);break}case"End":{r=H(f.length,-1);break}case"ArrowUp":{r=H(o,-1);break}case"ArrowLeft":{r=Ke(o);break}case"ArrowDown":case"ArrowRight":{r=H(o,1);break}default:return}Fe(r)}function at(e,t){let o=xe(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Fe(i);return}}}function Fe(e){let t=f[e];if(!t)return;if(Pe(t.path),ve(t.path))return;jw(k,e,oe()),h()}async function je(e){let t=_n();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await rl(e)}var N=new Map,V=null,S="",J="",I="",q=!1,U="";function GP(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Se(e,t,o){let r=(s)=>{if(!GP(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),ON(l,t,h)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function NT(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return ne(o)!==r}function Z(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&NT(r,t)}function F(e,t){let o=t?e:"";if(J===e&&I===o)return;J=e,I=o,$e()}function W(e){if(q===e)return;q=e,$e()}function $e(){U=q&&J===""?"true":"",te()}async function ON(e,t,o){if((await Ys([...e],{dir:t})).length===0)return;if(t!==".")_n().expanded.add(t);o()}function KP(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=Jc(),o.addEventListener("change",()=>{if(o.files?.length)ON(o.files,e,t)}),o.click()}function it(e,t,o){Re(e),j.set(t,e);let r=[zr({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){S=t,te()},onDrop(){S="",F("",!1),te()}}),Se(e,o==="directory"?t:ne(t),(a)=>{F(a?t:"",a)}),Ks({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return Z(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){F(t,Z(a,t,o))},onDragEnter({source:a}){F(t,Z(a,t,o))},onDragLeave(){F("",!1)},onDrop(){F("",!1)}})];N.set(e,Br(...r))}function Re(e){let t=N.get(e);if(t)t(),N.delete(e)}function st(e){if(V?.element===e)return;ke(),k=e;let t=Ks({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&NT(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){W(!0)},onDragLeave(){W(!1)},onDrop(){W(!1)}}),o=Js({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!NT(s,l))return;let c=s.split("/").pop(),d=l==="."?c:`${l}/${c}`;lt(s,d,h)}});V={cleanup:Br(t,o,Se(e,".",W)),element:e},ee()}function ke(){V?.cleanup(),V=null;for(let e of N.values())e();N.clear(),z?.window.destroy(),z=null,k=null,S="",J="",I="",q=!1,U=""}async function lt(e,t,o){let r=t.split("/").pop()??t,a=ne(t),i={path:e,source:"Files"},s;try{s=await p().listDirectory(a)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:`The folder could not be read to check for ${r}: ${X(d)}`});return}let l=r.toLowerCase(),c=s.find((d)=>d.name.toLowerCase()===l);if(c!==void 0){let d=a==="."?"The project root":`${a}/`;w.error(`Could not move ${e}.`,{...i,detail:`${d} already has ${c.name}, and a move would replace it.`});return}try{let d=await Pw(e,t);if(a!==".")_n().expanded.add(a);o(),Mw(`Moved to ${t}`,d,t)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:X(d)})}}function ne(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var D=null;function Ee(){D?.close(),D=null}function ct(e){let t={};if(e.type==="directory"){let o=Jd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,Fc(e.path))t.path=e.path;if(IS(e.path).length>0)t.source=e.path;return t}function P(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?P(a.id,a.title,()=>{Tn(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function pt(e){let t=e.type==="directory",o=[];if(t){if(o.push(P("files.newFile","New File…",()=>{Te(e.path,h)}),P("files.upload","Upload Files…",()=>{KP(e.path,h)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(P("files.pagesGrid","Edit Pages in Grid",()=>{HS()}))}else o.push(P("files.open","Open",()=>{_i(e.path)}));return o.push(...dt(e),P("files.rename","Rename…",()=>{yt(e,h)},{dividerAbove:!0}),P("files.delete","Delete",()=>{bt(e,h)},{destructive:!0})),o}function ut(e,t,o){let r=B(e);if(!r)return;Ee();let a=ve(e);D=zt({label:"File actions",onClosed:(i)=>{if(D===i)D=null},opener:a,origin:{x:t,y:o},region:"files",rows:pt({name:r.name,path:r.path,type:r.type})})}var mt=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function ht(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Aa(e.ext)?.name??e.ext} (${e.ext})`}]:$S(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:UC}]}function gt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=q$(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??UC}async function JP(e){let{dir:t,format:o,source:r="Files"}=e;await jt();let a=await Ow(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:ht(i),l=i===null||s===null?"":gt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},d=(G,Oe)=>iv(G,Oe,c),u=l,x={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"};if(s!==null)x.choice={initial:l,label:"Format",onChange:(G)=>{u=G},options:()=>s};if(e.suggestedName!==void 0)x.placeholder=e.suggestedName;let y=await Fn(e.title??"New File",x);if(!y)return null;let O=G$(y,u,o),De=t==="."?O:`${t}/${O}`,re=fn(O),Ne=e.content,Ce=o!==void 0&&u!==UC,Ie=Ne??re?.studio?.newFileTemplate??(re?"":O.toLowerCase().endsWith(".json")?Ce?mt:`{}
|
|
2
|
-
`:"");return
|
|
3
|
-
`),path:o,source:"Files"})}function vt(e,t){for(let o of e.references?.files??[])if(o.path!==t&&
|
|
4
|
-
export{
|
|
1
|
+
import{ft}from"./studio-4z0cdh16.js";import{X}from"./studio-9c6cbq2c.js";import{Tn,nt,Fn}from"./studio-cv6gnjqd.js";import{ao,w}from"./studio-bk0anq3b.js";import{ae}from"./studio-q509sqt8.js";import{cf,p,ve}from"./studio-xh6rf05g.js";import{jt,$h,lc,ru,Pa,lf,fn,_l}from"./studio-ex1644g2.js";import{hs}from"./studio-wn2cmf9q.js";import{Rs,Gm}from"./studio-48yzqzqr.js";import{Wt,ln,gr,Ym,ky,Gd,Kn,fi,g,Oa,sc,ac,Si,DR,Ft,Ry,OR}from"./studio-s49y6m5b.js";import{Wp,GA,JA,Ls}from"./studio-k05g7efh.js";import{ot,Er,_o}from"./studio-c72v1kwc.js";import{Ts,kA,XL,RA,Mx,Fx}from"./studio-1d8m5s38.js";import{al}from"./studio-thgexj3w.js";import{ei}from"./studio-gw83z798.js";import{$a}from"./studio-43pynnhz.js";import{wf}from"./studio-z6s56dzz.js";import{zo,Zs,Xs,Uo}from"./studio-czpmzs9r.js";import{tx,Dm,Om,Bb}from"./studio-ajfq4fmr.js";import{n1,nR,iR,ly,qm,Jc,Qs}from"./studio-td3h1644.js";import{YT,q0}from"./studio-6sxnqqw8.js";import{sx}from"./studio-j3bq30yz.js";import{rO,Bo,Mb,Fb}from"./studio-ek4fb4eb.js";import{Vb,Zu}from"./studio-g65t6svn.js";import{Vt}from"./studio-w3aafbpk.js";import{zw,Uw,qw}from"./studio-jqvke4ac.js";import{sl}from"./studio-6mf31e16.js";import{Ks}from"./studio-6hcfm9q3.js";import{x,id,_n}from"./studio-zn7ysyzb.js";import{E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,S}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";async function Nb(){if(tx(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=al({status:"Installing dependencies…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"Install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function M(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=M(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function K(e){return Le.some((t)=>e.includes(t))}function He(e){let t=x?.projectConfig?.layout;if(!n(t))return!1;return M(t).toLowerCase()===M(e).toLowerCase()}function A0(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of _l(e)){let r=Pa(o,"parse");if(r&&Pa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...ru().flatMap((e)=>e.extensions)])}function P0(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Kn(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&K(o.documentKinds):M(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of _l()){let s=Pa(i,"serialize");if(!s||s.name===o?.name||!K(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function VD(){let e=new Set([".json"]);for(let t of ru()){if(!t.capabilities.serialize||!K(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var Y="jx-studio-recent-projects",le="jx-studio-recent-files",se=8,We=10,D=[];function A(){if(!ve())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function _e(){try{let e=localStorage.getItem(Y);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Q(){return A()?D:_e()}function de(e){D=e;let t=A();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(Y,JSON.stringify(e))}catch{}}async function WD(){let e=A();if(!e)return;try{D=await e.getRecentProjects()}catch{D=[]}}function jw(){return Q().toSorted((e,t)=>t.timestamp-e.timestamp)}function Hw(e,t){let o=Q().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:ao()}),o.length>se)o.length=se;de(o)}function M0(e){de(Q().filter((t)=>t.root!==e))}function zD(){D=[];let e=A();if(e)e.saveRecentProjects([]);else localStorage.removeItem(Y)}function pe(){try{let e=localStorage.getItem(le);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function UD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function Db(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:ao()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(le,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},address:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Add ?project= and a project folder's absolute path to this page's address to open it."}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};E("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function H(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function Je(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function qe(e){let t=e?.$map,o=S(t)&&"item"in t?t.item:void 0;if(!S(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=b({...H(),...o});fe(r,t);let a=null,i=!1,s=I("files-panel",r,e,{onNodeCreated:(l,c,d,u)=>{if(i||!(l instanceof HTMLElement))return;let P=Je(d);if(P==="tree"){o.treeHost(l);return}if(P!=="row")return;let v=qe(u);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function ol(e){if(!x)return;try{let t=p(),[o]=await Promise.all([Rs(()=>t.listDirectory(e)),GA(e)]);x.dirs.set(e,o)}catch{x.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function Tm(){if(!x)return;await ol(".");let e=[];for(let t of x.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),x.expanded.add(t.path||t.name),await ol(t.path||t.name);x.projectDirs=e}async function MT(e){let t=new Set(x?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await Tm(),!0}function FT(){return Er(ot.showIgnoredFiles)==="true"}function rF(e){_o(ot.showIgnoredFiles,e?"true":"")}async function jT(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if($h(),jt(),lc(e),Wp(),Gm(),id({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)ac(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(Hw(_n().name,o.root),await Om(),await Nb())$h(),await jt(),lc(e);await Tm(),await $a(),await Ob(),Dm(o.root)}}catch{}}async function HT({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject?.();if(!r)return!1;let{config:a,handle:i}=r;if(DR({document:{children:[],tagName:"div"},id:"initial"}),rO(),$h(),jt(),lc(o),Wp(),Gm(),id({...x,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),ac(i.root,a),await Om(),await Nb())$h(),await jt(),lc(o);return await Tm(),await $a(),Bb(),Fx(),t?.(),Hw(_n().name,_n().projectRoot),e(),await Ob(),Dm(_n().projectRoot),!0}catch(o){return w.error("Could not open the project.",{detail:X(o),source:"Open Project"}),!1}}async function BT(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),w.success("Initialized a git repository for this project."),!0}catch(o){return w.warn("Could not initialize a git repository — the project itself was written.",{detail:X(o),source:"Source Control"}),!1}}async function F0(){await jt();let e=[..._l("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function oF(){let e=await F0();if(e)await _i(e)}async function Ob(){let e=RA(g.projectRoot),t=XL(g.projectRoot),o=await Be(e);return ge?.(t),o}var ge=null;function VT(e){ge=e}async function Be(e){if(Mx(g.projectRoot),e){if(await kA(e,{ensureSecondPane:()=>{sc(fi)},openFile:(o,r)=>_i(o,{focus:!1,paneId:r})})>0)return!0}return await oF(),!1}function Ue(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&wf(r)?"image":"file"}}var sF=24,f=[],T=null,R=new Map,_=null,we=null;function oe(){for(let e of R.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return sF}function Ge(){for(let[e,t]of R)if(!t.isConnected)R.delete(e),Re(t)}function ye(e){let t=R.get(e);return t?.isConnected===!0?t:null}function B(e){return f.find((t)=>!t.loading&&t.path===e)}function be(e,t,o,r){let a=_n().dirs.get(e);if(!a){ol(e).then(()=>m()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((d,u)=>{if(d.type==="directory"&&u.type!=="directory")return-1;if(d.type!=="directory"&&u.type==="directory")return 1;return d.name.localeCompare(u.name)}),s=FT()?i:i.filter((d)=>!JA(e,d.path,d.type==="directory")),l=_n().searchQuery.toLowerCase(),c=l?s.filter((d)=>d.type==="directory"||d.name.toLowerCase().includes(l)):s;for(let[d,u]of c.entries()){let v=u.type==="directory"&&_n().expanded.has(u.path);if(o.push({depth:t,expanded:v,key:u.path,loading:!1,name:u.name,path:u.path,locale:gr(u.path,r)??void 0,posInSet:d+1,setSize:c.length,type:u.type}),v)be(u.path,t+1,o,r)}}function xe(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function W(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ke(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Ye(){if(T?.isConnected!==!0||k!=="")return;queueMicrotask(m)}function ee(){let e=T;if(e===null)return;_=qw(_,e,{count:()=>f.length,onChange:Ye,rowHeight:oe})}function Qe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ue(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Wt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Xe(){if(Ge(),!x){f=[];let l={...H(),view:"none"};return y=l,l}if(!x.isSiteProject&&x.projectRoot==="."){f=[];let l=cf(p())?"welcome":"address",c={...H(),view:l};return y=c,c}let e=_n();f=[];let{i18n:t}=ln(e.projectConfig??{});be(".",0,f,t);let o=zw(T,{count:f.length,rowHeight:oe()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&B(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=FT(),s={currentPath:a,dragPath:k,dropPath:O,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:U,rows:r.map((l)=>Qe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function te(){if(!h||!y)return;y={...y,dragPath:k,dropPath:O,rootDrop:U},h.handle.update(y)}function m(){we?.()}async function Ze(){let e=_n();e.dirs.clear(),Wp(),await ol(".");for(let t of e.expanded)await ol(t);m()}function et(e){let t=B(e);if(!t)return;if(t.type==="directory"){je(e).then(()=>m());return}_i(e)}function tt(e,t){let o=_n();if(B(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),m();return}je(e).then(()=>m())}function Pe(e){if(!x||_n().selectedPath===e)return;_n().selectedPath=e,m()}function rt(e,t){let o=xe(e),r;switch(t){case"Home":{r=W(-1,1);break}case"End":{r=W(f.length,-1);break}case"ArrowUp":{r=W(o,-1);break}case"ArrowLeft":{r=Ke(o);break}case"ArrowDown":case"ArrowRight":{r=W(o,1);break}default:return}Fe(r)}function at(e,t){let o=xe(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Fe(i);return}}}function Fe(e){let t=f[e];if(!t)return;if(Pe(t.path),ye(t.path))return;Uw(T,e,oe()),m()}async function je(e){let t=_n();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await ol(e)}var C=new Map,V=null,k="",J="",O="",q=!1,U="";function aF(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Se(e,t,o){let r=(s)=>{if(!aF(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),qD(l,t,m)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function WT(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return ne(o)!==r}function Z(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&WT(r,t)}function j(e,t){let o=t?e:"";if(J===e&&O===o)return;J=e,O=o,$e()}function z(e){if(q===e)return;q=e,$e()}function $e(){U=q&&J===""?"true":"",te()}async function qD(e,t,o){if((await Qs([...e],{dir:t})).length===0)return;if(t!==".")_n().expanded.add(t);o()}function lF(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=Jc(),o.addEventListener("change",()=>{if(o.files?.length)qD(o.files,e,t)}),o.click()}function it(e,t,o){Re(e),R.set(t,e);let r=[Uo({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){k=t,te()},onDrop(){k="",j("",!1),te()}}),Se(e,o==="directory"?t:ne(t),(a)=>{j(a?t:"",a)}),Zs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return Z(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){j(t,Z(a,t,o))},onDragEnter({source:a}){j(t,Z(a,t,o))},onDragLeave(){j("",!1)},onDrop(){j("",!1)}})];C.set(e,zo(...r))}function Re(e){let t=C.get(e);if(t)t(),C.delete(e)}function st(e){if(V?.element===e)return;ke(),T=e;let t=Zs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&WT(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){z(!0)},onDragLeave(){z(!1)},onDrop(){z(!1)}}),o=Xs({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!WT(s,l))return;let c=s.split("/").pop(),d=l==="."?c:`${l}/${c}`;lt(s,d,m)}});V={cleanup:zo(t,o,Se(e,".",z)),element:e},ee()}function ke(){V?.cleanup(),V=null;for(let e of C.values())e();C.clear(),_?.window.destroy(),_=null,T=null,k="",J="",O="",q=!1,U=""}async function lt(e,t,o){let r=t.split("/").pop()??t,a=ne(t),i={path:e,source:"Files"},s;try{s=await p().listDirectory(a)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:`The folder could not be read to check for ${r}: ${X(d)}`});return}let l=r.toLowerCase(),c=s.find((d)=>d.name.toLowerCase()===l);if(c!==void 0){let d=a==="."?"The project root":`${a}/`;w.error(`Could not move ${e}.`,{...i,detail:`${d} already has ${c.name}, and a move would replace it.`});return}try{let d=await Ww(e,t);if(a!==".")_n().expanded.add(a);o(),Vw(`Moved to ${t}`,d,t)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:X(d)})}}function ne(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function Ee(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Gd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,sl(e.path))t.path=e.path;if(P0(e.path).length>0)t.source=e.path;return t}function F(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?F(a.id,a.title,()=>{Tn(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function pt(e){let t=e.type==="directory",o=[];if(t){if(o.push(F("files.newFile","New File…",()=>{Te(e.path,m)}),F("files.upload","Upload Files…",()=>{lF(e.path,m)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(F("files.pagesGrid","Edit Pages in Grid",()=>{q0()}))}else o.push(F("files.open","Open",()=>{_i(e.path)}));return o.push(...dt(e),F("files.rename","Rename…",()=>{yt(e,m)},{dividerAbove:!0}),F("files.delete","Delete",()=>{bt(e,m)},{destructive:!0})),o}function ut(e,t,o){let r=B(e);if(!r)return;Ee();let a=ye(e);N=Vt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:pt({name:r.name,path:r.path,type:r.type})})}var mt=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function ht(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Pa(e.ext)?.name??e.ext} (${e.ext})`}]:A0(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:n1}]}function gt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=nR(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??n1}async function cF(e){let{dir:t,format:o,source:r="Files"}=e;await jt();let a=await Bw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:ht(i),l=i===null||s===null?"":gt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},d=(G,Oe)=>ly(G,Oe,c),u=l,P={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"};if(s!==null)P.choice={initial:l,label:"Format",onChange:(G)=>{u=G},options:()=>s};if(e.suggestedName!==void 0)P.placeholder=e.suggestedName;let v=await Fn(e.title??"New File",P);if(!v)return null;let L=iR(v,u,o),De=t==="."?L:`${t}/${L}`,re=fn(L),Ne=e.content,Ce=o!==void 0&&u!==n1,Ie=Ne??re?.studio?.newFileTemplate??(re?"":L.toLowerCase().endsWith(".json")?Ce?mt:`{}
|
|
2
|
+
`:"");return j0(De,Ie,{dir:t,source:r})}async function Bw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function j0(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");Ls(e);try{if(await p().writeFile(e,t),await ol(r),o.quiet!==!0)w.success(`Created ${e}`);return e}catch(a){return w.error(`Could not create ${e}.`,{detail:X(a),path:e,source:o.source??"Files"}),null}}async function Te(e,t){await jt();let o=Gd(e);if(o?.unresolvedFormat!=null)w.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (ce("02j0s19w"),import("./entry-commands-02j0s19w.js"));i=await s(o.name,{dir:e})}else i=await cF({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function wt(e,t,o){let r=await Fb(t),a={confirmLabel:"Rename",select:"stem",validate:(i)=>qm(t,i,o),value:e};if(r!==void 0)a.message=r;return Fn("Rename",a)}function H0(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function Vw(e,t,o){let r=t.errors??[];if(r.length===0){w.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;w.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
|
|
3
|
+
`),path:o,source:"Files"})}function vt(e,t){for(let o of e.references?.files??[])if(o.path!==t&&g.tabs.has(o.path))Lm(o.path)}function $m(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function dF(e,t,o){hs();let r=$m(e),a=$m(t);if(await ol(r),a!==r)await ol(a);let i=_n();if(i.selectedPath===e)i.selectedPath=t;else if(i.selectedPath?.startsWith(`${e}/`))i.selectedPath=t+i.selectedPath.slice(e.length);vt(o,t)}async function Ww(e,t){Ls(e,t);let o=await p().renameFile(e,t),r=[...g.tabs.keys()];for(let a of r)if(a===e||a.startsWith(`${e}/`)){let i=t+a.slice(e.length);OR(a,i,i)}return await dF(e,t,o),o}async function B0(e,t){try{let o=await p().listDirectory($m(e));return new Set(o.map((r)=>r.name))}catch(o){return w.error(`Could not rename ${e.split("/").pop()??e}.`,{detail:`The folder could not be read to check the new name: ${X(o)}`,path:e,source:t}),null}}async function yt(e,t){let o=$m(e.path),r=await B0(e.path,"Files");if(r===null)return;let a=await wt(e.name,e.path,r);if(!a||a===e.name)return;let i=o==="."?a:`${o}/${a}`;try{let s=await Ww(e.path,i);t(),Vw(H0(a,s),s,i)}catch(s){w.error(`Could not rename ${e.name}.`,{detail:X(s),path:e.path,source:"Files"})}}async function bt(e,t){if(!await Mb(e))return;try{let r=p();Ls(e.path),await r.deleteFile(e.path),hs();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await ol(i),_n().selectedPath===e.path)_n().selectedPath=null;t(),w.success(`Deleted ${e.name}`)}catch(r){w.error(`Could not delete ${e.name}.`,{detail:X(r),path:e.path,source:"Files"})}}function xt(e,t){let o=t.paneId,r=Oa(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;Ry(e,o)}Ft(e,{focus:t.focus!==!1})}async function _i(e,t={}){let o=t.focus!==!1;for(let[a,i]of g.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(xt(a,t),o)_n().selectedPath=e;return}if(Vb(e)){if(Zu(e,t),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await YT(e,t),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot})}catch(a){w.error(`Could not open ${e}.`,{detail:X(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await jt(),!fn(e)&&!e.toLowerCase().endsWith(".json"))throw lf(e);return}await jt();let i,s,l=null,c=fn(e);if(c){let u=await Bo(e,a);({document:i}=u),{frontmatter:s}=u}else if(e.endsWith(".json"))({document:i,layout:l}=Ts(a));else throw lf(e);if(Si({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot})}catch(a){w.error(`Could not open ${e}.`,{detail:X(a),path:e,source:"Open File"})}}async function V0(e,t){await _i(t,{focus:!1,paneId:e,preview:!0})}function zT(e){if(ky(e))return;sx(e);for(let[,t]of g.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){Lm(e);return}}function UT(e){for(let t of e)Lm(t,{onlyIfChanged:!0})}async function Lm(e,t={}){for(let[,o]of g.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||ky(e);try{let s=await r.readFile(e);if(!s)return;if(await jt(),i())return;if(fn(e)){let{document:l,frontmatter:c}=await Bo(e,s);if(i())return;if(t.onlyIfChanged&&Ks(l,o.doc.document)&&Ks(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=Ts(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Ym(c),t.onlyIfChanged&&Ks(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){w.error(`Could not reload ${e} after it changed on disk.`,{detail:X(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function qT(){ei({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>ft,afterRender:(e,t)=>{uF(t,e.rerender)}})}var Pt={activate:et,contextMenu:ut,expand:tt,move:rt,newFile:()=>{Te(".",m)},openProject:()=>{nt("project.open",void 0,"Files")},refresh:()=>{Ze()},rowHost:it,search:(e)=>{_n().searchQuery=e,m()},select:Pe,toggleIgnored:()=>{rF(!FT()),m()},treeHost:st,typeahead:at},h=null,y=null;function uF(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,h&&(h.host!==o||!h.handle.connected()))hF();let r=Xe();if(h)h.handle.update(r);else{let a=me(o,r,Pt);h={handle:a,host:o},a.ready.then(ee)}queueMicrotask(ee)}function hF(){Ee(),h?.handle.dispose(),h=null,y=null,ke(),R.clear(),f=[]}
|
|
4
|
+
export{Nb,A0,P0,VD,WD,jw,Hw,M0,zD,UD,Db,ol,Tm,MT,FT,rF,jT,HT,BT,F0,oF,Ob,VT,sF,aF,WT,qD,lF,cF,Bw,j0,H0,Vw,$m,dF,Ww,B0,_i,V0,zT,UT,Lm,qT,uF,hF};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=studio-
|
|
6
|
+
//# debugId=04271C1940481F1B64756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-ze1sm147.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{De}from"./studio-43pynnhz.js";import{bt,Ta,qr,Wo}from"./studio-aaw7wxv8.js";import{Wt,Qc,ti,qn,Se,pi,Fe,g,Jo,pn,m1,og,_h,td}from"./studio-s49y6m5b.js";import{tr,$s,fl,u}from"./studio-1d8m5s38.js";import{zt}from"./studio-zn7ysyzb.js";import{re}from"./studio-151kgn69.js";import{te}from"./studio-9f5vcb4w.js";var h0=["code","layout","component","diff","breakpoint","locale"],T={breakpoint:"design",code:"source",component:"design"},x={design:"Design",source:"Code"},k="Could not read this file's comparison against HEAD.";var ju={breakpoint:"Same page at",code:"Code",component:"Component definition",diff:"Diff vs HEAD",layout:"Layout",locale:"Same page in"};function R(e){let t=pn(e)?.derived;if(!t)return null;let o=bt(t.sourcePaneId);if(!o)return{diffPath:null,kind:t.kind,media:null,mode:null,path:null,probePath:null,reason:"The pane this one follows has no document open.",select:null,status:"unavailable"};if(t.kind==="lens")return w(e,t,o);return S(e,t,o)}function w(e,t,o){let n={diffPath:null,kind:"lens",media:t.media,mode:t.mode,path:null,probePath:null,select:null};if(t.preset==="diff"){let i=o.documentPath;if(!m(i))return{...n,reason:"Nothing to compare — this file matches HEAD.",status:"unavailable"};if(t.diff?.filePath===i&&(t.diffRev===void 0||t.diffRev===u.git.rev))return{...n,reason:"",status:"ready"};if(c.get(e)?.failed&&c.get(e)?.path===i)return{...n,reason:k,status:"unavailable"};return{...n,diffPath:i,reason:"",status:"loading"}}if(t.preset==="code"&&Ta(o)==="source")return{...n,reason:"The pane this one follows is showing Code — one document has one editor.",status:"unavailable"};if(t.preset==="breakpoint"&&!p0(o).includes(t.media))return{...n,reason:`This document does not declare a "${t.media??"base"}" breakpoint.`,status:"unavailable"};return{...n,reason:"",status:"ready"}}function m(e){return u.git.status?.files.find((t)=>t.path===e&&(t.status==="M"||t.status==="A"||t.status==="U"))??null}function S(e,t,o){let n={diffPath:null,kind:"companion",media:null,mode:null};if(t.preset==="layout"){let a=u.layoutSelection,r=a?.layoutFile??fl(o.doc.document.$layout);return r===null?{...n,path:null,probePath:null,reason:"This page has no layout.",select:null,status:"unavailable"}:{...n,path:r,probePath:null,reason:"",select:a?a.layoutPath:null,status:"ready"}}if(t.preset==="locale"){let a=$s(),r=o.documentPath===null||t.locale===null?null:Qc(o.documentPath,t.locale,a);if(r===null)return{...n,path:null,probePath:null,reason:"This document has no path in that locale.",select:null,status:"unavailable"};let l=d.get(e);if(l?.path!==r||l.exists===null)return{...n,path:null,probePath:r,reason:"",select:null,status:"loading"};if(!l.exists)return{...n,path:null,probePath:null,reason:`No ${Wt(t.locale)} copy of this document yet — `+"the Languages panel can create one.",select:null,status:"unavailable"};return{...n,path:r,probePath:null,reason:"",select:null,status:"ready"}}let i=_(o);if(i===null)return t.resolved===null?{...n,path:null,probePath:null,reason:"Select an element inside a component to see its definition.",select:null,status:"unavailable"}:{...n,path:null,probePath:null,reason:"",select:null,status:"ready"};return{...n,path:i,probePath:null,reason:"",select:null,status:"ready"}}function p0(e){let{sizeBreakpoints:t}=Wo(tr(e.doc.document.$media));return[null,...t.map((o)=>o.name)]}function _(e){let[t]=e?.session.selection??[];if(!e||!t)return null;let o=e.doc.document,n=[...t];while(n){let i=re(o,n),a=i?De.find((r)=>r.tagName===i.tagName):null;if(a?.path)return a.path;n=zt(n)}return null}function F(e,t){if(t.sourcePaneId===e||!pn(t.sourcePaneId))throw RangeError(`pane "${e}" cannot derive from "${t.sourcePaneId}" — a derivation names `+"another pane that is in the grid");b(e,t)}function b(e,t){let o=pn(e);if(o)c.delete(e),d.delete(e),o.derived=t}function iT(e){b(e,null)}function f(e,t){let o=pn(e),n=o?.derived,i=R(e);if(!o||!n||!i)return;if(qr.derivedResolves+=1,n.status=i.status,n.reason=i.reason,n.kind==="lens"){let r=pn(n.sourcePaneId);if(o.tabOrder.length>0||o.activeTabId!==null){let l=[...o.tabOrder];for(let s of l)if(og(s),r)_h(r,s);o.activeTabId=null}if(n.preset==="diff"&&i.status!=="ready")n.diff=null;A(e,i,t);return}if(C(e,i,t),n.resolved!==null&&bt(e)===null)n.resolved=null;if(i.path===null||i.path===n.resolved){v(e,i);return}n.resolved=i.path,qr.derivedRetargets+=1;let a=t.openFileInPane(e,i.path);if(i.select===null)return;Promise.resolve(a).then(()=>{v(e,i)})}function v(e,t){let o=t.select,n=bt(e);if(!o||!n||t.path!==null&&n.documentPath!==t.path)return;let[i]=n.session.selection;if(i?.length===o.length&&i.every((a,r)=>a===o[r]))return;n.session.selection=[[...o]]}var c=new Map;function A(e,t,o){let n=t.diffPath,i=m(n),{rev:a}=u.git,r=c.get(e);if(n===null||!i||r?.path===n&&r.rev===a)return;c.set(e,{failed:!1,path:n,rev:a}),o.loadDiff(n,i.status).then((l)=>{let s=pn(e)?.derived;if(s?.kind!=="lens"||s.preset!=="diff"||c.get(e)?.path!==n)return;if(l)s.diff=l,s.diffRev=a;else c.set(e,{failed:!0,path:n,rev:a});f(e,o)}).catch((l)=>{console.error("loadDiff error:",l)})}var d=new Map;function C(e,t,o){let n=t.probePath;if(n===null||d.get(e)?.path===n)return;d.set(e,{exists:null,path:n}),o.fileExists(n).then((i)=>{let a=pn(e)?.derived;if(a?.kind!=="companion"||a.preset!=="locale"||d.get(e)?.path!==n)return;d.set(e,{exists:i,path:n}),f(e,o)}).catch((i)=>{console.error("fileExists error:",i)})}var p=new Map;function M(e,t){if(p.has(e))return;p.set(e,requestAnimationFrame(()=>{p.delete(e);try{f(e,t)}catch(o){console.error("applyDerivation error:",o)}}))}function cD(e,t){te(()=>{let o=pn(e),n=o?.derived;if(!n)return;o.activeTabId;let i=bt(n.sourcePaneId);if(n.kind==="lens"&&n.preset==="code")i?.session.ui.canvasMode;if(n.kind==="companion"&&n.preset==="component")i?.session.selection;if(n.kind==="companion"&&n.preset==="layout")u.layoutSelection,i?.doc.document?.$layout;M(e,t)})}function Sw(e,t,o,n=null){let i=bt(t);if(!i)return"an open document";let a=T[e];if(a&&!i.capabilities.modes.includes(a))return`a document with a ${x[a]} view — this one declares none`;if(e==="code")return Ta(i)==="source"?"a source pane that is not already showing Code":null;if(e==="diff")return m(i.documentPath)===null?"a file with changes against HEAD":null;if(e==="breakpoint")return p0(i).includes(o)?null:"a breakpoint this document declares — see Project Settings › Contexts";if(e==="layout")return fl(i.doc.document.$layout)===null?"a page with a layout — this one declares none":null;if(e==="locale"){let r=$s();if(r===null||r.locales.length<2)return"a project that declares more than one locale — see Project Settings › Locales";if(i.documentPath===null)return"a document that has been saved";return n!==null&&r.locales.includes(n)?null:"a locale this project declares"}return null}function Sb(e){let t=pn(e);return t&&t.activeTabId!==null&&t.derived===null?null:D}var D="an open document in a pane that is not itself derived";function O(e,t,o,n=null){if(e==="locale")return{kind:"companion",locale:n,preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};if(e==="layout"||e==="component")return{kind:"companion",preset:e,reason:"",resolved:null,sourcePaneId:t,status:"loading"};return{diff:null,kind:"lens",media:e==="breakpoint"?o:null,mode:e==="code"?"source":e==="diff"?"git-diff":"design",preset:e,reason:"",sourcePaneId:t,status:"loading",zoom:1}}function P(){return g.panes.find((e)=>rT(e.id)===null)??null}function rT(e){let t=pn(e);return t?.derived?.kind==="companion"&&t.activeTabId?null:y}var y="a derived pane showing a document of its own — Code, Diff and breakpoint views project "+"the document already open beside them";function dD(e){return[{args:Se({locale:Fe('BCP 47 tag for preset "locale". Ignored by every other preset.'),media:Fe('Breakpoint name for preset "breakpoint" — omit or leave empty for the base size. '+"Ignored by every other preset."),preset:pi(h0,"Which projection of this pane's document to show beside it.")},["preset"]),id:"pane.derive",title:"Show Beside This…",category:"View",level:"document",menus:["context/pane"],group:"5_pane",when:(t)=>t.document.open,enablement:()=>Sb(Jo().id)===null,requires:D,undo:"none",run:(t,o)=>{let n=qn("pane.derive",o,"preset",h0),i=ti("pane.derive",o,"media")??null,a=ti("pane.derive",o,"locale")??null,r=Jo(),l=Sw(n,r.id,i,a);if(l)throw RangeError(`command "pane.derive" argument "preset": "${n}" requires ${l}`);let s=m1(r.id);F(s.id,O(n,r.id,i,a));let E=[...s.tabOrder];for(let h of E)og(h),_h(r,h);f(s.id,e)}},{id:"pane.pin",title:"Keep This Document",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:()=>P()!==null,requires:y,undo:"none",run:()=>{let t=P();if(!t?.activeTabId)return;td(t.activeTabId),iT(t.id)}}]}
|
|
2
|
+
export{h0,ju,p0,iT,cD,Sw,Sb,rT,dD};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=7E66D3D71591308B64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-zkkt13qd.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n,J,qe,Q,S,m,Oe,Rr,Jn,_f,it}from"./studio-erjccagy.js";var Dy=400;var tf=350,x1=300,KP=30000;function oo(e){return Array.isArray(e?.children)?e.children:[]}function Oy(e,t,i=""){if(!S(e))return e;if(Array.isArray(e)){for(let[l,s]of e.entries())Oy(s,t,`${i}/${l}`);return e}let r=e,{children:o}=r;if(Rr(o)){let l=o;t?.(i,l),r.children=[l]}if(Array.isArray(r.children))for(let[l,s]of r.children.entries())Oy(s,t,`${i}/children/${l}`);if(r.$prototype==="Array"&&S(r.map))Oy(r.map,t,`${i}/map`);if(S(r.cases))for(let[l,s]of Object.entries(r.cases))Oy(s,t,`${i}/cases/${FR(l)}`);return e}function FR(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function zt(e){return e.length>=2?e.slice(0,-2):null}function Vi(e){return e.at(-1)}function jR(e){return e.join("/")}function ko(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;return e.every((i,r)=>i===t[r])}function Ch(e,t=[],i=0){let r=[];return u(e,t,i,r,!1),r}function u(e,t,i,r,o){if(n(e)||J(e)||qe(e)){if(!o)r.push({depth:i,node:e,nodeType:"text",path:t});return}if(e.$prototype==="Array"){if(!o)r.push({depth:i,node:e,nodeType:"map",path:t});let s=e.map;if(S(s))u(s,[...t,"map"],i+1,r,!1);return}if(!o)r.push({depth:i,node:e,nodeType:"element",path:t});if(e.$props&&it(e.tagName).includes("-")&&!Array.isArray(e.children))return;let{children:l}=e;if(Array.isArray(l))for(let s=0;s<l.length;s++){let a=[...t,"children",s];u(l[s],a,i+1,r,!1)}else if(Rr(l))u(l,[...t,"children"],i+1,r,!1);if(e.$switch&&S(e.cases))for(let[s,a]of Object.entries(e.cases)){let p=[...t,"cases",s];if(S(a)&&a.$ref)r.push({depth:i+1,node:a,nodeType:"case-ref",path:p});else if(S(a))r.push({depth:i+1,node:a,nodeType:"case",path:p}),u(a,p,i+2,r,!0)}}function Eo(e){if(!e)return"?";if(e.$prototype==="Array"){let{items:r}=e;return`Repeater → ${(Oe(r)?r.$ref:void 0)||"items"}`}if(e.$title)return e.$title;if(e.$id)return e.$id;if(e.tagName==="slot"){let r=e.attributes?.name;return n(r)&&r.trim()?`slot: ${r.trim()}`:"slot"}let t=it(e.tagName)||"div",i=e.$switch?" ⇆":"";if(n(e.textContent)&&e.textContent.length>0)return`${t} — ${e.textContent.slice(0,24)}${i}`;return t+i}var x=null;function id(e){x=e}function _n(){return x}function nu(e){return S(e)}function nf(e){if(Array.isArray(e))return e.map((i)=>nf(i));if(!Jn(e))return e;let t={};for(let[i,r]of Object.entries(e)){if(i.startsWith("on")&&_f(r))continue;if(i==="children")t.children=Array.isArray(r)?r.map((o)=>nf(o)):nf(r);else if(i==="cases"&&nu(r)){let o={};for(let[l,s]of Object.entries(r))o[l]=nf(s);t.cases=o}else if(i==="state"&&nu(r)){let o={};for(let[l,s]of Object.entries(r)){if(m(s)&&s.timing==="server")continue;o[l]=s}t.state=o}else t[i]=r}return t}var _1=null,kh=null,HR=null,BR=null,VR=null;function c(e){let t=document.querySelector(`#${e}`);return t instanceof HTMLElement?t:null}function GP(){_1=c("activity-bar"),kh=c("left-panel"),HR=c("right-panel"),BR=c("toolbar"),VR=c("statusbar")}function rf(e,t){if(!e)throw TypeError(`#${t} is not in the shell yet; initShellRefs() has not found it`);return e}var sg=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),WR=[":hover",":focus",":active",":focus-within",":focus-visible",":disabled",":first-child",":last-child","::before","::after","::placeholder"];function p_(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}var f=new Map;function f_(e,t,i){let r=t??Dy;return(...o)=>{clearTimeout(f.get(e)),f.set(e,setTimeout(()=>{f.delete(e),i(...o)},r))}}function JP(e){clearTimeout(f.get(e)),f.delete(e)}var b=new Map;function T(e){return(S(e)||Q(e))&&"then"in e&&Q(e.then)}var d=0;function YP(){return d}function h(e,t){d+=1;let i=()=>{d-=1},r=null;try{let o=t();if(T(o))r=o}catch(o){console.error(`Renderer "${e}" failed:`,o)}if(!r){i();return}r.then(i,(o)=>{console.error(`Renderer "${e}" failed:`,o),i()})}function ag(e,t){b.set(e,t)}function so(){for(let[e,t]of b.entries())h(e,t)}function wn(...e){for(let t of e){let i=b.get(t);if(!i)continue;h(t,i)}}function wl(e,t){if(e){if(t.selection!==void 0)e.session.selection=t.selection;if(t.hover!==void 0)e.session.hover=t.hover;if(t.clipboard!==void 0)e.session.clipboard=t.clipboard;if(t.ui)Object.assign(e.session.ui,t.ui);if(t.canvas)Object.assign(e.session.canvas,t.canvas)}}function Aa(e,t,i){if(e)e.session.ui[t]=i}function ZP(e,t){if(e)Object.assign(e.session.canvas,t)}
|
|
2
|
+
export{Dy,tf,x1,KP,oo,Oy,FR,zt,Vi,jR,ko,Ch,Eo,x,id,_n,nu,nf,_1,kh,HR,BR,VR,GP,rf,sg,WR,p_,f_,JP,YP,ag,so,wn,wl,Aa,ZP};
|
|
3
|
+
|
|
4
|
+
//# debugId=BE5C82A6F6BB5B2764756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-zn7ysyzb.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p,ye}from"./studio-4fnb5648.js";import{ae}from"./studio-wqfaqw4m.js";import{hA}from"./studio-xpx91fby.js";import{w}from"./studio-sce30r7b.js";import{Fn}from"./studio-tpxcryf2.js";import{X}from"./studio-9c6cbq2c.js";import{iM,qn,Se,pi}from"./studio-knsjyx7n.js";import{Bm,u}from"./studio-pwctzka3.js";import{Zl,Hb,Ri,jd,nC}from"./studio-rr00ex23.js";import{qs}from"./studio-v7a7yb5w.js";import{ds}from"./studio-61rg2cz5.js";import{ks,Us,QT}from"./studio-mrjtnm62.js";import{C}from"./studio-4f7thq0p.js";import{ce}from"./studio-0939t1q1.js";var x={attempts:6,delayMs:5000};function B(e,t){return`https://dash.cloudflare.com/${e}/pages/view/${t}`}async function S(e){if(e>0)await new Promise((t)=>{setTimeout(t,e)})}async function y(e={}){let t=Ri(),r=new AbortController,i=qs({cancel:()=>{r.abort()},source:"Publish",status:"Starting…",steps:["Push to the remote","Ask Cloudflare for the deployment"],title:"Deploy"});i.step("Push to the remote");try{await p().gitPush({setUpstream:!0}),i.log("Pushed the current branch.")}catch(s){return i.log(X(s)),i.fail("Could not push to the remote.",{action:"git.push"}),!1}if(!t)return i.done("Pushed. No provider is connected, so nothing was asked to build it."),!0;i.step("Ask Cloudflare for the deployment");let n=e.attempts??x.attempts,l=e.delayMs??x.delayMs;for(let s=0;s<n;s+=1){if(r.signal.aborted)return!1;let a;try{a=await Hb(t)}catch(o){return i.log(X(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return jd(a),i.log(`${a.stage}: ${a.status} — ${a.url}`),i.done(`${a.stage}: ${a.status}`),!0;await S(l)}if(r.signal.aborted)return!1;return jd(null),i.done("Pushed. Cloudflare has not reported a deployment yet."),!0}function q(){return[{category:"Publish",id:"publish.setUp",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"an open project on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.capability.publish,run:async()=>{let{openPublishPanel:e}=await (ce("vg1n880b"),import("./publish-panel-vg1n880b.js"));e()},title:"Set Up Publishing"},{category:"Publish",id:"publish.deploy",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a repository with a remote and a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo&&Ri()!==void 0&&e.capability.publish,run:async()=>{await y()},title:"Deploy"},{category:"Publish",id:"publish.openDashboard",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>Ri()!==void 0&&e.capability.publish,run:()=>{let e=Ri();if(e)window.open(B(e.accountId,e.projectName),"_blank","noopener")},title:"Open Deployment Dashboard"},{category:"Publish",id:"publish.quick",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a project tracked by git",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo,run:async()=>{let{openQuickPublish:e}=await (ce("4fwngwrw"),import("./publish-quick-4fwngwrw.js"));e()},title:"Quick Publish"},{args:Se({tab:pi(Bm,"Which view of the Publish workspace to show: review (the changes and where they go), deploys (the live site and its deployments), branches, or hosting (where the project is saved and hosted). Defaults to the view the workspace was left on.")},[]),category:"Publish",id:"publish.open",level:"project",menus:["never"],group:"8_publish",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.tab===void 0?null:qn("publish.open",t,"tab",Bm),i=ae();if(!i)throw Error(`command "publish.open" needs the window's command registry`);if(await i.run("view.setWorkspace",{workspace:"publish"}),r!==null){let{showPublishTab:n}=await (ce("jv4w2bx2"),import("./publish-workspace-jv4w2bx2.js"));n(r)}},title:"Show Publish"}]}function FD(e){e.registerAll(q())}function d(){let e=u.git.status?.remotes;return Array.isArray(e)&&e.length>0?e[0]??"":""}function h(){return u.git.branches?.current||u.git.status?.branch||""}function v(){return Ri()!==void 0&&Zl()&&d()!==""}function R(){let e=Ri();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${ds(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function D(){return ye()&&p().gitCommitBranch!==void 0}function k(){let e=f();return Us()&&D()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function pb(){if(!QT())return"This host cannot open a pull request yet. Publish live, or create a branch under Branches and push it.";if(Us()){let e=f(),t=h();if(k())return"";if(!e||!t||t===e)return`Every commit to ${e||"the default branch"} on this host is live. Create a branch under Branches and send it for review from there.`;return""}if(d()==="")return"A pull request needs a remote. Create the GitHub repository under Hosting first.";return""}function T(){let e=h()||"the current branch";if(v())return`Commits to ${e} and deploys to ${R()}.`;if(Us())return`Commits to ${e} on GitHub.`;let t=d();return t?`Commits to ${e} and pushes it to ${t}.`:`Commits to ${e}. This repository has no remote, so nothing leaves this machine.`}function M(){let e=h()||"the current branch",t=u.git.commitMessage.trim(),r=t?b(t):"a new studio/ branch";if(k())return`Saves to ${r} on GitHub and opens a pull request into ${e}.`;if(Us())return`Commits to ${e} and opens a pull request from it into ${f()||"the default branch"}.`;return`Saves to ${r}, pushes it and opens a pull request into ${e}.`}function hw(e){let t=pb();return[{checked:e==="live"?"true":"false",disabled:!1,label:"Publish live",note:T(),reason:"",value:"live"},{checked:e==="review"?"true":"false",disabled:t!=="",label:"Send for review",note:M(),reason:t,value:"review"}]}function hm(e){return e==="review"&&pb()!==""?"live":e}function jD(e){if(e==="review")return"Send for review";if(v())return"Publish live";return Us()||d()!==""?"Commit and push":"Commit"}function j(e){let t=u.git.status?.files??[];return e?t:t.filter((r)=>Boolean(r.staged))}function pm(e,t=!1){let{status:r}=u.git;if(!C||!r?.isRepo)return"Track this project with git first.";if(u.git.loading)return"Source control is busy.";if(r.files.length===0)return"There is nothing to publish.";if(j(t).length===0)return"Include at least one change.";if(!u.git.commitMessage.trim())return"Write a summary of the change first.";return e==="review"?pb():""}function A(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function X_(){return ye()&&p().buildSite!==void 0}async function HD(){if(!X_()||u.publish.build.state==="running")return;let e=p().buildSite;if(!e)return;u.publish.build.state="running",u.publish.build.text="Building the site…",u.publish.build.for=A();try{let t=await e();if(t.errors.length>0)u.publish.build.state="failed",u.publish.build.text=`Built with ${t.errors.length} error(s): ${t.errors[0]}`;else u.publish.build.state="passed",u.publish.build.text=t.mode==="live"?`${t.routes} page(s) render. This host previews the working tree; it does not build.`:`Site builds: ${t.routes} page(s).`}catch(t){u.publish.build.state="failed",u.publish.build.text=`The site could not be built: ${X(t)}`}}function fb(){let e=[],t=nC();if(e.push(t?{command:t.command,key:"deploy",state:t.state==="unknown"?"unknown":"todo",text:`${t.label}: ${t.detail}`}:{command:"",key:"deploy",state:"done",text:"Everything this project needs to ship is in place."}),X_()){let r=u.publish.build.for===A()||u.publish.build.state==="running";e.push(r&&u.publish.build.state!=="idle"?{command:"",key:"build",state:u.publish.build.state==="passed"?"done":u.publish.build.state==="failed"?"failed":"running",text:u.publish.build.text}:{command:"",key:"build",state:"unknown",text:"The site has not been built with these changes."})}return e}function BD(e){let t=e.filter((r)=>r.state!=="done");if(t.length===0)return"Checks passed: ready to publish.";return t.map((r)=>r.text).join(" · ")}function zD(){return u.publish.review.number>0?{number:u.publish.review.number,url:u.publish.review.url}:null}function P(e){if(!u.git.commitMessage)u.git.commitMessage=e}async function pw(e,t={}){let r=t.includeAll??!1,i=pm(e,r);if(i)return u.git.error=i,!1;let n=u.git.commitMessage.trim(),l=p();u.git.commitMessage="",u.git.loading=!0,u.git.error=null,await iM();let s=!1,a=!0;try{if(r){let o=j(!0).filter((c)=>!c.staged).map((c)=>c.path);if(o.length>0)await l.gitStage(o)}if(e==="review")await L(l,n,()=>{s=!0});else if(await l.gitCommit(n),s=!0,v())u.git.loading=!1,a=await y();else if(!Us()&&d()!=="")await l.gitPush();return await ks(),a}catch(o){let c=s?null:hA(o);if(c&&D()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=X(o),!1}if(u.git.error=X(o),u.git.loading=!1,!s)P(n);return!1}}function _(e){let t=e.slice(0,3).join(", ");return e.length>3?`${t} and ${e.length-3} more`:t}async function G(e,t){let r=p(),i=r.gitCommitBranch;if(!i)return!1;let n=h()||"this branch",l=t.length===1?"1 file":`${t.length} files`,s=await Fn("Publish to a New Branch",{confirmLabel:"Publish to branch",message:`${n} changed on GitHub after these edits began, and ${l} changed on both sides (${_(t)}). Publish your changes to a branch of their own instead, and a pull request will bring them into ${n}.`,value:b(e),validate:(o)=>o.trim()?"":"Enter a branch name."});if(!s)return P(e),!1;u.git.loading=!0,u.git.error=null;let a=!1;try{let o=await i({branch:s,message:e});a=!0;let c=r.createPullRequest,g=h(),m=c&&g?await c({base:g,head:o.branch,title:e}):null;if(m)u.publish.review.number=m.number,u.publish.review.url=m.url;w.success(m?`Published to ${o.branch}. Pull request #${m.number} brings it into ${g}.`:`Published to ${o.branch}.`,{detail:m?.url??"",key:"publish.branch",source:"Publish"});try{await r.gitPull()}catch{}return await ks(),!0}catch(o){if(u.git.error=X(o),u.git.loading=!1,!a)P(e);return!1}}async function H(e,t,r){if(k()&&e.gitCommitBranch){let l=h(),{branch:s}=await e.gitCommitBranch({branch:b(t),message:t});return r(),{base:l,head:s,title:t}}if(Us()){await e.gitCommit(t),r();let l=f();return l?{base:l,title:t}:{title:t}}let i=h(),n=b(t);return await e.gitCreateBranch(n),await e.gitCommit(t),r(),await e.gitPush({setUpstream:!0}),i?{base:i,head:n,title:t}:{head:n,title:t}}async function L(e,t,r){let i=e.createPullRequest;if(!i)throw Error(pb());let n=await i(await H(e,t,r));u.publish.review.number=n.number,u.publish.review.url=n.url,w.success(`Pull request #${n.number} opened for review.`,{detail:n.url,key:"publish.review",source:"Publish"})}
|
|
2
|
-
export{
|
|
1
|
+
import{X}from"./studio-9c6cbq2c.js";import{p,ve}from"./studio-xh6rf05g.js";import{fP,qn,Se,pi}from"./studio-s49y6m5b.js";import{w}from"./studio-bk0anq3b.js";import{CO}from"./studio-pv1ts08p.js";import{Fn}from"./studio-cv6gnjqd.js";import{ae}from"./studio-q509sqt8.js";import{zm,u}from"./studio-1d8m5s38.js";import{Xl,Wb,Ii,jd,cC}from"./studio-qarg1xf9.js";import{Js}from"./studio-thgexj3w.js";import{us}from"./studio-td3h1644.js";import{Es,Gs,c$}from"./studio-ajfq4fmr.js";import{x}from"./studio-zn7ysyzb.js";import{ce}from"./studio-7qqb7hb8.js";var k={attempts:6,delayMs:5000};function B(e,t){return`https://dash.cloudflare.com/${e}/pages/view/${t}`}async function S(e){if(e>0)await new Promise((t)=>{setTimeout(t,e)})}async function y(e={}){let t=Ii(),r=new AbortController,i=Js({cancel:()=>{r.abort()},source:"Publish",status:"Starting…",steps:["Push to the remote","Ask Cloudflare for the deployment"],title:"Deploy"});i.step("Push to the remote");try{await p().gitPush({setUpstream:!0}),i.log("Pushed the current branch.")}catch(s){return i.log(X(s)),i.fail("Could not push to the remote.",{action:"git.push"}),!1}if(!t)return i.done("Pushed. No provider is connected, so nothing was asked to build it."),!0;i.step("Ask Cloudflare for the deployment");let n=e.attempts??k.attempts,l=e.delayMs??k.delayMs;for(let s=0;s<n;s+=1){if(r.signal.aborted)return!1;let a;try{a=await Wb(t)}catch(o){return i.log(X(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return jd(a),i.log(`${a.stage}: ${a.status} — ${a.url}`),i.done(`${a.stage}: ${a.status}`),!0;await S(l)}if(r.signal.aborted)return!1;return jd(null),i.done("Pushed. Cloudflare has not reported a deployment yet."),!0}function q(){return[{category:"Publish",id:"publish.setUp",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"an open project on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.capability.publish,run:async()=>{let{openPublishPanel:e}=await (ce("czkpg8m4"),import("./publish-panel-czkpg8m4.js"));e()},title:"Set Up Publishing"},{category:"Publish",id:"publish.deploy",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a repository with a remote and a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo&&Ii()!==void 0&&e.capability.publish,run:async()=>{await y()},title:"Deploy"},{category:"Publish",id:"publish.openDashboard",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a connected deploy provider, on a platform that can reach the Cloudflare API",when:(e)=>e.project.open,enablement:(e)=>Ii()!==void 0&&e.capability.publish,run:()=>{let e=Ii();if(e)window.open(B(e.accountId,e.projectName),"_blank","noopener")},title:"Open Deployment Dashboard"},{category:"Publish",id:"publish.quick",level:"project",menus:["commandbar/overflow","palette"],group:"8_publish",requires:"a project tracked by git",when:(e)=>e.project.open,enablement:(e)=>e.project.isRepo,run:async()=>{let{openQuickPublish:e}=await (ce("b9wbhqj6"),import("./publish-quick-b9wbhqj6.js"));e()},title:"Quick Publish"},{args:Se({tab:pi(zm,"Which view of the Publish workspace to show: review (the changes and where they go), deploys (the live site and its deployments), branches, or hosting (where the project is saved and hosted). Defaults to the view the workspace was left on.")},[]),category:"Publish",id:"publish.open",level:"project",menus:["never"],group:"8_publish",requires:"an open project",enablement:(e)=>e.project.open,run:async(e,t)=>{let r=t.tab===void 0?null:qn("publish.open",t,"tab",zm),i=ae();if(!i)throw Error(`command "publish.open" needs the window's command registry`);if(await i.run("view.setWorkspace",{workspace:"publish"}),r!==null){let{showPublishTab:n}=await (ce("yy6d23b7"),import("./publish-workspace-yy6d23b7.js"));n(r)}},title:"Show Publish"}]}function KN(e){e.registerAll(q())}function d(){let e=u.git.status?.remotes;return Array.isArray(e)&&e.length>0?e[0]??"":""}function h(){return u.git.branches?.current||u.git.status?.branch||""}function v(){return Ii()!==void 0&&Xl()&&d()!==""}function R(){let e=Ii();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${us(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function D(){return ve()&&p().gitCommitBranch!==void 0}function C(){let e=f();return Gs()&&D()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function gb(){if(!c$())return"This host cannot open a pull request yet. Publish live, or create a branch under Branches and push it.";if(Gs()){let e=f(),t=h();if(C())return"";if(!e||!t||t===e)return`Every commit to ${e||"the default branch"} on this host is live. Create a branch under Branches and send it for review from there.`;return""}if(d()==="")return"A pull request needs a remote. Create the GitHub repository under Hosting first.";return""}function T(){let e=h()||"the current branch";if(v())return`Commits to ${e} and deploys to ${R()}.`;if(Gs())return`Commits to ${e} on GitHub.`;let t=d();return t?`Commits to ${e} and pushes it to ${t}.`:`Commits to ${e}. This repository has no remote, so nothing leaves this machine.`}function M(){let e=h()||"the current branch",t=u.git.commitMessage.trim(),r=t?b(t):"a new studio/ branch";if(C())return`Saves to ${r} on GitHub and opens a pull request into ${e}.`;if(Gs())return`Commits to ${e} and opens a pull request from it into ${f()||"the default branch"}.`;return`Saves to ${r}, pushes it and opens a pull request into ${e}.`}function yw(e){let t=gb();return[{checked:e==="live"?"true":"false",disabled:!1,label:"Publish live",note:T(),reason:"",value:"live"},{checked:e==="review"?"true":"false",disabled:t!=="",label:"Send for review",note:M(),reason:t,value:"review"}]}function pm(e){return e==="review"&&gb()!==""?"live":e}function GN(e){if(e==="review")return"Send for review";if(v())return"Publish live";return Gs()||d()!==""?"Commit and push":"Commit"}function j(e){let t=u.git.status?.files??[];return e?t:t.filter((r)=>Boolean(r.staged))}function fm(e,t=!1){let{status:r}=u.git;if(!x||!r?.isRepo)return"Track this project with git first.";if(u.git.loading)return"Source control is busy.";if(r.files.length===0)return"There is nothing to publish.";if(j(t).length===0)return"Include at least one change.";if(!u.git.commitMessage.trim())return"Write a summary of the change first.";return e==="review"?gb():""}function A(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function r0(){return ve()&&p().buildSite!==void 0}async function JN(){if(!r0()||u.publish.build.state==="running")return;let e=p().buildSite;if(!e)return;u.publish.build.state="running",u.publish.build.text="Building the site…",u.publish.build.for=A();try{let t=await e();if(t.errors.length>0)u.publish.build.state="failed",u.publish.build.text=`Built with ${t.errors.length} error(s): ${t.errors[0]}`;else u.publish.build.state="passed",u.publish.build.text=t.mode==="live"?`${t.routes} page(s) render. This host previews the working tree; it does not build.`:`Site builds: ${t.routes} page(s).`}catch(t){u.publish.build.state="failed",u.publish.build.text=`The site could not be built: ${X(t)}`}}function bb(){let e=[],t=cC();if(e.push(t?{command:t.command,key:"deploy",state:t.state==="unknown"?"unknown":"todo",text:`${t.label}: ${t.detail}`}:{command:"",key:"deploy",state:"done",text:"Everything this project needs to ship is in place."}),r0()){let r=u.publish.build.for===A()||u.publish.build.state==="running";e.push(r&&u.publish.build.state!=="idle"?{command:"",key:"build",state:u.publish.build.state==="passed"?"done":u.publish.build.state==="failed"?"failed":"running",text:u.publish.build.text}:{command:"",key:"build",state:"unknown",text:"The site has not been built with these changes."})}return e}function YN(e){let t=e.filter((r)=>r.state!=="done");if(t.length===0)return"Checks passed: ready to publish.";return t.map((r)=>r.text).join(" · ")}function ZN(){return u.publish.review.number>0?{number:u.publish.review.number,url:u.publish.review.url}:null}function P(e){if(!u.git.commitMessage)u.git.commitMessage=e}async function vw(e,t={}){let r=t.includeAll??!1,i=fm(e,r);if(i)return u.git.error=i,!1;let n=u.git.commitMessage.trim(),l=p();u.git.commitMessage="",u.git.loading=!0,u.git.error=null,await fP();let s=!1,a=!0;try{if(r){let o=j(!0).filter((c)=>!c.staged).map((c)=>c.path);if(o.length>0)await l.gitStage(o)}if(e==="review")await L(l,n,()=>{s=!0});else if(await l.gitCommit(n),s=!0,v())u.git.loading=!1,a=await y();else if(!Gs()&&d()!=="")await l.gitPush();return await Es(),a}catch(o){let c=s?null:CO(o);if(c&&D()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=X(o),!1}if(u.git.error=X(o),u.git.loading=!1,!s)P(n);return!1}}function _(e){let t=e.slice(0,3).join(", ");return e.length>3?`${t} and ${e.length-3} more`:t}async function G(e,t){let r=p(),i=r.gitCommitBranch;if(!i)return!1;let n=h()||"this branch",l=t.length===1?"1 file":`${t.length} files`,s=await Fn("Publish to a New Branch",{confirmLabel:"Publish to branch",message:`${n} changed on GitHub after these edits began, and ${l} changed on both sides (${_(t)}). Publish your changes to a branch of their own instead, and a pull request will bring them into ${n}.`,value:b(e),validate:(o)=>o.trim()?"":"Enter a branch name."});if(!s)return P(e),!1;u.git.loading=!0,u.git.error=null;let a=!1;try{let o=await i({branch:s,message:e});a=!0;let c=r.createPullRequest,g=h(),m=c&&g?await c({base:g,head:o.branch,title:e}):null;if(m)u.publish.review.number=m.number,u.publish.review.url=m.url;w.success(m?`Published to ${o.branch}. Pull request #${m.number} brings it into ${g}.`:`Published to ${o.branch}.`,{detail:m?.url??"",key:"publish.branch",source:"Publish"});try{await r.gitPull()}catch{}return await Es(),!0}catch(o){if(u.git.error=X(o),u.git.loading=!1,!a)P(e);return!1}}async function H(e,t,r){if(C()&&e.gitCommitBranch){let l=h(),{branch:s}=await e.gitCommitBranch({branch:b(t),message:t});return r(),{base:l,head:s,title:t}}if(Gs()){await e.gitCommit(t),r();let l=f();return l?{base:l,title:t}:{title:t}}let i=h(),n=b(t);return await e.gitCreateBranch(n),await e.gitCommit(t),r(),await e.gitPush({setUpstream:!0}),i?{base:i,head:n,title:t}:{head:n,title:t}}async function L(e,t,r){let i=e.createPullRequest;if(!i)throw Error(gb());let n=await i(await H(e,t,r));u.publish.review.number=n.number,u.publish.review.url=n.url,w.success(`Pull request #${n.number} opened for review.`,{detail:n.url,key:"publish.review",source:"Publish"})}
|
|
2
|
+
export{KN,gb,yw,pm,GN,fm,r0,JN,bb,YN,ZN,vw};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=1964679D54D8D7C064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-ztzf8mce.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Ot}from"./studio-z6s56dzz.js";var b=new Map([[".jpeg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".jpg",{container:"jpeg",label:"JPEG",mime:"image/jpeg"}],[".png",{container:"png",label:"PNG",mime:"image/png"}],[".webp",{container:"webp",label:"WebP",mime:"image/webp"}]]),V=new Map([[".avif","The browser has no AVIF encoder, so an edit could not be written back as AVIF."],[".bmp","The browser has no BMP encoder, so an edit could not be written back as BMP."],[".gif","The browser has no GIF encoder, and a bake would flatten the animation to its first frame."],[".ico","An icon file holds several resolutions, not one image."],[".svg","An SVG is a vector document, not a bitmap. Edit it in its Source mode instead."]]),z=48000000,fg=16384,_M=fg*fg,T=[137,80,78,71,13,10,26,10];function s(e,t,n){if(t+n.length>e.length)return!1;for(let i=0;i<n.length;i++)if(e[t+i]!==n.codePointAt(i))return!1;return!0}function A(e,t){return t.length<=e.length&&t.every((n,i)=>e[i]===n)}function c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return c(e).getUint16(t,!0)+e[t+2]*65536}function w(e){return e%16384}function O(e){let t=null,n=T.length;while(n+8<=e.length){let i=c(e).getUint32(n);if(s(e,n+4,"IHDR")&&n+16<=e.length)t={height:c(e).getUint32(n+12),width:c(e).getUint32(n+8)};else if(s(e,n+4,"acTL"))return{animated:!0,container:"png",size:t};else if(s(e,n+4,"IDAT")||s(e,n+4,"IEND"))break;n+=12+i}return{animated:!1,container:"png",size:t}}function k(e){if(s(e,12,"VP8X")&&e.length>=30)return{animated:Math.floor(e[20]/2)%2===1,container:"webp",size:{height:y(e,27)+1,width:y(e,24)+1}};if(s(e,12,"VP8L")&&e.length>=25){let t=c(e).getUint32(21,!0);return{animated:!1,container:"webp",size:{height:w(Math.floor(t/16384))+1,width:w(t)+1}}}if(s(e,12,"VP8 ")&&e.length>=30)return{animated:!1,container:"webp",size:{height:w(c(e).getUint16(28,!0)),width:w(c(e).getUint16(26,!0))}};return{animated:!1,container:"webp",size:null}}function j(e){let t=2;while(t+9<=e.length){if(e[t]!==255)break;let n=e[t+1];if(n===255){t+=1;continue}if(n===1||n>=208&&n<=215){t+=2;continue}if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return{animated:!1,container:"jpeg",size:{height:c(e).getUint16(t+5),width:c(e).getUint16(t+7)}};t+=2+c(e).getUint16(t+2)}return{animated:!1,container:"jpeg",size:null}}function sI(e){if(A(e,T))return O(e);if(A(e,[255,216,255]))return j(e);if(s(e,0,"RIFF")&&s(e,8,"WEBP"))return k(e);if(s(e,0,"GIF8"))return{animated:!1,container:"gif",size:null};if(s(e,4,"ftyp")&&(s(e,8,"avif")||s(e,8,"avis")))return{animated:s(e,8,"avis"),container:"avif",size:null};return{animated:!1,container:"unknown",size:null}}function I1(e){return b.get(Ot(e))?.mime??null}function C_(e){return e==="image/jpeg"||e==="image/webp"}function SM(e){return b.has(Ot(e))}function k_(e,t){let n=Ot(e),i=b.get(n);if(i===void 0)return V.get(n)??`${n||"A file with no extension"} is not an image format Studio edits.`;let o=sI(t);if(o.container!==i.container)return`This file's bytes are not ${i.label}, whatever its ${n} extension says, so an edit could not be written back as one.`;if(o.animated)return`This ${i.label} is animated, and a bake would keep only its first frame.`;if(o.size!==null&&o.size.width*o.size.height>z){let a=o.size.width*o.size.height/1e6;return`This image is ${o.size.width} × ${o.size.height} (${a.toFixed(1)} megapixels), past the ${z/1e6} megapixels an edit can hold in memory.`}return null}var G=[0,1,2,3],aI=[{id:"free",label:"Free"},{id:"original",label:"Original"},{id:"1:1",label:"Square (1:1)"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"},{id:"3:2",label:"3:2"},{id:"2:3",label:"2:3"},{id:"16:9",label:"16:9"},{id:"9:16",label:"9:16"}],Q={"1:1":"1:1","16:9":"9:16","2:3":"3:2","3:2":"2:3","3:4":"4:3","4:3":"3:4","9:16":"16:9",free:"free",original:"original"};var W=Object.freeze({aspect:"free",brightness:100,contrast:100,crop:null,flipH:!1,flipV:!1,quality:90,saturation:100,turns:0,width:null});function d(e){return{...e,crop:e.crop===null?null:{...e.crop}}}function ad(e,t){return e.crop??{height:t.height,width:t.width,x:0,y:0}}function E(e,t){return e===null||e.x===0&&e.y===0&&e.width===t.width&&e.height===t.height}function N1(e,t){return E(e.crop,t)&&(e.turns===0?!e.flipH&&!e.flipV:e.turns===2&&e.flipH&&e.flipV)&&(e.width===null||e.width>=Yy(e,t).width)&&e.quality===90&&e.brightness===100&&e.contrast===100&&e.saturation===100}function vf(e){return e%2===1}function Yy(e,t){let n=ad(e,t);return vf(e.turns)?{height:n.width,width:n.height}:{height:n.height,width:n.width}}function E_(e,t){let n=Yy(e,t);if(e.width===null||e.width>=n.width)return n;let i=Math.max(1,Math.round(e.width));return{height:Math.max(1,Math.round(n.height*i/n.width)),width:i}}function T_(e){let t=[];if(e.brightness!==100)t.push(`brightness(${e.brightness}%)`);if(e.contrast!==100)t.push(`contrast(${e.contrast}%)`);if(e.saturation!==100)t.push(`saturate(${e.saturation}%)`);return t.join(" ")}function Ph(e,t){return vf(e)?{height:t.width,width:t.height}:{height:t.height,width:t.width}}function B([e,t],n,i){let{width:o,height:a}=i,r;switch(n.turns){case 1:{r=[a-t,e];break}case 2:{r=[o-e,a-t];break}case 3:{r=[t,o-e];break}default:r=[e,t]}let l=Ph(n.turns,i);return[n.flipH?l.width-r[0]:r[0],n.flipV?l.height-r[1]:r[1]]}function Y([e,t],n,i){let{width:o,height:a}=i,r=Ph(n.turns,i),l=n.flipH?r.width-e:e,u=n.flipV?r.height-t:t;switch(n.turns){case 1:return[u,a-l];case 2:return[o-l,a-u];case 3:return[o-u,l];default:return[l,u]}}function U(e,t){let[n,i]=t([e.x,e.y]),[o,a]=t([e.x+e.width,e.y+e.height]);return{height:Math.abs(a-i),width:Math.abs(o-n),x:Math.min(n,o),y:Math.min(i,a)}}function Zy(e,t,n){return U(e,(i)=>B(i,t,n))}function q(e,t,n){return U(e,(i)=>Y(i,t,n))}var X=["n","ne","e","se","s","sw","w","nw"],mg=["move",...X],D1={e:"Right edge",move:"Crop area",n:"Top edge",ne:"Top right corner",nw:"Top left corner",s:"Bottom edge",se:"Bottom right corner",sw:"Bottom left corner",w:"Left edge"},f=1;function J(e,t,n,i,o){let a=Ph(e.turns,t),r=Zy(ad(e,t),e,t),l=H(e,t),u=l===null?Z(r,a,n,i,o):ee(r,a,n,i,o,l);return I(e,t,u)}function K(e,t,n,i){let o=Ph(e.turns,t),a=Zy(ad(e,t),e,t);return I(e,t,{...a,x:h(Math.round(a.x+n),0,o.width-a.width),y:h(Math.round(a.y+i),0,o.height-a.height)})}function lI(e,t,n,i,o){return n==="move"?K(e,t,i,o):J(e,t,n,i,o)}function I(e,t,n){let i=d(e),o=q(n,e,t);return i.crop=E(o,t)?null:o,_(i,t)}function Z(e,t,n,i,o){let{x:a,y:r}=e,l=e.x+e.width,u=e.y+e.height;if(n.includes("w"))a=h(Math.round(a+i),0,l-f);if(n.includes("e"))l=h(Math.round(l+i),a+f,t.width);if(n.includes("n"))r=h(Math.round(r+o),0,u-f);if(n.includes("s"))u=h(Math.round(u+o),r+f,t.height);return{height:u-r,width:l-a,x:a,y:r}}function ee(e,t,n,i,o,a){let r=n.includes("w"),l=n.includes("e"),u=n.includes("n"),p=n.includes("s"),P=l?i:r?-i:0,S=p?o:u?-o:0,C=(l||r)&&(!(u||p)||Math.abs(P)>=Math.abs(S)*a)?e.width+P:(e.height+S)*a,g=r?e.x+e.width:l?e.x:e.x+e.width/2,m=u?e.y+e.height:p?e.y:e.y+e.height/2,v=r?g:l?t.width-g:2*Math.min(g,t.width-g),N=u?m:p?t.height-m:2*Math.min(m,t.height-m),D=Math.min(v,N*a),M=Math.min(Math.max(C,Math.max(f,f*a)),D),x=Math.max(f,Math.round(M)),R=Math.max(f,Math.round(M/a)),L=r?g-x:l?g:Math.round(g-x/2),F=u?m-R:p?m:Math.round(m-R/2);return{height:R,width:x,x:h(L,0,t.width-x),y:h(F,0,t.height-R)}}function H(e,t){if(e.aspect==="free")return null;if(e.aspect==="original"){let o=Ph(e.turns,t);return o.width/o.height}let[n,i]=e.aspect.split(":");return Number(n)/Number(i)}function CM(e,t,n){let i={...d(e),aspect:n},o=H(i,t);if(o===null)return i;let a=Ph(e.turns,t),r=Zy(ad(e,t),e,t),l=Math.min(a.width,a.height*o),u=Math.max(f,Math.round(l)),p=Math.max(f,Math.round(l/o));return I(i,t,{height:p,width:u,x:h(Math.round(r.x+r.width/2-u/2),0,a.width-u),y:h(Math.round(r.y+r.height/2-p/2),0,a.height-p)})}function h(e,t,n){return Math.min(Math.max(e,t),n)}function _(e,t){if(e.width!==null&&e.width>=Yy(e,t).width)e.width=null;return e}function kM(e,t){let n=d(e);return n.turns=G[(e.turns+t+4)%4],n.flipH=e.flipV,n.flipV=e.flipH,n.aspect=Q[e.aspect],n.width=null,n}function EM(e,t){let n=d(e);if(t==="h")n.flipH=!e.flipH;else n.flipV=!e.flipV;return n}function cI(e,t,n){let i=d(e);return i.width=n===null||!Number.isFinite(n)||n<1?null:Math.round(n),_(i,t)}var te={max:200,min:0},ne={max:100,min:1};function TM(e,t,n){let i=d(e),o=t==="quality"?ne:te;return i[t]=Number.isFinite(n)?h(Math.round(n),o.min,o.max):e[t],i}function dI(e,t,n){let i=Yy(e,t).width,o=null;for(let a of n)if(Number.isFinite(a)&&a>=1&&a<i&&(o===null||a>o))o=Math.round(a);return o}var ie=100;function $_(e=W){return{future:[],past:[],present:d(e)}}function oe(e,t){return JSON.stringify(d(e))===JSON.stringify(d(t))}function $M(e,t){if(oe(e.present,t))return e;return{future:[],past:[...e.past,e.present].slice(-ie),present:d(t)}}function LM(e){let t=e.past.at(-1);if(t===void 0)return e;return{future:[e.present,...e.future],past:e.past.slice(0,-1),present:t}}function RM(e){let[t,...n]=e.future;if(t===void 0)return e;return{future:n,past:[...e.past,e.present],present:t}}
|
|
2
|
+
export{fg,_M,sI,I1,C_,SM,k_,aI,ad,N1,vf,Yy,E_,T_,Ph,Zy,mg,D1,lI,CM,kM,EM,cI,TM,dI,$_,$M,LM,RM};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=D0538BAB23C2535E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-zzgp5yka.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p,
|
|
1
|
+
import{p,l,f}from"./iframe-entry-54kwwhmg.js";import{t}from"./iframe-entry-m24fza30.js";var j=150,R=6,h=4,w=new WeakMap,g=new WeakMap;function D(e,n){let o=g.get(e);if(!o){let s=new Set,u=(c)=>{if(!(c instanceof KeyboardEvent)||c.key!=="Escape")return;for(let d of s)d()};e.addEventListener("keydown",u,!0),o={dismiss:s,listener:u},g.set(e,o)}let{dismiss:i,listener:r}=o;return i.add(n),()=>{if(i.delete(n),i.size===0&&g.get(e)?.listener===r)e.removeEventListener("keydown",r,!0),g.delete(e)}}function G(e){try{return e.matches(":popover-open")}catch{return!1}}function U(e,n){if(n)return!1;if(!(e instanceof Element))return!0;try{return e.matches(":focus-visible")}catch{return!0}}var v=new WeakMap;function K(){return t(globalThis.HTMLButtonElement)&&"interestForElement"in HTMLButtonElement.prototype}function J(e,n){return K()&&e.id!==""&&n.getAttribute("interestfor")===e.id}function Q(e,n){l(e,n)}function V(e){f(e)}function X(e,n){if(J(e,n))return()=>{};let o=e.getRootNode(),i=null,r=null,s=!1,u=!1,c=!1,d=!1,m=!1,a=()=>{if(i!==null)clearTimeout(i),i=null;if(r!==null)clearTimeout(r),r=null},M=()=>{a(),m=!0,Q(e,n)},y=()=>{m=!1,V(e)},H=()=>{if(a(),s||u||c)return;y()},I=()=>{a();let T="delay"in e?Number(e.delay)||0:0;i=setTimeout(M,T)},S=()=>{a(),r=setTimeout(H,j)},O=()=>{s=!0,I()},A=()=>{s=!1,d=!1,S()},B=()=>{d=!0},N=()=>{d=!1},P=(T)=>{let E=U(T.target,d);if(d=!1,!E)return;c=!0,M()},q=()=>{c=!1,H()},C=()=>{u=!0,a()},z=()=>{u=!1,S()},W=()=>{if(!m&&!G(e))return;a(),y()},x=[[n,"pointerenter",O],[n,"pointerleave",A],[n,"pointerdown",B],[n,"pointerup",N],[n,"focusin",P],[n,"focusout",q],[e,"pointerenter",C],[e,"pointerleave",z]];for(let[T,E,b]of x)T.addEventListener(E,b,!0);let _=D(o,W);return()=>{a(),_();for(let[T,E,b]of x)T.removeEventListener(E,b,!0)}}function k(e,n){let o=n.getRootNode(),i=e.for??"",r=i===""?null:o.getElementById?.(i)??null;if(r)return r;let s=n.id;if(!/^[\w-]+$/.test(s))return null;return o.querySelector(`[interestfor="${s}"]`)}function L(e,n){let o=k(e,n);if(o)return o;let i=n.getRootNode(),r=n.id;if(!/^[\w-]+$/.test(r))return null;return i.querySelector(`[aria-describedby~="${r}"]`)}function Y(e,n){let o=L(e,n);if(!o)return;let i=o.getBoundingClientRect();if(i.width===0&&i.height===0)return;e.x=Math.round(i.left),e.y=Math.round(i.bottom+R),e.flipped=!1;let r=()=>{let s=n.getBoundingClientRect();if(s.width===0&&s.height===0)return;if(s.right>window.innerWidth-h)e.x=Math.max(h,Math.round(window.innerWidth-s.width-h));if(s.bottom>window.innerHeight-h)e.y=Math.max(h,Math.round(i.top-s.height-R)),e.flipped=!0};if(t(globalThis.requestAnimationFrame))requestAnimationFrame(r);else r()}function Z(e,n){v.get(e)?.();let o=L(e,n),i=()=>{if(!o||e.anchored!==!0)return;let m=n.getBoundingClientRect(),a=o.getBoundingClientRect();if(m.width===0&&m.height===0)return;e.flipped=m.bottom<=a.top};if(!o||!t(globalThis.requestAnimationFrame))return i(),()=>{};let r=null,s=()=>{r=null,i()},u=()=>{if(r===null)r=requestAnimationFrame(s)};window.addEventListener("scroll",u,{capture:!0,passive:!0}),window.addEventListener("resize",u);let c=t(globalThis.ResizeObserver)?new ResizeObserver(u):null;if(c)c.observe(n),c.observe(o);let d=()=>{if(r!==null)cancelAnimationFrame(r),r=null;if(window.removeEventListener("scroll",u,{capture:!0}),window.removeEventListener("resize",u),c?.disconnect(),v.get(e)===d)v.delete(e)};return v.set(e,d),u(),d}function te(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i="newState"in n&&n.newState==="open",r="source"in n?n.source:null,s=r instanceof Element?r:L(e,o);if(e.anchored=i&&s!==null,!i)e.flipped=!1}function oe(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i="newState"in n&&n.newState==="open";if(e.open=i,!i){v.get(e)?.();return}if(e.anchored===!0&&p())Z(e,o);else Y(e,o)}function ie(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i=k(e,o);if(!i)return;w.get(e)?.dispose(),w.set(e,{dispose:X(o,i),tip:o})}function re(e){v.get(e)?.();let n=w.get(e);if(!n)return;queueMicrotask(()=>{if(w.get(e)!==n)return;if(n.tip.isConnected)return;n.dispose(),w.delete(e)})}var F=0;function le(e,n){F+=1,e.uid=`${n.localName}-${F}`}export{j as TOOLTIP_HIDE_GRACE_MS,X as bindTooltip,Z as measureAnchoredFlip,le as mintHintId,te as onTooltipBeforeToggle,ie as onTooltipReady,oe as onTooltipToggle,re as onTooltipUnmount,Y as placeTooltip,K as supportsInterestInvokers};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
4
|
-
//# sourceMappingURL=tooltip-
|
|
3
|
+
//# debugId=25C4A76890B55CFF64756E2164756E21
|
|
4
|
+
//# sourceMappingURL=tooltip-gtx40bjg.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t}from"./iframe-entry-
|
|
1
|
+
import{t}from"./iframe-entry-m24fza30.js";var p="jx-tree",y="jx-tree-item",L=new WeakMap,H=new WeakMap,T=new WeakMap;function b(n){let e=n.currentTarget;return e instanceof HTMLElement&&e.localName===p?e:null}function v(n,e){return e instanceof Element&&e.closest(p)===n}function h(n,e,r){let o=n[e];return o===void 0?n.getAttribute(r)??"":String(o)}function u(n){return h(n,"value","value")}function g(n){let e=Number(h(n,"level","aria-level"));return Number.isFinite(e)&&e>=1?Math.trunc(e):1}function M(n){let e=h(n,"expanded","aria-expanded");return e==="true"||e==="false"?e:""}function E(n){return n.disabled===void 0?n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true":n.disabled===!0}function N(n){let e=h(n,"label","label");return e===""?n.textContent:e}function K(n,e={}){let r=[...n.querySelectorAll(y)].filter((o)=>o.closest(p)===n);return e.includeDisabled?r:r.filter((o)=>!E(o))}function x(n){let e=K(n,{includeDisabled:!0});if(e.length===0)return;let r=String(n.current??""),o=e.filter((l)=>!E(l)),a=o.find((l)=>u(l)===r)??o[0]??null;for(let l of e)l.caret=l===a;F(n,r,a)}function P(n,e){let r=n.ownerDocument,o=r.activeElement;if(o instanceof Node&&n.contains(o))return!0;return(o===null||o===r.body)&&e.held!==null&&!e.held.isConnected}function F(n,e,r){let o=T.get(n);if(!o)return;if(!P(n,o)){T.delete(n);return}if(e===o.from||r===null||u(r)!==e)return;if(r.focus(),n.ownerDocument.activeElement===r)T.delete(n)}function W(n){if(H.has(n))return;let e=new MutationObserver(()=>{x(n)});e.observe(n,{attributeFilter:["tabindex"],attributes:!0,childList:!0,subtree:!0}),H.set(n,e)}function z(n){let e=String(n.current??""),r=L.get(n);if(r)x(r);return e}function G(n,e){let r=b(e);if(!r)return;L.set(n,r),x(r),W(r)}function j(n,e){return n.findIndex((r)=>r===e||e instanceof Node&&r.contains(e))}function f(n,e,r){n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))}function O(n,e,r){if(e.current=u(r),x(n),r.focus(),t(r.scrollIntoView))r.scrollIntoView({block:"nearest"});f(n,"change",u(r))}function S(n){return Number(n.padtop??0)>0}function D(n){return Number(n.padbottom??0)>0}function A(n,e){T.set(n,{from:String(e.current??""),held:n.ownerDocument.activeElement})}function I(n,e,r){A(n,e),f(n,"move",{from:String(e.current??""),key:r})}function R(n){return S(n)||D(n)}function V(n,e,r){A(n,e),f(n,"typeahead",{char:r,from:String(e.current??"")})}function w(n,e,r,o,a){let l=e.multiple===!0?o:"replace",d=String(e.anchor??""),i=l==="range"?d===""?a||r:d:r;e.anchor=i,f(n,"select",{anchor:i,mode:l,value:r})}function C(n){if(n.shiftKey)return"range";return n.ctrlKey||n.metaKey?"toggle":"replace"}function _(n){return n.key.length===1&&!n.ctrlKey&&!n.metaKey&&!n.altKey?n.key.toLowerCase():null}function q(n,e,r){let o=n.map((a)=>N(a).trim().toLowerCase());for(let a=1;a<=o.length;a++){let l=(e+a)%o.length;if(o[l].startsWith(r))return l}return-1}function B(n,e){let r=g(n[e]);for(let o=e-1;o>=0;o--)if(g(n[o])<r)return o;return-1}function J(n,e){let r=b(e);if(!r||!v(r,e.target))return;let o=K(r);if(o.length===0)return;let a=j(o,e.target),l=String(n.current??""),d=e.ctrlKey||e.metaKey,i=o[a],s=null;switch(e.key){case"ArrowDown":{s={key:e.key,select:!d,to:a===-1?0:a+1};break}case"ArrowUp":{s={key:e.key,select:!d,to:a===-1?o.length-1:a-1};break}case"Home":case"End":{if(e.key==="Home"?S(n):D(n)){e.preventDefault(),e.stopPropagation(),I(r,n,e.key);return}s={key:e.key,select:!0,to:e.key==="Home"?0:o.length-1};break}case"ArrowRight":{if(!i)return;let c=M(i);if(c==="")return;if(c==="false"){e.preventDefault(),e.stopPropagation(),f(r,"expand",{expanded:!0,value:u(i)});return}let m=o[a+1];if(m&&g(m)<=g(i))return;s={key:e.key,select:!0,to:a+1};break}case"ArrowLeft":{if(!i)return;if(M(i)==="true"){e.preventDefault(),e.stopPropagation(),f(r,"expand",{expanded:!1,value:u(i)});return}let c=B(o,a);if(c===-1&&g(i)===1)return;s={key:e.key,select:!0,to:c};break}case"Enter":{if(!i)return;e.preventDefault(),e.stopPropagation(),f(r,"activate",u(i));return}case" ":{if(!i)return;e.preventDefault(),e.stopPropagation(),w(r,n,u(i),n.multiple===!0?"toggle":"replace",l);return}default:{let c=_(e);if(c===null)return;if(R(n)){e.preventDefault(),e.stopPropagation(),V(r,n,c);return}let m=q(o,a,c);if(m===-1)return;s={key:e.key,select:!0,to:m}}}e.preventDefault(),e.stopPropagation();let k=o[s.to];if(!k){if(s.to<0?S(n):D(n))I(r,n,s.key);return}if(O(r,n,k),s.select)w(r,n,u(k),C(e),l)}function Q(n,e){let r=b(e);if(!r||!(e.target instanceof Element))return;let o=e.target.closest(y);if(!o||o.closest(p)!==r||E(o))return;let a=String(n.current??"");O(r,n,o),w(r,n,u(o),C(e),a)}function X(n,e){let r=b(e);if(!r||!(e.target instanceof Element))return;let o=e.target.closest(y);if(!o||o.closest(p)!==r||E(o))return;f(r,"activate",u(o))}function Y(n,e){let r=b(e);if(!r||!v(r,e.target)||!(e.target instanceof Element))return;e.stopPropagation();let o=e.target.closest(y);if(!o||E(o))return;f(r,"expand",{expanded:M(o)!=="true",value:u(o)})}export{z as applyCurrent,K as itemsOf,Q as onTreeClick,X as onTreeDblClick,J as onTreeKeydown,G as onTreeMount,Y as onTreeToggle,x as syncTree};
|
|
2
2
|
|
|
3
3
|
//# debugId=3A07049B25E0DD9964756E2164756E21
|
|
4
|
-
//# sourceMappingURL=tree-
|
|
4
|
+
//# sourceMappingURL=tree-a19s1c05.js.map
|