@jxsuite/studio 10.1.0 → 10.2.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-mkb0qa6p.js → 2020-bx702wqa.js} +3 -3
- package/dist/chunks/adapter-pp011m5x.js +4 -0
- package/dist/chunks/add-new-flow-ecqmzz76.js +4 -0
- package/dist/chunks/cf-account-picker-c07znkqt.js +4 -0
- package/dist/chunks/cf-settings-0v2bmqy0.js +4 -0
- package/dist/chunks/components-yn0dn2pq.js +4 -0
- package/dist/chunks/content-source-g0j41yy6.js +4 -0
- package/dist/chunks/{convert-to-repeater-f92ey3kp.js → convert-to-repeater-sbjk7tgn.js} +3 -3
- package/dist/chunks/editor-xz02jeh1.js +4 -0
- package/dist/chunks/entry-commands-kmt02crp.js +4 -0
- package/dist/chunks/extension-sections-0rprf12d.js +4 -0
- package/dist/chunks/file-ops-mexj5qed.js +4 -0
- package/dist/chunks/files-b2tcppdd.js +4 -0
- package/dist/chunks/format-host-btsevv0c.js +4 -0
- package/dist/chunks/fs-events-r0apejva.js +4 -0
- package/dist/chunks/grid-open-n2a8xkht.js +4 -0
- package/dist/chunks/{grid-view-r22jsqht.js → grid-view-tghcwrrt.js} +12 -12
- package/dist/chunks/iframe-host-gx0ypyh3.js +4 -0
- package/dist/chunks/index-bs4k9tr6.js +4 -0
- package/dist/chunks/{index-pxwwf00y.js → index-vr006kbt.js} +3 -3
- package/dist/chunks/{javascript-pzqryby6.js → javascript-z1g3s9fd.js} +2 -2
- package/dist/chunks/{jsonMode-tcnyxyap.js → jsonMode-7szwg8c4.js} +5 -5
- package/dist/chunks/jx-validate-ymf10teh.js +4 -0
- package/dist/chunks/layers-p9nfya38.js +4 -0
- package/dist/chunks/layers-panel-tt1hzhhf.js +4 -0
- package/dist/chunks/lit-html-x18n2sfz.js +4 -0
- package/dist/chunks/media-library-0n45gv8r.js +4 -0
- package/dist/chunks/media-picker-s09at95z.js +4 -0
- package/dist/chunks/{monaco-binding-bqpge64f.js → monaco-binding-v42w9c1v.js} +3 -3
- package/dist/chunks/monaco-buffer-een2ea0v.js +4 -0
- package/dist/chunks/{monaco-setup-1mkab762.js → monaco-setup-7bffxd6v.js} +3 -3
- package/dist/chunks/notify-qwb8radt.js +4 -0
- package/dist/chunks/parse-v77xtwv7.js +4 -0
- package/dist/chunks/platform-8jnez0wr.js +4 -0
- package/dist/chunks/publish-panel-aysnj611.js +4 -0
- package/dist/chunks/{publish-quick-m9vkhahq.js → publish-quick-kpbqs9mz.js} +3 -3
- package/dist/chunks/publish-workspace-nd0a8q99.js +4 -0
- package/dist/chunks/quick-search-vg0jkhk2.js +4 -0
- package/dist/chunks/references-a7v6a0e2.js +4 -0
- package/dist/chunks/right-panel-cvk1vxx5.js +4 -0
- package/dist/chunks/source-control-fsqzc6he.js +4 -0
- package/dist/chunks/studio-05jfwbmf.js +5 -0
- package/dist/chunks/{studio-qyb5bebs.js → studio-0q5jwddh.js} +7 -7
- package/dist/chunks/{studio-cvz0e00f.js → studio-0w2dr0q8.js} +4 -4
- package/dist/chunks/{studio-eesyjg7h.js → studio-1tzpds97.js} +5 -5
- package/dist/chunks/{studio-a3s6frde.js → studio-216b27sv.js} +3 -3
- package/dist/chunks/studio-2ejhqns4.js +5 -0
- package/dist/chunks/studio-2r90cts3.js +16 -0
- package/dist/chunks/{studio-dy2xtt7a.js → studio-399a25za.js} +4 -4
- package/dist/chunks/studio-399xknkb.js +6 -0
- package/dist/chunks/{studio-jh6t5qz4.js → studio-43y04qck.js} +4 -4
- package/dist/chunks/{studio-skynbac3.js → studio-4g8yb6jn.js} +2 -2
- package/dist/chunks/{studio-jw0q5j6k.js → studio-4jhw38b2.js} +4 -4
- package/dist/chunks/{studio-4smcnv33.js → studio-4ncmwqw5.js} +4 -4
- package/dist/chunks/studio-5atwjgkj.js +7 -0
- package/dist/chunks/{studio-vcz63n42.js → studio-5frqk7c0.js} +4 -4
- package/dist/chunks/{studio-hsr3k06v.js → studio-646nn2ys.js} +5 -5
- package/dist/chunks/{studio-ch8gt8vt.js → studio-6cwj6xrx.js} +4 -4
- package/dist/chunks/studio-6hzdjfv0.js +5 -0
- package/dist/chunks/{studio-9cp96v90.js → studio-71m92v9s.js} +7 -7
- package/dist/chunks/{studio-brdp85q7.js → studio-75kcdbsk.js} +4 -4
- package/dist/chunks/{studio-6vwvshw8.js → studio-78pywnp2.js} +5 -5
- package/dist/chunks/{studio-ggm7zf70.js → studio-86r8hp7r.js} +5 -5
- package/dist/chunks/studio-886t6ztg.js +5 -0
- package/dist/chunks/{studio-5dmgmyw4.js → studio-8wnvtr4z.js} +4 -4
- package/dist/chunks/studio-8z66jk4z.js +5 -0
- package/dist/chunks/{studio-x2metr13.js → studio-9rbe2xpw.js} +3 -3
- package/dist/chunks/{studio-8qejv8yf.js → studio-awxwjawq.js} +4 -4
- package/dist/chunks/studio-b2qpt0xy.js +14 -0
- package/dist/chunks/{studio-9rcbvksg.js → studio-bvs9kpst.js} +7 -7
- package/dist/chunks/studio-c71806xz.js +7 -0
- package/dist/chunks/{studio-vjhej0w5.js → studio-cbwks69x.js} +140 -140
- package/dist/chunks/studio-cg1bfyhf.js +9 -0
- package/dist/chunks/studio-cg710sk9.js +5 -0
- package/dist/chunks/studio-cw0wb9qk.js +7 -0
- package/dist/chunks/studio-cyheys7k.js +5 -0
- package/dist/chunks/studio-ea5m9kg5.js +5 -0
- package/dist/chunks/{studio-4nkm4404.js → studio-ea74s8c1.js} +4 -4
- package/dist/chunks/{studio-37twdaf7.js → studio-efdxjwyp.js} +34 -34
- package/dist/chunks/{studio-pmzg17fj.js → studio-egmw2837.js} +4 -4
- package/dist/chunks/{studio-8jb31dcf.js → studio-er5f383a.js} +4 -4
- package/dist/chunks/studio-f746039f.js +5 -0
- package/dist/chunks/studio-fmdymd9v.js +5 -0
- package/dist/chunks/studio-gcm12z00.js +6 -0
- package/dist/chunks/{studio-t3j8htp7.js → studio-gj98m8gy.js} +5 -5
- package/dist/chunks/{studio-cgb97rwv.js → studio-hasbgjah.js} +4 -4
- package/dist/chunks/studio-hhp4x8xf.js +6 -0
- package/dist/chunks/{studio-848rk4p1.js → studio-hz5n7x27.js} +4 -4
- package/dist/chunks/{studio-0g2sm01j.js → studio-j3d2fjqz.js} +4 -4
- package/dist/chunks/studio-jeraxdgv.js +7 -0
- package/dist/chunks/studio-jvgek9xt.js +5 -0
- package/dist/chunks/studio-jws1a87n.js +5 -0
- package/dist/chunks/studio-k2sz13zg.js +5 -0
- package/dist/chunks/studio-k3m4jkdk.js +5 -0
- package/dist/chunks/{studio-7vb997ff.js → studio-kg1abnz0.js} +4 -4
- package/dist/chunks/{studio-s0fg2wav.js → studio-kg5ya5r2.js} +4 -4
- package/dist/chunks/studio-khwbgrtg.js +5 -0
- package/dist/chunks/studio-mx6wzh25.js +5 -0
- package/dist/chunks/studio-mxs3ar9t.js +5 -0
- package/dist/chunks/studio-nm4szey4.js +5 -0
- package/dist/chunks/studio-nqxqf8p2.js +4 -0
- package/dist/chunks/{studio-07k0geap.js → studio-pjtntksy.js} +4 -4
- package/dist/chunks/studio-qh8berdz.js +5 -0
- package/dist/chunks/studio-qn7z4krm.js +5 -0
- package/dist/chunks/studio-qyed0ah6.js +5 -0
- package/dist/chunks/{studio-5e7p1vgd.js → studio-r4bcdwhq.js} +4 -4
- package/dist/chunks/{studio-mwnmzx7g.js → studio-r7pf0rkv.js} +6 -6
- package/dist/chunks/studio-rtfnhrdg.js +5 -0
- package/dist/chunks/{studio-zacvfm31.js → studio-rzqaz21g.js} +4 -4
- package/dist/chunks/studio-s5tzw84t.js +5 -0
- package/dist/chunks/{studio-nf0pqpbj.js → studio-sevbc3xv.js} +4 -4
- package/dist/chunks/{studio-va0e63sk.js → studio-sxdb9h3q.js} +6 -6
- package/dist/chunks/studio-t51y8v1d.js +5 -0
- package/dist/chunks/{studio-pd9dsqpq.js → studio-t98vq4r6.js} +4 -4
- package/dist/chunks/studio-th7z3fg7.js +5 -0
- package/dist/chunks/studio-tsxpqvh0.js +6 -0
- package/dist/chunks/{studio-7823f0g8.js → studio-v1yascv2.js} +4 -4
- package/dist/chunks/{studio-tpy3rdxn.js → studio-wc6za3zs.js} +4 -4
- package/dist/chunks/{studio-5m0w815d.js → studio-wxq6v5sv.js} +4 -4
- package/dist/chunks/{studio-ahf3cspq.js → studio-y60sts62.js} +3 -3
- package/dist/chunks/studio-ybnwymxw.js +5 -0
- package/dist/chunks/studio-zndrqawb.js +5 -0
- package/dist/chunks/studio-zwaxn5s2.js +5 -0
- package/dist/chunks/{tsMode-6vwhy6ty.js → tsMode-f54j66ym.js} +5 -5
- package/dist/chunks/workspace-home-x1787wpv.js +4 -0
- package/dist/chunks/workspace-zpe1np43.js +4 -0
- package/dist/chunks/{ws-client-zcxkfgmf.js → ws-client-e8kj684q.js} +3 -3
- package/dist/manifest.json +76 -75
- package/dist/studio.js +81 -82
- package/package.json +4 -4
- package/src/browse/library-model.ts +56 -23
- package/src/commands/context.ts +1 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/panels/data-grid.ts +0 -4
- package/src/panels/settings-menu.ts +3 -3
- package/src/panels/settings-pane.ts +42 -56
- package/src/services/ai-import-tools.ts +6 -3
- package/src/services/ai-models.ts +65 -11
- package/src/services/ai-settings.ts +45 -5
- package/src/services/document-assistant.ts +5 -2
- package/src/services/settings/definitions.ts +19 -0
- package/src/settings/contributed-section.ts +16 -7
- package/src/settings/css-vars-editor.ts +4 -4
- package/src/settings/general-settings.ts +1 -4
- package/src/settings/preferences-accounts.ts +2 -2
- package/src/settings/preferences-dialog.ts +4 -2
- package/src/settings/project-sections.ts +1 -1
- package/src/settings/section-registry.ts +5 -4
- package/src/settings/settings-document.ts +33 -24
- package/src/settings/settings-workspace.ts +205 -0
- package/src/shell.ts +31 -6
- package/src/surfaces/ai-credentials-form.json +59 -5
- package/src/surfaces/ai-credentials-form.ts +15 -2
- package/src/surfaces/commandbar.ts +7 -3
- package/src/surfaces/settings-contributed.json +4 -4
- package/src/surfaces/settings-contributed.ts +2 -2
- package/src/surfaces/settings-pane.json +262 -180
- package/src/surfaces/settings-pane.ts +63 -14
- package/src/ui/ai-credentials-form.ts +128 -11
- package/src/ui/regions.ts +5 -5
- package/src/workspace/tab-workspace.ts +3 -2
- package/src/workspace/workspace-home.ts +18 -4
- package/src/workspace/workspace-ids.ts +40 -7
- package/dist/chunks/adapter-xcpsmecx.js +0 -4
- package/dist/chunks/add-new-flow-ptmhmzr9.js +0 -4
- package/dist/chunks/cf-account-picker-z1sgwpwd.js +0 -4
- package/dist/chunks/cf-settings-xqvhxxe9.js +0 -4
- package/dist/chunks/components-whsc81a7.js +0 -4
- package/dist/chunks/content-source-jwtxg78w.js +0 -4
- package/dist/chunks/editor-zdqdpq1x.js +0 -4
- package/dist/chunks/entry-commands-w8p2fbpt.js +0 -4
- package/dist/chunks/extension-sections-y2p1te2r.js +0 -4
- package/dist/chunks/file-ops-13ab4swj.js +0 -4
- package/dist/chunks/files-zbc8p6v1.js +0 -4
- package/dist/chunks/format-host-zjsbktbx.js +0 -4
- package/dist/chunks/fs-events-t6x0hch6.js +0 -4
- package/dist/chunks/grid-open-fyzdwpkh.js +0 -4
- package/dist/chunks/iframe-host-kbyqc7pt.js +0 -4
- package/dist/chunks/index-6nvj89vb.js +0 -4
- package/dist/chunks/jx-validate-5sp8a4rm.js +0 -4
- package/dist/chunks/layers-panel-qrxj9vr2.js +0 -4
- package/dist/chunks/layers-tpzayggx.js +0 -4
- package/dist/chunks/lit-html-x6nrxsx3.js +0 -4
- package/dist/chunks/media-library-ywppnjrz.js +0 -4
- package/dist/chunks/media-picker-etxgc8qq.js +0 -4
- package/dist/chunks/monaco-buffer-qrnqhk0b.js +0 -4
- package/dist/chunks/notify-kcv38wwe.js +0 -4
- package/dist/chunks/parse-df2kkmhc.js +0 -4
- package/dist/chunks/platform-dtsysmyd.js +0 -4
- package/dist/chunks/publish-panel-evb1rcxt.js +0 -4
- package/dist/chunks/publish-workspace-ktk9h536.js +0 -4
- package/dist/chunks/quick-search-2f47fxcw.js +0 -4
- package/dist/chunks/references-5w6ajjv7.js +0 -4
- package/dist/chunks/right-panel-kz0a6byf.js +0 -4
- package/dist/chunks/source-control-1phx90zk.js +0 -4
- package/dist/chunks/studio-0hr000ba.js +0 -5
- package/dist/chunks/studio-1wyp7dt5.js +0 -5
- package/dist/chunks/studio-20ap8dds.js +0 -5
- package/dist/chunks/studio-291gqh98.js +0 -5
- package/dist/chunks/studio-4zqfw5ha.js +0 -5
- package/dist/chunks/studio-56egy6vf.js +0 -5
- package/dist/chunks/studio-695k95bw.js +0 -5
- package/dist/chunks/studio-732mw0g8.js +0 -5
- package/dist/chunks/studio-76t560kn.js +0 -6
- package/dist/chunks/studio-8486jn4r.js +0 -5
- package/dist/chunks/studio-8x8616xd.js +0 -5
- package/dist/chunks/studio-bkmv1h3e.js +0 -9
- package/dist/chunks/studio-cqf1k4qk.js +0 -5
- package/dist/chunks/studio-dbgv4fv9.js +0 -16
- package/dist/chunks/studio-et6t8g4m.js +0 -4
- package/dist/chunks/studio-f2j9et3h.js +0 -14
- package/dist/chunks/studio-fep7hr66.js +0 -7
- package/dist/chunks/studio-fyf7j57j.js +0 -5
- package/dist/chunks/studio-g5prntab.js +0 -5
- package/dist/chunks/studio-ga77mf07.js +0 -5
- package/dist/chunks/studio-h7gy12h2.js +0 -5
- package/dist/chunks/studio-j933k8nr.js +0 -5
- package/dist/chunks/studio-jgbvqcgh.js +0 -5
- package/dist/chunks/studio-k4xc5g6h.js +0 -5
- package/dist/chunks/studio-p0nf2e1f.js +0 -6
- package/dist/chunks/studio-pzfa2vmb.js +0 -5
- package/dist/chunks/studio-rf8d6p9f.js +0 -7
- package/dist/chunks/studio-rt498t2v.js +0 -5
- package/dist/chunks/studio-sd07xva5.js +0 -6
- package/dist/chunks/studio-thj81e98.js +0 -7
- package/dist/chunks/studio-tyw7tk0x.js +0 -5
- package/dist/chunks/studio-vffwe9k7.js +0 -5
- package/dist/chunks/studio-vxjap704.js +0 -5
- package/dist/chunks/studio-w67vfgy5.js +0 -5
- package/dist/chunks/studio-xebavr9s.js +0 -5
- package/dist/chunks/studio-yg5n49za.js +0 -5
- package/dist/chunks/studio-yhz5b313.js +0 -5
- package/dist/chunks/studio-zsjpsw08.js +0 -5
- package/dist/chunks/studio-zxm98z2m.js +0 -7
- package/dist/chunks/workspace-d65bz1qk.js +0 -4
- package/dist/chunks/workspace-home-vbg9b3jh.js +0 -4
- package/src/settings/settings-dialog.ts +0 -192
- package/src/surfaces/settings-dialog.json +0 -51
- package/src/surfaces/settings-dialog.ts +0 -169
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ae}from"./studio-b2qpt0xy.js";import{Q}from"./studio-nqxqf8p2.js";import{g}from"./studio-y60sts62.js";import{Wp,fh}from"./studio-k2sz13zg.js";import{cA}from"./studio-2r90cts3.js";import{Qn,L,R,nt}from"./studio-0w2dr0q8.js";import{n}from"./studio-8z66jk4z.js";var E=[{id:"general",intro:"",label:"General",note:""},{id:"integrations",intro:"Turn on what your site needs. Each one adds its own options where you use it.",label:"Integrations",note:""},{id:"advanced",intro:"Changes here affect every page. Most sites never need them.",label:"Advanced",note:"For developers"}],BR="integrations";function zR(e){return E.some((t)=>t.id===e)}var U="overview",f=new Map,T=new Set;function k(){for(let e of T)e()}function Sd(){k()}function E_(e){return T.add(e),()=>{T.delete(e)}}function Fl(e){f.set(e.key,e),k()}function WR(e){if(f.delete(e))k()}function q(){return[...f.values()].toSorted((e,t)=>e.order-t.order)}function zy(){let e=q();return E.flatMap((t)=>{let a=e.filter((r)=>(r.group??"integrations")===t.id);return a.length===0?[]:[{id:t.id,intro:t.intro,label:t.label,note:t.note,sections:a}]})}function Wk(){return zy().flatMap((e)=>e.sections.map((t)=>t.key))}function w(e){return f.get(e)}var b=null,h=U;function I(){if(b!==null&&f.has(b))return h=b,b=null,h;if(f.has(h))return h;return Wk()[0]??h}function T_(e){if(f.has(e))h=e,b=null;else b=e;k()}var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsPane",$description:"Project Settings' home (§17.1, §22.9): the Settings workspace's surface, filling a pane's stage. A head names the workspace and carries the Back control, which says where it goes; under it, the settings editor's two columns, the grouped section list and the section body. It draws no section: `panels/settings-pane.ts` keeps the registry, decides which section is current, and renders whichever one that is into the one empty `[part=\"section-host\"]` island this document leaves for it (studio-ui-guidelines.md §9.4), because a section renderer may be a lit template or a mounted document and neither can share a container with this one. The list is three vertical `tablist`s, one per group (General, Integrations, Advanced), each named by its group heading: a tablist may own only tabs, so a heading between two runs of rows has to END one list rather than sit inside it. Each group is one tab stop and the arrow keys move within it. Under the groups, a Moved footnote names what left Project Settings for a workspace, each with a button that goes there.",tagName:"div",attributes:{part:"settings","data-jx-region":"${state.region}",role:"region","aria-labelledby":"settings-pane-heading"},style:{$description:"Fills the pane's stage by its own geometry, as the Publish and Media homes do: the stage is `position: relative`, so the home takes the whole of it, and each column scrolls itself. No part below is named `body`, `field`, `label`, `error`, `text` or `actions`: sections mount kit controls and documents of their own inside this one, the kit is light DOM, and a rule keyed on one of their part names here would reach into them.",position:"absolute",inset:"0",display:"flex",flexDirection:"column",boxSizing:"border-box",minHeight:"0",background:"var(--bg)",color:"var(--fg)",fontFamily:"var(--jx-font-sans)",textAlign:"initial",'& [part="head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-5)",borderBottom:"1px solid var(--border)"},'& [part="heading"]':{flex:"1",margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="columns"]':{display:"flex",flex:"1",minHeight:"0"},'& [part="nav"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-4)",width:"220px",minWidth:"220px",flexShrink:"0",padding:"var(--jx-space-3) var(--jx-space-3) var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",overflowY:"auto",fontSize:"13px"},'& [part="group"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="group-title"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",margin:"0",padding:"0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"600",letterSpacing:"0.04em",textTransform:"uppercase"},'& [part="group-note"]':{$description:`The Advanced group's "For developers": a qualifier on the heading, not a second heading, so it reads at the heading's size without its weight.`,fontWeight:"400",letterSpacing:"0",textTransform:"none"},'& [part="group-note"]:empty':{display:"none"},'& [part="group-tabs"]':{$description:"The rule a vertical strip draws on its trailing edge is the column's own here: the nav draws one border for all three groups, so each strip drawing its own would stack three short rules beside it.",borderInlineEnd:"0"},'& [part="nav-item"]':{$description:"Full-bleed rows, which a tab is not by default: `jx-tab` centres its label and caps itself at 220px because a horizontal strip is a row of chips. In the nav column the row IS the target, so the label goes to the leading edge and the cap comes off.",maxWidth:"none",justifyContent:"flex-start",padding:"var(--jx-space-2) var(--jx-space-3)"},'& [part="moved"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",marginTop:"auto",padding:"var(--jx-space-3)",borderTop:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)"},'& [part="moved-title"]':{margin:"0",fontWeight:"600",color:"var(--fg)"},'& [part="moved-row"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-1)"},'& [part="content"]':{flex:"1",minWidth:"0",overflowY:"auto",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-6)"},'& [part="group-intro"]':{margin:"0 0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"13px",maxWidth:"1200px"},'& [part="group-intro"]:empty':{display:"none"},'& [part="section-host"]':{$description:"Wide enough for a map-layout section's list and editor side by side, and no wider: on a large monitor a form stretched to the stage's full width is a line too long to read.",display:"block",minWidth:"0",maxWidth:"1200px"},'& [part="empty"]':{$description:"What the body says when the active section is registered by nobody: every section unregistering at once, which is a project closing while Settings is on screen. A blank column beside a list reads as a broken surface, so it says which it is.",display:"flex",alignItems:"center",justifyContent:"center",minHeight:"120px",margin:"0",color:"var(--fg-dim)",fontSize:"13px"},'& [part="failure"]':{$description:"A section whose renderer threw or rejected. It is said where the section would have been, in the reader's line of sight, because a section that silently draws nothing is indistinguishable from one with nothing to say.",margin:"0",padding:"var(--jx-space-3)",border:"1px solid var(--danger)",borderRadius:"var(--radius)",color:"var(--fg)",fontSize:"13px"}},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"jx-action-button",attributes:{part:"back"},$props:{size:"sm",quiet:!0,icon:"arrow-left"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/back"},value:[]}]},children:[{tagName:"span",textContent:"${state.backLabel}"}],$description:"Back to the workspace Settings was opened from, named, as the pane context bar's Back is in a workspace with no tab strip (§22.1): the top bar draws no tab for Settings, so nothing else on screen says where the author came from."},{tagName:"h2",attributes:{part:"heading",id:"settings-pane-heading"},textContent:"${state.heading}"}]},{tagName:"div",attributes:{part:"columns",role:"none"},children:[{tagName:"div",attributes:{part:"nav",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"group",role:"none","data-group":"${$map.item.id}"},children:[{tagName:"h3",attributes:{part:"group-title",id:"${$map.item.titleId}"},children:[{tagName:"span",textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"group-note"},textContent:"${$map.item.note}"}]},{tagName:"jx-tabs",attributes:{part:"group-tabs",selected:"${state.active}",orientation:"vertical"},$props:{label:{$ref:"$map/item/tabsLabel"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectSection"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/sections"},key:{$ref:"$map/item/key"},map:{tagName:"jx-tab",attributes:{part:"nav-item",id:"${$map.item.tabId}","data-section":"${$map.item.key}",value:"${$map.item.key}",label:"${$map.item.label}",panel:"settings-pane-panel"}}}]}]}},{tagName:"div",attributes:{part:"moved",role:"group","aria-labelledby":"settings-pane-moved"},children:[{tagName:"p",attributes:{part:"moved-title",id:"settings-pane-moved"},textContent:"Moved"},{$prototype:"Array",items:{$ref:"#/state/moved"},key:{$ref:"$map/item/workspace"},map:{tagName:"div",attributes:{part:"moved-row","data-moved":"${$map.item.workspace}"},children:[{tagName:"span",textContent:"${$map.item.what} →"},{tagName:"jx-button",attributes:{part:"moved-link"},$props:{size:"sm",quiet:!0,label:{$ref:"$map/item/linkLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMoved"},value:[{$ref:"$map/item/workspace"}]}]},children:[{tagName:"span",textContent:"${$map.item.place}"}]}]}}]}]},{tagName:"jx-tab-panel",attributes:{part:"content",id:"settings-pane-panel"},$props:{active:!0,labelledby:{$ref:"#/state/activeTabId"}},children:[{$description:`The current group's intro ("Changes here affect every page. Most sites never need them."), above whichever of its sections is showing. General has none, and an empty sentence draws nothing.`,tagName:"p",attributes:{part:"group-intro"},textContent:"${state.intro}"},{$description:"The island, and it stays empty: a settings section renders itself, into a host this document never writes into and never reads back (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"section-host"}},{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/hasSection"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"${state.empty}"}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},$switch:{$ref:"#/state/failureState"},cases:{failed:{tagName:"p",attributes:{part:"failure",role:"alert"},textContent:"${state.failure}"}}}]}]}]};L("settings-pane",C);function J(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function A(e){return e===""?"ok":"failed"}function H(e,t,a){let r=g({...t,...a,failureState:A(t.failure)});e.textContent="",delete e._$litPart$;let o=null,s=!1,p=null,S=R("settings-pane",r,e,{onNodeCreated:(i,d,m)=>{if(!s&&i instanceof HTMLElement&&J(m)==="section-host")p=i}}).then((i)=>{if(s){i.dispose();return}o=i});return{attached:()=>{if(s)return!1;let i=o?.root;return i===void 0?!0:i instanceof HTMLElement&&e.contains(i)},body:()=>p,dispose(){s=!0,o?.dispose(),o=null,p=null},async focusActive(){let i=o?.root,d=i instanceof HTMLElement?[...i.querySelectorAll('[part="nav-item"]')].find((y)=>y.dataset.section===r.active):void 0;if(!d)return;let m=d.closest("jx-tabs");if(m&&d.getAttribute("aria-selected")!=="true")await new Promise((y)=>{m.addEventListener("jx-ready",()=>{y()},{once:!0})});if(!s)d.focus()},ready:S,update(i){r.region=i.region,r.heading=i.heading,r.backLabel=i.backLabel,r.groups=i.groups,r.moved=i.moved,r.activeTabId=i.activeTabId,r.empty=i.empty,r.intro=i.intro,r.hasSection=i.hasSection,r.failure=i.failure,r.failureState=A(i.failure),r.active=i.active}}}var K=fh("settings").title,Y="No settings sections.",G=[{place:"Styles › Variables",view:"variables",what:"Colors and fonts",workspace:"styles"},{place:"Publish › Hosting",publishTab:"hosting",what:"Hosting and domain",workspace:"publish"},{inspector:"page",place:"Page tab",what:"Head and SEO defaults",workspace:"design"}];function W(e){return`settings-nav-${e}`}function X(e){return G.find((t)=>t.workspace===e)??null}function P(e,t){let a=I(),r=zy();return{active:a,backLabel:e.backLabel(),activeTabId:W(a),empty:Y,failure:t,groups:r.map((o)=>({id:o.id,label:o.label,note:o.note,sections:o.sections.map((s)=>({key:s.key,label:s.label,tabId:W(s.key)})),tabsLabel:o.note===""?o.label:`${o.label}, ${o.note.toLowerCase()}`,titleId:`settings-group-${o.id}`})),hasSection:w(a)!==void 0,heading:K,intro:w(a)?.intro||(r.find((o)=>o.sections.some((s)=>s.key===a))?.intro??""),moved:G.map((o)=>{let{title:s}=fh(o.workspace),p=o.place??s;return{linkLabel:`${o.what}: ${p}. Go to ${s}`,place:p,what:o.what,workspace:o.workspace}}),region:e.region}}function O(e,t){let a=!1,r=null,o=null,s=null,p="",S=0,i=H(e,P(t,p),{back:()=>{t.back()},openMoved:(l)=>{let c=X(l);if(c!==null)t.openMoved(c.workspace,c.inspector,c.view,c.publishTab)},selectSection:(l)=>{T_(l)}});function d(l,c,u){if(a||u!==S)return;p=`Could not show ${w(l)?.label??l}: ${c}`,i.update(P(t,p))}function m(l){if(a)return;let c=I(),u=i.body();if(u!==r)r=u,s=null;if(!u||!l&&s===c){i.update(P(t,p));return}let M=s!==c;s=c,p="",i.update(P(t,p));let j=w(c);if(!j){o=null,u.replaceChildren();return}if(M||!o||o.parentElement!==u)o=document.createElement("div"),u.replaceChildren(o);S+=1;let N=S;try{let x=j.render(o);if(x instanceof Promise)x.catch((z)=>{d(c,Q(z),N)})}catch(x){d(c,Q(x),N)}}let y=E_(()=>{m(!0)}),F=i.ready.then(()=>{m(!0)});return{attached:()=>i.attached(),dispose(){if(a)return;a=!0,y(),i.dispose()},focusActive:()=>i.focusActive(),ready:F}}var Z="settings";function Vk(e){return Qn(e,Z)}var v=new Map,D=new Set;function _(){let e=cA();return e===null||e==="settings"?Wp:e}async function ee(){await nt("view.setWorkspace",{workspace:_()},"Settings")}async function te(e,t,a,r){if(a!==void 0){await nt("styles.open",{view:a},"Settings");return}if(r!==void 0){await nt("publish.open",{tab:r},"Settings");return}if(await nt("view.setWorkspace",{workspace:e},"Settings"),t===void 0)return;if(await nt("view.setRightPanel",{open:!0},"Settings"),ae()?.isEnabled("view.setRightTab")===!0)await nt("view.setRightTab",{tab:t},"Settings")}function Uk(e,t){let a=v.get(e);return a!==void 0&&a.tabId===t.id&&a.wrap.isConnected&&a.pane.attached()}function qk(e){let t=v.get(e);if(!t)return;v.delete(e),t.pane.dispose()}async function V(e,t){if(await t.pane.ready,v.get(e)===t)await t.pane.focusActive()}async function VR(e){let t=v.get(e);if(t?.wrap.isConnected===!0&&t.pane.attached()){await V(e,t);return}D.add(e)}var ne={back:()=>{ee()},backLabel:()=>`Back to ${fh(_()).title}`,openMoved:(e,t,a,r)=>{te(e,t,a,r)}};function UR(e,t){let{paneId:a,wrap:r}=e;if(Uk(a,t))return;qk(a);let s={pane:O(r,{...ne,region:Vk(a)}),tabId:t.id,wrap:r};if(v.set(a,s),D.delete(a))V(a,s)}
|
|
2
|
+
export{BR,zR,Sd,E_,Fl,WR,zy,Wk,T_,Vk,Uk,qk,VR,UR};
|
|
3
|
+
|
|
4
|
+
//# debugId=21F25BCFA0743F7364756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-nm4szey4.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{n,v}from"./studio-
|
|
2
|
-
export{Ws,
|
|
1
|
+
import{n,v}from"./studio-8z66jk4z.js";var S=500;class h extends Error{constructor(){super();this.name="MaxOpsExceededError"}}function Ws(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,r)=>Ws(i,t[r]));if(v(e)&&v(t)){let i=Object.keys(e),r=Object.keys(t);return i.length===r.length&&i.every((a)=>(a in t)&&Ws(e[a],t[a]))}return!1}function A(e){let t=5381;for(let i=0;i<e.length;i++)t=Math.imul(t,33)+(e.codePointAt(i)??0);return t.toString(36)}function m(e){return n(e)?`s:${e}`:`n:${A(JSON.stringify(e))}`}function g(e){if(n(e))return"s";let{attributes:t,$props:i}=e,r=(v(t)?t.id:void 0)??(v(i)?i.key:void 0)??"";return`w:${String(e.tagName??"")}:${String(r)}`}function y(e,t,i=Number.POSITIVE_INFINITY){let r=e.length,a=t.length;if(r===0||a===0||r*a>i)return[];let l=Array.from({length:r+1},()=>Array.from({length:a+1},()=>0));for(let s=r-1;s>=0;s--)for(let c=a-1;c>=0;c--)l[s][c]=e[s]===t[c]?l[s+1][c+1]+1:Math.max(l[s+1][c],l[s][c+1]);let f=[],o=0,u=0;while(o<r&&u<a)if(e[o]===t[u])f.push([o,u]),o+=1,u+=1;else if(l[o+1][u]>=l[o][u+1])o+=1;else u+=1;return f}function aT(e,t,i={}){let r=i.maxCells??Number.POSITIVE_INFINITY,a=y(e.map((s)=>m(s)),t.map((s)=>m(s)),r),l=[],f=-1,o=-1,u=[];for(let[s,c]of a)u.push([f+1,s,o+1,c]),l.push({aIndex:s,bIndex:c,identical:!0}),f=s,o=c;u.push([f+1,e.length,o+1,t.length]);for(let[s,c,x,I]of u){let J=e.slice(s,c),O=t.slice(x,I);for(let[M,N]of y(J.map((p)=>g(p)),O.map((p)=>g(p)),r))l.push({aIndex:s+M,bIndex:x+N,identical:!1})}return l.toSorted((s,c)=>s.aIndex-c.aIndex)}function d(e,t){if(e.ops.length>=e.maxOps)throw new h;e.ops.push(t)}function b(e,t,i,r){for(let f of new Set([...Object.keys(i),...Object.keys(r)])){if(f==="children")continue;if(!(f in r))d(e,{key:f,op:"set-key",path:t});else if(!Ws(i[f],r[f]))d(e,{key:f,op:"set-key",path:t,value:r[f]})}let a=i.children,l=r.children;if(Array.isArray(a)&&Array.isArray(l))D(e,t,a,l);else if(!Ws(a,l))d(e,{key:"children",op:"set-key",path:t,value:l})}function D(e,t,i,r){let a=aT(i,r),l=new Set(a.map((o)=>o.aIndex)),f=new Map(a.map((o)=>[o.bIndex,o]));for(let o=i.length-1;o>=0;o--)if(!l.has(o))d(e,{index:o,op:"remove-child",parentPath:t});for(let[o,u]of r.entries()){let s=f.get(o);if(!s){d(e,{index:o,node:u,op:"insert-child",parentPath:t});continue}if(s.identical)continue;let c=i[s.aIndex];if(v(c)&&v(u))b(e,[...t,"children",o],c,u);else if(!Ws(c,u))d(e,{index:o,node:u,op:"set-child",parentPath:t})}}function dP(e,t,i={}){let r={maxOps:i.maxOps??S,ops:[]};try{b(r,[],e,t)}catch(a){if(a instanceof h)return null;throw a}return r.ops}
|
|
2
|
+
export{Ws,aT,dP};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=14C6DAB00943B37164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-pjtntksy.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{Q}from"./studio-nqxqf8p2.js";import{dw,ju}from"./studio-rzqaz21g.js";import{L,R}from"./studio-0w2dr0q8.js";import{g}from"./studio-y60sts62.js";import{Zc,Nx}from"./studio-k2sz13zg.js";import{Wl,ym}from"./studio-egmw2837.js";import{n,v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var z_=["string","number","boolean","array","object","reference"],W_=["","image","date","color"],Ld={format:"",name:"",required:!1,type:"string"};function sb(e){if(e.$ref)return"reference";return e.type||"string"}function $d(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 D={$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"}]}]}}}]};L("schema-builder",D);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function B(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 E={$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"}]}}}]};L("reference-field",E);function Y(){return{canRetry:!1,disabled:!0,hasNote:!1,kind:"picker",label:"",note:"",noteTone:"dim",options:[],value:""}}function M(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."}}]};L("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 Z=z_.map((e)=>({label:e,value:e})),ee=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 T(e){return`name:${e}`}function k(e){return`required:${e}`}function C(e,s){return`${e} ${s}`}function q(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=C(s,t),p=sb(o);return{format:$d(o),hasFormat:S(p),key:t,name:q(e,T(l),t),parent:s,required:q(e,k(l),r),type:p}}function ie(e,s,t,o,r){let l=sb(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:$d(t),hasFormat:S(l),key:s,label:Zc(s),name:q(e,T(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:q(e,k(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 A(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:{...Ld},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:ee,targets:c,typeOptions:Z}},u=()=>H.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],j=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},H=B(e,{addNested(a){let i=j(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={...Ld},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={...Ld},h((f)=>{if(f.properties[a]=ya(m,i||void 0),c)A(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){j(a).name=i,u()},editDraftType(a,i){j(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Ld},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(T(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(T(C(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(k(C(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return A(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)?$d(b):void 0;return f.properties[i]=ya(c,N||void 0),!0})},setRequired(a,i){d(k(a),i),h((c)=>{if(!c.properties[a])return!1;return A(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)?$d(m):void 0;return c.properties[a]=ya(i,f||void 0),!0})}});return u(),{dispose:()=>H.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=()=>{Wl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>ym(e),update(r){t=r,o()}}}var ue={mount:me};dw("media",ue);var F=new Map,O=new Map,x=new Map;function dm(e){if(e===void 0)F.clear(),O.clear(),x.clear();else F.delete(e),O.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(le("g0j41yy6"),import("./content-source-g0j41yy6.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function xE(e,s){let t=O.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),O.set(e,p);for(let d of u??[])d()};return o.then((p)=>l({ids:p}),(p)=>l({error:Q(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=ju(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=xE(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=M(e,{choose(p){t.onChange(p===""?void 0:p)},edit(p){t.onChange(p.trim()||void 0)},retry(){let p=ju(t.schema);if(p!==null)dm(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_,Ld,sb,$d,ya,dm,xE};
|
|
3
|
+
|
|
4
|
+
//# debugId=D001B4983A2AA7A664756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qh8berdz.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{de,C}from"./studio-y60sts62.js";import{ee,_}from"./studio-8z66jk4z.js";var st={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function XO(){return m+=1,m}var l=new Map;function bo(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function xh(e){return e.wrap}function Jp(){return[...l.values()]}function Qc(e){if(!e)return null;for(let r of l.values())if(xh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function QO(e,r){let t=bo(e);return t.wrap=r,g(t),t}function eM(e){if(l.get(e))Z$(e);let t=v(e);return l.set(e,t),t}var S=null;function tM(e){S=e}function Z$(e){let r=l.get(e);if(!r)return;S?.(r),g(r),y(e)}function y(e){l.delete(e)}var Yp="commit";function b(e){return _(e)&&ee(e.then)}function gv(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!b(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var T={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=T[r],n=t?{detail:h(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return C.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function h(e){return e instanceof Error?e.stack??e.message:String(e)}function bv(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(Yp)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),b(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function X$(e){e?._writes?.cancel()}function Yd(e){return Boolean(e?.getModel())}function Zp(e,r){if(!Yd(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function w(e){let r=de(e);return[...Jp().map((o)=>o.monacoEditor),st.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&de(o._editingTab)===r&&Yd(o))}async function Zd(e){for(let r of w(e)){if(!Yd(r))continue;try{await r._writes?.flush(Yp)}catch(t){let o={detail:h(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;C.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function Xp(e){return w(e).some((r)=>r._writes?.typed()===!0)}
|
|
2
|
+
export{st,XO,bo,xh,Jp,Qc,QO,eM,tM,Z$,Yp,gv,bv,X$,Yd,Zp,Zd,Xp};
|
|
3
|
+
|
|
4
|
+
//# debugId=623348306DB8011D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qn7z4krm.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p,_e}from"./studio-jws1a87n.js";import{Q}from"./studio-nqxqf8p2.js";import{$a,R$}from"./studio-mx6wzh25.js";import{ge,ea,ne,g,de,C,pl,of}from"./studio-y60sts62.js";import{fO,hv,j$,Da,Y,fv,Wm,Cr,Px,Fx,m,h,_i}from"./studio-k2sz13zg.js";import{Ft,Qd,Wi,sf,fn,lr,lI,Pa,cI}from"./studio-hz5n7x27.js";import{Pd}from"./studio-f746039f.js";import{T$,iO,oO,uh,ev}from"./studio-b2qpt0xy.js";import{qo}from"./studio-0w2dr0q8.js";import{SN,mL}from"./studio-rtfnhrdg.js";import{Bd}from"./studio-399a25za.js";import{Es,Co}from"./studio-2r90cts3.js";import{il,qu}from"./studio-0q5jwddh.js";import{sN}from"./studio-78pywnp2.js";import{oe}from"./studio-wc6za3zs.js";import{n,Z,Ze,_,v}from"./studio-8z66jk4z.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function xS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:ev,popoverTags:uh},D="Popover",ke={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){pl((d)=>d.source===D);let s=new Map,l=iO(e,se);for(let d of l){let c=d.fix===void 0?void 0:ke[d.fix],b={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:D,tier:"problem"};if(c!==void 0)b.action=c,b.actionArgs={path:d.path};if(o!==void 0)b.path=o;C(d.severity,d.message,b)}let r=SN(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:D,tier:"problem"};if(o!==void 0)c.path=o;C(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=h.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function Se(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);C.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:D})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=of(D),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=oO(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Y(l,(b)=>{for(let w of c.base)Wm(b,r,w,"");for(let w of c.breakpoints)Fx(b,r,[w],"display","");if(c.openDisplay!==null)Px(b,r,":popover-open","display",c.openDisplay)}),C.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:D})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Y(l,(d)=>{Cr(d,r,"popovertarget"),Cr(d,r,"popovertargetaction")}),C.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:D})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Y(l,(d)=>{Cr(d,r,"popover",T$)}),C.success(`Set \`popover\` to "${T$}".`,{key:"popover.repaired.mode",source:D})},title:"Set popover to auto",when:(e)=>e.document.open}]}function tN(e){e.registerAll(Se())}function Ew(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(_(e)&&_(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var N="grid://",Sb={children:[],tagName:"div"};function ls(e){switch(e.kind){case"pages":return`${N}pages`;case"collection":return`${N}collection/${encodeURIComponent(e.name)}`;default:return`${N}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function xe(e){return e.startsWith(N)}function Vl(e){if(!xe(e))return null;let o=e.slice(N.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function wm(e){let o=Vl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var le=0;function ce(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let u=r.errors.get(t);if(u)u.set(i,a);else r.errors.set(t,new Map([[i,a]]))},b=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},w=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let u=r.inserts.get(t);if(u){if(a===null)delete u[i];else u[i]=a;return}if(Ew(a,e.resolveBaseline(t,i))){let f=r.pending.get(t);if(f?.delete(i),f?.size===0)r.pending.delete(t);return}let y=r.pending.get(t);if(y)y.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},P=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let u=r.pending.get(t)?.get(i);return u?u.value:e.resolveBaseline(t,i)},O=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},M=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let u of a)M(u,i);break}}},F=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},x=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},E=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let u=a.ops.map((y)=>i(y)).filter((y)=>y!==null);return u.length>0?{kind:"group",ops:u}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let u=r.pending.get(a.rowKey);if(u?.delete(a.field),u?.size===0)r.pending.delete(a.rowKey);b(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)E((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[u,y]of a)t.push({baseline:e.resolveBaseline(i,u),field:u,rowKey:i,value:y.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:O,cellState(t,i){if(O(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),w({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),w({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),E((i)=>i===t)},effectiveValue:P,beginGroup:F,endGroup:x,group(t){F();try{t()}finally{x()}},insertRow(t={}){le+=1;let i=`__new-${le}`;return r.inserts.set(i,{...t}),w({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return M(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let u=P(t,i);if(Ew(u,a))return;k(t,i,a),w({after:a,at:s(),before:u,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return M(t,"undo"),r.redoStack.push(t),!0}}}var ue={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function fe(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Pe(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Da(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function me(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Tw(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,b])=>{let w=r.has(c)?"readonly":Pe(b),k=Array.isArray(b.enum)?Math.max(...b.enum.map((P)=>String(P).length),4):0;return{editable:w!=="readonly",field:c,kind:w,pk:c===o.idField,required:l.has(c),schema:b,title:me(c),widthHint:w==="enum"?fe(k+3):ue[w]}});return d.sort((c,b)=>{let w=(P)=>P.pk?0:P.required?1:2,k=w(c)-w(b);return k===0?0:k}),d}function Lw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((w)=>{let k=w[r];return k===null||k===void 0||k===""?[]:[k]}),c=Ge(d),b=Math.max(...d.map((w)=>Qo(w).length),r.length,4);return{editable:!0,field:r,kind:c,title:me(r),widthHint:c==="string"||c==="text"?fe(b):ue[c]}})}function Ge(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Ze(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Z(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function yp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Z(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Ze(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function Qo(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(_(e))return e.$ref;return String(e)}var wS="__key",H=new WeakMap;function er(e){return e?H.get(de(e))??null:null}function wp(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=ce({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),b=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},w=(t)=>{let i=l.columns.filter((y)=>y.required&&y.editable);if(i.length===0)return null;let a=t.cells.filter((y)=>y.value===null&&i.some((f)=>f.field===y.field)).map((y)=>({error:"Required",field:y.field,ok:!1,rowKey:y.rowKey})),u=t.inserts.filter((y)=>i.some((f)=>y.cells[f.field]===null||y.cells[f.field]===void 0)).map((y)=>({error:`Missing required: ${i.filter((G)=>y.cells[G.field]===null||y.cells[G.field]===void 0).map((G)=>G.field).join(", ")}`,ok:!1,tempKey:y.tempKey}));if(a.length===0&&u.length===0)return null;return{cells:a,deletes:[],inserts:u}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,P=(t,i,a)=>{if(a==="number")return(Z(t)?t:0)-(Z(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return Qo(t).localeCompare(Qo(i))},O=()=>{let t=l.rows.map((u)=>u.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let u=l.columns.find((f)=>f.field===a)?.kind,y=i==="desc"?-1:1;t=t.toSorted((f,G)=>{let R=c.effectiveValue(f,a),U=c.effectiveValue(G,a);if(k(R)!==k(U))return k(R)?1:-1;return y*P(R,U,u)})}return l.grouping?[...M(t).values()].flat():t},M=(t)=>{let i=new Map;for(let a of t){let u=Qo(c.effectiveValue(a,l.grouping)),y=i.get(u);if(y)y.push(a);else i.set(u,[a])}return i},F=null,x=()=>F?.refreshData(),E={addRow(t={}){let i=c.insertRow(t);return x(),i},bindView(t){F=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),x()},discardRow(t){c.discardRow(t),x()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((f)=>f.editable&&(f.kind==="string"||f.kind==="text")),u=[...l.rows.map((f)=>f.key),...c.state.inserts.keys()],y=0;if(c.group(()=>{for(let f of u){if(c.rowState(f)==="pending-delete")continue;for(let G of a){let R=c.effectiveValue(f,G.field);if(n(R)&&R.includes(t))c.setCell(f,G.field,R.replaceAll(t,i)),y+=1}}}),y>0)x();return y},effectiveRows(){let t=(u)=>Array.isArray(u)?[...u]:_(u)?{$ref:u.$ref}:u,i=(u)=>{let y=[[wS,u]];for(let f of l.columns)y.push([f.field,t(c.effectiveValue(u,f.field))]);return Object.fromEntries(y)},a=O().map((u)=>i(u));for(let[u]of c.state.inserts)a.push(i(u));return a},groups(){if(!l.grouping)return[];return[...M(O())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await b()}catch(t){l.error=Q(t)}finally{l.loading=!1}x()},async refresh(){if(c.isDirty()){if(!await qo("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){C.info("No grid changes to save.",{key:"grid.save"});return}let a=w(t);if(a){c.applyCommitResult(a),C.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await qo("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let y=new Set(t.cells.map((f)=>f.rowKey)).size+t.inserts.length+t.deletes.length>5?il({title:"Saving grid"}):null;l.saving=!0;try{let f=await o.commit(t),G=(S,j)=>`${S}\x00${j}`,R=new Map(t.cells.map((S)=>[G(S.rowKey,S.field),S]));for(let S of f.cells){let j=R.get(G(S.rowKey,S.field));if(S.ok&&j){let re=r.get(S.rowKey);if(re)re.cells[S.field]=j.value}}if(c.applyCommitResult(f),f.inserts.some((S)=>S.ok)||f.deletes.some((S)=>S.ok))await b();let L=f.cells.filter((S)=>S.ok).length+f.inserts.filter((S)=>S.ok).length+f.deletes.filter((S)=>S.ok).length,ee=i-L,te=f.cells.filter((S)=>S.stale).length+f.deletes.filter((S)=>S.stale).length;if(ee===0)C.success(`Saved ${L} change(s).`,{key:"grid.save"});else C.error(`Saved ${L} · ${ee} failed${te?` (${te} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(f){C.error("Could not save the grid.",{action:"file.save",detail:Q(f),key:"grid.save",source:"Data"})}finally{l.saving=!1,y?.done(),x()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await b()}catch(i){l.error=Q(i)}finally{l.loading=!1}x()},setGrouping(t){l.grouping=t,x()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,x();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{ne(()=>{e.doc.dirty=c.isDirty()}),fv(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),x()},undo:()=>{c.undo(),x()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let u=o.backingPaths(),y=new Set;for(let f of a){if(f.isDir)continue;let G=f.path.replaceAll("\\","/"),R=u.get(G);if(R!==void 0&&!Bd(G))y.add(R)}if(y.size===0)return;if(c.isDirty()){let f=y.has("*")?l.rows.map((G)=>G.key):[...y];c.markStale(f),C.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),x()}else E.refresh()});ea(i)}ea(()=>{fv(e,null),H.delete(de(e)),o.dispose?.()})}),H.set(de(e),E),E}async function Wu(e){let s=er(e)?.serializeForSource();if(s)return s;await Ft();let l=Wi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Pa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=lr();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,b={...d,...e.doc.document};return Pa(r.name,b,{frontmatter:c,mode:"roundtrip"})}}return Co(fO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Re=200,Ee=500,Te=2097152,A=new Map,V=!1,I=null,T=null,B=null,X=null;function Oe(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function pe(){if(!_e())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Oe()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await Wu(s)}catch{continue}if(r.length>Te)continue;if(o.add(l),A.get(l)===r)continue;A.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of A.keys())if(!o.has(s))A.delete(s),await e.clearPreviewOverlay(s)}function ye(){if(!V)return;let e=Date.now();if(B??=e,T)clearTimeout(T);let o=e-B,s=Math.max(0,Math.min(Re,Ee-o));T=setTimeout(()=>{T=null,B=null,X=pe().finally(()=>{X=null})},s)}function nN(){ye()}function iN(){if(V)return;V=!0,I=ge(),I.run(()=>{ne(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;ye()})})}function oN(){if(V=!1,T)clearTimeout(T),T=null;B=null,I?.stop(),I=null,A.clear()}async function _S(){if(!V)return;if(T)clearTimeout(T),T=null,B=null;await X,await pe()}var he=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Me=new Set(["vnd","prs","x"]);function $e(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!he.test(r)||!he.test(d))return null;let c=d.lastIndexOf("+"),b=c===-1?null:d.slice(c+1),w=c===-1?d:d.slice(0,c);if(b==="")return null;let k=w.indexOf("."),P=k===-1?null:w.slice(0,k),O=P!==null&&Me.has(P)?P:null,M=O===null?w:w.slice(O.length+1);if(M==="")return null;let F={};for(let x of s){let E=x.indexOf("=");if(E===-1)return null;let t=x.slice(0,E).trim().toLowerCase(),i=x.slice(E+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);F[t]=i}return{parameters:F,subtype:M,suffix:b,tree:O,type:r}}function $w(e){let o=$e(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var we="text/markdown; variant=GFM",be="application/yaml",Tt={".markdown":`${we}; charset=utf-8`,".md":`${we}; charset=utf-8`,".yaml":`${be}; charset=utf-8`,".yml":`${be}; charset=utf-8`};async function rN(e,o){let s=await lI(e.name,o);return cI(e,s)}async function jr(e,o){await Ft();let s=fn(e);if(!s||!s.capabilities.parse)throw sf(e);return{...await rN(s,o),format:s}}var PT=async(e,o)=>{if(e.documentPath&&fn(e.documentPath)){let l=await jr(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=Es(o);return e.doc.layout=s.layout,{document:s.document}};function Fe(e){return"showOpenFilePicker"in e}function De(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function fP(){try{await Ft();let e=Qd(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[$w(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let b=c?await sN(r):null,w=fn(r);if(w){let{document:k,frontmatter:P}=await rN(w,d);_i({document:k,documentPath:b,fileHandle:c,frontmatter:P,id:r,source:d,sourceFormat:w.name})}else if(r.endsWith(".json")){let{document:k,layout:P}=Es(d);_i({document:k,documentPath:b,fileHandle:c,id:r,layout:P})}else throw sf(r)};if(Fe(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))C.error("Could not open the file.",{detail:Q(e),source:"Open File"})}}var ve=()=>{};function FT(e){ve=e}function K(e){let o=e.doc.document;ve(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?xS(o):null;if(s)C.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ne(e){return!Pd(e.documentPath??"")}async function xp(e=h.value){if(!e)return!1;if(await mL(e.id),hv(e))return C.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ne(e))return C.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1;let o=er(e);if(o)return await o.save(),!e.doc.dirty;try{if(await j$(e))return K(e),!0;let s=await Wu(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return _S(),K(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return K(e),!0}C.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))C.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:Q(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Ae(e){return Wi(e.doc.sourceFormat)??(e.doc.mode==="content"?lr():void 0)}async function jT(){let e=h.value;if(!e)return;try{await Ft();let o=Ae(e),s=await Wu(e),l=o?$w(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(De(window)){let b=e.documentPath?e.documentPath.split("/").pop():c,w=await window.showSaveFilePicker({suggestedName:b,types:[{accept:{[l]:[r]},description:d}]}),k=await w.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,K(e),C.success(`Exported as ${w.name}.`)}else{let b=new Blob([s],{type:l}),w=URL.createObjectURL(b),k=document.createElement("a");k.href=w,k.download=c,k.click(),URL.revokeObjectURL(w),e.doc.dirty=!1,K(e),C.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))C.error("Could not export the document.",{detail:Q(o),source:"Export"})}}async function Ce(e,o){let s=Pd(e)?await qu(e):await $a({path:e});return R$(s,o)??""}async function Cb(e){let o=await Ce(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await qo("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function kb(e,o="rename"){let s=await Ce(e,o);return s===""?void 0:s}
|
|
2
|
+
export{Ew,Sb,ls,Vl,wm,Tw,Lw,yp,Qo,wS,er,wp,xS,tN,Wu,nN,iN,oN,_S,$w,rN,jr,PT,fP,FT,xp,jT,Cb,kb};
|
|
3
|
+
|
|
4
|
+
//# debugId=9B19B5AB6CBDF39564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-qyed0ah6.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{k$}from"./studio-b2qpt0xy.js";import{L,R,Xs,Jb}from"./studio-0w2dr0q8.js";import{g}from"./studio-y60sts62.js";import{He}from"./studio-8wnvtr4z.js";var x={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMenu",$description:"A Studio menu: one jx-menu whose rows are a projection of command records the adapter hands in as `rows`. Nothing here decides what a row says; a row prints its record's title, chord, disabled reason and destructive flag, a divider falls where the adapter marked a group boundary, and a row with children owns a one-level submenu of the same shape. The chord and the reason are rendered only when present, so a row's text is its title.",tagName:"jx-menu",$props:{label:{$ref:"#/state/label"},x:{$ref:"#/state/x"},y:{$ref:"#/state/y"},floor:{$ref:"#/state/floor"},placement:{$ref:"#/state/placement"}},onselect:{$ref:"#/state/select"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"hr"}}},{tagName:"jx-menu-item",$props:{value:{$ref:"$map/item/id"},disabled:{$ref:"$map/item/disabled"},destructive:{$ref:"$map/item/destructive"},requires:{$ref:"$map/item/requires"},checked:{$ref:"$map/item/checked"},haspopup:{$ref:"$map/item/haspopup"}},attributes:{"data-command-id":"${$map.item.id}"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{slot:"value"},$switch:{$ref:"$map/item/noChord"},cases:{false:{tagName:"kbd",textContent:"${$map.item.chord}"}}},{tagName:"span",attributes:{slot:"description"},$switch:{$ref:"$map/item/enabled"},cases:{false:{tagName:"span",textContent:"Needs ${$map.item.requires}"}}},{tagName:"span",attributes:{slot:"submenu"},$switch:{$ref:"$map/item/haspopup"},cases:{true:{tagName:"jx-menu",$props:{label:{$ref:"$map/item/submenuLabel"}},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{role:"none"},children:[{tagName:"div",attributes:{role:"none"},$switch:{$ref:"$map/item/dividerAbove"},cases:{true:{tagName:"hr"}}},{tagName:"jx-menu-item",$props:{value:{$ref:"$map/item/id"},disabled:{$ref:"$map/item/disabled"},destructive:{$ref:"$map/item/destructive"},requires:{$ref:"$map/item/requires"},checked:{$ref:"$map/item/checked"}},attributes:{"data-command-id":"${$map.item.id}"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{slot:"value"},$switch:{$ref:"$map/item/noChord"},cases:{false:{tagName:"kbd",textContent:"${$map.item.chord}"}}},{tagName:"span",attributes:{slot:"description"},$switch:{$ref:"$map/item/enabled"},cases:{false:{tagName:"span",textContent:"Needs ${$map.item.requires}"}}}]}]}}]}}}]}]}}]};L("menu",x);var j="block-end span-inline-end";function P(e){if(e.placement!==void 0)return e.placement;return e.opener&&!e.origin&&!e.place&&!e.floor?j:""}function N(e){if(!e)return{x:0,y:0};let n=He(e);return{x:Math.round(n.left),y:Math.round(n.bottom)}}function b(e,n=0){let r=n===0?(e.children??[]).map((t)=>b(t,1)):[];return{...e,checked:e.checked??"",children:r,chord:e.chord??"",enabled:!e.disabled,haspopup:r.length>0,noChord:!e.chord,noDivider:!e.dividerAbove,requires:e.requires??"",submenuLabel:e.submenuLabel??e.title}}function S(e,n){for(let r of e){if(r.id===n)return r;let t=r.children.find((a)=>a.id===n);if(t)return t}return}function Bt(e){let n=Xs("popover",e.region),r=new AbortController,t=null,a=null,s=!1,h=()=>{if(s)return;s=!0,r.abort(),a?.(),a=null,Jb("popover",e.region),q(e.opener??null),e.onClosed?.(f)},v=e.place?e.place(new DOMRect):e.origin??N(e.opener),c=g({floor:e.floor?.()??0,label:e.label,placement:P(e),rows:e.rows.map((o)=>b(o)),select:(o,u)=>{let i=String(u.detail),d=S(c.rows,i);if(!d)return;if(k(t,e.opener??null),d.run)d.run();else e.run?.(i);f.close()},x:v.x,y:v.y}),w=()=>{if(s||!t||!e.place)return;let o=e.place(He(t));c.x=o.x,c.y=o.y},p=()=>r.signal.aborted,E=(async()=>{let o=await R("menu",c,n,{signal:r.signal});if(p())return;if({dispose:a}=o,t=o.root,t.addEventListener("toggle",(i)=>{if(i.newState==="closed")h()}),!t.hasAttribute("popover"))await new Promise((i)=>{t.addEventListener("jx-ready",()=>i(),{once:!0})});if(p())return;if(await C(r.signal),p())return;let u=e.opener instanceof HTMLElement&&e.opener!==document.body?e.opener:void 0;t.showPopover(u?{source:u}:void 0),w(),requestAnimationFrame(w)})(),f={close:()=>{if(s)return;if(t?.open)t.hidePopover();h()},host:n,ready:E,setRows:(o)=>{if(s)return;let i=document.activeElement?.closest("jx-menu"),d=i&&i!==t?i.parentElement?.closest("jx-menu-item")?.dataset.commandId:void 0;c.rows=o.map((m)=>b(m)),setTimeout(()=>{if(s||!t||t.contains(document.activeElement))return;let m=d?t.querySelector(`jx-menu-item[data-command-id="${d}"]`):null,y=m?.querySelector("jx-menu")??null;if(m&&!(y?.open&&y.querySelector("jx-menu-item")))m.focus();else k$(t)},0)}};return f}var l=new Set;if(typeof window<"u")window.addEventListener("pointerdown",(e)=>l.add(e.pointerId),!0),window.addEventListener("pointerup",(e)=>l.delete(e.pointerId),!0),window.addEventListener("pointercancel",(e)=>l.delete(e.pointerId),!0),window.addEventListener("blur",()=>l.clear());function C(e){if(l.size===0||e.aborted)return Promise.resolve();return new Promise((n)=>{let r=new AbortController,t=()=>{if(l.size===0||e.aborted)r.abort(),n()},a={capture:!0,signal:r.signal};window.addEventListener("pointerup",t,a),window.addEventListener("pointercancel",t,a),window.addEventListener("blur",t,{signal:r.signal}),e.addEventListener("abort",t,{signal:r.signal})})}function k(e,n){if(e?.contains(document.activeElement)&&n?.isConnected&&n!==document.body)n.focus({preventScroll:!0})}function q(e){let n=document.activeElement;if(e?.isConnected&&(!n||n===document.body))e.focus()}
|
|
2
|
+
export{Bt};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=558DA887E1C1A3B864756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-r4bcdwhq.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
1
|
+
import{p}from"./studio-jws1a87n.js";import{Vd,m}from"./studio-k2sz13zg.js";import{g}from"./studio-y60sts62.js";import{Ft,Wi,fn,fl,lr,Pa}from"./studio-hz5n7x27.js";import{$o}from"./studio-ea74s8c1.js";import{La,Bd}from"./studio-399a25za.js";import{Fw}from"./studio-rtfnhrdg.js";import{ls,Tw,Lw,er,jr}from"./studio-qyed0ah6.js";import{S}from"./studio-cg710sk9.js";import{n,Z,_,df}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var Cs="draft",bp="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function zl(e){return e?.[Cs]===!0}function M(e){return e?.properties?.[Cs]?.type==="boolean"}function Nc(e,t){return M(e)||zl(t)}var k=g({includeDrafts:!1});function I(){return k.includeDrafts}function KD(e){k.includeDrafts=e}function T(e,t,r){return r?e:e.filter((o)=>!zl(t(o)))}function W(e){let t=[],r=[],o="",s=!1,l=!1,u=()=>{r.push(o),o="",l=!1},x=()=>{if(u(),r.length===1&&r[0]===""){r=[];return}t.push(r),r=[]};for(let C=0;C<e.length;C++){let F=e[C];if(s){if(F==='"')if(e[C+1]==='"')o+='"',C+=1;else s=!1;else o+=F;continue}if(F==='"'&&!l)s=!0,l=!0;else if(F==='"')o+=F;else if(F===",")u();else if(F===`
|
|
2
2
|
`)x();else if(F==="\r"){if(e[C+1]===`
|
|
3
|
-
`)C+=1;x()}else o+=F,l=!0}if(o!==""||r.length>0)x();return t}function
|
|
3
|
+
`)C+=1;x()}else o+=F,l=!0}if(o!==""||r.length>0)x();return t}function Dd(e){let t=(e.match(/\r\n/g)??[]).length,r=(e.match(/(?<!\r)\n/g)??[]).length,o=t>r?`\r
|
|
4
4
|
`:`
|
|
5
5
|
`,s=e.endsWith(`
|
|
6
|
-
`),l=W(e),u=l[0]??[],x=l.slice(1),C=Math.max(u.length,...x.map((F)=>F.length),0);while(u.length<C)u.push("");for(let F of x)while(F.length<C)F.push("");return{eol:o,headers:u,rows:x,trailingNewline:s}}function z(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function
|
|
7
|
-
export{
|
|
6
|
+
`),l=W(e),u=l[0]??[],x=l.slice(1),C=Math.max(u.length,...x.map((F)=>F.length),0);while(u.length<C)u.push("");for(let F of x)while(F.length<C)F.push("");return{eol:o,headers:u,rows:x,trailingNewline:s}}function z(e){if(/[",\n\r]/.test(e))return`"${e.replaceAll('"','""')}"`;return e}function iT(e){return[e.headers,...e.rows].map((r)=>r.map((o)=>z(o)).join(",")).join(e.eol)+(e.trailingNewline?e.eol:"")}function q(e,t){let{headers:r,rows:o}=Dd(e),s=[t,"id","sku","slug","Slug"].flatMap((l)=>{let u=l===void 0?-1:r.indexOf(l);return u===-1?[]:[u]});return o.filter((l)=>l.some((u)=>u.trim()!=="")).map((l,u)=>{let x=s.find((C)=>(l[C]??"")!=="");return x===void 0?String(u):l[x]})}function B(e,t){let r;try{r=JSON.parse(e)}catch{return[]}let o=(s,l)=>{let u=_(s)&&!Array.isArray(s)?s.id:void 0;return n(u)||Z(u)?String(u):l};if(!Array.isArray(r))return[o(r,t)];return r.map((s,l)=>o(s,`${t}-${l}`))}function K(e,t,r){let o=e.toLowerCase();if(o.endsWith(".csv"))return q(t,r);if(o.endsWith(".json")){let s=(e.split("/").pop()??e).replace(/\.json$/i,"");return B(t,s)}return[]}var R="__path";function N(){return S?.projectConfig?.content??{}}function bb(e){let t=N()[e];if(!t?.source)return null;let r=t.source.replace(/^\.\//,"").replace(/\/$/,""),o=t.format==="json"?".json":Wi(t.format)?.extensions[0]??lr()?.extensions[0]??".json";return{def:t,dir:r,ext:o,name:e}}function rS(){return Object.entries(N()).filter(([,e])=>{let t=e.source?.replace(/^\.\//,"")??"";return t!==""&&!/\.[a-z0-9]+$/i.test(t)}).map(([e,t])=>({dir:t.source.replace(/^\.\//,"").replace(/\/$/,""),name:e}))}async function O(e,t){let r=p(),o=[],s=async(l)=>{let u;try{u=await r.listDirectory(l)}catch{return}for(let x of u)if(x.type==="directory")await s(x.path);else if(t.some((C)=>x.path.endsWith(C)))o.push(x.path)};return await s(e),o.toSorted()}async function sS(e){let t=e.dir.indexOf($o);if(t===-1)return[e.dir];let r=e.dir.slice(0,t).replace(/\/$/,""),o=e.dir.slice(t+$o.length),s;try{s=await p().listDirectory(r)}catch{return[]}return s.filter((l)=>l.type==="directory").map((l)=>`${l.path}${o}`.replace(/\/$/,"")).filter((l)=>Vd(l)?.name===e.name).toSorted()}async function V(e){let t=await sS(e);return(await Promise.all(t.map((o)=>O(o,[e.ext])))).flat().toSorted()}async function H(e){let t=Fw(e.name);if(t===null)return null;let r;try{r=await p().readFile(t)}catch{return[]}return K(t,r,e.def.idField)}async function vb(e){await Ft().catch(()=>{});let t=bb(e);if(!t)return[];let r=await H(t);if(r!==null)return r;return(await V(t)).map((s)=>{let l=s.split("/").pop()??s;return l.slice(0,l.length-t.ext.length)})}async function Q(e,t,r){let o=Array.from({length:e.length}),s=0,l=Array.from({length:Math.min(t,e.length)},async()=>{while(s<e.length){let u=s;s+=1,o[u]=await r(e[u])}});return await Promise.all(l),o}function j(e){if(e===void 0)return null;if(df(e))return e;if(Array.isArray(e)&&e.every((t)=>!_(t)))return e.map(String);return JSON.stringify(e)}function A(e){for(let t of m.tabs.values())if(t.documentPath===e)return t;return null}function U(e,t){return e.every((r)=>{let o=r[t];return!n(o)||!o.startsWith("{")&&!o.startsWith("[")})}var L=new WeakSet;async function oT(){let e=[];for(let t of m.tabs.values()){let r=er(t);if(r&&L.has(r.source))e.push(r.load())}await Promise.all(e)}function J(e){let t=X(e);if(e.drafts)L.add(t);return t}function X(e){let t=new Map,r=null,o=null,s=(d=!1)=>{if(!d&&r)return r;return r=(async()=>{await Ft().catch(()=>{});let h=p(),f=await e.list();t.clear(),o=null;let y=await Q(f,32,async(i)=>{try{let a=await h.readFile(i),c=await jr(i,a);return{document:c.document,formatName:c.format.name,frontmatter:c.frontmatter,rawText:a}}catch{return null}});for(let[i,a]of f.entries()){let c=y[i];if(c)t.set(a,c)}})(),r},l=()=>{if(o)return o;let d={editable:!1,field:R,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},h=Tw(e.schema()),f=new Set([R,...h.map((a)=>a.field)]),y=[...t.values()].map((a)=>{let c={};for(let[w,b]of Object.entries(a.frontmatter))if(!f.has(w)&&!w.startsWith("$"))c[w]=j(b);return c}),i=Lw(y);for(let a of i)a.editable=a.kind!=="text"||U(y,a.field);if(e.priorityFields?.length){let a=(c)=>{let w=e.priorityFields.indexOf(c.field);return w===-1?e.priorityFields.length:w};i.sort((c,w)=>a(c)-a(w))}return o=x([d,...h,...i]),o},u=()=>{if(!e.drafts)return!1;let d=e.schema();return Nc(d)||[...t.values()].some((h)=>Nc(d,h.frontmatter))},x=(d)=>{let h=d.findIndex((y)=>y.field===Cs);if(h<1||!u())return d;let f=d.filter((y)=>y.field!==Cs);return[f[0],d[h],...f.slice(1)]},C=(d,h)=>{let f={[R]:d};for(let y of l()){if(y.field===R)continue;f[y.field]=j(h.frontmatter[y.field])}return{cells:f,fingerprint:h.rawText,key:d}},F=async(d,h,f)=>{let y=p(),i={...h.frontmatter};for(let b of f)if(b.value===null)delete i[b.field];else i[b.field]=b.value;let a=h.document,c={...i,...a,children:a.children??[]},w=await Pa(h.formatName,c,{mode:"roundtrip",source:h.rawText});La(d),await y.writeFile(d,w),t.set(d,{...h,frontmatter:i,rawText:w})};return{backingPaths:()=>new Map([...t.keys()].map((d)=>[d,d])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await s(),l()},async commit(d){await s();let h=p(),f={cells:[],deletes:[],inserts:[]},y=new Map;for(let i of d.cells){let a=y.get(i.rowKey)??[];a.push({field:i.field,value:i.value}),y.set(i.rowKey,a)}for(let[i,a]of y){let c=(P,D,v)=>{for(let G of a)f.cells.push({error:D,field:G.field,ok:P,rowKey:i,stale:v})},w=t.get(i);if(!w){c(!1,"Entry no longer loaded — refresh the grid");continue}let b=A(i);if(b?.doc.dirty){c(!1,"Open in a tab with unsaved changes — save or close it first");continue}let E=null;try{E=await h.readFile(i)}catch{E=null}if(E!==w.rawText&&!Bd(i)){c(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await F(i,w,a),c(!0),b){let{reloadFileInTab:P}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));P(i)}}catch(P){c(!1,P instanceof Error?P.message:String(P))}}for(let i of d.inserts){let a=i.cells[R];if(!n(a)||a.trim()===""){f.inserts.push({error:"Path is required",ok:!1,tempKey:i.tempKey});continue}let c=e.resolveInsertPath(a),w=t.has(c);if(!w)try{await h.readFile(c),w=!0}catch{w=!1}if(w){f.inserts.push({error:`${c} already exists`,ok:!1,tempKey:i.tempKey});continue}let b=e.insertFormatName(c);if(!b){f.inserts.push({error:`No format can serialize ${c}`,ok:!1,tempKey:i.tempKey});continue}try{let E={};for(let[v,G]of Object.entries(i.cells))if(v!==R&&G!==null)E[v]=G;let P=await Pa(b,{...E,children:[]},{frontmatter:Object.keys(E).length>0,mode:"roundtrip"});La(c),await h.writeFile(c,P);let D=await jr(c,P);t.set(c,{document:D.document,formatName:D.format.name,frontmatter:D.frontmatter,rawText:P}),f.inserts.push({newKey:c,ok:!0,tempKey:i.tempKey})}catch(E){f.inserts.push({error:E instanceof Error?E.message:String(E),ok:!1,tempKey:i.tempKey})}}for(let i of d.deletes){if(A(i.rowKey)){f.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:i.rowKey});continue}try{La(i.rowKey),await h.deleteFile(i.rowKey),t.delete(i.rowKey),f.deletes.push({ok:!0,rowKey:i.rowKey})}catch(a){f.deletes.push({error:a instanceof Error?a.message:String(a),ok:!1,rowKey:i.rowKey})}}return f},id:e.id,label:e.label,async refresh(){await s(!0)},async rows(){await s();let h=(e.drafts?T([...t.entries()],([,f])=>f.frontmatter,I()):[...t.entries()]).map(([f,y])=>C(f,y));return{rows:h,total:h.length}}}}function rT(e){let t=()=>{let r=bb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return J({drafts:!0,id:ls({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?Wi(o.def.format)?.name:void 0)??fn(r)?.name??lr()?.name??null},label:e,list:()=>V(t()),resolveInsertPath:(r)=>{let o=t(),s=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!s.includes("/"))s=`${o.dir}/${s}`;if(!s.endsWith(o.ext))s=`${s}${o.ext}`;return s},schema:()=>t().def.schema})}function sT(){let e=()=>{let t=fl("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return J({id:ls({kind:"pages"}),insertFormatName:(t)=>fn(t)?.name??null,label:"Pages",list:()=>O("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
7
|
+
export{Dd,iT,Cs,bp,zl,Nc,KD,bb,rS,sS,vb,oT,rT,sT};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
10
|
-
//# sourceMappingURL=studio-
|
|
9
|
+
//# debugId=7DE28FDAE6B9A04F64756E2164756E21
|
|
10
|
+
//# sourceMappingURL=studio-r7pf0rkv.js.map
|