@stacksjs/stx 0.2.343 → 0.2.345
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/binding-manifest.d.ts +32 -0
- package/dist/binding-manifest.js +64 -0
- package/dist/{chunk-zr1x54bt.js → chunk-05zfez2g.js} +1 -1
- package/dist/{chunk-jagf7h9y.js → chunk-0k1mtwby.js} +1 -1
- package/dist/{chunk-jh6f1a9y.js → chunk-1c9453w0.js} +1 -1
- package/dist/chunk-1qyg1q6d.js +2 -0
- package/dist/chunk-1t4ece3v.js +2 -0
- package/dist/{chunk-7zxv2631.js → chunk-1vt1h19d.js} +1 -1
- package/dist/chunk-1vtdege3.js +2 -0
- package/dist/{chunk-stqm4brp.js → chunk-1vv9g6cj.js} +1 -1
- package/dist/{chunk-p3awq80d.js → chunk-1yh6pq6b.js} +1 -1
- package/dist/{chunk-57dxdvjh.js → chunk-223makqc.js} +1 -1
- package/dist/chunk-2fhk4e68.js +2 -0
- package/dist/{chunk-wyhb3nb0.js → chunk-34f8c48f.js} +1 -1
- package/dist/chunk-3zm4hgcf.js +2 -0
- package/dist/{chunk-xgw269cf.js → chunk-4spaszfn.js} +286 -286
- package/dist/chunk-57t402mn.js +2 -0
- package/dist/{chunk-wdaf98ya.js → chunk-59906baj.js} +1 -1
- package/dist/{chunk-z9hb80mk.js → chunk-64n10kpa.js} +1 -1
- package/dist/chunk-66tgkvqw.js +2 -0
- package/dist/{chunk-daxr6p6q.js → chunk-6fwp7gee.js} +1 -1
- package/dist/{chunk-1bfvdjpy.js → chunk-6h3r8v55.js} +1 -1
- package/dist/{chunk-safmgrq5.js → chunk-6wmjwbq9.js} +1 -1
- package/dist/{chunk-53sjbp3z.js → chunk-72x62kch.js} +2 -2
- package/dist/{chunk-amfq5rnz.js → chunk-72yrrggn.js} +2 -2
- package/dist/{chunk-2853ye06.js → chunk-77p1kjg2.js} +2 -2
- package/dist/chunk-7g5vk4c3.js +2 -0
- package/dist/{chunk-7mc1k1tq.js → chunk-7h9fajgs.js} +1 -1
- package/dist/{chunk-gvfgrve8.js → chunk-7m9qk7da.js} +1 -1
- package/dist/{chunk-3d3x7dwy.js → chunk-7qp3zphs.js} +1 -1
- package/dist/{chunk-grnmr3y1.js → chunk-86c461ca.js} +1 -1
- package/dist/chunk-86q2h34b.js +2 -0
- package/dist/{chunk-7r79j1hs.js → chunk-89mqnh67.js} +1 -1
- package/dist/{chunk-5hq25yky.js → chunk-8cc4vdkh.js} +1 -1
- package/dist/chunk-8rhjt6fh.js +2 -0
- package/dist/{chunk-45ydb29q.js → chunk-8v2k21n4.js} +1 -1
- package/dist/{chunk-aqxwwq6w.js → chunk-8y1ve8tc.js} +2 -2
- package/dist/{chunk-ag8gdk51.js → chunk-99b5tfxc.js} +1 -1
- package/dist/{chunk-4vd0rqfs.js → chunk-9jbssgem.js} +197 -88
- package/dist/{chunk-s60eccqk.js → chunk-9nrgjtah.js} +1 -1
- package/dist/{chunk-y5sxa2sq.js → chunk-9qtf2b1p.js} +1 -1
- package/dist/chunk-aapqf6bj.js +2 -0
- package/dist/{chunk-k8skvm0d.js → chunk-at622hg0.js} +1 -1
- package/dist/{chunk-1qtd4ex2.js → chunk-avwywzsj.js} +2 -2
- package/dist/{chunk-a0ajg9z5.js → chunk-b5hank5e.js} +1 -1
- package/dist/chunk-b5mnam29.js +2 -0
- package/dist/{chunk-4fafxr8d.js → chunk-bk1zb1xp.js} +1 -1
- package/dist/{chunk-hrdd26r4.js → chunk-bqdfbwdf.js} +1 -1
- package/dist/{chunk-c7qdnc5d.js → chunk-c30qnb6z.js} +1 -1
- package/dist/chunk-c4tf1vpy.js +2 -0
- package/dist/{chunk-g0dbtyk7.js → chunk-c8e2deyp.js} +1 -1
- package/dist/chunk-cypg8qwn.js +2 -0
- package/dist/{chunk-fbmjw0bh.js → chunk-d86q27j8.js} +1 -1
- package/dist/{chunk-dj5mqnp1.js → chunk-dgv43ccd.js} +1 -1
- package/dist/{chunk-em8cr7wy.js → chunk-dsztk2kp.js} +1 -1
- package/dist/{chunk-mwvxhv0r.js → chunk-dxkjvajv.js} +1 -1
- package/dist/{chunk-4pg6wbt6.js → chunk-e631svvs.js} +1 -1
- package/dist/chunk-e7gs18rc.js +2 -0
- package/dist/{chunk-h6y99nak.js → chunk-e7np0h2q.js} +1 -1
- package/dist/{chunk-0s3ry262.js → chunk-ejqpq0wc.js} +1 -1
- package/dist/chunk-ek2m0kkw.js +2 -0
- package/dist/chunk-eqzc88et.js +2 -0
- package/dist/chunk-erb294sv.js +2 -0
- package/dist/{chunk-36j9qset.js → chunk-esjcyxa9.js} +2 -2
- package/dist/{chunk-5azeswj2.js → chunk-evfr2zgg.js} +1 -1
- package/dist/{chunk-e53pwshq.js → chunk-fp868yhg.js} +1 -1
- package/dist/{chunk-5zemhhwe.js → chunk-gsc2vds7.js} +1 -1
- package/dist/{chunk-q6825wwz.js → chunk-gvemapw4.js} +1 -1
- package/dist/chunk-h1vax4wg.js +2 -0
- package/dist/chunk-hke0k33t.js +2 -0
- package/dist/{chunk-zcytk5w9.js → chunk-jekrtm2j.js} +1 -1
- package/dist/{chunk-pwhf5kte.js → chunk-jnbg3e4r.js} +1 -1
- package/dist/{chunk-brjfzbq9.js → chunk-kfkf9v2d.js} +1 -1
- package/dist/chunk-kq30wqp6.js +2 -0
- package/dist/{chunk-s7qbba8r.js → chunk-kqzpmwx2.js} +10 -10
- package/dist/{chunk-0dpgh7a6.js → chunk-kw9cgyfc.js} +1 -1
- package/dist/{chunk-0fp16c1x.js → chunk-m2j5skez.js} +1 -1
- package/dist/{chunk-vj3nx26v.js → chunk-mph46gkj.js} +1 -1
- package/dist/chunk-mr8ccsnm.js +2 -0
- package/dist/{chunk-1h1c2048.js → chunk-msywnv5n.js} +1 -1
- package/dist/{chunk-649dfqqz.js → chunk-n5657hm3.js} +1 -1
- package/dist/{chunk-t00ga194.js → chunk-njx93b4z.js} +1 -1
- package/dist/{chunk-m0xaw0qw.js → chunk-nm60wh6r.js} +1 -1
- package/dist/{chunk-8ah5mhst.js → chunk-nqz501eq.js} +2 -2
- package/dist/{chunk-hq3phk1a.js → chunk-nrt99ptw.js} +1 -1
- package/dist/{chunk-62vng8g8.js → chunk-pajk5680.js} +2 -2
- package/dist/{chunk-ey1tsk22.js → chunk-ppzz953j.js} +1 -1
- package/dist/{chunk-7yfk9393.js → chunk-qkdcbeaw.js} +1 -1
- package/dist/chunk-qr3zcm87.js +2 -0
- package/dist/chunk-r38xq7fp.js +33 -0
- package/dist/{chunk-tqw1yean.js → chunk-rwwfzkz4.js} +1 -1
- package/dist/{chunk-rns7wjy9.js → chunk-rzda6bd6.js} +1 -1
- package/dist/{chunk-rzg9pars.js → chunk-san1eq0r.js} +2 -2
- package/dist/{chunk-eh3meyd3.js → chunk-tc4pj651.js} +2 -2
- package/dist/{chunk-6g8rvnhc.js → chunk-v6e35j4g.js} +1 -1
- package/dist/{chunk-wnmegbw0.js → chunk-v7aa7v85.js} +1 -1
- package/dist/{chunk-e6rxvz3p.js → chunk-vhg91hnw.js} +1 -1
- package/dist/{chunk-k3dtvay1.js → chunk-vhta1be7.js} +1 -1
- package/dist/{chunk-tz68qv47.js → chunk-w5j9tbsk.js} +1 -1
- package/dist/{chunk-ec18ftcg.js → chunk-wj21f1e0.js} +1 -1
- package/dist/{chunk-12qteqk8.js → chunk-ws0282jr.js} +1 -1
- package/dist/chunk-x054qzma.js +2 -0
- package/dist/{chunk-q9ckfwhh.js → chunk-xj6bcwqa.js} +1 -1
- package/dist/chunk-xq0e2y4x.js +2 -0
- package/dist/chunk-xrjx7b2v.js +2 -0
- package/dist/{chunk-ay336sqb.js → chunk-xvh1k1a4.js} +1 -1
- package/dist/{chunk-vaggjvsm.js → chunk-y2f41kaq.js} +1 -1
- package/dist/{chunk-1zav2sf1.js → chunk-y6xzr30x.js} +1 -1
- package/dist/chunk-ybx8n794.js +2 -0
- package/dist/{chunk-yefnrr5z.js → chunk-yca761bm.js} +1 -1
- package/dist/{chunk-kgbz86sa.js → chunk-yg5r7bnm.js} +2 -2
- package/dist/{chunk-kbah2k8e.js → chunk-z8wb7kbj.js} +2 -2
- package/dist/chunk-zkxnarrh.js +2 -0
- package/dist/{chunk-hzbty7hz.js → chunk-zmazqcb8.js} +1 -1
- package/dist/chunk-zp14ksx1.js +2 -0
- package/dist/chunk-zwr4bn6a.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.js +15 -3
- package/dist/includes.js +2 -2
- package/dist/pwa.js +2 -2
- package/dist/runtime-globals.d.ts +22 -0
- package/dist/runtime-globals.js +46 -0
- package/dist/signals.js +193 -84
- package/dist/slots.js +3 -3
- package/dist/ssg.js +2 -2
- package/dist/theme-tokens.d.ts +59 -0
- package/dist/theme-tokens.js +83 -17
- package/dist/ts-css-config.js +4 -2
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +77 -12
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +23 -3
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-160g7ynw.js +0 -2
- package/dist/chunk-16hr5y08.js +0 -2
- package/dist/chunk-3h97y3n3.js +0 -2
- package/dist/chunk-3j915h2d.js +0 -2
- package/dist/chunk-4hkg6kx4.js +0 -2
- package/dist/chunk-57494khk.js +0 -2
- package/dist/chunk-5xavmr4t.js +0 -2
- package/dist/chunk-6rsfkms1.js +0 -2
- package/dist/chunk-6xs80tka.js +0 -32
- package/dist/chunk-905j49fe.js +0 -2
- package/dist/chunk-9czj483k.js +0 -2
- package/dist/chunk-9kv0qavn.js +0 -2
- package/dist/chunk-bcz8yp2g.js +0 -2
- package/dist/chunk-bxefsc7k.js +0 -2
- package/dist/chunk-c4kv3r8t.js +0 -2
- package/dist/chunk-fytemc96.js +0 -2
- package/dist/chunk-g7gc0ten.js +0 -2
- package/dist/chunk-gqsxxd81.js +0 -2
- package/dist/chunk-gx9z0wmm.js +0 -2
- package/dist/chunk-jnxzzzm4.js +0 -2
- package/dist/chunk-jy6jwxhs.js +0 -2
- package/dist/chunk-khqn40gv.js +0 -2
- package/dist/chunk-mhbzrh5y.js +0 -2
- package/dist/chunk-p8anntjb.js +0 -2
- package/dist/chunk-pwe51myj.js +0 -2
- package/dist/chunk-rqqdvnp5.js +0 -2
- package/dist/chunk-w1mbrq1g.js +0 -2
- package/dist/chunk-w84qe2m6.js +0 -2
- package/dist/chunk-wjm7hv5e.js +0 -2
- package/dist/chunk-yr7s02f7.js +0 -2
- package/dist/chunk-zq3tm2c2.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aj as M,Ej as
|
|
2
|
+
import{Aj as M,Ej as P,Fj as T,Gj as x,Hj as C,vj as B,wj as F,xj as H,yj as O,zj as I}from"./chunk-e4g8wz6t.js";import{Jv as L,Lv as R,Nv as S}from"./chunk-72x62kch.js";var w=null;function j(){return w}function g(z,W){if(w)w.provides.set(z,W);else V.set(z,W)}function v(z,W){let Q=w;while(Q){if(Q.provides.has(z))return Q.provides.get(z);Q=Q.parent}if(V.has(z))return V.get(z);return W}var V=new Map;function m(z,W){V.set(z,W)}function U(z){let W=w,Q=W?.el,Z=Array.isArray(z)?z:z&&typeof z==="object"?Object.keys(z):[];if(Q&&Z.length>0){let $=Q.__stx_component_emits||=Object.create(null);for(let Y of Z)$[Y]=!0}let _=($,...Y)=>{if(typeof document>"u")return;if(Q){let A=Q.__stx_component_emits||=Object.create(null);A[$]=!0,Q.dispatchEvent(new CustomEvent($,{detail:Y.length===1?Y[0]:Y,bubbles:!0,cancelable:!0}))}};if(W)W.emit=_;return _}function y(z){if(w)w.exposed=z}function h(z){let W=Promise.resolve();return z?W.then(z):W}function p(z){if(w)w.errorCapturedHooks.push(z)}function u(z,W,Q){let Z=W?.parent;while(Z){for(let _ of Z.errorCapturedHooks)if(_(z,W,Q)===!1)return;Z=Z.parent}}function l(){return w?.slots??{}}function d(){return w?.slots??{}}function i(){return w?.attrs??{}}function c(z){let W=z.__provides?new Map(Object.entries(z.__provides)):new Map;return{...z,__provides:W,__provide(Q,Z){W.set(Q,Z)},__inject(Q,Z){if(W.has(Q))return W.get(Q);if(z.__provides){let _=z.__provides instanceof Map?z.__provides:new Map(Object.entries(z.__provides));if(_.has(Q))return _.get(Q)}return Z}}}function o(){return`
|
|
3
3
|
// STX Composition API Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
const _provides = new Map();
|
|
@@ -64,7 +64,7 @@ import{Aj as M,Ej as E,Fj as P,Gj as O,Hj as I,vj as B,wj as R,xj as H,yj as S,z
|
|
|
64
64
|
return refs;
|
|
65
65
|
};
|
|
66
66
|
})();
|
|
67
|
-
`}function
|
|
67
|
+
`}function E(z,W,Q,Z,_){let $=!0,Y=new Set,A=(J)=>Z.get?Z.get(J):J,G=()=>A(z());return Object.defineProperty(G,"_isSignal",{value:!0}),Object.defineProperty(G,"modifiers",{get:W}),G.set=(J)=>{if(!$)return;let X=W(),N=Z.set?Z.set(J,X):J;if(X.trim&&typeof N==="string")N=N.trim();if(X.number&&typeof N==="string"&&N!==""){let K=Number(N);if(!Number.isNaN(K))N=K}if(Object.is(z(),N))return;z.set(N),Q(N)},G.update=(J)=>G.set(J(G())),G.input=(J)=>{if(!W().lazy)G.set(J)},G.change=(J)=>{if(W().lazy)G.set(J)},G.subscribe=(J)=>{if(!$)return()=>{};let X=z.subscribe((N,K)=>J(A(N),A(K)));return Y.add(X),()=>{X(),Y.delete(X)}},Object.defineProperty(G,"value",{get:G,set:G.set}),_(()=>{$=!1,Y.forEach((J)=>J()),Y.clear()}),G}function r(z="modelValue",W={}){let Q=typeof z==="string"?z:"modelValue",Z=typeof z==="string"?W:z,_=j()?.props||{},$=U([`update:${Q}`]),Y=Q==="modelValue"?"modelModifiers":`${Q}Modifiers`,A=(X)=>P(_[X])||T(_[X])?_[X]():_[X],G=B(Z.default),J=H(()=>{let X=A(Q);G.set(X===void 0?Z.default:X)});return M(J),E(G,()=>A(Y)||{},(X)=>$(`update:${Q}`,X),Z,M)}function q(z,W=!0,Q){if(!W||!z||typeof window>"u")return;let Z=window;if(!Z.__STX_DATA__){let $=document.querySelector("script[data-stx-server-data]");try{let Y=JSON.parse($?.textContent||"{}");Z.__STX_DATA__=Y&&typeof Y==="object"&&!Array.isArray(Y)?Y:{}}catch{Z.__STX_DATA__={}}}let _=Z.__STX_DATA__;if(_&&Object.prototype.hasOwnProperty.call(_,z))try{return{data:Q?Q(_[z]):_[z]}}catch($){return{data:null,error:$ instanceof Error?$:Error(String($))}}return}function D(z){if(typeof window>"u")return;let W=window;if(z===void 0)W.__STX_DATA__={};else{if(!W.__STX_DATA__)try{let Q=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");W.__STX_DATA__=Q&&typeof Q==="object"&&!Array.isArray(Q)?Q:{}}catch{W.__STX_DATA__={}}if(W.__STX_DATA__)delete W.__STX_DATA__[z]}}function f(){let z=k(b());try{let Q=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(z);return Q=Q.replace(/\}(var |let |const |function )/g,"};$1"),Q}catch{return z}}function k(z){let W=[],Q=0,Z="console.log(";while(Q<z.length){let _=z.indexOf(Z,Q);if(_===-1){W.push(z.slice(Q));break}W.push(z.slice(Q,_));let $=1,Y=_+Z.length;while(Y<z.length&&$>0){let A=z[Y];if(A==='"'||A==="'"||A==="`"){let G=A;Y++;while(Y<z.length&&z[Y]!==G){if(z[Y]==="\\")Y++;Y++}Y++;continue}if(A==="(")$++;else if(A===")")$--;Y++}W.push("0"),Q=Y}return W.join("")}function b(){return`
|
|
68
68
|
// STX Signals Runtime (Development Build)
|
|
69
69
|
console.log('[stx] signals runtime loading');
|
|
70
70
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -77,6 +77,82 @@ console.log('[stx] entering IIFE');
|
|
|
77
77
|
(function() {
|
|
78
78
|
'use strict';
|
|
79
79
|
|
|
80
|
+
// \u2500\u2500 Host \u2500\u2500
|
|
81
|
+
//
|
|
82
|
+
// The tree this runtime mutates. Every write the binding layer makes to a
|
|
83
|
+
// node goes through here, so the same runtime can drive something that is not
|
|
84
|
+
// the document -- native views over a bridge (stacksjs/stx#1984).
|
|
85
|
+
//
|
|
86
|
+
// Signals never touch a node, so nothing above this line needs to change; the
|
|
87
|
+
// coupling is entirely in the bind layer. A host is swapped in by assigning
|
|
88
|
+
// window.__stx_host before the runtime executes. The name is stxHost, not
|
|
89
|
+
// host, because the runtime already calls two local DOM nodes host -- a
|
|
90
|
+
// shadowed adapter fails as node.anchor is not a function, deep inside a
|
|
91
|
+
// branch swap, and nowhere near the line that caused it, which keeps the web path
|
|
92
|
+
// exactly as it was: same calls, one property lookup earlier.
|
|
93
|
+
var stxHost = window.__stx_host || {
|
|
94
|
+
setText: function(node, value) { node.textContent = value; },
|
|
95
|
+
setAttribute: function(node, name, value) { node.setAttribute(name, value); },
|
|
96
|
+
removeAttribute: function(node, name) { node.removeAttribute(name); },
|
|
97
|
+
|
|
98
|
+
// Structural operations, for the bindings that build rows rather than
|
|
99
|
+
// update one node (#1984).
|
|
100
|
+
//
|
|
101
|
+
// anchor() is a position in the child list that survives the nodes around
|
|
102
|
+
// it moving -- a comment node here, since the document has one; a native
|
|
103
|
+
// host keeps an index or a zero-size sentinel.
|
|
104
|
+
//
|
|
105
|
+
// clone() is the one that does not carry over as-is: a DOM subtree can be
|
|
106
|
+
// deep-copied, a native view hierarchy cannot. A native host materialises a
|
|
107
|
+
// fresh subtree from the template it was given instead of copying views,
|
|
108
|
+
// which is why the row template is passed rather than a node to duplicate.
|
|
109
|
+
// A native host registers the handler against the view and has the platform
|
|
110
|
+
// call it; nothing about the binding layer changes, which is the point.
|
|
111
|
+
// The options argument carries passive/capture/once. A native host has no use for
|
|
112
|
+
// passive -- there is no scroll thread to block -- but dropping the
|
|
113
|
+
// parameter silently makes every touch listener blocking again, so it stays
|
|
114
|
+
// in the signature and each host decides what to do with it.
|
|
115
|
+
listen: function(node, event, handler, options) { node.addEventListener(event, handler, options); },
|
|
116
|
+
|
|
117
|
+
// Returns the PREVIOUS visibility. bindShow needs to know whether it just
|
|
118
|
+
// revealed something, and asking the node afterwards is the one read-back
|
|
119
|
+
// in the binding layer -- a native host cannot answer what a UIView's
|
|
120
|
+
// display value was, because it has none. A write that reports what it
|
|
121
|
+
// replaced removes the question: the DOM host reads its own style, a native
|
|
122
|
+
// host reads isHidden, and the binder reads neither.
|
|
123
|
+
//
|
|
124
|
+
// Restoring an explicit display (a flex row, an inline-block) is the host's
|
|
125
|
+
// business too; it records it the first time it hides the node.
|
|
126
|
+
// The scope root a node belongs to: nearest ancestor-or-self that owns a
|
|
127
|
+
// scope, or null. Three binding paths need it -- ref ownership, and an
|
|
128
|
+
// if-chain finding the scope its branch belongs to.
|
|
129
|
+
//
|
|
130
|
+
// Not a query method. A host is never handed a selector, because a native
|
|
131
|
+
// view tree has nothing to match one against: the DOM host walks with
|
|
132
|
+
// closest(), a native host reads the node-to-scope map it maintains as it
|
|
133
|
+
// creates views. The from flag skips the node itself, which the ref path needs
|
|
134
|
+
// when it walks outward past a receiver it has already rejected.
|
|
135
|
+
scopeOf: function(node, from) {
|
|
136
|
+
var start = from ? (node && node.parentElement) : node;
|
|
137
|
+
return (start && start.closest) ? start.closest('[data-stx-scope]') : null;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
setVisible: function(node, visible) {
|
|
141
|
+
if (node.__stx_display === undefined) {
|
|
142
|
+
var d = node.style.display;
|
|
143
|
+
node.__stx_display = (d && d !== 'none') ? d : '';
|
|
144
|
+
}
|
|
145
|
+
var was = node.style.display !== 'none';
|
|
146
|
+
node.style.display = visible ? node.__stx_display : 'none';
|
|
147
|
+
return was;
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
anchor: function(label) { return document.createComment(label); },
|
|
151
|
+
clone: function(node) { return node.cloneNode(true); },
|
|
152
|
+
insert: function(parent, node, before) { parent.insertBefore(node, before); },
|
|
153
|
+
remove: function(node) { if (node.parentNode) node.parentNode.removeChild(node); }
|
|
154
|
+
};
|
|
155
|
+
|
|
80
156
|
// Inject x-cloak CSS to prevent FOUC (Flash of Unstyled Content)
|
|
81
157
|
// Elements with x-cloak are hidden until the runtime removes the attribute after mount
|
|
82
158
|
var cloakStyle = document.getElementById ? document.getElementById('stx-cloak-style') : null;
|
|
@@ -2585,7 +2661,41 @@ catch (e) {
|
|
|
2585
2661
|
return scripts;
|
|
2586
2662
|
}
|
|
2587
2663
|
|
|
2588
|
-
|
|
2664
|
+
/**
|
|
2665
|
+
* Bind what the server said carries a binding, instead of looking for it.
|
|
2666
|
+
*
|
|
2667
|
+
* The walk exists because the runtime does not know where the bindings are.
|
|
2668
|
+
* The server does -- it rendered them -- so when it ships that list the
|
|
2669
|
+
* runtime stops searching: resolve each id, bind that element, never touch
|
|
2670
|
+
* its children. An element with no bindings is never visited at all.
|
|
2671
|
+
*
|
|
2672
|
+
* This is the piece a native host needs. A view hierarchy has no attributes
|
|
2673
|
+
* to read and no selector to match, so discovery cannot happen there; handed
|
|
2674
|
+
* the list, it does not have to. On the DOM the ids resolve by attribute,
|
|
2675
|
+
* which is one query per entry rather than a full traversal.
|
|
2676
|
+
*
|
|
2677
|
+
* Absent a manifest nothing changes: the walk is still the default, and a
|
|
2678
|
+
* page that ships no list hydrates exactly as it did.
|
|
2679
|
+
*/
|
|
2680
|
+
function processFromManifest(root, scope, manifest) {
|
|
2681
|
+
if (!root || !manifest || !manifest.length) return false;
|
|
2682
|
+
for (var i = 0; i < manifest.length; i++) {
|
|
2683
|
+
var entry = manifest[i];
|
|
2684
|
+
var id = entry && entry.id;
|
|
2685
|
+
if (id === undefined || id === null) continue;
|
|
2686
|
+
var node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)
|
|
2687
|
+
? root
|
|
2688
|
+
: (root.querySelector ? root.querySelector('[data-stx-b="' + id + '"]') : null);
|
|
2689
|
+
if (!node) continue;
|
|
2690
|
+
processElement(node, scope, true);
|
|
2691
|
+
}
|
|
2692
|
+
return true;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
// skipChildren: this element's bindings only, because something else already
|
|
2696
|
+
// knows where the rest are. The manifest path passes it for every entry, so
|
|
2697
|
+
// the tree is never walked; see processFromManifest.
|
|
2698
|
+
function processElement(el, scope = componentScope, skipChildren) {
|
|
2589
2699
|
// Lazy hydration: if this element has stx-hydrate and hasn't been hydrated
|
|
2590
2700
|
// yet, defer its subtree processing until the trigger fires.
|
|
2591
2701
|
if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated) {
|
|
@@ -2831,7 +2941,7 @@ catch (e2) {
|
|
|
2831
2941
|
};
|
|
2832
2942
|
|
|
2833
2943
|
// Known directive names to exclude from generic :attr binding
|
|
2834
|
-
var DIRECTIVE_NAMES = {
|
|
2944
|
+
var DIRECTIVE_NAMES = ${R()};
|
|
2835
2945
|
|
|
2836
2946
|
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
2837
2947
|
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
@@ -2866,7 +2976,7 @@ catch (e2) {
|
|
|
2866
2976
|
// a dead duplicate attribute and the real viewBox never updates.
|
|
2867
2977
|
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'};
|
|
2868
2978
|
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
2869
|
-
var EVENT_RE =
|
|
2979
|
+
var EVENT_RE = ${S()};
|
|
2870
2980
|
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
2871
2981
|
|
|
2872
2982
|
// Handle attributes
|
|
@@ -2955,7 +3065,7 @@ catch (e2) {
|
|
|
2955
3065
|
el.setAttribute(attrName, String(v));
|
|
2956
3066
|
}
|
|
2957
3067
|
else if (v === false || v === null || v === undefined) {
|
|
2958
|
-
|
|
3068
|
+
stxHost.removeAttribute(el, attrName);
|
|
2959
3069
|
}
|
|
2960
3070
|
else if (v === true) {
|
|
2961
3071
|
el.setAttribute(attrName, '');
|
|
@@ -2966,7 +3076,7 @@ else {
|
|
|
2966
3076
|
try { attrValue = JSON.stringify(v); }
|
|
2967
3077
|
catch (e) { attrValue = String(v); }
|
|
2968
3078
|
}
|
|
2969
|
-
|
|
3079
|
+
stxHost.setAttribute(el, attrName, safeUrlAttr(attrName, attrValue));
|
|
2970
3080
|
}
|
|
2971
3081
|
});
|
|
2972
3082
|
el.removeAttribute(name);
|
|
@@ -2981,7 +3091,7 @@ else if (name === '@style' || name === ':style' || name === 'x-style') {
|
|
|
2981
3091
|
}
|
|
2982
3092
|
else if (name === '@text' || name === ':text' || name === 'x-text') {
|
|
2983
3093
|
effect(() => {
|
|
2984
|
-
el
|
|
3094
|
+
stxHost.setText(el, evalAttrExpr(value));
|
|
2985
3095
|
});
|
|
2986
3096
|
el.removeAttribute(name);
|
|
2987
3097
|
}
|
|
@@ -2997,14 +3107,14 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
2997
3107
|
// A page ref can be projected through a component whose own $refs
|
|
2998
3108
|
// replaced the compatibility scope's map. The compiler retains the
|
|
2999
3109
|
// receiver boundary so named and signal refs use the same caller.
|
|
3000
|
-
var refRoot =
|
|
3110
|
+
var refRoot = stxHost.scopeOf(el);
|
|
3001
3111
|
var refCaller = el.getAttribute('data-stx-ref-caller');
|
|
3002
3112
|
var refOwnerScope = findElementScope(el);
|
|
3003
3113
|
if (refCaller) {
|
|
3004
3114
|
var receiver = refRoot;
|
|
3005
3115
|
while (receiver && receiver.getAttribute('data-stx-scope') !== refCaller
|
|
3006
3116
|
&& receiver.getAttribute('data-stx-template-scope') !== refCaller) {
|
|
3007
|
-
receiver = receiver
|
|
3117
|
+
receiver = stxHost.scopeOf(receiver, true);
|
|
3008
3118
|
}
|
|
3009
3119
|
refOwnerScope = receiver && receiver.__stx_parent_scope;
|
|
3010
3120
|
}
|
|
@@ -3055,7 +3165,7 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
3055
3165
|
? { ...globalHelpers, ...el.__stx_parent_scope }
|
|
3056
3166
|
: { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
|
|
3057
3167
|
|
|
3058
|
-
|
|
3168
|
+
stxHost.listen(el, eventName, (event) => {
|
|
3059
3169
|
// Vue-style component listeners fall through to the rendered native
|
|
3060
3170
|
// root unless the child emits the same event. Signal components use
|
|
3061
3171
|
// a scope wrapper, so native events arrive here from a descendant.
|
|
@@ -3178,7 +3288,7 @@ catch (e) {
|
|
|
3178
3288
|
|
|
3179
3289
|
// Process children (skip script/style elements \u2014 their text content is not template markup)
|
|
3180
3290
|
// Skip elements that are roots of nested stx.mount() components \u2014 those have their own scope
|
|
3181
|
-
if (el.tagName !== 'SCRIPT' && el.tagName !== 'STYLE') {
|
|
3291
|
+
if (!skipChildren && el.tagName !== 'SCRIPT' && el.tagName !== 'STYLE') {
|
|
3182
3292
|
var children = Array.from(el.childNodes);
|
|
3183
3293
|
children.forEach(function(child) {
|
|
3184
3294
|
if (child.nodeType !== Node.ELEMENT_NODE) { processElement(child, scope); return; }
|
|
@@ -3256,8 +3366,6 @@ catch (e) {
|
|
|
3256
3366
|
if (el.__stx_show_bound) return;
|
|
3257
3367
|
el.__stx_show_bound = true;
|
|
3258
3368
|
|
|
3259
|
-
const currentDisplay = el.style.display;
|
|
3260
|
-
const originalDisplay = (currentDisplay && currentDisplay !== 'none') ? currentDisplay : '';
|
|
3261
3369
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3262
3370
|
|
|
3263
3371
|
// Check if the expression is a simple signal reference (most common case for :show)
|
|
@@ -3267,7 +3375,7 @@ catch (e) {
|
|
|
3267
3375
|
effect(() => {
|
|
3268
3376
|
const value = directSignal();
|
|
3269
3377
|
|
|
3270
|
-
el
|
|
3378
|
+
stxHost.setVisible(el, !!value);
|
|
3271
3379
|
});
|
|
3272
3380
|
} else {
|
|
3273
3381
|
// Complex expression path \u2014 use createAutoUnwrapProxy with fallback,
|
|
@@ -3292,16 +3400,15 @@ catch (e) {
|
|
|
3292
3400
|
// or object may not be ready yet on the first effect run, and
|
|
3293
3401
|
// the next pass will re-evaluate once data arrives.
|
|
3294
3402
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Show expression error:', expr, e2);
|
|
3295
|
-
el
|
|
3403
|
+
stxHost.setVisible(el, false);
|
|
3296
3404
|
return;
|
|
3297
3405
|
}
|
|
3298
3406
|
}
|
|
3299
|
-
var
|
|
3300
|
-
el.style.display = value ? originalDisplay : 'none';
|
|
3407
|
+
var wasVisible = stxHost.setVisible(el, !!value);
|
|
3301
3408
|
// When transitioning from hidden to visible, stamp the element so
|
|
3302
3409
|
// @click handlers can ignore clicks from the same frame (prevents
|
|
3303
3410
|
// modal backdrop from catching the click that opened the modal)
|
|
3304
|
-
if (value &&
|
|
3411
|
+
if (value && !wasVisible) {
|
|
3305
3412
|
el.__stx_shown_at = performance.now();
|
|
3306
3413
|
}
|
|
3307
3414
|
});
|
|
@@ -3378,7 +3485,7 @@ catch (e) {
|
|
|
3378
3485
|
};
|
|
3379
3486
|
el.__stx_model_sync = syncCheckbox;
|
|
3380
3487
|
effect(syncCheckbox);
|
|
3381
|
-
|
|
3488
|
+
stxHost.listen(el, 'change', () => {
|
|
3382
3489
|
var current = getValue();
|
|
3383
3490
|
if (!Array.isArray(current)) {
|
|
3384
3491
|
setValue(el.checked);
|
|
@@ -3395,7 +3502,7 @@ catch (e) {
|
|
|
3395
3502
|
var syncRadio = () => { el.checked = String(getValue()) === String(el.value); };
|
|
3396
3503
|
el.__stx_model_sync = syncRadio;
|
|
3397
3504
|
effect(syncRadio);
|
|
3398
|
-
|
|
3505
|
+
stxHost.listen(el, 'change', () => {
|
|
3399
3506
|
if (el.checked) setValue(coerceValue(el.value));
|
|
3400
3507
|
});
|
|
3401
3508
|
}
|
|
@@ -3421,7 +3528,7 @@ catch (e) {
|
|
|
3421
3528
|
el.__stx_model_observer = null;
|
|
3422
3529
|
});
|
|
3423
3530
|
}
|
|
3424
|
-
|
|
3531
|
+
stxHost.listen(el, 'change', () => setValue(coerceValue(el.value)));
|
|
3425
3532
|
}
|
|
3426
3533
|
else {
|
|
3427
3534
|
// Writing el.value moves the text cursor to the END of the control, and
|
|
@@ -3459,7 +3566,7 @@ else {
|
|
|
3459
3566
|
catch (e) { /* type does not support selection */ }
|
|
3460
3567
|
}
|
|
3461
3568
|
});
|
|
3462
|
-
|
|
3569
|
+
stxHost.listen(el, modifiers.includes('lazy') ? 'change' : 'input', () => setValue(coerceValue(el.value)));
|
|
3463
3570
|
}
|
|
3464
3571
|
|
|
3465
3572
|
el.removeAttribute(attrName);
|
|
@@ -3867,7 +3974,7 @@ else if (typeof value === 'string') {
|
|
|
3867
3974
|
return;
|
|
3868
3975
|
}
|
|
3869
3976
|
|
|
3870
|
-
const placeholder =
|
|
3977
|
+
const placeholder = stxHost.anchor('stx-for');
|
|
3871
3978
|
const isTemplate = el.tagName === 'TEMPLATE';
|
|
3872
3979
|
const componentSetupTemplates = [];
|
|
3873
3980
|
if (!isTemplate && el.hasAttribute('data-stx-scope')) {
|
|
@@ -3889,8 +3996,8 @@ else if (typeof value === 'string') {
|
|
|
3889
3996
|
&& setupSibling.hasAttribute('data-stx-scoped')
|
|
3890
3997
|
&& ((setupSibling.textContent || '').indexOf(componentScopeId) !== -1
|
|
3891
3998
|
|| (componentTemplateScopeId && (setupSibling.textContent || '').indexOf(componentTemplateScopeId) !== -1))) {
|
|
3892
|
-
componentSetupTemplates.push(
|
|
3893
|
-
|
|
3999
|
+
componentSetupTemplates.push(stxHost.clone(setupSibling));
|
|
4000
|
+
stxHost.remove(setupSibling);
|
|
3894
4001
|
setupSibling = nextSetupSibling;
|
|
3895
4002
|
continue;
|
|
3896
4003
|
}
|
|
@@ -3913,16 +4020,16 @@ else if (typeof value === 'string') {
|
|
|
3913
4020
|
let sibling = el.nextElementSibling;
|
|
3914
4021
|
while (sibling) {
|
|
3915
4022
|
if (sibling.hasAttribute('@for-loading')) {
|
|
3916
|
-
loadingTemplate =
|
|
4023
|
+
loadingTemplate = stxHost.clone(sibling);
|
|
3917
4024
|
loadingTemplate.removeAttribute('@for-loading');
|
|
3918
|
-
|
|
4025
|
+
stxHost.remove(sibling);
|
|
3919
4026
|
sibling = el.nextElementSibling;
|
|
3920
4027
|
continue;
|
|
3921
4028
|
}
|
|
3922
4029
|
if (sibling.hasAttribute('@for-empty')) {
|
|
3923
|
-
emptyTemplate =
|
|
4030
|
+
emptyTemplate = stxHost.clone(sibling);
|
|
3924
4031
|
emptyTemplate.removeAttribute('@for-empty');
|
|
3925
|
-
|
|
4032
|
+
stxHost.remove(sibling);
|
|
3926
4033
|
sibling = el.nextElementSibling;
|
|
3927
4034
|
continue;
|
|
3928
4035
|
}
|
|
@@ -3932,13 +4039,13 @@ else if (typeof value === 'string') {
|
|
|
3932
4039
|
// Capture the scope NOW before element is removed from DOM
|
|
3933
4040
|
const capturedScope = findElementScope(el) || findElementScope(parent);
|
|
3934
4041
|
|
|
3935
|
-
|
|
4042
|
+
stxHost.insert(parent, placeholder, el);
|
|
3936
4043
|
// Component setup scripts execute while the server-rendered loop source is
|
|
3937
4044
|
// still in the document. That source becomes a template, not a live
|
|
3938
4045
|
// instance, so reclaim all registered scopes before removing it. Every
|
|
3939
4046
|
// rendered iteration receives remapped setup scripts and fresh scopes.
|
|
3940
4047
|
disposeSubtreeScopes(el);
|
|
3941
|
-
|
|
4048
|
+
stxHost.remove(el);
|
|
3942
4049
|
|
|
3943
4050
|
// Capture :key expression BEFORE removing the attribute
|
|
3944
4051
|
const keyExpr = el.getAttribute(':key') || el.getAttribute('x-bind:key');
|
|
@@ -3949,7 +4056,7 @@ else if (typeof value === 'string') {
|
|
|
3949
4056
|
templateContent = el.content;
|
|
3950
4057
|
}
|
|
3951
4058
|
else {
|
|
3952
|
-
const wrapper =
|
|
4059
|
+
const wrapper = stxHost.clone(el);
|
|
3953
4060
|
wrapper.removeAttribute('@for');
|
|
3954
4061
|
wrapper.removeAttribute(':for');
|
|
3955
4062
|
wrapper.removeAttribute('x-for');
|
|
@@ -4002,12 +4109,12 @@ else {
|
|
|
4002
4109
|
const removeGroup = (group) => {
|
|
4003
4110
|
const liveNodes = liveGroupNodes(group);
|
|
4004
4111
|
const liveSet = new Set(liveNodes);
|
|
4005
|
-
liveNodes.forEach(e => { disposeSubtreeEffects(e); disposeSubtreeScopes(e);
|
|
4112
|
+
liveNodes.forEach(e => { disposeSubtreeEffects(e); disposeSubtreeScopes(e); stxHost.remove(e); });
|
|
4006
4113
|
group.forEach(groupNode => {
|
|
4007
4114
|
if (liveSet.has(groupNode)) return;
|
|
4008
4115
|
disposeSubtreeEffects(groupNode);
|
|
4009
4116
|
disposeSubtreeScopes(groupNode);
|
|
4010
|
-
|
|
4117
|
+
stxHost.remove(groupNode);
|
|
4011
4118
|
});
|
|
4012
4119
|
};
|
|
4013
4120
|
|
|
@@ -4070,15 +4177,15 @@ catch (e) {
|
|
|
4070
4177
|
hideLoading();
|
|
4071
4178
|
hideEmpty();
|
|
4072
4179
|
if (loadingTemplate) {
|
|
4073
|
-
loadingElement =
|
|
4074
|
-
|
|
4180
|
+
loadingElement = stxHost.clone(loadingTemplate);
|
|
4181
|
+
stxHost.insert(parent, loadingElement, placeholder);
|
|
4075
4182
|
}
|
|
4076
4183
|
};
|
|
4077
4184
|
|
|
4078
4185
|
// Helper to hide loading state
|
|
4079
4186
|
const hideLoading = () => {
|
|
4080
4187
|
if (loadingElement) {
|
|
4081
|
-
|
|
4188
|
+
stxHost.remove(loadingElement);
|
|
4082
4189
|
loadingElement = null;
|
|
4083
4190
|
}
|
|
4084
4191
|
};
|
|
@@ -4088,8 +4195,8 @@ catch (e) {
|
|
|
4088
4195
|
hideLoading();
|
|
4089
4196
|
hideEmpty();
|
|
4090
4197
|
if (emptyTemplate) {
|
|
4091
|
-
emptyElement =
|
|
4092
|
-
|
|
4198
|
+
emptyElement = stxHost.clone(emptyTemplate);
|
|
4199
|
+
stxHost.insert(parent, emptyElement, placeholder);
|
|
4093
4200
|
const shownEmpty = emptyElement;
|
|
4094
4201
|
shownEmpty.__stx_effect_disposers = trackEffects(function() { processElement(shownEmpty); });
|
|
4095
4202
|
}
|
|
@@ -4100,7 +4207,7 @@ catch (e) {
|
|
|
4100
4207
|
if (emptyElement) {
|
|
4101
4208
|
// A string @empty renders a text node, which has no subtree to dispose.
|
|
4102
4209
|
if (emptyElement.nodeType === 1) disposeSubtreeEffects(emptyElement);
|
|
4103
|
-
|
|
4210
|
+
stxHost.remove(emptyElement);
|
|
4104
4211
|
emptyElement = null;
|
|
4105
4212
|
}
|
|
4106
4213
|
};
|
|
@@ -4122,9 +4229,9 @@ catch (e) {
|
|
|
4122
4229
|
|
|
4123
4230
|
const elements = [];
|
|
4124
4231
|
if (isTemplate) {
|
|
4125
|
-
elements.push(
|
|
4232
|
+
elements.push(stxHost.anchor('stx-for-item-start'));
|
|
4126
4233
|
Array.from(templateContent.childNodes).forEach(node => {
|
|
4127
|
-
const clone =
|
|
4234
|
+
const clone = stxHost.clone(node);
|
|
4128
4235
|
if (clone.nodeType === 1) {
|
|
4129
4236
|
// Structural directives need a live parent. Keep the iteration
|
|
4130
4237
|
// scope on the clone until the keyed diff inserts it, then bind.
|
|
@@ -4132,13 +4239,13 @@ catch (e) {
|
|
|
4132
4239
|
}
|
|
4133
4240
|
elements.push(clone);
|
|
4134
4241
|
});
|
|
4135
|
-
elements.push(
|
|
4242
|
+
elements.push(stxHost.anchor('stx-for-item-end'));
|
|
4136
4243
|
} else {
|
|
4137
|
-
const clone =
|
|
4244
|
+
const clone = stxHost.clone(templateContent);
|
|
4138
4245
|
clone.__stx_for_scope = itemScope;
|
|
4139
4246
|
elements.push(clone);
|
|
4140
4247
|
componentSetupTemplates.forEach(function(setupTemplate) {
|
|
4141
|
-
elements.push(
|
|
4248
|
+
elements.push(stxHost.clone(setupTemplate));
|
|
4142
4249
|
});
|
|
4143
4250
|
}
|
|
4144
4251
|
remapForComponentScopes(elements);
|
|
@@ -4264,7 +4371,7 @@ catch (e) {
|
|
|
4264
4371
|
hideEmpty();
|
|
4265
4372
|
if (emptyContent && typeof emptyContent === 'string') {
|
|
4266
4373
|
emptyElement = document.createTextNode(emptyContent);
|
|
4267
|
-
|
|
4374
|
+
stxHost.insert(parent, emptyElement, placeholder);
|
|
4268
4375
|
}
|
|
4269
4376
|
} else if (emptyTemplate) {
|
|
4270
4377
|
showEmpty();
|
|
@@ -4358,7 +4465,7 @@ catch (e) {
|
|
|
4358
4465
|
// Moves without detaching. The cursor does not advance: this node
|
|
4359
4466
|
// is now behind it, and the cursor still marks the next position
|
|
4360
4467
|
// to fill.
|
|
4361
|
-
|
|
4468
|
+
stxHost.insert(parent, groupNode, cursor || placeholder);
|
|
4362
4469
|
}
|
|
4363
4470
|
}
|
|
4364
4471
|
newElements.push(...group);
|
|
@@ -4378,7 +4485,7 @@ catch (e) {
|
|
|
4378
4485
|
// Before the cursor, not before the placeholder: a new row inserted
|
|
4379
4486
|
// in the MIDDLE of the list must land at its own position, without
|
|
4380
4487
|
// forcing every row after it to be moved to get back in order.
|
|
4381
|
-
|
|
4488
|
+
stxHost.insert(parent, el, cursor || placeholder);
|
|
4382
4489
|
if (tgReady && el.isConnected) tgEnter(el, tgName);
|
|
4383
4490
|
});
|
|
4384
4491
|
hydrateComponentScopes(elements, elements.find(function(node) {
|
|
@@ -4422,13 +4529,13 @@ catch (e) {
|
|
|
4422
4529
|
disposeSubtreeEffects(el);
|
|
4423
4530
|
disposeSubtreeScopes(el);
|
|
4424
4531
|
if (tgLeave(el, tgName)) transitioned.add(el);
|
|
4425
|
-
else
|
|
4532
|
+
else stxHost.remove(el);
|
|
4426
4533
|
});
|
|
4427
4534
|
group.forEach((el) => {
|
|
4428
4535
|
if (transitioned.has(el) || liveNodes.includes(el)) return;
|
|
4429
4536
|
disposeSubtreeEffects(el);
|
|
4430
4537
|
disposeSubtreeScopes(el);
|
|
4431
|
-
|
|
4538
|
+
stxHost.remove(el);
|
|
4432
4539
|
});
|
|
4433
4540
|
}
|
|
4434
4541
|
else {
|
|
@@ -4518,8 +4625,8 @@ catch (e) {
|
|
|
4518
4625
|
b.el.__stx_chain_member = true;
|
|
4519
4626
|
b.el.__stx_chain_active = false;
|
|
4520
4627
|
b.capturedElementScope = findElementScope(b.el);
|
|
4521
|
-
b.placeholder =
|
|
4522
|
-
|
|
4628
|
+
b.placeholder = stxHost.anchor('stx-if-chain');
|
|
4629
|
+
stxHost.insert(parent, b.placeholder, b.el);
|
|
4523
4630
|
b.el.removeAttribute(b.attr);
|
|
4524
4631
|
// A <template> branch (the wrapper convertSignalDirectivesToAttributes
|
|
4525
4632
|
// emits for a multi-child / text branch) is INERT \u2014 inserting the element
|
|
@@ -4548,10 +4655,10 @@ catch (e) {
|
|
|
4548
4655
|
// and the attributes it consumed (x-model, :id) do not come back -- so a
|
|
4549
4656
|
// second clone taken from the element would arrive already stripped, with
|
|
4550
4657
|
// no binding and no way to acquire one.
|
|
4551
|
-
b.pristine = b.isTemplate ? b.el.content
|
|
4658
|
+
b.pristine = b.isTemplate ? stxHost.clone(b.el.content) : null;
|
|
4552
4659
|
b.nodes = b.isTemplate ? [] : [b.el];
|
|
4553
4660
|
b.endMarker = null;
|
|
4554
|
-
b.el
|
|
4661
|
+
stxHost.remove(b.el);
|
|
4555
4662
|
b.childrenProcessed = false;
|
|
4556
4663
|
});
|
|
4557
4664
|
|
|
@@ -4615,7 +4722,7 @@ catch (e2) {
|
|
|
4615
4722
|
console.log('[stx] bindIfChain pick:', pickedIdx, 'of', chain.length, '(', pickedIdx >= 0 ? chain[pickedIdx].attr : 'none', ') prev:', currentIdx);
|
|
4616
4723
|
if (__stxDevtoolsTracking) {
|
|
4617
4724
|
var __ifScope = null;
|
|
4618
|
-
try { __ifScope = (head
|
|
4725
|
+
try { __ifScope = stxHost.scopeOf(head); } catch (e) { __ifScope = null; }
|
|
4619
4726
|
__stxDevtoolsRecordIf({
|
|
4620
4727
|
scopeId: __ifScope ? __ifScope.getAttribute('data-stx-scope') : null,
|
|
4621
4728
|
branches: chain.map(function(c) { return c.attr; }),
|
|
@@ -4643,21 +4750,20 @@ catch (e2) {
|
|
|
4643
4750
|
// contains. The marker bounds the range, so a sibling that belongs to
|
|
4644
4751
|
// a later branch or to ordinary markup is never touched.
|
|
4645
4752
|
if (gone.endMarker && gone.endMarker.parentNode) {
|
|
4646
|
-
var host = gone.endMarker.parentNode;
|
|
4647
4753
|
var doomed = gone.placeholder.nextSibling;
|
|
4648
4754
|
while (doomed && doomed !== gone.endMarker) {
|
|
4649
4755
|
var nextDoomed = doomed.nextSibling;
|
|
4650
4756
|
disposeSubtreeEffects(doomed);
|
|
4651
|
-
|
|
4757
|
+
stxHost.remove(doomed);
|
|
4652
4758
|
doomed = nextDoomed;
|
|
4653
4759
|
}
|
|
4654
|
-
gone.endMarker
|
|
4760
|
+
stxHost.remove(gone.endMarker);
|
|
4655
4761
|
gone.endMarker = null;
|
|
4656
4762
|
}
|
|
4657
4763
|
gone.nodes.forEach(function (n) {
|
|
4658
4764
|
if (!n.parentNode) return;
|
|
4659
4765
|
disposeSubtreeEffects(n);
|
|
4660
|
-
|
|
4766
|
+
stxHost.remove(n);
|
|
4661
4767
|
});
|
|
4662
4768
|
// The next show clones afresh and processes again, so these effects
|
|
4663
4769
|
// are finished with; leaving them bound only accumulates work (#1954).
|
|
@@ -4675,10 +4781,10 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4675
4781
|
// Detached nodes are out of reach of a DOM walk, so a row removed
|
|
4676
4782
|
// while this branch is hidden could not dispose the effects it was
|
|
4677
4783
|
// processed with (#1954). Same registry the single-element :if uses.
|
|
4678
|
-
var
|
|
4679
|
-
if (!
|
|
4680
|
-
|
|
4681
|
-
|
|
4784
|
+
var parentEl = n.parentNode;
|
|
4785
|
+
if (!parentEl.__stx_detached_if) parentEl.__stx_detached_if = new Set();
|
|
4786
|
+
parentEl.__stx_detached_if.add(n);
|
|
4787
|
+
stxHost.remove(n);
|
|
4682
4788
|
});
|
|
4683
4789
|
}
|
|
4684
4790
|
}
|
|
@@ -4692,16 +4798,16 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4692
4798
|
var anchor = pick.placeholder.nextSibling;
|
|
4693
4799
|
var pickHost = pick.placeholder.parentNode;
|
|
4694
4800
|
if (pick.isTemplate && pick.nodes.length === 0)
|
|
4695
|
-
pick.nodes = Array.prototype.slice.call(pick.pristine
|
|
4801
|
+
pick.nodes = Array.prototype.slice.call(stxHost.clone(pick.pristine).childNodes);
|
|
4696
4802
|
pick.nodes.forEach(function (n) {
|
|
4697
4803
|
if (pickHost.__stx_detached_if) pickHost.__stx_detached_if.delete(n);
|
|
4698
|
-
|
|
4804
|
+
stxHost.insert(pickHost, n, anchor);
|
|
4699
4805
|
});
|
|
4700
4806
|
// Bound AFTER the clones, so hiding can remove whatever a structural
|
|
4701
4807
|
// directive inside the branch renders as their sibling.
|
|
4702
4808
|
if (pick.isTemplate) {
|
|
4703
|
-
if (!pick.endMarker) pick.endMarker =
|
|
4704
|
-
|
|
4809
|
+
if (!pick.endMarker) pick.endMarker = stxHost.anchor('stx-if-chain-end');
|
|
4810
|
+
stxHost.insert(pickHost, pick.endMarker, anchor);
|
|
4705
4811
|
}
|
|
4706
4812
|
pick.el.__stx_shown_at = performance.now();
|
|
4707
4813
|
if (!pick.childrenProcessed) {
|
|
@@ -4764,7 +4870,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4764
4870
|
return;
|
|
4765
4871
|
}
|
|
4766
4872
|
|
|
4767
|
-
const placeholder =
|
|
4873
|
+
const placeholder = stxHost.anchor('stx-if');
|
|
4768
4874
|
// Marks where this branch's rendered content ENDS (stacksjs/stx#1955).
|
|
4769
4875
|
// Hiding used to remove only the cloned nodes, but a structural directive
|
|
4770
4876
|
// directly inside the template renders its own output as siblings that are
|
|
@@ -4786,27 +4892,27 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4786
4892
|
const capturedComponentScope = { ...passedScope };
|
|
4787
4893
|
|
|
4788
4894
|
preserveConditionalComponentScopes(el, capturedComponentScope);
|
|
4789
|
-
|
|
4895
|
+
stxHost.insert(parent, placeholder, el);
|
|
4790
4896
|
el.removeAttribute(attrName);
|
|
4791
4897
|
|
|
4792
4898
|
if (isTemplate) {
|
|
4793
4899
|
// For templates, we need to handle the content fragment
|
|
4794
4900
|
const content = el.content;
|
|
4795
|
-
currentNodes = Array.from(content.childNodes).map(n =>
|
|
4901
|
+
currentNodes = Array.from(content.childNodes).map(n => stxHost.clone(n));
|
|
4796
4902
|
// Insert cloned content initially
|
|
4797
4903
|
// Capture the anchor once. Re-reading placeholder.nextSibling after
|
|
4798
4904
|
// every insertion points at the node just inserted and reverses a
|
|
4799
4905
|
// multi-root template branch.
|
|
4800
4906
|
const initialAnchor = placeholder.nextSibling;
|
|
4801
|
-
currentNodes.forEach(node =>
|
|
4907
|
+
currentNodes.forEach(node => stxHost.insert(parent, node, initialAnchor));
|
|
4802
4908
|
// The end of this branch's range, bound at the same time as the content
|
|
4803
4909
|
// it closes (#1955). Needed here too, not only on re-show: the first
|
|
4804
4910
|
// hide of a branch that was never toggled removes THIS content, and a
|
|
4805
4911
|
// nested :for renders rows that are siblings of these clones rather than
|
|
4806
4912
|
// among them.
|
|
4807
|
-
endMarker =
|
|
4808
|
-
|
|
4809
|
-
|
|
4913
|
+
endMarker = stxHost.anchor('stx-if-end');
|
|
4914
|
+
stxHost.insert(parent, endMarker, initialAnchor);
|
|
4915
|
+
stxHost.remove(el); // Remove the template element itself
|
|
4810
4916
|
}
|
|
4811
4917
|
|
|
4812
4918
|
// Helper to evaluate with captured scope (auto-unwraps signals).
|
|
@@ -4896,13 +5002,13 @@ catch (e2) {
|
|
|
4896
5002
|
if (isTemplate) {
|
|
4897
5003
|
if (value && !isInserted) {
|
|
4898
5004
|
// Re-insert cloned content
|
|
4899
|
-
currentNodes = Array.from(el.content.childNodes).map(n =>
|
|
5005
|
+
currentNodes = Array.from(el.content.childNodes).map(n => stxHost.clone(n));
|
|
4900
5006
|
const insertionAnchor = placeholder.nextSibling;
|
|
4901
|
-
currentNodes.forEach(node =>
|
|
5007
|
+
currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));
|
|
4902
5008
|
// Bound AFTER the clones, so hiding can remove whatever a nested
|
|
4903
5009
|
// structural directive rendered as their sibling (#1955).
|
|
4904
|
-
if (!endMarker) endMarker =
|
|
4905
|
-
|
|
5010
|
+
if (!endMarker) endMarker = stxHost.anchor('stx-if-end');
|
|
5011
|
+
stxHost.insert(parent, endMarker, insertionAnchor);
|
|
4906
5012
|
processTemplateNodes(currentNodes);
|
|
4907
5013
|
childrenProcessed = true;
|
|
4908
5014
|
// Stamp insertion time for click propagation guard
|
|
@@ -4928,12 +5034,12 @@ else if (!value && isInserted) {
|
|
|
4928
5034
|
while (doomed && doomed !== endMarker) {
|
|
4929
5035
|
var nextDoomed = doomed.nextSibling;
|
|
4930
5036
|
disposeSubtreeEffects(doomed);
|
|
4931
|
-
|
|
5037
|
+
stxHost.remove(doomed);
|
|
4932
5038
|
doomed = nextDoomed;
|
|
4933
5039
|
}
|
|
4934
|
-
|
|
5040
|
+
stxHost.remove(endMarker);
|
|
4935
5041
|
}
|
|
4936
|
-
currentNodes.forEach(node => { disposeSubtreeEffects(node);
|
|
5042
|
+
currentNodes.forEach(node => { disposeSubtreeEffects(node); stxHost.remove(node); });
|
|
4937
5043
|
currentNodes = [];
|
|
4938
5044
|
isInserted = false;
|
|
4939
5045
|
childrenProcessed = false;
|
|
@@ -4954,7 +5060,7 @@ else {
|
|
|
4954
5060
|
if (value && !isInserted) {
|
|
4955
5061
|
console.log('[stx] bindIf INSERTING element for :if=' + expr);
|
|
4956
5062
|
const insertionAnchor = placeholder.nextSibling;
|
|
4957
|
-
currentNodes.forEach(node =>
|
|
5063
|
+
currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));
|
|
4958
5064
|
if (parent && parent.__stx_detached_if) currentNodes.forEach(node => parent.__stx_detached_if.delete(node));
|
|
4959
5065
|
el.__stx_shown_at = performance.now();
|
|
4960
5066
|
isInserted = true;
|
|
@@ -4970,7 +5076,7 @@ else if (!value && isInserted) {
|
|
|
4970
5076
|
// once (#1737). Permanent disposal stays in bindFor (item removal)
|
|
4971
5077
|
// and cleanupContainer (SPA navigation). The double-bind guards make
|
|
4972
5078
|
// re-show idempotent, so toggling doesn't leak.
|
|
4973
|
-
currentNodes.forEach(node =>
|
|
5079
|
+
currentNodes.forEach(node => stxHost.remove(node));
|
|
4974
5080
|
// Detached nodes are out of reach of a DOM walk, so an ancestor row or
|
|
4975
5081
|
// branch removed while this is hidden could not dispose their effects
|
|
4976
5082
|
// (#1954). Record them on the parent that keeps the placeholder.
|
|
@@ -5911,7 +6017,7 @@ catch (e) {} }
|
|
|
5911
6017
|
return normalizedPrefix + '-' + __stxGeneratedIdCounter;
|
|
5912
6018
|
}
|
|
5913
6019
|
|
|
5914
|
-
var createModelSignal = ${
|
|
6020
|
+
var createModelSignal = ${E.toString()};
|
|
5915
6021
|
function useModel(name, options) {
|
|
5916
6022
|
if (typeof name !== 'string') { options = name || {}; name = 'modelValue'; }
|
|
5917
6023
|
options = options || {};
|
|
@@ -7856,7 +7962,10 @@ else {
|
|
|
7856
7962
|
// Bind page roots after child components have registered their local scope.
|
|
7857
7963
|
document.querySelectorAll('[data-stx]').forEach(el => {
|
|
7858
7964
|
console.log('[DOMContentLoaded] processElement on:', el.tagName, 'scope keys:', Object.keys(componentScope).slice(0, 10));
|
|
7859
|
-
var disposeEffects = trackEffects(function() {
|
|
7965
|
+
var disposeEffects = trackEffects(function() {
|
|
7966
|
+
// The server's list when the page shipped one, the walk otherwise.
|
|
7967
|
+
if (!processFromManifest(el, componentScope, window.__stx_bindings)) processElement(el);
|
|
7968
|
+
});
|
|
7860
7969
|
el.__stx_disposers = disposeEffects;
|
|
7861
7970
|
|
|
7862
7971
|
// Remove x-cloak after bindings are applied (prevents FOUC)
|
|
@@ -8623,5 +8732,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
8623
8732
|
}
|
|
8624
8733
|
}
|
|
8625
8734
|
})();
|
|
8626
|
-
`}var
|
|
8627
|
-
export{
|
|
8735
|
+
`}var _z={state:B,derived:F,effect:H,batch:O,onMount:I,onDestroy:M,isSignal:P,isDerived:T,untrack:x,peek:C,generateSignalsRuntime:f,generateSignalsRuntimeDev:b};
|
|
8736
|
+
export{g as _i,v as $i,m as aj,U as bj,y as cj,h as dj,p as ej,u as fj,l as gj,d as hj,i as ij,c as jj,o as kj,r as lj,D as mj,f as nj,b as oj,_z as pj};
|