@jxsuite/studio 10.5.0 → 10.6.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/data/locales/en/elements.json +434 -0
- package/data/webdata.json +116 -139
- package/dist/chunks/{2020-7sx2vexa.js → 2020-rqm7qrje.js} +3 -3
- package/dist/chunks/adapter-cyy8vbcx.js +4 -0
- package/dist/chunks/add-new-flow-8cgtejv2.js +4 -0
- package/dist/chunks/{cf-account-picker-ajh60k54.js → cf-account-picker-v3qd2dhw.js} +3 -3
- package/dist/chunks/cf-settings-1fnw874z.js +4 -0
- package/dist/chunks/{color-area-gbcftzh3.js → color-area-frd9y9q6.js} +2 -2
- package/dist/chunks/{color-field-85136598.js → color-field-rebpbe33.js} +3 -3
- package/dist/chunks/{color-slider-w1s3ndd8.js → color-slider-6bzmk3s7.js} +2 -2
- package/dist/chunks/color-t2bnnj8y.js +4 -0
- package/dist/chunks/{combobox-dk98wc5x.js → combobox-c49x7gf1.js} +2 -2
- package/dist/chunks/components-y8yhdd7d.js +4 -0
- package/dist/chunks/content-source-9e7qvmsf.js +4 -0
- package/dist/chunks/convert-to-repeater-pd2w4z21.js +4 -0
- package/dist/chunks/editor-mb9jzdrw.js +4 -0
- package/dist/chunks/entry-commands-at0wnx3f.js +4 -0
- package/dist/chunks/extension-sections-4z9qq0gh.js +4 -0
- package/dist/chunks/file-ops-dtdvjmza.js +4 -0
- package/dist/chunks/files-8pf70854.js +4 -0
- package/dist/chunks/format-host-fd3m2y2a.js +4 -0
- package/dist/chunks/fs-events-hrk29vcv.js +4 -0
- package/dist/chunks/grid-open-bh74v82z.js +4 -0
- package/dist/chunks/{grid-view-0v4hjspb.js → grid-view-a51mgzmq.js} +10 -10
- package/dist/chunks/{icons-j9eksgew.js → icons-qp8fn1k8.js} +2 -2
- package/dist/chunks/{iframe-entry-4zqtn3ry.js → iframe-entry-mpwe5pwk.js} +4 -4
- package/dist/chunks/{iframe-entry-2x9bn5ng.js → iframe-entry-msd43x9h.js} +4 -4
- package/dist/chunks/iframe-entry-rt8jz5t8.js +5 -0
- package/dist/chunks/{iframe-entry-54kwwhmg.js → iframe-entry-v40cr813.js} +2 -2
- package/dist/chunks/iframe-host-q0s0wwy3.js +4 -0
- package/dist/chunks/{image-bake-m8gzaan9.js → image-bake-q9ajdjsj.js} +3 -3
- package/dist/chunks/{image-editor-0afyws7c.js → image-editor-ke9std9b.js} +2 -2
- package/dist/chunks/index-57ang7ma.js +4 -0
- package/dist/chunks/index-eytr7av4.js +17 -0
- package/dist/chunks/{index-2q88g57p.js → index-x495reff.js} +3 -3
- package/dist/chunks/{javascript-5sxtr1g7.js → javascript-qe34bvaz.js} +3 -3
- package/dist/chunks/{jsonMode-m6sf47hq.js → jsonMode-m8rseh31.js} +8 -8
- package/dist/chunks/jx-validate-bbd1mary.js +4 -0
- package/dist/chunks/layers-panel-wcjtdqsa.js +4 -0
- package/dist/chunks/layers-yscpys6q.js +4 -0
- package/dist/chunks/{listbox-k5p41049.js → listbox-tktzq5xj.js} +2 -2
- package/dist/chunks/lit-html-qm5wbhqz.js +4 -0
- package/dist/chunks/media-library-2hfff88g.js +4 -0
- package/dist/chunks/media-open-4pb05cne.js +4 -0
- package/dist/chunks/media-picker-bzktmmwr.js +4 -0
- package/dist/chunks/{menu-26nez152.js → menu-xc3cbgsd.js} +2 -2
- package/dist/chunks/{monaco-binding-1s2b8snq.js → monaco-binding-7t38arh9.js} +3 -3
- package/dist/chunks/monaco-buffer-3vz94c9f.js +4 -0
- package/dist/chunks/monaco-setup-fstdew02.js +4 -0
- package/dist/chunks/notify-gbdcckrh.js +4 -0
- package/dist/chunks/parse-fpdzgk4c.js +4 -0
- package/dist/chunks/platform-9g72gdqr.js +4 -0
- package/dist/chunks/{popover-fhdnt4be.js → popover-cnmsav6b.js} +2 -2
- package/dist/chunks/publish-panel-91x1cb5d.js +4 -0
- package/dist/chunks/publish-quick-e2dmf7eg.js +4 -0
- package/dist/chunks/publish-workspace-1x8mnzrj.js +4 -0
- package/dist/chunks/quick-search-2m4y6p1x.js +4 -0
- package/dist/chunks/references-yg1g9rwx.js +4 -0
- package/dist/chunks/right-panel-7mfyhzrk.js +4 -0
- package/dist/chunks/source-control-rrc4jgp5.js +4 -0
- package/dist/chunks/{split-qh21j2b0.js → split-d15yencd.js} +2 -2
- package/dist/chunks/{studio-r5g7fx7q.js → studio-0jhhznxy.js} +6 -6
- package/dist/chunks/studio-0nb57pjg.js +7 -0
- package/dist/chunks/{studio-bpzwhn88.js → studio-0wa4wv4s.js} +4 -4
- package/dist/chunks/studio-0z8kp4xk.js +5 -0
- package/dist/chunks/{studio-jqvke4ac.js → studio-18gc5t3v.js} +4 -4
- package/dist/chunks/{studio-xh6rf05g.js → studio-1b79rpcb.js} +4 -4
- package/dist/chunks/studio-211q5j7m.js +4 -0
- package/dist/chunks/studio-213pyfxh.js +16 -0
- package/dist/chunks/studio-2b1smjvp.js +5 -0
- package/dist/chunks/{studio-dst8y8vh.js → studio-2v6tc9jp.js} +4 -4
- package/dist/chunks/studio-30j0wz99.js +5 -0
- package/dist/chunks/studio-3kmqhwtt.js +5 -0
- package/dist/chunks/studio-44drsmhw.js +5 -0
- package/dist/chunks/{studio-d5f7sskn.js → studio-495b6f2r.js} +4 -4
- package/dist/chunks/{studio-g65t6svn.js → studio-4gthb2fd.js} +4 -4
- package/dist/chunks/{studio-bmwgj8ez.js → studio-4xadhxj1.js} +4 -4
- package/dist/chunks/{studio-zav9hgb3.js → studio-52mzbxqm.js} +4 -4
- package/dist/chunks/{studio-thgexj3w.js → studio-56mmnsw8.js} +7 -7
- package/dist/chunks/studio-59hz8f4r.js +5 -0
- package/dist/chunks/{studio-bk0anq3b.js → studio-5k9mfafh.js} +3 -3
- package/dist/chunks/{studio-qarg1xf9.js → studio-5qez462c.js} +5 -5
- package/dist/chunks/studio-6tnpg0vx.js +5 -0
- package/dist/chunks/studio-6w8mt734.js +6 -0
- package/dist/chunks/studio-7hm04x5z.js +5 -0
- package/dist/chunks/studio-8atmfjjm.js +7 -0
- package/dist/chunks/{studio-69g6a0jn.js → studio-8n99z71s.js} +4 -4
- package/dist/chunks/{studio-ep1384t9.js → studio-8vmad6x2.js} +4 -4
- package/dist/chunks/{studio-6sxnqqw8.js → studio-93p5k4r4.js} +4 -4
- package/dist/chunks/{studio-hy936516.js → studio-9gb0m81w.js} +4 -4
- package/dist/chunks/{studio-ek4fb4eb.js → studio-a4ymg4vd.js} +4 -4
- package/dist/chunks/studio-anc8067x.js +5 -0
- package/dist/chunks/{studio-ketrgtph.js → studio-dbdt67kr.js} +5 -5
- package/dist/chunks/studio-dbex091t.js +5 -0
- package/dist/chunks/{studio-nngc45ct.js → studio-dj8ctxey.js} +4 -4
- package/dist/chunks/{studio-pgze9p34.js → studio-ed9bz68j.js} +5 -5
- package/dist/chunks/{studio-4ncxzw5m.js → studio-fe2d1fp5.js} +4 -4
- package/dist/chunks/{studio-m8hesdrw.js → studio-fgp4cyy3.js} +4 -4
- package/dist/chunks/{studio-151kgn69.js → studio-ft706q02.js} +4 -4
- package/dist/chunks/{studio-pv1ts08p.js → studio-g79s1dyg.js} +5 -5
- package/dist/chunks/{studio-zkkt13qd.js → studio-gahswxp4.js} +4 -4
- package/dist/chunks/{studio-x5ffyssw.js → studio-gbqc12bk.js} +4 -4
- package/dist/chunks/{studio-4jy967rj.js → studio-gxphbetb.js} +5 -5
- package/dist/chunks/studio-hdf01j7q.js +7 -0
- package/dist/chunks/studio-hf259xzd.js +48 -0
- package/dist/chunks/studio-jbva4wxw.js +5 -0
- package/dist/chunks/{studio-td3h1644.js → studio-jj9gf1qc.js} +4 -4
- package/dist/chunks/studio-jsjg3mjv.js +5 -0
- package/dist/chunks/studio-jtvb8hd7.js +5 -0
- package/dist/chunks/{studio-c72v1kwc.js → studio-kp4vzrct.js} +4 -4
- package/dist/chunks/{studio-s4k1v7dt.js → studio-kpx02gaa.js} +6 -6
- package/dist/chunks/{studio-3yr1zdp9.js → studio-kv1728ex.js} +8 -8
- package/dist/chunks/studio-m25ry0mf.js +5 -0
- package/dist/chunks/studio-mcbwmkyh.js +5 -0
- package/dist/chunks/studio-meajkr51.js +5 -0
- package/dist/chunks/studio-mkjrjpr2.js +6 -0
- package/dist/chunks/{studio-nv5eq0f7.js → studio-mr084886.js} +181 -181
- package/dist/chunks/{studio-43pynnhz.js → studio-mrb10hv3.js} +4 -4
- package/dist/chunks/{studio-7qqb7hb8.js → studio-nhpg405j.js} +4 -4
- package/dist/chunks/{studio-n271vdsg.js → studio-nsec0hxm.js} +41 -41
- package/dist/chunks/{studio-ztzf8mce.js → studio-nv0mh0p5.js} +4 -4
- package/dist/chunks/studio-pafmb06w.js +5 -0
- package/dist/chunks/{studio-4s5bka8t.js → studio-pgftd79b.js} +4 -4
- package/dist/chunks/{studio-wn2cmf9q.js → studio-pk961xgz.js} +4 -4
- package/dist/chunks/studio-pzbr7g05.js +5 -0
- package/dist/chunks/{studio-15mfah02.js → studio-qcc5hsw2.js} +6 -6
- package/dist/chunks/studio-qfq58c8n.js +5 -0
- package/dist/chunks/{studio-j3bq30yz.js → studio-qvb2jr83.js} +4 -4
- package/dist/chunks/studio-r85zw6ay.js +5 -0
- package/dist/chunks/{studio-f69wcajk.js → studio-s0kwce5w.js} +5 -5
- package/dist/chunks/studio-s6ymkf3q.js +14 -0
- package/dist/chunks/{studio-8ncm9zwx.js → studio-s7p5ccxa.js} +4 -4
- package/dist/chunks/{studio-zzgp5yka.js → studio-s9jjap3x.js} +4 -4
- package/dist/chunks/{studio-ber1dgte.js → studio-t5hde1ws.js} +4 -4
- package/dist/chunks/studio-vj9yv897.js +5 -0
- package/dist/chunks/{studio-ajfq4fmr.js → studio-wmak8xjw.js} +4 -4
- package/dist/chunks/{studio-k05g7efh.js → studio-wqsmvtqj.js} +4 -4
- package/dist/chunks/studio-x3z3rhej.js +5 -0
- package/dist/chunks/{studio-7qr8k0v2.js → studio-xb55kpmy.js} +4 -4
- package/dist/chunks/{studio-f3awr5nc.js → studio-xxtdajmv.js} +7 -7
- package/dist/chunks/{studio-1a7zshnv.js → studio-xxttcym1.js} +4 -4
- package/dist/chunks/{studio-czpmzs9r.js → studio-y2zsnzye.js} +7 -7
- package/dist/chunks/{studio-9f5vcb4w.js → studio-y3tjh2xb.js} +3 -3
- package/dist/chunks/studio-y4f1rdsj.js +5 -0
- package/dist/chunks/studio-ybkd5w8k.js +5 -0
- package/dist/chunks/{studio-cv6gnjqd.js → studio-yetr4gg1.js} +4 -4
- package/dist/chunks/{studio-ehj3csbm.js → studio-z295anhs.js} +5 -5
- package/dist/chunks/{studio-pte5w7rf.js → studio-z89e6wpg.js} +8 -8
- package/dist/chunks/{studio-4z0cdh16.js → studio-zbwr6prc.js} +3 -3
- package/dist/chunks/{studio-w3aafbpk.js → studio-zdbsv5q2.js} +3 -3
- package/dist/chunks/{studio-eq5vqn1q.js → studio-zvthj8hg.js} +4 -4
- package/dist/chunks/toast-2kn2vrn4.js +4 -0
- package/dist/chunks/{toast-host-g3r2s0kn.js → toast-host-3rxeyj3d.js} +3 -3
- package/dist/chunks/{tooltip-gtx40bjg.js → tooltip-ghkxkasp.js} +2 -2
- package/dist/chunks/{tree-a19s1c05.js → tree-vw4nc63s.js} +2 -2
- package/dist/chunks/{tsMode-3f116hth.js → tsMode-7gngmamr.js} +7 -7
- package/dist/chunks/workspace-gv0hxgsm.js +4 -0
- package/dist/chunks/workspace-home-j7e0mjy5.js +4 -0
- package/dist/chunks/{ws-client-cb49m87s.js → ws-client-vs11sxc5.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +84 -83
- package/dist/studio.js +80 -80
- package/package.json +12 -12
- package/src/browse/preview-style.ts +2 -1
- package/src/canvas/canvas-render.ts +6 -1
- package/src/canvas/iframe-drop.ts +84 -1
- package/src/canvas/iframe-entry.ts +9 -6
- package/src/canvas/iframe-render.ts +13 -0
- package/src/collab/collab-session.ts +2 -2
- package/src/commands/levels.ts +1 -1
- package/src/create/add-new-flow.ts +2 -1
- package/src/editor/convert-targets.ts +2 -23
- package/src/editor/slash-menu.ts +35 -17
- package/src/files/files.ts +18 -0
- package/src/format/format-choices.ts +5 -5
- package/src/format/format-host.ts +35 -3
- package/src/grid/redirects-grid.ts +4 -4
- package/src/locale/element-names.ts +131 -0
- package/src/panels/dnd.ts +3 -1
- package/src/panels/elements-panel.ts +93 -36
- package/src/panels/imports-panel.ts +3 -2
- package/src/panels/navigator-panels.ts +10 -10
- package/src/panels/panel-registry.ts +3 -3
- package/src/panels/site-panel.ts +2 -1
- package/src/panels/style-panel.ts +2 -1
- package/src/panels/styles-panel.ts +2 -2
- package/src/platforms/cloud.ts +5 -2
- package/src/services/ai-command-tools.ts +2 -1
- package/src/services/ai-project-tools.ts +18 -5
- package/src/services/jxn-language.ts +110 -0
- package/src/services/model-uri.ts +3 -0
- package/src/services/monaco-setup.ts +6 -2
- package/src/settings/contributed-section.ts +2 -1
- package/src/settings/extension-commands.ts +2 -1
- package/src/settings/general-settings.ts +2 -2
- package/src/settings/settings-document.ts +5 -5
- package/src/shell.ts +1 -1
- package/src/studio.ts +28 -11
- package/src/style/variables-view.ts +2 -2
- package/src/surfaces/panel-elements.json +466 -206
- package/src/surfaces/panel-elements.ts +61 -25
- package/src/tabs/project-config.ts +13 -13
- package/src/tabs/tab.ts +7 -2
- package/src/types.ts +11 -2
- package/src/view.ts +9 -2
- package/src/workspace/tab-workspace.ts +2 -2
- package/src/workspace/workspace-back.ts +2 -2
- package/dist/chunks/adapter-12dxr3z7.js +0 -4
- package/dist/chunks/add-new-flow-any4pw2q.js +0 -4
- package/dist/chunks/cf-settings-hbj16kh3.js +0 -4
- package/dist/chunks/color-thzpppyc.js +0 -4
- package/dist/chunks/components-a98hzqw9.js +0 -4
- package/dist/chunks/content-source-jq3fjs3w.js +0 -4
- package/dist/chunks/convert-to-repeater-g66r6qp1.js +0 -4
- package/dist/chunks/editor-rth1rzj8.js +0 -4
- package/dist/chunks/entry-commands-02j0s19w.js +0 -4
- package/dist/chunks/extension-sections-rqrs7dr0.js +0 -4
- package/dist/chunks/file-ops-6a49er4c.js +0 -4
- package/dist/chunks/files-b2p9y0yz.js +0 -4
- package/dist/chunks/format-host-7xe57k1s.js +0 -4
- package/dist/chunks/fs-events-0xsy168g.js +0 -4
- package/dist/chunks/grid-open-h3q4fjy5.js +0 -4
- package/dist/chunks/iframe-entry-m24fza30.js +0 -5
- package/dist/chunks/iframe-host-8jcmaktg.js +0 -4
- package/dist/chunks/index-7nj2375a.js +0 -4
- package/dist/chunks/jx-validate-808zgbgy.js +0 -4
- package/dist/chunks/layers-0ffdtqjn.js +0 -4
- package/dist/chunks/layers-panel-rw62wtvf.js +0 -4
- package/dist/chunks/lit-html-9bz9rcfv.js +0 -4
- package/dist/chunks/media-library-2a5hdbek.js +0 -4
- package/dist/chunks/media-open-069kzhj4.js +0 -4
- package/dist/chunks/media-picker-4p4pd28y.js +0 -4
- package/dist/chunks/monaco-buffer-m9fd2dka.js +0 -4
- package/dist/chunks/monaco-setup-e0crh3v6.js +0 -4
- package/dist/chunks/notify-re3js157.js +0 -4
- package/dist/chunks/parse-hee7ne9b.js +0 -4
- package/dist/chunks/platform-rywy3tkg.js +0 -4
- package/dist/chunks/publish-panel-czkpg8m4.js +0 -4
- package/dist/chunks/publish-quick-b9wbhqj6.js +0 -4
- package/dist/chunks/publish-workspace-yy6d23b7.js +0 -4
- package/dist/chunks/quick-search-tp7pjnmv.js +0 -4
- package/dist/chunks/references-wd2yj8s1.js +0 -4
- package/dist/chunks/right-panel-x971k0zc.js +0 -4
- package/dist/chunks/source-control-k4p00hpe.js +0 -4
- package/dist/chunks/studio-1d8m5s38.js +0 -16
- package/dist/chunks/studio-35pmfjtx.js +0 -5
- package/dist/chunks/studio-44xqe0b7.js +0 -4
- package/dist/chunks/studio-48yzqzqr.js +0 -5
- package/dist/chunks/studio-5rq3e4q5.js +0 -5
- package/dist/chunks/studio-6hcfm9q3.js +0 -5
- package/dist/chunks/studio-6mf31e16.js +0 -5
- package/dist/chunks/studio-8w5pa88p.js +0 -7
- package/dist/chunks/studio-9c6cbq2c.js +0 -4
- package/dist/chunks/studio-aaw7wxv8.js +0 -5
- package/dist/chunks/studio-afx9brsc.js +0 -5
- package/dist/chunks/studio-dmgh2rrj.js +0 -5
- package/dist/chunks/studio-erjccagy.js +0 -5
- package/dist/chunks/studio-ex1644g2.js +0 -5
- package/dist/chunks/studio-gw83z798.js +0 -7
- package/dist/chunks/studio-j52ks8q7.js +0 -5
- package/dist/chunks/studio-kefs4sz4.js +0 -5
- package/dist/chunks/studio-m3jrjfhy.js +0 -14
- package/dist/chunks/studio-n4pnf0sw.js +0 -5
- package/dist/chunks/studio-ncwx602y.js +0 -5
- package/dist/chunks/studio-nzp0sqjg.js +0 -5
- package/dist/chunks/studio-ph17an19.js +0 -5
- package/dist/chunks/studio-q509sqt8.js +0 -5
- package/dist/chunks/studio-s49y6m5b.js +0 -5
- package/dist/chunks/studio-t46rt6gx.js +0 -5
- package/dist/chunks/studio-veh91hjv.js +0 -5
- package/dist/chunks/studio-vswmz40d.js +0 -6
- package/dist/chunks/studio-w4mfaaam.js +0 -5
- package/dist/chunks/studio-x5py815g.js +0 -5
- package/dist/chunks/studio-z6s56dzz.js +0 -5
- package/dist/chunks/studio-ze1sm147.js +0 -7
- package/dist/chunks/studio-zn7ysyzb.js +0 -5
- package/dist/chunks/toast-w11qpkyz.js +0 -4
- package/dist/chunks/workspace-home-61n1jz3q.js +0 -4
- package/dist/chunks/workspace-sheek6zw.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
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{
|
|
1
|
+
import{Z}from"./studio-mkjrjpr2.js";import{p,we}from"./studio-1b79rpcb.js";import{TP,qn,Se,fi}from"./studio-ybkd5w8k.js";import{w}from"./studio-5k9mfafh.js";import{AO}from"./studio-g79s1dyg.js";import{Fn}from"./studio-yetr4gg1.js";import{ae}from"./studio-dbex091t.js";import{Km,u}from"./studio-3kmqhwtt.js";import{ec,Jb,Ii,Bd,bC}from"./studio-5qez462c.js";import{Ys}from"./studio-56mmnsw8.js";import{hs}from"./studio-jj9gf1qc.js";import{$s,Gs,y$}from"./studio-wmak8xjw.js";import{x}from"./studio-anc8067x.js";import{ce}from"./studio-nhpg405j.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=Ys({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(Z(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 Jb(t)}catch(o){return i.log(Z(o)),i.fail("Cloudflare did not answer.",{action:"publish.deploy"}),!1}if(a)return Bd(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 Bd(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("91x1cb5d"),import("./publish-panel-91x1cb5d.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("e2dmf7eg"),import("./publish-quick-e2dmf7eg.js"));e()},title:"Quick Publish"},{args:Se({tab:fi(Km,"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",Km),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("1x8mnzrj"),import("./publish-workspace-1x8mnzrj.js"));n(r)}},title:"Show Publish"}]}function rD(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&&ec()&&d()!==""}function R(){let e=Ii();return e?.productionUrl??e?.projectName??""}function b(e){return`studio/${hs(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").slice(0,48).replace(/-$/,"")||"changes"}`}function D(){return we()&&p().gitCommitBranch!==void 0}function C(){let e=f();return Gs()&&D()&&e!==""&&h()===e}function f(){return u.git.branches?.defaultBranch??""}function wb(){if(!y$())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 Sw(e){let t=wb();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 bm(e){return e==="review"&&wb()!==""?"live":e}function oD(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 ym(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"?wb():""}function A(){return(u.git.status?.files??[]).map((e)=>`${e.status}:${e.path}`).join("|")}function hS(){return we()&&p().buildSite!==void 0}async function sD(){if(!hS()||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: ${Z(t)}`}}function xb(){let e=[],t=bC();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."}),hS()){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 aD(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 lD(){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 Cw(e,t={}){let r=t.includeAll??!1,i=ym(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 TP();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 $s(),a}catch(o){let c=s?null:AO(o);if(c&&D()){if(u.git.loading=!1,await G(n,c))return!0;return u.git.error??=Z(o),!1}if(u.git.error=Z(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 $s(),!0}catch(o){if(u.git.error=Z(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(wb());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{rD,wb,Sw,bm,oD,ym,hS,sD,xb,aD,lD,Cw};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=DF10E41E07A9BEFA64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-nv0mh0p5.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{Sh}from"./studio-ybkd5w8k.js";import{Am}from"./studio-qcc5hsw2.js";import{x}from"./studio-anc8067x.js";import{n,S}from"./studio-0z8kp4xk.js";function n$(){return Object.keys(x?.projectConfig?.content??{})}function Js(e){let t=Am(e);if(!t)return null;if(/\.[a-z\d]+$/i.test(t.dir))return null;return{def:t.def,dir:t.dir,ext:t.ext,name:t.name,schema:t.def.schema??null}}function Xw(){return n$().map((e)=>Js(e)).filter((e)=>e!==null)}function ll(e){let t=Sh(e??null,x?.projectConfig);return t?Js(t.name):null}function oO(e){let t=Sh(e??null,x?.projectConfig),r=t?Am(t.name):null;if(!t||!r)return null;return{def:r.def,dir:r.dir,ext:r.ext,name:r.name,schema:t.schema}}function c(e){if(e===null||!S(e))return e;return JSON.parse(JSON.stringify(e))}function u(e){if(n(e.$ref))return"";switch(e.type){case"boolean":return!1;case"integer":case"number":return 0;case"array":return[];case"object":return i$(e);default:return""}}function i$(e){let t=e?.properties;if(!t)return{};let r=new Set(Array.isArray(e.required)?e.required:[]),o={};for(let[i,l]of Object.entries(t))if(l.default!==void 0)o[i]=c(l.default);else if(r.has(i))o[i]=u(l);return o}function sO(e,t){return(Array.isArray(e?.required)?e.required:[]).filter((o)=>t[o]===void 0)}
|
|
2
|
+
export{n$,Js,Xw,ll,oO,i$,sO};
|
|
3
|
+
|
|
4
|
+
//# debugId=A8588F9077F6DA2D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pafmb06w.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{n,
|
|
2
|
-
export{
|
|
1
|
+
import{n,f}from"./studio-0z8kp4xk.js";var t="jx.collab.v1";function VS(o){if(!f(o))return{offer:[],refused:null};let{collab:s,detail:l,protocols:e}=o;if(s===!1){let r=n(l)?l.trim():"";return{offer:[],refused:r||"This server has collaboration disabled."}}if(!Array.isArray(e)||e.length===0)return{offer:[],refused:null};if(e.includes(t))return{offer:[t],refused:null};let i=e.filter((r)=>n(r)).join(", ")||"none";return{offer:[],refused:`This server speaks collab envelope ${i}; this editor speaks ${t}.`}}
|
|
2
|
+
export{VS};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=8C54DDC890F0F4E064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pgftd79b.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p,
|
|
2
|
-
export{
|
|
1
|
+
import{p,we}from"./studio-1b79rpcb.js";import{Z}from"./studio-mkjrjpr2.js";import{Q}from"./studio-0z8kp4xk.js";function mh(){return we()&&Q(p().findReferences)}function u(e){return`${e.path??""}\x00${e.tagName??""}`}var i=new Map,o=new Map;function Kd(e){if(!mh())return{status:"unsupported"};return i.get(u(e))??(o.has(u(e))?{status:"pending"}:null)}async function Na(e){if(!mh())return{status:"unsupported"};if(!e.path&&!e.tagName)return{status:"failed",message:"no target to look for"};let t=u(e),s=i.get(t);if(s)return s;let r=o.get(t);if(r)return r;let n={};if(e.path!==void 0)n.path=e.path;if(e.tagName!==void 0)n.tagName=e.tagName;let a=(async()=>{try{return{result:await p().findReferences(n),status:"ready"}}catch(c){return{message:Z(c),status:"failed"}}})();o.set(t,a);let d=f,l=await a;if(o.get(t)===a)o.delete(t);if(d!==f)return l;return i.set(t,l),l}function xR(e){return i.delete(u(e)),Na(e)}var f=0,g=new Set;function ps(){f+=1,i.clear(),o.clear();for(let e of g)e()}function _R(e){return g.add(e),()=>{g.delete(e)}}function h(e){let t=0;for(let s of e.files)if(s.path.startsWith("pages/"))t+=1;return{others:e.files.length-t,pages:t}}function by(e){let{others:t,pages:s}=h(e);if(s===0&&t===0)return"Not used yet";let r=t===1?"file":"files";if(s===0)return`Used in ${t} ${r}`;let n=`Used on ${s} page${s===1?"":"s"}`;return t===0?n:`${n} and ${t} other ${r}`}function SR(e,t){if(e.status==="unsupported")return null;if(e.status==="pending")return"Counting references…";if(e.status==="failed")return`References could not be counted (${e.message}) — this may break more than it appears to.`;let{files:s,refsTotal:r}=e.result;if(s.length===0)return t==="delete"?"Nothing else in this project refers to it.":"Nothing else in this project refers to it, so nothing needs updating.";let n=`${r} reference${r===1?"":"s"} in ${s.length} file${s.length===1?"":"s"}`,a=e.result.errors.length>0?" (at least — some documents could not be read)":"";if(t==="delete")return`${n}${a} will break. Those files stay on disk; the references in them stop resolving.`;if(t==="convert")return`${n}${a} will be updated automatically to point at the new file.`;return`${n}${a} will be updated automatically. Nothing else changes.`}function yy(e){return e.files.toSorted((t,s)=>s.count-t.count||t.path.localeCompare(s.path))}
|
|
2
|
+
export{mh,Kd,Na,xR,ps,_R,by,SR,yy};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=9B989C9B83C2F33664756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pk961xgz.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
1
|
+
import{p}from"./studio-1b79rpcb.js";import{Yd,g}from"./studio-ybkd5w8k.js";import{jt,zi,fn,Cl,co,ja}from"./studio-hf259xzd.js";import{Rr}from"./studio-52mzbxqm.js";import{Rs,Jd}from"./studio-wqsmvtqj.js";import{vx}from"./studio-m25ry0mf.js";import{ls,tx,nx,to,Vo}from"./studio-a4ymg4vd.js";import{x}from"./studio-anc8067x.js";import{b}from"./studio-y3tjh2xb.js";import{n,J,qe,S,kf,f}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";function Y(e){let t=[],r=[],i="",o=!1,s=!1,l=()=>{r.push(i),i="",s=!1},y=()=>{if(l(),r.length===1&&r[0]===""){r=[];return}t.push(r),r=[]};for(let C=0;C<e.length;C++){let c=e[C];if(o){if(c==='"')if(e[C+1]==='"')i+='"',C+=1;else o=!1;else i+=c;continue}if(c==='"'&&!s)o=!0,s=!0;else if(c==='"')i+=c;else if(c===",")l();else if(c===`
|
|
2
2
|
`)y();else if(c==="\r"){if(e[C+1]===`
|
|
3
|
-
`)C+=1;y()}else i+=c,s=!0}if(i!==""||r.length>0)y();return t}function
|
|
3
|
+
`)C+=1;y()}else i+=c,s=!0}if(i!==""||r.length>0)y();return t}function Hd(e){let t=(e.match(/\r\n/g)??[]).length,r=(e.match(/(?<!\r)\n/g)??[]).length,i=t>r?`\r
|
|
4
4
|
`:`
|
|
5
5
|
`,o=e.endsWith(`
|
|
6
|
-
`),s=Y(e),l=s[0]??[],y=s.slice(1),C=Math.max(l.length,...y.map((c)=>c.length),0);while(l.length<C)l.push("");for(let c of y)while(c.length<C)c.push("");return{eol:i,headers:l,rows:y,trailingNewline:o}}function ee(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function QT(e){return[e.headers,...e.rows].map((r)=>r.map((i)=>ee(i)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}var A=new Set(["$eq","$ne","$in","$nin","$exists","$gt","$gte","$lt","$lte"]);function V(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)}function D(e){if(e instanceof Date){if(Number.isNaN(e.getTime()))return;let t=e.toISOString();return t.endsWith("T00:00:00.000Z")?t.slice(0,10):t.replace(/\.\d{3}Z$/,"Z")}return e}function N(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,i)=>N(D(r),D(t[i])));if(V(e)&&V(t)){let r=Object.keys(e);return r.length===Object.keys(t).length&&r.every((i)=>(i in t)&&N(D(e[i]),D(t[i])))}return!1}function k(e,t){let r=D(e);if(Array.isArray(t)||V(t))return N(r,t);if(Array.isArray(r))return r.some((i)=>D(i)===t);return r===t}function te(e,t){if(Object.hasOwn(e,t))return e[t];if(!t.includes("."))return;return G(e,t.split("."))}function G(e,[t,...r]){if(t===void 0||!V(e)||!Object.hasOwn(e,t))return;let i=e[t];return r.length===0?i:G(i,r)}function re(e,t){let r=D(e);if(J(r)&&J(t))return r-t;if(n(r)&&n(t))return r<t?-1:r>t?1:0;return}function ne(e){return V(e)&&e.$now===!0&&Object.keys(e).length===1}function ie(e){let t=e instanceof Date?e.getTime():n(e)?Date.parse(e):Number.NaN;return Number.isNaN(t)?void 0:t}function oe(e,t,r,i){switch(t){case"$eq":return(o)=>k(o,r);case"$ne":return(o)=>!k(o,r);case"$in":case"$nin":{if(!Array.isArray(r))throw TypeError(`${e}.${t}: expected an array, got ${JSON.stringify(r)}`);let o=(s)=>r.some((l)=>k(s,l));return t==="$in"?o:(s)=>!o(s)}case"$exists":{if(!qe(r))throw TypeError(`${e}.$exists: expected true or false, got ${JSON.stringify(r)}`);return(o)=>(o!==void 0&&o!==null)===r}default:{let o=(s)=>t==="$gt"?s>0:t==="$gte"?s>=0:t==="$lt"?s<0:s<=0;if(ne(r))return(s)=>{if(s===void 0||s===null)return!1;let l=ie(s);return l===void 0?i.onBadDate:o(l-i.now().getTime())};if(!n(r)&&!J(r))throw TypeError(`${e}.${t}: expected a string or number, got ${JSON.stringify(r)}`);return(s)=>{let l=re(s,r);return l!==void 0&&o(l)}}}}function se(e){let t=Object.keys(e),r=t.filter((i)=>i.startsWith("$"));if(r.length===0)return null;return r.length===t.length?t:[]}function le(e,t,r){let i=`${r.name}.${e}`;if(!V(t))return(l)=>k(l,t);let o=se(t);if(o===null)return(l)=>N(D(l),t);if(o.length===0)throw TypeError(`${i}: cannot mix $operators with plain keys in one condition`);let s=o.map((l)=>{if(!A.has(l))throw TypeError(`${i}: unknown operator "${l}" (use ${[...A].join(", ")})`);return oe(i,l,t[l],r)});return(l)=>s.every((y)=>y(l))}function ae(e,t){return Object.entries(e).map(([r,i])=>{if(r.startsWith("$"))throw TypeError(`${t.name}.${r}: top-level operators are not supported, conditions on different fields already combine with AND`);return{key:r,test:le(r,i,t)}})}var ue=()=>{},de=()=>new Date;function I(e,t={}){if(e===void 0)return ue;if(!Array.isArray(e))throw TypeError('"hold" must be an array of { "label", "when" } rules');let r=t.now??de,i=e.map((o,s)=>{let l=`hold[${s}]`;if(!V(o)||!n(o.label)||o.label.trim()==="")throw TypeError(`${l}: expected a non-empty "label"`);if(!V(o.when)||Object.keys(o.when).length===0)throw TypeError(`${l}: expected "when" to name at least one frontmatter field`);let y={name:`${l}.when`,now:r,onBadDate:!0};return{label:o.label,tests:ae(o.when,y)}});return(o)=>i.find(({tests:s})=>s.every(({key:l,test:y})=>y(te(o,l))))?.label}var K0="Published";function v(e){return Array.isArray(e?.hold)?e.hold:[]}var K=new WeakMap;function fe(e){let t=v(e),r=K.get(t);if(r)return r;let i;try{i=I(t)}catch{i=()=>{}}return K.set(t,i),i}function Gw(e){return v(e).length>0}function Ep(e,t){if(!Gw(e))return null;return fe(e)(t??{})??null}function Rm(e,t){return Gw(e)?Ep(e,t)??K0:""}function ks(e){for(let t of v(e))if(m(t)&&n(t.label)&&m(t.when)){let r=Object.entries(t.when),[i]=r;if(r.length===1&&i?.[1]===!0)return{field:i[0],label:t.label}}return null}function QD(e){return v(e).flatMap((t)=>m(t)&&m(t.when)?Object.keys(t.when):[])}function Tp(e){return e===null?"No hold rule matches this entry, so a production build publishes it.":`Held: ${e}. A production build leaves it out; jx dev, Preview and preview builds keep it.`}var B=b({includeHeld:!1});function W(){return B.includeHeld}function eO(e){B.includeHeld=e}function L(e,t,r,i){return i||!Gw(t)?e:e.filter((o)=>Ep(t,r(o))===null)}function me(e,t){let{headers:r,rows:i}=Fd(e),o=[t,"id","sku","slug","Slug"].flatMap((s)=>{let l=s===void 0?-1:r.indexOf(s);return l===-1?[]:[l]});return i.filter((s)=>s.some((l)=>l.trim()!=="")).map((s,l)=>{let y=o.find((C)=>(s[C]??"")!=="");return y===void 0?String(l):s[y]})}function pe(e,t){let r;try{r=JSON.parse(e)}catch{return[]}let i=(o,s)=>{let l=S(o)&&!Array.isArray(o)?o.id:void 0;return n(l)||J(l)?String(l):s};if(!Array.isArray(r))return[i(r,t)];return r.map((o,s)=>i(o,`${t}-${s}`))}function M(e,t,r){let i=e.toLowerCase();if(i.endsWith(".csv"))return me(t,r);if(i.endsWith(".json")){let o=(e.split("/").pop()??e).replace(/\.json$/i,"");return pe(t,o)}return[]}var j="__path";function _(){return x?.projectConfig?.content??{}}function Im(e){let t=_()[e];if(!t?.source)return null;let r=t.source.replace(/^\.\//,"").replace(/\/$/,""),i=t.format==="json"?".json":Wi(t.format)?.extensions[0]??lo()?.extensions[0]??".json";return{def:t,dir:r,ext:i,name:e}}function G0(){return Object.entries(_()).filter(([,e])=>{let t=e.source?.replace(/^\.\//,"")??"";return t!==""&&!/\.[a-z0-9]+$/i.test(t)}).map(([e,t])=>({dir:t.source.replace(/^\.\//,"").replace(/\/$/,""),name:e}))}async function z(e,t){let r=p(),i=[],o=async(s)=>{let l;try{l=await r.listDirectory(s)}catch{return}for(let y of l)if(y.type==="directory")await o(y.path);else if(t.some((C)=>y.path.endsWith(C)))i.push(y.path)};return await o(e),i.toSorted()}async function J0(e){let t=e.dir.indexOf(Lr);if(t===-1)return[e.dir];let r=e.dir.slice(0,t).replace(/\/$/,""),i=e.dir.slice(t+Lr.length),o;try{o=await p().listDirectory(r)}catch{return[]}return o.filter((s)=>s.type==="directory").map((s)=>`${s.path}${i}`.replace(/\/$/,"")).filter((s)=>Gd(s)?.name===e.name).toSorted()}async function Z(e){let t=await J0(e);return(await Promise.all(t.map((i)=>z(i,[e.ext])))).flat().toSorted()}async function he(e){let t=fx(e.name);if(t===null)return null;let r;try{r=await p().readFile(t)}catch{return[]}return M(t,r,e.def.idField)}async function Ab(e){await jt().catch(()=>{});let t=Im(e);if(!t)return[];let r=await he(t);if(r!==null)return r;return(await Z(t)).map((o)=>{let s=o.split("/").pop()??o;return s.slice(0,s.length-t.ext.length)})}async function ge(e,t,r){let i=Array.from({length:e.length}),o=0,s=Array.from({length:Math.min(t,e.length)},async()=>{while(o<e.length){let l=o;o+=1,i[l]=await r(e[l])}});return await Promise.all(s),i}function Q(e){if(e===void 0)return null;if(xf(e))return e;if(Array.isArray(e)&&e.every((t)=>!S(t)))return e.map(String);return JSON.stringify(e)}function q(e){for(let t of g.tabs.values())if(t.documentPath===e)return t;return null}function ye(e,t){return e.every((r)=>{let i=r[t];return!n(i)||!i.startsWith("{")&&!i.startsWith("[")})}var U=new WeakSet;async function e$(){let e=[];for(let t of g.tabs.values()){let r=eo(t);if(r&&U.has(r.source))e.push(r.load())}await Promise.all(e)}function X(e){let t=we(e);if(e.holdDef)U.add(t);return t}function we(e){let t=new Map,r=null,i=null,o=(c=!1)=>{if(!c&&r)return r;return r=(async()=>{await jt().catch(()=>{});let h=p(),f=await e.list();t.clear(),i=null;let F=await ge(f,32,async(a)=>{try{let u=await h.readFile(a),d=await Bo(a,u);return{document:d.document,formatName:d.format.name,frontmatter:d.frontmatter,rawText:u}}catch{return null}});for(let[a,u]of f.entries()){let d=F[a];if(d)t.set(u,d)}})(),r},s=()=>{if(i)return i;let c={editable:!1,field:j,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},h=Yw(e.schema()),f=new Set([j,...h.map((u)=>u.field)]),F=[...t.values()].map((u)=>{let d={};for(let[w,P]of Object.entries(u.frontmatter))if(!f.has(w)&&!w.startsWith("$"))d[w]=Q(P);return d}),a=Zw(F);for(let u of a)u.editable=u.kind!=="text"||ye(F,u.field);if(e.priorityFields?.length){let u=(d)=>{let w=e.priorityFields.indexOf(d.field);return w===-1?e.priorityFields.length:w};a.sort((d,w)=>u(d)-u(w))}return i=l([c,...h,...a]),i},l=(c)=>{let h=ks(e.holdDef?.())?.field,f=c.findIndex((a)=>a.field===h);if(f<1)return c;let F=c.filter((a)=>a.field!==h);return[F[0],c[f],...F.slice(1)]},y=(c,h)=>{let f={[j]:c};for(let F of s()){if(F.field===j)continue;f[F.field]=Q(h.frontmatter[F.field])}return{cells:f,fingerprint:h.rawText,key:c}},C=async(c,h,f)=>{let F=p(),a={...h.frontmatter};for(let P of f)if(P.value===null)delete a[P.field];else a[P.field]=P.value;let u=h.document,d={...a,...u,children:u.children??[]},w=await Ma(h.formatName,d,{mode:"roundtrip",source:h.rawText});Ls(c),await F.writeFile(c,w),t.set(c,{...h,frontmatter:a,rawText:w})};return{backingPaths:()=>new Map([...t.keys()].map((c)=>[c,c])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await o(),s()},async commit(c){await o();let h=p(),f={cells:[],deletes:[],inserts:[]},F=new Map;for(let a of c.cells){let u=F.get(a.rowKey)??[];u.push({field:a.field,value:a.value}),F.set(a.rowKey,u)}for(let[a,u]of F){let d=(O,T,H)=>{for(let R of u)f.cells.push({error:T,field:R.field,ok:O,rowKey:a,stale:H})},w=t.get(a);if(!w){d(!1,"Entry no longer loaded — refresh the grid");continue}let P=q(a);if(P?.doc.dirty){d(!1,"Open in a tab with unsaved changes — save or close it first");continue}let E=null;try{E=await h.readFile(a)}catch{E=null}if(E!==w.rawText&&!Ud(a)){d(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await C(a,w,u),d(!0),P){let{reloadFileInTab:O}=await (ce("b2p9y0yz"),import("./files-b2p9y0yz.js"));O(a)}}catch(O){d(!1,O instanceof Error?O.message:String(O))}}for(let a of c.inserts){let u=a.cells[j];if(!n(u)||u.trim()===""){f.inserts.push({error:"Path is required",ok:!1,tempKey:a.tempKey});continue}let d=e.resolveInsertPath(u),w=t.has(d);if(!w)try{await h.readFile(d),w=!0}catch{w=!1}if(w){f.inserts.push({error:`${d} already exists`,ok:!1,tempKey:a.tempKey});continue}let P=e.insertFormatName(d);if(!P){f.inserts.push({error:`No format can serialize ${d}`,ok:!1,tempKey:a.tempKey});continue}try{let E={};for(let[H,R]of Object.entries(a.cells))if(H!==j&&R!==null)E[H]=R;let O=await Ma(P,{...E,children:[]},{frontmatter:Object.keys(E).length>0,mode:"roundtrip"});Ls(d),await h.writeFile(d,O);let T=await Bo(d,O);t.set(d,{document:T.document,formatName:T.format.name,frontmatter:T.frontmatter,rawText:O}),f.inserts.push({newKey:d,ok:!0,tempKey:a.tempKey})}catch(E){f.inserts.push({error:E instanceof Error?E.message:String(E),ok:!1,tempKey:a.tempKey})}}for(let a of c.deletes){if(q(a.rowKey)){f.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:a.rowKey});continue}try{Ls(a.rowKey),await h.deleteFile(a.rowKey),t.delete(a.rowKey),f.deletes.push({ok:!0,rowKey:a.rowKey})}catch(u){f.deletes.push({error:u instanceof Error?u.message:String(u),ok:!1,rowKey:a.rowKey})}}return f},id:e.id,label:e.label,async refresh(){await o(!0)},async rows(){await o();let h=L([...t.entries()],e.holdDef?.(),([,f])=>f.frontmatter,W()).map(([f,F])=>y(f,F));return{rows:h,total:h.length}}}}function t$(e){let t=()=>{let r=Im(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return X({holdDef:()=>Im(e)?.def,id:as({kind:"collection",name:e}),insertFormatName:(r)=>{let i=t();return(i.def.format?Wi(i.def.format)?.name:void 0)??fn(r)?.name??lo()?.name??null},label:e,list:()=>Z(t()),resolveInsertPath:(r)=>{let i=t(),o=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!o.includes("/"))o=`${i.dir}/${o}`;if(!o.endsWith(i.ext))o=`${o}${i.ext}`;return o},schema:()=>t().def.schema})}function n$(){let e=()=>{let t=_l("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return X({id:as({kind:"pages"}),insertFormatName:(t)=>fn(t)?.name??null,label:"Pages",list:()=>z("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((i)=>r.endsWith(i)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
7
|
-
export{
|
|
6
|
+
`),s=Y(e),l=s[0]??[],y=s.slice(1),C=Math.max(l.length,...y.map((c)=>c.length),0);while(l.length<C)l.push("");for(let c of y)while(c.length<C)c.push("");return{eol:i,headers:l,rows:y,trailingNewline:o}}function ee(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function l$(e){return[e.headers,...e.rows].map((r)=>r.map((i)=>ee(i)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}var A=new Set(["$eq","$ne","$in","$nin","$exists","$gt","$gte","$lt","$lte"]);function V(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)}function D(e){if(e instanceof Date){if(Number.isNaN(e.getTime()))return;let t=e.toISOString();return t.endsWith("T00:00:00.000Z")?t.slice(0,10):t.replace(/\.\d{3}Z$/,"Z")}return e}function N(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,i)=>N(D(r),D(t[i])));if(V(e)&&V(t)){let r=Object.keys(e);return r.length===Object.keys(t).length&&r.every((i)=>(i in t)&&N(D(e[i]),D(t[i])))}return!1}function k(e,t){let r=D(e);if(Array.isArray(t)||V(t))return N(r,t);if(Array.isArray(r))return r.some((i)=>D(i)===t);return r===t}function te(e,t){if(Object.hasOwn(e,t))return e[t];if(!t.includes("."))return;return G(e,t.split("."))}function G(e,[t,...r]){if(t===void 0||!V(e)||!Object.hasOwn(e,t))return;let i=e[t];return r.length===0?i:G(i,r)}function re(e,t){let r=D(e);if(J(r)&&J(t))return r-t;if(n(r)&&n(t))return r<t?-1:r>t?1:0;return}function ne(e){return V(e)&&e.$now===!0&&Object.keys(e).length===1}function ie(e){let t=e instanceof Date?e.getTime():n(e)?Date.parse(e):Number.NaN;return Number.isNaN(t)?void 0:t}function oe(e,t,r,i){switch(t){case"$eq":return(o)=>k(o,r);case"$ne":return(o)=>!k(o,r);case"$in":case"$nin":{if(!Array.isArray(r))throw TypeError(`${e}.${t}: expected an array, got ${JSON.stringify(r)}`);let o=(s)=>r.some((l)=>k(s,l));return t==="$in"?o:(s)=>!o(s)}case"$exists":{if(!qe(r))throw TypeError(`${e}.$exists: expected true or false, got ${JSON.stringify(r)}`);return(o)=>(o!==void 0&&o!==null)===r}default:{let o=(s)=>t==="$gt"?s>0:t==="$gte"?s>=0:t==="$lt"?s<0:s<=0;if(ne(r))return(s)=>{if(s===void 0||s===null)return!1;let l=ie(s);return l===void 0?i.onBadDate:o(l-i.now().getTime())};if(!n(r)&&!J(r))throw TypeError(`${e}.${t}: expected a string or number, got ${JSON.stringify(r)}`);return(s)=>{let l=re(s,r);return l!==void 0&&o(l)}}}}function se(e){let t=Object.keys(e),r=t.filter((i)=>i.startsWith("$"));if(r.length===0)return null;return r.length===t.length?t:[]}function le(e,t,r){let i=`${r.name}.${e}`;if(!V(t))return(l)=>k(l,t);let o=se(t);if(o===null)return(l)=>N(D(l),t);if(o.length===0)throw TypeError(`${i}: cannot mix $operators with plain keys in one condition`);let s=o.map((l)=>{if(!A.has(l))throw TypeError(`${i}: unknown operator "${l}" (use ${[...A].join(", ")})`);return oe(i,l,t[l],r)});return(l)=>s.every((y)=>y(l))}function ae(e,t){return Object.entries(e).map(([r,i])=>{if(r.startsWith("$"))throw TypeError(`${t.name}.${r}: top-level operators are not supported, conditions on different fields already combine with AND`);return{key:r,test:le(r,i,t)}})}var ue=()=>{},de=()=>new Date;function I(e,t={}){if(e===void 0)return ue;if(!Array.isArray(e))throw TypeError('"hold" must be an array of { "label", "when" } rules');let r=t.now??de,i=e.map((o,s)=>{let l=`hold[${s}]`;if(!V(o)||!n(o.label)||o.label.trim()==="")throw TypeError(`${l}: expected a non-empty "label"`);if(!V(o.when)||Object.keys(o.when).length===0)throw TypeError(`${l}: expected "when" to name at least one frontmatter field`);let y={name:`${l}.when`,now:r,onBadDate:!0};return{label:o.label,tests:ae(o.when,y)}});return(o)=>i.find(({tests:s})=>s.every(({key:l,test:y})=>y(te(o,l))))?.label}var tC="Published";function v(e){return Array.isArray(e?.hold)?e.hold:[]}var K=new WeakMap;function fe(e){let t=v(e),r=K.get(t);if(r)return r;let i;try{i=I(t)}catch{i=()=>{}}return K.set(t,i),i}function Qw(e){return v(e).length>0}function Lp(e,t){if(!Qw(e))return null;return fe(e)(t??{})??null}function Om(e,t){return Qw(e)?Lp(e,t)??tC:""}function Ts(e){for(let t of v(e))if(f(t)&&n(t.label)&&f(t.when)){let r=Object.entries(t.when),[i]=r;if(r.length===1&&i?.[1]===!0)return{field:i[0],label:t.label}}return null}function dO(e){return v(e).flatMap((t)=>f(t)&&f(t.when)?Object.keys(t.when):[])}function Rp(e){return e===null?"No hold rule matches this entry, so a production build publishes it.":`Held: ${e}. A production build leaves it out; jx dev, Preview and preview builds keep it.`}var B=b({includeHeld:!1});function W(){return B.includeHeld}function uO(e){B.includeHeld=e}function L(e,t,r,i){return i||!Qw(t)?e:e.filter((o)=>Lp(t,r(o))===null)}function me(e,t){let{headers:r,rows:i}=Hd(e),o=[t,"id","sku","slug","Slug"].flatMap((s)=>{let l=s===void 0?-1:r.indexOf(s);return l===-1?[]:[l]});return i.filter((s)=>s.some((l)=>l.trim()!=="")).map((s,l)=>{let y=o.find((C)=>(s[C]??"")!=="");return y===void 0?String(l):s[y]})}function pe(e,t){let r;try{r=JSON.parse(e)}catch{return[]}let i=(o,s)=>{let l=S(o)&&!Array.isArray(o)?o.id:void 0;return n(l)||J(l)?String(l):s};if(!Array.isArray(r))return[i(r,t)];return r.map((o,s)=>i(o,`${t}-${s}`))}function M(e,t,r){let i=e.toLowerCase();if(i.endsWith(".csv"))return me(t,r);if(i.endsWith(".json")){let o=(e.split("/").pop()??e).replace(/\.json$/i,"");return pe(t,o)}return[]}var j="__path";function _(){return x?.projectConfig?.content??{}}function Am(e){let t=_()[e];if(!t?.source)return null;let r=t.source.replace(/^\.\//,"").replace(/\/$/,""),i=t.format==="json"?".json":zi(t.format)?.extensions[0]??co()?.extensions[0]??".json";return{def:t,dir:r,ext:i,name:e}}function nC(){return Object.entries(_()).filter(([,e])=>{let t=e.source?.replace(/^\.\//,"")??"";return t!==""&&!/\.[a-z0-9]+$/i.test(t)}).map(([e,t])=>({dir:t.source.replace(/^\.\//,"").replace(/\/$/,""),name:e}))}async function z(e,t){let r=p(),i=[],o=async(s)=>{let l;try{l=await r.listDirectory(s)}catch{return}for(let y of l)if(y.type==="directory")await o(y.path);else if(t.some((C)=>y.path.endsWith(C)))i.push(y.path)};return await o(e),i.toSorted()}async function iC(e){let t=e.dir.indexOf(Rr);if(t===-1)return[e.dir];let r=e.dir.slice(0,t).replace(/\/$/,""),i=e.dir.slice(t+Rr.length),o;try{o=await p().listDirectory(r)}catch{return[]}return o.filter((s)=>s.type==="directory").map((s)=>`${s.path}${i}`.replace(/\/$/,"")).filter((s)=>Yd(s)?.name===e.name).toSorted()}async function Z(e){let t=await iC(e);return(await Promise.all(t.map((i)=>z(i,[e.ext])))).flat().toSorted()}async function he(e){let t=vx(e.name);if(t===null)return null;let r;try{r=await p().readFile(t)}catch{return[]}return M(t,r,e.def.idField)}async function jb(e){await jt().catch(()=>{});let t=Am(e);if(!t)return[];let r=await he(t);if(r!==null)return r;return(await Z(t)).map((o)=>{let s=o.split("/").pop()??o;return s.slice(0,s.length-t.ext.length)})}async function ge(e,t,r){let i=Array.from({length:e.length}),o=0,s=Array.from({length:Math.min(t,e.length)},async()=>{while(o<e.length){let l=o;o+=1,i[l]=await r(e[l])}});return await Promise.all(s),i}function Q(e){if(e===void 0)return null;if(kf(e))return e;if(Array.isArray(e)&&e.every((t)=>!S(t)))return e.map(String);return JSON.stringify(e)}function q(e){for(let t of g.tabs.values())if(t.documentPath===e)return t;return null}function ye(e,t){return e.every((r)=>{let i=r[t];return!n(i)||!i.startsWith("{")&&!i.startsWith("[")})}var U=new WeakSet;async function c$(){let e=[];for(let t of g.tabs.values()){let r=to(t);if(r&&U.has(r.source))e.push(r.load())}await Promise.all(e)}function X(e){let t=we(e);if(e.holdDef)U.add(t);return t}function we(e){let t=new Map,r=null,i=null,o=(c=!1)=>{if(!c&&r)return r;return r=(async()=>{await jt().catch(()=>{});let h=p(),m=await e.list();t.clear(),i=null;let F=await ge(m,32,async(a)=>{try{let u=await h.readFile(a),d=await Vo(a,u);return{document:d.document,formatName:d.format.name,frontmatter:d.frontmatter,rawText:u}}catch{return null}});for(let[a,u]of m.entries()){let d=F[a];if(d)t.set(u,d)}})(),r},s=()=>{if(i)return i;let c={editable:!1,field:j,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},h=tx(e.schema()),m=new Set([j,...h.map((u)=>u.field)]),F=[...t.values()].map((u)=>{let d={};for(let[w,P]of Object.entries(u.frontmatter))if(!m.has(w)&&!w.startsWith("$"))d[w]=Q(P);return d}),a=nx(F);for(let u of a)u.editable=u.kind!=="text"||ye(F,u.field);if(e.priorityFields?.length){let u=(d)=>{let w=e.priorityFields.indexOf(d.field);return w===-1?e.priorityFields.length:w};a.sort((d,w)=>u(d)-u(w))}return i=l([c,...h,...a]),i},l=(c)=>{let h=Ts(e.holdDef?.())?.field,m=c.findIndex((a)=>a.field===h);if(m<1)return c;let F=c.filter((a)=>a.field!==h);return[F[0],c[m],...F.slice(1)]},y=(c,h)=>{let m={[j]:c};for(let F of s()){if(F.field===j)continue;m[F.field]=Q(h.frontmatter[F.field])}return{cells:m,fingerprint:h.rawText,key:c}},C=async(c,h,m)=>{let F=p(),a={...h.frontmatter};for(let P of m)if(P.value===null)delete a[P.field];else a[P.field]=P.value;let u=h.document,d={...a,...u,children:u.children??[]},w=await ja(h.formatName,d,{mode:"roundtrip",source:h.rawText});Rs(c),await F.writeFile(c,w),t.set(c,{...h,frontmatter:a,rawText:w})};return{backingPaths:()=>new Map([...t.keys()].map((c)=>[c,c])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await o(),s()},async commit(c){await o();let h=p(),m={cells:[],deletes:[],inserts:[]},F=new Map;for(let a of c.cells){let u=F.get(a.rowKey)??[];u.push({field:a.field,value:a.value}),F.set(a.rowKey,u)}for(let[a,u]of F){let d=(O,T,H)=>{for(let R of u)m.cells.push({error:T,field:R.field,ok:O,rowKey:a,stale:H})},w=t.get(a);if(!w){d(!1,"Entry no longer loaded — refresh the grid");continue}let P=q(a);if(P?.doc.dirty){d(!1,"Open in a tab with unsaved changes — save or close it first");continue}let E=null;try{E=await h.readFile(a)}catch{E=null}if(E!==w.rawText&&!Jd(a)){d(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await C(a,w,u),d(!0),P){let{reloadFileInTab:O}=await (ce("8pf70854"),import("./files-8pf70854.js"));O(a)}}catch(O){d(!1,O instanceof Error?O.message:String(O))}}for(let a of c.inserts){let u=a.cells[j];if(!n(u)||u.trim()===""){m.inserts.push({error:"Path is required",ok:!1,tempKey:a.tempKey});continue}let d=e.resolveInsertPath(u),w=t.has(d);if(!w)try{await h.readFile(d),w=!0}catch{w=!1}if(w){m.inserts.push({error:`${d} already exists`,ok:!1,tempKey:a.tempKey});continue}let P=e.insertFormatName(d);if(!P){m.inserts.push({error:`No format can serialize ${d}`,ok:!1,tempKey:a.tempKey});continue}try{let E={};for(let[H,R]of Object.entries(a.cells))if(H!==j&&R!==null)E[H]=R;let O=await ja(P,{...E,children:[]},{frontmatter:Object.keys(E).length>0,mode:"roundtrip"});Rs(d),await h.writeFile(d,O);let T=await Vo(d,O);t.set(d,{document:T.document,formatName:T.format.name,frontmatter:T.frontmatter,rawText:O}),m.inserts.push({newKey:d,ok:!0,tempKey:a.tempKey})}catch(E){m.inserts.push({error:E instanceof Error?E.message:String(E),ok:!1,tempKey:a.tempKey})}}for(let a of c.deletes){if(q(a.rowKey)){m.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:a.rowKey});continue}try{Rs(a.rowKey),await h.deleteFile(a.rowKey),t.delete(a.rowKey),m.deletes.push({ok:!0,rowKey:a.rowKey})}catch(u){m.deletes.push({error:u instanceof Error?u.message:String(u),ok:!1,rowKey:a.rowKey})}}return m},id:e.id,label:e.label,async refresh(){await o(!0)},async rows(){await o();let h=L([...t.entries()],e.holdDef?.(),([,m])=>m.frontmatter,W()).map(([m,F])=>y(m,F));return{rows:h,total:h.length}}}}function d$(e){let t=()=>{let r=Am(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return X({holdDef:()=>Am(e)?.def,id:ls({kind:"collection",name:e}),insertFormatName:(r)=>{let i=t();return(i.def.format?zi(i.def.format)?.name:void 0)??fn(r)?.name??co()?.name??null},label:e,list:()=>Z(t()),resolveInsertPath:(r)=>{let i=t(),o=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!o.includes("/"))o=`${i.dir}/${o}`;if(!o.endsWith(i.ext))o=`${o}${i.ext}`;return o},schema:()=>t().def.schema})}function u$(){let e=()=>{let t=Cl("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return X({id:ls({kind:"pages"}),insertFormatName:(t)=>fn(t)?.name??null,label:"Pages",list:()=>z("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((i)=>r.endsWith(i)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
7
|
+
export{Hd,l$,tC,Qw,Lp,Om,Ts,dO,Rp,uO,Am,nC,iC,jb,c$,d$,u$};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
10
|
-
//# sourceMappingURL=studio-
|
|
9
|
+
//# debugId=4533884CDB35391364756E2164756E21
|
|
10
|
+
//# sourceMappingURL=studio-qcc5hsw2.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{st,Tr,So,Up}from"./studio-kp4vzrct.js";function vb(){return Tr(st.cfToken)}function QE(t){So(st.cfToken,t||"")}function eT(){return Tr(st.cfAccountId)}function PF(t){So(st.cfAccountId,t||"")}function tT(){Up([st.cfToken,st.cfAccountId])}
|
|
2
|
+
export{vb,QE,eT,PF,tT};
|
|
3
|
+
|
|
4
|
+
//# debugId=8CA0866697C2CC2E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qfq58c8n.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{gi}from"./studio-52mzbxqm.js";import{p,we}from"./studio-1b79rpcb.js";import{ra,Xd,g,xl,jR}from"./studio-ybkd5w8k.js";import{Lh,w}from"./studio-5k9mfafh.js";import{Z}from"./studio-mkjrjpr2.js";import{Kd,Na,by}from"./studio-pk961xgz.js";import{Jx,yl,Zm}from"./studio-jj9gf1qc.js";import{mI,j1,I_,N_,gI,cd,H1,Sf,tv,D_,O_,jh,nv,vg,B1,bI,MM,FM,jM,yI,HM,vI,A_,BM,VM,WM}from"./studio-s9jjap3x.js";import{x}from"./studio-anc8067x.js";import{$n}from"./studio-xxttcym1.js";import{me,te,b,le}from"./studio-y3tjh2xb.js";import{J}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";var D={message:"no media file to look for",status:"failed"};function H(t){let e=gi(t);return e===""?null:{path:e}}function hx(t){let e=H(t);return e===null?null:Kd(e)}async function eh(t){let e=H(t);return e===null?D:Na(e)}function $O(t){if(t===null)return"Counting references…";switch(t.status){case"unsupported":return null;case"pending":return"Counting references…";case"failed":return"Usage unknown";default:return by(t.result)}}var ds="image",B=[320,640,960,1280,1920],C=null,F=null;function W(){return C??=(ce("ke9std9b"),import("./image-editor-ke9std9b.js")),C}function _(){return F??=(ce("q9ajdjsj"),import("./image-bake-q9ajdjsj.js")),F}var A=new WeakMap;function U(t){return A.get(le(t))}function j(t){let e=le(t),r=A.get(e);if(!r){r=b({decoded:!1,generation:0,history:A_(),live:null,message:"Reading the image…",saving:!1,size:null,source:null,status:"loading",typed:!1}),A.set(e,r);let i=M(r);Xd(e,i),Xd(t,i)}return r}function M(t){return{canRedo:()=>!t.saving&&t.history.future.length>0,canUndo:()=>!t.saving&&t.history.past.length>0,redo:()=>{if(!t.saving)t.history=WM(t.history)},undo:()=>{if(!t.saving)t.history=VM(t.history)}}}function m(t){return t.live??t.history.present}function O(t,e,r){let i=t.source;if(t.source={bytes:e,url:URL.createObjectURL(new Blob([e],{type:r}))},t.status="ready",t.message="",i!==null)URL.revokeObjectURL(i.url)}function T(t){if(t.source!==null)URL.revokeObjectURL(t.source.url),t.source=null,t.status="loading"}async function R(t,e){if(t.source!==null)return;t.generation+=1;let{generation:r}=t;t.status="loading",t.message="Reading the image…";let i=we()?p():null,u=i?.readFileBytes;if(u===void 0){t.status="refused",t.message="This backend cannot hand Studio a file's raw bytes, so it cannot edit one.";return}let o;try{o=new Uint8Array(await u.call(i,e))}catch(a){if(t.generation===r)t.status="refused",t.message=`Could not read ${e}: ${a instanceof Error?a.message:String(a)}`;return}if(t.generation!==r)return;let n=N_(e,o);if(n!==null){t.status="refused",t.message=n;return}t.size??=mI(o).size,O(t,o,j1(e)??"")}function dl(t){let e=U(t),r=e?.size;if(e===void 0||r===null||r===void 0)return!1;return e.typed||!H1(m(e),r)}function P(t,e){t.live=null,t.history=BM(t.history,e)}var v=new Map;function J$(t,e){let r=v.get(t);return r!==void 0&&le(r.tab)===le(e)&&r.wrap.isConnected&&(r.surface===null||r.surface.attached())}function dx(t){let e=v.get(t);if(!e)return;e.disposed=!0,e.scope.stop(),e.surface?.dispose(),v.delete(t);let r=U(e.tab);if(e.drag!==null&&r!==void 0)r.live=null;if(r!==void 0&&S(e.tab).length===0)r.typed=!1;if(S(e.tab).length===0&&r!==void 0&&!r.saving)T(r),r.generation+=1}function q(t){if(t.rows.length===0||t.rows.find((e)=>e.tabindex==="0")?.id!==t.active)t.rows=vg.map((e)=>({id:e,label:B1[e],tabindex:e===t.active?"0":"-1"}));return t.rows}function h(t){return`${Number(t.toFixed(4))}%`}function L(){let e=x?.projectConfig?.images?.widths;return Array.isArray(e)&&e.length>0&&e.every((r)=>J(r))?e:B}var N=gI.map(({id:t,label:e})=>({label:e,value:t}));function y(t,e){let r=t.tab.documentPath??"",i=r.split("/").pop()??r,u=m(e),o=e.size??{height:1,width:1},n=jh(u.turns,o),a=nv(cd(u,o),u,o),l=tv(u,o),c=D_(u,o),s=vI(u,o,L()),f=j1(r)??"",d=e.source!==null&&e.decoded&&e.size!==null,I=d&&(e.typed||!H1(u,o)),k=Sf(u.turns);return{alt:`${i}, being edited`,aspect:u.aspect,aspectOptions:N,brightness:String(u.brightness),busy:e.saving||!d,undecoded:!d,cannotFit:e.saving||!d||s===null||s===c.width,cannotRedo:e.saving||e.history.future.length===0,cannotSave:e.saving||!I||ra(t.tab),cannotUndo:e.saving||e.history.past.length===0,clean:e.saving||!I,contrast:String(u.contrast),cropH:h(a.height/n.height*100),cropW:h(a.width/n.width*100),cropX:h(a.x/n.width*100),cropY:h(a.y/n.height*100),facts:d?`Output ${c.width} × ${c.height} · crop ${l.width} × ${l.height} · source ${o.width} × ${o.height}`:"",filter:O_(u)||"none",fitHint:s===null?"Already no wider than the largest width the build derives.":"The largest of the project's image widths (images.widths, or the build's defaults) below this crop.",fitLabel:s===null?"Fit for web":`Fit for web (${s} px)`,handleHelpId:`${$n(t.paneId,"image")}/handle-help`,handles:q(t),imageHeight:k?h(o.height/n.height*100):"100%",imageTransform:`translate(-50%, -50%) scale(${u.flipH?-1:1}, ${u.flipV?-1:1}) rotate(${u.turns*90}deg)`,imageWidth:k?h(o.width/n.width*100):"100%",maxOutputWidth:String(l.width),maxWidth:`${n.width}px`,message:e.message,moveCursor:u.crop===null?"default":"move",name:i,quality:I_(f)?"shown":"hidden",qualityValue:String(u.quality),ratio:String(n.width/n.height),region:$n(t.paneId,"image"),saturation:String(u.saturation),saving:e.saving,src:e.source?.url??"",status:e.status,warning:`Save overwrites ${r} and keeps no backup. Source control is how to get the original back.`,width:String(c.width)}}function V(t,e,r){let i=nv(cd(e,r),e,r);Lh(`${B1[t]}: crop ${i.width} × ${i.height} at ${i.x}, ${i.y}`)}function z(t){return vg.some((e)=>e===t)}function Y(t,e){let r=()=>e.source===null||!e.decoded?null:e.size,i=()=>t.surface?.syncFields(y(t,e)),u=M(e),o=(n)=>{let a=r();if(a!==null&&!e.saving)P(e,n(m(e),a))};return{cycleHandle:(n,a)=>{if(!z(n))return;let l=vg.indexOf(n),c=a<0?-1:1,s=vg[(l+c+vg.length)%vg.length];t.active=s,t.surface?.update(y(t,e)),t.surface?.focusHandle(s),Lh(B1[s])},fieldEdited:()=>{e.typed=!0},fitForWeb:()=>{o((n,a)=>{let l=vI(n,a,L());return l===null?n:yI(n,a,l)})},flip:(n)=>{o((a)=>jM(a,n==="v"?"v":"h"))},handleDown:(n,a,l,c,s)=>{let f=r(),d=t.surface?.frameRect();if(f===null||!z(n)||!d||d.width<=0||e.saving)return;s.setPointerCapture(a),t.active=n,t.drag={handle:n,pointerId:a,scale:jh(m(e).turns,f).width/d.width,start:m(e),startX:l,startY:c}},handleFocused:(n)=>{if(z(n)&&t.active!==n)t.active=n,t.surface?.update(y(t,e))},handleMove:(n,a,l)=>{let{drag:c}=t,s=r();if(c===null||c.pointerId!==n||s===null||e.saving)return;e.live=bI(c.start,s,c.handle,(a-c.startX)*c.scale,(l-c.startY)*c.scale)},handleUp:(n)=>{let{drag:a}=t;if(a===null||a.pointerId!==n)return;if(t.drag=null,e.live!==null)P(e,e.live)},imageFailed:(n)=>{if(e.source?.url!==n)return;T(e),e.status="refused",e.message=`${t.tab.documentPath??"This file"} could not be decoded, so it cannot be edited.`},imageLoaded:(n,a)=>{if(e.source===null||!(n>0&&a>0))return;if(e.decoded=!0,e.size?.width!==n||e.size.height!==a)e.size={height:a,width:n};yl(t.tab.documentPath??"",n,a)},nudge:(n,a,l,c)=>{let s=r();if(s===null||!z(n)||e.saving)return;let f=c?10:1,d=bI(m(e),s,n,a*f,l*f);P(e,d),V(n,d,s)},redo:()=>{u.redo(t.tab)},reset:()=>{o(()=>A_().present)},rotate:(n)=>{o((a)=>FM(a,n<0?-1:1))},save:()=>{K$(t.tab)},setAspect:(n)=>{let a=gI.find((l)=>l.id===n);if(a)o((l,c)=>MM(l,c,a.id))},setValue:(n,a)=>{if(a.trim()!==""&&(n==="brightness"||n==="contrast"||n==="saturation"||n==="quality"))o((l)=>HM(l,n,Number(a)));e.typed=!1,i()},setWidth:(n)=>{o((a,l)=>yI(a,l,n.trim()===""?null:Number(n))),e.typed=!1,i()},undo:()=>{u.undo(t.tab)}}}function EO(t,e){let{paneId:r,wrap:i}=t;if(J$(r,e))return;dx(r);let u=j(e),o={active:"nw",disposed:!1,drag:null,paneId:r,rows:[],scope:me(),surface:null,tab:e,wrap:i};v.set(r,o),R(u,e.documentPath??""),W().then(({mountImageEditorSurface:n})=>{if(o.disposed)return;o.surface=n(i,y(o,u),Y(o,u)),o.scope.run(()=>{te(()=>{if(!o.disposed)o.surface?.update(y(o,u))})})})}async function X(t,e){if(t.source===null)await R(t,e);if(t.source===null&&t.status==="loading")await R(t,e);return t.source}function S(t){let e=le(t);return[...v.values()].filter((r)=>le(r.tab)===e)}async function K$(t){let e=t.documentPath??"",r=e.split("/").pop()??e;if(ra(t))return w.warn(`You have read access to this session — the edit to ${r} stays in your browser and cannot be saved.`,{key:`image.readOnly:${e}`,path:e,source:"Collaboration"}),!1;let i=U(t);if(i===void 0||i.saving)return i===void 0;for(let u of S(t))u.surface?.flushFields(),u.drag=null;if(i.typed=!1,i.live!==null)P(i,i.live);i.saving=!0;try{let{size:u}=i,o=m(i);if(u===null||H1(o,u))return w.info(`${r} has no changes, so nothing was written.`,{key:`image.identity:${e}`}),!0;let n=(E)=>(w.error(`Could not save ${r}.`,{detail:E,path:e,source:"Image"}),!1),a=await X(i,e);if(a===null)return n(i.message);let l=j1(e)??"",{bakeImage:c}=await _(),s;try{s=await c(o,a.bytes,l)}catch(E){return n(`The browser could not process this image: ${Z(E)}`)}if(!s.ok)return n(s.reason);if(!xl(t))return!1;if(t.documentPath!==e)return n("It was renamed while saving, so the edit was not written to its old name.");let{blob:f}=s,d=Zm(a.bytes.byteLength),I=f.size>a.bytes.byteLength?", so the file grew":"";if(!await Jx(e,new File([f],r,{type:l}),{note:`${s.size.width} × ${s.size.height}, ${Zm(f.size)} (was ${d}${I})`}))return!1;return O(i,new Uint8Array(await f.arrayBuffer()),l),i.size=s.size,i.decoded=!0,yl(e,s.size.width,s.size.height),i.live=null,i.history=A_(),!0}finally{if(i.saving=!1,S(t).length===0)T(i),i.generation+=1}}function TO(t){let e=g.tabs.get(t);if(!e||!dl(e))return!0;let r=t.split("/").pop()??t;return w.warn(`${r} has an unsaved edit. Save or discard it before replacing the file.`,{key:`image.replaceDirty:${t}`,path:t,source:"Image"}),!1}function ux(t){let e=g.tabs.get(t),r=e&&U(e);if(!e||r===void 0||r.saving||dl(e))return;if(T(r),r.generation+=1,r.size=null,r.decoded=!1,r.live=null,r.history=A_(),S(e).length>0)R(r,t)}jR(dl);
|
|
2
|
+
export{ds,dl,J$,dx,EO,K$,TO,ux,hx,eh,$O};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=FC35BF2240572F9B64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qvb2jr83.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{w}from"./studio-5k9mfafh.js";import{le}from"./studio-y3tjh2xb.js";import{Q,S}from"./studio-0z8kp4xk.js";var tt={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],insertTab:"elements",elementsOpen:new Map,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function nM(){return m+=1,m}var l=new Map;function yr(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function Eh(e){return e.wrap}function ef(){return[...l.values()]}function rd(e){if(!e)return null;for(let r of l.values())if(Eh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function iM(e,r){let t=yr(e);return t.wrap=r,g(t),t}function rM(e){if(l.get(e))UR(e);let t=v(e);return l.set(e,t),t}var b=null;function oM(e){b=e}function UR(e){let r=l.get(e);if(!r)return;b?.(r),g(r),T(e)}function T(e){l.delete(e)}var tf="commit";function h(e){return S(e)&&Q(e.then)}function Ay(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!h(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var M={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=M[r],n=t?{detail:C(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return w.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function C(e){return e instanceof Error?e.stack??e.message:String(e)}function Py(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(tf)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),h(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function qR(e){e?._writes?.cancel()}function nu(e){return Boolean(e?.getModel())}function nf(e,r){if(!nu(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function y(e){let r=le(e);return[...ef().map((o)=>o.monacoEditor),tt.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&le(o._editingTab)===r&&nu(o))}async function iu(e){for(let r of y(e)){if(!nu(r))continue;try{await r._writes?.flush(tf)}catch(t){let o={detail:C(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;w.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function rf(e){return y(e).some((r)=>r._writes?.typed()===!0)}
|
|
2
|
+
export{tt,nM,yr,Eh,ef,rd,iM,rM,oM,UR,tf,Ay,Py,qR,nu,nf,iu,rf};
|
|
3
|
+
|
|
4
|
+
//# debugId=96791901C77EA15064756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-r85zw6ay.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{pf}from"./studio-m3jrjfhy.js";import{l_,h}from"./studio-s49y6m5b.js";import{tr,xo,Lx,u}from"./studio-1d8m5s38.js";import{De}from"./studio-43pynnhz.js";import{bt,ul,ji,Wc,Pp,Wo,PL,BL}from"./studio-aaw7wxv8.js";import{b0,lT,y0}from"./studio-vswmz40d.js";import{x,wl}from"./studio-zn7ysyzb.js";import{ou}from"./studio-151kgn69.js";import{E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,J,S,Ni,ld}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var ew="Project Styles",Au="stylebook",lm="tokens",K="source",sb={elements:Au,variables:lm,code:K},BS=["elements","variables","code"],xN=BS.map((e)=>sb[e]),VS=[{id:"color",prefix:"--color-",title:"Colors"},{id:"font",prefix:"--font-",title:"Fonts"},{id:"size",prefix:"--size-",title:"Sizes & Spacing"},{id:"other",prefix:"--",title:"Other"}];function WS(e){if(e.startsWith("--color"))return"color";if(e.startsWith("--font"))return"font";if(e.startsWith("--size")||e.startsWith("--spacing")||e.startsWith("--radius"))return"size";return"other"}function Q(e){let o=WS(e);if(o==="other")return e;let{prefix:t}=VS.find((r)=>r.id===o);return l_(e,t)}function Z(e){if(!e)return[];let o=[];for(let[t,r]of Object.entries(e)){if(!t.startsWith("--"))continue;if(!n(r)&&!J(r))continue;o.push({group:WS(t),label:Q(t),name:t,value:r})}return o}function zS(e){let o=Z(e);return VS.map((t)=>({group:t,tokens:o.filter((r)=>r.group===t.id)}))}function US(e){if(!e)return[];let{featureQueries:o,sizeBreakpoints:t}=Wo(e),r=[],a=[];for(let{name:l,query:d}of o){let v=Pp(d);if(v)r.push({key:`@${l}`,kind:"scheme",label:v==="dark"?"Dark":"Light",name:l,scheme:v});else a.push({key:`@${l}`,kind:"feature",label:`@${l}`,name:l})}let i=t.map(({name:l})=>({key:`@${l}`,kind:"size",label:`@${l}`,name:l}));return[...r,...i,...a]}function D(e,o){return Ni(e,o.key)}function tw(e,o,t){let r=D(e,o)?.[t];return n(r)||J(r)?r:void 0}function wE(e,o,t,r){if(r){ld(e,o.key)[t]=r;return}let a=D(e,o);if(!a)return;if(delete a[t],Object.keys(a).length===0)delete e[o.key]}function _N(e,o,t,r=[]){let a=new Set(r.map((i)=>i.name));return o.filter((i)=>!a.has(i.name)&&tw(e,i,t)===void 0)}function W(e){return!e.startsWith(":")&&!e.startsWith(".")&&!e.startsWith("&")&&!e.startsWith("[")&&!e.startsWith("@")&&!e.startsWith("--")}function N(e){return S(e)&&!Array.isArray(e)}var L="& .element-card-preview";function nw(e){let o={},t=(r)=>{let a={};for(let[i,l]of Object.entries(r))if(i!=="@--")a[i]=l;return a};for(let[r,a]of Object.entries(e)){if(!N(a)){o[r]=a;continue}if(r==="@--")continue;if(pf(r)){o[r]=a;continue}if(r.startsWith("@")){let i={};for(let[l,d]of Object.entries(a))if(N(d)&&W(l))i[`${L} ${l}`]=t(d);else i[l]=d;o[r]=i;continue}if(W(r)){o[`${L} ${r}`]=t(a);continue}o[r]=a}return o}function A(e,o){let t=o.split(" "),r=e;for(let a of t){if(!N(r))return null;r=r[a]}return N(r)?r:null}function iw(e,o){let t=A(e,o);if(t&&Object.keys(t).length>0)return!0;for(let[r,a]of Object.entries(e)){if(!r.startsWith("@")||!N(a))continue;let i=A(a,o);if(i&&Object.keys(i).length>0)return!0}return!1}function X(e){if(!e)return null;return e.split(" ").pop()??null}function rw(e,o){let t=X(o),r=[],a=(i,l,d)=>{let v=d?`${d} ${i.tag}`:i.tag;r.push({depth:l,entry:i,path:v,selected:i.tag===t,tag:i.tag});let C=i.children?[...new Map(i.children.map((w)=>[w.tag,w])).values()]:[];for(let w of C)a(w,l+1,v)};for(let i of e)a(i,0,"");return r}function B(e){let o=new Map,t=new Map,r=e.filter.toLowerCase(),a=(s,p,g)=>{let c=s.tag===g?g:`${g} ${s.tag}`;o.set(Wc(p),c);let f=s.children??[];for(let[y,O]of f.entries())a(O,[...p,"children",y],g)},i=(s)=>{let p={...s.attributes};if(s.style)p.style=s.style;let g={tagName:s.tag};if(s.text)g.textContent=s.text;if(Object.keys(p).length>0)g.attributes=p;if(s.children)g.children=s.children.map(i);return g},l=(s,p,g,c,f)=>{o.set(Wc(c),s),o.set(Wc([...c,"children",0]),s);let y=[...c,"children",0,"children",0];if(f)a(f,y,s);else o.set(Wc(y),s);if(!t.has(s))t.set(s,c);return{attributes:{class:"element-card"},children:[{attributes:{class:"element-card-preview"},children:[g],tagName:"div"},{attributes:{class:"element-card-label"},tagName:"div",textContent:p}],tagName:"div"}},d=[],v=(s,p)=>({attributes:{class:"sb-section"},children:[{attributes:{class:"sb-label"},tagName:"div",textContent:s},{attributes:{class:"sb-body"},children:p,tagName:"div"}],tagName:"div"}),C=()=>["children",d.length,"children",1];for(let s of e.meta.$sections){let p=s.elements;if(r)p=p.filter((f)=>f.tag.includes(r)||s.label.toLowerCase().includes(r));if(e.customizedOnly)p=p.filter((f)=>iw(e.effectiveStyle,f.tag));if(p.length===0)continue;let g=C(),c=p.map((f,y)=>l(f.tag,`<${f.tag}>`,i(f),[...g,"children",y],f));d.push(v(s.label,c))}let w=[];{let s=e.components;if(r)s=s.filter((p)=>p.tagName.toLowerCase().includes(r));if(e.customizedOnly)s=s.filter((p)=>iw(e.effectiveStyle,p.tagName));if(s.length>0){let p=C(),g=s.map((c,f)=>{let y=[...p,"children",f];if(c.source!=="npm"&&c.path?.endsWith(".json")){w.push({$ref:`/${e.projectRoot?`${e.projectRoot}/`:""}${c.path}`.replace(/^\/+/,"/")});let P=e.specimens?.get(c.tagName);if(P?.kind==="props"){let m={$props:P.props,tagName:c.tagName};return l(c.tagName,`<${c.tagName}>`,m,y,null)}if(P?.kind!=="none"){let m={};for(let j of c.props??[])if(j.default!==void 0&&j.default!=="false"&&j.default!=="''")m[j.name]=String(j.default).replaceAll(/^'|'$/g,"");let M={tagName:c.tagName};if(Object.keys(m).length>0)M.attributes=m;return l(c.tagName,`<${c.tagName}>`,M,y,null)}}let z={attributes:{class:"sb-fallback"},tagName:"div",textContent:`<${c.tagName}>`};return l(c.tagName,`<${c.tagName}>`,z,y,null)});d.push(v("Components",g))}}if(d.length===0)d.push({attributes:{class:"sb-empty"},tagName:"div",textContent:e.customizedOnly?"No customized elements":"No matching elements"});let k={};if(w.length>0)k.$elements=w;if(e.effectiveHead&&e.effectiveHead.length>0)k.$head=e.effectiveHead;return k.$media=e.effectiveMedia,k.attributes={class:"sb-root"},k.children=d,k.style=nw(e.effectiveStyle),k.tagName="div",{doc:k,pathToTag:o,tagToCardPath:t}}var H={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylebookChrome",$description:"The bar across the top of the Project Styles canvas: the filter that narrows the specimen catalogue, and the toggle that reduces it to the elements this file has already styled. Both are shell state rather than document state — the adapter owns which — and the two names come in as values, because the surface is called Project Styles and the canvas view it draws is the wire word `stylebook`; nothing a reader sees here may be spelled from that. **The bar IS the kit's toolbar now.** It used to write `role=\"toolbar\"` and its own `aria-label` on a `<div>`, which is a role with none of the behaviour under it: two controls, two tab stops, and no arrow key between them. `jx-action-group` is not the element for it — that one roves `jx-action-button` and this bar's first control is a `jx-textfield` — so `jx-toolbar` is, and the field keeps its own arrows while its caret still has text to walk (ui.md §5.5).",tagName:"jx-toolbar",attributes:{part:"chrome"},$props:{label:{$ref:"#/state/title"}},style:{$description:'What `.sb-chrome` said in `styles/overlays.css`, plus the six inline declarations the template carried beside it, plus `.tb-toggle` — all three go dead with this conversion, and none of them is shared with another surface. Three repairs on the way. The bar is one element rather than a positioned box wrapping a `role="toolbar"` row that declared the same flex layout again. The flex layout is not declared here EITHER any more: `display: flex`, `align-items: center`, the `--jx-space-2` gap, the sans face and the foreground colour are all `jx-toolbar`\'s own, so what is left below is only what a positioned BAND is. And `.tb-toggle` read `var(--spectrum-font-size-50, 11px)`, which the kit spells `--jx-text-sm` at the same value; the rest of its drawing is a `jx-action-button` reaching in through `part="control"`, because what it has to look like is a small bordered chip and every fill and control height the kit draws would otherwise have to be taken back off.',position:"absolute",top:"0",left:"0",right:"0",zIndex:"15",flexShrink:"0",padding:"var(--jx-space-2) var(--jx-space-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",'& [part="filter"]':{flex:"1",maxWidth:"200px"},'& [part="customized"] > [part="control"]':{$description:"Bordered, unfilled and dimmed until it is on, which is what says it is a filter rather than an action: the catalogue it narrows is the thing the reader is looking at, so the control has to be quieter than its subject.",padding:"3px var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"transparent",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",":hover":{background:"var(--hover-bg)"}},'& [part="customized"][data-selected] > [part="control"]':{$description:"`data-selected` and not `selected`: the kit reflects the pressed state as a data attribute (`jx-action-button.json`), and the property this document binds never reaches the attribute of the same name.",borderColor:"var(--accent)",background:"var(--accent-15)",color:"var(--accent)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:{$ref:"#/state/filterLabel"},placeholder:"Filter…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",$description:"`onchange` and not `onclick`: a `toggles` button owns its own pressed state and says so with `change` (`jx-action-button.json`), and an `onclick` written here would replace the element's own click handler on the same property — the toggle would stop flipping and stop announcing `aria-pressed`.",attributes:{part:"customized"},$props:{size:"sm",toggles:!0,selected:{$ref:"#/state/customizedOnly"},label:{$ref:"#/state/customizedLabel"},hint:{$ref:"#/state/customizedHint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleCustomized"},value:[]}]},children:[{tagName:"span",textContent:"${state.customizedLabel}"}]}]};E("stylebook-chrome",H);function V(e,o){let t=document.createElement("div");t.style.display="contents";let r=b({...e,...o}),a=null,i=!1;function l(){i=!0,I("stylebook-chrome",r,t).then((d)=>{i=!1,a=d})}return l(),{host:t,update(d){if(Object.assign(r,d),i||a!==null&&t.contains(a.root))return;a?.dispose(),a=null,t.textContent="",l()}}}var q=new WeakMap;async function te(e){let{path:o}=e;if(e.source==="npm"||!o?.endsWith(".json"))return{kind:"bare"};let t=await lT(o);if(!t)return{kind:"bare"};let r=b0(t);if(r.size>0&&await y0(t,o,r))return{kind:"props",props:Object.fromEntries(r)};return await y0(t,o,new Map)?{kind:"bare"}:{kind:"none"}}async function F(e,o=te){let t=q.get(e);if(!t)t=new Map,q.set(e,t);let r=t,a=await Promise.all(e.map(async(i)=>{let l=i.path??i.tagName,d=r.get(l);if(!d)d=o(i).catch(()=>({kind:"bare"})),r.set(l,d);return[i.tagName,await d]}));return new Map(a)}var gp={$sections:[{label:"Headings",elements:[{tag:"h1",text:"Code Is Poetry"},{tag:"h2",text:"Code Is Poetry"},{tag:"h3",text:"Code Is Poetry"},{tag:"h4",text:"Code Is Poetry"},{tag:"h5",text:"Code Is Poetry"},{tag:"h6",text:"Code Is Poetry"}]},{label:"Paragraph",elements:[{tag:"p",text:"In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing."}]},{label:"List",elements:[{tag:"ul",children:[{tag:"li",text:"Alice."},{tag:"li",text:"The White Rabbit."},{tag:"li",text:"The Cheshire Cat."},{tag:"li",text:"The Mad Hatter."},{tag:"li",text:"The Queen of Hearts."}]},{tag:"ol",children:[{tag:"li",text:"First item"},{tag:"li",text:"Second item"},{tag:"li",text:"Third item"}]}]},{label:"Quote",elements:[{tag:"blockquote",children:[{tag:"p",text:"In quoting others, we cite ourselves.",style:"font-size:1.25em;font-style:italic"},{tag:"p",text:"— Julio Cortázar"}]}]},{label:"Code",elements:[{tag:"pre",children:[{tag:"code",text:`// A "block" is the abstract term used
|
|
1
|
+
import{bf}from"./studio-s6ymkf3q.js";import{p_,h}from"./studio-ybkd5w8k.js";import{nr,_o,Ox,u}from"./studio-3kmqhwtt.js";import{De}from"./studio-mrb10hv3.js";import{bt,pl,Hi,Uc,jp,zo,UL,YL}from"./studio-m25ry0mf.js";import{kS,gT,ES}from"./studio-6w8mt734.js";import{x,_l}from"./studio-anc8067x.js";import{au}from"./studio-ft706q02.js";import{E,I}from"./studio-xxttcym1.js";import{b}from"./studio-y3tjh2xb.js";import{n,J,S,Di,dd}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";var ow="Project Styles",Mu="stylebook",hm="tokens",K="source",db={elements:Mu,variables:hm,code:K},G0=["elements","variables","code"],NN=G0.map((e)=>db[e]),Y0=[{id:"color",prefix:"--color-",title:"Colors"},{id:"font",prefix:"--font-",title:"Fonts"},{id:"size",prefix:"--size-",title:"Sizes & Spacing"},{id:"other",prefix:"--",title:"Other"}];function Z0(e){if(e.startsWith("--color"))return"color";if(e.startsWith("--font"))return"font";if(e.startsWith("--size")||e.startsWith("--spacing")||e.startsWith("--radius"))return"size";return"other"}function Q(e){let o=Z0(e);if(o==="other")return e;let{prefix:t}=Y0.find((r)=>r.id===o);return p_(e,t)}function Z(e){if(!e)return[];let o=[];for(let[t,r]of Object.entries(e)){if(!t.startsWith("--"))continue;if(!n(r)&&!J(r))continue;o.push({group:Z0(t),label:Q(t),name:t,value:r})}return o}function X0(e){let o=Z(e);return Y0.map((t)=>({group:t,tokens:o.filter((r)=>r.group===t.id)}))}function Q0(e){if(!e)return[];let{featureQueries:o,sizeBreakpoints:t}=zo(e),r=[],a=[];for(let{name:l,query:d}of o){let v=jp(d);if(v)r.push({key:`@${l}`,kind:"scheme",label:v==="dark"?"Dark":"Light",name:l,scheme:v});else a.push({key:`@${l}`,kind:"feature",label:`@${l}`,name:l})}let i=t.map(({name:l})=>({key:`@${l}`,kind:"size",label:`@${l}`,name:l}));return[...r,...i,...a]}function D(e,o){return Di(e,o.key)}function sw(e,o,t){let r=D(e,o)?.[t];return n(r)||J(r)?r:void 0}function $E(e,o,t,r){if(r){dd(e,o.key)[t]=r;return}let a=D(e,o);if(!a)return;if(delete a[t],Object.keys(a).length===0)delete e[o.key]}function DN(e,o,t,r=[]){let a=new Set(r.map((i)=>i.name));return o.filter((i)=>!a.has(i.name)&&sw(e,i,t)===void 0)}function W(e){return!e.startsWith(":")&&!e.startsWith(".")&&!e.startsWith("&")&&!e.startsWith("[")&&!e.startsWith("@")&&!e.startsWith("--")}function N(e){return S(e)&&!Array.isArray(e)}var L="& .element-card-preview";function aw(e){let o={},t=(r)=>{let a={};for(let[i,l]of Object.entries(r))if(i!=="@--")a[i]=l;return a};for(let[r,a]of Object.entries(e)){if(!N(a)){o[r]=a;continue}if(r==="@--")continue;if(bf(r)){o[r]=a;continue}if(r.startsWith("@")){let i={};for(let[l,d]of Object.entries(a))if(N(d)&&W(l))i[`${L} ${l}`]=t(d);else i[l]=d;o[r]=i;continue}if(W(r)){o[`${L} ${r}`]=t(a);continue}o[r]=a}return o}function A(e,o){let t=o.split(" "),r=e;for(let a of t){if(!N(r))return null;r=r[a]}return N(r)?r:null}function lw(e,o){let t=A(e,o);if(t&&Object.keys(t).length>0)return!0;for(let[r,a]of Object.entries(e)){if(!r.startsWith("@")||!N(a))continue;let i=A(a,o);if(i&&Object.keys(i).length>0)return!0}return!1}function X(e){if(!e)return null;return e.split(" ").pop()??null}function cw(e,o){let t=X(o),r=[],a=(i,l,d)=>{let v=d?`${d} ${i.tag}`:i.tag;r.push({depth:l,entry:i,path:v,selected:i.tag===t,tag:i.tag});let C=i.children?[...new Map(i.children.map((w)=>[w.tag,w])).values()]:[];for(let w of C)a(w,l+1,v)};for(let i of e)a(i,0,"");return r}function B(e){let o=new Map,t=new Map,r=e.filter.toLowerCase(),a=(s,p,g)=>{let c=s.tag===g?g:`${g} ${s.tag}`;o.set(Uc(p),c);let f=s.children??[];for(let[y,O]of f.entries())a(O,[...p,"children",y],g)},i=(s)=>{let p={...s.attributes};if(s.style)p.style=s.style;let g={tagName:s.tag};if(s.text)g.textContent=s.text;if(Object.keys(p).length>0)g.attributes=p;if(s.children)g.children=s.children.map(i);return g},l=(s,p,g,c,f)=>{o.set(Uc(c),s),o.set(Uc([...c,"children",0]),s);let y=[...c,"children",0,"children",0];if(f)a(f,y,s);else o.set(Uc(y),s);if(!t.has(s))t.set(s,c);return{attributes:{class:"element-card"},children:[{attributes:{class:"element-card-preview"},children:[g],tagName:"div"},{attributes:{class:"element-card-label"},tagName:"div",textContent:p}],tagName:"div"}},d=[],v=(s,p)=>({attributes:{class:"sb-section"},children:[{attributes:{class:"sb-label"},tagName:"div",textContent:s},{attributes:{class:"sb-body"},children:p,tagName:"div"}],tagName:"div"}),C=()=>["children",d.length,"children",1];for(let s of e.meta.$sections){let p=s.elements;if(r)p=p.filter((f)=>f.tag.includes(r)||s.label.toLowerCase().includes(r));if(e.customizedOnly)p=p.filter((f)=>lw(e.effectiveStyle,f.tag));if(p.length===0)continue;let g=C(),c=p.map((f,y)=>l(f.tag,`<${f.tag}>`,i(f),[...g,"children",y],f));d.push(v(s.label,c))}let w=[];{let s=e.components;if(r)s=s.filter((p)=>p.tagName.toLowerCase().includes(r));if(e.customizedOnly)s=s.filter((p)=>lw(e.effectiveStyle,p.tagName));if(s.length>0){let p=C(),g=s.map((c,f)=>{let y=[...p,"children",f];if(c.source!=="npm"&&c.path?.endsWith(".json")){w.push({$ref:`/${e.projectRoot?`${e.projectRoot}/`:""}${c.path}`.replace(/^\/+/,"/")});let P=e.specimens?.get(c.tagName);if(P?.kind==="props"){let m={$props:P.props,tagName:c.tagName};return l(c.tagName,`<${c.tagName}>`,m,y,null)}if(P?.kind!=="none"){let m={};for(let j of c.props??[])if(j.default!==void 0&&j.default!=="false"&&j.default!=="''")m[j.name]=String(j.default).replaceAll(/^'|'$/g,"");let M={tagName:c.tagName};if(Object.keys(m).length>0)M.attributes=m;return l(c.tagName,`<${c.tagName}>`,M,y,null)}}let z={attributes:{class:"sb-fallback"},tagName:"div",textContent:`<${c.tagName}>`};return l(c.tagName,`<${c.tagName}>`,z,y,null)});d.push(v("Components",g))}}if(d.length===0)d.push({attributes:{class:"sb-empty"},tagName:"div",textContent:e.customizedOnly?"No customized elements":"No matching elements"});let k={};if(w.length>0)k.$elements=w;if(e.effectiveHead&&e.effectiveHead.length>0)k.$head=e.effectiveHead;return k.$media=e.effectiveMedia,k.attributes={class:"sb-root"},k.children=d,k.style=aw(e.effectiveStyle),k.tagName="div",{doc:k,pathToTag:o,tagToCardPath:t}}var H={$schema:"https://jxsuite.com/schema/v1",$id:"StudioStylebookChrome",$description:"The bar across the top of the Project Styles canvas: the filter that narrows the specimen catalogue, and the toggle that reduces it to the elements this file has already styled. Both are shell state rather than document state — the adapter owns which — and the two names come in as values, because the surface is called Project Styles and the canvas view it draws is the wire word `stylebook`; nothing a reader sees here may be spelled from that. **The bar IS the kit's toolbar now.** It used to write `role=\"toolbar\"` and its own `aria-label` on a `<div>`, which is a role with none of the behaviour under it: two controls, two tab stops, and no arrow key between them. `jx-action-group` is not the element for it — that one roves `jx-action-button` and this bar's first control is a `jx-textfield` — so `jx-toolbar` is, and the field keeps its own arrows while its caret still has text to walk (ui.md §5.5).",tagName:"jx-toolbar",attributes:{part:"chrome"},$props:{label:{$ref:"#/state/title"}},style:{$description:'What `.sb-chrome` said in `styles/overlays.css`, plus the six inline declarations the template carried beside it, plus `.tb-toggle` — all three go dead with this conversion, and none of them is shared with another surface. Three repairs on the way. The bar is one element rather than a positioned box wrapping a `role="toolbar"` row that declared the same flex layout again. The flex layout is not declared here EITHER any more: `display: flex`, `align-items: center`, the `--jx-space-2` gap, the sans face and the foreground colour are all `jx-toolbar`\'s own, so what is left below is only what a positioned BAND is. And `.tb-toggle` read `var(--spectrum-font-size-50, 11px)`, which the kit spells `--jx-text-sm` at the same value; the rest of its drawing is a `jx-action-button` reaching in through `part="control"`, because what it has to look like is a small bordered chip and every fill and control height the kit draws would otherwise have to be taken back off.',position:"absolute",top:"0",left:"0",right:"0",zIndex:"15",flexShrink:"0",padding:"var(--jx-space-2) var(--jx-space-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",'& [part="filter"]':{flex:"1",maxWidth:"200px"},'& [part="customized"] > [part="control"]':{$description:"Bordered, unfilled and dimmed until it is on, which is what says it is a filter rather than an action: the catalogue it narrows is the thing the reader is looking at, so the control has to be quieter than its subject.",padding:"3px var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"transparent",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",":hover":{background:"var(--hover-bg)"}},'& [part="customized"][data-selected] > [part="control"]':{$description:"`data-selected` and not `selected`: the kit reflects the pressed state as a data attribute (`jx-action-button.json`), and the property this document binds never reaches the attribute of the same name.",borderColor:"var(--accent)",background:"var(--accent-15)",color:"var(--accent)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:{$ref:"#/state/filterLabel"},placeholder:"Filter…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",$description:"`onchange` and not `onclick`: a `toggles` button owns its own pressed state and says so with `change` (`jx-action-button.json`), and an `onclick` written here would replace the element's own click handler on the same property — the toggle would stop flipping and stop announcing `aria-pressed`.",attributes:{part:"customized"},$props:{size:"sm",toggles:!0,selected:{$ref:"#/state/customizedOnly"},label:{$ref:"#/state/customizedLabel"},hint:{$ref:"#/state/customizedHint"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleCustomized"},value:[]}]},children:[{tagName:"span",textContent:"${state.customizedLabel}"}]}]};E("stylebook-chrome",H);function V(e,o){let t=document.createElement("div");t.style.display="contents";let r=b({...e,...o}),a=null,i=!1;function l(){i=!0,I("stylebook-chrome",r,t).then((d)=>{i=!1,a=d})}return l(),{host:t,update(d){if(Object.assign(r,d),i||a!==null&&t.contains(a.root))return;a?.dispose(),a=null,t.textContent="",l()}}}var q=new WeakMap;async function te(e){let{path:o}=e;if(e.source==="npm"||!o?.endsWith(".json"))return{kind:"bare"};let t=await gT(o);if(!t)return{kind:"bare"};let r=kS(t);if(r.size>0&&await ES(t,o,r))return{kind:"props",props:Object.fromEntries(r)};return await ES(t,o,new Map)?{kind:"bare"}:{kind:"none"}}async function F(e,o=te){let t=q.get(e);if(!t)t=new Map,q.set(e,t);let r=t,a=await Promise.all(e.map(async(i)=>{let l=i.path??i.tagName,d=r.get(l);if(!d)d=o(i).catch(()=>({kind:"bare"})),r.set(l,d);return[i.tagName,await d]}));return new Map(a)}var vp={$sections:[{label:"Headings",elements:[{tag:"h1",text:"Code Is Poetry"},{tag:"h2",text:"Code Is Poetry"},{tag:"h3",text:"Code Is Poetry"},{tag:"h4",text:"Code Is Poetry"},{tag:"h5",text:"Code Is Poetry"},{tag:"h6",text:"Code Is Poetry"}]},{label:"Paragraph",elements:[{tag:"p",text:"In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing."}]},{label:"List",elements:[{tag:"ul",children:[{tag:"li",text:"Alice."},{tag:"li",text:"The White Rabbit."},{tag:"li",text:"The Cheshire Cat."},{tag:"li",text:"The Mad Hatter."},{tag:"li",text:"The Queen of Hearts."}]},{tag:"ol",children:[{tag:"li",text:"First item"},{tag:"li",text:"Second item"},{tag:"li",text:"Third item"}]}]},{label:"Quote",elements:[{tag:"blockquote",children:[{tag:"p",text:"In quoting others, we cite ourselves.",style:"font-size:1.25em;font-style:italic"},{tag:"p",text:"— Julio Cortázar"}]}]},{label:"Code",elements:[{tag:"pre",children:[{tag:"code",text:`// A "block" is the abstract term used
|
|
2
2
|
// to describe units of markup that
|
|
3
3
|
// when composed together, form the
|
|
4
4
|
// content or layout of a page.
|
|
5
|
-
registerBlockType( name, settings );`}]}]},{label:"Inline",elements:[{tag:"a",text:"Visit the documentation",attributes:{href:"#"}},{tag:"strong",text:"Bold text emphasis"},{tag:"em",text:"Italic text emphasis"},{tag:"small",text:"Fine print and legal text"},{tag:"mark",text:"Highlighted text"},{tag:"code",text:"const x = 42;"},{tag:"abbr",text:"HTML",attributes:{title:"HyperText Markup Language"}},{tag:"sub",text:"subscript"},{tag:"sup",text:"superscript"}]},{label:"Form",elements:[{tag:"input",attributes:{type:"text",placeholder:"Enter text…"}},{tag:"button",text:"Click Me"},{tag:"select",children:[{tag:"option",text:"Option 1"},{tag:"option",text:"Option 2"},{tag:"option",text:"Option 3"}]},{tag:"textarea",attributes:{placeholder:"Enter longer text…",rows:"3"}}]},{label:"Table",elements:[{tag:"table",children:[{tag:"thead",children:[{tag:"tr",children:[{tag:"th",text:"Name"},{tag:"th",text:"Role"},{tag:"th",text:"Status"}]}]},{tag:"tbody",children:[{tag:"tr",children:[{tag:"td",text:"Alice"},{tag:"td",text:"Developer"},{tag:"td",text:"Active"}]},{tag:"tr",children:[{tag:"td",text:"Bob"},{tag:"td",text:"Designer"},{tag:"td",text:"Away"}]},{tag:"tr",children:[{tag:"td",text:"Carol"},{tag:"td",text:"Manager"},{tag:"td",text:"Active"}]}]}]}]},{label:"Interactive",elements:[{tag:"details",attributes:{open:""},children:[{tag:"summary",text:"Click to expand details"},{tag:"p",text:"Additional detail content revealed when the disclosure widget is toggled open."}]}]},{label:"Media",elements:[{tag:"img",attributes:{alt:"Placeholder image"},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"video",attributes:{controls:""},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"audio",attributes:{controls:""},style:"width:100%"}]}],$variables:{color:{label:"Color",prefix:"--color-",placeholder:"#007acc"},font:{label:"Font",prefix:"--font-",placeholder:"system-ui, sans-serif"},size:{label:"Size",prefix:"--size-",placeholder:"16px"},other:{label:"Other",prefix:"--",placeholder:"value"}}};var G=new WeakMap;function ne(e){let o={customizedHint:"Show only the elements this file has already styled",customizedLabel:"Customized",customizedOnly:u.stylebook.customizedOnly,filter:u.stylebook.filter,filterLabel:`Filter the ${ew} catalogue`,title:ew},t=G.get(e);if(t)return t.update(o),t.host;let r=V(o,{setFilter:(a)=>{u.stylebook.filter=a},toggleCustomized:()=>{u.stylebook.customizedOnly=!u.stylebook.customizedOnly}});return G.set(e,r),r.host}function re(e,o){let t=e.filter((r)=>r.name===(o??"base"));return t.length>0?t:e.slice(0,1)}async function SN(e,o){let t=e.wrap,r=bt(e.paneId),a=u.stylebook.filter.toLowerCase(),{customizedOnly:i}=u.stylebook,l=e.renderGeneration,d=De,v=F(d),C=tr(r?.doc.document?.$media),{sizeBreakpoints:w,baseWidth:k}=Wo(C),s=w.length>0,p=ne(e);t.style.overflow="hidden";let g=[];if(s){g.push({displayName:ji("--"),name:"base",width:k});for(let m of w)g.push({displayName:ji(m.name),name:m.name,width:m.width})}let c;if(!s){let m=C["--"],M=m?`${ji("--")} (${k}px)`:null;c=[o.canvasPanelEntry(m?"base":null,M,!m,m?k:void 0)]}else c=re(g,ul(e.paneId)).map((m)=>o.canvasPanelEntry(m.name,`${m.displayName} (${m.width}px)`,!1,m.width));if(!await o.drawStage(e,{frame:"boards",framePart:"panzoom",frameVars:"--boards-inset:40px",handles:"hidden",hug:!1,innerPart:"boards",lead:"chrome",panels:c.map((m)=>m.item)},c))return;let y=o.stageHost(e,"chrome-host");if(y&&y.firstChild!==p)y.replaceChildren(p);let O=await v;if(e.renderGeneration!==l)return;let z=B({components:d,specimens:O,customizedOnly:Boolean(i),effectiveHead:Lx(r?.doc.document?.$head),effectiveMedia:C,effectiveStyle:xo(r?.doc.document?.style),filter:a,meta:gp,projectRoot:x?.projectRoot??null}),{panels:P}=e;for(let{panel:m}of c)P.push(m),PL(e.renderGeneration,z,m.canvas,m._width);if(s)o.updateActivePanelHeaders(e);o.applyTransform(e),o.observeCenterUntilStable(e)}function $d(e,o,{panCanvas:t=!1}={}){let r={activeSelector:e,rightTab:"style"};if(o!==void 0)r.activeMedia=o;if(wl(h.value,{selection:[],ui:r}),u.stylebook.selection=e,e&&t)BL(e)}var qS=[{id:"page",strip:"page",title:"Page"},{id:"properties",strip:"element",title:"Content"},{id:"style",strip:"element",title:"Style"},{id:"events",strip:"element",title:"Logic"},{id:"assistant",strip:"assistant",title:"Assistant"}],xE=[{id:"page",title:"Page"},{id:"element",title:"Element"},{id:"assistant",title:"Assistant"}];function KS(){return{saveDocument:()=>{},undo:()=>{},redo:()=>{},openInBrowser:()=>{},buildSite:()=>{},closeDocument:()=>{},duplicateSelection:()=>{},deleteSelection:()=>{},selectParent:()=>{},toggleDock:()=>{},toggleZen:()=>{},openPalette:()=>{},openProject:()=>{},newWindow:()=>{},panelRoster:[],focusPanel:()=>{},focusInspectorTab:()=>{},cycleRegion:()=>{}}}var T=(e)=>e.document.open,R=(e)=>e.selection.count>0&&e.editor.kind==="canvas",_=(e)=>!e.selection.isRoot&&e.selection.paths.every((o)=>ou(o)),U="an element selected on the canvas that has a sibling position: not the document root, a repeater's template or a switch case",Y=(e)=>e.map((o)=>`[${o.join(", ")}]`).join(" and ");function cm(e){return[{id:"file.save",title:"Save",category:"File",level:"document",icon:"floppy-disk",keybinding:"mod+s",menus:["commandbar/primary","statusbar/document","palette"],group:"1_file",undo:"none",when:T,enablement:(t)=>t.document.dirty,requires:"unsaved changes",run:()=>e.saveDocument()},{id:"document.close",title:"Close Document",category:"Document",level:"document",keybinding:"mod+w",menus:["context/tab","palette"],group:"1_file",when:T,requires:"an open document",run:()=>e.closeDocument()},{id:"view.openInBrowser",title:"Open in Browser",category:"View",level:"document",icon:"arrow-square-out",keybinding:"mod+shift+o",menus:["commandbar/primary","statusbar/document","palette"],group:"2_output",when:(t)=>t.project.isSite,enablement:T,requires:"a page to preview",run:()=>e.openInBrowser()},{id:"project.buildSite",title:"Build Site",category:"Project",level:"project",menus:["commandbar/overflow","palette"],group:"2_output",when:(t)=>t.project.isSite,requires:"a site project",run:()=>e.buildSite()},{id:"edit.undo",title:"Undo",category:"Edit",level:"document",icon:"arrow-u-up-left",keybinding:"mod+z",menus:["commandbar/primary","palette"],group:"1_history",order:1,when:T,enablement:(t)=>t.document.canUndo,requires:"a change to undo",run:()=>e.undo()},{id:"edit.redo",title:"Redo",category:"Edit",level:"document",icon:"arrow-u-up-right",keybinding:["mod+shift+z","mod+y"],menus:["commandbar/primary","palette"],group:"1_history",order:2,when:T,enablement:(t)=>t.document.canRedo,requires:"a change to redo",run:()=>e.redo()},{id:"selection.duplicate",title:"Duplicate",category:"Selection",level:"selection",keyScope:"canvas",keybinding:"mod+d",menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"3_structure",undo:"document",when:R,enablement:_,requires:U,aiTool:{name:"duplicate_node",description:"Duplicate elements in the document, inserting each copy after its original, as one undoable step. The copies become the selection.",report:({after:t})=>{let r=t.selection.paths.length;return`Duplicated ${r} element${r===1?"":"s"}; the ${r===1?"copy is":"copies are"} selected at ${Y(t.selection.paths)}.`}},run:()=>e.duplicateSelection()},{id:"selection.repeat",title:"Repeat...",category:"Selection",level:"selection",keyScope:"canvas",menus:["context/element","palette"],group:"3_structure",undo:"document",when:R,enablement:(t)=>_(t)&&!t.selection.isRepeater,requires:"an element with a sibling position that is not already a repeater",run:()=>{(ce("g66r6qp1"),import("./convert-to-repeater-g66r6qp1.js")).then(({convertToRepeater:t})=>t())}},{id:"selection.delete",title:"Delete",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["delete","backspace"],menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"9_danger",destructive:!0,undo:"document",when:R,enablement:_,requires:U,aiTool:{name:"delete_node",description:"Delete elements from the document as one undoable step.",report:({before:t,after:r})=>{let a=t.selection.paths.length;return`Deleted ${a} element${a===1?"":"s"} at ${Y(t.selection.paths)} in one undo step; the selection is now ${r.selection.count===0?"empty":"elsewhere"}.`}},run:()=>e.deleteSelection()},{id:"selection.selectParent",title:"Select Parent",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["escape","arrowleft"],menus:["palette"],group:"2_navigate",when:R,requires:"an element selection",run:()=>e.selectParent()},{id:"view.toggleNavigator",title:"Toggle Navigator Dock",category:"View",level:"application",keybinding:"mod+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("navigator")},{id:"view.toggleInspector",title:"Toggle Inspector Dock",category:"View",level:"application",keybinding:"mod+alt+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("inspector")},{id:"view.zen",title:"Zen Mode",category:"View",level:"application",keybinding:"mod+.",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleZen()},{id:"palette.open",title:"Open Command Center",category:"View",level:"application",keybinding:"mod+k",menus:["palette"],group:"5_palette",run:()=>e.openPalette("picker")},{id:"palette.openFiles",title:"Go to File…",category:"File",level:"application",keybinding:"mod+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("files")},{id:"palette.openCommands",title:"Run Command…",category:"View",level:"application",keybinding:"mod+shift+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("commands")},{id:"palette.openNodes",title:"Go to Symbol in Document…",category:"Selection",level:"document",menus:["palette"],group:"5_palette",when:T,requires:"an open document",run:()=>e.openPalette("nodes")},{id:"project.open",title:"Open Project…",category:"Project",level:"project",keybinding:"mod+o",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",when:(t)=>t.capability.openProject,requires:"a host that can open a project from a dialog",run:()=>e.openProject()},{id:"view.newWindow",title:"New Window",category:"View",level:"application",keybinding:"mod+shift+n",menus:["commandbar/overflow","palette"],group:"1_file",when:(t)=>t.capability.windowControls,requires:"a host that can hold more than one window",run:()=>e.newWindow()},{id:"project.openRecent",title:"Open Recent…",category:"Project",level:"project",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",run:()=>e.openPalette("projects")},...ae(e),...ie(e),{id:"view.cycleRegion",title:"Focus Next Region",category:"View",level:"application",keybinding:"f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(1)},{id:"view.cycleRegionBack",title:"Focus Previous Region",category:"View",level:"application",keybinding:"shift+f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(-1)}]}function ae(e){return e.panelRoster.map((o)=>({id:`panel.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"application",menus:["palette"],group:"4_docks",requires:"an open project",when:(t)=>t.project.open&&(o.when?.(t)??!0),run:()=>e.focusPanel(o.id)}))}function ie(e){return qS.map((o,t)=>({id:`inspector.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"document",keybinding:`mod+shift+${t+1}`,menus:["palette"],group:"4_docks",requires:"an open document",when:(a)=>a.document.open,run:()=>e.focusInspectorTab(o.id)}))}
|
|
6
|
-
export{
|
|
5
|
+
registerBlockType( name, settings );`}]}]},{label:"Inline",elements:[{tag:"a",text:"Visit the documentation",attributes:{href:"#"}},{tag:"strong",text:"Bold text emphasis"},{tag:"em",text:"Italic text emphasis"},{tag:"small",text:"Fine print and legal text"},{tag:"mark",text:"Highlighted text"},{tag:"code",text:"const x = 42;"},{tag:"abbr",text:"HTML",attributes:{title:"HyperText Markup Language"}},{tag:"sub",text:"subscript"},{tag:"sup",text:"superscript"}]},{label:"Form",elements:[{tag:"input",attributes:{type:"text",placeholder:"Enter text…"}},{tag:"button",text:"Click Me"},{tag:"select",children:[{tag:"option",text:"Option 1"},{tag:"option",text:"Option 2"},{tag:"option",text:"Option 3"}]},{tag:"textarea",attributes:{placeholder:"Enter longer text…",rows:"3"}}]},{label:"Table",elements:[{tag:"table",children:[{tag:"thead",children:[{tag:"tr",children:[{tag:"th",text:"Name"},{tag:"th",text:"Role"},{tag:"th",text:"Status"}]}]},{tag:"tbody",children:[{tag:"tr",children:[{tag:"td",text:"Alice"},{tag:"td",text:"Developer"},{tag:"td",text:"Active"}]},{tag:"tr",children:[{tag:"td",text:"Bob"},{tag:"td",text:"Designer"},{tag:"td",text:"Away"}]},{tag:"tr",children:[{tag:"td",text:"Carol"},{tag:"td",text:"Manager"},{tag:"td",text:"Active"}]}]}]}]},{label:"Interactive",elements:[{tag:"details",attributes:{open:""},children:[{tag:"summary",text:"Click to expand details"},{tag:"p",text:"Additional detail content revealed when the disclosure widget is toggled open."}]}]},{label:"Media",elements:[{tag:"img",attributes:{alt:"Placeholder image"},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"video",attributes:{controls:""},style:"width:100%;max-width:400px;height:200px;background:#e0e0e0;display:block;border-radius:4px"},{tag:"audio",attributes:{controls:""},style:"width:100%"}]}],$variables:{color:{label:"Color",prefix:"--color-",placeholder:"#007acc"},font:{label:"Font",prefix:"--font-",placeholder:"system-ui, sans-serif"},size:{label:"Size",prefix:"--size-",placeholder:"16px"},other:{label:"Other",prefix:"--",placeholder:"value"}}};var G=new WeakMap;function ne(e){let o={customizedHint:"Show only the elements this file has already styled",customizedLabel:"Customized",customizedOnly:u.stylebook.customizedOnly,filter:u.stylebook.filter,filterLabel:`Filter the ${ow} catalogue`,title:ow},t=G.get(e);if(t)return t.update(o),t.host;let r=V(o,{setFilter:(a)=>{u.stylebook.filter=a},toggleCustomized:()=>{u.stylebook.customizedOnly=!u.stylebook.customizedOnly}});return G.set(e,r),r.host}function re(e,o){let t=e.filter((r)=>r.name===(o??"base"));return t.length>0?t:e.slice(0,1)}async function ON(e,o){let t=e.wrap,r=bt(e.paneId),a=u.stylebook.filter.toLowerCase(),{customizedOnly:i}=u.stylebook,l=e.renderGeneration,d=De,v=F(d),C=nr(r?.doc.document?.$media),{sizeBreakpoints:w,baseWidth:k}=zo(C),s=w.length>0,p=ne(e);t.style.overflow="hidden";let g=[];if(s){g.push({displayName:Hi("--"),name:"base",width:k});for(let m of w)g.push({displayName:Hi(m.name),name:m.name,width:m.width})}let c;if(!s){let m=C["--"],M=m?`${Hi("--")} (${k}px)`:null;c=[o.canvasPanelEntry(m?"base":null,M,!m,m?k:void 0)]}else c=re(g,pl(e.paneId)).map((m)=>o.canvasPanelEntry(m.name,`${m.displayName} (${m.width}px)`,!1,m.width));if(!await o.drawStage(e,{frame:"boards",framePart:"panzoom",frameVars:"--boards-inset:40px",handles:"hidden",hug:!1,innerPart:"boards",lead:"chrome",panels:c.map((m)=>m.item)},c))return;let y=o.stageHost(e,"chrome-host");if(y&&y.firstChild!==p)y.replaceChildren(p);let O=await v;if(e.renderGeneration!==l)return;let z=B({components:d,specimens:O,customizedOnly:Boolean(i),effectiveHead:Ox(r?.doc.document?.$head),effectiveMedia:C,effectiveStyle:_o(r?.doc.document?.style),filter:a,meta:vp,projectRoot:x?.projectRoot??null}),{panels:P}=e;for(let{panel:m}of c)P.push(m),UL(e.renderGeneration,z,m.canvas,m._width);if(s)o.updateActivePanelHeaders(e);o.applyTransform(e),o.observeCenterUntilStable(e)}function Rd(e,o,{panCanvas:t=!1}={}){let r={activeSelector:e,rightTab:"style"};if(o!==void 0)r.activeMedia=o;if(_l(h.value,{selection:[],ui:r}),u.stylebook.selection=e,e&&t)YL(e)}var eS=[{id:"page",strip:"page",title:"Page"},{id:"properties",strip:"element",title:"Content"},{id:"style",strip:"element",title:"Style"},{id:"events",strip:"element",title:"Logic"},{id:"assistant",strip:"assistant",title:"Assistant"}],LE=[{id:"page",title:"Page"},{id:"element",title:"Element"},{id:"assistant",title:"Assistant"}];function tS(){return{saveDocument:()=>{},undo:()=>{},redo:()=>{},openInBrowser:()=>{},buildSite:()=>{},closeDocument:()=>{},duplicateSelection:()=>{},deleteSelection:()=>{},selectParent:()=>{},toggleDock:()=>{},toggleZen:()=>{},openPalette:()=>{},openProject:()=>{},newWindow:()=>{},panelRoster:[],focusPanel:()=>{},focusInspectorTab:()=>{},cycleRegion:()=>{}}}var T=(e)=>e.document.open,R=(e)=>e.selection.count>0&&e.editor.kind==="canvas",_=(e)=>!e.selection.isRoot&&e.selection.paths.every((o)=>au(o)),U="an element selected on the canvas that has a sibling position: not the document root, a repeater's template or a switch case",Y=(e)=>e.map((o)=>`[${o.join(", ")}]`).join(" and ");function pm(e){return[{id:"file.save",title:"Save",category:"File",level:"document",icon:"floppy-disk",keybinding:"mod+s",menus:["commandbar/primary","statusbar/document","palette"],group:"1_file",undo:"none",when:T,enablement:(t)=>t.document.dirty,requires:"unsaved changes",run:()=>e.saveDocument()},{id:"document.close",title:"Close Document",category:"Document",level:"document",keybinding:"mod+w",menus:["context/tab","palette"],group:"1_file",when:T,requires:"an open document",run:()=>e.closeDocument()},{id:"view.openInBrowser",title:"Open in Browser",category:"View",level:"document",icon:"arrow-square-out",keybinding:"mod+shift+o",menus:["commandbar/primary","statusbar/document","palette"],group:"2_output",when:(t)=>t.project.isSite,enablement:T,requires:"a page to preview",run:()=>e.openInBrowser()},{id:"project.buildSite",title:"Build Site",category:"Project",level:"project",menus:["commandbar/overflow","palette"],group:"2_output",when:(t)=>t.project.isSite,requires:"a site project",run:()=>e.buildSite()},{id:"edit.undo",title:"Undo",category:"Edit",level:"document",icon:"arrow-u-up-left",keybinding:"mod+z",menus:["commandbar/primary","palette"],group:"1_history",order:1,when:T,enablement:(t)=>t.document.canUndo,requires:"a change to undo",run:()=>e.undo()},{id:"edit.redo",title:"Redo",category:"Edit",level:"document",icon:"arrow-u-up-right",keybinding:["mod+shift+z","mod+y"],menus:["commandbar/primary","palette"],group:"1_history",order:2,when:T,enablement:(t)=>t.document.canRedo,requires:"a change to redo",run:()=>e.redo()},{id:"selection.duplicate",title:"Duplicate",category:"Selection",level:"selection",keyScope:"canvas",keybinding:"mod+d",menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"3_structure",undo:"document",when:R,enablement:_,requires:U,aiTool:{name:"duplicate_node",description:"Duplicate elements in the document, inserting each copy after its original, as one undoable step. The copies become the selection.",report:({after:t})=>{let r=t.selection.paths.length;return`Duplicated ${r} element${r===1?"":"s"}; the ${r===1?"copy is":"copies are"} selected at ${Y(t.selection.paths)}.`}},run:()=>e.duplicateSelection()},{id:"selection.repeat",title:"Repeat...",category:"Selection",level:"selection",keyScope:"canvas",menus:["context/element","palette"],group:"3_structure",undo:"document",when:R,enablement:(t)=>_(t)&&!t.selection.isRepeater,requires:"an element with a sibling position that is not already a repeater",run:()=>{(ce("pd2w4z21"),import("./convert-to-repeater-pd2w4z21.js")).then(({convertToRepeater:t})=>t())}},{id:"selection.delete",title:"Delete",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["delete","backspace"],menus:["blockbar","context/element","context/layer","outline/row","palette"],group:"9_danger",destructive:!0,undo:"document",when:R,enablement:_,requires:U,aiTool:{name:"delete_node",description:"Delete elements from the document as one undoable step.",report:({before:t,after:r})=>{let a=t.selection.paths.length;return`Deleted ${a} element${a===1?"":"s"} at ${Y(t.selection.paths)} in one undo step; the selection is now ${r.selection.count===0?"empty":"elsewhere"}.`}},run:()=>e.deleteSelection()},{id:"selection.selectParent",title:"Select Parent",category:"Selection",level:"selection",keyScope:"canvas",keybinding:["escape","arrowleft"],menus:["palette"],group:"2_navigate",when:R,requires:"an element selection",run:()=>e.selectParent()},{id:"view.toggleNavigator",title:"Toggle Navigator Dock",category:"View",level:"application",keybinding:"mod+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("navigator")},{id:"view.toggleInspector",title:"Toggle Inspector Dock",category:"View",level:"application",keybinding:"mod+alt+b",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleDock("inspector")},{id:"view.zen",title:"Zen Mode",category:"View",level:"application",keybinding:"mod+.",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>e.toggleZen()},{id:"palette.open",title:"Open Command Center",category:"View",level:"application",keybinding:"mod+k",menus:["palette"],group:"5_palette",run:()=>e.openPalette("picker")},{id:"palette.openFiles",title:"Go to File…",category:"File",level:"application",keybinding:"mod+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("files")},{id:"palette.openCommands",title:"Run Command…",category:"View",level:"application",keybinding:"mod+shift+p",menus:["palette"],group:"5_palette",run:()=>e.openPalette("commands")},{id:"palette.openNodes",title:"Go to Symbol in Document…",category:"Selection",level:"document",menus:["palette"],group:"5_palette",when:T,requires:"an open document",run:()=>e.openPalette("nodes")},{id:"project.open",title:"Open Project…",category:"Project",level:"project",keybinding:"mod+o",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",when:(t)=>t.capability.openProject,requires:"a host that can open a project from a dialog",run:()=>e.openProject()},{id:"view.newWindow",title:"New Window",category:"View",level:"application",keybinding:"mod+shift+n",menus:["commandbar/overflow","palette"],group:"1_file",when:(t)=>t.capability.windowControls,requires:"a host that can hold more than one window",run:()=>e.newWindow()},{id:"project.openRecent",title:"Open Recent…",category:"Project",level:"project",menus:["commandbar/overflow","statusbar/project","palette"],group:"1_file",run:()=>e.openPalette("projects")},...ae(e),...ie(e),{id:"view.cycleRegion",title:"Focus Next Region",category:"View",level:"application",keybinding:"f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(1)},{id:"view.cycleRegionBack",title:"Focus Previous Region",category:"View",level:"application",keybinding:"shift+f6",menus:["palette"],group:"4_docks",run:()=>e.cycleRegion(-1)}]}function ae(e){return e.panelRoster.map((o)=>({id:`panel.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"application",menus:["palette"],group:"4_docks",requires:"an open project",when:(t)=>t.project.open&&(o.when?.(t)??!0),run:()=>e.focusPanel(o.id)}))}function ie(e){return eS.map((o,t)=>({id:`inspector.focus.${o.id}`,title:`Show ${o.title}`,category:"View",level:"document",keybinding:`mod+shift+${t+1}`,menus:["palette"],group:"4_docks",requires:"an open document",when:(a)=>a.document.open,run:()=>e.focusInspectorTab(o.id)}))}
|
|
6
|
+
export{ow,Mu,hm,db,G0,NN,Y0,Z0,X0,Q0,sw,$E,DN,aw,lw,cw,vp,ON,Rd,eS,LE,tS,pm};
|
|
7
7
|
|
|
8
|
-
//# debugId=
|
|
9
|
-
//# sourceMappingURL=studio-
|
|
8
|
+
//# debugId=3C198F9491DC773D64756E2164756E21
|
|
9
|
+
//# sourceMappingURL=studio-s0kwce5w.js.map
|