@stacksjs/stx 0.2.82 → 0.2.84

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.
Files changed (62) hide show
  1. package/dist/app-shell.js +21 -11
  2. package/dist/build-assets.js +19 -9
  3. package/dist/build-mode-detector.js +22 -12
  4. package/dist/build-views.js +22 -12
  5. package/dist/build.js +21 -11
  6. package/dist/caching.js +19 -9
  7. package/dist/cli.js +22 -12
  8. package/dist/component-processing.js +21 -11
  9. package/dist/component-renderer.js +21 -11
  10. package/dist/components.js +22 -12
  11. package/dist/conditionals.js +1 -1
  12. package/dist/custom-directives.js +1 -1
  13. package/dist/dev-server/index.js +22 -12
  14. package/dist/dev-server/serve-app.js +21 -11
  15. package/dist/dev-server/serve-file.js +21 -11
  16. package/dist/dev-server/serve-markdown.js +22 -12
  17. package/dist/dev-server/serve-multi.js +21 -11
  18. package/dist/dev-server.js +21 -11
  19. package/dist/docs.js +22 -12
  20. package/dist/dynamic-components.js +21 -11
  21. package/dist/error-handling.js +1 -1
  22. package/dist/errors/formatter.js +1 -1
  23. package/dist/errors/index.js +1 -1
  24. package/dist/i18n.js +1 -1
  25. package/dist/includes.js +21 -11
  26. package/dist/index.js +21 -11
  27. package/dist/interactive.js +22 -12
  28. package/dist/lazy-loader.js +98 -88
  29. package/dist/misc-directives.js +1 -1
  30. package/dist/plugin.js +21 -11
  31. package/dist/process.js +21 -11
  32. package/dist/production-builder.js +21 -11
  33. package/dist/production-server.js +21 -11
  34. package/dist/pwa/index.js +22 -12
  35. package/dist/pwa/offline.js +22 -12
  36. package/dist/pwa.js +21 -11
  37. package/dist/reactive.js +1 -1
  38. package/dist/render.js +22 -12
  39. package/dist/runtime-injection.js +19 -9
  40. package/dist/seo.js +1 -1
  41. package/dist/serve.js +22 -12
  42. package/dist/signal-processing.js +41 -31
  43. package/dist/signals.js +19 -9
  44. package/dist/site-builder/build.js +22 -12
  45. package/dist/site-builder/index.js +22 -12
  46. package/dist/ssg.js +21 -11
  47. package/dist/ssr.js +22 -12
  48. package/dist/store-loader.js +18 -18
  49. package/dist/story/cli.js +22 -12
  50. package/dist/story/commands/dev.js +22 -12
  51. package/dist/story/commands/index.js +22 -12
  52. package/dist/story/index.js +22 -12
  53. package/dist/story/renderer.js +22 -12
  54. package/dist/story/server.js +22 -12
  55. package/dist/story/visual-testing.js +22 -12
  56. package/dist/streaming.js +21 -11
  57. package/dist/template-compiler.js +22 -12
  58. package/dist/template-hydrator.js +22 -12
  59. package/dist/testing.js +147 -137
  60. package/dist/utils.js +21 -11
  61. package/dist/web-components.js +22 -12
  62. package/package.json +5 -5
package/dist/signals.js CHANGED
@@ -1703,6 +1703,13 @@ catch (e2) {
1703
1703
 
1704
1704
  // Known directive names to exclude from generic :attr binding
1705
1705
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
1706
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
1707
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
1708
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
1709
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
1710
+ // a dead duplicate attribute and the real viewBox never updates.
1711
+ 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'};
1712
+ var SVG_NS = 'http://www.w3.org/2000/svg';
1706
1713
  var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
1707
1714
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
1708
1715
 
@@ -1727,7 +1734,8 @@ catch (e2) {
1727
1734
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
1728
1735
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
1729
1736
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
1730
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
1737
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
1738
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
1731
1739
  effect(() => {
1732
1740
  const v = evalAttrExpr(value);
1733
1741
  if (v === false || v === null || v === undefined) {
@@ -2106,10 +2114,12 @@ else {
2106
2114
  });
2107
2115
  }
2108
2116
  else if (Array.isArray(value)) {
2109
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
2117
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
2118
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
2110
2119
  }
2111
2120
  else {
2112
- el.className = originalClasses + (value ? ' ' + value : '');
2121
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
2122
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
2113
2123
  }
2114
2124
  });
2115
2125
  }
