@stacksjs/stx 0.2.794 → 0.2.798
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/{chunk-d6arvs57.js → chunk-0beyn8ak.js} +5 -5
- package/dist/{chunk-5a92srn2.js → chunk-0gsq8gps.js} +1 -1
- package/dist/chunk-0xnvjw7s.js +2 -0
- package/dist/chunk-1wyccmsr.js +2 -0
- package/dist/{chunk-7pk3t82j.js → chunk-20yz8bjp.js} +2 -2
- package/dist/{chunk-h0jnatd4.js → chunk-2ws2qe1k.js} +2 -2
- package/dist/{chunk-ssh2gycr.js → chunk-2z2bq2at.js} +3 -3
- package/dist/chunk-31qjy9xr.js +2 -0
- package/dist/chunk-33devn0s.js +2 -0
- package/dist/{chunk-c0ejyxfj.js → chunk-33vr7x2t.js} +3 -3
- package/dist/chunk-33wpv2n1.js +2 -0
- package/dist/{chunk-wk6xsyv3.js → chunk-3mby4nes.js} +3 -3
- package/dist/chunk-3p5gxc6t.js +2 -0
- package/dist/{chunk-j6255z7f.js → chunk-3x598qjt.js} +4 -4
- package/dist/chunk-4hgz9dkv.js +2 -0
- package/dist/{chunk-rrb9m2q2.js → chunk-4sesw88b.js} +5 -5
- package/dist/{chunk-94gyfwpz.js → chunk-4v50nafp.js} +14 -14
- package/dist/chunk-5kc9kjaa.js +2 -0
- package/dist/{chunk-vav9ktgm.js → chunk-5wwcgze3.js} +2 -2
- package/dist/chunk-5xd53dwe.js +2 -0
- package/dist/chunk-5y6518h8.js +2 -0
- package/dist/chunk-5y77pe7b.js +2 -0
- package/dist/chunk-6a97a9wk.js +2 -0
- package/dist/{chunk-5j619xgb.js → chunk-6b5zhtb3.js} +2 -2
- package/dist/chunk-6hre8cg4.js +2 -0
- package/dist/{chunk-4s5q1aea.js → chunk-6m4y5dh5.js} +6 -6
- package/dist/chunk-6pyweb05.js +2 -0
- package/dist/chunk-6tp7ys77.js +2 -0
- package/dist/chunk-6zxzr20d.js +2 -0
- package/dist/chunk-75ctpxr3.js +2 -0
- package/dist/{chunk-w9nwb8r3.js → chunk-7bxnjr3b.js} +7 -7
- package/dist/chunk-7gw96jpj.js +2 -0
- package/dist/chunk-7m4eesp0.js +2 -0
- package/dist/chunk-7na8bets.js +2 -0
- package/dist/{chunk-kr8qdg0r.js → chunk-7yb82rm6.js} +2 -2
- package/dist/{chunk-e3wmnjz8.js → chunk-810r5dk3.js} +3 -3
- package/dist/{chunk-e0wxcst7.js → chunk-89jn2jmf.js} +4 -4
- package/dist/{chunk-488kx8j5.js → chunk-8bzq2z0m.js} +5 -5
- package/dist/chunk-8k2n6abg.js +2 -0
- package/dist/chunk-8vqs94f3.js +2 -0
- package/dist/{chunk-dhqp3z4w.js → chunk-91htcq62.js} +2 -2
- package/dist/chunk-9736003n.js +2 -0
- package/dist/{chunk-agtvdtx4.js → chunk-9b6896tb.js} +2 -2
- package/dist/{chunk-y0pqpch2.js → chunk-9k6tza24.js} +7 -7
- package/dist/chunk-9w33k6f7.js +2 -0
- package/dist/{chunk-enep9r03.js → chunk-9x62j5f0.js} +52 -52
- package/dist/{chunk-b4r7d6me.js → chunk-a1ba9d2r.js} +5 -5
- package/dist/{chunk-efrc97by.js → chunk-a20wq8wf.js} +4 -4
- package/dist/{chunk-t3ptzpfc.js → chunk-a3xqfyb6.js} +2 -2
- package/dist/chunk-ag8j9ec2.js +2 -0
- package/dist/chunk-ak15dt1a.js +2 -0
- package/dist/{chunk-27rzdq3n.js → chunk-akcyaxwv.js} +2 -2
- package/dist/{chunk-w5hhqjwr.js → chunk-aw6369cx.js} +1 -1
- package/dist/chunk-b5ck6epd.js +177 -0
- package/dist/chunk-b98743ja.js +2 -0
- package/dist/{chunk-14ft0zc7.js → chunk-b9d70mgr.js} +6 -6
- package/dist/chunk-bskxswmn.js +2 -0
- package/dist/chunk-bv5h4etd.js +2 -0
- package/dist/chunk-c7x3bmvs.js +2 -0
- package/dist/{chunk-2gqhfge6.js → chunk-c84pxd2k.js} +2 -2
- package/dist/chunk-camm2hcx.js +2 -0
- package/dist/chunk-cd2wda5c.js +2 -0
- package/dist/chunk-cv6pqg85.js +2 -0
- package/dist/chunk-cy0mab8y.js +2 -0
- package/dist/chunk-d554f2fj.js +2 -0
- package/dist/chunk-dd1vqndp.js +2 -0
- package/dist/{chunk-0r61tkfe.js → chunk-ddhkhhc7.js} +2 -2
- package/dist/{chunk-9tqa8xvf.js → chunk-dsnggn3g.js} +2 -2
- package/dist/chunk-e14v1q9c.js +2 -0
- package/dist/{chunk-2m5h2mtr.js → chunk-e37g6ezw.js} +41 -41
- package/dist/chunk-e3xw2bzh.js +2 -0
- package/dist/{chunk-nps2whkz.js → chunk-eegb7f3t.js} +6 -6
- package/dist/chunk-eeztqt6f.js +2 -0
- package/dist/{chunk-1y9ez7nz.js → chunk-ef3w5thv.js} +2 -2
- package/dist/chunk-eh528njb.js +2 -0
- package/dist/chunk-en0wry1c.js +20 -0
- package/dist/chunk-eszpqrxy.js +2 -0
- package/dist/{chunk-2p4yad7w.js → chunk-fp0ew9n4.js} +4 -4
- package/dist/chunk-fyxkzs9c.js +2 -0
- package/dist/{chunk-d18xd9x5.js → chunk-gjf8cjdt.js} +3 -3
- package/dist/{chunk-7gdwvnwc.js → chunk-gvnfb6s2.js} +2 -2
- package/dist/{chunk-fpn4dren.js → chunk-gzfvj15b.js} +1 -1
- package/dist/chunk-hb4jkdfr.js +2 -0
- package/dist/{chunk-qp3xd98j.js → chunk-hg9mwgnr.js} +2 -2
- package/dist/{chunk-8q63njnd.js → chunk-hmt0vqhb.js} +1 -1
- package/dist/{chunk-v8rfeev5.js → chunk-hp9e8nz6.js} +2 -2
- package/dist/chunk-hzps1xya.js +2 -0
- package/dist/{chunk-985afhhy.js → chunk-j3st59hv.js} +2 -2
- package/dist/{chunk-7sartb04.js → chunk-jde0shn4.js} +2 -2
- package/dist/{chunk-15ckxpq7.js → chunk-jeprxn45.js} +6 -6
- package/dist/{chunk-bwcj9z19.js → chunk-jt0yn7ab.js} +4 -4
- package/dist/chunk-k8gpvg0w.js +2 -0
- package/dist/chunk-kgn911k7.js +2 -0
- package/dist/{chunk-jdj1358b.js → chunk-kj8dvzpc.js} +2 -2
- package/dist/chunk-km8c0j9g.js +2 -0
- package/dist/{chunk-w6taxq7d.js → chunk-mj3hzy1e.js} +5 -5
- package/dist/{chunk-66b56g2z.js → chunk-nw0v655w.js} +6 -6
- package/dist/{chunk-6v4b0xc1.js → chunk-p1mghe1h.js} +6 -6
- package/dist/{chunk-pa9zfbh6.js → chunk-p2a6dwj6.js} +6 -6
- package/dist/chunk-pw89m3re.js +2 -0
- package/dist/chunk-q38vjqv2.js +2 -0
- package/dist/{chunk-yyr7vb7k.js → chunk-q3ma4khe.js} +5 -5
- package/dist/{chunk-ne69yaak.js → chunk-q7q9e0gj.js} +10 -10
- package/dist/{chunk-kce6pzmj.js → chunk-qef2vv0m.js} +3 -3
- package/dist/{chunk-q14d714d.js → chunk-qjbpa1n4.js} +4 -4
- package/dist/{chunk-5gppagt3.js → chunk-qm2wmqre.js} +1 -1
- package/dist/{chunk-605b93pe.js → chunk-qpvwxppw.js} +4 -4
- package/dist/{chunk-8nb8b0nf.js → chunk-qxt6hdat.js} +1 -1
- package/dist/{chunk-1hajf3wc.js → chunk-r6d6jphq.js} +21 -21
- package/dist/chunk-rbv6fxtx.js +3 -0
- package/dist/chunk-rrketemm.js +2 -0
- package/dist/chunk-rwys552r.js +3 -0
- package/dist/chunk-s0bx4gjh.js +2 -0
- package/dist/{chunk-gv3bfkdm.js → chunk-s14jcqdf.js} +5 -5
- package/dist/{chunk-es006emk.js → chunk-s3fmmm98.js} +3 -3
- package/dist/chunk-s8s7b7rv.js +2 -0
- package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
- package/dist/{chunk-3gn1t0pa.js → chunk-sprgkk9j.js} +31 -31
- package/dist/chunk-sywqa4da.js +2 -0
- package/dist/{chunk-gb65t4n1.js → chunk-t65tn8ee.js} +2 -2
- package/dist/{chunk-vrbcdds3.js → chunk-trjhz9d9.js} +1 -1
- package/dist/chunk-txrbz95y.js +2 -0
- package/dist/{chunk-h0c6jtrj.js → chunk-v9hm1xv6.js} +5 -5
- package/dist/{chunk-bmfk3b29.js → chunk-w0zayhmg.js} +2 -2
- package/dist/{chunk-tnn0br4w.js → chunk-w58bnt44.js} +3 -3
- package/dist/chunk-w7681v48.js +2 -0
- package/dist/chunk-w7wz670a.js +2 -0
- package/dist/{chunk-epcy3r18.js → chunk-wp6bdac7.js} +113 -105
- package/dist/{chunk-8ztgy5y4.js → chunk-x8ckxemg.js} +107 -107
- package/dist/{chunk-74rf78w8.js → chunk-x8h81amr.js} +2 -2
- package/dist/{chunk-hh9t97hr.js → chunk-xa36escd.js} +3 -3
- package/dist/{chunk-7fr038wx.js → chunk-xskswvef.js} +4 -4
- package/dist/chunk-xzgtdcbg.js +2 -0
- package/dist/{chunk-k4bdf0dw.js → chunk-y9bj3566.js} +2 -2
- package/dist/chunk-yfdb3x3p.js +2 -0
- package/dist/{chunk-qv85c3qy.js → chunk-yv4dwdhc.js} +2 -2
- package/dist/{chunk-1stvxcjv.js → chunk-z1aq59qj.js} +3 -3
- package/dist/{chunk-nwbq8qvb.js → chunk-z1fb5k3h.js} +1305 -449
- package/dist/{chunk-tnkxww7b.js → chunk-z8wfvqbk.js} +5 -5
- package/dist/chunk-z9a80qqg.js +2 -0
- package/dist/chunk-za5kx15m.js +2 -0
- package/dist/{chunk-8e23zh2y.js → chunk-zbv8e4rq.js} +2 -2
- package/dist/{chunk-v1z6n7wz.js → chunk-znx5m1jv.js} +4 -4
- package/dist/{chunk-6pt4158p.js → chunk-zqsacq3r.js} +1 -1
- package/dist/{chunk-rgz797k3.js → chunk-zsy145ac.js} +3 -3
- package/dist/{chunk-j56mg28d.js → chunk-zx8tnhfr.js} +3 -3
- package/dist/cli.js +19 -19
- package/dist/client/signals-authoring-runtime.js +6 -3
- package/dist/client/signals-binding-utils-runtime.js +2 -4
- package/dist/client/signals-component-props-runtime.js +8 -2
- package/dist/client/signals-expression-compiler-runtime.js +1 -1
- package/dist/client/signals-for-runtime.js +34 -0
- package/dist/client/signals-handler-runtime.js +68 -24
- package/dist/client/signals-helpers-runtime.js +51 -0
- package/dist/client/signals-native-row-runtime.d.ts +26 -0
- package/dist/client/signals-native-row-runtime.js +661 -0
- package/dist/client/signals-pipe-runtime.js +16 -0
- package/dist/client/signals-process-element-runtime.js +305 -287
- package/dist/client/signals-proxy-runtime.js +56 -31
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/accessibility.js +8 -0
- package/dist/native/compiler/bundle.js +1 -1
- package/dist/native/compiler/inline-style.js +93 -4
- package/dist/native/compiler/style-variables.js +9 -1
- package/dist/native/event-names.js +1 -0
- package/dist/native/prop-names.js +9 -1
- package/dist/native/runtime/binding-tree.d.ts +2 -0
- package/dist/native/runtime/binding-tree.js +12 -1
- package/dist/native/runtime/craft-bridge.js +66 -0
- package/dist/native/runtime/craft.d.ts +78 -2
- package/dist/native/runtime/native-host.d.ts +2 -0
- package/dist/native/runtime/native-host.js +315 -91
- package/dist/native-build.js +2 -23
- package/dist/pwa.js +3 -3
- package/dist/signals.d.ts +13 -10
- package/dist/signals.js +5 -3
- package/dist/ssg.js +15 -15
- package/dist/stx-virtual-ts.d.ts +25 -1
- package/dist/stx-virtual-ts.js +109 -6
- package/dist/typecheck.d.ts +3 -1
- package/dist/typecheck.js +28 -11
- package/package.json +6 -6
- package/dist/chunk-0675z8hj.js +0 -177
- package/dist/chunk-1brkqd5f.js +0 -2
- package/dist/chunk-1ds97d9m.js +0 -2
- package/dist/chunk-1tvb2stj.js +0 -2
- package/dist/chunk-2vxh8b8g.js +0 -2
- package/dist/chunk-33na85q2.js +0 -2
- package/dist/chunk-3t4t655h.js +0 -2
- package/dist/chunk-43ynckvh.js +0 -2
- package/dist/chunk-4v22nj67.js +0 -2
- package/dist/chunk-5v5w0cd2.js +0 -2
- package/dist/chunk-699t603m.js +0 -2
- package/dist/chunk-6f6xqzhb.js +0 -2
- package/dist/chunk-7mrr4ke5.js +0 -2
- package/dist/chunk-7tzzzvdg.js +0 -2
- package/dist/chunk-8a5txj4f.js +0 -2
- package/dist/chunk-8pphy0p1.js +0 -2
- package/dist/chunk-8rmb79zw.js +0 -2
- package/dist/chunk-8rwnzmvb.js +0 -2
- package/dist/chunk-90pxjq62.js +0 -2
- package/dist/chunk-9s4ggstz.js +0 -2
- package/dist/chunk-9wmjmas8.js +0 -2
- package/dist/chunk-9xdz8r73.js +0 -2
- package/dist/chunk-agvykxs8.js +0 -2
- package/dist/chunk-ajj56vrw.js +0 -2
- package/dist/chunk-ay4ep67v.js +0 -2
- package/dist/chunk-bwfncfe1.js +0 -3
- package/dist/chunk-cdsv4yrv.js +0 -2
- package/dist/chunk-d5e47gr4.js +0 -2
- package/dist/chunk-d910ytt2.js +0 -2
- package/dist/chunk-d9p7xaj7.js +0 -2
- package/dist/chunk-dsrn2vgp.js +0 -2
- package/dist/chunk-fkkdt6sj.js +0 -2
- package/dist/chunk-fpw03bhv.js +0 -2
- package/dist/chunk-fxy0cq7h.js +0 -2
- package/dist/chunk-g6smtcc0.js +0 -2
- package/dist/chunk-g747k4gg.js +0 -3
- package/dist/chunk-gryrg1c0.js +0 -2
- package/dist/chunk-gvj862m1.js +0 -2
- package/dist/chunk-h5nrnen8.js +0 -2
- package/dist/chunk-hagk74x6.js +0 -2
- package/dist/chunk-hv0whj8t.js +0 -2
- package/dist/chunk-k2brrhf8.js +0 -2
- package/dist/chunk-k6ncb5qm.js +0 -2
- package/dist/chunk-kn38mjpp.js +0 -2
- package/dist/chunk-kvmpc0sg.js +0 -2
- package/dist/chunk-nbjgytem.js +0 -2
- package/dist/chunk-nf2bzqaw.js +0 -2
- package/dist/chunk-nt7wqqax.js +0 -2
- package/dist/chunk-pq1qs7bp.js +0 -2
- package/dist/chunk-pvw58x2j.js +0 -20
- package/dist/chunk-qk9v0emh.js +0 -2
- package/dist/chunk-qnj444zc.js +0 -2
- package/dist/chunk-qzb0v08n.js +0 -2
- package/dist/chunk-s1wdzttg.js +0 -2
- package/dist/chunk-sq0qc9sk.js +0 -2
- package/dist/chunk-th5afzmv.js +0 -2
- package/dist/chunk-tktkj2dc.js +0 -2
- package/dist/chunk-vgzfsh1z.js +0 -2
- package/dist/chunk-wmh4yxcs.js +0 -2
- package/dist/chunk-wr3adhd8.js +0 -2
- package/dist/chunk-xmae29mn.js +0 -2
- package/dist/chunk-zdwnzq78.js +0 -2
- package/dist/chunk-zssf9fdg.js +0 -2
- package/dist/chunk-zyf6737j.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fl,gl,ml}from"./chunk-gb65t4n1.js";import{le,Vn,Un,bo,Gr,Jr,Wn,qn,wo,Yr}from"./chunk-9tqa8xvf.js";function W(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},M=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=M(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,M=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(M(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(M(),n))},z=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)z(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)z(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,H)=>{O=setTimeout(()=>{if(C)C.abort();H(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let D=m.fetch||((L,j)=>fetch(L,j)),H={method:"GET",headers:{Accept:"application/json"}};if(b)H.cache="no-cache";if(C)H.signal=C.signal;A=D(w,H).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((j)=>{throw Error(j&&(j.error||j.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:M,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(M(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
|
|
3
|
-
`),
|
|
2
|
+
import{ml,hl,yl}from"./chunk-t65tn8ee.js";import{le,Vn,Un,vo,Jr,Yr,Wn,qn,xo,Zr}from"./chunk-dsnggn3g.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,h=(p)=>r.get?r.get(p):p,a=()=>h(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let f=o(),t=r.set?r.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let f=e.subscribe((t,i)=>p(h(t),h(i)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>h(a.error),a.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,h)=>y().then((a)=>new Promise((p,f)=>{let t=a.transaction("kv",u),i=h(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>s("readonly",(h)=>h.get(u)),set:(u,h)=>s("readwrite",(a)=>{a.put(h,u)}),remove:(u)=>s("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>s("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,h=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,f=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return i;let n=Array.from(f.entries());return f.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?h(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let C=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,V=()=>{C.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),V()})};if(!S)W(E);let xt=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),V(),!b)W(E)},St=(w,b)=>{let T=m.timeoutMs||15000,I=typeof AbortController<"u"?new AbortController:null,O=null,H=new Promise((D,F)=>{O=setTimeout(()=>{if(I)I.abort();F(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:I?I.signal:void 0});else if(b){let D=m.fetch||((L,j)=>fetch(L,j)),F={method:"GET",headers:{Accept:"application/json"}};if(w)F.cache="no-cache";if(I)F.signal=I.signal;A=D(b,F).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((j)=>{throw Error(j&&(j.error||j.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(C());return Promise.race([A,H]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),I=()=>{if(b!==R)return Promise.resolve(C());if(x++,q.set(!0),c===0&&!M())U.set(!0);let H=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return St(w,T).then((A)=>{if(b!==R||T!==N())return H(),C();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),V(),H(),C()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return H(),C()})},O=`${b} ${T||""}`;return w?v.fresh(O,I):v.run(O,I)},B={data:C,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(xt(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(C());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),V()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);V()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let a={key:s,promise:h};l.push(a);let p=()=>{let f=l.indexOf(a);if(f!==-1)l.splice(f,1)};return h.then(p,p),h};return{run(s,u){for(let h of l)if(o(h.key,s))return h.promise;for(let h of r)if(o(h.key,s))return h.promise;return y(s,u)},fresh(s,u){for(let f of r)if(o(f.key,s))return f.promise;let h=l.filter((f)=>o(f.key,s)).map((f)=>f.promise);if(!h.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(a);if(f!==-1)r.splice(f,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),h=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:f}=await u.read();if(p)break;if(a+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
3
|
+
`),a.length>1048576)throw Error("Broadcast frame too large");let t;while((t=a.indexOf(`
|
|
4
4
|
|
|
5
|
-
`))!==-1){let
|
|
5
|
+
`))!==-1){let i=a.slice(0,t);a=a.slice(t+2);let g=i.split(`
|
|
6
6
|
`).filter((_)=>_.startsWith("data:")).map((_)=>_.slice(5).trimStart()).join(`
|
|
7
|
-
`);if(!g)continue;let m=JSON.parse(g);if(typeof m.channel==="string"&&typeof m.event==="string")e.onMessage(m)}}}finally{await u.cancel().catch(()=>{}),u.releaseLock()}}catch{}finally{if(e.onStatus?.(!1),!
|
|
7
|
+
`);if(!g)continue;let m=JSON.parse(g);if(typeof m.channel==="string"&&typeof m.event==="string")e.onMessage(m)}}}finally{await u.cancel().catch(()=>{}),u.releaseLock()}}catch{}finally{if(e.onStatus?.(!1),!o)r=setTimeout(y,Math.min((e.reconnectDelay??1000)*2**d++,30000))}}return y(),{close(){if(o=!0,l?.abort(),r)clearTimeout(r);e.onStatus?.(!1)}}}var re=` function useColorMode(options) {
|
|
8
8
|
options = options || {};
|
|
9
9
|
// The pre-paint boot script (stacksjs/stx#1794) publishes the app's
|
|
10
10
|
// configured options here. Reading them makes a bare useColorMode() agree
|
|
@@ -364,7 +364,7 @@ catch (e) {} }
|
|
|
364
364
|
return v;
|
|
365
365
|
};
|
|
366
366
|
var root = window.__STX_CURRENT_ELEMENT__;
|
|
367
|
-
var kebabName = name
|
|
367
|
+
var kebabName = __stxKebab(name);
|
|
368
368
|
var lowerName = name.toLowerCase();
|
|
369
369
|
var attributeNames = [name];
|
|
370
370
|
if (kebabName !== name) attributeNames.push(kebabName);
|
|
@@ -383,10 +383,13 @@ catch (e) {} }
|
|
|
383
383
|
var serializedProps = root.getAttribute('data-stx-props');
|
|
384
384
|
if (serializedProps) {
|
|
385
385
|
try {
|
|
386
|
-
var parsedProps =
|
|
387
|
-
var camelName = name
|
|
386
|
+
var parsedProps = __stxParsedProps(serializedProps);
|
|
387
|
+
var camelName = __stxCamel(name);
|
|
388
388
|
if (Object.prototype.hasOwnProperty.call(parsedProps, name)) staticValue = parsedProps[name];
|
|
389
389
|
else if (Object.prototype.hasOwnProperty.call(parsedProps, camelName)) staticValue = parsedProps[camelName];
|
|
390
|
+
// A structured value is this instance's own, as a fresh parse made it.
|
|
391
|
+
if (staticValue && typeof staticValue === 'object' && staticValue !== defaultValue)
|
|
392
|
+
staticValue = JSON.parse(JSON.stringify(staticValue));
|
|
390
393
|
}
|
|
391
394
|
catch (e) {}
|
|
392
395
|
}
|
|
@@ -550,7 +553,7 @@ catch (e) {} }
|
|
|
550
553
|
}
|
|
551
554
|
|
|
552
555
|
function preserveDeferredParentComponentProps(el) {
|
|
553
|
-
var names = (el.getAttribute('data-stx-parent-bindings') || '')
|
|
556
|
+
var names = __stxWords(el.getAttribute('data-stx-parent-bindings') || '');
|
|
554
557
|
if (!names.length) return;
|
|
555
558
|
var deferred = readDeferredParentComponentProps(el);
|
|
556
559
|
names.forEach(function(name) {
|
|
@@ -607,9 +610,7 @@ catch (e) {} }
|
|
|
607
610
|
if (!el || !el.getAttribute) return;
|
|
608
611
|
var scopeId = el.getAttribute('data-stx-scope');
|
|
609
612
|
var scopeVars = scopeId && window.stx._scopes && window.stx._scopes[scopeId];
|
|
610
|
-
var camelName = name
|
|
611
|
-
return character.toUpperCase();
|
|
612
|
-
});
|
|
613
|
+
var camelName = __stxCamel(name);
|
|
613
614
|
// useReactiveProp signals are often intentionally aliased inside the
|
|
614
615
|
// child, for example liveClosable = useReactiveProp('closable', true).
|
|
615
616
|
// The public prop name therefore cannot be inferred from the variable
|
|
@@ -995,7 +996,7 @@ else {
|
|
|
995
996
|
}
|
|
996
997
|
`;var ue=` function bindParentComponentProps(el, callerScope) {
|
|
997
998
|
if (!el || !el.getAttribute || el.__stx_parent_props_bound) return;
|
|
998
|
-
var names = (el.getAttribute('data-stx-parent-bindings') || '')
|
|
999
|
+
var names = __stxWords(el.getAttribute('data-stx-parent-bindings') || '');
|
|
999
1000
|
if (!names.length) return;
|
|
1000
1001
|
if (hasPendingLoopBoundary(el)) {
|
|
1001
1002
|
preserveDeferredParentComponentProps(el);
|
|
@@ -1069,8 +1070,14 @@ else {
|
|
|
1069
1070
|
}
|
|
1070
1071
|
|
|
1071
1072
|
function resolveComponentCallerScope(el, pageScope) {
|
|
1073
|
+
return componentCallerScopeFrom(el && (el.parentElement || el.parentNode), pageScope);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// The caller scope for a component placed under \`current\`: the page's
|
|
1077
|
+
// scope, then every component scope around it, outermost first. A native
|
|
1078
|
+
// loop row binds before it is inserted, so it asks from its future parent.
|
|
1079
|
+
function componentCallerScopeFrom(current, pageScope) {
|
|
1072
1080
|
var ancestors = [];
|
|
1073
|
-
var current = el && (el.parentElement || el.parentNode);
|
|
1074
1081
|
while (current && current !== document) {
|
|
1075
1082
|
if (current.getAttribute && current.hasAttribute('data-stx-scope'))
|
|
1076
1083
|
ancestors.push(current.getAttribute('data-stx-scope'));
|
|
@@ -1267,7 +1274,7 @@ else {
|
|
|
1267
1274
|
}
|
|
1268
1275
|
});
|
|
1269
1276
|
}
|
|
1270
|
-
`;var
|
|
1277
|
+
`;var fe=` // Component composition API (Phase 4)
|
|
1271
1278
|
defineProps: function(definitions) {
|
|
1272
1279
|
var props = window.__STX_CURRENT_PROPS__ || {};
|
|
1273
1280
|
if (!definitions) return props;
|
|
@@ -1325,7 +1332,7 @@ else {
|
|
|
1325
1332
|
// implementation behind it (#1804).
|
|
1326
1333
|
useSlots: function() {
|
|
1327
1334
|
return window.__STX_CURRENT_SLOTS__ || {};
|
|
1328
|
-
},`;var
|
|
1335
|
+
},`;var he=` var __bindIfCounter = 0;
|
|
1329
1336
|
// \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1330
1337
|
// Returns { name, terminal } for an else/else-if attribute present on el,
|
|
1331
1338
|
// or null. terminal=true for the catch-all x-else (no further siblings
|
|
@@ -1734,7 +1741,7 @@ else {
|
|
|
1734
1741
|
function stxConfirm(message, options) {
|
|
1735
1742
|
return _createDialog(message, options, true);
|
|
1736
1743
|
}
|
|
1737
|
-
`;var
|
|
1744
|
+
`;var we=` // ==========================================================================
|
|
1738
1745
|
// DevTools introspection (stacksjs/stx#1747, Phase 1)
|
|
1739
1746
|
// ==========================================================================
|
|
1740
1747
|
// A read-only, console-usable inspector wired to the live runtime \u2014 no manual
|
|
@@ -1869,7 +1876,7 @@ else {
|
|
|
1869
1876
|
return s ? __stxDevtoolsClassify(s) : null;
|
|
1870
1877
|
},
|
|
1871
1878
|
};
|
|
1872
|
-
`;var
|
|
1879
|
+
`;var be=` // ==========================================================================
|
|
1873
1880
|
// Auto-initialization
|
|
1874
1881
|
// ==========================================================================
|
|
1875
1882
|
|
|
@@ -2544,7 +2551,7 @@ finally {
|
|
|
2544
2551
|
const names = __stxNamesIn(body);
|
|
2545
2552
|
// A layered view answers from its layers directly: through the proxy,
|
|
2546
2553
|
// each name cost a trap and a fresh property descriptor.
|
|
2547
|
-
const own = __stxOwnOf.get(scope);
|
|
2554
|
+
const own = __stxOwnOf.get(__stxUnwrapTargetOf.get(scope) || scope);
|
|
2548
2555
|
for (let i = 0; i < names.length; i++) {
|
|
2549
2556
|
if (own !== undefined ? __stxLayerOf(own, names[i]) !== null : Object.prototype.propertyIsEnumerable.call(scope, names[i])) keys.push(names[i]);
|
|
2550
2557
|
}
|
|
@@ -2981,12 +2988,12 @@ catch (e) {
|
|
|
2981
2988
|
}
|
|
2982
2989
|
throw e;
|
|
2983
2990
|
}
|
|
2984
|
-
}`;function Ae(e,
|
|
2991
|
+
}`;function Ae(e,o){return` // ==========================================================================
|
|
2985
2992
|
// Declarative Data Fetching (Feature #6 - useFetch)
|
|
2986
2993
|
// ==========================================================================
|
|
2987
2994
|
|
|
2988
2995
|
var readHydratedData = ${e};
|
|
2989
|
-
var clearServerData = ${
|
|
2996
|
+
var clearServerData = ${o};
|
|
2990
2997
|
|
|
2991
2998
|
function useFetch(urlOrFn, options = {}) {
|
|
2992
2999
|
const hydrated = readHydratedData(options.key, options.hydrate !== false, options.transform);
|
|
@@ -3305,6 +3312,9 @@ else {
|
|
|
3305
3312
|
templateContent = wrapper;
|
|
3306
3313
|
}
|
|
3307
3314
|
|
|
3315
|
+
// The native row plan: undefined until the first row asks for it, null
|
|
3316
|
+
// where this template keeps the generic path.
|
|
3317
|
+
let rowPlan;
|
|
3308
3318
|
let currentElements = [];
|
|
3309
3319
|
// One entry per list item, each holding EVERY node that item rendered.
|
|
3310
3320
|
// currentElements stays flat for transition snapshots, but the keyed
|
|
@@ -3781,6 +3791,37 @@ catch (e) {
|
|
|
3781
3791
|
signals.index.set(i);
|
|
3782
3792
|
}
|
|
3783
3793
|
} else {
|
|
3794
|
+
// A native screen builds its rows from a plan of the template, made
|
|
3795
|
+
// with the first row (signals-native-row-runtime). A row is bound
|
|
3796
|
+
// before it is inserted, so it reaches the host whole.
|
|
3797
|
+
if (rowPlan === undefined) {
|
|
3798
|
+
// A native :for is a template holding the row; a plan covers a
|
|
3799
|
+
// template of one element (the usual row) or a bare element.
|
|
3800
|
+
const rowTemplate = isTemplate
|
|
3801
|
+
? (templateContent.childNodes.length === 1 ? templateContent.childNodes[0] : null)
|
|
3802
|
+
: templateContent;
|
|
3803
|
+
rowPlan = stxHost.isNative && typeof planNativeRow === 'function' && typeof stxHost.cloneElement === 'function'
|
|
3804
|
+
&& rowTemplate && !slotScopeInfo && !componentSetupTemplates.length ? planNativeRow(rowTemplate) : null;
|
|
3805
|
+
}
|
|
3806
|
+
if (rowPlan && !tgIsGroup) {
|
|
3807
|
+
const plannedItem = state(list[i]);
|
|
3808
|
+
plannedItem._isStxLoopItem = true;
|
|
3809
|
+
const plannedIndex = state(i);
|
|
3810
|
+
const plannedScope = layerTemplateScopes(globalHelpers, passedScope, capturedScope || {});
|
|
3811
|
+
Object.defineProperty(plannedScope, itemName, { value: plannedItem, writable: true, enumerable: true, configurable: true });
|
|
3812
|
+
if (indexName) Object.defineProperty(plannedScope, indexName, { value: plannedIndex, writable: true, enumerable: true, configurable: true });
|
|
3813
|
+
const created = createNativeRow(rowPlan, plannedScope, parent);
|
|
3814
|
+
markLoopRow(created.root, itemName, plannedItem);
|
|
3815
|
+
const plannedRow = isTemplate
|
|
3816
|
+
? [stxHost.anchor('stx-for-item-start'), created.root, stxHost.anchor('stx-for-item-end')]
|
|
3817
|
+
: [created.root];
|
|
3818
|
+
plannedRow.__stx_signals = { item: plannedItem, index: plannedIndex };
|
|
3819
|
+
for (let pi = 0; pi < plannedRow.length; pi++) stxHost.insert(parent, plannedRow[pi], cursor || placeholder);
|
|
3820
|
+
finishNativeRow(created);
|
|
3821
|
+
newElements.push(...plannedRow);
|
|
3822
|
+
newGroups.push(plannedRow);
|
|
3823
|
+
continue;
|
|
3824
|
+
}
|
|
3784
3825
|
// New item \u2014 create DOM elements with a fresh item signal
|
|
3785
3826
|
const elements = createItemElements(list[i], i, key);
|
|
3786
3827
|
elements.forEach(el => {
|
|
@@ -3869,6 +3910,666 @@ catch (e) {
|
|
|
3869
3910
|
if (tgIsGroup) parent.__stx_tg_init = true;
|
|
3870
3911
|
});
|
|
3871
3912
|
}
|
|
3913
|
+
`;var Ie=` // ==========================================================================
|
|
3914
|
+
// Native row plans
|
|
3915
|
+
// ==========================================================================
|
|
3916
|
+
|
|
3917
|
+
var __STX_ROW_GENERIC_ATTRS = { 'stx-hydrate': 1, 'data-stx-memo': 1, 'data-stx-suspense': 1, 'x-data': 1, 'data-stx-xdata': 1, ref: 1, 'data-stx-ref': 1, 'data-stx-lazy': 1, 'data-stx-slot-scope': 1 };
|
|
3918
|
+
var __STX_ROW_SKIPPED_EVENTS = { if: 1, for: 1, show: 1, model: 1, class: 1, style: 1, text: 1, html: 1, ref: 1 };
|
|
3919
|
+
var __STX_ROW_CONTROL_ATTRS = { value: 1, checked: 1, selected: 1, indeterminate: 1 };
|
|
3920
|
+
var __STX_IDENT = /^[A-Za-z_$][\\w$]*$/;
|
|
3921
|
+
var __STX_QUOTED = /'(?:[^'\\\\]|\\\\.)*'|"(?:[^"\\\\]|\\\\.)*"/g;
|
|
3922
|
+
var __STX_KEYWORDS = { return: 1, true: 1, false: 1, null: 1, typeof: 1, instanceof: 1, new: 1, this: 1, void: 1, in: 1, of: 1, delete: 1, function: 1, var: 1, let: 1, const: 1, if: 1, else: 1 };
|
|
3923
|
+
|
|
3924
|
+
function __stxAlwaysVisible() { return true; }
|
|
3925
|
+
|
|
3926
|
+
// What planning throws for a template it leaves to the generic path: one
|
|
3927
|
+
// object, not an Error with a stack to capture for every refusal.
|
|
3928
|
+
var ROW_UNPLANNED = { unplanned: true };
|
|
3929
|
+
|
|
3930
|
+
// A plan for rows cloned from \`template\`, or null where the generic path
|
|
3931
|
+
// has to make them.
|
|
3932
|
+
function planNativeRow(template) {
|
|
3933
|
+
if (!template || template.nodeType !== 1 || !template.attributes) return null;
|
|
3934
|
+
// Two scopes a row reads from: its own (bindings inside the row) and, for
|
|
3935
|
+
// a component, its caller's (the props the caller passes). Each keeps the
|
|
3936
|
+
// names its expressions mention and the functions compiled per shape.
|
|
3937
|
+
var plan = { sites: [], eval: rowGroup(), prop: rowGroup(), props: null, component: false, scopeId: null, setup: null, root: null };
|
|
3938
|
+
if (template.hasAttribute('data-stx-scope')) {
|
|
3939
|
+
plan.component = true;
|
|
3940
|
+
plan.scopeId = template.getAttribute('data-stx-template-scope') || template.getAttribute('data-stx-scope');
|
|
3941
|
+
var setups = window.__stx_componentSetups;
|
|
3942
|
+
plan.setup = setups && setups[plan.scopeId];
|
|
3943
|
+
if (typeof plan.setup !== 'function') return null;
|
|
3944
|
+
}
|
|
3945
|
+
try {
|
|
3946
|
+
plan.root = planRowNode(plan, template, true, false);
|
|
3947
|
+
}
|
|
3948
|
+
catch (e) {
|
|
3949
|
+
return null;
|
|
3950
|
+
}
|
|
3951
|
+
return plan.root ? plan : null;
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
function rowGroup() {
|
|
3955
|
+
return { names: [], nameIndex: {}, shapes: new Map() };
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
function planRowSite(plan, raw, kind) {
|
|
3959
|
+
var expr = raw.indexOf('&') === -1 ? raw : raw.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'");
|
|
3960
|
+
// The same body text each path compiles, so the functions are the ones
|
|
3961
|
+
// the generic path would have made.
|
|
3962
|
+
var body = kind === 'attr' || kind === 'text' || kind === 'prop' ? 'return (' + expr + ')'
|
|
3963
|
+
: kind === 'if' ? 'return ' + expr + ''
|
|
3964
|
+
: 'return ' + raw;
|
|
3965
|
+
var source = kind === 'attr' || kind === 'text' || kind === 'if' ? expr : raw;
|
|
3966
|
+
var group = kind === 'prop' ? plan.prop : plan.eval;
|
|
3967
|
+
if (parsePipeExpression(source, {}) !== null) throw ROW_UNPLANNED;
|
|
3968
|
+
if (plan.component && raw.indexOf(plan.scopeId) !== -1) throw ROW_UNPLANNED;
|
|
3969
|
+
// The names the expression can read: not the words of its quoted strings
|
|
3970
|
+
// (a class list in a ternary) nor keywords, which every row would
|
|
3971
|
+
// otherwise look up in its scope for nothing.
|
|
3972
|
+
var unquoted = source.indexOf("'") === -1 && source.indexOf('"') === -1 ? source : source.replace(__STX_QUOTED, ' ');
|
|
3973
|
+
var names = __stxNamesIn(unquoted).filter(function(k) { return !__STX_KEYWORDS[k]; });
|
|
3974
|
+
for (var i = 0; i < names.length; i++) {
|
|
3975
|
+
if (group.nameIndex[names[i]] === undefined) {
|
|
3976
|
+
group.nameIndex[names[i]] = group.names.length;
|
|
3977
|
+
group.names.push(names[i]);
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
var site = { index: plan.sites.length, kind: kind, group: group, expr: source, body: body, names: names, placeholder: /^__[A-Z_]+__$/.test(source.trim()), ident: __STX_IDENT.test(source.trim()), handler: null };
|
|
3981
|
+
plan.sites.push(site);
|
|
3982
|
+
return site;
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
// One element of the template: its bindings, the attributes a row's copy
|
|
3986
|
+
// keeps, and its children. Throws where the template needs the generic path;
|
|
3987
|
+
// returns { generic: true } for an :if branch whose content does.
|
|
3988
|
+
function planRowNode(plan, tmpl, isRoot, inBranch, gated) {
|
|
3989
|
+
var node = { tmpl: tmpl, attrs: [], ops: [], children: [], ifSite: null, generic: false, inert: false, remap: [], gated: !!(gated || inBranch) };
|
|
3990
|
+
var attrs = getElementAttributes(tmpl);
|
|
3991
|
+
var parentEvents = __stxWords(tmpl.getAttribute('data-stx-parent-events') || '');
|
|
3992
|
+
var parentBindings = isRoot && plan.component ? __stxWords(tmpl.getAttribute('data-stx-parent-bindings') || '') : [];
|
|
3993
|
+
// A component's props, as bindParentComponentProps reads them: each
|
|
3994
|
+
// parent binding from its :name attribute, else from the bindings an
|
|
3995
|
+
// enclosing loop deferred (data-stx-deferred-parent-bindings). What the
|
|
3996
|
+
// row leaves deferred is the same for every row.
|
|
3997
|
+
var deferredProps = null;
|
|
3998
|
+
if (isRoot && plan.component) {
|
|
3999
|
+
plan.props = [];
|
|
4000
|
+
deferredProps = readDeferredParentComponentProps(tmpl);
|
|
4001
|
+
for (var b = 0; b < parentBindings.length; b++) {
|
|
4002
|
+
var propName = parentBindings[b];
|
|
4003
|
+
var propExpression = tmpl.hasAttribute(':' + propName) ? tmpl.getAttribute(':' + propName) : deferredProps[propName];
|
|
4004
|
+
if (typeof propExpression !== 'string') continue;
|
|
4005
|
+
plan.props.push({ name: propName, site: planRowSite(plan, propExpression, 'prop') });
|
|
4006
|
+
delete deferredProps[propName];
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
4009
|
+
if (getElseAttrInfo(tmpl)) throw ROW_UNPLANNED;
|
|
4010
|
+
var generic = false;
|
|
4011
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
4012
|
+
var name = attrs[i].name;
|
|
4013
|
+
var value = attrs[i].value;
|
|
4014
|
+
if (!name) continue;
|
|
4015
|
+
if (name === ':if' || name === '@if') {
|
|
4016
|
+
if (isRoot) throw ROW_UNPLANNED;
|
|
4017
|
+
if (getElseAttrInfo(tmpl.nextElementSibling)) throw ROW_UNPLANNED;
|
|
4018
|
+
node.ifSite = planRowSite(plan, value, 'if');
|
|
4019
|
+
continue;
|
|
4020
|
+
}
|
|
4021
|
+
if (name === 'x-if') throw ROW_UNPLANNED;
|
|
4022
|
+
if ((name === ':for' || name === '@for' || name === 'x-for') && isForDirectiveExpression(value)) throw ROW_UNPLANNED;
|
|
4023
|
+
if (name === 'x-cloak') continue;
|
|
4024
|
+
if (name === 'data-stx-scope' || name === 'data-stx-template-scope') {
|
|
4025
|
+
if (!isRoot) throw ROW_UNPLANNED;
|
|
4026
|
+
continue;
|
|
4027
|
+
}
|
|
4028
|
+
if (__STX_ROW_GENERIC_ATTRS[name] || name.startsWith('::') || name.startsWith('x-') || name.startsWith('@bind:')) { generic = true; continue; }
|
|
4029
|
+
if (name.charCodeAt(0) === 58) {
|
|
4030
|
+
var bound = name.slice(1);
|
|
4031
|
+
var base = bound.split('.')[0];
|
|
4032
|
+
if (base === 'class' || base === 'style' || base === 'text') {
|
|
4033
|
+
if (name !== ':' + base) { generic = true; continue; }
|
|
4034
|
+
node.ops.push({ kind: base, site: planRowSite(plan, value, base) });
|
|
4035
|
+
if (base === 'text') node.inert = true;
|
|
4036
|
+
continue;
|
|
4037
|
+
}
|
|
4038
|
+
if (DIRECTIVE_NAMES[base] || EVENT_RE.test(bound)) { generic = true; continue; }
|
|
4039
|
+
if (isRoot && plan.component && parentBindings.indexOf(bound) !== -1) continue;
|
|
4040
|
+
if ((__STX_ROW_CONTROL_ATTRS[bound] && bound in tmpl) || (bound === 'src' && tmpl.tagName === 'IFRAME')) { generic = true; continue; }
|
|
4041
|
+
node.ops.push({ kind: 'attr', attrName: bound, site: planRowSite(plan, value, 'attr') });
|
|
4042
|
+
continue;
|
|
4043
|
+
}
|
|
4044
|
+
if (name.charCodeAt(0) === 64) {
|
|
4045
|
+
if (name === '@class' || name === '@style' || name === '@text') {
|
|
4046
|
+
var directive = name.slice(1);
|
|
4047
|
+
node.ops.push({ kind: directive, site: planRowSite(plan, value, directive) });
|
|
4048
|
+
if (directive === 'text') node.inert = true;
|
|
4049
|
+
continue;
|
|
4050
|
+
}
|
|
4051
|
+
var parts = name.slice(1).split('.');
|
|
4052
|
+
var eventName = parentEvents.find(function(event) { return event.toLowerCase() === parts[0].toLowerCase(); }) || parts[0];
|
|
4053
|
+
if (__STX_ROW_SKIPPED_EVENTS[eventName]) { generic = true; continue; }
|
|
4054
|
+
if (plan.component && value.indexOf(plan.scopeId) !== -1) throw ROW_UNPLANNED;
|
|
4055
|
+
node.ops.push({
|
|
4056
|
+
kind: 'event',
|
|
4057
|
+
eventName: eventName,
|
|
4058
|
+
modifiers: parts.slice(1),
|
|
4059
|
+
value: value,
|
|
4060
|
+
key: '__stx_evt_' + eventName + '_' + value.substring(0, 20),
|
|
4061
|
+
forwarded: isRoot && plan.component && parentEvents.indexOf(eventName) !== -1,
|
|
4062
|
+
});
|
|
4063
|
+
continue;
|
|
4064
|
+
}
|
|
4065
|
+
if (deferredProps && name === 'data-stx-deferred-parent-bindings' && plan.props.length) {
|
|
4066
|
+
if (Object.keys(deferredProps).length) node.attrs.push({ name: name, value: JSON.stringify(deferredProps) });
|
|
4067
|
+
continue;
|
|
4068
|
+
}
|
|
4069
|
+
if (plan.component && typeof value === 'string' && value.indexOf(plan.scopeId) !== -1) node.remap.push(node.attrs.length);
|
|
4070
|
+
node.attrs.push(attrs[i]);
|
|
4071
|
+
}
|
|
4072
|
+
if (generic) {
|
|
4073
|
+
if (!inBranch || !node.ifSite) throw ROW_UNPLANNED;
|
|
4074
|
+
return { tmpl: tmpl, generic: true, ifSite: node.ifSite };
|
|
4075
|
+
}
|
|
4076
|
+
var kids = tmpl.childNodes || [];
|
|
4077
|
+
for (var k = 0; k < kids.length; k++) {
|
|
4078
|
+
var child = kids[k];
|
|
4079
|
+
if (child.nodeType !== 1 || child.tagName === 'SCRIPT' || child.tagName === 'TEMPLATE' || child.__stx_scope) throw ROW_UNPLANNED;
|
|
4080
|
+
var hasIf = child.hasAttribute(':if') || child.hasAttribute('@if');
|
|
4081
|
+
node.children.push(planRowNode(plan, child, false, hasIf, node.gated));
|
|
4082
|
+
}
|
|
4083
|
+
return node;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
// Which of the plan's names this row's scope holds, and the functions
|
|
4087
|
+
// compiled for that answer. Rows of one loop nearly always share one.
|
|
4088
|
+
function rowShape(group, own, layers) {
|
|
4089
|
+
var names = group.names;
|
|
4090
|
+
var stack = own[__STX_LAYERS];
|
|
4091
|
+
// A row's scope is its loop's layers (the same objects for every row)
|
|
4092
|
+
// and a few of its own (its item, its component's variables), which hold
|
|
4093
|
+
// the same names from row to row. When this row's are the last row's or
|
|
4094
|
+
// hold the same names, every name lives where it did: nothing to look up.
|
|
4095
|
+
var last = group.last;
|
|
4096
|
+
if (last && stack.length === last.stack.length && own[__STX_HIDDEN] === undefined && Object.keys(own).length === 0) {
|
|
4097
|
+
var same = true;
|
|
4098
|
+
for (var j = 0; j < stack.length && same; j++) {
|
|
4099
|
+
if (stack[j] !== last.stack[j]) same = Object.keys(stack[j]).join('\x01') === last.names[j];
|
|
4100
|
+
}
|
|
4101
|
+
if (same) {
|
|
4102
|
+
for (var n = 0; n < names.length; n++) layers[n] = last.at[n] < 0 ? null : stack[last.at[n]];
|
|
4103
|
+
last.stack = stack;
|
|
4104
|
+
return last.shape;
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
var signature = '';
|
|
4108
|
+
var at = new Array(names.length);
|
|
4109
|
+
for (var i = 0; i < names.length; i++) {
|
|
4110
|
+
var layer = __stxLayerOf(own, names[i]);
|
|
4111
|
+
layers[i] = layer;
|
|
4112
|
+
at[i] = layer === null ? -1 : stack.lastIndexOf(layer);
|
|
4113
|
+
signature += layer === null ? '0' : '1';
|
|
4114
|
+
}
|
|
4115
|
+
var shape = group.shapes.get(signature);
|
|
4116
|
+
if (!shape) {
|
|
4117
|
+
shape = { signature: signature, compiled: [] };
|
|
4118
|
+
group.shapes.set(signature, shape);
|
|
4119
|
+
}
|
|
4120
|
+
// Remembered for the next row only when every name was found in a layer
|
|
4121
|
+
// (not on the scope's own object, which differs per row).
|
|
4122
|
+
var ownless = Object.keys(own).length === 0 && own[__STX_HIDDEN] === undefined;
|
|
4123
|
+
if (ownless) {
|
|
4124
|
+
for (var k = 0; k < names.length; k++) if (layers[k] !== null && at[k] < 0) ownless = false;
|
|
4125
|
+
}
|
|
4126
|
+
group.last = ownless ? { stack: stack, names: stack.map(function(layer) { return Object.keys(layer).join('\x01'); }), at: at, shape: shape } : null;
|
|
4127
|
+
return shape;
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
// How the expression uses a name its scope holds, worked out when a row
|
|
4131
|
+
// first evaluates it: a prop's scope keeps a signal its expression calls or
|
|
4132
|
+
// uses as a signal (createAutoUnwrapProxy's rule), everything else follows
|
|
4133
|
+
// the expression (StxAutoUnwrapHandler's).
|
|
4134
|
+
function rowSignalUse(site, name) {
|
|
4135
|
+
return site.kind === 'prop'
|
|
4136
|
+
? (expressionCallsSignal(site.expr, name) || expressionUsesSignalApi(site.expr, name) ? 1 : 0)
|
|
4137
|
+
: expressionSignalUse(site.expr, name);
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
function compileRowSite(site, shape) {
|
|
4141
|
+
var nameIndex = site.group.nameIndex;
|
|
4142
|
+
var keys = [];
|
|
4143
|
+
var uses = [];
|
|
4144
|
+
for (var i = 0; i < site.names.length; i++) {
|
|
4145
|
+
if (shape.signature.charCodeAt(nameIndex[site.names[i]]) === 49) {
|
|
4146
|
+
keys.push(site.names[i]);
|
|
4147
|
+
uses.push(rowSignalUse(site, site.names[i]));
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
var slots = keys.map(function(key) { return nameIndex[key]; });
|
|
4151
|
+
var compiled = { keys: keys, slots: slots, uses: uses, fn: null, error: null };
|
|
4152
|
+
try { compiled.fn = __stxCompile(keys, site.body); }
|
|
4153
|
+
catch (e) { compiled.error = e; }
|
|
4154
|
+
shape.compiled[site.index] = compiled;
|
|
4155
|
+
return compiled;
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
function readRowScope(own, key) {
|
|
4159
|
+
var layer = __stxLayerOf(own, key);
|
|
4160
|
+
return layer === null ? own[key] : layer[key];
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
// What the expression's auto-unwrap proxy would hand the function for one
|
|
4164
|
+
// name (StxAutoUnwrapHandler.get with the expression).
|
|
4165
|
+
function unwrapRowValue(site, value, use) {
|
|
4166
|
+
if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) {
|
|
4167
|
+
if (value._isStxLoopItem) return value();
|
|
4168
|
+
if (use === 1) return value;
|
|
4169
|
+
if (use === 0) return value();
|
|
4170
|
+
var keep;
|
|
4171
|
+
try {
|
|
4172
|
+
var current = value();
|
|
4173
|
+
keep = !(current && typeof current === 'object' && Object.prototype.hasOwnProperty.call(current, 'value'));
|
|
4174
|
+
}
|
|
4175
|
+
catch (e) { keep = true; }
|
|
4176
|
+
return keep ? value : value();
|
|
4177
|
+
}
|
|
4178
|
+
if (value && typeof value === 'object' && value._isStxStore) {
|
|
4179
|
+
if (!site.handler) {
|
|
4180
|
+
var expr = site.expr;
|
|
4181
|
+
site.handler = site.kind === 'prop'
|
|
4182
|
+
? new StxAutoUnwrapHandler(function(prop) { return typeof prop === 'string' && (expressionCallsSignal(expr, prop) || expressionUsesSignalApi(expr, prop)); }, null)
|
|
4183
|
+
: new StxAutoUnwrapHandler(null, expr);
|
|
4184
|
+
}
|
|
4185
|
+
return new Proxy(value, site.handler);
|
|
4186
|
+
}
|
|
4187
|
+
return value;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
// An expression evaluated as its generic path does: through the unwrapping
|
|
4191
|
+
// scope first, then the raw scope, then reported and replaced by \`fallback\`.
|
|
4192
|
+
// \`at\`: the scope the site reads, as the row found it (row.local or row.caller).
|
|
4193
|
+
function evaluateRowSite(at, site, el, fallback, subscribe) {
|
|
4194
|
+
if (site.placeholder) return site.expr;
|
|
4195
|
+
var compiled = at.shape.compiled[site.index] || compileRowSite(site, at.shape);
|
|
4196
|
+
var keys = compiled.keys;
|
|
4197
|
+
var layers = at.layers;
|
|
4198
|
+
var raw = new Array(keys.length);
|
|
4199
|
+
var args = new Array(keys.length);
|
|
4200
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4201
|
+
// The layer holding each name was found once for the row (rowShape):
|
|
4202
|
+
// the layers are the row's own objects and the scopes it was given.
|
|
4203
|
+
var value = layers[compiled.slots[i]][keys[i]];
|
|
4204
|
+
raw[i] = value;
|
|
4205
|
+
if (subscribe && value && typeof value === 'function' && (value._isSignal || value._isDerived)) value();
|
|
4206
|
+
args[i] = unwrapRowValue(site, value, compiled.uses[i]);
|
|
4207
|
+
}
|
|
4208
|
+
if (compiled.fn) {
|
|
4209
|
+
try {
|
|
4210
|
+
var result = compiled.fn.apply(null, args);
|
|
4211
|
+
if (site.kind === 'attr' || site.kind === 'text') {
|
|
4212
|
+
if (result && typeof result === 'function' && (result._isSignal || result._isDerived)) result = result();
|
|
4213
|
+
noteExprSuccess(site.expr);
|
|
4214
|
+
}
|
|
4215
|
+
return result;
|
|
4216
|
+
}
|
|
4217
|
+
catch (e1) {
|
|
4218
|
+
try {
|
|
4219
|
+
var retried = compiled.fn.apply(null, raw);
|
|
4220
|
+
if (site.kind === 'attr' || site.kind === 'text') {
|
|
4221
|
+
if (retried && typeof retried === 'function' && (retried._isSignal || retried._isDerived)) retried = retried();
|
|
4222
|
+
noteExprSuccess(site.expr);
|
|
4223
|
+
}
|
|
4224
|
+
return retried;
|
|
4225
|
+
}
|
|
4226
|
+
catch (e2) {
|
|
4227
|
+
return failRowSite(at, site, el, e2, fallback);
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
return failRowSite(at, site, el, compiled.error, fallback);
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
function failRowSite(at, site, el, error, fallback) {
|
|
4235
|
+
reportUnknownBinding(error, site.expr, at.scope, el);
|
|
4236
|
+
if (site.kind === 'prop') {
|
|
4237
|
+
if (!(error instanceof ReferenceError) && !(error instanceof TypeError)) console.warn('[STX] Parent component prop error:', site.expr, error);
|
|
4238
|
+
return fallback;
|
|
4239
|
+
}
|
|
4240
|
+
var label = site.kind === 'attr' || site.kind === 'text' ? '[STX] Attribute expression error:'
|
|
4241
|
+
: site.kind === 'style' ? '[STX] Style expression error:'
|
|
4242
|
+
: site.kind === 'class' ? '[STX] Class expression error:' : '[STX] Expression error:';
|
|
4243
|
+
if (!(error instanceof ReferenceError) && !(error instanceof TypeError)) console.warn(label, site.expr, error);
|
|
4244
|
+
else if (site.kind === 'attr' || site.kind === 'text') noteExprFailure(site.expr, error);
|
|
4245
|
+
return fallback;
|
|
4246
|
+
}
|
|
4247
|
+
|
|
4248
|
+
// The visibility gates an element's attribute bindings wait on: every :if
|
|
4249
|
+
// around it, the row's own and those around the loop.
|
|
4250
|
+
function rowVisibility(el, row, pnode) {
|
|
4251
|
+
// Outside every :if of the row, in a loop no :if hides: always visible,
|
|
4252
|
+
// without walking up to find that out.
|
|
4253
|
+
if (!pnode.gated && !row.outer.length && !row.inserted) return __stxAlwaysVisible;
|
|
4254
|
+
var gates = [];
|
|
4255
|
+
for (var node = el; node; node = node.parentNode) {
|
|
4256
|
+
if (node.__stx_if_visible) gates.push(node.__stx_if_visible);
|
|
4257
|
+
if (node === row.root && !node.parentNode) {
|
|
4258
|
+
for (var i = 0; i < row.outer.length; i++) gates.push(row.outer[i]);
|
|
4259
|
+
break;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
if (!gates.length) return __stxAlwaysVisible;
|
|
4263
|
+
if (gates.length === 1) { var gate = gates[0]; return function() { return gate(); }; }
|
|
4264
|
+
return function() {
|
|
4265
|
+
for (var g = 0; g < gates.length; g++) if (!gates[g]()) return false;
|
|
4266
|
+
return true;
|
|
4267
|
+
};
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
// The nodes of one planned element, children placed and :if children
|
|
4271
|
+
// given their anchors, nothing bound yet.
|
|
4272
|
+
function buildRowNode(pnode, row) {
|
|
4273
|
+
var el = stxHost.cloneElement(pnode.tmpl, pnode.attrs);
|
|
4274
|
+
for (var r = 0; r < pnode.remap.length; r++) {
|
|
4275
|
+
var attribute = pnode.attrs[pnode.remap[r]];
|
|
4276
|
+
el.setAttribute(attribute.name, attribute.value.split(row.plan.scopeId).join(row.scopeId));
|
|
4277
|
+
}
|
|
4278
|
+
var kids = new Array(pnode.children.length);
|
|
4279
|
+
for (var i = 0; i < pnode.children.length; i++) {
|
|
4280
|
+
var child = pnode.children[i];
|
|
4281
|
+
var made;
|
|
4282
|
+
if (child.ifSite) {
|
|
4283
|
+
made = { pnode: child, el: null, anchor: stxHost.anchor('stx-if') };
|
|
4284
|
+
stxHost.append(el, made.anchor);
|
|
4285
|
+
}
|
|
4286
|
+
else {
|
|
4287
|
+
made = buildRowNode(child, row);
|
|
4288
|
+
stxHost.append(el, made.el);
|
|
4289
|
+
}
|
|
4290
|
+
kids[i] = made;
|
|
4291
|
+
}
|
|
4292
|
+
return { pnode: pnode, el: el, kids: kids, anchor: null };
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4295
|
+
function bindRowNode(made, row) {
|
|
4296
|
+
var pnode = made.pnode;
|
|
4297
|
+
var el = made.el;
|
|
4298
|
+
var ops = pnode.ops;
|
|
4299
|
+
var visible = null;
|
|
4300
|
+
var urlWarning = null;
|
|
4301
|
+
for (var i = 0; i < ops.length; i++) {
|
|
4302
|
+
var op = ops[i];
|
|
4303
|
+
if (op.kind === 'attr') {
|
|
4304
|
+
if (!visible) visible = rowVisibility(el, row, pnode);
|
|
4305
|
+
if (!urlWarning) urlWarning = { warned: false };
|
|
4306
|
+
bindRowAttribute(el, op, row, visible, urlWarning);
|
|
4307
|
+
}
|
|
4308
|
+
else if (op.kind === 'class') {
|
|
4309
|
+
if (!visible) visible = rowVisibility(el, row, pnode);
|
|
4310
|
+
bindRowClass(el, op.site, row, visible);
|
|
4311
|
+
}
|
|
4312
|
+
else if (op.kind === 'style') {
|
|
4313
|
+
if (!visible) visible = rowVisibility(el, row, pnode);
|
|
4314
|
+
bindRowStyle(el, op.site, row, visible);
|
|
4315
|
+
}
|
|
4316
|
+
else if (op.kind === 'text') {
|
|
4317
|
+
el.__stx_inert_content = true;
|
|
4318
|
+
bindRowText(el, op.site, row);
|
|
4319
|
+
}
|
|
4320
|
+
else if (op.kind === 'event') {
|
|
4321
|
+
if (el[op.key]) continue;
|
|
4322
|
+
el[op.key] = true;
|
|
4323
|
+
var forwarded = op.forwarded && !!el.__stx_parent_scope;
|
|
4324
|
+
// A forwarded handler runs in its caller's scope, which the listener
|
|
4325
|
+
// layers again when it fires; one layering serves all of the row's.
|
|
4326
|
+
if (forwarded && row.forwardedScope === null) row.forwardedScope = layerTemplateScopes(globalHelpers, el.__stx_parent_scope);
|
|
4327
|
+
listenTemplateEvent(el, op.eventName, op.modifiers, op.value, forwarded ? row.forwardedScope : row.evalScope, forwarded);
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
if (pnode.inert) return;
|
|
4331
|
+
for (var k = 0; k < made.kids.length; k++) {
|
|
4332
|
+
var kid = made.kids[k];
|
|
4333
|
+
if (kid.anchor) bindRowIf(kid, made.el, row);
|
|
4334
|
+
else bindRowNode(kid, row);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
function bindRowAttribute(el, op, row, visible, urlWarning) {
|
|
4339
|
+
effect(function() {
|
|
4340
|
+
if (!visible()) return;
|
|
4341
|
+
applyBoundAttribute(el, op.attrName, evaluateRowSite(row.local, op.site, el, ''), visible, urlWarning);
|
|
4342
|
+
});
|
|
4343
|
+
}
|
|
4344
|
+
|
|
4345
|
+
function bindRowText(el, site, row) {
|
|
4346
|
+
effect(function() { stxHost.setText(el, evaluateRowSite(row.local, site, el, '')); });
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4349
|
+
function bindRowStyle(el, site, row, visible) {
|
|
4350
|
+
effect(function() {
|
|
4351
|
+
if (!visible()) return;
|
|
4352
|
+
stxHost.setStyle(el, evaluateRowSite(row.local, site, el, {}), true);
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4356
|
+
// bindClass, reading its names through the row's scope.
|
|
4357
|
+
function bindRowClass(el, site, row, visible) {
|
|
4358
|
+
var originalClasses = el.className;
|
|
4359
|
+
effect(function() {
|
|
4360
|
+
if (!visible()) return;
|
|
4361
|
+
var value = evaluateRowSite(row.local, site, el, '', true);
|
|
4362
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
4363
|
+
Object.keys(value).forEach(function(cls) {
|
|
4364
|
+
var tokens = cls.split(/\\s+/).filter(Boolean);
|
|
4365
|
+
if (value[cls]) tokens.forEach(function(t) { el.classList.add(t); });
|
|
4366
|
+
else tokens.forEach(function(t) { el.classList.remove(t); });
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4369
|
+
else if (Array.isArray(value)) {
|
|
4370
|
+
el.className = [originalClasses, value.filter(Boolean).join(' ')].filter(Boolean).join(' ');
|
|
4371
|
+
}
|
|
4372
|
+
else {
|
|
4373
|
+
el.className = [originalClasses, value || ''].filter(Boolean).join(' ');
|
|
4374
|
+
}
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4378
|
+
// bindIf for an element of a planned row. Its element is made the first
|
|
4379
|
+
// time it shows, rather than cloned with the row and removed again.
|
|
4380
|
+
function bindRowIf(made, parentEl, row) {
|
|
4381
|
+
var pnode = made.pnode;
|
|
4382
|
+
var site = pnode.ifSite;
|
|
4383
|
+
var placeholder = made.anchor;
|
|
4384
|
+
var parent = parentEl;
|
|
4385
|
+
var el = null;
|
|
4386
|
+
var isInserted = false;
|
|
4387
|
+
var childrenProcessed = false;
|
|
4388
|
+
var firstRun = true;
|
|
4389
|
+
var direct = site.ident ? readRowScope(row.local.own, site.expr.trim()) : null;
|
|
4390
|
+
var directSignal = direct && (direct._isSignal || direct._isDerived) ? direct : null;
|
|
4391
|
+
effect(function() {
|
|
4392
|
+
parent = followPlaceholder(placeholder, parent, el ? [el] : []);
|
|
4393
|
+
var value = directSignal ? directSignal() : evaluateRowSite(row.local, site, null, '');
|
|
4394
|
+
var initial = firstRun;
|
|
4395
|
+
firstRun = false;
|
|
4396
|
+
if (!el) {
|
|
4397
|
+
if (!value) return;
|
|
4398
|
+
el = makeRowBranch(pnode, row);
|
|
4399
|
+
made.el = el;
|
|
4400
|
+
if (initial) {
|
|
4401
|
+
// Shown from the start: placed as the generic path's clone was.
|
|
4402
|
+
stxHost.insert(parent, el, placeholder.nextSibling);
|
|
4403
|
+
isInserted = true;
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
stxHost.setVisible(el, !!value);
|
|
4407
|
+
if (value && !isInserted) {
|
|
4408
|
+
stxHost.insert(parent, el, placeholder.nextSibling);
|
|
4409
|
+
if (parent && parent.__stx_detached_if) parent.__stx_detached_if.delete(el);
|
|
4410
|
+
el.__stx_if_visible.set(true);
|
|
4411
|
+
el.__stx_shown_at = performance.now();
|
|
4412
|
+
isInserted = true;
|
|
4413
|
+
peek(resumeDetachedBranches);
|
|
4414
|
+
if (childrenProcessed) {
|
|
4415
|
+
queueMicrotask(function() {
|
|
4416
|
+
if (isInserted) peek(function() { resumeSubtreeScopes([el]); });
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
else if (!value && isInserted) {
|
|
4421
|
+
el.__stx_if_visible.set(false);
|
|
4422
|
+
suspendSubtreeScopes([el]);
|
|
4423
|
+
stxHost.remove(el);
|
|
4424
|
+
if (parent) {
|
|
4425
|
+
if (!parent.__stx_detached_if) parent.__stx_detached_if = new Set();
|
|
4426
|
+
parent.__stx_detached_if.add(el);
|
|
4427
|
+
}
|
|
4428
|
+
isInserted = false;
|
|
4429
|
+
}
|
|
4430
|
+
if (value && isInserted && !childrenProcessed) {
|
|
4431
|
+
childrenProcessed = true;
|
|
4432
|
+
peek(function() { hydrateRowBranch(made, row); });
|
|
4433
|
+
}
|
|
4434
|
+
});
|
|
4435
|
+
}
|
|
4436
|
+
|
|
4437
|
+
function makeRowBranch(pnode, row) {
|
|
4438
|
+
var el;
|
|
4439
|
+
if (pnode.generic) {
|
|
4440
|
+
el = stxHost.clone(pnode.tmpl);
|
|
4441
|
+
el.removeAttribute(':if');
|
|
4442
|
+
el.removeAttribute('@if');
|
|
4443
|
+
if (row.plan.component) remapRowSubtree(el, row);
|
|
4444
|
+
}
|
|
4445
|
+
else {
|
|
4446
|
+
var made = buildRowNode(pnode, row);
|
|
4447
|
+
el = made.el;
|
|
4448
|
+
el.__stx_row_made = made;
|
|
4449
|
+
}
|
|
4450
|
+
el.__stx_if_bound = true;
|
|
4451
|
+
el.__stx_if_visible = state(true);
|
|
4452
|
+
return el;
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4455
|
+
function remapRowSubtree(el, row) {
|
|
4456
|
+
var oldId = row.plan.scopeId;
|
|
4457
|
+
[el].concat(stxHost.descendants(el)).forEach(function(node) {
|
|
4458
|
+
if (!node.attributes) return;
|
|
4459
|
+
getElementAttributes(node).forEach(function(attribute) {
|
|
4460
|
+
if (typeof attribute.value === 'string' && attribute.value.indexOf(oldId) !== -1)
|
|
4461
|
+
node.setAttribute(attribute.name, attribute.value.split(oldId).join(row.scopeId));
|
|
4462
|
+
});
|
|
4463
|
+
});
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
function hydrateRowBranch(made, row) {
|
|
4467
|
+
var el = made.el;
|
|
4468
|
+
var built = el.__stx_row_made;
|
|
4469
|
+
if (built) {
|
|
4470
|
+
el.__stx_row_made = null;
|
|
4471
|
+
el.__stx_if_disposers = trackEffects(function() { bindRowNode(built, row); });
|
|
4472
|
+
resumeDetachedBranches();
|
|
4473
|
+
return;
|
|
4474
|
+
}
|
|
4475
|
+
// Generic content, processed as bindIf's shown branch is: once its row
|
|
4476
|
+
// is on the screen, since the generic walk reads the tree around it.
|
|
4477
|
+
var run = function() {
|
|
4478
|
+
if (!el.isConnected) {
|
|
4479
|
+
if (!row.inserted) { row.after.push(run); return; }
|
|
4480
|
+
var resume = function() { peek(run); };
|
|
4481
|
+
resume.el = el;
|
|
4482
|
+
detachedBranches.add(resume);
|
|
4483
|
+
return;
|
|
4484
|
+
}
|
|
4485
|
+
var wasTracked = !!el.__stx_disposers;
|
|
4486
|
+
if (wasTracked || !el.__stx_disposers)
|
|
4487
|
+
el.__stx_if_disposers = trackEffects(function() { processElement(el, row.evalScope); });
|
|
4488
|
+
resumeDetachedBranches();
|
|
4489
|
+
};
|
|
4490
|
+
run();
|
|
4491
|
+
}
|
|
4492
|
+
|
|
4493
|
+
// The scope a row's expressions read, with the layer each name lives in
|
|
4494
|
+
// found once (rowShape): the layers are the row's own objects and the
|
|
4495
|
+
// scopes it was given, so a read goes straight to the layer.
|
|
4496
|
+
function rowScopeAt(group, scope) {
|
|
4497
|
+
var own = __stxOwnOf.get(scope);
|
|
4498
|
+
var layers = new Array(group.names.length);
|
|
4499
|
+
return { scope: scope, own: own, layers: layers, shape: rowShape(group, own, layers) };
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
// bindParentComponentProps for a planned row: the caller's props, each
|
|
4503
|
+
// evaluated with the function compiled for it, written as the generic
|
|
4504
|
+
// path writes them.
|
|
4505
|
+
function bindRowProps(root, row, callerScope) {
|
|
4506
|
+
root.__stx_parent_props_bound = true;
|
|
4507
|
+
var props = row.plan.props;
|
|
4508
|
+
var caller = row.caller = rowScopeAt(row.plan.prop, layerTemplateScopes(globalHelpers, callerScope));
|
|
4509
|
+
for (var i = 0; i < props.length; i++) bindRowProp(root, props[i], caller);
|
|
4510
|
+
}
|
|
4511
|
+
|
|
4512
|
+
function bindRowProp(root, prop, caller) {
|
|
4513
|
+
var name = prop.name;
|
|
4514
|
+
effect(function() {
|
|
4515
|
+
var value = evaluateRowSite(caller, prop.site, root, undefined);
|
|
4516
|
+
if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();
|
|
4517
|
+
if (name.startsWith('aria-') && typeof value === 'boolean') stxHost.setAttribute(root, name, String(value));
|
|
4518
|
+
else if (value === null || value === undefined) stxHost.removeAttribute(root, name);
|
|
4519
|
+
else stxHost.setAttribute(root, name, value);
|
|
4520
|
+
syncComponentPropSignal(root, name, value);
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
|
|
4524
|
+
// A row of \`plan\`, bound before it is inserted. \`parent\` is where it will
|
|
4525
|
+
// go; the caller inserts it and then calls finishNativeRow.
|
|
4526
|
+
function createNativeRow(plan, itemScope, parent) {
|
|
4527
|
+
var row = { plan: plan, root: null, scope: null, evalScope: null, local: null, caller: null, forwardedScope: null, outer: [], after: [], inserted: false, scopeVars: null, scopeId: null };
|
|
4528
|
+
for (var node = parent; node; node = node.parentNode) if (node.__stx_if_visible) row.outer.push(node.__stx_if_visible);
|
|
4529
|
+
if (plan.component) row.scopeId = plan.scopeId + '_for_' + (++__forComponentScopeCounter);
|
|
4530
|
+
var made = buildRowNode(plan.root, row);
|
|
4531
|
+
var root = made.el;
|
|
4532
|
+
row.root = root;
|
|
4533
|
+
if (plan.component) {
|
|
4534
|
+
if (!root.hasAttribute('data-stx-template-scope')) root.setAttribute('data-stx-template-scope', plan.scopeId);
|
|
4535
|
+
root.setAttribute('data-stx-scope', row.scopeId);
|
|
4536
|
+
if (!(window.stx._scopes && window.stx._scopes[row.scopeId])) runClonedComponentSetup(plan.setup, root);
|
|
4537
|
+
var callerScope = componentCallerScopeFrom(parent, itemScope);
|
|
4538
|
+
root.__stx_parent_scope = callerScope;
|
|
4539
|
+
if (plan.props.length) bindRowProps(root, row, callerScope);
|
|
4540
|
+
var scopeVars = window.stx._scopes && window.stx._scopes[row.scopeId];
|
|
4541
|
+
if (!scopeVars) return { root: root, row: row };
|
|
4542
|
+
scopeVars.__el = root;
|
|
4543
|
+
row.scopeVars = scopeVars;
|
|
4544
|
+
row.scope = layerTemplateScopes(callerScope, scopeVars);
|
|
4545
|
+
// processElement layers the helpers and the component's variables over
|
|
4546
|
+
// this scope for each element; it already starts with the helpers (the
|
|
4547
|
+
// item scope's first layer) and ends with the variables, so the same
|
|
4548
|
+
// names resolve to the same layers through it as it is.
|
|
4549
|
+
row.evalScope = row.scope;
|
|
4550
|
+
}
|
|
4551
|
+
else {
|
|
4552
|
+
row.scope = itemScope;
|
|
4553
|
+
row.evalScope = layerTemplateScopes(globalHelpers, itemScope, findElementScope(parent) || {});
|
|
4554
|
+
}
|
|
4555
|
+
row.local = rowScopeAt(plan.eval, row.evalScope);
|
|
4556
|
+
var dispose = trackEffects(function() { bindRowNode(made, row); });
|
|
4557
|
+
if (plan.component) root.__stx_disposers = dispose;
|
|
4558
|
+
else root.__stx_effect_disposers = dispose;
|
|
4559
|
+
return { root: root, row: row };
|
|
4560
|
+
}
|
|
4561
|
+
|
|
4562
|
+
function finishNativeRow(created) {
|
|
4563
|
+
var row = created.row;
|
|
4564
|
+
row.inserted = true;
|
|
4565
|
+
var scopeVars = row.scopeVars;
|
|
4566
|
+
if (scopeVars && scopeVars.__mountCallbacks && !scopeVars.__mounted) {
|
|
4567
|
+
scopeVars.__mounted = true;
|
|
4568
|
+
runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
|
|
4569
|
+
}
|
|
4570
|
+
var after = row.after.splice(0, row.after.length);
|
|
4571
|
+
for (var i = 0; i < after.length; i++) after[i]();
|
|
4572
|
+
}
|
|
3872
4573
|
`;var Ce=` // Also expose globally for convenience
|
|
3873
4574
|
window.state = state;
|
|
3874
4575
|
window.derived = derived;
|
|
@@ -3936,10 +4637,27 @@ catch (e) {
|
|
|
3936
4637
|
// Note: SPA Router and View Transitions CSS are provided by the canonical
|
|
3937
4638
|
// router script (packages/router/src/client.ts) which is injected alongside
|
|
3938
4639
|
// the signals runtime or via the @stxRouter directive.
|
|
3939
|
-
`;var
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
4640
|
+
`;var Re=` // Each answer depends only on the expression and the name, and each is a
|
|
4641
|
+
// regular expression built for the pair: asked for every signal a binding
|
|
4642
|
+
// or prop reads, so it is kept (and a name the expression does not hold
|
|
4643
|
+
// is answered without one).
|
|
4644
|
+
const __stxSignalPatterns = new Map();
|
|
4645
|
+
function rememberedSignalPattern(kind, expression, name, test) {
|
|
4646
|
+
if (expression.indexOf(name) === -1) return false;
|
|
4647
|
+
var key = kind + '\\u0001' + name + '\\u0001' + expression;
|
|
4648
|
+
var known = __stxSignalPatterns.get(key);
|
|
4649
|
+
if (known === undefined) {
|
|
4650
|
+
if (__stxSignalPatterns.size >= 5000) __stxSignalPatterns.clear();
|
|
4651
|
+
known = test(expression, name);
|
|
4652
|
+
__stxSignalPatterns.set(key, known);
|
|
4653
|
+
}
|
|
4654
|
+
return known;
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
function expressionUsesSignalApi(expression, name) {
|
|
4658
|
+
return rememberedSignalPattern('api', expression, name, function(text, signalName) {
|
|
4659
|
+
return expressionUsesSignalMethod(text, signalName) || expressionUsesSignalValue(text, signalName);
|
|
4660
|
+
});
|
|
3943
4661
|
}
|
|
3944
4662
|
|
|
3945
4663
|
function expressionUsesSignalMethod(expression, name) {
|
|
@@ -3953,31 +4671,58 @@ catch (e) {
|
|
|
3953
4671
|
}
|
|
3954
4672
|
|
|
3955
4673
|
function expressionCallsSignal(expression, name) {
|
|
4674
|
+
return rememberedSignalPattern('call', expression, name, expressionCallsSignalNow);
|
|
4675
|
+
}
|
|
4676
|
+
|
|
4677
|
+
function expressionCallsSignalNow(expression, name) {
|
|
3956
4678
|
var escapedName = name.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');
|
|
3957
4679
|
return new RegExp('(?:^|[^\\\\w$])' + escapedName + '\\\\s*\\\\(').test(expression);
|
|
3958
4680
|
}
|
|
3959
4681
|
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
4682
|
+
// What an expression does with a signal it names: calls it, calls one of
|
|
4683
|
+
// its methods, reads its .value, or none of these. It depends only on the
|
|
4684
|
+
// expression and the name, so it is worked out once: three regular
|
|
4685
|
+
// expressions were built for every signal an expression read, every time
|
|
4686
|
+
// it ran.
|
|
4687
|
+
const __stxSignalUse = new Map();
|
|
4688
|
+
function expressionSignalUse(expression, name) {
|
|
4689
|
+
let uses = __stxSignalUse.get(expression);
|
|
4690
|
+
if (uses === undefined) {
|
|
4691
|
+
if (__stxSignalUse.size >= 5000) __stxSignalUse.clear();
|
|
4692
|
+
uses = new Map();
|
|
4693
|
+
__stxSignalUse.set(expression, uses);
|
|
4694
|
+
}
|
|
4695
|
+
let use = uses.get(name);
|
|
4696
|
+
if (use === undefined) {
|
|
4697
|
+
use = expression.indexOf(name) === -1 ? 0
|
|
4698
|
+
: expressionCallsSignal(expression, name) || expressionUsesSignalMethod(expression, name) ? 1
|
|
4699
|
+
: expressionUsesSignalValue(expression, name) ? 2 : 0;
|
|
4700
|
+
uses.set(name, use);
|
|
4701
|
+
}
|
|
4702
|
+
return use;
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4705
|
+
function expressionKeepsSignal(expression, prop, signal) {
|
|
4706
|
+
if (typeof prop !== 'string') return false;
|
|
4707
|
+
const use = expressionSignalUse(expression, prop);
|
|
4708
|
+
if (use === 1) return true;
|
|
4709
|
+
if (use === 0) return false;
|
|
4710
|
+
// A :for item is itself represented by a signal. If that item's value
|
|
4711
|
+
// is an object with a real value field, item.value means the field,
|
|
4712
|
+
// not the signal wrapper API. Primitive signals still support
|
|
4713
|
+
// count.value, matching the explicit ref syntax.
|
|
4714
|
+
try {
|
|
4715
|
+
var currentValue = signal();
|
|
4716
|
+
return !(currentValue && typeof currentValue === 'object'
|
|
4717
|
+
&& Object.prototype.hasOwnProperty.call(currentValue, 'value'));
|
|
4718
|
+
}
|
|
4719
|
+
catch (e) {
|
|
4720
|
+
return true;
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
3967
4723
|
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
// not the signal wrapper API. Primitive signals still support
|
|
3971
|
-
// count.value, matching the explicit ref syntax.
|
|
3972
|
-
try {
|
|
3973
|
-
var currentValue = signal();
|
|
3974
|
-
return !(currentValue && typeof currentValue === 'object'
|
|
3975
|
-
&& Object.prototype.hasOwnProperty.call(currentValue, 'value'));
|
|
3976
|
-
}
|
|
3977
|
-
catch (e) {
|
|
3978
|
-
return true;
|
|
3979
|
-
}
|
|
3980
|
-
});
|
|
4724
|
+
function createExpressionAutoUnwrapProxy(scope, expression) {
|
|
4725
|
+
return createExpressionUnwrapProxy(scope, expression);
|
|
3981
4726
|
}
|
|
3982
4727
|
|
|
3983
4728
|
function executeHandler(expr, event, el) {
|
|
@@ -4018,7 +4763,7 @@ catch (e) {
|
|
|
4018
4763
|
console.warn('[STX] Handler error:', expr, e);
|
|
4019
4764
|
}
|
|
4020
4765
|
}
|
|
4021
|
-
`;var
|
|
4766
|
+
`;var Oe=` // ==========================================================================
|
|
4022
4767
|
// Client-side useHead / useSeoMeta
|
|
4023
4768
|
// ==========================================================================
|
|
4024
4769
|
|
|
@@ -4110,7 +4855,58 @@ catch (e) {
|
|
|
4110
4855
|
if (config.canonical) meta.push({ property: 'og:url', content: config.canonical });
|
|
4111
4856
|
useHead({ title: config.title || config.ogTitle, meta: meta });
|
|
4112
4857
|
}
|
|
4113
|
-
`;var
|
|
4858
|
+
`;var De=` // ==========================================================================
|
|
4859
|
+
// Name and word lists, remembered
|
|
4860
|
+
// ==========================================================================
|
|
4861
|
+
|
|
4862
|
+
// The same few strings (a component's parent-binding names, a prop's name)
|
|
4863
|
+
// are taken apart for every row of every list. A regular expression split
|
|
4864
|
+
// or replace is among the slowest things an interpreted engine does, so
|
|
4865
|
+
// each answer is kept. Callers must not change a returned list.
|
|
4866
|
+
var __stxWordLists = new Map();
|
|
4867
|
+
function __stxWords(text) {
|
|
4868
|
+
var words = __stxWordLists.get(text);
|
|
4869
|
+
if (words === undefined) {
|
|
4870
|
+
words = String(text).split(/\\s+/).filter(Boolean);
|
|
4871
|
+
if (__stxWordLists.size >= 2000) __stxWordLists.clear();
|
|
4872
|
+
__stxWordLists.set(text, words);
|
|
4873
|
+
}
|
|
4874
|
+
return words;
|
|
4875
|
+
}
|
|
4876
|
+
var __stxCamelNames = new Map();
|
|
4877
|
+
function __stxCamel(name) {
|
|
4878
|
+
var camel = __stxCamelNames.get(name);
|
|
4879
|
+
if (camel === undefined) {
|
|
4880
|
+
camel = name.replace(/-([a-z0-9])/g, function(_, c) { return c.toUpperCase(); });
|
|
4881
|
+
if (__stxCamelNames.size >= 2000) __stxCamelNames.clear();
|
|
4882
|
+
__stxCamelNames.set(name, camel);
|
|
4883
|
+
}
|
|
4884
|
+
return camel;
|
|
4885
|
+
}
|
|
4886
|
+
// A component's static props, as its wrapper carries them: the same text
|
|
4887
|
+
// for every row of a list, parsed once. Callers only read the result.
|
|
4888
|
+
var __stxPropTexts = new Map();
|
|
4889
|
+
function __stxParsedProps(text) {
|
|
4890
|
+
var parsed = __stxPropTexts.get(text);
|
|
4891
|
+
if (parsed === undefined) {
|
|
4892
|
+
parsed = JSON.parse(text);
|
|
4893
|
+
if (__stxPropTexts.size >= 2000) __stxPropTexts.clear();
|
|
4894
|
+
__stxPropTexts.set(text, parsed);
|
|
4895
|
+
}
|
|
4896
|
+
return parsed;
|
|
4897
|
+
}
|
|
4898
|
+
var __stxKebabNames = new Map();
|
|
4899
|
+
function __stxKebab(name) {
|
|
4900
|
+
var kebab = __stxKebabNames.get(name);
|
|
4901
|
+
if (kebab === undefined) {
|
|
4902
|
+
kebab = name.replace(/([A-Z])/g, function(_, c) { return '-' + c.toLowerCase(); });
|
|
4903
|
+
if (__stxKebabNames.size >= 2000) __stxKebabNames.clear();
|
|
4904
|
+
__stxKebabNames.set(name, kebab);
|
|
4905
|
+
}
|
|
4906
|
+
return kebab;
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
// ==========================================================================
|
|
4114
4910
|
// Global Helpers (Feature #5)
|
|
4115
4911
|
// ==========================================================================
|
|
4116
4912
|
|
|
@@ -4239,7 +5035,7 @@ catch (e) {
|
|
|
4239
5035
|
const deps = depsMap.get(key);
|
|
4240
5036
|
if (deps) notifySubscribers(deps);
|
|
4241
5037
|
}
|
|
4242
|
-
`;var
|
|
5038
|
+
`;var Pe=` // \u2500\u2500 Host \u2500\u2500
|
|
4243
5039
|
//
|
|
4244
5040
|
// The tree this runtime mutates. Every write the binding layer makes to a
|
|
4245
5041
|
// node goes through here, so the same runtime can drive something that is not
|
|
@@ -4541,7 +5337,7 @@ catch (e) {
|
|
|
4541
5337
|
}
|
|
4542
5338
|
window.dispatchEvent(new CustomEvent('stx:hydrated', { detail: { el: container, trigger: 'stream' } }));
|
|
4543
5339
|
}
|
|
4544
|
-
`;var
|
|
5340
|
+
`;var Le=` // ==========================================================================
|
|
4545
5341
|
// Post-hydration invariant sweep (stacksjs/stx#1773)
|
|
4546
5342
|
// ==========================================================================
|
|
4547
5343
|
//
|
|
@@ -4751,7 +5547,7 @@ catch (e) {
|
|
|
4751
5547
|
_exprFailureCount = 0;
|
|
4752
5548
|
}
|
|
4753
5549
|
}
|
|
4754
|
-
`;var
|
|
5550
|
+
`;var Ve=` // Reactive if/else-if/else chain. A single effect drives mutual exclusion:
|
|
4755
5551
|
// on each run it picks the first branch whose condition is truthy (the
|
|
4756
5552
|
// trailing x-else always matches), inserts that branch, and removes
|
|
4757
5553
|
// whichever branch was previously shown. One effect for the whole chain
|
|
@@ -5037,7 +5833,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5037
5833
|
// Shown branches whose deferred bind found them off the page: an enclosing
|
|
5038
5834
|
// :if, bound later in the same pass, hid them between the queue and the run.
|
|
5039
5835
|
// Their own condition has not changed, so their effect never runs again to
|
|
5040
|
-
// retry; each resumes here when an enclosing branch puts it back.`;var
|
|
5836
|
+
// retry; each resumes here when an enclosing branch puts it back.`;var He=` const detachedBranches = new Set();
|
|
5041
5837
|
function resumeDetachedBranches() {
|
|
5042
5838
|
if (!detachedBranches.size) return;
|
|
5043
5839
|
Array.from(detachedBranches).forEach(function(resume) {
|
|
@@ -5389,7 +6185,7 @@ else if (!value && isInserted) {
|
|
|
5389
6185
|
}
|
|
5390
6186
|
});
|
|
5391
6187
|
}
|
|
5392
|
-
`;function
|
|
6188
|
+
`;function Fe(e,o,l,r,d){return` // One request for every caller that wants the same answer: run joins one
|
|
5393
6189
|
// in flight, fresh waits one out and asks again, latest replaces a request
|
|
5394
6190
|
// counter. See shared-request.ts; cached queries are built on it.
|
|
5395
6191
|
var sharedRequest = (${d});
|
|
@@ -5408,8 +6204,8 @@ else if (!value && isInserted) {
|
|
|
5408
6204
|
// off the critical path and read back asynchronously. Values kept before it
|
|
5409
6205
|
// are read where they are.
|
|
5410
6206
|
var STX_KEPT_PREFIX = 'stx:kept:';
|
|
5411
|
-
var __stxKept = (${e})(undefined, ${
|
|
5412
|
-
var __stxQueries = (${
|
|
6207
|
+
var __stxKept = (${e})(undefined, ${o});
|
|
6208
|
+
var __stxQueries = (${l})({ state: state, kept: __stxKept, prefix: STX_KEPT_PREFIX, matches: ${r}, sharedRequest: sharedRequest });
|
|
5413
6209
|
function stxKeptPrefix(scope) {
|
|
5414
6210
|
return STX_KEPT_PREFIX + (scope === undefined || scope === null || scope === '' ? '' : String(scope) + ':');
|
|
5415
6211
|
}
|
|
@@ -5453,7 +6249,7 @@ else if (!value && isInserted) {
|
|
|
5453
6249
|
function cachedQuery(key, options) {
|
|
5454
6250
|
return __stxQueries.cachedQuery(key, options);
|
|
5455
6251
|
}
|
|
5456
|
-
`}var
|
|
6252
|
+
`}var je=` // Lazy hydration: defer processElement for subtrees marked with stx-hydrate.
|
|
5457
6253
|
// Triggers: "visible" (IntersectionObserver), "idle" (requestIdleCallback),
|
|
5458
6254
|
// "interaction" (mouseenter/click/focus), "media:<query>" (matchMedia).
|
|
5459
6255
|
function deferHydration(el, trigger, scope) {
|
|
@@ -5585,7 +6381,7 @@ else if (!value && isInserted) {
|
|
|
5585
6381
|
run();
|
|
5586
6382
|
}
|
|
5587
6383
|
}
|
|
5588
|
-
`;var
|
|
6384
|
+
`;var Ue=` // ==========================================================================
|
|
5589
6385
|
// Lifecycle
|
|
5590
6386
|
// ==========================================================================
|
|
5591
6387
|
|
|
@@ -5713,7 +6509,7 @@ else if (!value && isInserted) {
|
|
|
5713
6509
|
// Drain any early mount/destroy calls captured by the pre-initialization shim
|
|
5714
6510
|
if (window.__stx_early_mounts) { window.__stx_early_mounts.forEach(function(fn) { mountCallbacks.push(fn); }); window.__stx_early_mounts = null; }
|
|
5715
6511
|
if (window.__stx_early_destroys) { window.__stx_early_destroys.forEach(function(fn) { destroyCallbacks.push(fn); }); window.__stx_early_destroys = null; }
|
|
5716
|
-
`;var
|
|
6512
|
+
`;var qe=` var __forComponentScopeCounter = 0;
|
|
5717
6513
|
var __forComponentSetupFactories = new Map();
|
|
5718
6514
|
|
|
5719
6515
|
function forEachGroupElement(nodes, callback) {
|
|
@@ -5778,7 +6574,7 @@ else if (!value && isInserted) {
|
|
|
5778
6574
|
}
|
|
5779
6575
|
});
|
|
5780
6576
|
}
|
|
5781
|
-
`;var
|
|
6577
|
+
`;var Be=` // A :for row is a clone of its template, so a conditional element in the row
|
|
5782
6578
|
// is built for every row whether or not its condition ever holds; :if then
|
|
5783
6579
|
// parks the false ones. In WebKit a <video> or <audio> sets up a media player
|
|
5784
6580
|
// as it is created: a message list with one media slot per attachment took
|
|
@@ -5891,7 +6687,7 @@ else if (!value && isInserted) {
|
|
|
5891
6687
|
el.appendChild(fragment);
|
|
5892
6688
|
remapForComponentScopes([el]);
|
|
5893
6689
|
}
|
|
5894
|
-
`;var
|
|
6690
|
+
`;var Ke=` // A loop row binds in its own iteration scope, and only its loop puts it
|
|
5895
6691
|
// there. A walk from further out (an enclosing :if hydrating the branch it
|
|
5896
6692
|
// shows) carries no item, so it used to bind whatever in the row was still
|
|
5897
6693
|
// unbound -- a conditional's children, waiting for their own deferred pass
|
|
@@ -5931,7 +6727,7 @@ else if (!value && isInserted) {
|
|
|
5931
6727
|
}
|
|
5932
6728
|
return now;
|
|
5933
6729
|
}
|
|
5934
|
-
`;var
|
|
6730
|
+
`;var Ge=` /**
|
|
5935
6731
|
* Bind what the server said carries a binding, instead of looking for it.
|
|
5936
6732
|
*
|
|
5937
6733
|
* The walk exists because the runtime does not know where the bindings are.
|
|
@@ -6042,7 +6838,7 @@ else if (!value && isInserted) {
|
|
|
6042
6838
|
}
|
|
6043
6839
|
};
|
|
6044
6840
|
}
|
|
6045
|
-
`;var
|
|
6841
|
+
`;var $e=` function bindModel(el, expr, passedScope = componentScope, attrName = '@model') {
|
|
6046
6842
|
if (el.__stx_model_bound) return;
|
|
6047
6843
|
el.__stx_model_bound = true;
|
|
6048
6844
|
const tag = el.tagName.toLowerCase();
|
|
@@ -6200,7 +6996,7 @@ else {
|
|
|
6200
6996
|
|
|
6201
6997
|
el.removeAttribute(attrName);
|
|
6202
6998
|
}
|
|
6203
|
-
`;var
|
|
6999
|
+
`;var We=` mountEl: function(selector, setupFn) {
|
|
6204
7000
|
function doMount() {
|
|
6205
7001
|
var root = document.querySelector(selector);
|
|
6206
7002
|
if (!root) { console.warn('[stx] mountEl: element not found:', selector); return; }
|
|
@@ -6646,7 +7442,7 @@ else {
|
|
|
6646
7442
|
}
|
|
6647
7443
|
};
|
|
6648
7444
|
}
|
|
6649
|
-
`;var
|
|
7445
|
+
`;var Xe=` // ==========================================================================
|
|
6650
7446
|
// Optimistic State (useOptimistic) \u2014 stacksjs/stx#1742
|
|
6651
7447
|
// ==========================================================================
|
|
6652
7448
|
// Mirrors signals-api.ts useOptimistic. Shows base + pending actions while an
|
|
@@ -6679,7 +7475,7 @@ else {
|
|
|
6679
7475
|
}
|
|
6680
7476
|
return [optimistic, addOptimistic];
|
|
6681
7477
|
}
|
|
6682
|
-
`;var
|
|
7478
|
+
`;var Qe=` // \u2500\u2500 Overlay stack \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
6683
7479
|
//
|
|
6684
7480
|
// One stack for everything that takes over the page: stxAlert/stxConfirm,
|
|
6685
7481
|
// the runtime modal and drawer, @stacksjs/components' Dialog and Drawer, and
|
|
@@ -7053,7 +7849,7 @@ else {
|
|
|
7053
7849
|
else modal.open(id);
|
|
7054
7850
|
}
|
|
7055
7851
|
};
|
|
7056
|
-
`;var
|
|
7852
|
+
`;var Ye=` // ==========================================================================
|
|
7057
7853
|
// Advanced Data Fetching (useQuery / useMutation)
|
|
7058
7854
|
// ==========================================================================
|
|
7059
7855
|
|
|
@@ -7403,7 +8199,7 @@ finally {
|
|
|
7403
8199
|
reset: function() { data.set(null); error.set(null); loading.set(false); }
|
|
7404
8200
|
};
|
|
7405
8201
|
}
|
|
7406
|
-
`;var
|
|
8202
|
+
`;var Je=` // ==========================================================================
|
|
7407
8203
|
// Notify
|
|
7408
8204
|
// ==========================================================================
|
|
7409
8205
|
|
|
@@ -7428,16 +8224,16 @@ finally {
|
|
|
7428
8224
|
collectSubscribers(subscribers, reached);
|
|
7429
8225
|
reached.forEach(function(e) { e(); });
|
|
7430
8226
|
}
|
|
7431
|
-
`;function
|
|
8227
|
+
`;function Ze(e,o,l){return`${e} // ==========================================================================
|
|
7432
8228
|
// Reactive Core
|
|
7433
8229
|
// ==========================================================================
|
|
7434
8230
|
|
|
7435
|
-
${
|
|
8231
|
+
${o}
|
|
7436
8232
|
let activeEffect = null;
|
|
7437
8233
|
const effectStack = [];
|
|
7438
8234
|
const pendingEffects = new Set();
|
|
7439
8235
|
let isBatching = false;
|
|
7440
|
-
${
|
|
8236
|
+
${Je}
|
|
7441
8237
|
|
|
7442
8238
|
// DevTools Phase 2 (#1747): dev-mode reactivity instrumentation. OFF by
|
|
7443
8239
|
// default \u2014 even in the dev runtime \u2014 so set()/effect-run stay zero-overhead
|
|
@@ -7454,9 +8250,9 @@ ${Ye}
|
|
|
7454
8250
|
function __stxDevtoolsNow() { return (typeof performance !== 'undefined' && performance.now) ? performance.now() : Date.now(); }
|
|
7455
8251
|
function __stxDevtoolsRecordIf(rec) { if (!__stxDevtoolsTracking) return; __stxDevtoolsIfTrace.push(rec); if (__stxDevtoolsIfTrace.length > 100) __stxDevtoolsIfTrace.shift(); }
|
|
7456
8252
|
function __stxDevtoolsRecordQuery(rec) { if (!__stxDevtoolsTracking) return; __stxDevtoolsQueries.push(rec); if (__stxDevtoolsQueries.length > 100) __stxDevtoolsQueries.shift(); }
|
|
7457
|
-
${
|
|
8253
|
+
${l}
|
|
7458
8254
|
let activeDisposers = null; // Array | null \u2014 when non-null, effects auto-register their dispose fn
|
|
7459
|
-
const targetMap = new WeakMap();`}var
|
|
8255
|
+
const targetMap = new WeakMap();`}var et=` // Vue-compat aliases
|
|
7460
8256
|
var ref = state;
|
|
7461
8257
|
|
|
7462
8258
|
// reactive() used to be a bare alias of state(), which made it the most
|
|
@@ -7521,7 +8317,7 @@ ${i}
|
|
|
7521
8317
|
return proxy;
|
|
7522
8318
|
}
|
|
7523
8319
|
var computed = derived;
|
|
7524
|
-
var watchEffect = function(fn) { return effect(fn); };`;var
|
|
8320
|
+
var watchEffect = function(fn) { return effect(fn); };`;var tt=` // ==========================================================================
|
|
7525
8321
|
// Pipe Syntax Support (Feature #2)
|
|
7526
8322
|
// ==========================================================================
|
|
7527
8323
|
|
|
@@ -7536,6 +8332,22 @@ ${i}
|
|
|
7536
8332
|
if (expr.indexOf('|') === -1) return null;
|
|
7537
8333
|
const known = __stxPipeIndex.get(expr);
|
|
7538
8334
|
if (known === -1) return null;
|
|
8335
|
+
// Nearly every bar is half of a ||: when no bar stands alone, there is no
|
|
8336
|
+
// pipe, and the character scan below (slow in an interpreter, for an
|
|
8337
|
+
// expression of any length) has nothing to find.
|
|
8338
|
+
if (known === undefined) {
|
|
8339
|
+
let bar = expr.indexOf('|');
|
|
8340
|
+
while (bar !== -1) {
|
|
8341
|
+
if (expr.charCodeAt(bar + 1) === 124) { bar = expr.indexOf('|', bar + 2); continue; }
|
|
8342
|
+
if (bar > 0 && expr.charCodeAt(bar - 1) === 63) { bar = expr.indexOf('|', bar + 1); continue; }
|
|
8343
|
+
break;
|
|
8344
|
+
}
|
|
8345
|
+
if (bar === -1) {
|
|
8346
|
+
if (__stxPipeIndex.size >= 5000) __stxPipeIndex.clear();
|
|
8347
|
+
__stxPipeIndex.set(expr, -1);
|
|
8348
|
+
return null;
|
|
8349
|
+
}
|
|
8350
|
+
}
|
|
7539
8351
|
// Find pipe operators: single | that's not part of || or preceded by ?
|
|
7540
8352
|
// We need to find | that is:
|
|
7541
8353
|
// 1. Not preceded by | or ?
|
|
@@ -7707,7 +8519,46 @@ else {
|
|
|
7707
8519
|
|
|
7708
8520
|
return value;
|
|
7709
8521
|
}
|
|
7710
|
-
`;function
|
|
8522
|
+
`;function nt(e,o,l){return` // Known directive names to exclude from generic :attr binding
|
|
8523
|
+
var DIRECTIVE_NAMES = ${e};
|
|
8524
|
+
|
|
8525
|
+
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
8526
|
+
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
8527
|
+
// substituted into an href, and x-href over a signal reaches the same
|
|
8528
|
+
// attribute by another road. Same policy, same unsafe: prefix, so a page
|
|
8529
|
+
// behaves the same whether the value arrived at render or at runtime.
|
|
8530
|
+
var URL_NAV_ATTR = {href:1, 'xlink:href':1, action:1, formaction:1, ping:1, cite:1, manifest:1, data:1, to:1};
|
|
8531
|
+
var URL_FETCH_ATTR = {src:1, srcset:1, poster:1, background:1};
|
|
8532
|
+
function __stxSafeUrlAttr(attrName, value, warning) {
|
|
8533
|
+
var navigable = URL_NAV_ATTR[attrName];
|
|
8534
|
+
if (!navigable && !URL_FETCH_ATTR[attrName]) return value;
|
|
8535
|
+
if (typeof value !== 'string' || !value) return value;
|
|
8536
|
+
// Browsers ignore ASCII whitespace and controls inside a scheme and match
|
|
8537
|
+
// it case-insensitively, so the spellings collapse before the test.
|
|
8538
|
+
var probe = value.replace(/[\\u0000-\\u0020\\u00a0\\u2000-\\u200f\\u2028\\u2029\\ufeff]+/g, '').toLowerCase();
|
|
8539
|
+
var refused = /^(?:javascript|vbscript|livescript|mocha|view-source):/.test(probe)
|
|
8540
|
+
|| (navigable
|
|
8541
|
+
? /^data:(?:text\\/html|text\\/xml|application\\/xhtml\\+xml|application\\/xml|image\\/svg\\+xml)/.test(probe)
|
|
8542
|
+
: /^data:(?:text\\/html|application\\/xhtml\\+xml)/.test(probe));
|
|
8543
|
+
if (!refused) return value;
|
|
8544
|
+
if (!warning.warned) {
|
|
8545
|
+
warning.warned = true;
|
|
8546
|
+
console.warn('[stx] refused a ' + attrName + ' value whose scheme can run script: ' + probe.slice(0, 24));
|
|
8547
|
+
}
|
|
8548
|
+
return 'unsafe:' + value;
|
|
8549
|
+
}
|
|
8550
|
+
// SVG attributes are case-sensitive, but the HTML parser lowercases
|
|
8551
|
+
// prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
|
|
8552
|
+
// the spec's "adjust SVG attributes" step only covers unprefixed names.
|
|
8553
|
+
// Without restoring the canonical casing, setAttribute('viewbox') creates
|
|
8554
|
+
// a dead duplicate attribute and the real viewBox never updates.
|
|
8555
|
+
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
8556
|
+
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
8557
|
+
var EVENT_RE = ${o};
|
|
8558
|
+
var X_HANDLED = ${l};
|
|
8559
|
+
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
8560
|
+
|
|
8561
|
+
// True for text a binding wrote, or markup :html injected: data, never
|
|
7711
8562
|
// template. Checked only for text that holds braces, so the climb is rare.
|
|
7712
8563
|
function isInertContent(node) {
|
|
7713
8564
|
for (var n = node; n; n = n.parentNode) if (n.__stx_inert_content) return true;
|
|
@@ -7949,7 +8800,8 @@ else if (part) {
|
|
|
7949
8800
|
const activeScope = evaluationScope || attrCapturedScope;
|
|
7950
8801
|
// Decode HTML entities that browsers may encode in attribute values
|
|
7951
8802
|
// e.g. :text="a > b" may be stored as :text="a > b" in HTML
|
|
7952
|
-
|
|
8803
|
+
// Nearly no expression holds an entity: six replaces on every run of every binding.
|
|
8804
|
+
var expr = rawExpr.indexOf('&') === -1 ? rawExpr : rawExpr.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'");
|
|
7953
8805
|
try {
|
|
7954
8806
|
if (/^__[A-Z_]+__$/.test(expr.trim())) return expr;
|
|
7955
8807
|
|
|
@@ -7993,44 +8845,8 @@ catch (e2) {
|
|
|
7993
8845
|
}
|
|
7994
8846
|
};
|
|
7995
8847
|
|
|
7996
|
-
//
|
|
7997
|
-
var
|
|
7998
|
-
|
|
7999
|
-
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
8000
|
-
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
8001
|
-
// substituted into an href, and x-href over a signal reaches the same
|
|
8002
|
-
// attribute by another road. Same policy, same unsafe: prefix, so a page
|
|
8003
|
-
// behaves the same whether the value arrived at render or at runtime.
|
|
8004
|
-
var URL_NAV_ATTR = {href:1, 'xlink:href':1, action:1, formaction:1, ping:1, cite:1, manifest:1, data:1, to:1};
|
|
8005
|
-
var URL_FETCH_ATTR = {src:1, srcset:1, poster:1, background:1};
|
|
8006
|
-
var urlRefusalWarned = false;
|
|
8007
|
-
function safeUrlAttr(attrName, value) {
|
|
8008
|
-
var navigable = URL_NAV_ATTR[attrName];
|
|
8009
|
-
if (!navigable && !URL_FETCH_ATTR[attrName]) return value;
|
|
8010
|
-
if (typeof value !== 'string' || !value) return value;
|
|
8011
|
-
// Browsers ignore ASCII whitespace and controls inside a scheme and match
|
|
8012
|
-
// it case-insensitively, so the spellings collapse before the test.
|
|
8013
|
-
var probe = value.replace(/[\\u0000-\\u0020\\u00a0\\u2000-\\u200f\\u2028\\u2029\\ufeff]+/g, '').toLowerCase();
|
|
8014
|
-
var refused = /^(?:javascript|vbscript|livescript|mocha|view-source):/.test(probe)
|
|
8015
|
-
|| (navigable
|
|
8016
|
-
? /^data:(?:text\\/html|text\\/xml|application\\/xhtml\\+xml|application\\/xml|image\\/svg\\+xml)/.test(probe)
|
|
8017
|
-
: /^data:(?:text\\/html|application\\/xhtml\\+xml)/.test(probe));
|
|
8018
|
-
if (!refused) return value;
|
|
8019
|
-
if (!urlRefusalWarned) {
|
|
8020
|
-
urlRefusalWarned = true;
|
|
8021
|
-
console.warn('[stx] refused a ' + attrName + ' value whose scheme can run script: ' + probe.slice(0, 24));
|
|
8022
|
-
}
|
|
8023
|
-
return 'unsafe:' + value;
|
|
8024
|
-
}
|
|
8025
|
-
// SVG attributes are case-sensitive, but the HTML parser lowercases
|
|
8026
|
-
// prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
|
|
8027
|
-
// the spec's "adjust SVG attributes" step only covers unprefixed names.
|
|
8028
|
-
// Without restoring the canonical casing, setAttribute('viewbox') creates
|
|
8029
|
-
// a dead duplicate attribute and the real viewBox never updates.
|
|
8030
|
-
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
8031
|
-
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
8032
|
-
var EVENT_RE = ${s};
|
|
8033
|
-
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
8848
|
+
// One refusal warning per element, as before the policy moved out.
|
|
8849
|
+
var urlWarning = { warned: false };
|
|
8034
8850
|
|
|
8035
8851
|
// Handle attributes
|
|
8036
8852
|
getElementAttributes(el).forEach(attr => {
|
|
@@ -8065,13 +8881,12 @@ catch (e2) {
|
|
|
8065
8881
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
8066
8882
|
// x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
|
|
8067
8883
|
// handled by their own code paths below \u2014 exclude them here.
|
|
8068
|
-
var X_HANDLED = ${i};
|
|
8069
8884
|
if (name.startsWith('@bind:') || name.startsWith('x-bind:')
|
|
8070
8885
|
|| (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
|
|
8071
8886
|
|| (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
|
|
8072
8887
|
let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
|
|
8073
8888
|
if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
|
|
8074
|
-
var parentBindingNames = (el.getAttribute && el.getAttribute('data-stx-parent-bindings') || '')
|
|
8889
|
+
var parentBindingNames = __stxWords(el.getAttribute && el.getAttribute('data-stx-parent-bindings') || '');
|
|
8075
8890
|
var bindingScope = el.__stx_parent_scope && parentBindingNames.includes(attrName)
|
|
8076
8891
|
? el.__stx_parent_scope
|
|
8077
8892
|
: attrCapturedScope;
|
|
@@ -8085,112 +8900,7 @@ catch (e2) {
|
|
|
8085
8900
|
effect(() => {
|
|
8086
8901
|
if (!attributesVisible()) return;
|
|
8087
8902
|
const v = evalAttrExpr(value, bindingScope);
|
|
8088
|
-
|
|
8089
|
-
// attribute does not update a <select>'s chosen option and can leave
|
|
8090
|
-
// inputs displaying stale text after a reactive update.
|
|
8091
|
-
if (attrName === 'value' && 'value' in el) {
|
|
8092
|
-
var controlValue = v;
|
|
8093
|
-
if (typeof v === 'object' && v !== null) {
|
|
8094
|
-
try { controlValue = JSON.stringify(v); }
|
|
8095
|
-
catch (e) { controlValue = String(v); }
|
|
8096
|
-
}
|
|
8097
|
-
controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
|
|
8098
|
-
el.__stx_bound_value = controlValue;
|
|
8099
|
-
var applyControlValue = function() {
|
|
8100
|
-
if (!attributesVisible()) return;
|
|
8101
|
-
var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
|
|
8102
|
-
el.value = desiredValue;
|
|
8103
|
-
if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
|
|
8104
|
-
else if (el.getAttribute(attrName) !== desiredValue) el.setAttribute(attrName, desiredValue);
|
|
8105
|
-
if (typeof el.__stx_model_sync === 'function') el.__stx_model_sync();
|
|
8106
|
-
};
|
|
8107
|
-
applyControlValue();
|
|
8108
|
-
|
|
8109
|
-
// A select's value binding is processed before its child
|
|
8110
|
-
// directives. When a nested :for creates the matching options
|
|
8111
|
-
// afterward, the browser otherwise leaves the first option
|
|
8112
|
-
// selected. Keep the desired value and reapply it whenever the
|
|
8113
|
-
// option tree changes, including later reactive list updates.
|
|
8114
|
-
if (el.tagName === 'SELECT' && !el.__stx_value_observer && typeof window.MutationObserver !== 'undefined') {
|
|
8115
|
-
el.__stx_value_observer = new window.MutationObserver(applyControlValue);
|
|
8116
|
-
el.__stx_value_observer.observe(el, {
|
|
8117
|
-
childList: true,
|
|
8118
|
-
subtree: true,
|
|
8119
|
-
attributes: true,
|
|
8120
|
-
attributeFilter: ['value'],
|
|
8121
|
-
});
|
|
8122
|
-
el.__stx_destroy = el.__stx_destroy || [];
|
|
8123
|
-
el.__stx_destroy.push(function() {
|
|
8124
|
-
if (el.__stx_value_observer) el.__stx_value_observer.disconnect();
|
|
8125
|
-
el.__stx_value_observer = null;
|
|
8126
|
-
});
|
|
8127
|
-
}
|
|
8128
|
-
return;
|
|
8129
|
-
}
|
|
8130
|
-
// Checked, selected, and indeterminate are live DOM properties, just like value.
|
|
8131
|
-
// Updating only the HTML attribute leaves a user-touched checkbox or
|
|
8132
|
-
// radio in its previous state because the property becomes dirty.
|
|
8133
|
-
// Indeterminate has no corresponding effective HTML attribute at all.
|
|
8134
|
-
if ((attrName === 'checked' || attrName === 'selected' || attrName === 'indeterminate') && attrName in el) {
|
|
8135
|
-
var selectedState = Boolean(v);
|
|
8136
|
-
el[attrName] = selectedState;
|
|
8137
|
-
if (attrName === 'indeterminate') {
|
|
8138
|
-
el.removeAttribute(attrName);
|
|
8139
|
-
}
|
|
8140
|
-
else if (selectedState) {
|
|
8141
|
-
el.setAttribute(attrName, '');
|
|
8142
|
-
}
|
|
8143
|
-
else {
|
|
8144
|
-
el.removeAttribute(attrName);
|
|
8145
|
-
}
|
|
8146
|
-
return;
|
|
8147
|
-
}
|
|
8148
|
-
// aria-* and data-* carry a STRING: the platform's boolean attribute
|
|
8149
|
-
// is presence, which cannot say "false" and wrote data-open="" for
|
|
8150
|
-
// true, so a [data-open='true'] selector never matched. React renders
|
|
8151
|
-
// both as "true" / "false", and so does this.
|
|
8152
|
-
if ((attrName.startsWith('aria-') || attrName.startsWith('data-')) && typeof v === 'boolean') {
|
|
8153
|
-
stxHost.setAttribute(el, attrName, String(v));
|
|
8154
|
-
}
|
|
8155
|
-
else if (typeof v === 'boolean') {
|
|
8156
|
-
stxHost.setAttribute(el, attrName, v);
|
|
8157
|
-
}
|
|
8158
|
-
else if (v === null || v === undefined) {
|
|
8159
|
-
stxHost.removeAttribute(el, attrName);
|
|
8160
|
-
}
|
|
8161
|
-
else {
|
|
8162
|
-
var attrValue = v;
|
|
8163
|
-
if (typeof v === 'object') {
|
|
8164
|
-
try { attrValue = JSON.stringify(v); }
|
|
8165
|
-
catch (e) { attrValue = String(v); }
|
|
8166
|
-
}
|
|
8167
|
-
var attrValueSafe = safeUrlAttr(attrName, attrValue);
|
|
8168
|
-
// Keep structured values structured for non-DOM hosts. The DOM
|
|
8169
|
-
// host serializes them at its boundary, preserving web output.
|
|
8170
|
-
var hostValue = (typeof v === 'object' && v !== null) ? v : attrValueSafe;
|
|
8171
|
-
// Writing the value an attribute already has is not nothing: a
|
|
8172
|
-
// frame given its own src again loads again (an entry in the
|
|
8173
|
-
// page's history each time) and a video restarts. A player whose
|
|
8174
|
-
// rest and next set share a video re-set it on every step.
|
|
8175
|
-
if (el.getAttribute(attrName) === String(attrValueSafe)) return;
|
|
8176
|
-
// A frame already on the page that is pointed somewhere else
|
|
8177
|
-
// navigates, and every navigation is an entry in the page's own
|
|
8178
|
-
// history: a player showing a video per step left one per step,
|
|
8179
|
-
// and Back had to be tapped through all of them before it left
|
|
8180
|
-
// the screen. Out of the page and back in, the frame starts afresh
|
|
8181
|
-
// (its first load adds no entry, and its old entries go with it).
|
|
8182
|
-
var parentNode = el.parentNode;
|
|
8183
|
-
if (attrName === 'src' && el.tagName === 'IFRAME' && parentNode && el.isConnected
|
|
8184
|
-
&& el.hasAttribute('src') && el.getAttribute('src') !== String(attrValueSafe)) {
|
|
8185
|
-
var nextSibling = el.nextSibling;
|
|
8186
|
-
parentNode.removeChild(el);
|
|
8187
|
-
stxHost.setAttribute(el, attrName, hostValue);
|
|
8188
|
-
parentNode.insertBefore(el, nextSibling);
|
|
8189
|
-
}
|
|
8190
|
-
else {
|
|
8191
|
-
stxHost.setAttribute(el, attrName, hostValue);
|
|
8192
|
-
}
|
|
8193
|
-
}
|
|
8903
|
+
applyBoundAttribute(el, attrName, v, attributesVisible, urlWarning);
|
|
8194
8904
|
});
|
|
8195
8905
|
el.removeAttribute(name);
|
|
8196
8906
|
}
|
|
@@ -8265,7 +8975,7 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
8265
8975
|
const parts = name.slice(1).split('.');
|
|
8266
8976
|
// HTML folds attribute names to lowercase; the forwarding metadata
|
|
8267
8977
|
// retains the declared event spelling (e.g. update:modelValue).
|
|
8268
|
-
const parentEventNames = (el.getAttribute && el.getAttribute('data-stx-parent-events') || '')
|
|
8978
|
+
const parentEventNames = __stxWords(el.getAttribute && el.getAttribute('data-stx-parent-events') || '');
|
|
8269
8979
|
const eventName = parentEventNames.find(function(event) {
|
|
8270
8980
|
return event.toLowerCase() === parts[0].toLowerCase();
|
|
8271
8981
|
}) || parts[0];
|
|
@@ -8288,146 +8998,11 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
8288
8998
|
|
|
8289
8999
|
// Capture scope at setup time so @for loop variables are available when event fires
|
|
8290
9000
|
const isForwardedComponentEvent = !!(el.__stx_parent_scope && parentEventNames.includes(eventName));
|
|
8291
|
-
|
|
9001
|
+
const eventCapturedScope = isForwardedComponentEvent
|
|
8292
9002
|
? layerTemplateScopes(globalHelpers, el.__stx_parent_scope)
|
|
8293
9003
|
: layerTemplateScopes(globalHelpers, scope, (findElementScope(el) || {}));
|
|
8294
9004
|
|
|
8295
|
-
|
|
8296
|
-
// A forwarded handler belongs to the caller, whose scope can be
|
|
8297
|
-
// resolved again after this listener is bound: a component inside
|
|
8298
|
-
// another component's :if, in a dialog, was bound against the
|
|
8299
|
-
// page's scope and only later handed its real caller, so
|
|
8300
|
-
// @pick="pickFromBank" found nothing and did nothing. Read it now.
|
|
8301
|
-
if (isForwardedComponentEvent && el.__stx_parent_scope)
|
|
8302
|
-
eventCapturedScope = layerTemplateScopes(globalHelpers, el.__stx_parent_scope);
|
|
8303
|
-
// Vue-style component listeners fall through to the rendered native
|
|
8304
|
-
// root unless the child emits the same event. Signal components use
|
|
8305
|
-
// a scope wrapper, so native events arrive here from a descendant.
|
|
8306
|
-
// Ignore that native event only after defineEmits() has declared or
|
|
8307
|
-
// emitted the same name, preventing submit/click handlers from
|
|
8308
|
-
// firing once for the native event and again for the CustomEvent.
|
|
8309
|
-
var componentEmits = el.__stx_component_emits;
|
|
8310
|
-
if (isForwardedComponentEvent && event.target !== el
|
|
8311
|
-
&& componentEmits && componentEmits[eventName]) return;
|
|
8312
|
-
|
|
8313
|
-
// Vue-style component handlers receive the emitted payload directly.
|
|
8314
|
-
// Native root events still receive the Event object so server-only
|
|
8315
|
-
// components can forward clicks and other browser events.
|
|
8316
|
-
var emittedArgs = isForwardedComponentEvent && event instanceof CustomEvent
|
|
8317
|
-
&& Array.isArray(event.__stx_emit_args) ? event.__stx_emit_args : null;
|
|
8318
|
-
var handlerEvent = emittedArgs ? emittedArgs[0]
|
|
8319
|
-
: isForwardedComponentEvent && event instanceof CustomEvent ? event.detail : event;
|
|
8320
|
-
|
|
8321
|
-
// Skip an opener click that reaches UI which just became visible in
|
|
8322
|
-
// this frame. A click whose target is inside the revealed subtree is
|
|
8323
|
-
// a real interaction and must not be discarded, especially for
|
|
8324
|
-
// async lists whose controls are usable as soon as they render.
|
|
8325
|
-
if (eventName === 'click') {
|
|
8326
|
-
var ancestor = el;
|
|
8327
|
-
while (ancestor) {
|
|
8328
|
-
if (ancestor.__stx_shown_at
|
|
8329
|
-
&& (performance.now() - ancestor.__stx_shown_at) < 50
|
|
8330
|
-
&& !(ancestor.contains && ancestor.contains(event.target))) return;
|
|
8331
|
-
ancestor = ancestor.parentElement;
|
|
8332
|
-
}
|
|
8333
|
-
}
|
|
8334
|
-
// System key modifiers
|
|
8335
|
-
if (modifiers.includes('self') && event.target !== el) return;
|
|
8336
|
-
if (modifiers.includes('ctrl') && !event.ctrlKey) return;
|
|
8337
|
-
if (modifiers.includes('alt') && !event.altKey) return;
|
|
8338
|
-
if (modifiers.includes('shift') && !event.shiftKey) return;
|
|
8339
|
-
if (modifiers.includes('meta') && !event.metaKey) return;
|
|
8340
|
-
// Key modifiers
|
|
8341
|
-
for (var mi = 0; mi < modifiers.length; mi++) {
|
|
8342
|
-
if (KEY_MAP[modifiers[mi]] && event.key !== KEY_MAP[modifiers[mi]]) return;
|
|
8343
|
-
}
|
|
8344
|
-
if (modifiers.includes('prevent')) event.preventDefault();
|
|
8345
|
-
if (modifiers.includes('stop')) event.stopPropagation();
|
|
8346
|
-
// Execute with captured scope (includes @for loop variables)
|
|
8347
|
-
// For x-data scopes, expressions like "mobileOpen = !mobileOpen" need to
|
|
8348
|
-
// read the signal value AND write back through the signal's setter.
|
|
8349
|
-
try {
|
|
8350
|
-
if (!value || /^__[A-Z_]+__$/.test(value.trim())) return;
|
|
8351
|
-
var shorthandFn = parseEventShorthand(value, eventCapturedScope);
|
|
8352
|
-
if (shorthandFn) { shorthandFn.apply(null, emittedArgs || [handlerEvent]); return; }
|
|
8353
|
-
// Check if any scope values are signals (x-data pattern)
|
|
8354
|
-
// A derived value reads like a signal in a handler, as it does in a
|
|
8355
|
-
// binding: \`pick(selectedPackage)\` passes the package. Leaving it
|
|
8356
|
-
// out handed the handler the derived's getter function, so
|
|
8357
|
-
// \`selectedPackage.trainer_id\` was undefined with nothing said.
|
|
8358
|
-
// Only the names the handler mentions. A page's scope holds
|
|
8359
|
-
// hundreds; reading, testing and declaring every one of them on
|
|
8360
|
-
// each click or hover cost far more than the handler itself.
|
|
8361
|
-
var handlerNames = __stxNamesIn(value).filter(function(k) {
|
|
8362
|
-
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k) && (k in eventCapturedScope);
|
|
8363
|
-
});
|
|
8364
|
-
var hasSignals = handlerNames.some(function(k) {
|
|
8365
|
-
var v = eventCapturedScope[k];
|
|
8366
|
-
return v && typeof v === 'function' && (v._isSignal || v._isDerived);
|
|
8367
|
-
});
|
|
8368
|
-
// Only use signal read/write proxy for DIRECT assignment expressions
|
|
8369
|
-
// like "count = count + 1" or "open = !open". Function calls like
|
|
8370
|
-
// "openModal()" handle their own signal.set() internally \u2014 the writeback
|
|
8371
|
-
// would RESET signals to their pre-handler values.
|
|
8372
|
-
var isDirectAssignment = hasSignals && /^[a-zA-Z_$]\\w*\\s*=/.test(value.trim()) && !value.trim().startsWith('==');
|
|
8373
|
-
if (isDirectAssignment) {
|
|
8374
|
-
var getVars = handlerNames.map(function(k) {
|
|
8375
|
-
return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
|
|
8376
|
-
}).join(';');
|
|
8377
|
-
var setVars = handlerNames.filter(function(k) {
|
|
8378
|
-
var v = eventCapturedScope[k];
|
|
8379
|
-
return v && typeof v === 'function' && v._isSignal;
|
|
8380
|
-
}).map(function(k) {
|
|
8381
|
-
return 'if(' + k + ' !== __s["' + k + '"]()) __s["' + k + '"].set(' + k + ')';
|
|
8382
|
-
}).join(';');
|
|
8383
|
-
var body = getVars + ';' + value + ';' + setVars;
|
|
8384
|
-
var fn2 = __stxCompile(['__s', '$event'], body);
|
|
8385
|
-
fn2(eventCapturedScope, handlerEvent);
|
|
8386
|
-
} else if (hasSignals) {
|
|
8387
|
-
// Function calls with signals in scope keep any signal used through
|
|
8388
|
-
// its object API as a raw signal function, and unwrap the rest for
|
|
8389
|
-
// primitive reads.
|
|
8390
|
-
var unwrapVars = handlerNames.map(function(k) {
|
|
8391
|
-
var v = eventCapturedScope[k];
|
|
8392
|
-
// A :for item is a signal only as an implementation detail, so
|
|
8393
|
-
// that keyed rows can update in place. Its \`.value\` is a field
|
|
8394
|
-
// on the item, never the signal compatibility API \u2014 the same
|
|
8395
|
-
// rule createAutoUnwrapProxy states for binding expressions.
|
|
8396
|
-
// Without the carve-out, expressionUsesSignalApi sees
|
|
8397
|
-
// \`option.value\` and hands the handler the raw signal, so a
|
|
8398
|
-
// handler like \`pick(option.value)\` receives the whole item.
|
|
8399
|
-
// It is not an error, so it lands silently: the wrong value is
|
|
8400
|
-
// stored and only surfaces much later.
|
|
8401
|
-
if (v && typeof v === 'function' && ((v._isSignal && !v._isStxLoopItem) || v._isDerived)
|
|
8402
|
-
&& (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
|
|
8403
|
-
return 'var ' + k + ' = __s["' + k + '"]';
|
|
8404
|
-
}
|
|
8405
|
-
return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
|
|
8406
|
-
}).join(';');
|
|
8407
|
-
var fn3 = __stxCompile(['__s', '$event'], unwrapVars + ';' + value);
|
|
8408
|
-
fn3(eventCapturedScope, handlerEvent);
|
|
8409
|
-
} else {
|
|
8410
|
-
var fn = __stxCompileScoped(eventCapturedScope, ['$event'], value);
|
|
8411
|
-
fn(...__stxArgs(fn, eventCapturedScope), handlerEvent);
|
|
8412
|
-
}
|
|
8413
|
-
}
|
|
8414
|
-
catch (e) {
|
|
8415
|
-
// See #1694: dropping the TypeError/ReferenceError carve-out for inline
|
|
8416
|
-
// handlers \u2014 same reason as executeHandler above. Silencing these hid
|
|
8417
|
-
// the substring-detector bug (auto-unwrap missing .set( inside helper
|
|
8418
|
-
// calls) for ~30min of bisecting in the field.
|
|
8419
|
-
console.warn('[STX] Handler error:', value, e);
|
|
8420
|
-
}
|
|
8421
|
-
}, {
|
|
8422
|
-
capture: modifiers.includes('capture'),
|
|
8423
|
-
// A touch or wheel listener that is not passive holds every scroll
|
|
8424
|
-
// starting on the element until this thread has run it. Passive
|
|
8425
|
-
// unless .prevent needs preventDefault() or .nonpassive asks.
|
|
8426
|
-
passive: modifiers.includes('passive')
|
|
8427
|
-
|| (/^(touchstart|touchmove|wheel|mousewheel)$/i.test(eventName)
|
|
8428
|
-
&& !modifiers.includes('prevent') && !modifiers.includes('nonpassive')),
|
|
8429
|
-
once: modifiers.includes('once')
|
|
8430
|
-
});
|
|
9005
|
+
listenTemplateEvent(el, eventName, modifiers, value, eventCapturedScope, isForwardedComponentEvent);
|
|
8431
9006
|
el.removeAttribute(name);
|
|
8432
9007
|
}
|
|
8433
9008
|
});
|
|
@@ -8447,10 +9022,312 @@ catch (e) {
|
|
|
8447
9022
|
processElement(child, scope);
|
|
8448
9023
|
});
|
|
8449
9024
|
}
|
|
8450
|
-
}
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9027
|
+
// A bound attribute's new value, written as the element's kind wants it:
|
|
9028
|
+
// live properties for form controls, strings for aria-/data- booleans, a
|
|
9029
|
+
// structured value kept structured for a native host. Shared by
|
|
9030
|
+
// processElement and the native row plans so both write a value one way.
|
|
9031
|
+
function applyBoundAttribute(el, attrName, v, attributesVisible, urlWarning) {
|
|
9032
|
+
// Form control values are live DOM properties. Setting only the HTML
|
|
9033
|
+
// attribute does not update a <select>'s chosen option and can leave
|
|
9034
|
+
// inputs displaying stale text after a reactive update.
|
|
9035
|
+
if (attrName === 'value' && 'value' in el) {
|
|
9036
|
+
var controlValue = v;
|
|
9037
|
+
if (typeof v === 'object' && v !== null) {
|
|
9038
|
+
try { controlValue = JSON.stringify(v); }
|
|
9039
|
+
catch (e) { controlValue = String(v); }
|
|
9040
|
+
}
|
|
9041
|
+
controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
|
|
9042
|
+
el.__stx_bound_value = controlValue;
|
|
9043
|
+
var applyControlValue = function() {
|
|
9044
|
+
if (!attributesVisible()) return;
|
|
9045
|
+
var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
|
|
9046
|
+
el.value = desiredValue;
|
|
9047
|
+
if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
|
|
9048
|
+
else if (el.getAttribute(attrName) !== desiredValue) el.setAttribute(attrName, desiredValue);
|
|
9049
|
+
if (typeof el.__stx_model_sync === 'function') el.__stx_model_sync();
|
|
9050
|
+
};
|
|
9051
|
+
applyControlValue();
|
|
9052
|
+
|
|
9053
|
+
// A select's value binding is processed before its child
|
|
9054
|
+
// directives. When a nested :for creates the matching options
|
|
9055
|
+
// afterward, the browser otherwise leaves the first option
|
|
9056
|
+
// selected. Keep the desired value and reapply it whenever the
|
|
9057
|
+
// option tree changes, including later reactive list updates.
|
|
9058
|
+
if (el.tagName === 'SELECT' && !el.__stx_value_observer && typeof window.MutationObserver !== 'undefined') {
|
|
9059
|
+
el.__stx_value_observer = new window.MutationObserver(applyControlValue);
|
|
9060
|
+
el.__stx_value_observer.observe(el, {
|
|
9061
|
+
childList: true,
|
|
9062
|
+
subtree: true,
|
|
9063
|
+
attributes: true,
|
|
9064
|
+
attributeFilter: ['value'],
|
|
9065
|
+
});
|
|
9066
|
+
el.__stx_destroy = el.__stx_destroy || [];
|
|
9067
|
+
el.__stx_destroy.push(function() {
|
|
9068
|
+
if (el.__stx_value_observer) el.__stx_value_observer.disconnect();
|
|
9069
|
+
el.__stx_value_observer = null;
|
|
9070
|
+
});
|
|
9071
|
+
}
|
|
9072
|
+
return;
|
|
9073
|
+
}
|
|
9074
|
+
// Checked, selected, and indeterminate are live DOM properties, just like value.
|
|
9075
|
+
// Updating only the HTML attribute leaves a user-touched checkbox or
|
|
9076
|
+
// radio in its previous state because the property becomes dirty.
|
|
9077
|
+
// Indeterminate has no corresponding effective HTML attribute at all.
|
|
9078
|
+
if ((attrName === 'checked' || attrName === 'selected' || attrName === 'indeterminate') && attrName in el) {
|
|
9079
|
+
var selectedState = Boolean(v);
|
|
9080
|
+
el[attrName] = selectedState;
|
|
9081
|
+
if (attrName === 'indeterminate') {
|
|
9082
|
+
el.removeAttribute(attrName);
|
|
9083
|
+
}
|
|
9084
|
+
else if (selectedState) {
|
|
9085
|
+
el.setAttribute(attrName, '');
|
|
9086
|
+
}
|
|
9087
|
+
else {
|
|
9088
|
+
el.removeAttribute(attrName);
|
|
9089
|
+
}
|
|
9090
|
+
return;
|
|
9091
|
+
}
|
|
9092
|
+
// aria-* and data-* carry a STRING: the platform's boolean attribute
|
|
9093
|
+
// is presence, which cannot say "false" and wrote data-open="" for
|
|
9094
|
+
// true, so a [data-open='true'] selector never matched. React renders
|
|
9095
|
+
// both as "true" / "false", and so does this.
|
|
9096
|
+
if ((attrName.startsWith('aria-') || attrName.startsWith('data-')) && typeof v === 'boolean') {
|
|
9097
|
+
stxHost.setAttribute(el, attrName, String(v));
|
|
9098
|
+
}
|
|
9099
|
+
else if (typeof v === 'boolean') {
|
|
9100
|
+
stxHost.setAttribute(el, attrName, v);
|
|
9101
|
+
}
|
|
9102
|
+
else if (v === null || v === undefined) {
|
|
9103
|
+
stxHost.removeAttribute(el, attrName);
|
|
9104
|
+
}
|
|
9105
|
+
else {
|
|
9106
|
+
var attrValue = v;
|
|
9107
|
+
if (typeof v === 'object') {
|
|
9108
|
+
try { attrValue = JSON.stringify(v); }
|
|
9109
|
+
catch (e) { attrValue = String(v); }
|
|
9110
|
+
}
|
|
9111
|
+
var attrValueSafe = __stxSafeUrlAttr(attrName, attrValue, urlWarning);
|
|
9112
|
+
// Keep structured values structured for non-DOM hosts. The DOM
|
|
9113
|
+
// host serializes them at its boundary, preserving web output.
|
|
9114
|
+
var hostValue = (typeof v === 'object' && v !== null) ? v : attrValueSafe;
|
|
9115
|
+
// Writing the value an attribute already has is not nothing: a
|
|
9116
|
+
// frame given its own src again loads again (an entry in the
|
|
9117
|
+
// page's history each time) and a video restarts. A player whose
|
|
9118
|
+
// rest and next set share a video re-set it on every step.
|
|
9119
|
+
if (el.getAttribute(attrName) === String(attrValueSafe)) return;
|
|
9120
|
+
// A frame already on the page that is pointed somewhere else
|
|
9121
|
+
// navigates, and every navigation is an entry in the page's own
|
|
9122
|
+
// history: a player showing a video per step left one per step,
|
|
9123
|
+
// and Back had to be tapped through all of them before it left
|
|
9124
|
+
// the screen. Out of the page and back in, the frame starts afresh
|
|
9125
|
+
// (its first load adds no entry, and its old entries go with it).
|
|
9126
|
+
var parentNode = el.parentNode;
|
|
9127
|
+
if (attrName === 'src' && el.tagName === 'IFRAME' && parentNode && el.isConnected
|
|
9128
|
+
&& el.hasAttribute('src') && el.getAttribute('src') !== String(attrValueSafe)) {
|
|
9129
|
+
var nextSibling = el.nextSibling;
|
|
9130
|
+
parentNode.removeChild(el);
|
|
9131
|
+
stxHost.setAttribute(el, attrName, hostValue);
|
|
9132
|
+
parentNode.insertBefore(el, nextSibling);
|
|
9133
|
+
}
|
|
9134
|
+
else {
|
|
9135
|
+
stxHost.setAttribute(el, attrName, hostValue);
|
|
9136
|
+
}
|
|
9137
|
+
}
|
|
9138
|
+
}
|
|
9139
|
+
|
|
9140
|
+
// An authored @event listener. The scope is re-read for a forwarded
|
|
9141
|
+
// component event, whose caller can be resolved after the listener is bound.
|
|
9142
|
+
function listenTemplateEvent(el, eventName, modifiers, value, eventCapturedScope, isForwardedComponentEvent) {
|
|
9143
|
+
stxHost.listen(el, eventName, (event) => {
|
|
9144
|
+
// A forwarded handler belongs to the caller, whose scope can be
|
|
9145
|
+
// resolved again after this listener is bound: a component inside
|
|
9146
|
+
// another component's :if, in a dialog, was bound against the
|
|
9147
|
+
// page's scope and only later handed its real caller, so
|
|
9148
|
+
// @pick="pickFromBank" found nothing and did nothing. Read it now.
|
|
9149
|
+
if (isForwardedComponentEvent && el.__stx_parent_scope)
|
|
9150
|
+
eventCapturedScope = layerTemplateScopes(globalHelpers, el.__stx_parent_scope);
|
|
9151
|
+
// Vue-style component listeners fall through to the rendered native
|
|
9152
|
+
// root unless the child emits the same event. Signal components use
|
|
9153
|
+
// a scope wrapper, so native events arrive here from a descendant.
|
|
9154
|
+
// Ignore that native event only after defineEmits() has declared or
|
|
9155
|
+
// emitted the same name, preventing submit/click handlers from
|
|
9156
|
+
// firing once for the native event and again for the CustomEvent.
|
|
9157
|
+
var componentEmits = el.__stx_component_emits;
|
|
9158
|
+
if (isForwardedComponentEvent && event.target !== el
|
|
9159
|
+
&& componentEmits && componentEmits[eventName]) return;
|
|
9160
|
+
|
|
9161
|
+
// Vue-style component handlers receive the emitted payload directly.
|
|
9162
|
+
// Native root events still receive the Event object so server-only
|
|
9163
|
+
// components can forward clicks and other browser events.
|
|
9164
|
+
var emittedArgs = isForwardedComponentEvent && event instanceof CustomEvent
|
|
9165
|
+
&& Array.isArray(event.__stx_emit_args) ? event.__stx_emit_args : null;
|
|
9166
|
+
var handlerEvent = emittedArgs ? emittedArgs[0]
|
|
9167
|
+
: isForwardedComponentEvent && event instanceof CustomEvent ? event.detail : event;
|
|
9168
|
+
|
|
9169
|
+
// Skip an opener click that reaches UI which just became visible in
|
|
9170
|
+
// this frame. A click whose target is inside the revealed subtree is
|
|
9171
|
+
// a real interaction and must not be discarded, especially for
|
|
9172
|
+
// async lists whose controls are usable as soon as they render.
|
|
9173
|
+
if (eventName === 'click') {
|
|
9174
|
+
var ancestor = el;
|
|
9175
|
+
while (ancestor) {
|
|
9176
|
+
if (ancestor.__stx_shown_at
|
|
9177
|
+
&& (performance.now() - ancestor.__stx_shown_at) < 50
|
|
9178
|
+
&& !(ancestor.contains && ancestor.contains(event.target))) return;
|
|
9179
|
+
ancestor = ancestor.parentElement;
|
|
9180
|
+
}
|
|
9181
|
+
}
|
|
9182
|
+
// System key modifiers
|
|
9183
|
+
if (modifiers.includes('self') && event.target !== el) return;
|
|
9184
|
+
if (modifiers.includes('ctrl') && !event.ctrlKey) return;
|
|
9185
|
+
if (modifiers.includes('alt') && !event.altKey) return;
|
|
9186
|
+
if (modifiers.includes('shift') && !event.shiftKey) return;
|
|
9187
|
+
if (modifiers.includes('meta') && !event.metaKey) return;
|
|
9188
|
+
// Key modifiers
|
|
9189
|
+
for (var mi = 0; mi < modifiers.length; mi++) {
|
|
9190
|
+
if (KEY_MAP[modifiers[mi]] && event.key !== KEY_MAP[modifiers[mi]]) return;
|
|
9191
|
+
}
|
|
9192
|
+
if (modifiers.includes('prevent')) event.preventDefault();
|
|
9193
|
+
if (modifiers.includes('stop')) event.stopPropagation();
|
|
9194
|
+
// Execute with captured scope (includes @for loop variables)
|
|
9195
|
+
// For x-data scopes, expressions like "mobileOpen = !mobileOpen" need to
|
|
9196
|
+
// read the signal value AND write back through the signal's setter.
|
|
9197
|
+
try {
|
|
9198
|
+
if (!value || /^__[A-Z_]+__$/.test(value.trim())) return;
|
|
9199
|
+
var shorthandFn = parseEventShorthand(value, eventCapturedScope);
|
|
9200
|
+
if (shorthandFn) { shorthandFn.apply(null, emittedArgs || [handlerEvent]); return; }
|
|
9201
|
+
// Check if any scope values are signals (x-data pattern)
|
|
9202
|
+
// A derived value reads like a signal in a handler, as it does in a
|
|
9203
|
+
// binding: \`pick(selectedPackage)\` passes the package. Leaving it
|
|
9204
|
+
// out handed the handler the derived's getter function, so
|
|
9205
|
+
// \`selectedPackage.trainer_id\` was undefined with nothing said.
|
|
9206
|
+
// Only the names the handler mentions. A page's scope holds
|
|
9207
|
+
// hundreds; reading, testing and declaring every one of them on
|
|
9208
|
+
// each click or hover cost far more than the handler itself.
|
|
9209
|
+
var handlerNames = __stxNamesIn(value).filter(function(k) {
|
|
9210
|
+
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k) && (k in eventCapturedScope);
|
|
9211
|
+
});
|
|
9212
|
+
var hasSignals = handlerNames.some(function(k) {
|
|
9213
|
+
var v = eventCapturedScope[k];
|
|
9214
|
+
return v && typeof v === 'function' && (v._isSignal || v._isDerived);
|
|
9215
|
+
});
|
|
9216
|
+
// Only use signal read/write proxy for DIRECT assignment expressions
|
|
9217
|
+
// like "count = count + 1" or "open = !open". Function calls like
|
|
9218
|
+
// "openModal()" handle their own signal.set() internally \u2014 the writeback
|
|
9219
|
+
// would RESET signals to their pre-handler values.
|
|
9220
|
+
var isDirectAssignment = hasSignals && /^[a-zA-Z_$]\\w*\\s*=/.test(value.trim()) && !value.trim().startsWith('==');
|
|
9221
|
+
if (isDirectAssignment) {
|
|
9222
|
+
var getVars = handlerNames.map(function(k) {
|
|
9223
|
+
return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
|
|
9224
|
+
}).join(';');
|
|
9225
|
+
var setVars = handlerNames.filter(function(k) {
|
|
9226
|
+
var v = eventCapturedScope[k];
|
|
9227
|
+
return v && typeof v === 'function' && v._isSignal;
|
|
9228
|
+
}).map(function(k) {
|
|
9229
|
+
return 'if(' + k + ' !== __s["' + k + '"]()) __s["' + k + '"].set(' + k + ')';
|
|
9230
|
+
}).join(';');
|
|
9231
|
+
var body = getVars + ';' + value + ';' + setVars;
|
|
9232
|
+
var fn2 = __stxCompile(['__s', '$event'], body);
|
|
9233
|
+
fn2(eventCapturedScope, handlerEvent);
|
|
9234
|
+
} else if (hasSignals) {
|
|
9235
|
+
// Function calls with signals in scope keep any signal used through
|
|
9236
|
+
// its object API as a raw signal function, and unwrap the rest for
|
|
9237
|
+
// primitive reads.
|
|
9238
|
+
var unwrapVars = handlerNames.map(function(k) {
|
|
9239
|
+
var v = eventCapturedScope[k];
|
|
9240
|
+
// A :for item is a signal only as an implementation detail, so
|
|
9241
|
+
// that keyed rows can update in place. Its \`.value\` is a field
|
|
9242
|
+
// on the item, never the signal compatibility API \u2014 the same
|
|
9243
|
+
// rule createAutoUnwrapProxy states for binding expressions.
|
|
9244
|
+
// Without the carve-out, expressionUsesSignalApi sees
|
|
9245
|
+
// \`option.value\` and hands the handler the raw signal, so a
|
|
9246
|
+
// handler like \`pick(option.value)\` receives the whole item.
|
|
9247
|
+
// It is not an error, so it lands silently: the wrong value is
|
|
9248
|
+
// stored and only surfaces much later.
|
|
9249
|
+
if (v && typeof v === 'function' && ((v._isSignal && !v._isStxLoopItem) || v._isDerived)
|
|
9250
|
+
&& (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
|
|
9251
|
+
return 'var ' + k + ' = __s["' + k + '"]';
|
|
9252
|
+
}
|
|
9253
|
+
return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
|
|
9254
|
+
}).join(';');
|
|
9255
|
+
var fn3 = __stxCompile(['__s', '$event'], unwrapVars + ';' + value);
|
|
9256
|
+
fn3(eventCapturedScope, handlerEvent);
|
|
9257
|
+
} else {
|
|
9258
|
+
var fn = __stxCompileScoped(eventCapturedScope, ['$event'], value);
|
|
9259
|
+
fn(...__stxArgs(fn, eventCapturedScope), handlerEvent);
|
|
9260
|
+
}
|
|
9261
|
+
}
|
|
9262
|
+
catch (e) {
|
|
9263
|
+
// See #1694: dropping the TypeError/ReferenceError carve-out for inline
|
|
9264
|
+
// handlers \u2014 same reason as executeHandler above. Silencing these hid
|
|
9265
|
+
// the substring-detector bug (auto-unwrap missing .set( inside helper
|
|
9266
|
+
// calls) for ~30min of bisecting in the field.
|
|
9267
|
+
console.warn('[STX] Handler error:', value, e);
|
|
9268
|
+
}
|
|
9269
|
+
}, {
|
|
9270
|
+
capture: modifiers.includes('capture'),
|
|
9271
|
+
// A touch or wheel listener that is not passive holds every scroll
|
|
9272
|
+
// starting on the element until this thread has run it. Passive
|
|
9273
|
+
// unless .prevent needs preventDefault() or .nonpassive asks.
|
|
9274
|
+
passive: modifiers.includes('passive')
|
|
9275
|
+
|| (/^(touchstart|touchmove|wheel|mousewheel)$/i.test(eventName)
|
|
9276
|
+
&& !modifiers.includes('prevent') && !modifiers.includes('nonpassive')),
|
|
9277
|
+
once: modifiers.includes('once')
|
|
9278
|
+
});
|
|
9279
|
+
}
|
|
9280
|
+
`}var rt=` // ==========================================================================
|
|
8451
9281
|
// Auto-unwrap Signals (Feature #1)
|
|
8452
9282
|
// ==========================================================================
|
|
8453
9283
|
|
|
9284
|
+
// One handler class for every auto-unwrap proxy: an expression is
|
|
9285
|
+
// evaluated through a fresh one each time it runs, and a handler object
|
|
9286
|
+
// with closures of its own per proxy was a cost every binding paid in an
|
|
9287
|
+
// interpreter. A handler knows how to keep a signal either by a callback
|
|
9288
|
+
// (preserveSignal) or, for an expression, by what the expression does with
|
|
9289
|
+
// the name (expressionKeepsSignal), which needs no closure at all.
|
|
9290
|
+
function StxAutoUnwrapHandler(preserveSignal, expression) {
|
|
9291
|
+
this.preserveSignal = preserveSignal;
|
|
9292
|
+
this.expression = expression;
|
|
9293
|
+
}
|
|
9294
|
+
StxAutoUnwrapHandler.prototype.get = function(target, prop) {
|
|
9295
|
+
const val = target[prop];
|
|
9296
|
+
// If it's a signal or derived, call it to get the value
|
|
9297
|
+
if (val && typeof val === 'function' && (val._isSignal || val._isDerived)) {
|
|
9298
|
+
// Loop variables are implementation-detail signals so keyed rows can
|
|
9299
|
+
// update reactively. In template expressions they must behave like
|
|
9300
|
+
// their item value, including for objects with fields named value,
|
|
9301
|
+
// set, or subscribe. Otherwise item.value is mistaken for the
|
|
9302
|
+
// signal compatibility API and resolves to the whole item object.
|
|
9303
|
+
if (val._isStxLoopItem) return val();
|
|
9304
|
+
if (this.expression !== null) {
|
|
9305
|
+
if (expressionKeepsSignal(this.expression, prop, val)) return val;
|
|
9306
|
+
}
|
|
9307
|
+
else if (this.preserveSignal && this.preserveSignal(prop, val)) return val;
|
|
9308
|
+
return val();
|
|
9309
|
+
}
|
|
9310
|
+
// If it's an stx store, return a recursively-unwrapping wrapper so
|
|
9311
|
+
// store.signalProp resolves to the value in template expressions
|
|
9312
|
+
if (val && typeof val === 'object' && val._isStxStore) {
|
|
9313
|
+
return new Proxy(val, this);
|
|
9314
|
+
}
|
|
9315
|
+
return val;
|
|
9316
|
+
};
|
|
9317
|
+
StxAutoUnwrapHandler.prototype.set = function(target, prop, value) {
|
|
9318
|
+
const cur = target[prop];
|
|
9319
|
+
if (cur && typeof cur === 'function' && cur._isSignal && typeof cur.set === 'function') {
|
|
9320
|
+
cur.set(value);
|
|
9321
|
+
return true;
|
|
9322
|
+
}
|
|
9323
|
+
target[prop] = value;
|
|
9324
|
+
return true;
|
|
9325
|
+
};
|
|
9326
|
+
|
|
9327
|
+
// The scope an auto-unwrap proxy reads, so compiling an expression asks
|
|
9328
|
+
// the scope itself which names it holds rather than through the proxy.
|
|
9329
|
+
const __stxUnwrapTargetOf = new WeakMap();
|
|
9330
|
+
|
|
8454
9331
|
// Create a proxy that auto-unwraps signals when accessed.
|
|
8455
9332
|
// For stx stores (objects with _isStxStore), recursively wrap so nested
|
|
8456
9333
|
// signal properties auto-unwrap too \u2014 this is what makes template
|
|
@@ -8458,37 +9335,15 @@ catch (e) {
|
|
|
8458
9335
|
// resolve to the value. Action methods on the store pass through as
|
|
8459
9336
|
// functions because they don't carry _isSignal/_isDerived markers.
|
|
8460
9337
|
function createAutoUnwrapProxy(scope, preserveSignal) {
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
// signal compatibility API and resolves to the whole item object.
|
|
8471
|
-
if (val._isStxLoopItem) return val();
|
|
8472
|
-
if (preserveSignal && preserveSignal(prop, val)) return val;
|
|
8473
|
-
return val();
|
|
8474
|
-
}
|
|
8475
|
-
// If it's an stx store, return a recursively-unwrapping wrapper so
|
|
8476
|
-
// store.signalProp resolves to the value in template expressions
|
|
8477
|
-
if (val && typeof val === 'object' && val._isStxStore) {
|
|
8478
|
-
return createAutoUnwrapProxy(val, preserveSignal);
|
|
8479
|
-
}
|
|
8480
|
-
return val;
|
|
8481
|
-
},
|
|
8482
|
-
set(target, prop, value) {
|
|
8483
|
-
const cur = target[prop];
|
|
8484
|
-
if (cur && typeof cur === 'function' && cur._isSignal && typeof cur.set === 'function') {
|
|
8485
|
-
cur.set(value);
|
|
8486
|
-
return true;
|
|
8487
|
-
}
|
|
8488
|
-
target[prop] = value;
|
|
8489
|
-
return true;
|
|
8490
|
-
}
|
|
8491
|
-
});
|
|
9338
|
+
const proxy = new Proxy(scope, new StxAutoUnwrapHandler(preserveSignal || null, null));
|
|
9339
|
+
__stxUnwrapTargetOf.set(proxy, scope);
|
|
9340
|
+
return proxy;
|
|
9341
|
+
}
|
|
9342
|
+
|
|
9343
|
+
function createExpressionUnwrapProxy(scope, expression) {
|
|
9344
|
+
const proxy = new Proxy(scope, new StxAutoUnwrapHandler(null, expression));
|
|
9345
|
+
__stxUnwrapTargetOf.set(proxy, scope);
|
|
9346
|
+
return proxy;
|
|
8492
9347
|
}
|
|
8493
9348
|
|
|
8494
9349
|
// A proxy for the WRITE side of x-model, kept separate from the read proxy
|
|
@@ -8524,7 +9379,7 @@ catch (e) {
|
|
|
8524
9379
|
},
|
|
8525
9380
|
});
|
|
8526
9381
|
}
|
|
8527
|
-
`;function
|
|
9382
|
+
`;function ot(e){return` // Component mount system
|
|
8528
9383
|
var mountQueue = [];
|
|
8529
9384
|
|
|
8530
9385
|
// MERGE, never replace (#1804). Three client bundles assign window.stx and
|
|
@@ -8648,7 +9503,7 @@ ${e}
|
|
|
8648
9503
|
_scopes: {}, // Component-level scopes
|
|
8649
9504
|
_scopeCounter: 0, // Counter for generating unique scope IDs during SPA navigation
|
|
8650
9505
|
_latestSetup: window.__stx_latestSetup || null, // Latest SFC setup function (including scripts parsed before the runtime)
|
|
8651
|
-
_stores: new Map(), // Global store registry \u2014 survives SPA navigation`}var
|
|
9506
|
+
_stores: new Map(), // Global store registry \u2014 survives SPA navigation`}var st=` // ==========================================================================
|
|
8652
9507
|
// Template Refs (useRef)
|
|
8653
9508
|
// ==========================================================================
|
|
8654
9509
|
|
|
@@ -8680,7 +9535,7 @@ ${e}
|
|
|
8680
9535
|
Object.defineProperty(read, 'value', { get: read, enumerable: true });
|
|
8681
9536
|
return read;
|
|
8682
9537
|
}
|
|
8683
|
-
`;var
|
|
9538
|
+
`;var at=` // ==========================================================================
|
|
8684
9539
|
// Scope Disposal
|
|
8685
9540
|
// ==========================================================================
|
|
8686
9541
|
|
|
@@ -8888,7 +9743,7 @@ ${e}
|
|
|
8888
9743
|
delete scopes[id];
|
|
8889
9744
|
}
|
|
8890
9745
|
}
|
|
8891
|
-
`;var
|
|
9746
|
+
`;var it=` // Helper to process elements while skipping already-processed scoped containers
|
|
8892
9747
|
function processElementSkipScopes(el, processedScopes) {
|
|
8893
9748
|
if (processedScopes.has(el)) return;
|
|
8894
9749
|
if (el.nodeType === Node.TEXT_NODE) {
|
|
@@ -8929,7 +9784,7 @@ ${e}
|
|
|
8929
9784
|
if (el.tagName !== 'SCRIPT' && el.tagName !== 'STYLE') {
|
|
8930
9785
|
Array.from(el.childNodes).forEach(child => processElementSkipScopes(child, processedScopes));
|
|
8931
9786
|
}
|
|
8932
|
-
}`;var
|
|
9787
|
+
}`;var lt=` function bindShow(el, expr, passedScope = componentScope, attrName = '@show') {
|
|
8933
9788
|
if (el.__stx_show_bound) return;
|
|
8934
9789
|
el.__stx_show_bound = true;
|
|
8935
9790
|
|
|
@@ -8983,7 +9838,7 @@ ${e}
|
|
|
8983
9838
|
}
|
|
8984
9839
|
el.removeAttribute(attrName);
|
|
8985
9840
|
}
|
|
8986
|
-
`;var
|
|
9841
|
+
`;var ct=` // Re-initialize components after SPA content swap.
|
|
8987
9842
|
// Debounce to handle rapid re-fires (HMR triggers navigate which triggers stx:load again).
|
|
8988
9843
|
var _stxLoadTimer = null;
|
|
8989
9844
|
if (window.__stxLoadHandler) {
|
|
@@ -9024,7 +9879,7 @@ ${e}
|
|
|
9024
9879
|
var departingDestroys = null;
|
|
9025
9880
|
function beginSwap() {
|
|
9026
9881
|
departingDestroys = (departingDestroys || []).concat(destroyCallbacks.splice(0));
|
|
9027
|
-
}`;var
|
|
9882
|
+
}`;var dt=` function _handleStxLoad() {
|
|
9028
9883
|
_stxLoadTimer = null;
|
|
9029
9884
|
console.log('[stx:load] START. mountQueue:', mountQueue.length, '_latestSetup:', !!window.stx._latestSetup);
|
|
9030
9885
|
|
|
@@ -9210,7 +10065,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9210
10065
|
// Everything that should have hydrated has now had its chance (#1773).
|
|
9211
10066
|
auditHydration(container, 'stx:load');
|
|
9212
10067
|
}
|
|
9213
|
-
`;var
|
|
10068
|
+
`;var ut=` // ==========================================================================
|
|
9214
10069
|
// State Signal
|
|
9215
10070
|
// ==========================================================================
|
|
9216
10071
|
|
|
@@ -9361,7 +10216,7 @@ finally {
|
|
|
9361
10216
|
function memo(compute, equals) {
|
|
9362
10217
|
return derived(compute, { equals: typeof equals === 'function' ? equals : Object.is });
|
|
9363
10218
|
}
|
|
9364
|
-
`;var
|
|
10219
|
+
`;var pt=` // \u2500\u2500 Store System \u2500\u2500
|
|
9365
10220
|
// Pinia-inspired, signals-based. Stores survive SPA navigation.
|
|
9366
10221
|
|
|
9367
10222
|
defineStore: function(id, setupOrOptions, storeOptions) {
|
|
@@ -9821,7 +10676,7 @@ finally {
|
|
|
9821
10676
|
}
|
|
9822
10677
|
console.log('[stx:store] useStore:', id);
|
|
9823
10678
|
return store;
|
|
9824
|
-
},`;var
|
|
10679
|
+
},`;var ft=` // Storage access is guarded end to end (stacksjs/stx#1793). Every one of
|
|
9825
10680
|
// these can throw, and each throw took down the whole client script for the
|
|
9826
10681
|
// page rather than just the composable:
|
|
9827
10682
|
//
|
|
@@ -9899,7 +10754,7 @@ finally {
|
|
|
9899
10754
|
window.addEventListener('storage', handler);
|
|
9900
10755
|
onDestroy(function() { window.removeEventListener('storage', handler); });
|
|
9901
10756
|
return s;
|
|
9902
|
-
}`;var
|
|
10757
|
+
}`;var mt=` function bindStyle(el, expr, passedScope = componentScope, isVisible) {
|
|
9903
10758
|
// Capture scope at setup time - use passed scope to preserve context
|
|
9904
10759
|
const capturedScope = layerTemplateScopes(globalHelpers, passedScope, (findElementScope(el) || {}));
|
|
9905
10760
|
|
|
@@ -9934,7 +10789,7 @@ catch (e2) {
|
|
|
9934
10789
|
stxHost.setStyle(el, value, true);
|
|
9935
10790
|
});
|
|
9936
10791
|
}
|
|
9937
|
-
`;var
|
|
10792
|
+
`;var gt=` // <Suspense> boundary (#1742). Aggregates the loading/error state of every
|
|
9938
10793
|
// descendant suspense query (useQuery/useFetch with { suspense: true }) for
|
|
9939
10794
|
// which this is the nearest [data-stx-suspense] ancestor, and toggles three
|
|
9940
10795
|
// regions accordingly: [data-stx-suspense-fallback] while any query is loading,
|
|
@@ -9992,7 +10847,7 @@ catch (e2) {
|
|
|
9992
10847
|
var contentRoot = (contentEl === el) ? el : contentEl;
|
|
9993
10848
|
Array.from(contentRoot.childNodes).forEach(function(child) { processElement(child, scope); });
|
|
9994
10849
|
}
|
|
9995
|
-
`;var
|
|
10850
|
+
`;var vt=` // ==========================================================================
|
|
9996
10851
|
// Timer & Utility Composables
|
|
9997
10852
|
// ==========================================================================
|
|
9998
10853
|
|
|
@@ -10393,7 +11248,7 @@ else if (timer === null) {
|
|
|
10393
11248
|
}
|
|
10394
11249
|
};
|
|
10395
11250
|
}
|
|
10396
|
-
`;var
|
|
11251
|
+
`;var yt=` // \u2500\u2500 Tooltip runtime \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
10397
11252
|
(function() {
|
|
10398
11253
|
var tip = null;
|
|
10399
11254
|
function createTip() {
|
|
@@ -10432,7 +11287,7 @@ else if (timer === null) {
|
|
|
10432
11287
|
document.addEventListener('focusin', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });
|
|
10433
11288
|
document.addEventListener('focusout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });
|
|
10434
11289
|
})();
|
|
10435
|
-
`;var
|
|
11290
|
+
`;var wt=` // ==========================================================================
|
|
10436
11291
|
// Toast notification system
|
|
10437
11292
|
// ==========================================================================
|
|
10438
11293
|
|
|
@@ -10728,7 +11583,7 @@ else if (timer === null) {
|
|
|
10728
11583
|
});
|
|
10729
11584
|
});
|
|
10730
11585
|
}
|
|
10731
|
-
`;var
|
|
11586
|
+
`;var _t=` // ==========================================================================
|
|
10732
11587
|
// WebSocket Composable
|
|
10733
11588
|
// ==========================================================================
|
|
10734
11589
|
|
|
@@ -10865,85 +11720,86 @@ else if (timer === null) {
|
|
|
10865
11720
|
subscribe: subscribe
|
|
10866
11721
|
};
|
|
10867
11722
|
}
|
|
10868
|
-
`;function ht(){let
|
|
10869
|
-
${
|
|
11723
|
+
`;function ht(e={}){let o=kt(Hn(e));try{let r=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(o);return r=r.replace(/\}(var |let |const |function )/g,"};$1"),r}catch{return o}}function kt(e){let o=[],l=0,r="console.log(";while(l<e.length){let d=e.indexOf(r,l);if(d===-1){o.push(e.slice(l));break}o.push(e.slice(l,d));let y=1,s=d+r.length;while(s<e.length&&y>0){let u=e[s];if(u==='"'||u==="'"||u==="`"){let h=u;s++;while(s<e.length&&e[s]!==h){if(e[s]==="\\")s++;s++}s++;continue}if(u==="(")y++;else if(u===")")y--;s++}o.push("0"),l=s}return o.join("")}function Hn(e={}){return`${ae}${Pe}
|
|
11724
|
+
${Ze(ie,ke,Te)}
|
|
10870
11725
|
|
|
10871
|
-
${
|
|
10872
|
-
${
|
|
10873
|
-
${
|
|
10874
|
-
${
|
|
11726
|
+
${De}
|
|
11727
|
+
${rt}
|
|
11728
|
+
${tt}
|
|
11729
|
+
${ut}
|
|
10875
11730
|
${xe}
|
|
10876
|
-
${
|
|
10877
|
-
${
|
|
11731
|
+
${Ue}
|
|
11732
|
+
${_t}
|
|
10878
11733
|
${Ae(X.toString(),Q.toString())}
|
|
10879
|
-
${
|
|
11734
|
+
${st}
|
|
10880
11735
|
${ze}
|
|
10881
|
-
${
|
|
10882
|
-
${
|
|
11736
|
+
${Ye}
|
|
11737
|
+
${Xe}
|
|
10883
11738
|
// ==========================================================================
|
|
10884
11739
|
// Template Binding
|
|
10885
11740
|
// ==========================================================================
|
|
10886
11741
|
|
|
10887
11742
|
${Ee}
|
|
10888
11743
|
${Se}
|
|
10889
|
-
${
|
|
10890
|
-
${
|
|
11744
|
+
${Re}
|
|
11745
|
+
${je}
|
|
10891
11746
|
${se}
|
|
10892
11747
|
${ue}
|
|
10893
11748
|
${me}
|
|
10894
|
-
${Ke}
|
|
10895
|
-
${tt(gl(),ml(),fl())}
|
|
10896
|
-
|
|
10897
|
-
${mt}
|
|
10898
|
-
${it}
|
|
10899
11749
|
${Ge}
|
|
11750
|
+
${nt(hl(),yl(),ml())}
|
|
11751
|
+
|
|
11752
|
+
${gt}
|
|
11753
|
+
${lt}
|
|
11754
|
+
${$e}
|
|
10900
11755
|
${ce}
|
|
10901
|
-
${
|
|
11756
|
+
${mt}
|
|
10902
11757
|
${bt}
|
|
10903
|
-
${
|
|
11758
|
+
${qe}
|
|
10904
11759
|
${pe}
|
|
10905
|
-
${
|
|
11760
|
+
${Ke}
|
|
10906
11761
|
${Ne}
|
|
10907
|
-
${
|
|
10908
|
-
${
|
|
10909
|
-
${
|
|
10910
|
-
${
|
|
11762
|
+
${e.native?Ie:""}
|
|
11763
|
+
${Be}
|
|
11764
|
+
${he}
|
|
11765
|
+
${Ve}
|
|
11766
|
+
${He}
|
|
10911
11767
|
${de}
|
|
10912
|
-
${
|
|
11768
|
+
${vt}
|
|
10913
11769
|
${re}
|
|
10914
|
-
${
|
|
11770
|
+
${et}
|
|
10915
11771
|
|
|
10916
|
-
${
|
|
11772
|
+
${ft}
|
|
10917
11773
|
|
|
10918
11774
|
var useBroadcastStream = ${ne.toString()};
|
|
10919
11775
|
|
|
10920
|
-
${
|
|
11776
|
+
${Fe(J.toString(),Y.toString(),ee.toString(),Z.toString(),te.toString())}
|
|
10921
11777
|
${ve}
|
|
10922
|
-
${oe(
|
|
10923
|
-
${
|
|
10924
|
-
${
|
|
11778
|
+
${oe(z.toString())}
|
|
11779
|
+
${Oe}
|
|
11780
|
+
${wt}
|
|
10925
11781
|
|
|
10926
|
-
${
|
|
11782
|
+
${Qe}
|
|
10927
11783
|
${ye}
|
|
10928
11784
|
${_e}
|
|
10929
|
-
${
|
|
11785
|
+
${yt}
|
|
10930
11786
|
${Me}
|
|
10931
|
-
${
|
|
11787
|
+
${ot(fe)}
|
|
10932
11788
|
|
|
10933
|
-
${
|
|
11789
|
+
${pt}
|
|
10934
11790
|
|
|
10935
|
-
${
|
|
11791
|
+
${We}
|
|
10936
11792
|
});
|
|
10937
11793
|
|
|
10938
11794
|
${Ce}
|
|
10939
|
-
${be}
|
|
10940
11795
|
${we}
|
|
10941
|
-
${
|
|
10942
|
-
${
|
|
11796
|
+
${be}
|
|
11797
|
+
${at}
|
|
11798
|
+
${Le}
|
|
10943
11799
|
${ge}
|
|
10944
|
-
${lt}
|
|
10945
11800
|
${ct}
|
|
10946
|
-
${
|
|
11801
|
+
${dt}
|
|
11802
|
+
${it}
|
|
10947
11803
|
})();
|
|
10948
|
-
`}var
|
|
10949
|
-
export{ht,Hn,
|
|
11804
|
+
`}var lh={state:le,derived:Vn,effect:Un,batch:vo,onMount:Jr,onDestroy:Yr,isSignal:Wn,isDerived:qn,untrack:xo,peek:Zr,generateSignalsRuntime:ht,generateSignalsRuntimeDev:Hn};
|
|
11805
|
+
export{ht,Hn,lh};
|