@jxsuite/studio 9.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-89fz3pfy.js → 2020-mkb0qa6p.js} +3 -3
- package/dist/chunks/adapter-xcpsmecx.js +4 -0
- package/dist/chunks/{add-new-flow-nmkqpjym.js → add-new-flow-ptmhmzr9.js} +3 -3
- package/dist/chunks/{cf-account-picker-2e06qxey.js → cf-account-picker-z1sgwpwd.js} +3 -3
- package/dist/chunks/cf-settings-xqvhxxe9.js +4 -0
- package/dist/chunks/components-whsc81a7.js +4 -0
- package/dist/chunks/content-source-jwtxg78w.js +4 -0
- package/dist/chunks/{convert-to-repeater-j9hfcj4f.js → convert-to-repeater-f92ey3kp.js} +3 -3
- package/dist/chunks/editor-zdqdpq1x.js +4 -0
- package/dist/chunks/entry-commands-w8p2fbpt.js +4 -0
- package/dist/chunks/{extension-sections-thfke054.js → extension-sections-y2p1te2r.js} +3 -3
- package/dist/chunks/file-ops-13ab4swj.js +4 -0
- package/dist/chunks/files-zbc8p6v1.js +4 -0
- package/dist/chunks/format-host-zjsbktbx.js +4 -0
- package/dist/chunks/fs-events-t6x0hch6.js +4 -0
- package/dist/chunks/grid-open-fyzdwpkh.js +4 -0
- package/dist/chunks/{grid-view-7d2nx83y.js → grid-view-r22jsqht.js} +5 -5
- package/dist/chunks/iframe-host-kbyqc7pt.js +4 -0
- package/dist/chunks/index-6nvj89vb.js +4 -0
- package/dist/chunks/{index-jxmt7vh8.js → index-pxwwf00y.js} +3 -3
- package/dist/chunks/{javascript-vmqp56ke.js → javascript-pzqryby6.js} +2 -2
- package/dist/chunks/{jsonMode-n3wmpant.js → jsonMode-tcnyxyap.js} +5 -5
- package/dist/chunks/jx-validate-5sp8a4rm.js +4 -0
- package/dist/chunks/layers-panel-qrxj9vr2.js +4 -0
- package/dist/chunks/layers-tpzayggx.js +4 -0
- package/dist/chunks/lit-html-x6nrxsx3.js +4 -0
- package/dist/chunks/media-library-ywppnjrz.js +4 -0
- package/dist/chunks/media-picker-etxgc8qq.js +4 -0
- package/dist/chunks/{monaco-binding-wfhmz89d.js → monaco-binding-bqpge64f.js} +3 -3
- package/dist/chunks/monaco-buffer-qrnqhk0b.js +4 -0
- package/dist/chunks/{monaco-setup-fty7a8vg.js → monaco-setup-1mkab762.js} +3 -3
- package/dist/chunks/notify-kcv38wwe.js +4 -0
- package/dist/chunks/parse-df2kkmhc.js +4 -0
- package/dist/chunks/platform-dtsysmyd.js +4 -0
- package/dist/chunks/publish-panel-evb1rcxt.js +4 -0
- package/dist/chunks/{publish-quick-12hh8926.js → publish-quick-m9vkhahq.js} +3 -3
- package/dist/chunks/publish-workspace-ktk9h536.js +4 -0
- package/dist/chunks/quick-search-2f47fxcw.js +4 -0
- package/dist/chunks/references-5w6ajjv7.js +4 -0
- package/dist/chunks/right-panel-kz0a6byf.js +4 -0
- package/dist/chunks/source-control-1phx90zk.js +4 -0
- package/dist/chunks/{studio-qevf5z9d.js → studio-07k0geap.js} +4 -4
- package/dist/chunks/{studio-k5n4es74.js → studio-0g2sm01j.js} +4 -4
- package/dist/chunks/{studio-7q6jdd4h.js → studio-0hr000ba.js} +4 -4
- package/dist/chunks/{studio-e4rq6x0q.js → studio-1wyp7dt5.js} +4 -4
- package/dist/chunks/{studio-vtey9w98.js → studio-20ap8dds.js} +4 -4
- package/dist/chunks/studio-291gqh98.js +5 -0
- package/dist/chunks/{studio-32d8wyxq.js → studio-37twdaf7.js} +30 -30
- package/dist/chunks/{studio-8pne0rx4.js → studio-4nkm4404.js} +4 -4
- package/dist/chunks/{studio-z1p91z5a.js → studio-4smcnv33.js} +4 -4
- package/dist/chunks/{studio-s4fq9jht.js → studio-4zqfw5ha.js} +4 -4
- package/dist/chunks/{studio-n4qq1n57.js → studio-56egy6vf.js} +4 -4
- package/dist/chunks/{studio-t6dqnnft.js → studio-5dmgmyw4.js} +4 -4
- package/dist/chunks/{studio-9ff0vqff.js → studio-5e7p1vgd.js} +4 -4
- package/dist/chunks/{studio-4qg61g9j.js → studio-5m0w815d.js} +4 -4
- package/dist/chunks/{studio-0rg30pvs.js → studio-695k95bw.js} +4 -4
- package/dist/chunks/{studio-spza69tb.js → studio-6vwvshw8.js} +5 -5
- package/dist/chunks/{studio-ae7a69jc.js → studio-76t560kn.js} +5 -5
- package/dist/chunks/{studio-9gzvypw4.js → studio-7823f0g8.js} +4 -4
- package/dist/chunks/{studio-gskkgfe3.js → studio-7vb997ff.js} +4 -4
- package/dist/chunks/{studio-sc35ttdk.js → studio-8486jn4r.js} +4 -4
- package/dist/chunks/{studio-a6e5fzve.js → studio-848rk4p1.js} +4 -4
- package/dist/chunks/{studio-tyzgte21.js → studio-8jb31dcf.js} +4 -4
- package/dist/chunks/{studio-jr30g4ae.js → studio-8qejv8yf.js} +4 -4
- package/dist/chunks/studio-8x8616xd.js +5 -0
- package/dist/chunks/{studio-kyw47pet.js → studio-9b7177jq.js} +4 -4
- package/dist/chunks/{studio-gk9yk8dj.js → studio-9cp96v90.js} +6 -6
- package/dist/chunks/{studio-h4jbgne2.js → studio-9rcbvksg.js} +6 -6
- package/dist/chunks/{studio-3hpcawh8.js → studio-a3s6frde.js} +3 -3
- package/dist/chunks/{studio-tfmhnwyr.js → studio-ahf3cspq.js} +3 -3
- package/dist/chunks/{studio-6rbaedw2.js → studio-bkmv1h3e.js} +6 -6
- package/dist/chunks/{studio-4j35hgsw.js → studio-brdp85q7.js} +4 -4
- package/dist/chunks/{studio-hcy9zeac.js → studio-cgb97rwv.js} +4 -4
- package/dist/chunks/{studio-gczve8zf.js → studio-ch8gt8vt.js} +3 -3
- package/dist/chunks/studio-cqf1k4qk.js +5 -0
- package/dist/chunks/{studio-myb4mf0h.js → studio-cvz0e00f.js} +4 -4
- package/dist/chunks/{studio-nqexty8x.js → studio-dbgv4fv9.js} +14 -14
- package/dist/chunks/{studio-8hf8qcm1.js → studio-dy2xtt7a.js} +4 -4
- package/dist/chunks/{studio-c88gq88j.js → studio-eesyjg7h.js} +5 -5
- package/dist/chunks/studio-et6t8g4m.js +4 -0
- package/dist/chunks/{studio-qs5fmhtj.js → studio-f2j9et3h.js} +8 -8
- package/dist/chunks/{studio-79r8msnr.js → studio-fep7hr66.js} +4 -4
- package/dist/chunks/{studio-1cfyd1ys.js → studio-fyf7j57j.js} +3 -3
- package/dist/chunks/{studio-mkw17ngg.js → studio-g5prntab.js} +4 -4
- package/dist/chunks/{studio-x2trkhk5.js → studio-ga77mf07.js} +4 -4
- package/dist/chunks/{studio-yjh9gddd.js → studio-ggm7zf70.js} +5 -5
- package/dist/chunks/studio-h7gy12h2.js +5 -0
- package/dist/chunks/{studio-qd0cycm4.js → studio-hsr3k06v.js} +5 -5
- package/dist/chunks/{studio-ztppbam0.js → studio-j933k8nr.js} +4 -4
- package/dist/chunks/studio-jgbvqcgh.js +5 -0
- package/dist/chunks/{studio-xzgp0cp7.js → studio-jh6t5qz4.js} +4 -4
- package/dist/chunks/{studio-k6hbx2fc.js → studio-jw0q5j6k.js} +4 -4
- package/dist/chunks/studio-k4xc5g6h.js +5 -0
- package/dist/chunks/{studio-fg4fj9ec.js → studio-mwnmzx7g.js} +6 -6
- package/dist/chunks/{studio-ekzbgnjp.js → studio-nf0pqpbj.js} +4 -4
- package/dist/chunks/{studio-sm2f0sc6.js → studio-p0nf2e1f.js} +5 -5
- package/dist/chunks/{studio-by8x0jvc.js → studio-pd9dsqpq.js} +4 -4
- package/dist/chunks/{studio-cg54vtet.js → studio-pmzg17fj.js} +4 -4
- package/dist/chunks/{studio-ht81xjkr.js → studio-pzfa2vmb.js} +4 -4
- package/dist/chunks/{studio-9179bsm7.js → studio-qyb5bebs.js} +7 -7
- package/dist/chunks/{studio-aghsg0ds.js → studio-rf8d6p9f.js} +6 -6
- package/dist/chunks/{studio-9ra9e7m4.js → studio-rt498t2v.js} +4 -4
- package/dist/chunks/{studio-trcfer2b.js → studio-s0fg2wav.js} +4 -4
- package/dist/chunks/studio-sd07xva5.js +6 -0
- package/dist/chunks/{studio-apapy17g.js → studio-skynbac3.js} +2 -2
- package/dist/chunks/{studio-nvfa137z.js → studio-t3j8htp7.js} +5 -5
- package/dist/chunks/{studio-ry4789ng.js → studio-thj81e98.js} +6 -6
- package/dist/chunks/{studio-nfwacw31.js → studio-tpy3rdxn.js} +4 -4
- package/dist/chunks/{studio-g45r5vm8.js → studio-va0e63sk.js} +4 -4
- package/dist/chunks/{studio-kqh7fxn6.js → studio-vcz63n42.js} +4 -4
- package/dist/chunks/studio-vffwe9k7.js +5 -0
- package/dist/chunks/{studio-nm86874b.js → studio-vjhej0w5.js} +123 -123
- package/dist/chunks/{studio-ws2r1d7e.js → studio-vxjap704.js} +4 -4
- package/dist/chunks/{studio-9ndgd55w.js → studio-w67vfgy5.js} +4 -4
- package/dist/chunks/{studio-ajw4k8hp.js → studio-x2metr13.js} +3 -3
- package/dist/chunks/{studio-14hh60j8.js → studio-xebavr9s.js} +4 -4
- package/dist/chunks/{studio-4rgem12q.js → studio-yg5n49za.js} +4 -4
- package/dist/chunks/{studio-6k9djnxw.js → studio-yhz5b313.js} +4 -4
- package/dist/chunks/{studio-nfmpmkqb.js → studio-zacvfm31.js} +4 -4
- package/dist/chunks/{studio-ywf9y1e2.js → studio-zsjpsw08.js} +4 -4
- package/dist/chunks/{studio-0nefxhar.js → studio-zxm98z2m.js} +6 -6
- package/dist/chunks/{tsMode-byje4a01.js → tsMode-6vwhy6ty.js} +5 -5
- package/dist/chunks/workspace-d65bz1qk.js +4 -0
- package/dist/chunks/workspace-home-vbg9b3jh.js +4 -0
- package/dist/chunks/{ws-client-h09h6sqg.js → ws-client-zcxkfgmf.js} +3 -3
- package/dist/iframe-entry.js +8 -8
- package/dist/manifest.json +74 -74
- package/dist/studio.js +86 -84
- package/package.json +11 -11
- package/src/canvas/iframe-editable-root.ts +32 -2
- package/src/format/format-host.ts +1 -1
- package/src/github/github-auth-status.ts +2 -2
- package/src/media/media-library.ts +73 -3
- package/src/packages/ensure-deps.ts +5 -5
- package/src/packages/pull-package-sync.ts +4 -4
- package/src/panels/activity-panel.ts +1 -1
- package/src/platform-errors.ts +17 -1
- package/src/platforms/cloud.ts +62 -34
- package/src/publish/publish-changes.ts +136 -4
- package/src/settings/extension-commands.ts +1 -1
- package/src/settings/extension-rows.ts +1 -6
- package/src/settings/extensions-section.ts +3 -6
- package/src/surfaces/block-action-bar.json +1 -3
- package/src/surfaces/media-library.json +35 -0
- package/src/surfaces/media-library.ts +2 -0
- package/src/surfaces/menu.ts +62 -1
- package/src/surfaces/settings-packages.ts +1 -1
- package/src/types.ts +24 -8
- package/src/ui/layers.ts +1 -1
- package/src/ui/progress-modal.ts +3 -3
- package/dist/chunks/adapter-ay13gema.js +0 -4
- package/dist/chunks/cf-settings-5y04810c.js +0 -4
- package/dist/chunks/components-3vf75n83.js +0 -4
- package/dist/chunks/content-source-4f2raf4a.js +0 -4
- package/dist/chunks/editor-645krvtz.js +0 -4
- package/dist/chunks/entry-commands-3qmv8wkr.js +0 -4
- package/dist/chunks/file-ops-kkhp9ma7.js +0 -4
- package/dist/chunks/files-yswdhxrf.js +0 -4
- package/dist/chunks/format-host-4g8ex6bz.js +0 -4
- package/dist/chunks/fs-events-z9gpvc6t.js +0 -4
- package/dist/chunks/grid-open-fm4j183c.js +0 -4
- package/dist/chunks/iframe-host-q7fedsmr.js +0 -4
- package/dist/chunks/index-pt4wh98x.js +0 -4
- package/dist/chunks/jx-validate-19y62knt.js +0 -4
- package/dist/chunks/layers-panel-1qvc83y9.js +0 -4
- package/dist/chunks/layers-qf0bc7ze.js +0 -4
- package/dist/chunks/lit-html-wyqw04y2.js +0 -4
- package/dist/chunks/media-library-f9d5qcjb.js +0 -4
- package/dist/chunks/media-picker-rsb1fmk2.js +0 -4
- package/dist/chunks/monaco-buffer-ak0raadw.js +0 -4
- package/dist/chunks/notify-4qj70q0x.js +0 -4
- package/dist/chunks/parse-n8dfxnqf.js +0 -4
- package/dist/chunks/platform-ehg6t9vd.js +0 -4
- package/dist/chunks/publish-panel-yhmda3cd.js +0 -4
- package/dist/chunks/publish-workspace-hx8qdv9p.js +0 -4
- package/dist/chunks/quick-search-r955m3q1.js +0 -4
- package/dist/chunks/references-8gxv0x7t.js +0 -4
- package/dist/chunks/right-panel-jarwqjpy.js +0 -4
- package/dist/chunks/source-control-84qt25m9.js +0 -4
- package/dist/chunks/studio-2bq7hheq.js +0 -5
- package/dist/chunks/studio-a9k86nq6.js +0 -5
- package/dist/chunks/studio-dvhxxxbd.js +0 -5
- package/dist/chunks/studio-fj6jzgxw.js +0 -5
- package/dist/chunks/studio-ge08zwpv.js +0 -5
- package/dist/chunks/studio-nr0kcqc6.js +0 -5
- package/dist/chunks/studio-psh8mwnw.js +0 -4
- package/dist/chunks/studio-tn7v8gey.js +0 -6
- package/dist/chunks/studio-y47090vq.js +0 -5
- package/dist/chunks/workspace-7q4arnt3.js +0 -4
- package/dist/chunks/workspace-home-ge027kr6.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Si}from"./studio-
|
|
2
|
-
export{L$,us,
|
|
1
|
+
import{Si}from"./studio-4nkm4404.js";import{Da}from"./studio-ahf3cspq.js";import{n}from"./studio-zsjpsw08.js";var h=new Set([".apng",".avif",".bmp",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp",".eot",".otf",".ttf",".woff",".woff2",".m4v",".mov",".mp4",".ogv",".webm",".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav"]);function u(e){let r=e.lastIndexOf("/"),t=e.lastIndexOf(".");return t>r+1&&h.has(e.slice(t).toLowerCase())}var s=new Map,c=0,m=0,d=new Map,g=new Map,l=null,v=Object.freeze({}),L$=Da(0);function p(){l=null,L$.value+=1}function y(){return c}function x(e,r){let t=d.get(e);if(t!==void 0&&t>r)return!0;for(let[i,o]of g)if(o>r&&e.startsWith(i))return!0;return!1}function w(e,r){if(r<m)return;let t=!1;for(let i of e){if(i.type!=="file")continue;let o=Si(i.path);if(o===""||x(o,r))continue;let f=n(i.version)&&i.version!==""?i.version:null,a=s.get(o);if(f===null){if(a===void 0)continue;s.delete(o)}else if(a===f)continue;else s.set(o,f);if(u(o))t=!0}if(t)p()}async function us(e){let r=y(),t=await e();return w(t,r),t}function Wd(e,r=[]){c+=1;let t=!1;for(let i of e){let o=Si(i);if(o==="")continue;if(d.set(o,c),s.delete(o)&&u(o))t=!0}for(let i of r){let o=Si(i);if(o==="")continue;let f=`${o}/`;g.set(f,c);for(let a of s.keys())if(a.startsWith(f)){if(s.delete(a),u(a))t=!0}}if(t)p()}function tO(e){return s.get(Si(e))}function ph(){if(l)return l;let e={},r=!1;for(let[t,i]of s)if(u(t))e[t]=i,r=!0;return l=r?Object.freeze(e):v,l}function $$(){let e=ph()!==v;if(s.clear(),d.clear(),g.clear(),c+=1,m=c,e)p()}function Om(){$$()}
|
|
2
|
+
export{L$,us,Wd,tO,ph,$$,Om};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=C6902FE72689A3EB64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pd9dsqpq.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p,_e}from"./studio-9ndgd55w.js";import{Ue,ft,T,R,tt}from"./studio-myb4mf0h.js";import{g}from"./studio-tfmhnwyr.js";import{us}from"./studio-by8x0jvc.js";import{He,Ks,Js,nn,Vc}from"./studio-t6dqnnft.js";import{zc,cA,Sa,jb,tr}from"./studio-vtey9w98.js";import{Rd,Dd,iN,qu,_p,oN,Aw}from"./studio-kqh7fxn6.js";import{zx,xn}from"./studio-9ra9e7m4.js";import{le}from"./studio-k5n4es74.js";var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, because a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",C);function G(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function D(t,e,o){let i=g({browse:o.browse,edit:o.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:o.upload,value:e.value,warm:o.warm}),a=null,r=!1;return R("media-field",i,t).then((n)=>{if(r){n.dispose();return}a=n}),{dispose(){r=!0,a?.dispose(),a=null},update:(n)=>G(i,n)}}function zu(t){let{anchor:e,name:o,scope:i,slot:a}=t,r=document.createElement("div");r.style.pointerEvents="auto",r.setAttribute(Ue,ft("popover",a)),tt("popover").append(r);let n=new AbortController,s=null,l=null,c=!1,N=()=>n.signal.aborted,H=(x)=>{if(c)return;if(c=!0,n.abort(),l?.dispose(),l=null,r.remove(),x)t.onDismissed?.()},U=(async()=>{let x={signal:n.signal};if(t.onNodeCreated)x.onNodeCreated=t.onNodeCreated;let I=await R(o,i,r,x);if(N())return;if(l=I,s=I.root,s.setAttribute(Ue,ft("popover",a)),s.addEventListener("toggle",(S)=>{if("newState"in S&&S.newState==="closed")H(!0)}),!s.hasAttribute("popover"))await new Promise((S)=>{s?.addEventListener("jx-ready",()=>S(),{once:!0})});if(N())return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();H(!1)},host:r,isOpen:()=>!c,ready:U}}var _={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{justifyContent:"flex-start"},'& [part="browse-all"]':{$description:"The last row, set apart by a rule: it does not pick a file, it opens the picker that shows all of them.",marginTop:"var(--jx-space-1)",paddingTop:"var(--jx-space-2)",borderTop:"1px solid var(--border)",justifyContent:"flex-start"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so, and the marker is a control (the rule studio.md §5.6 states for every truncation marker): it raises the cap by fifty, so every file the Media workspace lists can be reached from here without a search. Inert "…21 more" text was the panel holding the answer and not showing it.',tagName:"jx-button",attributes:{part:"more"},$props:{variant:"secondary",size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showMore"},value:[]}]},children:[{tagName:"span",textContent:"${state.moreLabel}"}]}}},{tagName:"jx-button",attributes:{part:"browse-all"},$props:{variant:"secondary",size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browseAll"},value:[]}]},children:[{tagName:"span",textContent:"${state.browseAllLabel}"}]}]}]};T("media-browser",_);var X="media-picker";function Y(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel,t.browseAllLabel=e.browseAllLabel}function V(t,e,o){let i=g({browseAll:e.browseAll,browseAllLabel:t.browseAllLabel,emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,showMore:e.showMore,x:t.x,y:t.y}),a={anchor:o,name:"media-browser",scope:i,slot:X};if(e.dismissed)a.onDismissed=e.dismissed;let r=zu(a);return r.ready.then(()=>{if(r.isOpen())r.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:r.close,host:r.host,isOpen:r.isOpen,ready:r.ready,update:(n)=>Y(i,n)}}var b=[],M=!1,L="images";function DT(t){let e=t.replaceAll("\\","/");return e.startsWith("public/")||new RegExp(`^content/[^/]+/${L}/`).test(e)}async function B(t,e){let o=[];try{let i=await us(()=>e.listDirectory(t));iN(i);for(let a of i)if(a.type==="directory"){let r=await B(a.path,e);o.push(...r)}else{let r=nn(a.name);if(Js.has(r))o.push({file:a.path,isImage:Ks.has(r),kind:cA(a.name),name:a.name,ref:jb(a.path)})}}catch{}return o}async function Q(t){let e;try{e=(await t.listDirectory("content")).filter((a)=>a.type==="directory").map((a)=>a.path)}catch{return[]}let o=[];for(let i of e){let a=!1;try{a=(await t.listDirectory(i)).some((n)=>n.type==="directory"&&n.name===L)}catch{}if(a)o.push(...await B(`${i}/${L}`,t))}return o}async function Z(t){try{let e=await t.listDirectory(".");return new Set(e.filter((o)=>o.type==="directory").map((o)=>o.name).filter((o)=>o==="public"||o==="content"))}catch{return new Set(["public","content"])}}var h=null,E=0,O=new Set;function NT(t){return O.add(t),()=>{O.delete(t)}}function q(){for(let t of O)t()}function k(){if(M)return Promise.resolve();if(h)return h;if(!_e())return Promise.resolve();let t=E,e=(async()=>{let o=p(),i=await Z(o),[a,r]=await Promise.all([i.has("public")?B("public",o):[],i.has("content")?Q(o):[]]);if(t!==E)return;b=[...a,...r],M=!0,h=null,xn("leftPanel","rightPanel"),q()})();return h=e,e}function Wu(){if(!M)return k(),null;return b}function kw(){b=[],M=!1,E+=1,h=null,oN(),q()}var z=null;function ee(){return z??=(le("f9d5qcjb"),import("./media-library-f9d5qcjb.js")),z}async function P2(t,e={}){(await ee()).openMediaPickDialog({images:e.images===!0,onPick:t})}var y=50,d=null,f=null,v="",u=y,w={},A={x:0,y:0};function m(){let t=v.toLowerCase(),e=w.images?b.filter((r)=>r.isImage):b,o=t?e.filter((r)=>r.ref.toLowerCase().includes(t)||r.name.toLowerCase().includes(t)):e,a=o.slice(0,u).map((r)=>{let n=Aw(Dd(r.file));return{caption:n,captionState:n?"shown":"hidden",file:r.file,key:r.file,name:r.name,path:r.ref,thumbSrc:r.isImage?tr(r.file):"",thumbState:r.isImage?"shown":"hidden"}});return{browseAllLabel:w.images?"Browse all images…":"Browse all media…",emptyLabel:e.length>0?"No matches":w.images?"No images in this project yet":"No media in this project yet",filter:v,moreLabel:`Show ${Math.min(o.length-u,y)} more`,moreState:o.length>u?"shown":"hidden",rows:a,rowsState:a.length>0?"listed":"empty",x:A.x,y:A.y}}function P(){let t=d;d=null,f=null,v="",u=y,t?.close()}var j=0;function te(t,e,o){if(!_p(t,e,o)){if(!Rd(t))qu(t).then(()=>d?.update(m()));return}if(j!==0)return;j=requestAnimationFrame(()=>{j=0,d?.update(m())})}function vS(t,e,o={}){P(),k().then(()=>d?.update(m())),f=e,w=o;let i=He(t);A={x:i.left,y:i.bottom+4},d=V(m(),{browseAll:()=>{let a=f,r=w;if(P(),a)P2(a,r)},dismissed:()=>{d=null,f=null,v="",u=y},measure:te,pick:(a)=>{let r=f;P(),r?.(a)},showMore:()=>{u+=y,d?.update(m())},setFilter:(a)=>{v=a,d?.update(m())}},t)}async function F2(t,e){let o=await Sa([...t]),[i]=o;if(i)e(i.ref)}function yS(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=zc(),e.addEventListener("change",()=>{if(e.files?.length)F2(e.files,t)}),e.click()}var re=400,F=new WeakMap;function W(t,e){let o=Ks.has(nn(e));return{label:t,thumbSrc:o&&e?Vc(e):"",thumbState:o&&e?"shown":"hidden",value:e}}function Hl(t,e,o,i,a={}){k();let r=F.get(t);if(r){r.prop=e,r.commit=i,r.options=a,r.handle.update(W(e,o));return}let n={commit:i,options:a,prop:e},s=D(t,W(e,o),{browse:(l)=>{vS(l,(c)=>n.commit(c),n.options)},edit:(l)=>zx(`media:${n.prop}`,re,(c)=>n.commit(c))(l),upload:()=>yS((l)=>n.commit(l)),warm:()=>{k()}});F.set(t,Object.assign(n,{handle:s}))}function bm(t){let e=F.get(t);if(e)F.delete(t),e.handle.dispose()}
|
|
2
|
-
export{zu,DT,NT,Wu,kw,
|
|
1
|
+
import{p,_e}from"./studio-w67vfgy5.js";import{Ue,ft,T,R,tt}from"./studio-cvz0e00f.js";import{g}from"./studio-ahf3cspq.js";import{us}from"./studio-pd9dsqpq.js";import{He,Js,Ys,nn,Uc}from"./studio-5dmgmyw4.js";import{Wc,dA,Sa,Hb,tr}from"./studio-20ap8dds.js";import{Dd,Nd,oN,qu,_p,rN,Aw}from"./studio-vcz63n42.js";import{zx,xn}from"./studio-rt498t2v.js";import{le}from"./studio-0g2sm01j.js";var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, because a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",C);function G(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function D(t,e,o){let i=g({browse:o.browse,edit:o.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:o.upload,value:e.value,warm:o.warm}),a=null,r=!1;return R("media-field",i,t).then((n)=>{if(r){n.dispose();return}a=n}),{dispose(){r=!0,a?.dispose(),a=null},update:(n)=>G(i,n)}}function zu(t){let{anchor:e,name:o,scope:i,slot:a}=t,r=document.createElement("div");r.style.pointerEvents="auto",r.setAttribute(Ue,ft("popover",a)),tt("popover").append(r);let n=new AbortController,s=null,l=null,c=!1,N=()=>n.signal.aborted,H=(x)=>{if(c)return;if(c=!0,n.abort(),l?.dispose(),l=null,r.remove(),x)t.onDismissed?.()},U=(async()=>{let x={signal:n.signal};if(t.onNodeCreated)x.onNodeCreated=t.onNodeCreated;let I=await R(o,i,r,x);if(N())return;if(l=I,s=I.root,s.setAttribute(Ue,ft("popover",a)),s.addEventListener("toggle",(S)=>{if("newState"in S&&S.newState==="closed")H(!0)}),!s.hasAttribute("popover"))await new Promise((S)=>{s?.addEventListener("jx-ready",()=>S(),{once:!0})});if(N())return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();H(!1)},host:r,isOpen:()=>!c,ready:U}}var _={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{justifyContent:"flex-start"},'& [part="browse-all"]':{$description:"The last row, set apart by a rule: it does not pick a file, it opens the picker that shows all of them.",marginTop:"var(--jx-space-1)",paddingTop:"var(--jx-space-2)",borderTop:"1px solid var(--border)",justifyContent:"flex-start"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so, and the marker is a control (the rule studio.md §5.6 states for every truncation marker): it raises the cap by fifty, so every file the Media workspace lists can be reached from here without a search. Inert "…21 more" text was the panel holding the answer and not showing it.',tagName:"jx-button",attributes:{part:"more"},$props:{variant:"secondary",size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showMore"},value:[]}]},children:[{tagName:"span",textContent:"${state.moreLabel}"}]}}},{tagName:"jx-button",attributes:{part:"browse-all"},$props:{variant:"secondary",size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browseAll"},value:[]}]},children:[{tagName:"span",textContent:"${state.browseAllLabel}"}]}]}]};T("media-browser",_);var X="media-picker";function Y(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel,t.browseAllLabel=e.browseAllLabel}function V(t,e,o){let i=g({browseAll:e.browseAll,browseAllLabel:t.browseAllLabel,emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,showMore:e.showMore,x:t.x,y:t.y}),a={anchor:o,name:"media-browser",scope:i,slot:X};if(e.dismissed)a.onDismissed=e.dismissed;let r=zu(a);return r.ready.then(()=>{if(r.isOpen())r.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:r.close,host:r.host,isOpen:r.isOpen,ready:r.ready,update:(n)=>Y(i,n)}}var b=[],M=!1,L="images";function DT(t){let e=t.replaceAll("\\","/");return e.startsWith("public/")||new RegExp(`^content/[^/]+/${L}/`).test(e)}async function B(t,e){let o=[];try{let i=await us(()=>e.listDirectory(t));oN(i);for(let a of i)if(a.type==="directory"){let r=await B(a.path,e);o.push(...r)}else{let r=nn(a.name);if(Ys.has(r))o.push({file:a.path,isImage:Js.has(r),kind:dA(a.name),name:a.name,ref:Hb(a.path)})}}catch{}return o}async function Q(t){let e;try{e=(await t.listDirectory("content")).filter((a)=>a.type==="directory").map((a)=>a.path)}catch{return[]}let o=[];for(let i of e){let a=!1;try{a=(await t.listDirectory(i)).some((n)=>n.type==="directory"&&n.name===L)}catch{}if(a)o.push(...await B(`${i}/${L}`,t))}return o}async function Z(t){try{let e=await t.listDirectory(".");return new Set(e.filter((o)=>o.type==="directory").map((o)=>o.name).filter((o)=>o==="public"||o==="content"))}catch{return new Set(["public","content"])}}var h=null,E=0,O=new Set;function NT(t){return O.add(t),()=>{O.delete(t)}}function q(){for(let t of O)t()}function k(){if(M)return Promise.resolve();if(h)return h;if(!_e())return Promise.resolve();let t=E,e=(async()=>{let o=p(),i=await Z(o),[a,r]=await Promise.all([i.has("public")?B("public",o):[],i.has("content")?Q(o):[]]);if(t!==E)return;b=[...a,...r],M=!0,h=null,xn("leftPanel","rightPanel"),q()})();return h=e,e}function Wu(){if(!M)return k(),null;return b}function kw(){b=[],M=!1,E+=1,h=null,rN(),q()}var z=null;function ee(){return z??=(le("ywppnjrz"),import("./media-library-ywppnjrz.js")),z}async function j2(t,e={}){(await ee()).openMediaPickDialog({images:e.images===!0,onPick:t})}var y=50,d=null,f=null,v="",u=y,w={},A={x:0,y:0};function m(){let t=v.toLowerCase(),e=w.images?b.filter((r)=>r.isImage):b,o=t?e.filter((r)=>r.ref.toLowerCase().includes(t)||r.name.toLowerCase().includes(t)):e,a=o.slice(0,u).map((r)=>{let n=Aw(Nd(r.file));return{caption:n,captionState:n?"shown":"hidden",file:r.file,key:r.file,name:r.name,path:r.ref,thumbSrc:r.isImage?tr(r.file):"",thumbState:r.isImage?"shown":"hidden"}});return{browseAllLabel:w.images?"Browse all images…":"Browse all media…",emptyLabel:e.length>0?"No matches":w.images?"No images in this project yet":"No media in this project yet",filter:v,moreLabel:`Show ${Math.min(o.length-u,y)} more`,moreState:o.length>u?"shown":"hidden",rows:a,rowsState:a.length>0?"listed":"empty",x:A.x,y:A.y}}function P(){let t=d;d=null,f=null,v="",u=y,t?.close()}var j=0;function te(t,e,o){if(!_p(t,e,o)){if(!Dd(t))qu(t).then(()=>d?.update(m()));return}if(j!==0)return;j=requestAnimationFrame(()=>{j=0,d?.update(m())})}function vS(t,e,o={}){P(),k().then(()=>d?.update(m())),f=e,w=o;let i=He(t);A={x:i.left,y:i.bottom+4},d=V(m(),{browseAll:()=>{let a=f,r=w;if(P(),a)j2(a,r)},dismissed:()=>{d=null,f=null,v="",u=y},measure:te,pick:(a)=>{let r=f;P(),r?.(a)},showMore:()=>{u+=y,d?.update(m())},setFilter:(a)=>{v=a,d?.update(m())}},t)}async function H2(t,e){let o=await Sa([...t]),[i]=o;if(i)e(i.ref)}function yS(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=Wc(),e.addEventListener("change",()=>{if(e.files?.length)H2(e.files,t)}),e.click()}var re=400,F=new WeakMap;function W(t,e){let o=Js.has(nn(e));return{label:t,thumbSrc:o&&e?Uc(e):"",thumbState:o&&e?"shown":"hidden",value:e}}function Hl(t,e,o,i,a={}){k();let r=F.get(t);if(r){r.prop=e,r.commit=i,r.options=a,r.handle.update(W(e,o));return}let n={commit:i,options:a,prop:e},s=D(t,W(e,o),{browse:(l)=>{vS(l,(c)=>n.commit(c),n.options)},edit:(l)=>zx(`media:${n.prop}`,re,(c)=>n.commit(c))(l),upload:()=>yS((l)=>n.commit(l)),warm:()=>{k()}});F.set(t,Object.assign(n,{handle:s}))}function bm(t){let e=F.get(t);if(e)F.delete(t),e.handle.dispose()}
|
|
2
|
+
export{zu,DT,NT,Wu,kw,j2,vS,H2,yS,Hl,bm};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=FEB17876EA5977C164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pmzg17fj.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{te}from"./studio-psh8mwnw.js";import{cw,Hu}from"./studio-nfmpmkqb.js";import{T,R}from"./studio-myb4mf0h.js";import{g}from"./studio-tfmhnwyr.js";import{Jc,Nx}from"./studio-ztppbam0.js";import{Hl,bm}from"./studio-cg54vtet.js";import{n,v}from"./studio-ywf9y1e2.js";import{le}from"./studio-k5n4es74.js";var z_=["string","number","boolean","array","object","reference"],W_=["","image","date","color"],Ed={format:"",name:"",required:!1,type:"string"};function ib(e){if(e.$ref)return"reference";return e.type||"string"}function Td(e){if(e.type==="array"&&e.items?.format)return e.items.format;return e.format||""}function va(e,s){switch(e){case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"array":return s?{items:{format:s,type:"string"},type:"array"}:{items:{type:"string"},type:"array"};case"object":return{properties:{},required:[],type:"object"};case"reference":return{$ref:"#/content/"};default:return s?{format:s,type:"string"}:{type:"string"}}}var B={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSchemaBuilder",$description:'The `schema-builder` form control (specs/extensions.md §9.1): the visual editor for a JSON Schema object, drawn as one card per property. A descriptor names it with `"ui": { "<prop>": { "control": "schema-builder" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. The adapter (`surfaces/schema-builder.ts`) hands in the fields already classified and every draft the reader is part-way through typing; `ui/form-controls.ts` decides what a field may be renamed to and what reaches the host\'s `onChange`. Nothing here reads a schema: a document that re-derived a field\'s type while drawing would be a second opinion about what one module already owns. **The card is `surfaces/settings-defs.json`\'s, part for part.** Data Shapes edits the project\'s `$defs` and this edits a content type\'s `schema`; they are the same object with the same six controls per row, so the row vocabulary — `card`, `field-row`, `field-label`, `field-name`, `field-type`, `field-format`, `field-required`, `field-delete`, `nested`, `nested-card`, `nested-add-name`/`-type`/`-button`, `ref-target`, `add-form` — is ONE vocabulary, and the row views it is drawn from are that surface\'s own types rather than a second declaration of them. What differs is only what encloses it: Data Shapes carries the two-column chrome that chooses WHICH shape is being edited, and this one is handed the object to edit.',tagName:"div",attributes:{part:"builder"},style:{$description:"What `.schema-builder`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-nested-add-name` and `.schema-add-field` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer — the same translation `surfaces/settings-defs.json` carries, because it is the same card. Two values could not come with them. `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and the caption was an `sp-field-label` at whatever size Spectrum drew it; a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time. The nested card takes the studio layer's `--border`, and the caption says what it is in the type ramp instead.",display:"block",'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},'& [part="card"], & [part="nested-card"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"6px 10px"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"8px"},'& [part="field-label"]':{$description:"The field's name in words: a caption on the row rather than a label for a control, since the raw key beside it is what the reader edits and what carries the accessible name.",flex:"none",minWidth:"84px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="field-name"]':{flex:"1",maxWidth:"140px"},'& [part="nested"]':{marginLeft:"16px",marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--border)",display:"flex",flexDirection:"column",gap:"4px"},'& [part="ref-target"]':{display:"flex",marginTop:"6px",maxWidth:"220px"},'& [part="nested-add"]':{display:"flex",alignItems:"center",gap:"6px",padding:"4px 0"},'& [part="nested-add-name"]':{flex:"1",maxWidth:"120px"},'& [part="add-form"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0"}},children:[{tagName:"div",attributes:{part:"fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card","data-field":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.label}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.label}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFormat"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",$description:"Whether the object requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.label}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRequired"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.label}",hint:"Delete ${$map.item.label}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeField"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"extra-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/extra"},cases:{reference:{tagName:"div",attributes:{part:"ref-target"},children:[{tagName:"jx-select",attributes:{part:"ref-target-select"},$props:{label:"Target for ${$map.item.label}",size:"sm",options:{$ref:"#/state/targets"},value:{$ref:"$map/item/refTarget"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setTarget"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},nested:{tagName:"div",attributes:{part:"nested"},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"nested-card","data-nested":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.parent}.${$map.item.key}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedType"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedFormat"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.parent}.${$map.item.key}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedRequired"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.parent}.${$map.item.key}",hint:"Delete ${$map.item.parent}.${$map.item.key}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"}]}]}}]}]}},{tagName:"div",attributes:{part:"nested-add"},children:[{tagName:"jx-textfield",attributes:{part:"nested-add-name"},$props:{label:"New field in ${$map.item.label}",placeholder:"field name",size:"sm",value:{$ref:"$map/item/draftName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-select",attributes:{part:"nested-add-type"},$props:{label:"Type of the new field in ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/draftType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"nested-add-button"},$props:{label:"Add a field to ${$map.item.label}",hint:"Add a field to ${$map.item.label}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}]}}}]}}]},{tagName:"div",attributes:{part:"add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"add-open"},$props:{label:"Add Field",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add Field"}]},open:{tagName:"div",attributes:{part:"add-form"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:"New field name",placeholder:"Field name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddName"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]}}]}},{tagName:"jx-select",attributes:{part:"add-type"},$props:{label:"Type of the new field",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"#/state/addType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddType"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"add-format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addHasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"add-format"},$props:{label:"Format of the new field",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"#/state/addFormat"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddFormat"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"add-required"},$props:{hint:"Require the new field",size:"sm",checked:{$ref:"#/state/addRequired"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddRequired"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Required"}]},{tagName:"jx-button",attributes:{part:"add-confirm"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"jx-button",attributes:{part:"add-cancel"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]}]}}}]};T("schema-builder",B);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function E(e,s){e.textContent="";let t=g({..._(),...s}),o=null,r=!0,l=!1,p=()=>R("schema-builder",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.addFormat=d.addFormat,t.addHasFormat=d.addHasFormat,t.addName=d.addName,t.addRequired=d.addRequired,t.addState=d.addState,t.addType=d.addType,t.fields=d.fields,t.formatOptions=d.formatOptions,t.targets=d.targets,t.typeOptions=d.typeOptions,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var M={$schema:"https://jxsuite.com/schema/v1",$id:"StudioReferenceField",$description:'The `reference` form control — site-architecture.md §6.1\'s `{ "$ref": "#/content/x" }` and site-architecture.md §7.4\'s entry picker. Registered once and dispatched to by `ui/schema-form.ts` for any property whose `$ref` names a collection, so the settings forms, the entry editor and an array-of-objects cell all draw the same control without any of them knowing it exists. `ui/form-controls.ts` decides which of the three states the field is in and what each gesture commits; nothing here reads a schema or lists a directory. The three states are drawn as three different controls on purpose: a picker while the entries are known, a TEXT field while they are not — a failed read leaves the value editable with the reason beside it, because swapping it for an empty dropdown would present "no entries" and "could not find out" as the same screen — and a disabled picker saying so while the read is in flight.',tagName:"div",attributes:{part:"reference",role:"none"},style:{$description:"The five `.reference-*` rules from `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Two values could not come with them. The note read `var(--spectrum-font-size-50, 11px)`, which resolves only inside `<sp-theme>` — this document is mounted in a settings pane, an entry editor or a frontmatter card, all outside that element, so it would silently have taken its hard-coded fallback every time. And `.reference-missing` coloured ONE row of the dropdown red; the kit's select offers a row a face, a swatch and a border style but no tone, so the dangling entry says what it is in words (\"— not found\") and the colour is not replaced by a second channel. The 6px gap comes onto the kit's spacing scale.",display:"flex",flex:"1",minWidth:"0",alignItems:"center",gap:"var(--jx-space-2)",'& [part="picker"], & [part="text"]':{flex:"1",minWidth:"0"},'& [part="note"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",lineHeight:"1.4"},'& [part="note"][data-tone="danger"]':{$description:"A listing that failed is a FAULT rather than a fact about the project, and the two notes this control draws are otherwise the same sentence in the same place.",color:"var(--danger)"},'& [part="retry"]':{flex:"none"}},children:[{tagName:"div",attributes:{part:"control-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/kind"},cases:{picker:{$description:"The collection's entries. The empty row is `\"\"` rather than a sentinel, because the kit's select treats the empty string as a legal value a reader can arrow to; a dangling reference is kept in the list and marked, since blanking the field would delete the evidence and the value in one repaint. While the read is in flight the same control is disabled and offers one row saying so.",tagName:"jx-select",attributes:{part:"picker"},$props:{size:"sm",label:{$ref:"#/state/label"},options:{$ref:"#/state/options"},value:{$ref:"#/state/value"},disabled:{$ref:"#/state/disabled"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"event#/target/value"}]}]}},text:{$description:"The id as the string it is: what a reader gets when the choices could not be listed, and when the control was named by a `ui.control` override on a property that references nothing. Refusing to draw anything would lose the value that is already there.",tagName:"jx-textfield",attributes:{part:"text"},$props:{size:"sm",label:{$ref:"#/state/label"},value:{$ref:"#/state/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasNote"},cases:{true:{tagName:"p",attributes:{part:"note","data-tone":"${state.noteTone}",role:"status"},textContent:"${state.note}"}}},{tagName:"div",attributes:{part:"retry-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canRetry"},cases:{true:{$description:"Offered only where there is something to try again — a listing that failed. It used to be offered only where the HOST passed a repaint hook, because a template control cannot draw a second frame of its own and a button that cannot do the thing it is named after is worse than its absence. A mounted control redraws itself, so the condition is now the failure rather than the host.",tagName:"jx-action-button",attributes:{part:"retry"},$props:{size:"sm",quiet:!0,label:"Retry listing entries"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"},value:[]}]},children:[{tagName:"span",textContent:"Retry"}]}}}]};T("reference-field",M);function Y(){return{canRetry:!1,disabled:!0,hasNote:!1,kind:"picker",label:"",note:"",noteTone:"dim",options:[],value:""}}function L(e,s){e.textContent="";let t=g({...Y(),...s}),o=null,r=!0,l=!1,p=()=>R("reference-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.canRetry=d.canRetry,t.disabled=d.disabled,t.hasNote=d.hasNote,t.kind=d.kind,t.label=d.label,t.note=d.note,t.noteTone=d.noteTone,t.options=d.options,t.value=d.value,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var V={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSecretField",$description:'The `secret` form control (specs/extensions.md §9.1, §13): one password field whose VALUE goes to the platform\'s secret store and never to project.json. A descriptor names it with `"ui": { "<field>": { "control": "secret" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. **A surface never renders back the secret it describes, and this document is where that is visible rather than remembered**: the only thing bound to the field\'s value is `#/state/shown`, a scope path whose whole purpose is to hold nothing. What the field is worth is said in the placeholder instead — the env NAME the store gave it, which is the only half of a secret a screen may carry. `ui/form-controls.ts` decides everything else: whether the host has a secret store at all, what the placeholder says, what a commit is worth and what the field persists.',tagName:"div",attributes:{part:"secret",role:"none"},style:{$description:"`.secret-field` carried no rule anywhere — it was one of `check-styles.ts`'s ALLOWED_ORPHANS, a class emitted only so a test could find the control — so there is nothing to translate and the wrapper takes no box of its own. The field takes the width of the control host the form drew, which is the flex item; a kit field is inline-flex by default and would otherwise sit at its intrinsic width in a row sized for it.",display:"contents",'& [part="field"]':{width:"100%"}},children:[{$description:"`autocomplete: new-password` because this is a place to PUT a secret rather than to prove one: without it a password manager offers to fill the field with a credential belonging to whatever site the reader last logged in to, and the offer is the manager's own UI drawn over an editor. The value binding is `#/state/shown` and nothing else ever writes to it — see the document description.",tagName:"jx-textfield",attributes:{part:"field"},$props:{type:"password",size:"sm",autocomplete:"new-password",label:{$ref:"#/state/label"},placeholder:{$ref:"#/state/placeholder"},disabled:{$ref:"#/state/disabled"},value:{$ref:"#/state/shown"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"event#/target/value"}]}],description:"The change bubbles out of the field's own input, so what the reader typed is read off the event rather than off the element — and it is read here, handed to the flow, and never written back onto the scope."}}]};T("secret-field",V);function G(){return{disabled:!0,label:"",placeholder:"Not set"}}function z(e,s){e.textContent="";let t=g({...G(),...s,shown:""}),o=null,r=!0,l=!1,p=()=>R("secret-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{clear(){t.shown=" ",t.shown=""},dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.disabled=d.disabled,t.label=d.label,t.placeholder=d.placeholder,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var Q=z_.map((e)=>({label:e,value:e})),Z=W_.map((e)=>({label:e||"(none)",value:e})),P=[],I=" ";function ee(e){let s=e.resolvePointer("#/$context/content"),t=v(s)?Object.keys(s):[],o=t.join(" ");if(o!==I)I=o,P=t.map((r)=>({label:r,value:r}));return P}function S(e){return e==="string"||e==="array"}function re(e){if(!v(e))return{properties:{},required:[],type:"object"};return e}function ae(e){return JSON.parse(JSON.stringify(e))}function ne(e){let s=e;return s.type??="object",s.properties??={},s.required??=[],s}function k(e){return`name:${e}`}function q(e){return`required:${e}`}function H(e,s){return`${e} ${s}`}function O(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=H(s,t),p=ib(o);return{format:Td(o),hasFormat:S(p),key:t,name:O(e,k(l),t),parent:s,required:O(e,q(l),r),type:p}}function ie(e,s,t,o,r){let l=ib(t),p=l==="object",u=e.drafts.get(s),d=t.required??[];return{children:p?Object.entries(t.properties??{}).map(([y,h])=>oe(e,s,y,h,d.includes(y))):[],draftName:u?.name??"",draftType:u?.type??"string",extra:l==="reference"&&r?"reference":p?"nested":"none",format:Td(t),hasFormat:S(l),key:s,label:Jc(s),name:O(e,k(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:O(e,q(s),o),type:l}}function W(e,s,t){let o={};for(let[r,l]of Object.entries(e))o[r===s?t:r]=l,delete e[r];Object.assign(e,o)}function C(e,s,t){e.required??=[];let o=e.required.indexOf(s);if(t&&o===-1)e.required.push(s);if(!t&&o!==-1)e.required.splice(o,1)}function se(e,s){let t=s,o=null,r={add:{...Ed},addOpen:!1,drafts:new Map,echo:null},l=()=>o??re(t.value),p=()=>{let a=l(),i=a.required??[],c=ee(t.ctx);return{addFormat:r.add.format,addHasFormat:S(r.add.type),addName:r.add.name,addRequired:r.add.required,addState:r.addOpen?"open":"closed",addType:r.add.type,fields:Object.entries(a.properties??{}).map(([m,f])=>ie(r,m,f,i.includes(m),c.length>0)),formatOptions:Z,targets:c,typeOptions:Q}},u=()=>D.update(p()),d=(a,i)=>{r.echo={id:a,value:i},u()},y=()=>{r.echo=null,u()},h=(a)=>{let i=ae(l()),c=ne(i);if(!a(c)){y();return}o=c,r.echo=null,t.onChange(i),u()},w=(a,i)=>a.properties[i],A=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},D=E(e,{addNested(a){let i=A(a),c=Nx(i.name.trim());if(!c)return;h((m)=>{let f=w(m,a);if(!f)return!1;return f.properties??={},f.properties[c]=va(i.type||"string"),i.name="",!0})},cancelAdd(){r.addOpen=!1,r.add={...Ed},u()},confirmAdd(){let a=Nx(r.add.name.trim());if(!a)return;let{format:i,required:c,type:m}=r.add;r.addOpen=!1,r.add={...Ed},h((f)=>{if(f.properties[a]=va(m,i||void 0),c)C(f,a,!0);return!0})},editAddFormat(a){r.add.format=a,u()},editAddName(a){r.add.name=a,u()},editAddRequired(a){r.add.required=a,u()},editAddType(a){r.add.type=a,u()},editDraftName(a,i){A(a).name=i,u()},editDraftType(a,i){A(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Ed},u()},removeField(a){h((i)=>{if(!i.properties[a])return!1;return delete i.properties[a],i.required=i.required.filter((c)=>c!==a),!0})},removeNested(a,i){h((c)=>{let m=w(c,a);if(!m?.properties?.[i])return!1;if(delete m.properties[i],m.required)m.required=m.required.filter((f)=>f!==i);return!0})},renameField(a,i){d(k(a),i);let c=Nx(i.trim());h((m)=>{if(!m.properties[a]||!c||c===a||m.properties[c])return!1;return W(m.properties,a,c),m.required=m.required.map((f)=>f===a?c:f),!0})},renameNested(a,i,c){d(k(H(a,i)),c);let m=Nx(c.trim());h((f)=>{let b=w(f,a);if(!b?.properties?.[i]||!m||m===i||b.properties[m])return!1;if(W(b.properties,i,m),b.required)b.required=b.required.map((N)=>N===i?m:N);return!0})},setFormat(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;return c.properties[a]=va(m.type||"string",i||void 0),!0})},setNestedFormat(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;return f.properties[i]=va(b.type||"string",c||void 0),!0})},setNestedRequired(a,i,c){d(q(H(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return C(f,i,c),!0})},setNestedType(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;let N=S(c)?Td(b):void 0;return f.properties[i]=va(c,N||void 0),!0})},setRequired(a,i){d(q(a),i),h((c)=>{if(!c.properties[a])return!1;return C(c,a,i),!0})},setTarget(a,i){h((c)=>{if(!c.properties[a])return!1;return c.properties[a]={$ref:`#/content/${i}`},!0})},setType(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;let f=S(i)?Td(m):void 0;return c.properties[a]=va(i,f||void 0),!0})}});return u(),{dispose:()=>D.dispose(),update(a){t=a,o=null,r.echo=null,u()}}}var de={mount:se};cw("schema-builder",de);function J(e){return n(e)&&e?e:null}function ce(e,s){let t=s,o=()=>{let l=J(t.value);r.update({disabled:!t.ctx.commitSecret,label:t.key,placeholder:l?`Stored as ${l}`:"Not set"})},r=z(e,{commit(l){let{commitSecret:p}=t.ctx;if(!p||!l)return;r.clear();let{key:u,onChange:d}=t,y=J(t.value);Promise.resolve(p(u,l)).then((h)=>{if(n(h)&&h&&h!==y)d(h)})}});return o(),{dispose:()=>r.dispose(),update(l){t=l,o()}}}var pe={mount:ce};cw("secret",pe);function me(e,s){let t=s,o=()=>{Hl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>bm(e),update(r){t=r,o()}}}var ue={mount:me};cw("media",ue);var F=new Map,j=new Map,x=new Map;function lm(e){if(e===void 0)F.clear(),j.clear(),x.clear();else F.delete(e),j.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(le("4f2raf4a"),import("./content-source-4f2raf4a.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function vE(e,s){let t=j.get(e);if(t)return t;let o=fe(e),r=x.get(e);if(r){if(s)r.add(s);return null}x.set(e,new Set(s?[s]:[]));let l=(p)=>{if(F.get(e)!==o)return;let u=x.get(e);x.delete(e),j.set(e,p);for(let d of u??[])d()};return o.then((p)=>l({ids:p}),(p)=>l({error:te(p)})),null}function he(e,s){let t=n(e.value)?e.value:"",o={canRetry:!1,disabled:!1,hasNote:!1,label:e.key,note:"",noteTone:"dim",options:[],value:t},r=Hu(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=vE(r,s);if(l===null)return{...o,disabled:!0,kind:"picker",options:[{label:"Loading…",value:t}]};if("error"in l)return{...o,canRetry:!0,hasNote:!0,kind:"text",note:`Could not list ${r} entries — ${l.error}`,noteTone:"danger"};let p=t!==""&&!l.ids.includes(t);return{...o,hasNote:l.ids.length===0,kind:"picker",note:l.ids.length===0?`No ${r} entries yet.`:"",options:[{label:"—",value:""},...p?[{label:`${t} — not found`,value:t}]:[],...l.ids.map((u)=>({label:u,value:u}))]}}function ge(e,s){let t=s,o=!1,r=()=>{if(!o)l.update(he(t,r))},l=L(e,{choose(p){t.onChange(p===""?void 0:p)},edit(p){t.onChange(p.trim()||void 0)},retry(){let p=Hu(t.schema);if(p!==null)lm(p);r()}});return r(),{dispose(){o=!0,l.dispose()},update(p){t=p,r()}}}var ye={mount:ge};cw("reference",ye);
|
|
2
|
-
export{z_,W_,
|
|
1
|
+
import{ee}from"./studio-et6t8g4m.js";import{dw,Hu}from"./studio-zacvfm31.js";import{T,R}from"./studio-cvz0e00f.js";import{g}from"./studio-ahf3cspq.js";import{Yc,Nx}from"./studio-j933k8nr.js";import{Hl,bm}from"./studio-pmzg17fj.js";import{n,v}from"./studio-zsjpsw08.js";import{le}from"./studio-0g2sm01j.js";var z_=["string","number","boolean","array","object","reference"],W_=["","image","date","color"],Td={format:"",name:"",required:!1,type:"string"};function ob(e){if(e.$ref)return"reference";return e.type||"string"}function Ld(e){if(e.type==="array"&&e.items?.format)return e.items.format;return e.format||""}function ya(e,s){switch(e){case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"array":return s?{items:{format:s,type:"string"},type:"array"}:{items:{type:"string"},type:"array"};case"object":return{properties:{},required:[],type:"object"};case"reference":return{$ref:"#/content/"};default:return s?{format:s,type:"string"}:{type:"string"}}}var B={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSchemaBuilder",$description:'The `schema-builder` form control (specs/extensions.md §9.1): the visual editor for a JSON Schema object, drawn as one card per property. A descriptor names it with `"ui": { "<prop>": { "control": "schema-builder" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. The adapter (`surfaces/schema-builder.ts`) hands in the fields already classified and every draft the reader is part-way through typing; `ui/form-controls.ts` decides what a field may be renamed to and what reaches the host\'s `onChange`. Nothing here reads a schema: a document that re-derived a field\'s type while drawing would be a second opinion about what one module already owns. **The card is `surfaces/settings-defs.json`\'s, part for part.** Data Shapes edits the project\'s `$defs` and this edits a content type\'s `schema`; they are the same object with the same six controls per row, so the row vocabulary — `card`, `field-row`, `field-label`, `field-name`, `field-type`, `field-format`, `field-required`, `field-delete`, `nested`, `nested-card`, `nested-add-name`/`-type`/`-button`, `ref-target`, `add-form` — is ONE vocabulary, and the row views it is drawn from are that surface\'s own types rather than a second declaration of them. What differs is only what encloses it: Data Shapes carries the two-column chrome that chooses WHICH shape is being edited, and this one is handed the object to edit.',tagName:"div",attributes:{part:"builder"},style:{$description:"What `.schema-builder`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-nested-add-name` and `.schema-add-field` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer — the same translation `surfaces/settings-defs.json` carries, because it is the same card. Two values could not come with them. `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and the caption was an `sp-field-label` at whatever size Spectrum drew it; a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time. The nested card takes the studio layer's `--border`, and the caption says what it is in the type ramp instead.",display:"block",'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},'& [part="card"], & [part="nested-card"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"6px 10px"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"8px"},'& [part="field-label"]':{$description:"The field's name in words: a caption on the row rather than a label for a control, since the raw key beside it is what the reader edits and what carries the accessible name.",flex:"none",minWidth:"84px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="field-name"]':{flex:"1",maxWidth:"140px"},'& [part="nested"]':{marginLeft:"16px",marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--border)",display:"flex",flexDirection:"column",gap:"4px"},'& [part="ref-target"]':{display:"flex",marginTop:"6px",maxWidth:"220px"},'& [part="nested-add"]':{display:"flex",alignItems:"center",gap:"6px",padding:"4px 0"},'& [part="nested-add-name"]':{flex:"1",maxWidth:"120px"},'& [part="add-form"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0"}},children:[{tagName:"div",attributes:{part:"fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card","data-field":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.label}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.label}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFormat"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",$description:"Whether the object requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.label}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRequired"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.label}",hint:"Delete ${$map.item.label}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeField"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"extra-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/extra"},cases:{reference:{tagName:"div",attributes:{part:"ref-target"},children:[{tagName:"jx-select",attributes:{part:"ref-target-select"},$props:{label:"Target for ${$map.item.label}",size:"sm",options:{$ref:"#/state/targets"},value:{$ref:"$map/item/refTarget"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setTarget"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},nested:{tagName:"div",attributes:{part:"nested"},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"nested-card","data-nested":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.parent}.${$map.item.key}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedType"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedFormat"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.parent}.${$map.item.key}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedRequired"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.parent}.${$map.item.key}",hint:"Delete ${$map.item.parent}.${$map.item.key}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"}]}]}}]}]}},{tagName:"div",attributes:{part:"nested-add"},children:[{tagName:"jx-textfield",attributes:{part:"nested-add-name"},$props:{label:"New field in ${$map.item.label}",placeholder:"field name",size:"sm",value:{$ref:"$map/item/draftName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-select",attributes:{part:"nested-add-type"},$props:{label:"Type of the new field in ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/draftType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"nested-add-button"},$props:{label:"Add a field to ${$map.item.label}",hint:"Add a field to ${$map.item.label}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}]}}}]}}]},{tagName:"div",attributes:{part:"add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"add-open"},$props:{label:"Add Field",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add Field"}]},open:{tagName:"div",attributes:{part:"add-form"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:"New field name",placeholder:"Field name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddName"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]}}]}},{tagName:"jx-select",attributes:{part:"add-type"},$props:{label:"Type of the new field",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"#/state/addType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddType"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"add-format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addHasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"add-format"},$props:{label:"Format of the new field",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"#/state/addFormat"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddFormat"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"add-required"},$props:{hint:"Require the new field",size:"sm",checked:{$ref:"#/state/addRequired"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddRequired"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Required"}]},{tagName:"jx-button",attributes:{part:"add-confirm"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"jx-button",attributes:{part:"add-cancel"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]}]}}}]};T("schema-builder",B);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function E(e,s){e.textContent="";let t=g({..._(),...s}),o=null,r=!0,l=!1,p=()=>R("schema-builder",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.addFormat=d.addFormat,t.addHasFormat=d.addHasFormat,t.addName=d.addName,t.addRequired=d.addRequired,t.addState=d.addState,t.addType=d.addType,t.fields=d.fields,t.formatOptions=d.formatOptions,t.targets=d.targets,t.typeOptions=d.typeOptions,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var M={$schema:"https://jxsuite.com/schema/v1",$id:"StudioReferenceField",$description:'The `reference` form control — site-architecture.md §6.1\'s `{ "$ref": "#/content/x" }` and site-architecture.md §7.4\'s entry picker. Registered once and dispatched to by `ui/schema-form.ts` for any property whose `$ref` names a collection, so the settings forms, the entry editor and an array-of-objects cell all draw the same control without any of them knowing it exists. `ui/form-controls.ts` decides which of the three states the field is in and what each gesture commits; nothing here reads a schema or lists a directory. The three states are drawn as three different controls on purpose: a picker while the entries are known, a TEXT field while they are not — a failed read leaves the value editable with the reason beside it, because swapping it for an empty dropdown would present "no entries" and "could not find out" as the same screen — and a disabled picker saying so while the read is in flight.',tagName:"div",attributes:{part:"reference",role:"none"},style:{$description:"The five `.reference-*` rules from `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Two values could not come with them. The note read `var(--spectrum-font-size-50, 11px)`, which resolves only inside `<sp-theme>` — this document is mounted in a settings pane, an entry editor or a frontmatter card, all outside that element, so it would silently have taken its hard-coded fallback every time. And `.reference-missing` coloured ONE row of the dropdown red; the kit's select offers a row a face, a swatch and a border style but no tone, so the dangling entry says what it is in words (\"— not found\") and the colour is not replaced by a second channel. The 6px gap comes onto the kit's spacing scale.",display:"flex",flex:"1",minWidth:"0",alignItems:"center",gap:"var(--jx-space-2)",'& [part="picker"], & [part="text"]':{flex:"1",minWidth:"0"},'& [part="note"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",lineHeight:"1.4"},'& [part="note"][data-tone="danger"]':{$description:"A listing that failed is a FAULT rather than a fact about the project, and the two notes this control draws are otherwise the same sentence in the same place.",color:"var(--danger)"},'& [part="retry"]':{flex:"none"}},children:[{tagName:"div",attributes:{part:"control-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/kind"},cases:{picker:{$description:"The collection's entries. The empty row is `\"\"` rather than a sentinel, because the kit's select treats the empty string as a legal value a reader can arrow to; a dangling reference is kept in the list and marked, since blanking the field would delete the evidence and the value in one repaint. While the read is in flight the same control is disabled and offers one row saying so.",tagName:"jx-select",attributes:{part:"picker"},$props:{size:"sm",label:{$ref:"#/state/label"},options:{$ref:"#/state/options"},value:{$ref:"#/state/value"},disabled:{$ref:"#/state/disabled"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"event#/target/value"}]}]}},text:{$description:"The id as the string it is: what a reader gets when the choices could not be listed, and when the control was named by a `ui.control` override on a property that references nothing. Refusing to draw anything would lose the value that is already there.",tagName:"jx-textfield",attributes:{part:"text"},$props:{size:"sm",label:{$ref:"#/state/label"},value:{$ref:"#/state/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasNote"},cases:{true:{tagName:"p",attributes:{part:"note","data-tone":"${state.noteTone}",role:"status"},textContent:"${state.note}"}}},{tagName:"div",attributes:{part:"retry-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canRetry"},cases:{true:{$description:"Offered only where there is something to try again — a listing that failed. It used to be offered only where the HOST passed a repaint hook, because a template control cannot draw a second frame of its own and a button that cannot do the thing it is named after is worse than its absence. A mounted control redraws itself, so the condition is now the failure rather than the host.",tagName:"jx-action-button",attributes:{part:"retry"},$props:{size:"sm",quiet:!0,label:"Retry listing entries"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"},value:[]}]},children:[{tagName:"span",textContent:"Retry"}]}}}]};T("reference-field",M);function Y(){return{canRetry:!1,disabled:!0,hasNote:!1,kind:"picker",label:"",note:"",noteTone:"dim",options:[],value:""}}function L(e,s){e.textContent="";let t=g({...Y(),...s}),o=null,r=!0,l=!1,p=()=>R("reference-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.canRetry=d.canRetry,t.disabled=d.disabled,t.hasNote=d.hasNote,t.kind=d.kind,t.label=d.label,t.note=d.note,t.noteTone=d.noteTone,t.options=d.options,t.value=d.value,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var V={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSecretField",$description:'The `secret` form control (specs/extensions.md §9.1, §13): one password field whose VALUE goes to the platform\'s secret store and never to project.json. A descriptor names it with `"ui": { "<field>": { "control": "secret" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. **A surface never renders back the secret it describes, and this document is where that is visible rather than remembered**: the only thing bound to the field\'s value is `#/state/shown`, a scope path whose whole purpose is to hold nothing. What the field is worth is said in the placeholder instead — the env NAME the store gave it, which is the only half of a secret a screen may carry. `ui/form-controls.ts` decides everything else: whether the host has a secret store at all, what the placeholder says, what a commit is worth and what the field persists.',tagName:"div",attributes:{part:"secret",role:"none"},style:{$description:"`.secret-field` carried no rule anywhere — it was one of `check-styles.ts`'s ALLOWED_ORPHANS, a class emitted only so a test could find the control — so there is nothing to translate and the wrapper takes no box of its own. The field takes the width of the control host the form drew, which is the flex item; a kit field is inline-flex by default and would otherwise sit at its intrinsic width in a row sized for it.",display:"contents",'& [part="field"]':{width:"100%"}},children:[{$description:"`autocomplete: new-password` because this is a place to PUT a secret rather than to prove one: without it a password manager offers to fill the field with a credential belonging to whatever site the reader last logged in to, and the offer is the manager's own UI drawn over an editor. The value binding is `#/state/shown` and nothing else ever writes to it — see the document description.",tagName:"jx-textfield",attributes:{part:"field"},$props:{type:"password",size:"sm",autocomplete:"new-password",label:{$ref:"#/state/label"},placeholder:{$ref:"#/state/placeholder"},disabled:{$ref:"#/state/disabled"},value:{$ref:"#/state/shown"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"event#/target/value"}]}],description:"The change bubbles out of the field's own input, so what the reader typed is read off the event rather than off the element — and it is read here, handed to the flow, and never written back onto the scope."}}]};T("secret-field",V);function G(){return{disabled:!0,label:"",placeholder:"Not set"}}function z(e,s){e.textContent="";let t=g({...G(),...s,shown:""}),o=null,r=!0,l=!1,p=()=>R("secret-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{clear(){t.shown=" ",t.shown=""},dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.disabled=d.disabled,t.label=d.label,t.placeholder=d.placeholder,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var Q=z_.map((e)=>({label:e,value:e})),Z=W_.map((e)=>({label:e||"(none)",value:e})),P=[],I=" ";function te(e){let s=e.resolvePointer("#/$context/content"),t=v(s)?Object.keys(s):[],o=t.join(" ");if(o!==I)I=o,P=t.map((r)=>({label:r,value:r}));return P}function S(e){return e==="string"||e==="array"}function re(e){if(!v(e))return{properties:{},required:[],type:"object"};return e}function ae(e){return JSON.parse(JSON.stringify(e))}function ne(e){let s=e;return s.type??="object",s.properties??={},s.required??=[],s}function k(e){return`name:${e}`}function q(e){return`required:${e}`}function H(e,s){return`${e} ${s}`}function O(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=H(s,t),p=ob(o);return{format:Ld(o),hasFormat:S(p),key:t,name:O(e,k(l),t),parent:s,required:O(e,q(l),r),type:p}}function ie(e,s,t,o,r){let l=ob(t),p=l==="object",u=e.drafts.get(s),d=t.required??[];return{children:p?Object.entries(t.properties??{}).map(([y,h])=>oe(e,s,y,h,d.includes(y))):[],draftName:u?.name??"",draftType:u?.type??"string",extra:l==="reference"&&r?"reference":p?"nested":"none",format:Ld(t),hasFormat:S(l),key:s,label:Yc(s),name:O(e,k(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:O(e,q(s),o),type:l}}function W(e,s,t){let o={};for(let[r,l]of Object.entries(e))o[r===s?t:r]=l,delete e[r];Object.assign(e,o)}function C(e,s,t){e.required??=[];let o=e.required.indexOf(s);if(t&&o===-1)e.required.push(s);if(!t&&o!==-1)e.required.splice(o,1)}function se(e,s){let t=s,o=null,r={add:{...Td},addOpen:!1,drafts:new Map,echo:null},l=()=>o??re(t.value),p=()=>{let a=l(),i=a.required??[],c=te(t.ctx);return{addFormat:r.add.format,addHasFormat:S(r.add.type),addName:r.add.name,addRequired:r.add.required,addState:r.addOpen?"open":"closed",addType:r.add.type,fields:Object.entries(a.properties??{}).map(([m,f])=>ie(r,m,f,i.includes(m),c.length>0)),formatOptions:Z,targets:c,typeOptions:Q}},u=()=>D.update(p()),d=(a,i)=>{r.echo={id:a,value:i},u()},y=()=>{r.echo=null,u()},h=(a)=>{let i=ae(l()),c=ne(i);if(!a(c)){y();return}o=c,r.echo=null,t.onChange(i),u()},w=(a,i)=>a.properties[i],A=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},D=E(e,{addNested(a){let i=A(a),c=Nx(i.name.trim());if(!c)return;h((m)=>{let f=w(m,a);if(!f)return!1;return f.properties??={},f.properties[c]=ya(i.type||"string"),i.name="",!0})},cancelAdd(){r.addOpen=!1,r.add={...Td},u()},confirmAdd(){let a=Nx(r.add.name.trim());if(!a)return;let{format:i,required:c,type:m}=r.add;r.addOpen=!1,r.add={...Td},h((f)=>{if(f.properties[a]=ya(m,i||void 0),c)C(f,a,!0);return!0})},editAddFormat(a){r.add.format=a,u()},editAddName(a){r.add.name=a,u()},editAddRequired(a){r.add.required=a,u()},editAddType(a){r.add.type=a,u()},editDraftName(a,i){A(a).name=i,u()},editDraftType(a,i){A(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Td},u()},removeField(a){h((i)=>{if(!i.properties[a])return!1;return delete i.properties[a],i.required=i.required.filter((c)=>c!==a),!0})},removeNested(a,i){h((c)=>{let m=w(c,a);if(!m?.properties?.[i])return!1;if(delete m.properties[i],m.required)m.required=m.required.filter((f)=>f!==i);return!0})},renameField(a,i){d(k(a),i);let c=Nx(i.trim());h((m)=>{if(!m.properties[a]||!c||c===a||m.properties[c])return!1;return W(m.properties,a,c),m.required=m.required.map((f)=>f===a?c:f),!0})},renameNested(a,i,c){d(k(H(a,i)),c);let m=Nx(c.trim());h((f)=>{let b=w(f,a);if(!b?.properties?.[i]||!m||m===i||b.properties[m])return!1;if(W(b.properties,i,m),b.required)b.required=b.required.map((N)=>N===i?m:N);return!0})},setFormat(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;return c.properties[a]=ya(m.type||"string",i||void 0),!0})},setNestedFormat(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;return f.properties[i]=ya(b.type||"string",c||void 0),!0})},setNestedRequired(a,i,c){d(q(H(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return C(f,i,c),!0})},setNestedType(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;let N=S(c)?Ld(b):void 0;return f.properties[i]=ya(c,N||void 0),!0})},setRequired(a,i){d(q(a),i),h((c)=>{if(!c.properties[a])return!1;return C(c,a,i),!0})},setTarget(a,i){h((c)=>{if(!c.properties[a])return!1;return c.properties[a]={$ref:`#/content/${i}`},!0})},setType(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;let f=S(i)?Ld(m):void 0;return c.properties[a]=ya(i,f||void 0),!0})}});return u(),{dispose:()=>D.dispose(),update(a){t=a,o=null,r.echo=null,u()}}}var de={mount:se};dw("schema-builder",de);function J(e){return n(e)&&e?e:null}function ce(e,s){let t=s,o=()=>{let l=J(t.value);r.update({disabled:!t.ctx.commitSecret,label:t.key,placeholder:l?`Stored as ${l}`:"Not set"})},r=z(e,{commit(l){let{commitSecret:p}=t.ctx;if(!p||!l)return;r.clear();let{key:u,onChange:d}=t,y=J(t.value);Promise.resolve(p(u,l)).then((h)=>{if(n(h)&&h&&h!==y)d(h)})}});return o(),{dispose:()=>r.dispose(),update(l){t=l,o()}}}var pe={mount:ce};dw("secret",pe);function me(e,s){let t=s,o=()=>{Hl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>bm(e),update(r){t=r,o()}}}var ue={mount:me};dw("media",ue);var F=new Map,j=new Map,x=new Map;function lm(e){if(e===void 0)F.clear(),j.clear(),x.clear();else F.delete(e),j.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(le("jwtxg78w"),import("./content-source-jwtxg78w.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function vE(e,s){let t=j.get(e);if(t)return t;let o=fe(e),r=x.get(e);if(r){if(s)r.add(s);return null}x.set(e,new Set(s?[s]:[]));let l=(p)=>{if(F.get(e)!==o)return;let u=x.get(e);x.delete(e),j.set(e,p);for(let d of u??[])d()};return o.then((p)=>l({ids:p}),(p)=>l({error:ee(p)})),null}function he(e,s){let t=n(e.value)?e.value:"",o={canRetry:!1,disabled:!1,hasNote:!1,label:e.key,note:"",noteTone:"dim",options:[],value:t},r=Hu(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=vE(r,s);if(l===null)return{...o,disabled:!0,kind:"picker",options:[{label:"Loading…",value:t}]};if("error"in l)return{...o,canRetry:!0,hasNote:!0,kind:"text",note:`Could not list ${r} entries — ${l.error}`,noteTone:"danger"};let p=t!==""&&!l.ids.includes(t);return{...o,hasNote:l.ids.length===0,kind:"picker",note:l.ids.length===0?`No ${r} entries yet.`:"",options:[{label:"—",value:""},...p?[{label:`${t} — not found`,value:t}]:[],...l.ids.map((u)=>({label:u,value:u}))]}}function ge(e,s){let t=s,o=!1,r=()=>{if(!o)l.update(he(t,r))},l=L(e,{choose(p){t.onChange(p===""?void 0:p)},edit(p){t.onChange(p.trim()||void 0)},retry(){let p=Hu(t.schema);if(p!==null)lm(p);r()}});return r(),{dispose(){o=!0,l.dispose()},update(p){t=p,r()}}}var ye={mount:ge};dw("reference",ye);
|
|
2
|
+
export{z_,W_,Td,ob,Ld,ya,lm,vE};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=81B1ABDD6F0FF3AA64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pzfa2vmb.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{Vr}from"./studio-ajw4k8hp.js";import{Ot,Nt}from"./studio-qs5fmhtj.js";import{ge,ne,g,ar,C}from"./studio-tfmhnwyr.js";import{Si}from"./studio-8pne0rx4.js";import{Ue,ft,T,R,Jt,tt}from"./studio-myb4mf0h.js";import{oh}from"./studio-nqexty8x.js";import{uN}from"./studio-0nefxhar.js";import{Xn}from"./studio-yjh9gddd.js";import{Bd,La,Xb}from"./studio-7q6jdd4h.js";var y={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelActivity",$description:'The Activity feed: one row per operation this session, newest last, drawn from the projection `panels/activity-panel.ts` hands in. A row is a glyph, a head line (what the operation is, who is running it, how long it has taken), the line it is doing now, the plan it declared, the log it captured and — only when the operation handed a callback over — its Cancel. Every conditional the row has is a boolean field on the projected item, because `$switch` over a value is the only conditional a document has and "is this entry cancellable" is a question the panel has already answered. Nothing here reads the activity store: the panel owns what an operation IS, and the surface owns what it looks like.',tagName:"div",attributes:{part:"panel"},style:{$description:"What `.activity-panel`, `.activity-actions`, `.activity-list`, `.activity-row`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-duration`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step-icon`, `.activity-log-toggle` and `.activity-log` said in `styles/panels.css`, keyed on `part`. Two rules were DELETED rather than moved: `.activity-clear` and `.activity-cancel` drew a small bordered button by hand, and `jx-button` is that button — so the sizes, the border, the hover fill and the disabled state are the kit's now. Three token names changed meaning on the way: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and this document is mounted into the Bottom dock's body where that element is not an ancestor — every one of them would silently have taken its px fallback. They are the kit's own scale here (`--jx-text-sm`, `--jx-text-md`, `--jx-radius-xs`), which is the step each of them was. The `.activity-*` rules stay in the stylesheet regardless: `publish/deploy-checklist.ts` still draws the checklist above this feed in that same vocabulary, and it is a lit template until it converts.",display:"flex",flexDirection:"column",gap:"8px",padding:"8px",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="feed"]':{display:"flex",flexDirection:"column",gap:"8px",minWidth:"0"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{$description:"The left border is the state, at 3px, which is the one thing that must be legible in a column of twenty rows without reading any of them. Its default is the dim foreground so a state nobody has a colour for still draws a border rather than a gap.",display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 8px",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-state="running"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-state="done"]':{borderLeftColor:"var(--success)"},'& [part="row"][data-state="failed"]':{borderLeftColor:"var(--danger)"},'& [part="row"][data-state="cancelled"]':{borderLeftColor:"var(--fg-dim)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] [part="icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] [part="icon"]':{color:"var(--success)"},'& [part="row"][data-state="failed"] [part="icon"]':{color:"var(--danger)"},'& [part="body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"8px",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"], & [part="duration"]':{flex:"none",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="duration"]':{$description:"Pushed to the far edge so a column of rows reads as a column of times.",marginLeft:"auto"},'& [part="status"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The plan, declared up front, so "which of the three steps is this on" is answered by looking rather than by reading the status line and remembering what came before it.',display:"flex",flexDirection:"column",gap:"1px",margin:"2px 0 0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-sm)"},'& [part="step"]':{display:"flex",gap:"6px",color:"var(--fg-dim)"},'& [part="step"][data-state="running"]':{color:"var(--fg)"},'& [part="step"][data-state="done"] [part="step-icon"]':{color:"var(--success)"},'& [part="step"][data-state="failed"] [part="step-icon"]':{color:"var(--danger)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="log-toggle"]':{$description:"A plain button rather than a kit one, and the one element here that is not the kit's. The control has to carry `aria-expanded` on the node the reader actually focuses, and a `jx-button` forwards a fixed set of ARIA properties to the control inside its shadow root — an attribute written on the host would name the wrapper and not the button. Its wording is the disclosure's whole state (`docs/studio/interface/problems-and-progress.md` calls it the Show log disclosure), so nothing else has to draw one.",alignSelf:"flex-start",padding:"0",border:"none",background:"none",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="log"]':{$description:"The captured output the progress modal used to show once and then lose. It scrolls inside the row rather than growing it, so one 400-line `bun install` failure does not become the whole panel. It is selectable against the root's `user-select: none`, the one part of an activity row that is: the output is what a reader pastes into a bug report, and the row offers no copy action.",userSelect:"text",maxHeight:"180px",margin:"2px 0 0",padding:"6px",overflow:"auto",borderRadius:"var(--jx-radius-xs)",background:"var(--bg)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap"},'& [part="cancel"]':{flex:"none"},'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template and a document cannot call one. What it says is what is kept — one sentence saying what the region is FOR, then where its content comes from — and this region's fill is an operation somebody else starts, so it offers no button.",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"24px",textAlign:"center",fontSize:"13px",color:"var(--fg-dim)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"}},children:[{tagName:"div",attributes:{part:"feed-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRows"},cases:{true:{tagName:"div",attributes:{part:"feed"},children:[{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFinished"},cases:{true:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{size:"sm",quiet:!0},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearFinished"}}]},children:[{tagName:"span",textContent:"${state.clearLabel}"}]}]}}},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"row","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSource"},cases:{true:{tagName:"span",attributes:{part:"source"},textContent:"${$map.item.source}"}}},{tagName:"span",attributes:{part:"duration"},textContent:"${$map.item.duration}"}]},{tagName:"div",attributes:{part:"status-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasStatus"},cases:{true:{tagName:"div",attributes:{part:"status"},textContent:"${$map.item.status}"}}},{tagName:"div",attributes:{part:"steps-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSteps"},cases:{true:{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"$map/item/steps"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"step","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-label"},textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"log-toggle-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasLog"},cases:{true:{tagName:"button",attributes:{part:"log-toggle",type:"button","aria-expanded":"${$map.item.expanded ? 'true' : 'false'}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleLog"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.logLabel}"}}},{tagName:"div",attributes:{part:"log-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/showLog"},cases:{true:{tagName:"pre",attributes:{part:"log"},textContent:"${$map.item.logText}"}}}]},{tagName:"div",attributes:{part:"cancel-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/cancellable"},cases:{true:{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"cancel",title:"Stop this operation"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"Cancel"}]}}}]}}]}]},false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Long operations show their progress, their log and their Cancel button here."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Installs, clones, publishes and imports report here while they run."}]}}}]};T("panel-activity",y);var h=null,u=null,d=null,c=null;function N(t,e){t.rows=e.rows,t.hasRows=e.hasRows,t.hasFinished=e.hasFinished,t.clearLabel=e.clearLabel}function E(t){if(h!==t)return!1;return c===null?d!==null:c.root.parentNode===t}function v(t,e){if(E(t))return;f(),h=t;let i=g({cancel:e.cancel,clearFinished:e.clearFinished,clearLabel:"",hasFinished:!1,hasRows:!1,rows:[],toggleLog:e.toggleLog});u=ge(),u.run(()=>{ne(()=>{N(i,e.project())})});let a=R("panel-activity",i,t);d=a,a.then((l)=>{if(d===a)c=l;else l.dispose()})}function f(){u?.stop(),u=null;let t=d;if(d=null,c)c.dispose(),c=null;else if(t)t.then((e)=>e.dispose());h=null}var cs=g([]),j=20,p=new Map,b=0;function I(){return b+=1,`a${b}`}function Dc(t){return t.state!=="running"}function w(){let t=cs.filter((e)=>Dc(e)).length-j;while(t>0){let e=cs.findIndex((i)=>Dc(i));if(e===-1)return;p.delete(cs[e].id),cs.splice(e,1),t-=1}}function Vs(t){let e={cancellable:t.cancel!==void 0,endedAt:null,expanded:!1,id:I(),log:[],startedAt:ar(),state:"running",status:t.status??"",steps:(t.steps??[]).map((o)=>({label:o,state:"pending"})),title:t.title},i=t.source===void 0?e:{...e,source:t.source};if(t.cancel)p.set(i.id,t.cancel);cs.push(i);let a=cs.at(-1);w();let l=(o,r)=>{if(Dc(a))return;if(a.state=o,a.endedAt=ar(),r!==void 0)a.status=r;for(let n of a.steps)n.state=n.state==="done"?"done":o==="done"?"done":"failed";a.cancellable=!1,p.delete(a.id),w()};return{done(o){l("done",o)},entry:a,fail(o,r={}){if(Dc(a))return;let n=a.log.join(`
|
|
2
|
-
`);l("failed",o);let s={source:a.source??a.title};if(n!=="")s.detail=n;if(r.action!==void 0)s.action=r.action;if(r.actionArgs!==void 0)s.actionArgs=r.actionArgs;if(r.path!==void 0)s.path=r.path;C.error(o,s)},id:a.id,log(o){let r=o.replace(/\s+$/,"");if(r!=="")a.log.push(r)},setStatus(o){if(!
|
|
3
|
-
`),showLog:t.expanded&&e>0,source:t.source??"",state:t.state,status:t.status,steps:t.steps.map((i,a)=>O(i,a)),title:t.title}}function z(){let t=cs.filter((e)=>
|
|
4
|
-
<div data-activity-surface></div>`}function U(t){let e=t.querySelector("[data-activity-surface]");if(!e){f();return}v(e,D)}function
|
|
1
|
+
import{Vr}from"./studio-x2metr13.js";import{Ot,Nt}from"./studio-f2j9et3h.js";import{ge,ne,g,ar,C}from"./studio-ahf3cspq.js";import{Si}from"./studio-4nkm4404.js";import{Ue,ft,T,R,Yt,tt}from"./studio-cvz0e00f.js";import{oh}from"./studio-dbgv4fv9.js";import{hN}from"./studio-zxm98z2m.js";import{Xn}from"./studio-ggm7zf70.js";import{zd,La,Qb}from"./studio-0hr000ba.js";var y={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelActivity",$description:'The Activity feed: one row per operation this session, newest last, drawn from the projection `panels/activity-panel.ts` hands in. A row is a glyph, a head line (what the operation is, who is running it, how long it has taken), the line it is doing now, the plan it declared, the log it captured and — only when the operation handed a callback over — its Cancel. Every conditional the row has is a boolean field on the projected item, because `$switch` over a value is the only conditional a document has and "is this entry cancellable" is a question the panel has already answered. Nothing here reads the activity store: the panel owns what an operation IS, and the surface owns what it looks like.',tagName:"div",attributes:{part:"panel"},style:{$description:"What `.activity-panel`, `.activity-actions`, `.activity-list`, `.activity-row`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-duration`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step-icon`, `.activity-log-toggle` and `.activity-log` said in `styles/panels.css`, keyed on `part`. Two rules were DELETED rather than moved: `.activity-clear` and `.activity-cancel` drew a small bordered button by hand, and `jx-button` is that button — so the sizes, the border, the hover fill and the disabled state are the kit's now. Three token names changed meaning on the way: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and this document is mounted into the Bottom dock's body where that element is not an ancestor — every one of them would silently have taken its px fallback. They are the kit's own scale here (`--jx-text-sm`, `--jx-text-md`, `--jx-radius-xs`), which is the step each of them was. The `.activity-*` rules stay in the stylesheet regardless: `publish/deploy-checklist.ts` still draws the checklist above this feed in that same vocabulary, and it is a lit template until it converts.",display:"flex",flexDirection:"column",gap:"8px",padding:"8px",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="feed"]':{display:"flex",flexDirection:"column",gap:"8px",minWidth:"0"},'& [part="actions"]':{display:"flex",justifyContent:"flex-end"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{$description:"The left border is the state, at 3px, which is the one thing that must be legible in a column of twenty rows without reading any of them. Its default is the dim foreground so a state nobody has a colour for still draws a border rather than a gap.",display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 8px",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-state="running"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-state="done"]':{borderLeftColor:"var(--success)"},'& [part="row"][data-state="failed"]':{borderLeftColor:"var(--danger)"},'& [part="row"][data-state="cancelled"]':{borderLeftColor:"var(--fg-dim)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] [part="icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] [part="icon"]':{color:"var(--success)"},'& [part="row"][data-state="failed"] [part="icon"]':{color:"var(--danger)"},'& [part="body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"8px",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"], & [part="duration"]':{flex:"none",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="duration"]':{$description:"Pushed to the far edge so a column of rows reads as a column of times.",marginLeft:"auto"},'& [part="status"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The plan, declared up front, so "which of the three steps is this on" is answered by looking rather than by reading the status line and remembering what came before it.',display:"flex",flexDirection:"column",gap:"1px",margin:"2px 0 0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-sm)"},'& [part="step"]':{display:"flex",gap:"6px",color:"var(--fg-dim)"},'& [part="step"][data-state="running"]':{color:"var(--fg)"},'& [part="step"][data-state="done"] [part="step-icon"]':{color:"var(--success)"},'& [part="step"][data-state="failed"] [part="step-icon"]':{color:"var(--danger)"},'& [part="step-icon"]':{flex:"none",width:"10px",textAlign:"center"},'& [part="log-toggle"]':{$description:"A plain button rather than a kit one, and the one element here that is not the kit's. The control has to carry `aria-expanded` on the node the reader actually focuses, and a `jx-button` forwards a fixed set of ARIA properties to the control inside its shadow root — an attribute written on the host would name the wrapper and not the button. Its wording is the disclosure's whole state (`docs/studio/interface/problems-and-progress.md` calls it the Show log disclosure), so nothing else has to draw one.",alignSelf:"flex-start",padding:"0",border:"none",background:"none",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="log"]':{$description:"The captured output the progress modal used to show once and then lose. It scrolls inside the row rather than growing it, so one 400-line `bun install` failure does not become the whole panel. It is selectable against the root's `user-select: none`, the one part of an activity row that is: the output is what a reader pastes into a bug report, and the row offers no copy action.",userSelect:"text",maxHeight:"180px",margin:"2px 0 0",padding:"6px",overflow:"auto",borderRadius:"var(--jx-radius-xs)",background:"var(--bg)",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",whiteSpace:"pre-wrap"},'& [part="cancel"]':{flex:"none"},'& [part="empty"]':{$description:"The teaching empty state, drawn here rather than borrowed from `panels/empty-state.ts`: that helper is a lit template and a document cannot call one. What it says is what is kept — one sentence saying what the region is FOR, then where its content comes from — and this region's fill is an operation somebody else starts, so it offers no button.",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"24px",textAlign:"center",fontSize:"13px",color:"var(--fg-dim)"},'& [part="empty-message"], & [part="empty-detail"]':{margin:"0",maxWidth:"34ch",lineHeight:"1.5"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-sm)",opacity:"0.8"}},children:[{tagName:"div",attributes:{part:"feed-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasRows"},cases:{true:{tagName:"div",attributes:{part:"feed"},children:[{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasFinished"},cases:{true:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"jx-button",$props:{size:"sm",quiet:!0},attributes:{part:"clear"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearFinished"}}]},children:[{tagName:"span",textContent:"${state.clearLabel}"}]}]}}},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"row","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"source-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSource"},cases:{true:{tagName:"span",attributes:{part:"source"},textContent:"${$map.item.source}"}}},{tagName:"span",attributes:{part:"duration"},textContent:"${$map.item.duration}"}]},{tagName:"div",attributes:{part:"status-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasStatus"},cases:{true:{tagName:"div",attributes:{part:"status"},textContent:"${$map.item.status}"}}},{tagName:"div",attributes:{part:"steps-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasSteps"},cases:{true:{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"$map/item/steps"},key:{$ref:"$map/item/key"},map:{tagName:"li",attributes:{part:"step","data-state":"${$map.item.state}"},children:[{tagName:"span",attributes:{part:"step-icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"step-label"},textContent:"${$map.item.label}"}]}}]}}},{tagName:"div",attributes:{part:"log-toggle-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasLog"},cases:{true:{tagName:"button",attributes:{part:"log-toggle",type:"button","aria-expanded":"${$map.item.expanded ? 'true' : 'false'}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleLog"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.logLabel}"}}},{tagName:"div",attributes:{part:"log-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/showLog"},cases:{true:{tagName:"pre",attributes:{part:"log"},textContent:"${$map.item.logText}"}}}]},{tagName:"div",attributes:{part:"cancel-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/cancellable"},cases:{true:{tagName:"jx-button",$props:{size:"sm"},attributes:{part:"cancel",title:"Stop this operation"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"Cancel"}]}}}]}}]}]},false:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-message"},textContent:"Long operations show their progress, their log and their Cancel button here."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"Installs, clones, publishes and imports report here while they run."}]}}}]};T("panel-activity",y);var h=null,u=null,d=null,c=null;function N(t,e){t.rows=e.rows,t.hasRows=e.hasRows,t.hasFinished=e.hasFinished,t.clearLabel=e.clearLabel}function E(t){if(h!==t)return!1;return c===null?d!==null:c.root.parentNode===t}function v(t,e){if(E(t))return;f(),h=t;let i=g({cancel:e.cancel,clearFinished:e.clearFinished,clearLabel:"",hasFinished:!1,hasRows:!1,rows:[],toggleLog:e.toggleLog});u=ge(),u.run(()=>{ne(()=>{N(i,e.project())})});let a=R("panel-activity",i,t);d=a,a.then((l)=>{if(d===a)c=l;else l.dispose()})}function f(){u?.stop(),u=null;let t=d;if(d=null,c)c.dispose(),c=null;else if(t)t.then((e)=>e.dispose());h=null}var cs=g([]),j=20,p=new Map,b=0;function I(){return b+=1,`a${b}`}function Nc(t){return t.state!=="running"}function w(){let t=cs.filter((e)=>Nc(e)).length-j;while(t>0){let e=cs.findIndex((i)=>Nc(i));if(e===-1)return;p.delete(cs[e].id),cs.splice(e,1),t-=1}}function Us(t){let e={cancellable:t.cancel!==void 0,endedAt:null,expanded:!1,id:I(),log:[],startedAt:ar(),state:"running",status:t.status??"",steps:(t.steps??[]).map((o)=>({label:o,state:"pending"})),title:t.title},i=t.source===void 0?e:{...e,source:t.source};if(t.cancel)p.set(i.id,t.cancel);cs.push(i);let a=cs.at(-1);w();let l=(o,r)=>{if(Nc(a))return;if(a.state=o,a.endedAt=ar(),r!==void 0)a.status=r;for(let n of a.steps)n.state=n.state==="done"?"done":o==="done"?"done":"failed";a.cancellable=!1,p.delete(a.id),w()};return{done(o){l("done",o)},entry:a,fail(o,r={}){if(Nc(a))return;let n=a.log.join(`
|
|
2
|
+
`);l("failed",o);let s={source:a.source??a.title};if(n!=="")s.detail=n;if(r.action!==void 0)s.action=r.action;if(r.actionArgs!==void 0)s.actionArgs=r.actionArgs;if(r.path!==void 0)s.path=r.path;C.error(o,s)},id:a.id,log(o){let r=o.replace(/\s+$/,"");if(r!=="")a.log.push(r)},setStatus(o){if(!Nc(a))a.status=o},step(o){let r=a.steps.findIndex((n)=>n.label===o);if(r===-1)a.steps.push({label:o,state:"pending"}),r=a.steps.length-1;for(let[n,s]of a.steps.entries())s.state=n<r?"done":n===r?"running":s.state;a.status=o}}}function x(t){return cs.find((e)=>e.id===t)}function m(){return cs.filter((t)=>!Nc(t))}function H(t){let e=x(t),i=p.get(t);if(!e||!i||Nc(e))return!1;return i(),p.delete(t),e.state="cancelled",e.endedAt=ar(),e.cancellable=!1,e.status="Cancelled",!0}function F(){let t=cs.filter((i)=>!Nc(i)),e=cs.length-t.length;return cs.splice(0,cs.length,...t),e}function sN(){return m().map((t)=>`activity: ${t.title} — ${t.status||"running"}`)}var P={cancelled:"⊘",done:"✓",failed:"✕",running:"⋯"},M={done:"✓",failed:"✕",pending:"·",running:"⋯"};function V(t,e=ar()){let i=Math.max(0,(t.endedAt??e)-t.startedAt);if(i<1000)return`${i}ms`;let a=Math.round(i/1000);return a<60?`${a}s`:`${Math.floor(a/60)}m ${a%60}s`}function O(t,e){return{icon:M[t.state],key:`${e}:${t.label}`,label:t.label,state:t.state}}function VT(t){let e=t.log.length;return{cancellable:t.cancellable,duration:V(t),expanded:t.expanded,hasLog:e>0,hasSource:(t.source??"")!=="",hasStatus:t.status!=="",hasSteps:t.steps.length>0,icon:P[t.state],id:t.id,logLabel:t.expanded?"Hide log":`Show log (${e} line(s))`,logText:t.log.join(`
|
|
3
|
+
`),showLog:t.expanded&&e>0,source:t.source??"",state:t.state,status:t.status,steps:t.steps.map((i,a)=>O(i,a)),title:t.title}}function z(){let t=cs.filter((e)=>Nc(e)).length;return{clearLabel:`Clear ${t} finished`,hasFinished:t>0,hasRows:cs.length>0,rows:cs.map((e)=>VT(e))}}var D={cancel:(t)=>{H(t)},clearFinished:()=>{F()},project:z,toggleLog:(t)=>{let e=x(t);if(e)e.expanded=!e.expanded}};function _(){return Vr`<div data-deploy-checklist></div>
|
|
4
|
+
<div data-activity-surface></div>`}function U(t){let e=t.querySelector("[data-activity-surface]");if(!e){f();return}v(e,D)}function aN(){Xn({id:"activity",title:"Activity",level:"project",dock:"bottom",icon:"clock-counter-clockwise",rail:!1,badge:()=>m().length>0?m().length:null,render:()=>_(),afterRender:(t,e)=>{hN(e),U(e)}})}var W={message:"no media file to look for",status:"failed"};function A(t){let e=Si(t);return e===""?null:{path:e}}function Ow(t){let e=A(t);return e===null?null:zd(e)}async function Gu(t){let e=A(t);return e===null?W:La(e)}function lN(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 Qb(t.result)}}var S={$schema:"https://jxsuite.com/schema/v1",$id:"StudioProgressModal",$description:"The one surface in Studio that blocks while it works: the operation's name, a spinner, the line under it, and the two ways out. A `jx-dialog`, so the platform owns modality, the backdrop, focus restoration and Escape — which is what retired the `sp-underlay` this surface used to paint beside itself, and with it the fixed box, the panel, the shadow and the `z-index: 1000` that box needed to climb back out from under its own scrim. The two answers are the dialog's own: confirm is `Run in the background`, which stops the BLOCKING and leaves the work running in Activity, and the secondary answer is Cancel, drawn only when the operation handed one over. It is the secondary rather than the cancel answer for a reason that is behavioural, not cosmetic: the platform raises one `cancel` for Escape, for a light dismissal and for the cancel button alike, and a surface that cannot tell them apart would stop a dependency install on a keystroke. Escape therefore means what confirm means — stop blocking, not stop working — and the answer that stops the work is a button and only a button.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/title"},confirmLabel:"Run in the background",secondaryLabel:{$ref:"#/state/cancelLabel"},cancelLabel:"",size:"sm"},attributes:{part:"progress"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/background"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/background"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"What is left once `jx-dialog` has drawn the dialog. `.progress-modal` is gone rather than moved — it positioned a fixed box, painted its panel, border, radius and shadow, capped its height and then lifted itself above the scrim it rendered beside — and a modal `<dialog>` in the top layer is every one of those. `.progress-title` went the same way: the operation's name is the dialog's headline, which is also its accessible name, so nothing here draws a title.",'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="status"]':{$description:"`anywhere`, because a status line is usually a path or a package spec with no space in it, and one of those would otherwise be the thing that decides how wide the dialog is. `min-width: 0` is what lets it wrap at all: a flex item's automatic minimum is its content, so without this the row refuses to shrink and the text overflows instead.",minWidth:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",overflowWrap:"anywhere"}},children:[{tagName:"div",attributes:{part:"row"},children:[{tagName:"jx-spinner",attributes:{part:"busy"},$props:{size:"lg"}},{tagName:"span",attributes:{part:"status","aria-live":"polite"},textContent:"${state.status}"}]}]};T("progress-modal",S);function k(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(Ue,ft("modal","progress")),t.layer.append(e);let i=!1,a=()=>i,l=g({background:()=>{t.onBackground()},cancel:()=>{t.onCancel()},cancelLabel:t.cancellable?"Cancel":"",closed:()=>{t.onClosed()},status:t.status,title:t.title}),o=null,r=R("progress-modal",l,e).then(async(n)=>{let s=n.root;if(a())return n.dispose(),s;if(o=n,await Yt(s),a())return s;return Ot(s),s});return{close(){if(i)return;i=!0;let n=o?.root;if(n instanceof HTMLElement)Nt(n);o?.dispose(),o=null,e.remove()},host:e,ready:r,setStatus(n){l.status=n}}}function el(t){let e=!1,i={title:t.title};if(t.status!==void 0)i.status=t.status;if(t.source!==void 0)i.source=t.source;if(t.cancel!==void 0)i.cancel=t.cancel;let a=Us(i),l=()=>{if(e)return;e=!0,r.close()},o=()=>{l(),oh("activity")},r=k({cancellable:t.cancel!==void 0,layer:tt("modal"),onBackground:o,onCancel:()=>{l(),t.cancel?.()},onClosed:l,status:t.status??"",title:t.title});return{activity:a,done(){a.done(),l()},fail(n){let s=n.trim();if(s===""||s.includes(`
|
|
5
5
|
`))a.log(s),a.fail(`${t.title} failed`);else a.fail(s);l()},log(n){a.log(n)},setStatus(n){if(a.setStatus(n),!e)r.setStatus(n)}}}
|
|
6
|
-
export{cs,
|
|
6
|
+
export{cs,Nc,Us,sN,VT,aN,el,Ow,Gu,lN};
|
|
7
7
|
|
|
8
|
-
//# debugId=
|
|
9
|
-
//# sourceMappingURL=studio-
|
|
8
|
+
//# debugId=A3C3EBA632C1E41B64756E2164756E21
|
|
9
|
+
//# sourceMappingURL=studio-qyb5bebs.js.map
|