@@ -4433,10 +4443,10 @@ else {
4433
4443
  var root = scriptEl ? scriptEl.nextElementSibling : null;
4434
4444
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
4435
4445
 
4436
- // SPA fallback: during router navigation, script is appended to <body>
4446
+ // SPA fallback: during router navigation, script is appended to body>
4437
4447
  // (not inside the content container), so nextElementSibling won't find the page content.
4438
4448
  // Only use fallback when we genuinely couldn't find a suitable root element.
4439
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
4449
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
4440
4450
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
4441
4451
  var needsFallback = !root || root === document.body
4442
4452
  || (root && root.tagName === 'SCRIPT');
@@ -4755,7 +4765,7 @@ else {
4755
4765
  mountCallbacks.forEach(fn => fn());
4756
4766
  });
4757
4767
 
4758
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
4768
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
4759
4769
  // top-level element with data-stx (signal-processing.ts marks one element),
4760
4770
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
4761
4771
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -4852,7 +4862,7 @@ else {
4852
4862
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
4853
4863
  });
4854
4864
 
4855
- // Process <head> elements (title, meta) that may contain {{ }} expressions
4865
+ // Process head> elements (title, meta) that may contain {{ }} expressions
4856
4866
  // Use componentScope which now contains variables from processed components
4857
4867
  const headElements = document.querySelectorAll('head title, head meta[content]');
