@jxsuite/studio 10.2.0 → 10.4.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-bx702wqa.js → 2020-906vx2dq.js} +3 -3
- package/dist/chunks/adapter-hnvad61x.js +4 -0
- package/dist/chunks/add-new-flow-v0pm96mr.js +4 -0
- package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
- package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
- package/dist/chunks/components-w5zqwva1.js +4 -0
- package/dist/chunks/content-source-g38w0d3f.js +4 -0
- package/dist/chunks/convert-to-repeater-r8sfxjjm.js +4 -0
- package/dist/chunks/editor-wvf5e6j9.js +4 -0
- package/dist/chunks/entry-commands-t13dyw3c.js +4 -0
- package/dist/chunks/extension-sections-vjzw46xb.js +4 -0
- package/dist/chunks/file-ops-1sghzgcr.js +4 -0
- package/dist/chunks/files-zrqtgt41.js +4 -0
- package/dist/chunks/format-host-9gy76erh.js +4 -0
- package/dist/chunks/fs-events-45rhg3me.js +4 -0
- package/dist/chunks/grid-open-t4fq6bbm.js +4 -0
- package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-2f03wcgw.js} +16 -16
- package/dist/chunks/icons-gb967qc8.js +4 -0
- package/dist/chunks/iframe-host-9aq8ze3q.js +4 -0
- package/dist/chunks/image-bake-4afr4y6a.js +4 -0
- package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
- package/dist/chunks/index-f9qr7kzh.js +4 -0
- package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
- package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
- package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
- package/dist/chunks/jx-validate-r4ax11e3.js +4 -0
- package/dist/chunks/layers-m49nmwvx.js +4 -0
- package/dist/chunks/layers-panel-zr92pwdp.js +4 -0
- package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
- package/dist/chunks/media-library-j74rt0w4.js +4 -0
- package/dist/chunks/media-open-mypr0k6b.js +4 -0
- package/dist/chunks/media-picker-pemtbsjv.js +4 -0
- package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
- package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
- package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-0hw9f835.js} +3 -3
- package/dist/chunks/notify-bwehrp7q.js +4 -0
- package/dist/chunks/parse-hee7ne9b.js +4 -0
- package/dist/chunks/platform-kv0k65cy.js +4 -0
- package/dist/chunks/publish-panel-vg1n880b.js +4 -0
- package/dist/chunks/publish-quick-4fwngwrw.js +4 -0
- package/dist/chunks/publish-workspace-jv4w2bx2.js +4 -0
- package/dist/chunks/quick-search-nh29rt8a.js +4 -0
- package/dist/chunks/references-vqyr5s9x.js +4 -0
- package/dist/chunks/right-panel-3ws9f2w0.js +4 -0
- package/dist/chunks/source-control-h3hcs5gy.js +4 -0
- package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
- package/dist/chunks/studio-0gvvqj3h.js +5 -0
- package/dist/chunks/studio-0khd8xtx.js +4 -0
- package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
- package/dist/chunks/studio-1410q5dw.js +5 -0
- package/dist/chunks/studio-1ctnw3xv.js +5 -0
- package/dist/chunks/studio-1ks5d9y4.js +5 -0
- package/dist/chunks/{studio-awxwjawq.js → studio-1y9mab9m.js} +4 -4
- package/dist/chunks/studio-2e4hry72.js +6 -0
- package/dist/chunks/studio-2kpxm0eh.js +7 -0
- package/dist/chunks/studio-2pk7kc7z.js +5 -0
- package/dist/chunks/studio-2x972v58.js +5 -0
- package/dist/chunks/studio-2zz4qbv9.js +5 -0
- package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
- package/dist/chunks/studio-3pz4t5a2.js +5 -0
- package/dist/chunks/studio-3qr08sxq.js +4 -0
- package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
- package/dist/chunks/studio-4bgvvzhv.js +5 -0
- package/dist/chunks/studio-4f7thq0p.js +5 -0
- package/dist/chunks/studio-4fnb5648.js +5 -0
- package/dist/chunks/studio-4zd6an2b.js +5 -0
- package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
- package/dist/chunks/studio-61rg2cz5.js +5 -0
- package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
- package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
- package/dist/chunks/studio-9c6cbq2c.js +4 -0
- package/dist/chunks/studio-9dq7rwc7.js +5 -0
- package/dist/chunks/studio-9gr7xs9r.js +6 -0
- package/dist/chunks/studio-a88ej93p.js +7 -0
- package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
- package/dist/chunks/studio-acer0g8w.js +5 -0
- package/dist/chunks/{studio-qh8berdz.js → studio-amaz545p.js} +4 -4
- package/dist/chunks/studio-az3wvyh2.js +5 -0
- package/dist/chunks/studio-bg8pzprg.js +5 -0
- package/dist/chunks/{studio-399a25za.js → studio-bnc50f9h.js} +4 -4
- package/dist/chunks/studio-brh8d2pr.js +5 -0
- package/dist/chunks/{studio-646nn2ys.js → studio-c2fa783p.js} +5 -5
- package/dist/chunks/studio-cfnn70h1.js +5 -0
- package/dist/chunks/{studio-rzqaz21g.js → studio-cqxj4fcy.js} +4 -4
- package/dist/chunks/studio-cw11h078.js +5 -0
- package/dist/chunks/studio-daksw8kh.js +5 -0
- package/dist/chunks/studio-dn56z7sn.js +5 -0
- package/dist/chunks/studio-egnjpyde.js +9 -0
- package/dist/chunks/studio-ejrypvmq.js +5 -0
- package/dist/chunks/studio-eqcddvc2.js +928 -0
- package/dist/chunks/studio-evq47j2z.js +5 -0
- package/dist/chunks/{studio-r7pf0rkv.js → studio-frc16j8v.js} +7 -7
- package/dist/chunks/studio-g0hxtcga.js +5 -0
- package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
- package/dist/chunks/studio-gnazwtv3.js +5 -0
- package/dist/chunks/studio-hfqpfmpk.js +5 -0
- package/dist/chunks/studio-hh394phe.js +5 -0
- package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
- package/dist/chunks/studio-j5fcp6gj.js +5 -0
- package/dist/chunks/studio-jd1qb1st.js +7 -0
- package/dist/chunks/studio-jma2q8r9.js +5 -0
- package/dist/chunks/studio-k0xzrse2.js +64 -0
- package/dist/chunks/studio-k1xqrgm5.js +5 -0
- package/dist/chunks/studio-k2evngrj.js +7 -0
- package/dist/chunks/studio-k3we3kqb.js +5 -0
- package/dist/chunks/studio-knsjyx7n.js +5 -0
- package/dist/chunks/studio-mrjtnm62.js +5 -0
- package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
- package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
- package/dist/chunks/studio-nwf0c32p.js +5 -0
- package/dist/chunks/studio-nzemfbkk.js +14 -0
- package/dist/chunks/{studio-43y04qck.js → studio-pj216fmn.js} +4 -4
- package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
- package/dist/chunks/studio-pwctzka3.js +16 -0
- package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
- package/dist/chunks/studio-q9hx2qp0.js +5 -0
- package/dist/chunks/studio-qrzmfaf6.js +5 -0
- package/dist/chunks/{studio-86r8hp7r.js → studio-r6mx7vm5.js} +5 -5
- package/dist/chunks/studio-rr00ex23.js +7 -0
- package/dist/chunks/{studio-4jhw38b2.js → studio-s24mhq0z.js} +4 -4
- package/dist/chunks/studio-sce30r7b.js +4 -0
- package/dist/chunks/studio-swedpd82.js +5 -0
- package/dist/chunks/studio-tmfcn347.js +6 -0
- package/dist/chunks/studio-tpxcryf2.js +5 -0
- package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
- package/dist/chunks/studio-v7a7yb5w.js +9 -0
- package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
- package/dist/chunks/{studio-881z1xrx.js → studio-wmjmsw0p.js} +4 -4
- package/dist/chunks/studio-wqfaqw4m.js +5 -0
- package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
- package/dist/chunks/studio-xva3hzkv.js +5 -0
- package/dist/chunks/{studio-6hzdjfv0.js → studio-xx3r3sb0.js} +4 -4
- package/dist/chunks/{studio-cg1bfyhf.js → studio-z3fztxrp.js} +8 -8
- package/dist/chunks/studio-z9453ypn.js +6 -0
- package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
- package/dist/chunks/workspace-6ztqcrsh.js +4 -0
- package/dist/chunks/workspace-home-rse9h8a0.js +4 -0
- package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
- package/dist/iframe-entry.js +13 -13
- package/dist/manifest.json +83 -78
- package/dist/studio.js +84 -84
- package/package.json +11 -11
- package/src/browse/library-pane.ts +44 -29
- package/src/browse/library-preview.ts +6 -2
- package/src/canvas/asset-refs.ts +13 -4
- package/src/canvas/asset-resolve.ts +54 -11
- package/src/canvas/canvas-render.ts +25 -0
- package/src/canvas/iframe-entry.ts +5 -1
- package/src/canvas/iframe-host.ts +16 -6
- package/src/canvas/iframe-protocol.ts +9 -1
- package/src/commands/context.ts +5 -0
- package/src/commands/live-context.ts +5 -2
- package/src/editor/shortcuts.ts +3 -0
- package/src/files/asset-versions.ts +108 -2
- package/src/files/file-ops.ts +11 -1
- package/src/files/files.ts +111 -48
- package/src/files/media-paths.ts +12 -4
- package/src/files/media-upload.ts +195 -21
- package/src/files/new-file-name.ts +39 -1
- package/src/media/image-bake.ts +164 -0
- package/src/media/image-editor.ts +846 -0
- package/src/media/image-format.ts +262 -0
- package/src/media/image-recipe.ts +651 -0
- package/src/media/media-commands.ts +65 -1
- package/src/media/media-library-model.ts +1 -1
- package/src/media/media-library.ts +175 -15
- package/src/media/media-open.ts +156 -3
- package/src/media/media-pane.ts +8 -4
- package/src/panels/pane-context.ts +6 -1
- package/src/panels/tab-strip.ts +12 -3
- package/src/studio.ts +13 -2
- package/src/surfaces/image-editor.json +1390 -0
- package/src/surfaces/image-editor.ts +272 -0
- package/src/surfaces/inspector-dock.json +3 -3
- package/src/surfaces/media-library.json +129 -1
- package/src/surfaces/media-library.ts +17 -2
- package/src/types.ts +2 -1
- package/src/workspace/tab-workspace.ts +2 -1
- package/src/workspace/workspace-switch.ts +3 -1
- package/src/workspace/workspace.ts +22 -1
- package/dist/chunks/adapter-pp011m5x.js +0 -4
- package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
- package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
- package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
- package/dist/chunks/components-yn0dn2pq.js +0 -4
- package/dist/chunks/content-source-g0j41yy6.js +0 -4
- package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
- package/dist/chunks/editor-xz02jeh1.js +0 -4
- package/dist/chunks/entry-commands-kmt02crp.js +0 -4
- package/dist/chunks/extension-sections-0rprf12d.js +0 -4
- package/dist/chunks/file-ops-mexj5qed.js +0 -4
- package/dist/chunks/files-b2tcppdd.js +0 -4
- package/dist/chunks/format-host-btsevv0c.js +0 -4
- package/dist/chunks/fs-events-r0apejva.js +0 -4
- package/dist/chunks/grid-open-n2a8xkht.js +0 -4
- package/dist/chunks/icons-853n6qt3.js +0 -4
- package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
- package/dist/chunks/index-bs4k9tr6.js +0 -4
- package/dist/chunks/jx-validate-ymf10teh.js +0 -4
- package/dist/chunks/layers-p9nfya38.js +0 -4
- package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
- package/dist/chunks/lit-html-x18n2sfz.js +0 -4
- package/dist/chunks/media-library-0n45gv8r.js +0 -4
- package/dist/chunks/media-picker-s09at95z.js +0 -4
- package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
- package/dist/chunks/notify-qwb8radt.js +0 -4
- package/dist/chunks/parse-v77xtwv7.js +0 -4
- package/dist/chunks/platform-8jnez0wr.js +0 -4
- package/dist/chunks/publish-panel-aysnj611.js +0 -4
- package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
- package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
- package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
- package/dist/chunks/references-a7v6a0e2.js +0 -4
- package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
- package/dist/chunks/source-control-fsqzc6he.js +0 -4
- package/dist/chunks/studio-05jfwbmf.js +0 -5
- package/dist/chunks/studio-0q5jwddh.js +0 -9
- package/dist/chunks/studio-0w2dr0q8.js +0 -5
- package/dist/chunks/studio-1tzpds97.js +0 -9
- package/dist/chunks/studio-216b27sv.js +0 -4
- package/dist/chunks/studio-2ejhqns4.js +0 -5
- package/dist/chunks/studio-2r90cts3.js +0 -16
- package/dist/chunks/studio-399xknkb.js +0 -6
- package/dist/chunks/studio-4ncmwqw5.js +0 -5
- package/dist/chunks/studio-5atwjgkj.js +0 -7
- package/dist/chunks/studio-5frqk7c0.js +0 -5
- package/dist/chunks/studio-6cwj6xrx.js +0 -5
- package/dist/chunks/studio-78pywnp2.js +0 -6
- package/dist/chunks/studio-886t6ztg.js +0 -5
- package/dist/chunks/studio-8wnvtr4z.js +0 -5
- package/dist/chunks/studio-8z66jk4z.js +0 -5
- package/dist/chunks/studio-b2qpt0xy.js +0 -14
- package/dist/chunks/studio-c71806xz.js +0 -7
- package/dist/chunks/studio-cbwks69x.js +0 -928
- package/dist/chunks/studio-cg710sk9.js +0 -5
- package/dist/chunks/studio-cw0wb9qk.js +0 -7
- package/dist/chunks/studio-cyheys7k.js +0 -5
- package/dist/chunks/studio-ea5m9kg5.js +0 -5
- package/dist/chunks/studio-efdxjwyp.js +0 -64
- package/dist/chunks/studio-egmw2837.js +0 -5
- package/dist/chunks/studio-f746039f.js +0 -5
- package/dist/chunks/studio-fmdymd9v.js +0 -5
- package/dist/chunks/studio-gcm12z00.js +0 -6
- package/dist/chunks/studio-gj98m8gy.js +0 -7
- package/dist/chunks/studio-hasbgjah.js +0 -5
- package/dist/chunks/studio-hz5n7x27.js +0 -5
- package/dist/chunks/studio-jeraxdgv.js +0 -7
- package/dist/chunks/studio-jvgek9xt.js +0 -5
- package/dist/chunks/studio-jws1a87n.js +0 -5
- package/dist/chunks/studio-k2sz13zg.js +0 -5
- package/dist/chunks/studio-k3m4jkdk.js +0 -5
- package/dist/chunks/studio-kg5ya5r2.js +0 -5
- package/dist/chunks/studio-khwbgrtg.js +0 -5
- package/dist/chunks/studio-mx6wzh25.js +0 -5
- package/dist/chunks/studio-mxs3ar9t.js +0 -5
- package/dist/chunks/studio-nm4szey4.js +0 -5
- package/dist/chunks/studio-nqxqf8p2.js +0 -4
- package/dist/chunks/studio-qn7z4krm.js +0 -5
- package/dist/chunks/studio-qyed0ah6.js +0 -5
- package/dist/chunks/studio-r4bcdwhq.js +0 -5
- package/dist/chunks/studio-rtfnhrdg.js +0 -5
- package/dist/chunks/studio-s5tzw84t.js +0 -5
- package/dist/chunks/studio-t51y8v1d.js +0 -5
- package/dist/chunks/studio-t98vq4r6.js +0 -5
- package/dist/chunks/studio-tsxpqvh0.js +0 -6
- package/dist/chunks/studio-v1yascv2.js +0 -5
- package/dist/chunks/studio-wxq6v5sv.js +0 -5
- package/dist/chunks/studio-y60sts62.js +0 -4
- package/dist/chunks/studio-zndrqawb.js +0 -5
- package/dist/chunks/studio-zwaxn5s2.js +0 -5
- package/dist/chunks/workspace-home-x1787wpv.js +0 -4
- package/dist/chunks/workspace-zpe1np43.js +0 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{p,
|
|
2
|
-
`),i=
|
|
3
|
-
${r}`;if(!x.has(s)){let o=P,a=Fe(e,t).then((l)=>{if(x.get(s)===a)x.delete(s);if(o===P){E.set(e,{entries:l,key:r});for(let c of F)c()}return l});x.set(s,a)}return null}function ve(e,t,r){let i=E.get(t),s=i?.entries.findIndex((a)=>a.path===e)??-1;if(!i||s===-1)return!1;let o=i.entries.with(s,X(e,t,r));E.set(t,{entries:o,key:i.key});for(let a of F)a();return!0}function bD(e,t){let r=Gl(e);if(e===null||r===null||r===hi)return!1;return ve(e,r,t)}function CE(){P+=1,E.clear(),x.clear()}function rw(e){return F.add(e),()=>{F.delete(e)}}var Le=/^\d{4}-\d{2}-\d{2}/,f="entry",h=g(new Map);function k(e){let t=h.get(e.id);if(t===void 0)return null;if("key"in t)return t.key;return er(e)?.state.rows[t.row]?.key??null}function Ce(e){return h.has(e.id)}function A(e,t){h.set(e.id,{key:t})}function Te(e){h.delete(e.id)}function y(e){return Ce(e)&&er(e)!==null}function ee(e){let t=er(e),r=k(e);if(!t||r===null)return{};let i={};for(let s of t.state.columns){let o=t.buffer.effectiveValue(r,s.field);if(o===null||o==="")continue;if(s.kind==="date"&&n(o)&&!Le.test(o)){i[s.field]=ab(o)||o;continue}i[s.field]=_(o)&&!Array.isArray(o)?o.$ref:o}return i}function Re(e){if(e===void 0||e===null)return null;if(Array.isArray(e))return e.map((t)=>n(t)?t:JSON.stringify(t));if(n(e)||Z(e)||Ze(e))return e;return JSON.stringify(e)}function I(e,t){let r=er(e),i=k(e);if(!r||i===null)return;let s=new Set(r.state.columns.map((o)=>o.field));r.buffer.group(()=>{for(let[o,a]of Object.entries(t))if(s.has(o))r.buffer.setCell(i,o,Re(a))})}function w(e){let t=er(e),r=k(e),i=t?.state.rows??[],s=r===null?-1:i.findIndex((o)=>o.key===r);return{index:s,next:s===-1?null:i[s+1]?.key??null,previous:s<=0?null:i[s-1]?.key??null,total:i.length}}async function vD(e,t){let{openFileInTab:r}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));await r(e);let i=m.tabs.get(e)??null;if(!i||!er(i))return i;if(!h.has(i.id))i.scope.run(()=>{ea(()=>Te(i))});if(h.set(i.id,{row:t}),!i.capabilities.modes.includes(f))i.capabilities.modes.unshift(f);return i.session.ui.canvasMode=f,i.session.ui.preview=!1,Pt(i.id),i}function te(e){return e.doc.sourceFormat==null&&e.doc.mode!=="content"}function Hl(e){if(y(e))return ee(e);return te(e)?e.doc.document:e.doc.content.frontmatter}function De(e,t,r){let i=e.doc.document,s=Object.hasOwn(i,t)?Se(i[t]):void 0,o=r===void 0||r===null||r==="";if(o)delete i[t];else i[t]=r;let a=o?void 0:Se(r);Bi({forward:{key:t,op:"set-key",path:[],value:a},inverse:{key:t,op:"set-key",path:[],value:s}}),e.doc.dirty=!0,nN()}function H(e,t,r){if(y(e))I(e,{[t]:r});else if(te(e))De(e,t,r);else Gd(e,t,r)}function U_(e,t){if(y(e)){I(e,t);return}Y(e,(r)=>{for(let[i,s]of Object.entries(t))H(r,i,s)})}var re={$schema:"https://jxsuite.com/schema/v1",$id:"StudioEntryEditor",$description:"The Entry editor (site-architecture.md §7.4) — one content entry's fields, in a pane, as a Jx document over the kit. The adapter (`surfaces/entry-editor.ts`) hands in a projection; `content/entry-editor.ts` decides everything in it — which collection the file belongs to, which record its fields live in, which required keys are absent and what a draft flag commits into. The FORM is an island: a schema is `ui/schema-form.ts`'s subject, so this document renders an empty `fields` node and the flow places the element that engine hands back (studio-ui-guidelines.md §9.3, §9.4). That is the whole of the difference between this and the card the lit version drew, and it is why the engine converting in batch 7 is what unblocked this one.",tagName:"div",attributes:{part:"entry","data-jx-region":"${state.region}"},style:{$description:"What `.entry-editor`, `.entry-editor-header`, `.entry-editor-collection`, `.entry-draft-switch`, `.entry-editor-fields`, `.entry-editor-note` and `.entry-editor-empty` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This editor was the only emitter of all seven, so those rules are dead in the stylesheet from here; a central sweep removes them rather than this change, which owns no stylesheet. Every `--spectrum-font-size-*` reference is gone rather than renamed: those names resolve only inside `<sp-theme>`, and a pane editor is mounted outside it, so each would silently have taken its hard-coded fallback.",height:"100%",padding:"var(--jx-space-5)",overflowY:"auto",background:"var(--bg-panel)",'& [part="header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)",marginBottom:"var(--jx-space-5)"},'& [part="name"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="collection"]':{padding:"1px var(--jx-space-3)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="draft"]':{$description:"Pushed to the far end of the header rather than placed there: the heading and the collection chip are both content-width, so `margin-left: auto` is what keeps the switch on the right edge whatever the entry is called.",marginLeft:"auto"},'& [part="fields"]':{$description:"The schema form's host is `display: contents`, so its rows are the flex items of THIS box — which is why the column lives here and not inside the engine.",display:"flex",flexDirection:"column"},'& [part="note"]':{margin:"0 0 var(--jx-space-4)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",lineHeight:"1.5"},'& [part="empty"]':{display:"flex",maxWidth:"46ch",flexDirection:"column",alignItems:"flex-start",gap:"var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",lineHeight:"1.5"},'& [part="record-nav"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"stage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/stage"},cases:{entry:{tagName:"div",attributes:{part:"body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"header"},children:[{tagName:"h3",attributes:{part:"name"},textContent:"${state.name}"},{tagName:"span",attributes:{part:"collection"},textContent:"${state.collection}"},{tagName:"div",attributes:{part:"record-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/recordNav"},cases:{shown:{$description:"A record of a file-backed collection (a CSV row): which row of the file this is, the rows either side of it, and the grid that shows them all. A file entry has no neighbours to step to, so it draws none of this.",tagName:"div",attributes:{part:"record-nav",role:"group","aria-label":"Records"},children:[{tagName:"jx-action-button",attributes:{part:"previous"},$props:{size:"sm",quiet:!0,label:"Previous record",hint:"Previous record",disabled:{$ref:"#/state/previousDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showPrevious"},value:[]}]},children:[{tagName:"span",textContent:"‹ Previous"}]},{tagName:"span",attributes:{part:"place"},textContent:"${state.place}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,label:"Next record",hint:"Next record",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showNext"},value:[]}]},children:[{tagName:"span",textContent:"Next ›"}]},{tagName:"jx-action-button",attributes:{part:"grid"},$props:{size:"sm",quiet:!0,label:"Edit in grid",hint:"Every record of the file, as a table"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openGrid"},value:[]}]},children:[{tagName:"span",textContent:"Edit in grid"}]}]}}},{tagName:"div",attributes:{part:"draft-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/draftAxis"},cases:{shown:{$description:"No `label`: the slotted word is on screen and carries the name, so an aria-label would be read twice. The tooltip is `hint`, which is what DRAFT_MEANING has always been.",tagName:"jx-switch",attributes:{part:"draft"},$props:{checked:{$ref:"#/state/draft"},hint:"${state.draftHint}",size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDraft"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Draft"}]}}}]},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/noteState"},cases:{shown:{tagName:"p",attributes:{part:"note"},textContent:"${state.note}"}}},{$description:"An island: `ui/schema-form.ts` draws this entry's fields into this node, and nothing in this document knows what a schema is.",tagName:"div",attributes:{part:"fields","data-jx-region":"${state.fieldsRegion}"}}]},empty:{$description:"The mode is reachable from the palette and from `__jxAutomation` on any tab, so this state is real: it names the reason and the fix rather than drawing an empty form.",tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-line"},textContent:"${state.emptyLine}"},{tagName:"p",attributes:{part:"note"},children:[{tagName:"span",textContent:"A collection is a "},{tagName:"code",textContent:"content"},{tagName:"span",textContent:" entry in "},{tagName:"code",textContent:"project.json"},{tagName:"span",textContent:" whose "},{tagName:"code",textContent:"source"},{tagName:"span",textContent:" directory contains this file and which declares a "},{tagName:"code",textContent:"schema"},{tagName:"span",textContent:"."}]},{tagName:"jx-action-button",attributes:{part:"content-types"},$props:{label:"Content types",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openContentTypes"},value:[]}]},children:[{tagName:"span",textContent:"Content types…"}]}]}}}]};L("entry-editor",re);function ie(e,t){e.region=t.region,e.fieldsRegion=t.fieldsRegion,e.stage=t.stage,e.name=t.name,e.collection=t.collection,e.draftAxis=t.draftAxis,e.draft=t.draft,e.draftHint=t.draftHint,e.noteState=t.noteState,e.note=t.note,e.emptyLine=t.emptyLine,e.recordNav=t.recordNav,e.place=t.place,e.previousDisabled=t.previousDisabled,e.nextDisabled=t.nextDisabled}function Pe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function oe(e,t,r,i){e.replaceChildren();let s=g({collection:"",draft:!1,draftAxis:"hidden",draftHint:"",emptyLine:"",fieldsRegion:"",name:"",nextDisabled:!0,note:"",noteState:"hidden",openContentTypes:r.openContentTypes,openGrid:r.openGrid,place:"",previousDisabled:!0,recordNav:"hidden",region:"",setDraft:r.setDraft,showNext:r.showNext,showPrevious:r.showPrevious,stage:"empty"});ie(s,t);let o=null,a=!1,l=R("entry-editor",s,e,{onNodeCreated:(c,d,D)=>{if(c instanceof HTMLElement&&Pe(D)==="fields")i.fieldsSlot(c)}}).then((c)=>{let d=c.root;if(a)return c.dispose(),d;return o=c,d});return{attached:()=>{if(a)return!1;let c=o?.root;return c===void 0?!0:c instanceof HTMLElement&&e.contains(c)},dispose(){a=!0,o?.dispose(),o=null},ready:l,update:(c)=>ie(s,c)}}var M=g(new Map);function se(e,t){M.set(e,t)}function yD(e){return e?M.get(e):void 0}function wD(e){M.delete(e)}function b(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"").replace(/\/+$/,"")}function je(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function ce(e,t){let r=[];for(let o of e)r.push(b(o));let i=[],s=t?.content??{};for(let o of Object.values(s)){if(!n(o.source)||o.source===""||je(o.source))continue;let a=b(o.source),l=a.indexOf($o);if(l!==-1)a=b(a.slice(0,l));if(a===""||a===".")continue;if(![...r,...i].some((d)=>a===d||a.startsWith(`${d}/`)))i.push(a)}return i.length===0?e:[...e,...i]}function Oe(e,t){let r=Gl(e);if(r===null)return null;if(r===hi)return t===void 0||Ju(e,t)?r:null;let i=Un(e);if(!i||i.name!==r||!i.def.format||i.ext===null)return r;return e.toLowerCase().endsWith(i.ext.toLowerCase())?r:null}var ke=new Set(["node_modules",".git",".jx",".cache"]);function Ae(e){let t=b(e);return t===""||t==="."}async function de(e,t,r=!1){let i;try{i=await us(()=>t.platform.listDirectory(e))}catch(o){if(!r)t.failures.push({dir:e,error:Q(o)});return}let s=[];for(let o of i){if(o.type==="directory"){let l=b(o.path);if(!ke.has(o.name)&&!Ae(l)&&!t.claimed.has(l))t.claimed.add(l),s.push(o.path);continue}let a=tn(o.name);t.out.push({collection:Oe(o.path,t.pageExtensions),ext:a,locale:wx(o.path,t.i18n)??void 0,media:Ys.has(a),modified:o.modified,name:o.name,path:o.path,size:o.size,type:a||"file"})}await Promise.all(s.map((o)=>de(o,t)))}async function um(e,t,r=new Set,i){let{i18n:s}=ln(S?.projectConfig??{}),o={claimed:new Set,failures:[],i18n:s,out:[],pageExtensions:i,platform:t};await Promise.all(e.map((c)=>{let d=b(c);if(o.claimed.has(d))return Promise.resolve();return o.claimed.add(d),de(c,o,r.has(c))}));let{failures:a,out:l}=o;return l.sort((c,d)=>c.path.localeCompare(d.path)),{failures:a,files:l}}function kE(e,t){let r=e.filter((o)=>o.collection===t.collection),i=t.query.trim().toLowerCase();if(i)r=r.filter((o)=>o.name.toLowerCase().includes(i)||o.path.toLowerCase().includes(i));let s=t.locale?.trim();if(s)r=r.filter((o)=>o.locale===s);return r}var hm=["table","cards","calendar","board"],sw={board:"Board",calendar:"Calendar",cards:"Cards",table:"Table"};var xD=new Set(["cards"]),$e=/^(\d{4}-\d{2}-\d{2})/;function EE(e){let t=$e.exec(e.name);if(t)return t[1];if(e.modified){let r=_p(new Date(e.modified));if(r)return r}return null}function lb(){return ln(S?.projectConfig??{}).i18n?.locales??[]}function _D(e){let t=new Set;for(let r of e)if(r.locale)t.add(r.locale);return lb().filter((r)=>t.has(r))}function SD(e,t=EE){let r=new Map,i=[];for(let o of e){let a=t(o);if(a===null){i.push(o);continue}let l=r.get(a);if(l)l.push(o);else r.set(a,[o])}return{days:[...r.entries()].map(([o,a])=>({date:o,files:a})).toSorted((o,a)=>a.date.localeCompare(o.date)),undated:i}}function Ie(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function CD(e){let t=new Map;for(let r of e){let i=Ie(r.path),s=t.get(i);if(s)s.push(r);else t.set(i,[r])}return[...t.entries()].map(([r,i])=>({files:i,group:r})).toSorted((r,i)=>r.group.localeCompare(i.group))}function He(e,t,r,i){let s=pp(e,t),o=s===null?"":t[s]??"",a=Object.values(t).find((l)=>l.trim()!=="");return(o||a||i||`Row ${r+1}`).trim()}function Me(e){let{headers:t,rows:r}=Dd(e);return r.flatMap((i,s)=>i.some((o)=>o.trim()!=="")?[{fields:Object.fromEntries(t.map((o,a)=>[o,i[a]??""])),row:s}]:[])}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}let r=(i)=>_(i)&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).map(([s,o])=>[s,j(o)])):{};if(!Array.isArray(t))return[{fields:r(t),row:0,single:!0}];return t.map((i,s)=>({fields:r(i),row:s}))}function ue(e,t,r){let i=e.toLowerCase(),s=i.endsWith(".csv")?Me(t):i.endsWith(".json")?Ge(t):null;if(s===null)return null;let o=(e.split("/").pop()??e).replace(/\.[^.]+$/,"");return s.map(({fields:a,row:l,single:c},d)=>({fields:a,index:d,row:l,title:He(r,a,d,c?o:"")}))}function fe(e,t){return`${e}#${t+1}`}var G="The Content workspace lists files; it does not edit them in the list. Rename, duplicate or delete from the file's context menu, or open the file to edit it.";function Ve(e){return`field:${e}`}function kD(e){return e.startsWith("field:")?e.slice(6):null}var Je=6,me=new Set(["image","markdown","html","richtext"]);function V(e){return $b($S(e))}function ED(e,t){return Object.entries(e?.properties??{}).filter(([r,i])=>{if(t.has(r)||r===Cs)return!1;if(i.type==="object"||n(i.format)&&me.has(i.format))return!1;let s=i.items?.format;return i.type!=="array"||i.items?.type==="string"&&!(n(s)&&me.has(s))}).slice(0,Je).map(([r,i])=>{let s={name:r,title:V(r)};if(i.type==="array")s.list=!0;if(i.type==="number"||i.type==="integer"||i.format==="date"||i.format==="date-time")s.measure=!0;return s})}function ze(e){let t=[{editable:!1,field:"title",kind:"string",title:"Title",widthHint:240},{editable:!1,field:"url",kind:"string",pk:!0,title:"URL",widthHint:200},{editable:!1,field:"template",kind:"string",title:"Template",widthHint:140}];if(e?.status)t.push({editable:!1,field:"status",kind:"string",title:"Status",widthHint:100});if(e?.locale)t.push({editable:!1,field:"locale",kind:"string",title:"Language",widthHint:110});return t.push({editable:!1,field:"modified",kind:"date",title:"Edited",widthHint:120}),t}function TE(e=hi,t){let r=[...t?.locale?[{editable:!1,field:"locale",kind:"string",title:"Locale",widthHint:90}]:[],{editable:!1,field:"modified",kind:"date",title:"Modified",widthHint:160},{editable:!1,field:"path",kind:"readonly",title:"Path",widthHint:320}];if(e===hi)return ze(t);let i=[{editable:!1,field:"title",kind:"string",title:"Title",widthHint:260}];if(t?.status)i.push({editable:!1,field:"status",kind:"string",title:"Status",widthHint:100});if(t?.date)i.push({editable:!1,field:"date",kind:"date",title:"Date",widthHint:120});for(let s of t?.fields??[])i.push({editable:!1,field:Ve(s.name),kind:"string",title:s.title,widthHint:140});return[...i,...r]}function Ke(e){return{cells:{locale:e.locale??null,modified:e.modified??null,status:null,template:null,title:e.name,url:e.collection===hi?yr(e.path).urlPattern:null},key:e.path}}async function Ye(e,t){return(await Promise.all(e.map(async(i)=>{let s=i.collection===null?null:Un(i.path);if(!s?.fileBacked)return[i];let o;try{o=await t(i.path)}catch{return[i]}let a=ue(i.path,o,s.def.schema);if(a===null)return[i];return a.map((l)=>Be(i,l))}))).flat()}function Be(e,t){return{...e,name:t.title,path:fe(e.path,t.index),record:{fields:t.fields,row:t.row,source:e.path}}}async function We(e){let t=p(),r=await Ye(e.files,(i)=>t.readFile(i));return{...e,files:r}}function TD(e){let t=null,r=null,i=null,s=e??(()=>ce(S?.projectDirs??[],S?.projectConfig??null));async function o(){if(t)return t;let a=s(),l=new Set(e?a:S?.projectDirs??[]),c=new Set(a.filter((d)=>!l.has(d)));return r??=Ev().then((d)=>um(a,p(),c,d)).then(We).then((d)=>(t=d,i=a.join(`
|
|
4
|
-
`),r=null,d)),r}return{capabilities:{delete:!1,insert:!1,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(
|
|
5
|
-
`)}}var qe=[f],T=new Map;function J(e){return T.get(e)??null}function
|
|
6
|
-
export{
|
|
1
|
+
import{p,ye}from"./studio-4fnb5648.js";import{X}from"./studio-9c6cbq2c.js";import{ln,jx,$a,Bi,Gn,Z,Qd,m,Ft}from"./studio-knsjyx7n.js";import{Nv}from"./studio-q9hx2qp0.js";import{$o}from"./studio-nvcn2ykc.js";import{$s}from"./studio-hh394phe.js";import{ra,At,yf}from"./studio-1ks5d9y4.js";import{nr}from"./studio-61rg2cz5.js";import{Fd,Cs,Tp,Jl,jc}from"./studio-frc16j8v.js";import{ae}from"./studio-wqfaqw4m.js";import{yr,ih,mC,Ub,hi,ec}from"./studio-xva3hzkv.js";import{er,VN}from"./studio-hfqpfmpk.js";import{Gl,Ep}from"./studio-cqxj4fcy.js";import{Sa,Fc,PN,FN}from"./studio-qrzmfaf6.js";import{Rp}from"./studio-cfnn70h1.js";import{C}from"./studio-4f7thq0p.js";import{Ce}from"./studio-v5wktj6f.js";import{Ln,E,R}from"./studio-9dq7rwc7.js";import{me,ia,te,g}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var be=["title","name","label","heading"];function Sp(e,t={}){let r=(i)=>{for(let s of be){let o=i.find((a)=>a.toLowerCase()===s);if(o!==void 0)return o}return null};return r(Object.keys(e?.properties??{}))??r(Object.keys(t).filter((i)=>n(t[i])))}function j(e){if(e instanceof Date)return kb(e);if(n(e))return e;if(Y(e)||Ze(e))return String(e);if(Array.isArray(e))return e.filter((t)=>n(t)||Y(t)).map(String).join(", ");return""}function xe(e,t){return Object.fromEntries(Object.keys(e?.properties??{}).filter((r)=>(r in t)).map((r)=>[r,j(t[r])]))}var Ee=["date","published","publishedAt","pubDate","publishDate"];function wS(e,t){for(let[r,i]of Object.entries(e?.properties??{}))if(i.format==="date"||i.format==="date-time")return r;return Ee.find((r)=>(r in t))??null}function sT(e){let t=e?.properties??{};return wS(e,Object.fromEntries(Object.keys(t).map((r)=>[r,""])))}function kb(e){if(e instanceof Date)return Number.isNaN(e.getTime())?"":e.toISOString().slice(0,10);if(!n(e))return"";let t=/^(\d{4}-\d{2}-\d{2})/.exec(e.trim());if(t)return t[1];let r=new Date(e);if(e.trim()===""||Number.isNaN(r.getTime()))return"";if(!e.includes(":")){let i=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return`${r.getFullYear()}-${i}-${s}`}return r.toISOString().slice(0,10)}function O(e){let t=e.split("/").pop()??e,r=t.lastIndexOf(".");return r>0?t.slice(0,r):t}function B(e,t){if(t.startsWith("/"))return`public${t}`;let r=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=[...r===""?[]:r.split("/"),...t.split("/")],s=[];for(let o of i){if(o===""||o===".")continue;if(o==="..")s.pop();else s.push(o)}return s.join("/")}var W=/^[a-z][\d+.a-z-]*:/i;function we(e,t){let r=t.trim();if(r==="")return"";return W.test(r)?r:nr(B(e,r))}function q(e){if(n(e))return e.split(",")[0]?.trim()??"";if(Array.isArray(e)){let[t]=e;return t===void 0?"":q(t)}if(v(e)){let{src:t}=e;return n(t)?t:""}return""}function U(e){if(e.format==="image")return!0;let t=e.properties?.src;if(e.type==="object"&&t?.type==="string")return!0;return e.type==="array"&&e.items!==void 0&&U(e.items)}function aT(e,t,r){for(let[i,s]of Object.entries(r?.properties??{}))if(U(s)){let o=we(e,q(t[i]));if(o!=="")return o}for(let i of Object.values(t)){if(!n(i)||W.test(i))continue;let s=i.lastIndexOf(".");if(s>0&&yf(i.slice(s)))return nr(B(e,i))}return""}function Q(e,t,r){let i=Sa(t)?.schema??null,s=Sp(i,r),o=s===null?void 0:r[s],a=Jl(r),l=wS(i,r);return{date:l===null?"":kb(r[l]),fields:xe(i,r),path:e,status:jc(i,r)?a?"Draft":"Published":"",thumb:aT(e,r,i),title:n(o)&&o.trim()!==""?o:O(e)}}async function Se(e){try{let t=await p().readFile(e);if(e.endsWith(".json")){let s=JSON.parse(t);return _(s)&&!Array.isArray(s)?s:{}}let{parseSourceForPath:r}=await (ce("1sghzgcr"),import("./file-ops-1sghzgcr.js"));return(await r(e,t)).frontmatter}catch{return{}}}var w=new Map,x=new Map,P=0,F=new Set,K=200;async function Fe(e,t){let r=t.slice(0,K),i=await Promise.all(r.map(async(o)=>Q(o,e,await Se(o)))),s=t.slice(K).map((o)=>({date:"",path:o,status:"",thumb:"",title:O(o)}));return[...i,...s]}function Cw(e,t){let r=t.join(`
|
|
2
|
+
`),i=w.get(e);if(i?.key===r)return i.entries;if(!ye())return t.map((o)=>({date:"",path:o,status:"",thumb:"",title:O(o)}));let s=`${e}
|
|
3
|
+
${r}`;if(!x.has(s)){let o=P,a=Fe(e,t).then((l)=>{if(x.get(s)===a)x.delete(s);if(o===P){w.set(e,{entries:l,key:r});for(let c of F)c()}return l});x.set(s,a)}return null}function ve(e,t,r){let i=w.get(t),s=i?.entries.findIndex((a)=>a.path===e)??-1;if(!i||s===-1)return!1;let o=i.entries.with(s,Q(e,t,r));w.set(t,{entries:o,key:i.key});for(let a of F)a();return!0}function aN(e,t){let r=ec(e);if(e===null||r===null||r===hi)return!1;return ve(e,r,t)}function lT(){P+=1,w.clear(),x.clear()}function kw(e){return F.add(e),()=>{F.delete(e)}}var Le=/^\d{4}-\d{2}-\d{2}/,f="entry",h=g(new Map);function k(e){let t=h.get(e.id);if(t===void 0)return null;if("key"in t)return t.key;return er(e)?.state.rows[t.row]?.key??null}function Te(e){return h.has(e.id)}function A(e,t){h.set(e.id,{key:t})}function Re(e){h.delete(e.id)}function y(e){return Te(e)&&er(e)!==null}function ee(e){let t=er(e),r=k(e);if(!t||r===null)return{};let i={};for(let s of t.state.columns){let o=t.buffer.effectiveValue(r,s.field);if(o===null||o==="")continue;if(s.kind==="date"&&n(o)&&!Le.test(o)){i[s.field]=kb(o)||o;continue}i[s.field]=_(o)&&!Array.isArray(o)?o.$ref:o}return i}function De(e){if(e===void 0||e===null)return null;if(Array.isArray(e))return e.map((t)=>n(t)?t:JSON.stringify(t));if(n(e)||Y(e)||Ze(e))return e;return JSON.stringify(e)}function I(e,t){let r=er(e),i=k(e);if(!r||i===null)return;let s=new Set(r.state.columns.map((o)=>o.field));r.buffer.group(()=>{for(let[o,a]of Object.entries(t))if(s.has(o))r.buffer.setCell(i,o,De(a))})}function S(e){let t=er(e),r=k(e),i=t?.state.rows??[],s=r===null?-1:i.findIndex((o)=>o.key===r);return{index:s,next:s===-1?null:i[s+1]?.key??null,previous:s<=0?null:i[s-1]?.key??null,total:i.length}}async function lN(e,t){let{openFileInTab:r}=await (ce("zrqtgt41"),import("./files-zrqtgt41.js"));await r(e);let i=m.tabs.get(e)??null;if(!i||!er(i))return i;if(!h.has(i.id))i.scope.run(()=>{ia(()=>Re(i))});if(h.set(i.id,{row:t}),!i.capabilities.modes.includes(f))i.capabilities.modes.unshift(f);return i.session.ui.canvasMode=f,i.session.ui.preview=!1,Ft(i.id),i}function re(e){return e.doc.sourceFormat==null&&e.doc.mode!=="content"}function Ul(e){if(y(e))return ee(e);return re(e)?e.doc.document:e.doc.content.frontmatter}function Ne(e,t,r){let i=e.doc.document,s=Object.hasOwn(i,t)?Ce(i[t]):void 0,o=r===void 0||r===null||r==="";if(o)delete i[t];else i[t]=r;let a=o?void 0:Ce(r);Bi({forward:{key:t,op:"set-key",path:[],value:a},inverse:{key:t,op:"set-key",path:[],value:s}}),e.doc.dirty=!0,VN()}function H(e,t,r){if(y(e))I(e,{[t]:r});else if(re(e))Ne(e,t,r);else Qd(e,t,r)}function xS(e,t){if(y(e)){I(e,t);return}Z(e,(r)=>{for(let[i,s]of Object.entries(t))H(r,i,s)})}var ne={$schema:"https://jxsuite.com/schema/v1",$id:"StudioEntryEditor",$description:"The Entry editor (site-architecture.md §7.4) — one content entry's fields, in a pane, as a Jx document over the kit. The adapter (`surfaces/entry-editor.ts`) hands in a projection; `content/entry-editor.ts` decides everything in it — which collection the file belongs to, which record its fields live in, which required keys are absent and what a draft flag commits into. The FORM is an island: a schema is `ui/schema-form.ts`'s subject, so this document renders an empty `fields` node and the flow places the element that engine hands back (studio-ui-guidelines.md §9.3, §9.4). That is the whole of the difference between this and the card the lit version drew, and it is why the engine converting in batch 7 is what unblocked this one.",tagName:"div",attributes:{part:"entry","data-jx-region":"${state.region}"},style:{$description:"What `.entry-editor`, `.entry-editor-header`, `.entry-editor-collection`, `.entry-draft-switch`, `.entry-editor-fields`, `.entry-editor-note` and `.entry-editor-empty` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This editor was the only emitter of all seven, so those rules are dead in the stylesheet from here; a central sweep removes them rather than this change, which owns no stylesheet. Every `--spectrum-font-size-*` reference is gone rather than renamed: those names resolve only inside `<sp-theme>`, and a pane editor is mounted outside it, so each would silently have taken its hard-coded fallback.",height:"100%",padding:"var(--jx-space-5)",overflowY:"auto",background:"var(--bg-panel)",'& [part="header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-4)",marginBottom:"var(--jx-space-5)"},'& [part="name"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="collection"]':{padding:"1px var(--jx-space-3)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="draft"]':{$description:"Pushed to the far end of the header rather than placed there: the heading and the collection chip are both content-width, so `margin-left: auto` is what keeps the switch on the right edge whatever the entry is called.",marginLeft:"auto"},'& [part="fields"]':{$description:"The schema form's host is `display: contents`, so its rows are the flex items of THIS box — which is why the column lives here and not inside the engine.",display:"flex",flexDirection:"column"},'& [part="note"]':{margin:"0 0 var(--jx-space-4)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",lineHeight:"1.5"},'& [part="empty"]':{display:"flex",maxWidth:"46ch",flexDirection:"column",alignItems:"flex-start",gap:"var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",lineHeight:"1.5"},'& [part="record-nav"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{tagName:"div",attributes:{part:"stage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/stage"},cases:{entry:{tagName:"div",attributes:{part:"body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"header"},children:[{tagName:"h3",attributes:{part:"name"},textContent:"${state.name}"},{tagName:"span",attributes:{part:"collection"},textContent:"${state.collection}"},{tagName:"div",attributes:{part:"record-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/recordNav"},cases:{shown:{$description:"A record of a file-backed collection (a CSV row): which row of the file this is, the rows either side of it, and the grid that shows them all. A file entry has no neighbours to step to, so it draws none of this.",tagName:"div",attributes:{part:"record-nav",role:"group","aria-label":"Records"},children:[{tagName:"jx-action-button",attributes:{part:"previous"},$props:{size:"sm",quiet:!0,label:"Previous record",hint:"Previous record",disabled:{$ref:"#/state/previousDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showPrevious"},value:[]}]},children:[{tagName:"span",textContent:"‹ Previous"}]},{tagName:"span",attributes:{part:"place"},textContent:"${state.place}"},{tagName:"jx-action-button",attributes:{part:"next"},$props:{size:"sm",quiet:!0,label:"Next record",hint:"Next record",disabled:{$ref:"#/state/nextDisabled"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/showNext"},value:[]}]},children:[{tagName:"span",textContent:"Next ›"}]},{tagName:"jx-action-button",attributes:{part:"grid"},$props:{size:"sm",quiet:!0,label:"Edit in grid",hint:"Every record of the file, as a table"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openGrid"},value:[]}]},children:[{tagName:"span",textContent:"Edit in grid"}]}]}}},{tagName:"div",attributes:{part:"draft-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/draftAxis"},cases:{shown:{$description:"No `label`: the slotted word is on screen and carries the name, so an aria-label would be read twice. The tooltip is `hint`, which is what DRAFT_MEANING has always been.",tagName:"jx-switch",attributes:{part:"draft"},$props:{checked:{$ref:"#/state/draft"},hint:"${state.draftHint}",size:"sm"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDraft"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Draft"}]}}}]},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/noteState"},cases:{shown:{tagName:"p",attributes:{part:"note"},textContent:"${state.note}"}}},{$description:"An island: `ui/schema-form.ts` draws this entry's fields into this node, and nothing in this document knows what a schema is.",tagName:"div",attributes:{part:"fields","data-jx-region":"${state.fieldsRegion}"}}]},empty:{$description:"The mode is reachable from the palette and from `__jxAutomation` on any tab, so this state is real: it names the reason and the fix rather than drawing an empty form.",tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",attributes:{part:"empty-line"},textContent:"${state.emptyLine}"},{tagName:"p",attributes:{part:"note"},children:[{tagName:"span",textContent:"A collection is a "},{tagName:"code",textContent:"content"},{tagName:"span",textContent:" entry in "},{tagName:"code",textContent:"project.json"},{tagName:"span",textContent:" whose "},{tagName:"code",textContent:"source"},{tagName:"span",textContent:" directory contains this file and which declares a "},{tagName:"code",textContent:"schema"},{tagName:"span",textContent:"."}]},{tagName:"jx-action-button",attributes:{part:"content-types"},$props:{label:"Content types",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openContentTypes"},value:[]}]},children:[{tagName:"span",textContent:"Content types…"}]}]}}}]};E("entry-editor",ne);function ie(e,t){e.region=t.region,e.fieldsRegion=t.fieldsRegion,e.stage=t.stage,e.name=t.name,e.collection=t.collection,e.draftAxis=t.draftAxis,e.draft=t.draft,e.draftHint=t.draftHint,e.noteState=t.noteState,e.note=t.note,e.emptyLine=t.emptyLine,e.recordNav=t.recordNav,e.place=t.place,e.previousDisabled=t.previousDisabled,e.nextDisabled=t.nextDisabled}function je(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function oe(e,t,r,i){e.replaceChildren();let s=g({collection:"",draft:!1,draftAxis:"hidden",draftHint:"",emptyLine:"",fieldsRegion:"",name:"",nextDisabled:!0,note:"",noteState:"hidden",openContentTypes:r.openContentTypes,openGrid:r.openGrid,place:"",previousDisabled:!0,recordNav:"hidden",region:"",setDraft:r.setDraft,showNext:r.showNext,showPrevious:r.showPrevious,stage:"empty"});ie(s,t);let o=null,a=!1,l=R("entry-editor",s,e,{onNodeCreated:(c,d,D)=>{if(c instanceof HTMLElement&&je(D)==="fields")i.fieldsSlot(c)}}).then((c)=>{let d=c.root;if(a)return c.dispose(),d;return o=c,d});return{attached:()=>{if(a)return!1;let c=o?.root;return c===void 0?!0:c instanceof HTMLElement&&e.contains(c)},dispose(){a=!0,o?.dispose(),o=null},ready:l,update:(c)=>ie(s,c)}}var M=g(new Map);function se(e,t){M.set(e,t)}function cN(e){return e?M.get(e):void 0}function dN(e){M.delete(e)}function b(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"").replace(/\/+$/,"")}function Oe(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function le(e,t){let r=[];for(let o of e)r.push(b(o));let i=[],s=t?.content??{};for(let o of Object.values(s)){if(!n(o.source)||o.source===""||Oe(o.source))continue;let a=b(o.source),l=a.indexOf($o);if(l!==-1)a=b(a.slice(0,l));if(a===""||a===".")continue;if(![...r,...i].some((d)=>a===d||a.startsWith(`${d}/`)))i.push(a)}return i.length===0?e:[...e,...i]}function ke(e,t){let r=ec(e);if(r===null)return null;if(r===hi)return t===void 0||ih(e,t)?r:null;let i=Gn(e);if(!i||i.name!==r||!i.def.format||i.ext===null)return r;return e.toLowerCase().endsWith(i.ext.toLowerCase())?r:null}var Ae=new Set(["node_modules",".git",".jx",".cache"]);function $e(e){let t=b(e);return t===""||t==="."}async function de(e,t,r=!1){let i;try{i=await $s(()=>t.platform.listDirectory(e))}catch(o){if(!r)t.failures.push({dir:e,error:X(o)});return}let s=[];for(let o of i){if(o.type==="directory"){let l=b(o.path);if(!Ae.has(o.name)&&!$e(l)&&!t.claimed.has(l))t.claimed.add(l),s.push(o.path);continue}let a=At(o.name);t.out.push({collection:ke(o.path,t.pageExtensions),ext:a,locale:jx(o.path,t.i18n)??void 0,media:ra.has(a),modified:o.modified,name:o.name,path:o.path,size:o.size,type:a||"file"})}await Promise.all(s.map((o)=>de(o,t)))}async function xm(e,t,r=new Set,i){let{i18n:s}=ln(C?.projectConfig??{}),o={claimed:new Set,failures:[],i18n:s,out:[],pageExtensions:i,platform:t};await Promise.all(e.map((c)=>{let d=b(c);if(o.claimed.has(d))return Promise.resolve();return o.claimed.add(d),de(c,o,r.has(c))}));let{failures:a,out:l}=o;return l.sort((c,d)=>c.path.localeCompare(d.path)),{failures:a,files:l}}function cT(e,t){let r=e.filter((o)=>o.collection===t.collection),i=t.query.trim().toLowerCase();if(i)r=r.filter((o)=>o.name.toLowerCase().includes(i)||o.path.toLowerCase().includes(i));let s=t.locale?.trim();if(s)r=r.filter((o)=>o.locale===s);return r}var _m=["table","cards","calendar","board"],Ew={board:"Board",calendar:"Calendar",cards:"Cards",table:"Table"};var uN=new Set(["cards"]),Ie=/^(\d{4}-\d{2}-\d{2})/;function dT(e){let t=Ie.exec(e.name);if(t)return t[1];if(e.modified){let r=Rp(new Date(e.modified));if(r)return r}return null}function Eb(){return ln(C?.projectConfig??{}).i18n?.locales??[]}function hN(e){let t=new Set;for(let r of e)if(r.locale)t.add(r.locale);return Eb().filter((r)=>t.has(r))}function pN(e,t=dT){let r=new Map,i=[];for(let o of e){let a=t(o);if(a===null){i.push(o);continue}let l=r.get(a);if(l)l.push(o);else r.set(a,[o])}return{days:[...r.entries()].map(([o,a])=>({date:o,files:a})).toSorted((o,a)=>a.date.localeCompare(o.date)),undated:i}}function _e(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function fN(e){let t=new Map;for(let r of e){let i=_e(r.path),s=t.get(i);if(s)s.push(r);else t.set(i,[r])}return[...t.entries()].map(([r,i])=>({files:i,group:r})).toSorted((r,i)=>r.group.localeCompare(i.group))}function He(e,t,r,i){let s=Sp(e,t),o=s===null?"":t[s]??"",a=Object.values(t).find((l)=>l.trim()!=="");return(o||a||i||`Row ${r+1}`).trim()}function Me(e){let{headers:t,rows:r}=Fd(e);return r.flatMap((i,s)=>i.some((o)=>o.trim()!=="")?[{fields:Object.fromEntries(t.map((o,a)=>[o,i[a]??""])),row:s}]:[])}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}let r=(i)=>_(i)&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).map(([s,o])=>[s,j(o)])):{};if(!Array.isArray(t))return[{fields:r(t),row:0,single:!0}];return t.map((i,s)=>({fields:r(i),row:s}))}function ue(e,t,r){let i=e.toLowerCase(),s=i.endsWith(".csv")?Me(t):i.endsWith(".json")?Ge(t):null;if(s===null)return null;let o=(e.split("/").pop()??e).replace(/\.[^.]+$/,"");return s.map(({fields:a,row:l,single:c},d)=>({fields:a,index:d,row:l,title:He(r,a,d,c?o:"")}))}function fe(e,t){return`${e}#${t+1}`}var G="The Content workspace lists files; it does not edit them in the list. Rename, duplicate or delete from the file's context menu, or open the file to edit it.";function Ve(e){return`field:${e}`}function mN(e){return e.startsWith("field:")?e.slice(6):null}var Je=6,pe=new Set(["image","markdown","html","richtext"]);function V(e){return Ub(mC(e))}function gN(e,t){return Object.entries(e?.properties??{}).filter(([r,i])=>{if(t.has(r)||r===Cs)return!1;if(i.type==="object"||n(i.format)&&pe.has(i.format))return!1;let s=i.items?.format;return i.type!=="array"||i.items?.type==="string"&&!(n(s)&&pe.has(s))}).slice(0,Je).map(([r,i])=>{let s={name:r,title:V(r)};if(i.type==="array")s.list=!0;if(i.type==="number"||i.type==="integer"||i.format==="date"||i.format==="date-time")s.measure=!0;return s})}function ze(e){let t=[{editable:!1,field:"title",kind:"string",title:"Title",widthHint:240},{editable:!1,field:"url",kind:"string",pk:!0,title:"URL",widthHint:200},{editable:!1,field:"template",kind:"string",title:"Template",widthHint:140}];if(e?.status)t.push({editable:!1,field:"status",kind:"string",title:"Status",widthHint:100});if(e?.locale)t.push({editable:!1,field:"locale",kind:"string",title:"Language",widthHint:110});return t.push({editable:!1,field:"modified",kind:"date",title:"Edited",widthHint:120}),t}function uT(e=hi,t){let r=[...t?.locale?[{editable:!1,field:"locale",kind:"string",title:"Locale",widthHint:90}]:[],{editable:!1,field:"modified",kind:"date",title:"Modified",widthHint:160},{editable:!1,field:"path",kind:"readonly",title:"Path",widthHint:320}];if(e===hi)return ze(t);let i=[{editable:!1,field:"title",kind:"string",title:"Title",widthHint:260}];if(t?.status)i.push({editable:!1,field:"status",kind:"string",title:"Status",widthHint:100});if(t?.date)i.push({editable:!1,field:"date",kind:"date",title:"Date",widthHint:120});for(let s of t?.fields??[])i.push({editable:!1,field:Ve(s.name),kind:"string",title:s.title,widthHint:140});return[...i,...r]}function Ke(e){return{cells:{locale:e.locale??null,modified:e.modified??null,status:null,template:null,title:e.name,url:e.collection===hi?yr(e.path).urlPattern:null},key:e.path}}async function Ye(e,t){return(await Promise.all(e.map(async(i)=>{let s=i.collection===null?null:Gn(i.path);if(!s?.fileBacked)return[i];let o;try{o=await t(i.path)}catch{return[i]}let a=ue(i.path,o,s.def.schema);if(a===null)return[i];return a.map((l)=>Be(i,l))}))).flat()}function Be(e,t){return{...e,name:t.title,path:fe(e.path,t.index),record:{fields:t.fields,row:t.row,source:e.path}}}async function We(e){let t=p(),r=await Ye(e.files,(i)=>t.readFile(i));return{...e,files:r}}function bN(e){let t=null,r=null,i=null,s=e??(()=>le(C?.projectDirs??[],C?.projectConfig??null));async function o(){if(t)return t;let a=s(),l=new Set(e?a:C?.projectDirs??[]),c=new Set(a.filter((d)=>!l.has(d)));return r??=Nv().then((d)=>xm(a,p(),c,d)).then(We).then((d)=>(t=d,i=a.join(`
|
|
4
|
+
`),r=null,d)),r}return{capabilities:{delete:!1,insert:!1,remotePaging:!1,remoteSort:!1},columns:()=>Promise.resolve(uT()),commit(a){return Promise.resolve({cells:a.cells.map((l)=>({error:G,field:l.field,ok:!1,rowKey:l.rowKey})),deletes:a.deletes.map((l)=>({error:G,ok:!1,rowKey:l.rowKey})),inserts:a.inserts.map((l)=>({error:G,ok:!1,tempKey:l.tempKey}))})},failures:()=>t?.failures??[],files:()=>t?.files??[],id:$a("content"),label:"Content",async refresh(){t=null,r=null,await o()},async rows(){let a=await o();return{rows:a.files.map((l)=>Ke(l)),total:a.files.length}},scanned:()=>t!==null,stale:()=>t!==null&&i!==s().join(`
|
|
5
|
+
`)}}var qe=[f],T=new Map;function J(e){return T.get(e)??null}function hT(e,t){let r=J(e);return r!==null&&r.tabId===t.id&&r.wrap.isConnected&&r.surface.attached()}function Tw(e){let t=T.get(e);if(!t)return;t.scope.stop(),t.surface.dispose(),T.delete(e)}function Tb(e,t){Z(e,(r)=>H(r,Cs,t))}function vN(e){let t=L(e),r=Ul(e);if(!t||!jc(t.schema,r))return null;let i=Jl(r);return{draft:i,text:i?"Draft":"Published",title:i?Tp:"Not marked a draft."}}function pT(e){return Object.fromEntries(Object.entries(e?.properties??{}).map(([t,r])=>[t,{label:n(r.title)&&r.title!==""?r.title:V(t)}]))}function fT(e){return{fieldKeyPrefix:`entry:${e.id}`,resolvePointer:(t,r)=>Ep(t,{projectConfig:C?.projectConfig??{},scope:r})}}function mT(e,t){return Object.fromEntries(FN(e.schema,t).map((r)=>[r,"Required — this entry does not have one."]))}function L(e){return y(e)?PN(e.documentPath):Fc(e.documentPath)}function gT(e,t,r){let i=Sp(t,r),s=e.properties??{},o=i===null?void 0:s[i];if(i===null||o===void 0)return e;return{...e,properties:{[i]:o,...s}}}function Ue(e){return`${e.documentPath??"This document"} is not an entry of any content collection, so there is no schema to draw a form from.`}function he(e,t,r){let i=Ln(e,"entry"),s=Ln(e,"entry/fields");if(!r)return{collection:"",draft:!1,draftAxis:"hidden",draftHint:Tp,emptyLine:Ue(t),fieldsRegion:s,name:"",nextDisabled:!0,note:"",noteState:"hidden",place:"",previousDisabled:!0,recordNav:"hidden",region:i,stage:"empty"};let o=Ul(t),a=Jl(o),l=y(t),c=S(t);return{collection:r.name,draft:a,draftAxis:jc(r.schema,o)?"shown":"hidden",draftHint:Tp,emptyLine:"",fieldsRegion:s,name:l?Xe(r,o,c.index):t.documentPath?.split("/").pop()??"Untitled",nextDisabled:c.next===null,note:Tp,noteState:a?"shown":"hidden",place:c.index===-1?"":`${c.index+1} of ${c.total}`,previousDisabled:c.previous===null,recordNav:l?"shown":"hidden",region:i,stage:"entry"}}function Xe(e,t,r){let i=Sp(e.schema,t),s=i===null?void 0:t[i];if(n(s)&&s.trim()!=="")return s.trim();return r===-1?"Record":`Row ${r+1}`}function yN(e,t){let{paneId:r,wrap:i}=e;if(hT(r,t))return;Tw(r);let s=null,o=null,a=()=>{if(s!==null&&J(r)===s)c()},l=(u)=>{if(!o||!u)return;let N=Ul(t),z=Gl(`entry:${r}`,gT(u.schema,u.schema,N),N,{context:fT(t),errors:mT(u,N),onChange:(ge)=>xS(t,ge),rerender:a,ui:pT(u.schema)});if(z.parentNode!==o)o.replaceChildren(z)},c=()=>{let u=L(t);if(!u)o=null;s?.surface.update(he(r,t,u)),l(u)},d=me(),D=oe(i,he(r,t,L(t)),{openContentTypes:()=>{ae()?.run("settings.open",{section:"content"})},openGrid:()=>{let{index:u}=S(t);if(u!==-1&&t.documentPath)se(t.documentPath,u);t.session.ui.canvasMode="grid"},setDraft:(u)=>Tb(t,u),showNext:()=>{let{next:u}=S(t);if(u!==null)A(t,u)},showPrevious:()=>{let{previous:u}=S(t);if(u!==null)A(t,u)}},{fieldsSlot:(u)=>{o=u,l(L(t))}});s={paneId:r,scope:d,surface:D,tabId:t.id,wrap:i},T.set(r,s),d.run(()=>{te(()=>{if(J(r)!==s)return;t.doc.document,t.doc.content.frontmatter,C?.projectConfig?.content,c()})})}async function wN(e){let{openFileInTab:t}=await (ce("zrqtgt41"),import("./files-zrqtgt41.js"));await t(e);for(let[r,i]of m.tabs.entries()){if(i.documentPath!==e)continue;for(let s of qe)if(!i.capabilities.modes.includes(s))i.capabilities.modes.unshift(s);return i.session.ui.canvasMode=f,i.session.ui.preview=!1,Ft(r),i}return null}
|
|
6
|
+
export{Sp,wS,sT,kb,aT,Cw,aN,lT,kw,lN,Ul,xS,cN,dN,xm,cT,_m,Ew,uN,dT,Eb,hN,pN,fN,mN,gN,uT,bN,hT,Tw,Tb,vN,pT,fT,mT,gT,yN,wN};
|
|
7
7
|
|
|
8
|
-
//# debugId=
|
|
9
|
-
//# sourceMappingURL=studio-
|
|
8
|
+
//# debugId=66DE3D0E0D534F9764756E2164756E21
|
|
9
|
+
//# sourceMappingURL=studio-z3fztxrp.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{p0,pf,ff,mf,f0,ag,su,Fv,gf,zI,Rh,cg,XM,Pa}from"./studio-nzemfbkk.js";import{p}from"./studio-4fnb5648.js";import{gh,Vp}from"./studio-hh394phe.js";import{_v}from"./studio-knsjyx7n.js";import{jt,fn}from"./studio-q9hx2qp0.js";import{Ne}from"./studio-n9qba0gx.js";import{mx}from"./studio-xva3hzkv.js";import{Fr}from"./studio-hfqpfmpk.js";import{fh,dv,Gd,uv,hv,mh}from"./studio-acer0g8w.js";import{C}from"./studio-4f7thq0p.js";import{n,Q,_,v,cd}from"./studio-k3we3kqb.js";function w(e,t){return new URL(`/node_modules/${e}`,t).href}function g(e){if(e===void 0)return!1;if(n(e))return!e.includes("${");if(Array.isArray(e))return e.every((t)=>g(t));if(v(e))return!("$ref"in e)&&!("$prototype"in e)&&!("$expression"in e)&&Object.values(e).every((t)=>g(t));return!0}function uS(e){let t=new Map;for(let[s,r]of Object.entries(e.state??{})){if(cd(s)||!v(r)||!Array.isArray(r.examples))continue;let[o]=r.examples;if(g(o))t.set(s,o)}return t}var k={body:"body",root:":root"};function R(e,t,s,r,o=k){let l=[],a=(i,c)=>{let d={mediaQueries:t,scope:c,transposeValue:s};if(r)d.resolveValue=(m,h)=>r(m,h,c);for(let m of ag(i,d))l.push(m.text)},S={},y={},x=[],b=[];for(let[i,c]of Object.entries(e)){if(_(c)&&!Array.isArray(c)){if(i.startsWith("@"))x.push([i,c]);else if(!i.startsWith("--"))b.push([i,c]);continue}if(f0(i)||i.startsWith("@"))continue;if(i.startsWith("--")||i==="colorScheme"||i==="color-scheme")S[i]=c;else y[i]=c}a(S,o.root),a(y,o.body);for(let[i,c]of b)if(i.startsWith("&"))a({[i]:c},o.root);else a(c,i);for(let[i,c]of x){if(p0(i)||pf(i)){a({[i]:c},null);continue}let d={},m={},h=[];for(let[u,f]of Object.entries(c)){if(_(f)&&!Array.isArray(f)){if(!u.startsWith("@"))h.push([u,f]);continue}if(u.startsWith("--"))d[u]=f;else m[u]=f}a({[i]:d},o.root),a({[i]:m},o.body);for(let[u,f]of h)a({[i]:f},u)}if(Object.values(t).some((i)=>mf(i)!==null)&&!("colorScheme"in e))l.push(`${o.root} { color-scheme: light dark }`,`${o.root}:where([${ff}="light"]) { color-scheme: light }`,`${o.root}:where([${ff}="dark"]) { color-scheme: dark }`);return l.join(`
|
|
2
|
+
`)}var T={body:":host",root:":host"},P=new WeakMap,J=new WeakMap;function A(e){let t=e.replaceAll(/:root\b/g,":host").replaceAll(/(^|[\s,>+~(])(?:html|body)(?![\w-])/g,"$1:host").replaceAll(/:host(?:\s*>?\s*:host)+/g,":host");return t===e?null:t}function j(e){for(let t=0;t<e.cssRules.length;t+=1){let s=e.cssRules[t],r=s instanceof CSSStyleRule?A(s.selectorText):null;if(s instanceof CSSStyleRule&&r!==null){let l=`${r}${s.cssText.slice(s.cssText.indexOf("{"))}`;try{e.insertRule(l,t),e.deleteRule(t+1)}catch{}}let o=e.cssRules[t];if(o instanceof CSSGroupingRule)j(o)}}function D(e){let t=[];for(let s of e??[]){if(!_(s)||String(s.tagName).toLowerCase()!=="link")continue;let{href:r,rel:o}=s.attributes??{};if(n(r)&&r!==""&&n(o)&&o.split(/\s+/).includes("stylesheet"))t.push(r)}return t}async function M(e){let t=hv(e,"project.json");try{let s=await fetch(t);if(!s.ok)return null;let r=new URL(t,location.href).href,o=new CSSStyleSheet({baseURL:r});return o.replaceSync(await s.text()),j(o),o}catch{return null}}async function L(e){let s=(await Promise.all(D(e.$head).map((o)=>M(o)))).filter((o)=>o!==null),{style:r}=e;if(_(r)){let o=new CSSStyleSheet;o.replaceSync(R(r,e.$media??{},(l)=>l,void 0,T)),s.push(o)}return s}function E(){let e=C?.projectConfig;if(!e||!Q(globalThis.CSSStyleSheet))return Promise.resolve([]);let t=P.get(e);if(!t)t=L(e).then((s)=>(J.set(e,s),s)),P.set(e,t);return t}function iN(){let e=C?.projectConfig;return(e&&J.get(e))??[]}var H=150;function yw(e=H){let t=new Map;function s(){for(let[r,o]of t){if(t.size<=e)break;t.delete(r),o.remove()}}return{clear(){for(let r of t.values())r.remove();t.clear()},get(r){let o=t.get(r);if(o!==void 0)t.delete(r),t.set(r,o);return o},has:(r)=>t.has(r),keys:()=>[...t.keys()],set(r,o){t.delete(r),t.set(r,o),s()},size:()=>t.size}}function O(e){let t=Gd(C?.projectRoot);return URL.canParse(t)?new URL(e,t).href:location.href}async function N(e){try{let t=await p().readFile(e);su(!0);let s=uv(e,mh());await jt();let r;if(fn(e))r=(await Fr(e,t)).document;else r=JSON.parse(t);return await F(r,e,s)}catch{return null}}async function F(e,t,s){su(!0),Fv(dv());let r=await Rh(e,{},O(t)),o=s&&{...s,revisions:Vp(),versions:gh()};zI((l)=>_v(l,o));try{let l=Pa(e,r);return l instanceof HTMLElement?l:null}finally{zI(null)}}async function W(e,t){let s=await XE(t);if(!s)return null;let r=uS(s);return await hS(s,t,r)?mx(e,r):null}async function XE(e){try{let t=JSON.parse(await p().readFile(e));return _(t)&&!Array.isArray(t)?t:null}catch{return null}}async function hS(e,t,s){let r=null;try{su(!0),Fv(dv());let o=await Rh(e,{},O(t));for(let[S,y]of s)o[S]=y;let l=!1;cg(()=>{l=!0});let{stop:a}=gf(()=>Pa({...e,tagName:"div"},o));return r=a,!l}catch{return!1}finally{cg(null),r?.()}}function V(e){return e.source!=="npm"&&(e.path?.endsWith(".json")??!1)}async function ww(e,t){let s=t.get(e);if(s)return s;let r;try{XM((l)=>w(l,`${fh()}/`)),await E();let o=Ne.find((l)=>l.path===e);if(o&&V(o))r=await W(o,e);else r=o?await mx(o):await N(e)}catch{return}if(!r)return;return t.set(e,r),r}function _p(e){if(!Q(globalThis.IntersectionObserver))return{destroy(){},observe:(r)=>e(r),releaseDetached:()=>0};let t=new Set,s=new IntersectionObserver((r)=>{for(let o of r)if(o.isIntersecting)t.delete(o.target),s.unobserve(o.target),e(o.target)},{rootMargin:"200px"});return{destroy(){s.disconnect(),t.clear()},observe(r){if(t.has(r))return;t.add(r),s.observe(r)},releaseDetached(){let r=0;for(let o of t)if(!o.isConnected)t.delete(o),s.unobserve(o),r+=1;return r}}}
|
|
3
|
+
export{uS,iN,yw,XE,hS,ww,_p};
|
|
4
|
+
|
|
5
|
+
//# debugId=1F63FE53C2A6F9CC64756E2164756E21
|
|
6
|
+
//# sourceMappingURL=studio-z9453ypn.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hp,wa,C_,Ed,Un,xe}from"./studio-eqcddvc2.js";import{_0}from"./studio-egnjpyde.js";import{pR}from"./studio-k0xzrse2.js";class z{constructor(o,e){this._modeId=o,this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){if(this._worker)this._worker.dispose(),this._worker=null;this._client=null}async _updateExtraLibs(){if(!this._worker)return;let o=++this._updateExtraLibsToken,e=await this._worker.getProxy();if(this._updateExtraLibsToken!==o)return;e.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){if(!this._client)this._client=(async()=>{if(this._worker=_0({moduleId:"vs/language/typescript/tsWorker",createWorker:()=>new Worker(new URL("ts.worker.js",import.meta.url),{type:"module"}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync())return await this._worker.withSyncedResources(Un.getModels().filter((o)=>o.getLanguageId()===this._modeId).map((o)=>o.uri));return await this._worker.getProxy()})();return this._client}async getLanguageServiceWorker(...o){let e=await this._getClient();if(this._worker)await this._worker.withSyncedResources(o);return e}}var i={};i["lib.d.ts"]=!0;i["lib.decorators.d.ts"]=!0;i["lib.decorators.legacy.d.ts"]=!0;i["lib.dom.asynciterable.d.ts"]=!0;i["lib.dom.d.ts"]=!0;i["lib.dom.iterable.d.ts"]=!0;i["lib.es2015.collection.d.ts"]=!0;i["lib.es2015.core.d.ts"]=!0;i["lib.es2015.d.ts"]=!0;i["lib.es2015.generator.d.ts"]=!0;i["lib.es2015.iterable.d.ts"]=!0;i["lib.es2015.promise.d.ts"]=!0;i["lib.es2015.proxy.d.ts"]=!0;i["lib.es2015.reflect.d.ts"]=!0;i["lib.es2015.symbol.d.ts"]=!0;i["lib.es2015.symbol.wellknown.d.ts"]=!0;i["lib.es2016.array.include.d.ts"]=!0;i["lib.es2016.d.ts"]=!0;i["lib.es2016.full.d.ts"]=!0;i["lib.es2016.intl.d.ts"]=!0;i["lib.es2017.arraybuffer.d.ts"]=!0;i["lib.es2017.d.ts"]=!0;i["lib.es2017.date.d.ts"]=!0;i["lib.es2017.full.d.ts"]=!0;i["lib.es2017.intl.d.ts"]=!0;i["lib.es2017.object.d.ts"]=!0;i["lib.es2017.sharedmemory.d.ts"]=!0;i["lib.es2017.string.d.ts"]=!0;i["lib.es2017.typedarrays.d.ts"]=!0;i["lib.es2018.asyncgenerator.d.ts"]=!0;i["lib.es2018.asynciterable.d.ts"]=!0;i["lib.es2018.d.ts"]=!0;i["lib.es2018.full.d.ts"]=!0;i["lib.es2018.intl.d.ts"]=!0;i["lib.es2018.promise.d.ts"]=!0;i["lib.es2018.regexp.d.ts"]=!0;i["lib.es2019.array.d.ts"]=!0;i["lib.es2019.d.ts"]=!0;i["lib.es2019.full.d.ts"]=!0;i["lib.es2019.intl.d.ts"]=!0;i["lib.es2019.object.d.ts"]=!0;i["lib.es2019.string.d.ts"]=!0;i["lib.es2019.symbol.d.ts"]=!0;i["lib.es2020.bigint.d.ts"]=!0;i["lib.es2020.d.ts"]=!0;i["lib.es2020.date.d.ts"]=!0;i["lib.es2020.full.d.ts"]=!0;i["lib.es2020.intl.d.ts"]=!0;i["lib.es2020.number.d.ts"]=!0;i["lib.es2020.promise.d.ts"]=!0;i["lib.es2020.sharedmemory.d.ts"]=!0;i["lib.es2020.string.d.ts"]=!0;i["lib.es2020.symbol.wellknown.d.ts"]=!0;i["lib.es2021.d.ts"]=!0;i["lib.es2021.full.d.ts"]=!0;i["lib.es2021.intl.d.ts"]=!0;i["lib.es2021.promise.d.ts"]=!0;i["lib.es2021.string.d.ts"]=!0;i["lib.es2021.weakref.d.ts"]=!0;i["lib.es2022.array.d.ts"]=!0;i["lib.es2022.d.ts"]=!0;i["lib.es2022.error.d.ts"]=!0;i["lib.es2022.full.d.ts"]=!0;i["lib.es2022.intl.d.ts"]=!0;i["lib.es2022.object.d.ts"]=!0;i["lib.es2022.regexp.d.ts"]=!0;i["lib.es2022.string.d.ts"]=!0;i["lib.es2023.array.d.ts"]=!0;i["lib.es2023.collection.d.ts"]=!0;i["lib.es2023.d.ts"]=!0;i["lib.es2023.full.d.ts"]=!0;i["lib.es2023.intl.d.ts"]=!0;i["lib.es2024.arraybuffer.d.ts"]=!0;i["lib.es2024.collection.d.ts"]=!0;i["lib.es2024.d.ts"]=!0;i["lib.es2024.full.d.ts"]=!0;i["lib.es2024.object.d.ts"]=!0;i["lib.es2024.promise.d.ts"]=!0;i["lib.es2024.regexp.d.ts"]=!0;i["lib.es2024.sharedmemory.d.ts"]=!0;i["lib.es2024.string.d.ts"]=!0;i["lib.es5.d.ts"]=!0;i["lib.es6.d.ts"]=!0;i["lib.esnext.array.d.ts"]=!0;i["lib.esnext.collection.d.ts"]=!0;i["lib.esnext.d.ts"]=!0;i["lib.esnext.decorators.d.ts"]=!0;i["lib.esnext.disposable.d.ts"]=!0;i["lib.esnext.error.d.ts"]=!0;i["lib.esnext.float16.d.ts"]=!0;i["lib.esnext.full.d.ts"]=!0;i["lib.esnext.intl.d.ts"]=!0;i["lib.esnext.iterator.d.ts"]=!0;i["lib.esnext.promise.d.ts"]=!0;i["lib.esnext.sharedmemory.d.ts"]=!0;i["lib.scripthost.d.ts"]=!0;i["lib.webworker.asynciterable.d.ts"]=!0;i["lib.webworker.d.ts"]=!0;i["lib.webworker.importscripts.d.ts"]=!0;i["lib.webworker.iterable.d.ts"]=!0;function M(o,e,n=0){if(typeof o==="string")return o;else if(o===void 0)return"";let c="";if(n){c+=e;for(let r=0;r<n;r++)c+=" "}if(c+=o.messageText,n++,o.next)for(let r of o.next)c+=M(r,e,n);return c}function v(o){if(o)return o.map((e)=>e.text).join("");return""}class b{constructor(o){this._worker=o}_textSpanToRange(o,e){let n=o.getPositionAt(e.start),c=o.getPositionAt(e.start+e.length),{lineNumber:r,column:s}=n,{lineNumber:d,column:t}=c;return{startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t}}}class A{constructor(o){this._worker=o,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(o){if(!o)return!1;if(o.path.indexOf("/lib.")===0)return!!i[o.path.slice(1)];return!1}getOrCreateModel(o){let e=Ed.parse(o),n=Un.getModel(e);if(n)return n;if(this.isLibFile(e)&&this._hasFetchedLibFiles)return Un.createModel(this._libFiles[e.path.slice(1)],"typescript",e);let c=pR.getExtraLibs()[o];if(c)return Un.createModel(c.content,"typescript",e);return null}_containsLibFile(o){for(let e of o)if(this.isLibFile(e))return!0;return!1}async fetchLibFilesIfNecessary(o){if(!this._containsLibFile(o))return;await this._fetchLibFiles()}_fetchLibFiles(){if(!this._fetchLibFilesPromise)this._fetchLibFilesPromise=this._worker().then((o)=>o.getLibFiles()).then((o)=>{this._hasFetchedLibFiles=!0,this._libFiles=o});return this._fetchLibFilesPromise}}class C extends b{constructor(o,e,n,c){super(c);this._libFiles=o,this._defaults=e,this._selector=n,this._disposables=[],this._listener=Object.create(null);let r=(t)=>{if(t.getLanguageId()!==n)return;let l=()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u){if(t.isAttachedToEditor())this._doValidate(t)}else this._doValidate(t)},p,g=t.onDidChangeContent(()=>{clearTimeout(p),p=window.setTimeout(l,500)}),m=t.onDidChangeAttached(()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u)if(t.isAttachedToEditor())l();else Un.setModelMarkers(t,this._selector,[])});this._listener[t.uri.toString()]={dispose(){g.dispose(),m.dispose(),clearTimeout(p)}},l()},s=(t)=>{Un.setModelMarkers(t,this._selector,[]);let l=t.uri.toString();if(this._listener[l])this._listener[l].dispose(),delete this._listener[l]};this._disposables.push(Un.onDidCreateModel((t)=>r(t))),this._disposables.push(Un.onWillDisposeModel(s)),this._disposables.push(Un.onDidChangeModelLanguage((t)=>{s(t.model),r(t.model)})),this._disposables.push({dispose(){for(let t of Un.getModels())s(t)}});let d=()=>{for(let t of Un.getModels())s(t),r(t)};this._disposables.push(this._defaults.onDidChange(d)),this._disposables.push(this._defaults.onDidExtraLibsChange(d)),Un.getModels().forEach((t)=>r(t))}dispose(){this._disposables.forEach((o)=>o&&o.dispose()),this._disposables=[]}async _doValidate(o){let e=await this._worker(o.uri);if(o.isDisposed())return;let n=[],{noSyntaxValidation:c,noSemanticValidation:r,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();if(!c)n.push(e.getSyntacticDiagnostics(o.uri.toString()));if(!r)n.push(e.getSemanticDiagnostics(o.uri.toString()));if(!s)n.push(e.getSuggestionDiagnostics(o.uri.toString()));let d=await Promise.all(n);if(!d||o.isDisposed())return;let t=d.reduce((p,g)=>g.concat(p),[]).filter((p)=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(p.code)===-1),l=t.map((p)=>p.relatedInformation||[]).reduce((p,g)=>g.concat(p),[]).map((p)=>p.file?Ed.parse(p.file.fileName):null);if(await this._libFiles.fetchLibFilesIfNecessary(l),o.isDisposed())return;Un.setModelMarkers(o,this._selector,t.map((p)=>this._convertDiagnostics(o,p)))}_convertDiagnostics(o,e){let n=e.start||0,c=e.length||1,{lineNumber:r,column:s}=o.getPositionAt(n),{lineNumber:d,column:t}=o.getPositionAt(n+c),l=[];if(e.reportsUnnecessary)l.push(C_.Unnecessary);if(e.reportsDeprecated)l.push(C_.Deprecated);return{severity:this._tsDiagnosticCategoryToMarkerSeverity(e.category),startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t,message:M(e.messageText,`
|
|
2
2
|
`),code:e.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(o,e.relatedInformation)}}_convertRelatedInformation(o,e){if(!e)return[];let n=[];return e.forEach((c)=>{let r=o;if(c.file)r=this._libFiles.getOrCreateModel(c.file.fileName);if(!r)return;let s=c.start||0,d=c.length||1,{lineNumber:t,column:l}=r.getPositionAt(s),{lineNumber:p,column:g}=r.getPositionAt(s+d);n.push({resource:r.uri,startLineNumber:t,startColumn:l,endLineNumber:p,endColumn:g,message:M(c.messageText,`
|
|
3
|
-
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return
|
|
3
|
+
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return wa.Error;case 3:return wa.Info;case 0:return wa.Warning;case 2:return wa.Hint}return wa.Info}}class x extends b{get triggerCharacters(){return["."]}async provideCompletionItems(o,e,n,c){let r=o.getWordUntilPosition(e),s=new hp(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn),d=o.uri,t=o.getOffsetAt(e),l=await this._worker(d);if(o.isDisposed())return;let p=await l.getCompletionsAtPosition(d.toString(),t);if(!p||o.isDisposed())return;return{suggestions:p.entries.map((m)=>{let u=s;if(m.replacementSpan){let k=o.getPositionAt(m.replacementSpan.start),y=o.getPositionAt(m.replacementSpan.start+m.replacementSpan.length);u=new hp(k.lineNumber,k.column,y.lineNumber,y.column)}let w=[];if(m.kindModifiers!==void 0&&m.kindModifiers.indexOf("deprecated")!==-1)w.push(xe.CompletionItemTag.Deprecated);return{uri:d,position:e,offset:t,range:u,label:m.name,insertText:m.name,sortText:m.sortText,kind:x.convertKind(m.kind),tags:w}})}}async resolveCompletionItem(o,e){let n=o,{uri:c,position:r,offset:s}=n,t=await(await this._worker(c)).getCompletionEntryDetails(c.toString(),s,n.label);if(!t)return n;return{uri:c,position:r,label:t.name,kind:x.convertKind(t.kind),detail:v(t.displayParts),documentation:{value:x.createDocumentationString(t)}}}static convertKind(o){switch(o){case a.primitiveType:case a.keyword:return xe.CompletionItemKind.Keyword;case a.variable:case a.localVariable:return xe.CompletionItemKind.Variable;case a.memberVariable:case a.memberGetAccessor:case a.memberSetAccessor:return xe.CompletionItemKind.Field;case a.function:case a.memberFunction:case a.constructSignature:case a.callSignature:case a.indexSignature:return xe.CompletionItemKind.Function;case a.enum:return xe.CompletionItemKind.Enum;case a.module:return xe.CompletionItemKind.Module;case a.class:return xe.CompletionItemKind.Class;case a.interface:return xe.CompletionItemKind.Interface;case a.warning:return xe.CompletionItemKind.File}return xe.CompletionItemKind.Property}static createDocumentationString(o){let e=v(o.documentation);if(o.tags)for(let n of o.tags)e+=`
|
|
4
4
|
|
|
5
|
-
${R(n)}`;return e}}function R(o){let e=`*@${o.name}*`;if(o.name==="param"&&o.text){let[n,...c]=o.text;if(e+=`\`${n.text}\``,c.length>0)e+=` — ${c.map((r)=>r.text).join(" ")}`}else if(Array.isArray(o.text))e+=` — ${o.text.map((n)=>n.text).join(" ")}`;else if(o.text)e+=` — ${o.text}`;return e}class L extends b{constructor(){super(...arguments);this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(o){switch(o.triggerKind){case
|
|
5
|
+
${R(n)}`;return e}}function R(o){let e=`*@${o.name}*`;if(o.name==="param"&&o.text){let[n,...c]=o.text;if(e+=`\`${n.text}\``,c.length>0)e+=` — ${c.map((r)=>r.text).join(" ")}`}else if(Array.isArray(o.text))e+=` — ${o.text.map((n)=>n.text).join(" ")}`;else if(o.text)e+=` — ${o.text}`;return e}class L extends b{constructor(){super(...arguments);this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(o){switch(o.triggerKind){case xe.SignatureHelpTriggerKind.TriggerCharacter:if(o.triggerCharacter)if(o.isRetrigger)return{kind:"retrigger",triggerCharacter:o.triggerCharacter};else return{kind:"characterTyped",triggerCharacter:o.triggerCharacter};else return{kind:"invoked"};case xe.SignatureHelpTriggerKind.ContentChange:return o.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};case xe.SignatureHelpTriggerKind.Invoke:default:return{kind:"invoked"}}}async provideSignatureHelp(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getSignatureHelpItems(r.toString(),s,{triggerReason:L._toSignatureHelpTriggerReason(c)});if(!t||o.isDisposed())return;let l={activeSignature:t.selectedItemIndex,activeParameter:t.argumentIndex,signatures:[]};return t.items.forEach((p)=>{let g={label:"",parameters:[]};g.documentation={value:v(p.documentation)},g.label+=v(p.prefixDisplayParts),p.parameters.forEach((m,u,w)=>{let k=v(m.displayParts),y={label:k,documentation:{value:v(m.documentation)}};if(g.label+=k,g.parameters.push(y),u<w.length-1)g.label+=v(p.separatorDisplayParts)}),g.label+=v(p.suffixDisplayParts),l.signatures.push(g)}),{value:l,dispose(){}}}}class S extends b{async provideHover(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getQuickInfoAtPosition(c.toString(),r);if(!d||o.isDisposed())return;let t=v(d.documentation),l=d.tags?d.tags.map((g)=>R(g)).join(`
|
|
6
6
|
|
|
7
7
|
`):"",p=v(d.displayParts);return{range:this._textSpanToRange(o,d.textSpan),contents:[{value:"```typescript\n"+p+"\n```\n"},{value:t+(l?`
|
|
8
8
|
|
|
9
|
-
`+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?
|
|
9
|
+
`+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?xe.DocumentHighlightKind.Write:xe.DocumentHighlightKind.Text})))}}class T extends b{constructor(o,e){super(e);this._libFiles=o}async provideDefinition(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDefinitionAtPosition(c.toString(),r);if(!d||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(d.map((l)=>Ed.parse(l.fileName))),o.isDisposed())return;let t=[];for(let l of d){let p=this._libFiles.getOrCreateModel(l.fileName);if(p)t.push({uri:p.uri,range:this._textSpanToRange(p,l.textSpan)})}return t}}class D extends b{constructor(o,e){super(e);this._libFiles=o}async provideReferences(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getReferencesAtPosition(r.toString(),s);if(!t||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(t.map((p)=>Ed.parse(p.fileName))),o.isDisposed())return;let l=[];for(let p of t){let g=this._libFiles.getOrCreateModel(p.fileName);if(g)l.push({uri:g.uri,range:this._textSpanToRange(g,p.textSpan)})}return l}}class j extends b{async provideDocumentSymbols(o,e){let n=o.uri,c=await this._worker(n);if(o.isDisposed())return;let r=await c.getNavigationTree(n.toString());if(!r||o.isDisposed())return;let s=(t,l)=>({name:t.text,detail:"",kind:h[t.kind]||xe.SymbolKind.Variable,range:this._textSpanToRange(o,t.spans[0]),selectionRange:this._textSpanToRange(o,t.spans[0]),tags:[],children:t.childItems?.map((g)=>s(g,t.text)),containerName:l});return r.childItems?r.childItems.map((t)=>s(t)):[]}}class a{}a.unknown="";a.keyword="keyword";a.script="script";a.module="module";a.class="class";a.interface="interface";a.type="type";a.enum="enum";a.variable="var";a.localVariable="local var";a.function="function";a.localFunction="local function";a.memberFunction="method";a.memberGetAccessor="getter";a.memberSetAccessor="setter";a.memberVariable="property";a.constructorImplementation="constructor";a.callSignature="call";a.indexSignature="index";a.constructSignature="construct";a.parameter="parameter";a.typeParameter="type parameter";a.primitiveType="primitive type";a.label="label";a.alias="alias";a.const="const";a.let="let";a.warning="warning";var h=Object.create(null);h[a.module]=xe.SymbolKind.Module;h[a.class]=xe.SymbolKind.Class;h[a.enum]=xe.SymbolKind.Enum;h[a.interface]=xe.SymbolKind.Interface;h[a.memberFunction]=xe.SymbolKind.Method;h[a.memberVariable]=xe.SymbolKind.Property;h[a.memberGetAccessor]=xe.SymbolKind.Property;h[a.memberSetAccessor]=xe.SymbolKind.Property;h[a.variable]=xe.SymbolKind.Variable;h[a.const]=xe.SymbolKind.Variable;h[a.localVariable]=xe.SymbolKind.Variable;h[a.variable]=xe.SymbolKind.Variable;h[a.function]=xe.SymbolKind.Function;h[a.localFunction]=xe.SymbolKind.Function;class f extends b{static _convertOptions(o){return{ConvertTabsToSpaces:o.insertSpaces,TabSize:o.tabSize,IndentSize:o.tabSize,IndentStyle:2,NewLineCharacter:`
|
|
10
10
|
`,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(o,e){return{text:e.newText,range:this._textSpanToRange(o,e.span)}}}class q extends f{constructor(){super(...arguments);this.canFormatMultipleRanges=!1}async provideDocumentRangeFormattingEdits(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getFormattingEditsForRange(r.toString(),s,d,f._convertOptions(n));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class B extends f{get autoFormatTriggerCharacters(){return[";","}",`
|
|
11
|
-
`]}async provideOnTypeFormattingEdits(o,e,n,c,r){let s=o.uri,d=o.getOffsetAt(e),t=await this._worker(s);if(o.isDisposed())return;let l=await t.getFormattingEditsAfterKeystroke(s.toString(),d,n,f._convertOptions(c));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class F extends f{async provideCodeActions(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=f._convertOptions(o.getOptions()),l=n.markers.filter((u)=>u.code).map((u)=>u.code).map(Number),p=await this._worker(r);if(o.isDisposed())return;let g=await p.getCodeFixesAtPosition(r.toString(),s,d,l,t);if(!g||o.isDisposed())return{actions:[],dispose:()=>{}};return{actions:g.filter((u)=>u.changes.filter((w)=>w.isNewFile).length===0).map((u)=>this._tsCodeFixActionToMonacoCodeAction(o,n,u)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(o,e,n){let c=[];for(let s of n.changes)for(let d of s.textChanges)c.push({resource:o.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(o,d.span),text:d.newText}});return{title:n.description,edit:{edits:c},diagnostics:e.markers,kind:"quickfix"}}}class E extends b{constructor(o,e){super(e);this._libFiles=o}async provideRenameEdits(o,e,n,c){let r=o.uri,s=r.toString(),d=o.getOffsetAt(e),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getRenameInfo(s,d,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw Error("Renaming files is not supported.");let p=await t.findRenameLocations(s,d,!1,!1,!1);if(!p||o.isDisposed())return;let g=[];for(let m of p){let u=this._libFiles.getOrCreateModel(m.fileName);if(u)g.push({resource:u.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(u,m.textSpan),text:n}});else throw Error(`Unknown file ${m.fileName}.`)}return{edits:g}}}class N extends b{async provideInlayHints(o,e,n){let c=o.uri,r=c.toString(),s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(c);if(o.isDisposed())return null;return{hints:(await t.provideInlayHints(r,s,d)).map((g)=>({...g,label:g.text,position:o.getPositionAt(g.position),kind:this._convertHintKind(g.kind)})),dispose:()=>{}}}_convertHintKind(o){switch(o){case"Parameter":return
|
|
11
|
+
`]}async provideOnTypeFormattingEdits(o,e,n,c,r){let s=o.uri,d=o.getOffsetAt(e),t=await this._worker(s);if(o.isDisposed())return;let l=await t.getFormattingEditsAfterKeystroke(s.toString(),d,n,f._convertOptions(c));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class F extends f{async provideCodeActions(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=f._convertOptions(o.getOptions()),l=n.markers.filter((u)=>u.code).map((u)=>u.code).map(Number),p=await this._worker(r);if(o.isDisposed())return;let g=await p.getCodeFixesAtPosition(r.toString(),s,d,l,t);if(!g||o.isDisposed())return{actions:[],dispose:()=>{}};return{actions:g.filter((u)=>u.changes.filter((w)=>w.isNewFile).length===0).map((u)=>this._tsCodeFixActionToMonacoCodeAction(o,n,u)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(o,e,n){let c=[];for(let s of n.changes)for(let d of s.textChanges)c.push({resource:o.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(o,d.span),text:d.newText}});return{title:n.description,edit:{edits:c},diagnostics:e.markers,kind:"quickfix"}}}class E extends b{constructor(o,e){super(e);this._libFiles=o}async provideRenameEdits(o,e,n,c){let r=o.uri,s=r.toString(),d=o.getOffsetAt(e),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getRenameInfo(s,d,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw Error("Renaming files is not supported.");let p=await t.findRenameLocations(s,d,!1,!1,!1);if(!p||o.isDisposed())return;let g=[];for(let m of p){let u=this._libFiles.getOrCreateModel(m.fileName);if(u)g.push({resource:u.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(u,m.textSpan),text:n}});else throw Error(`Unknown file ${m.fileName}.`)}return{edits:g}}}class N extends b{async provideInlayHints(o,e,n){let c=o.uri,r=c.toString(),s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(c);if(o.isDisposed())return null;return{hints:(await t.provideInlayHints(r,s,d)).map((g)=>({...g,label:g.text,position:o.getPositionAt(g.position),kind:this._convertHintKind(g.kind)})),dispose:()=>{}}}_convertHintKind(o){switch(o){case"Parameter":return xe.InlayHintKind.Parameter;case"Type":return xe.InlayHintKind.Type;default:return xe.InlayHintKind.Type}}}var W,H;function Ot(o){H=O(o,"typescript")}function _t(o){W=O(o,"javascript")}function Pt(){return new Promise((o,e)=>{if(!W)return e("JavaScript not registered!");o(W)})}function Vt(){return new Promise((o,e)=>{if(!H)return e("TypeScript not registered!");o(H)})}function O(o,e){let n=[],c=new z(e,o),r=(...t)=>c.getLanguageServiceWorker(...t),s=new A(r);function d(){let{modeConfiguration:t}=o;if(_(n),t.completionItems)n.push(xe.registerCompletionItemProvider(e,new x(r)));if(t.signatureHelp)n.push(xe.registerSignatureHelpProvider(e,new L(r)));if(t.hovers)n.push(xe.registerHoverProvider(e,new S(r)));if(t.documentHighlights)n.push(xe.registerDocumentHighlightProvider(e,new I(r)));if(t.definitions)n.push(xe.registerDefinitionProvider(e,new T(s,r)));if(t.references)n.push(xe.registerReferenceProvider(e,new D(s,r)));if(t.documentSymbols)n.push(xe.registerDocumentSymbolProvider(e,new j(r)));if(t.rename)n.push(xe.registerRenameProvider(e,new E(s,r)));if(t.documentRangeFormattingEdits)n.push(xe.registerDocumentRangeFormattingEditProvider(e,new q(r)));if(t.onTypeFormattingEdits)n.push(xe.registerOnTypeFormattingEditProvider(e,new B(r)));if(t.codeActions)n.push(xe.registerCodeActionProvider(e,new F(r)));if(t.inlayHints)n.push(xe.registerInlayHintsProvider(e,new N(r)));if(t.diagnostics)n.push(new C(s,o,e,r))}return d(),r}function _(o){while(o.length)o.pop().dispose()}export{b as Adapter,F as CodeActionAdaptor,T as DefinitionAdapter,C as DiagnosticsAdapter,I as DocumentHighlightAdapter,q as FormatAdapter,f as FormatHelper,B as FormatOnTypeAdapter,N as InlayHintsAdapter,a as Kind,A as LibFiles,j as OutlineAdapter,S as QuickInfoAdapter,D as ReferenceAdapter,E as RenameAdapter,L as SignatureHelpAdapter,x as SuggestAdapter,z as WorkerManager,M as flattenDiagnosticMessageText,Pt as getJavaScriptWorker,Vt as getTypeScriptWorker,_t as setupJavaScript,Ot as setupTypeScript};
|
|
12
12
|
|
|
13
|
-
//# debugId=
|
|
14
|
-
//# sourceMappingURL=tsMode-
|
|
13
|
+
//# debugId=9030420828D5214B64756E2164756E21
|
|
14
|
+
//# sourceMappingURL=tsMode-jg1dtphj.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{fi,Xm,yI,m,h,qr,pn,Da,Sr,Qm,i1,o1,oc,eg,tg,r1,s1,a1,ng,Sh,rc,Yp,bl,l1,Si,td,c1,wI,Cv,r0,xI,eu,_I,SI,Ft,kv,CI,kI}from"./studio-knsjyx7n.js";import"./studio-swedpd82.js";import"./studio-sce30r7b.js";import"./studio-q9hx2qp0.js";import"./studio-4fnb5648.js";import"./studio-nvcn2ykc.js";export{yI as MAX_PANES,fi as PRIMARY_PANE,Xm as SECONDARY_PANE,Ft as activateTab,qr as activePane,h as activeTab,l1 as clearPaneActiveTab,_I as closeAllTabs,eg as closePane,eu as closeTab,ng as detachTab,Sr as focusPane,Sh as insertIntoPane,Qm as isPaneFocused,Yp as isTabActive,xI as moveTab,kv as moveTabToPane,Si as openTab,o1 as paneBeside,pn as paneById,tg as paneIsEmpty,Da as paneOfTab,c1 as promoteDirtyPreviewTabs,td as promoteTab,oc as receivingPane,kI as registerTabCommands,CI as renameTab,SI as replaceAllTabs,a1 as setCloseLanding,wI as setEditBesideDocument,s1 as setEmptyPaneFallback,r0 as setTabPinned,r1 as setTabScope,rc as setWorkspaceProject,i1 as splitRight,Cv as tabHoldsEditBesideDocument,bl as tabIsLive,m as workspace};
|
|
2
|
+
|
|
3
|
+
//# debugId=325891B045F9C5F964756E2164756E21
|
|
4
|
+
//# sourceMappingURL=workspace-6ztqcrsh.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{jP,z_,uE,hE,W_,ob,pE}from"./studio-j5fcp6gj.js";import"./studio-2kpxm0eh.js";import"./studio-2pk7kc7z.js";import"./studio-xx3r3sb0.js";import"./studio-2x972v58.js";import"./studio-z9453ypn.js";import"./studio-1ctnw3xv.js";import"./studio-z3fztxrp.js";import"./studio-nwf0c32p.js";import"./studio-cqxj4fcy.js";import"./studio-4bgvvzhv.js";import"./studio-a88ej93p.js";import"./studio-qrzmfaf6.js";import"./studio-2zz4qbv9.js";import"./studio-daksw8kh.js";import"./studio-frc16j8v.js";import"./studio-hfqpfmpk.js";import"./studio-9gr7xs9r.js";import"./studio-mrjtnm62.js";import"./studio-k2evngrj.js";import"./studio-jma2q8r9.js";import"./studio-v7a7yb5w.js";import"./studio-3pz4t5a2.js";import"./studio-rr00ex23.js";import"./studio-xpx91fby.js";import"./studio-r6mx7vm5.js";import"./studio-xva3hzkv.js";import"./studio-n9qba0gx.js";import"./studio-pwctzka3.js";import"./studio-g9brbewz.js";import"./studio-90zkgne5.js";import"./studio-61rg2cz5.js";import"./studio-tpxcryf2.js";import"./studio-5tet77de.js";import"./studio-bnc50f9h.js";import"./studio-4zd6an2b.js";import"./studio-acer0g8w.js";import"./studio-wqfaqw4m.js";import"./studio-hh394phe.js";import"./studio-knsjyx7n.js";import"./studio-swedpd82.js";import"./studio-9c6cbq2c.js";import"./studio-sce30r7b.js";import"./studio-q9hx2qp0.js";import"./studio-4fnb5648.js";import"./studio-9dq7rwc7.js";import"./studio-nzemfbkk.js";import"./studio-nvcn2ykc.js";import"./studio-1410q5dw.js";import"./studio-1ks5d9y4.js";import"./studio-k1wvtp03.js";export{jP as WORKSPACE_HOME_MODE_SET,ob as detachWorkspaceHome,z_ as isWorkspaceHomeMode,uE as openWorkspaceHome,hE as placeWorkspaceHome,pE as renderWorkspaceHome,W_ as workspaceHomeMounted};
|
|
2
|
+
|
|
3
|
+
//# debugId=CBDAE9980CBB9F4664756E2164756E21
|
|
4
|
+
//# sourceMappingURL=workspace-home-rse9h8a0.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Yk,is,Qa,Zk,br,_t,el,zo,tl,Xo,Dt,nl,$u,fp,Td,WR,VR,UR,Xk,Qk}from"./studio-3na1r48j.js";import{Qy}from"./studio-0x6f3nk9.js";var x=30000;class I extends Yk{constructor(e){super();this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let r=$u();if(this.getLocalState()!==null&&x/2<=r-this.meta.get(this.clientID).lastUpdated)this.setLocalState(this.getLocalState());let s=[];if(this.meta.forEach((o,c)=>{if(c!==this.clientID&&x<=r-o.lastUpdated&&this.states.has(c))s.push(c)}),s.length>0)L(this,s,"timeout")},is(x/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let r=this.clientID,s=this.meta.get(r),o=s===void 0?0:s.clock+1,c=this.states.get(r);if(e===null)this.states.delete(r);else this.states.set(r,e);this.meta.set(r,{clock:o,lastUpdated:$u()});let a=[],d=[],y=[],f=[];if(e===null)f.push(r);else if(c==null){if(e!=null)a.push(r)}else if(d.push(r),!fp(c,e))y.push(r);if(a.length>0||y.length>0||f.length>0)this.emit("change",[{added:a,updated:y,removed:f},"local"]);this.emit("update",[{added:a,updated:d,removed:f},"local"])}setLocalStateField(e,r){let s=this.getLocalState();if(s!==null)this.setLocalState({...s,[e]:r})}getStates(){return this.states}}var L=(e,r,s)=>{let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(e.states.has(a)){if(e.states.delete(a),a===e.clientID){let d=e.meta.get(a);e.meta.set(a,{clock:d.clock+1,lastUpdated:$u()})}o.push(a)}}if(o.length>0)e.emit("change",[{added:[],updated:[],removed:o},s]),e.emit("update",[{added:[],updated:[],removed:o},s])},M=(e,r,s=e.states)=>{let o=r.length,c=Qa();_t(c,o);for(let a=0;a<o;a++){let d=r[a],y=s.get(d)||null,f=e.meta.get(d).clock;_t(c,d),_t(c,f),el(c,JSON.stringify(y))}return br(c)};var F=(e,r,s)=>{let o=tl(r),c=$u(),a=[],d=[],y=[],f=[],U=Dt(o);for(let b=0;b<U;b++){let h=Dt(o),g=Dt(o),S=JSON.parse(nl(o)),v=e.meta.get(h),k=e.states.get(h),w=v===void 0?0:v.clock;if(w<g||w===g&&S===null&&e.states.has(h)){if(S===null)if(h===e.clientID&&e.getLocalState()!=null)g++;else e.states.delete(h);else e.states.set(h,S);if(e.meta.set(h,{clock:g,lastUpdated:c}),v===void 0&&S!==null)a.push(h);else if(v!==void 0&&S===null)f.push(h);else if(S!==null){if(!fp(S,k))y.push(h);d.push(h)}}}if(a.length>0||y.length>0||f.length>0)e.emit("change",[{added:a,updated:y,removed:f},s]);if(a.length>0||d.length>0||f.length>0)e.emit("update",[{added:a,updated:d,removed:f},s])};var W=0,D=1,R=2,j=(e,r)=>{_t(e,W);let s=UR(r);zo(e,s)},H=(e,r,s)=>{_t(e,D),zo(e,VR(r,s))},B=(e,r,s)=>H(r,s,Xo(e)),N=(e,r,s,o)=>{try{WR(r,Xo(e),s)}catch(c){if(o!=null)o(c);console.error("Caught error while handling a Yjs update",c)}},J=(e,r)=>{_t(e,R),zo(e,r)},z=N,_=(e,r,s,o,c)=>{let a=Dt(e);switch(a){case W:B(e,r,s);break;case D:N(e,s,o,c);break;case R:z(e,s,o,c);break;default:throw Error("Unknown message type")}return a};var K=1;function se(e){let r=e.webSocketImpl??globalThis.WebSocket,s=e.openTimeoutMs??1e4,o=new Map,c=new Set,a=new Td,d=new I(a);d.setLocalState(null);let y=null,f=null,U="connecting",b=!1,h=(n)=>{if(U===n)return;U=n;for(let t of c)t(n)},g=(n)=>{if(y&&y.readyState===K)try{y.send(Xk(n))}catch{}},S=(n)=>{g({message:{path:n,type:"open"},type:"control"})};d.on("update",(n,t)=>{if(t==="remote")return;let l=[...n.added,...n.updated,...n.removed];g({body:M(d,l),type:"awareness"})});let v=(n)=>{switch(n.type){case"hello":{let t={color:n.color,login:n.login,permission:n.permission};if(n.name!==void 0)t.name=n.name;if(n.avatarUrl!==void 0)t.avatarUrl=n.avatarUrl;f=t;return}case"opened":{let t=o.get(n.path);if(!t)return;if(t.opened&&t.epoch!==n.epoch){w(n.path,t);return}t.epoch=n.epoch,t.opened=!0,t.resolveOpen?.(!0),t.resolveOpen=null;let l=Qa();j(l,t.doc),g({body:br(l),epoch:t.epoch,path:n.path,type:"doc-sync"});return}case"doc-reset":{let t=o.get(n.path);if(t)w(n.path,t);return}case"flush-ack":{let t=o.get(n.path);if(t){for(let l of t.pendingFlush)l();t.pendingFlush.clear()}return}case"doc-dirty":{let t=o.get(n.path);if(t){t.dirty=n.dirty;for(let l of t.dirtyCbs)l(n.dirty)}return}case"error":{if(!n.path)return;let t=o.get(n.path);if(!t)return;if(n.code==="content-not-loaded"&&e.hydratePath&&!t.hydrated){t.hydrated=!0,e.hydratePath(n.path).then(()=>S(n.path),()=>{t.resolveOpen?.(!1),t.resolveOpen=null});return}if(!t.opened)t.resolveOpen?.(!1),t.resolveOpen=null;break}default:break}},k=(n,t,l)=>{let u=o.get(n);if(!u||!u.opened||u.epoch!==t)return;let i=tl(l),m=Qa(),T=_(i,m,u.doc,"remote");if(Zk(m)>0)g({body:br(m),epoch:t,path:n,type:"doc-sync"});if(T===D&&!u.synced)u.synced=!0,u.resolveSynced()},w=(n,t)=>{o.delete(n),t.resolveOpen?.(!1),t.resolveOpen=null;for(let l of t.resetCbs)l();t.doc.destroy()},P=()=>{h("connecting");let n=e.protocols,t=n===void 0||n.length===0?new r(e.url):new r(e.url,n);y=t,t.binaryType="arraybuffer",t.onopen=()=>{O.opened(),h("connected");for(let u of o.keys())S(u);if(d.getLocalState()!==null)g({body:M(d,[d.clientID]),type:"awareness"})},t.onmessage=(l)=>{let u=l.data,i=u instanceof ArrayBuffer?new Uint8Array(u):u instanceof Uint8Array?u:null;if(!i)return;let m;try{m=Qk(i)}catch{return}switch(m.type){case"control":{v(m.message);return}case"doc-sync":{k(m.path,m.epoch,m.body);return}case"awareness":{F(d,m.body,"remote");break}default:break}},t.onclose=()=>{if(b)return;h("offline");for(let l of o.values())l.opened=!1;O.scheduleRetry()},t.onerror=()=>{}},A={};if(e.reconnectDelayMs!==void 0)A.baseMs=e.reconnectDelayMs;if(e.reconnectRandom!==void 0)A.random=e.reconnectRandom;let O=Qy(P,A);return P(),{destroy(){if(b)return;b=!0,O.dispose(),L(d,[d.clientID],"destroy"),d.destroy(),a.destroy();for(let[n,t]of o)t.resolveOpen?.(!1),t.doc.destroy(),o.delete(n);y?.close()},async openDoc(n){if(b)return null;let t=o.get(n);if(t&&!t.handleDestroyed)return null;let l=()=>{},u=new Promise((p)=>{l=p}),i={dirty:!1,dirtyCbs:new Set,doc:new Td,epoch:0,handleDestroyed:!1,hydrated:!1,opened:!1,pendingFlush:new Set,resetCbs:new Set,resolveOpen:null,resolveSynced:l,synced:!1,whenSynced:u};if(o.set(n,i),i.doc.on("update",(p,V)=>{if(V==="remote"||!i.opened)return;let C=Qa();J(C,p),g({body:br(C),epoch:i.epoch,path:n,type:"doc-sync"})}),!await new Promise((p)=>{i.resolveOpen=p;let V=setTimeout(()=>{i.resolveOpen=null,p(!1)},s);i.resolveOpen=(C)=>{clearTimeout(V),p(C)},S(n)})){if(o.get(n)===i)o.delete(n);return i.doc.destroy(),null}return{awareness:d,destroy:()=>{if(i.handleDestroyed)return;if(i.handleDestroyed=!0,o.get(n)===i)o.delete(n),g({path:n,type:"doc-close"});i.doc.destroy()},doc:i.doc,flush:()=>new Promise((p)=>{i.pendingFlush.add(p),g({message:{path:n,type:"flush"},type:"control"})}),identity:()=>f,onDirty:(p)=>(i.dirtyCbs.add(p),p(i.dirty),()=>i.dirtyCbs.delete(p)),onReset:(p)=>(i.resetCbs.add(p),()=>i.resetCbs.delete(p)),onStatus:(p)=>(c.add(p),()=>c.delete(p)),whenSynced:i.whenSynced}},status:()=>U}}export{se as createWsCollabConnection};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
4
|
-
//# sourceMappingURL=ws-client-
|
|
3
|
+
//# debugId=A6B7FFCBD3BA89FB64756E2164756E21
|
|
4
|
+
//# sourceMappingURL=ws-client-arz2qsy9.js.map
|