4858
4868
  headElements.forEach(el => {
@@ -5048,7 +5058,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
5048
5058
 
5049
5059
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
5050
5060
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
5051
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
5061
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
5052
5062
  var usedLatestSetup = false;
5053
5063
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
5054
5064
  try {
@@ -5132,7 +5142,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
5132
5142
 
5133
5143
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
5134
5144
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
5135
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
5145
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
5136
5146
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
5137
5147
  if (!container.__stx_scope) {
5138
5148
  // Dispose previous effects on the container (from prior navigation)
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)z.push(`
1783
1783
  ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function _q($,Z,Y){let X=$.split(`
1784
1784
  `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${X[K]}`)}return G.join(`
1785
1785
  `)}function Bq($,Z,Y){let X=$.split(`
1786
- `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;z.push(`${B}${W}\x1B[0m | ${j}`)}return z.join(`
1786
+ `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;z.push(`${B}\x1B[90m${W}\x1B[0m | ${j}`)}return z.join(`
1787
1787
  `)}function OY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function LY($,Z){let X=$.substring(0,Z).split(`
1788
1788
  `);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return G3({type:$,message:Z,code:Y,format:"html"}).formatted}function jq($,Z,Y,X,J){return G3({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function Hq($,Z,Y){let X=Y.template.split(`
1789
1789
  `),J=LY(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
@@ -3756,7 +3756,7 @@ window.__stx_reactive = (function() {
3756
3756
 
3757
3757
  return { initScope: initScope, reactive: reactive };
3758
3758
  })();
3759
- `}function $X($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return JSON.stringify(Q)}catch{return X}}),Y}function Rz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=$X(X.stateExpr,Z),G=X.initExpr?$X(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
3759
+ `}function $X($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return X}}),Y}function Rz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=$X(X.stateExpr,Z),G=X.initExpr?$X(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
3760
3760
  (function() {
3761
3761
  var scopeEl = document.querySelector('${X.selector}');
3762
3762
  if (!scopeEl) return;
@@ -5996,6 +5996,13 @@ catch (e2) {
5996
5996
 
5997
5997
  // Known directive names to exclude from generic :attr binding
5998
5998
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
5999
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
6000
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
6001
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
6002
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
6003
+ // a dead duplicate attribute and the real viewBox never updates.
6004
+ 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'};
6005
+ var SVG_NS = 'http://www.w3.org/2000/svg';
5999
6006
  var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
6000
6007
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
6001
6008
 
@@ -6020,7 +6027,8 @@ catch (e2) {
6020
6027
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6021
6028
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6022
6029
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
6023
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6030
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6031
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
6024
6032
  effect(() => {
6025
6033
  const v = evalAttrExpr(value);
6026
6034
  if (v === false || v === null || v === undefined) {
@@ -6399,10 +6407,12 @@ else {
6399
6407
  });
6400
6408
  }
6401
6409
  else if (Array.isArray(value)) {
6402
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
6410
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
6411
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
6403
6412
  }
6404
6413
  else {
6405
- el.className = originalClasses + (value ? ' ' + value : '');
6414
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
6415
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
6406
6416
  }
6407
6417
  });
6408
6418
  }
@@ -8726,10 +8736,10 @@ else {
8726
8736
  var root = scriptEl ? scriptEl.nextElementSibling : null;
8727
8737
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
8728
8738
 
8729
- // SPA fallback: during router navigation, script is appended to <body>
8739
+ // SPA fallback: during router navigation, script is appended to body>
8730
8740
  // (not inside the content container), so nextElementSibling won't find the page content.
8731
8741
  // Only use fallback when we genuinely couldn't find a suitable root element.
8732
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
8742
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
8733
8743
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
8734
8744
  var needsFallback = !root || root === document.body
8735
8745
  || (root && root.tagName === 'SCRIPT');
@@ -9048,7 +9058,7 @@ else {
9048
9058
  mountCallbacks.forEach(fn => fn());
9049
9059
  });
9050
9060
 
9051
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
9061
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
9052
9062
  // top-level element with data-stx (signal-processing.ts marks one element),
9053
9063
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
9054
9064
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -9145,7 +9155,7 @@ else {
9145
9155
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
9146
9156
  });
9147
9157
 
9148
- // Process <head> elements (title, meta) that may contain {{ }} expressions
9158
+ // Process head> elements (title, meta) that may contain {{ }} expressions
9149
9159
  // Use componentScope which now contains variables from processed components
9150
9160
  const headElements = document.querySelectorAll('head title, head meta[content]');
9151
9161
  headElements.forEach(el => {
@@ -9341,7 +9351,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9341
9351
 
9342
9352
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
9343
9353
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
9344
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
9354
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
9345
9355
  var usedLatestSetup = false;
9346
9356
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
9347
9357
  try {
@@ -9425,7 +9435,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9425
9435
 
9426
9436
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
9427
9437
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
9428
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
9438
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
9429
9439
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
9430
9440
  if (!container.__stx_scope) {
9431
9441
  // Dispose previous effects on the container (from prior navigation)
@@ -9535,7 +9545,7 @@ ${_}${U}
9535
9545
  return { ${W} };
9536
9546
  }
9537
9547
  if(window.stx)window.stx._latestSetup=${G};
9538
- </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"];j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(L,F,O)=>{if(H.includes(F.toLowerCase()))return L;return`<${F}${O} data-stx="${G}">`})}return{output:j,setupCode:B}}function D9($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9548
+ </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function D9($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9539
9549
  `)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9540
9550
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){W(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&z()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function $8($,Z,Y,X){if(!i4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await I9(J,Y,X);if(J=Q,J=await F9(J,Z),J=L9(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
9541
9551
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)z.push(`
1783
1783
  ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function jq($,Z,Y){let X=$.split(`
1784
1784
  `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${X[K]}`)}return G.join(`
1785
1785
  `)}function Hq($,Z,Y){let X=$.split(`
1786
- `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;z.push(`${B}${W}\x1B[0m | ${j}`)}return z.join(`
1786
+ `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;z.push(`${B}\x1B[90m${W}\x1B[0m | ${j}`)}return z.join(`
1787
1787
  `)}function IY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function DY($,Z){let X=$.substring(0,Z).split(`
1788
1788
  `);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return G3({type:$,message:Z,code:Y,format:"html"}).formatted}function Oq($,Z,Y,X,J){return G3({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function Lq($,Z,Y){let X=Y.template.split(`
1789
1789
  `),J=DY(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
@@ -3756,7 +3756,7 @@ window.__stx_reactive = (function() {
3756
3756
 
3757
3757
  return { initScope: initScope, reactive: reactive };
3758
3758
  })();
3759
- `}function UX($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return JSON.stringify(Q)}catch{return X}}),Y}function Mz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=UX(X.stateExpr,Z),G=X.initExpr?UX(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
3759
+ `}function UX($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return X}}),Y}function Mz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=UX(X.stateExpr,Z),G=X.initExpr?UX(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
3760
3760
  (function() {
3761
3761
  var scopeEl = document.querySelector('${X.selector}');
3762
3762
  if (!scopeEl) return;
@@ -5996,6 +5996,13 @@ catch (e2) {
5996
5996
 
5997
5997
  // Known directive names to exclude from generic :attr binding
5998
5998
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
5999
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
6000
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
6001
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
6002
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
6003
+ // a dead duplicate attribute and the real viewBox never updates.
6004
+ 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'};
6005
+ var SVG_NS = 'http://www.w3.org/2000/svg';
5999
6006
  var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
6000
6007
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
6001
6008
 
@@ -6020,7 +6027,8 @@ catch (e2) {
6020
6027
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6021
6028
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6022
6029
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
6023
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6030
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6031
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
6024
6032
  effect(() => {
6025
6033
  const v = evalAttrExpr(value);
6026
6034
  if (v === false || v === null || v === undefined) {
@@ -6399,10 +6407,12 @@ else {
6399
6407
  });
6400
6408
  }
6401
6409
  else if (Array.isArray(value)) {
6402
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
6410
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
6411
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
6403
6412
  }
6404
6413
  else {
6405
- el.className = originalClasses + (value ? ' ' + value : '');
6414
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
6415
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
6406
6416
  }
6407
6417
  });
6408
6418
  }
@@ -8726,10 +8736,10 @@ else {
8726
8736
  var root = scriptEl ? scriptEl.nextElementSibling : null;
8727
8737
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
8728
8738
 
8729
- // SPA fallback: during router navigation, script is appended to <body>
8739
+ // SPA fallback: during router navigation, script is appended to body>
8730
8740
  // (not inside the content container), so nextElementSibling won't find the page content.
8731
8741
  // Only use fallback when we genuinely couldn't find a suitable root element.
8732
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
8742
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
8733
8743
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
8734
8744
  var needsFallback = !root || root === document.body
8735
8745
  || (root && root.tagName === 'SCRIPT');
@@ -9048,7 +9058,7 @@ else {
9048
9058
  mountCallbacks.forEach(fn => fn());
9049
9059
  });
9050
9060
 
9051
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
9061
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
9052
9062
  // top-level element with data-stx (signal-processing.ts marks one element),
9053
9063
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
9054
9064
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -9145,7 +9155,7 @@ else {
9145
9155
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
9146
9156
  });
9147
9157
 
9148
- // Process <head> elements (title, meta) that may contain {{ }} expressions
9158
+ // Process head> elements (title, meta) that may contain {{ }} expressions
9149
9159
  // Use componentScope which now contains variables from processed components
9150
9160
  const headElements = document.querySelectorAll('head title, head meta[content]');
9151
9161
  headElements.forEach(el => {
@@ -9341,7 +9351,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9341
9351
 
9342
9352
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
9343
9353
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
9344
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
9354
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
9345
9355
  var usedLatestSetup = false;
9346
9356
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
9347
9357
  try {
@@ -9425,7 +9435,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9425
9435
 
9426
9436
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
9427
9437
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
9428
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
9438
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
9429
9439
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
9430
9440
  if (!container.__stx_scope) {
9431
9441
  // Dispose previous effects on the container (from prior navigation)
@@ -9535,7 +9545,7 @@ ${_}${U}
9535
9545
  return { ${W} };
9536
9546
  }
9537
9547
  if(window.stx)window.stx._latestSetup=${G};
9538
- </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"];j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(L,F,O)=>{if(H.includes(F.toLowerCase()))return L;return`<${F}${O} data-stx="${G}">`})}return{output:j,setupCode:B}}function f9($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9548
+ </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function f9($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9539
9549
  `)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9540
9550
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){W(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&z()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function $6($,Z,Y,X){if(!i4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await x9(J,Y,X);if(J=Q,J=await E9(J,Z),J=D9(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
9541
9551
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
package/dist/ssg.js CHANGED
@@ -2498,7 +2498,7 @@ window.__stx_reactive = (function() {
2498
2498
 
2499
2499
  return { initScope: initScope, reactive: reactive };
2500
2500
  })();
2501
- `}function $Z($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;return String(X)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;return JSON.stringify(X)}catch{return J}}),Y}function gK($,Z){if($.length===0)return"";let Y=$.map((J)=>{let Q=JSON.stringify(Object.fromEntries(J.refs)),X=$Z(J.stateExpr,Z),G=J.initExpr?$Z(J.initExpr,Z):null,K=JSON.stringify(X),q=G?JSON.stringify(G):"null";return`
2501
+ `}function $Z($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;return String(X)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}catch{return J}}),Y}function gK($,Z){if($.length===0)return"";let Y=$.map((J)=>{let Q=JSON.stringify(Object.fromEntries(J.refs)),X=$Z(J.stateExpr,Z),G=J.initExpr?$Z(J.initExpr,Z):null,K=JSON.stringify(X),q=G?JSON.stringify(G):"null";return`
2502
2502
  (function() {
2503
2503
  var scopeEl = document.querySelector('${J.selector}');
2504
2504
  if (!scopeEl) return;
@@ -4543,6 +4543,13 @@ catch (e2) {
4543
4543
 
4544
4544
  // Known directive names to exclude from generic :attr binding
4545
4545
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
4546
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
4547
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
4548
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
4549
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
4550
+ // a dead duplicate attribute and the real viewBox never updates.
4551
+ 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'};
4552
+ var SVG_NS = 'http://www.w3.org/2000/svg';
4546
4553
  var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
4547
4554
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
4548
4555
 
@@ -4567,7 +4574,8 @@ catch (e2) {
4567
4574
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
4568
4575
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
4569
4576
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
4570
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4577
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4578
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
4571
4579
  effect(() => {
4572
4580
  const v = evalAttrExpr(value);
4573
4581
  if (v === false || v === null || v === undefined) {
@@ -4946,10 +4954,12 @@ else {
4946
4954
  });
4947
4955
  }
4948
4956
  else if (Array.isArray(value)) {
4949
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
4957
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
4958
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
4950
4959
  }
4951
4960
  else {
4952
- el.className = originalClasses + (value ? ' ' + value : '');
4961
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
4962
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
4953
4963
  }
4954
4964
  });
4955
4965
  }
@@ -7273,10 +7283,10 @@ else {
7273
7283
  var root = scriptEl ? scriptEl.nextElementSibling : null;
7274
7284
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
7275
7285
 
7276
- // SPA fallback: during router navigation, script is appended to <body>
7286
+ // SPA fallback: during router navigation, script is appended to body>
7277
7287
  // (not inside the content container), so nextElementSibling won't find the page content.
7278
7288
  // Only use fallback when we genuinely couldn't find a suitable root element.
7279
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
7289
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
7280
7290
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
7281
7291
  var needsFallback = !root || root === document.body
7282
7292
  || (root && root.tagName === 'SCRIPT');
@@ -7595,7 +7605,7 @@ else {
7595
7605
  mountCallbacks.forEach(fn => fn());
7596
7606
  });
7597
7607
 
7598
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
7608
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
7599
7609
  // top-level element with data-stx (signal-processing.ts marks one element),
7600
7610
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
7601
7611
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -7692,7 +7702,7 @@ else {
7692
7702
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
7693
7703
  });
7694
7704
 
7695
- // Process <head> elements (title, meta) that may contain {{ }} expressions
7705
+ // Process head> elements (title, meta) that may contain {{ }} expressions
7696
7706
  // Use componentScope which now contains variables from processed components
7697
7707
  const headElements = document.querySelectorAll('head title, head meta[content]');
7698
7708
  headElements.forEach(el => {
@@ -7888,7 +7898,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7888
7898
 
7889
7899
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
7890
7900
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
7891
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
7901
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
7892
7902
  var usedLatestSetup = false;
7893
7903
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
7894
7904
  try {
@@ -7972,7 +7982,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7972
7982
 
7973
7983
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
7974
7984
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
7975
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
7985
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
7976
7986
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
7977
7987
  if (!container.__stx_scope) {
7978
7988
  // Dispose previous effects on the container (from prior navigation)
@@ -8082,7 +8092,7 @@ ${_}${z}
8082
8092
  return { ${U} };
8083
8093
  }
8084
8094
  if(window.stx)window.stx._latestSetup=${G};
8085
- </script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"];j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(L,F,O)=>{if(H.includes(F.toLowerCase()))return L;return`<${F}${O} data-stx="${G}">`})}return{output:j,setupCode:B}}function GY($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K="",q=()=>{X++;let j=!1;while(X<G){let H=Z[X];if(H==="\\"){X+=2;continue}if(H==="["&&!j){j=!0,X++;continue}if(H==="]"&&j){j=!1,X++;continue}if(H==="/"&&!j){X++;while(X<G&&/[gimsuyd]/.test(Z[X]))X++;return}if(H===`
8095
+ </script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function GY($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K="",q=()=>{X++;let j=!1;while(X<G){let H=Z[X];if(H==="\\"){X+=2;continue}if(H==="["&&!j){j=!0,X++;continue}if(H==="]"&&j){j=!1,X++;continue}if(H==="/"&&!j){X++;while(X<G&&/[gimsuyd]/.test(Z[X]))X++;return}if(H===`
8086
8096
  `)return;X++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===j){X++;return}X++}},U=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let j=1;while(X<G&&j>0)if(Z[X]==="{")j++,X++;else if(Z[X]==="}")j--,X++;else if(Z[X]==="'"||Z[X]==='"')z(Z[X]);else if(Z[X]==="`")U();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
8087
8097
  `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){z(Z[X]),K=Z[X-1];continue}if(Z[X]==="`"){U(),K="`";continue}if(Z[X]==="/"&&Z[X+1]!=="/"&&Z[X+1]!=="*"&&W()){q(),K="/";continue}if(Z[X]==="{"){Q++,K="{",X++;continue}if(Z[X]==="}"){Q--,K="}",X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))B();if(!/\s/.test(Z[X]))K=Z[X];X++}return Y.join(", ")}async function l3($,Z,Y,J){if(!O4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:X,setupCode:G}=await QY(Q,Y,J);if(Q=X,Q=await t2(Q,Z),Q=a2(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
8088
8098
  </head>`);else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
package/dist/ssr.js CHANGED
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)q.push(`
1783
1783
  ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),q.join("")}function nK($,Z,Y){let X=$.split(`
1784
1784
  `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let z=(K+1).toString().padStart(4),q=K===Z-1?">":" ";G.push(`${q}${z} | ${X[K]}`)}return G.join(`
1785
1785
  `)}function oK($,Z,Y){let X=$.split(`
1786
- `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",z="\x1B[0m",q=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;q.push(`${B}${W}\x1B[0m | ${j}`)}return q.join(`
1786
+ `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",z="\x1B[0m",q=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;q.push(`${B}\x1B[90m${W}\x1B[0m | ${j}`)}return q.join(`
1787
1787
  `)}function GZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function KZ($,Z){let X=$.substring(0,Z).split(`
1788
1788
  `);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return $3({type:$,message:Z,code:Y,format:"html"}).formatted}function sK($,Z,Y,X,J){return $3({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function rK($,Z,Y){let X=Y.template.split(`
1789
1789
  `),J=KZ(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
@@ -3756,7 +3756,7 @@ window.__stx_reactive = (function() {
3756
3756
 
3757
3757
  return { initScope: initScope, reactive: reactive };
3758
3758
  })();
3759
- `}function cZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return JSON.stringify(Q)}catch{return X}}),Y}function Jq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=cZ(X.stateExpr,Z),G=X.initExpr?cZ(X.initExpr,Z):null,K=JSON.stringify(Q),z=G?JSON.stringify(G):"null";return`
3759
+ `}function cZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;return String(Q)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{try{let Q=h0(J,Z,!0);if(Q===void 0)return X;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return X}}),Y}function Jq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=cZ(X.stateExpr,Z),G=X.initExpr?cZ(X.initExpr,Z):null,K=JSON.stringify(Q),z=G?JSON.stringify(G):"null";return`
3760
3760
  (function() {
3761
3761
  var scopeEl = document.querySelector('${X.selector}');
3762
3762
  if (!scopeEl) return;
@@ -5996,6 +5996,13 @@ catch (e2) {
5996
5996
 
5997
5997
  // Known directive names to exclude from generic :attr binding
5998
5998
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
5999
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
6000
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
6001
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
6002
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
6003
+ // a dead duplicate attribute and the real viewBox never updates.
6004
+ 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'};
6005
+ var SVG_NS = 'http://www.w3.org/2000/svg';
5999
6006
  var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
6000
6007
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
6001
6008
 
@@ -6020,7 +6027,8 @@ catch (e2) {
6020
6027
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6021
6028
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6022
6029
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
6023
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6030
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
6031
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
6024
6032
  effect(() => {
6025
6033
  const v = evalAttrExpr(value);
6026
6034
  if (v === false || v === null || v === undefined) {
@@ -6399,10 +6407,12 @@ else {
6399
6407
  });
6400
6408
  }
6401
6409
  else if (Array.isArray(value)) {
6402
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
6410
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
6411
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
6403
6412
  }
6404
6413
  else {
6405
- el.className = originalClasses + (value ? ' ' + value : '');
6414
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
6415
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
6406
6416
  }
6407
6417
  });
6408
6418
  }
@@ -8726,10 +8736,10 @@ else {
8726
8736
  var root = scriptEl ? scriptEl.nextElementSibling : null;
8727
8737
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
8728
8738
 
8729
- // SPA fallback: during router navigation, script is appended to <body>
8739
+ // SPA fallback: during router navigation, script is appended to body>
8730
8740
  // (not inside the content container), so nextElementSibling won't find the page content.
8731
8741
  // Only use fallback when we genuinely couldn't find a suitable root element.
8732
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
8742
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
8733
8743
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
8734
8744
  var needsFallback = !root || root === document.body
8735
8745
  || (root && root.tagName === 'SCRIPT');
@@ -9048,7 +9058,7 @@ else {
9048
9058
  mountCallbacks.forEach(fn => fn());
9049
9059
  });
9050
9060
 
9051
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
9061
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
9052
9062
  // top-level element with data-stx (signal-processing.ts marks one element),
9053
9063
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
9054
9064
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -9145,7 +9155,7 @@ else {
9145
9155
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
9146
9156
  });
9147
9157
 
9148
- // Process <head> elements (title, meta) that may contain {{ }} expressions
9158
+ // Process head> elements (title, meta) that may contain {{ }} expressions
9149
9159
  // Use componentScope which now contains variables from processed components
9150
9160
  const headElements = document.querySelectorAll('head title, head meta[content]');
9151
9161
  headElements.forEach(el => {
@@ -9341,7 +9351,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9341
9351
 
9342
9352
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
9343
9353
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
9344
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
9354
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
9345
9355
  var usedLatestSetup = false;
9346
9356
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
9347
9357
  try {
@@ -9425,7 +9435,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9425
9435
 
9426
9436
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
9427
9437
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
9428
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
9438
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
9429
9439
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
9430
9440
  if (!container.__stx_scope) {
9431
9441
  // Dispose previous effects on the container (from prior navigation)
@@ -9535,7 +9545,7 @@ ${_}${U}
9535
9545
  return { ${W} };
9536
9546
  }
9537
9547
  if(window.stx)window.stx._latestSetup=${G};
9538
- </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"];j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(L,F,O)=>{if(H.includes(F.toLowerCase()))return L;return`<${F}${O} data-stx="${G}">`})}return{output:j,setupCode:B}}function FX($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",z=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9548
+ </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function FX($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",z=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
9539
9549
  `)return;Q++}},q=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9540
9550
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){W(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){z(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function n6($,Z,Y,X){if(!u4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await LX(J,Y,X);if(J=Q,J=await qX(J,Z),J=zX(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
9541
9551
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>