@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/caching.js CHANGED
@@ -2963,6 +2963,13 @@ catch (e2) {
2963
2963
 
2964
2964
  // Known directive names to exclude from generic :attr binding
2965
2965
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
2966
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
2967
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
2968
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
2969
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
2970
+ // a dead duplicate attribute and the real viewBox never updates.
2971
+ 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'};
2972
+ var SVG_NS = 'http://www.w3.org/2000/svg';
2966
2973
  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)/;
2967
2974
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
2968
2975
 
@@ -2987,7 +2994,8 @@ catch (e2) {
2987
2994
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
2988
2995
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
2989
2996
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
2990
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
2997
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
2998
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
2991
2999
  effect(() => {
2992
3000
  const v = evalAttrExpr(value);
2993
3001
  if (v === false || v === null || v === undefined) {
@@ -3366,10 +3374,12 @@ else {
3366
3374
  });
3367
3375
  }
3368
3376
  else if (Array.isArray(value)) {
3369
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
3377
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
3378
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
3370
3379
  }
3371
3380
  else {
3372
- el.className = originalClasses + (value ? ' ' + value : '');
3381
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
3382
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
3373
3383
  }
3374
3384
  });
3375
3385
  }
@@ -5693,10 +5703,10 @@ else {
5693
5703
  var root = scriptEl ? scriptEl.nextElementSibling : null;
5694
5704
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
5695
5705
 
5696
- // SPA fallback: during router navigation, script is appended to <body>
5706
+ // SPA fallback: during router navigation, script is appended to body>
5697
5707
  // (not inside the content container), so nextElementSibling won't find the page content.
5698
5708
  // Only use fallback when we genuinely couldn't find a suitable root element.
5699
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
5709
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
5700
5710
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
5701
5711
  var needsFallback = !root || root === document.body
5702
5712
  || (root && root.tagName === 'SCRIPT');
@@ -6015,7 +6025,7 @@ else {
6015
6025
  mountCallbacks.forEach(fn => fn());
6016
6026
  });
6017
6027
 
6018
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
6028
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
6019
6029
  // top-level element with data-stx (signal-processing.ts marks one element),
6020
6030
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
6021
6031
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -6112,7 +6122,7 @@ else {
6112
6122
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
6113
6123
  });
6114
6124
 
6115
- // Process <head> elements (title, meta) that may contain {{ }} expressions
6125
+ // Process head> elements (title, meta) that may contain {{ }} expressions
6116
6126
  // Use componentScope which now contains variables from processed components
6117
6127
  const headElements = document.querySelectorAll('head title, head meta[content]');
6118
6128
  headElements.forEach(el => {
@@ -6308,7 +6318,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
6308
6318
 
6309
6319
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
6310
6320
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
6311
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
6321
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
6312
6322
  var usedLatestSetup = false;
6313
6323
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
6314
6324
  try {
@@ -6392,7 +6402,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
6392
6402
 
6393
6403
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
6394
6404
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
6395
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
6405
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
6396
6406
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
6397
6407
  if (!container.__stx_scope) {
6398
6408
  // Dispose previous effects on the container (from prior navigation)
package/dist/cli.js CHANGED
@@ -1782,7 +1782,7 @@ window.__stx_reactive = (function() {
1782
1782
 
1783
1783
  return { initScope: initScope, reactive: reactive };
1784
1784
  })();
1785
- `}function aU($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=X1(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=X1(J,Z,!0);if(Q===void 0)return X;return JSON.stringify(Q)}catch{return X}}),Y}function SR($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=aU(X.stateExpr,Z),G=X.initExpr?aU(X.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1785
+ `}function aU($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=X1(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=X1(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 SR($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=aU(X.stateExpr,Z),G=X.initExpr?aU(X.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1786
1786
  (function() {
1787
1787
  var scopeEl = document.querySelector('${X.selector}');
1788
1788
  if (!scopeEl) return;
@@ -3986,6 +3986,13 @@ catch (e2) {
3986
3986
 
3987
3987
  // Known directive names to exclude from generic :attr binding
3988
3988
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
3989
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
3990
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
3991
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
3992
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
3993
+ // a dead duplicate attribute and the real viewBox never updates.
3994
+ 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'};
3995
+ var SVG_NS = 'http://www.w3.org/2000/svg';
3989
3996
  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)/;
3990
3997
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
3991
3998
 
@@ -4010,7 +4017,8 @@ catch (e2) {
4010
4017
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
4011
4018
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
4012
4019
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
4013
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4020
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4021
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
4014
4022
  effect(() => {
4015
4023
  const v = evalAttrExpr(value);
4016
4024
  if (v === false || v === null || v === undefined) {
@@ -4389,10 +4397,12 @@ else {
4389
4397
  });
4390
4398
  }
4391
4399
  else if (Array.isArray(value)) {
4392
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
4400
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
4401
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
4393
4402
  }
4394
4403
  else {
4395
- el.className = originalClasses + (value ? ' ' + value : '');
4404
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
4405
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
4396
4406
  }
4397
4407
  });
4398
4408
  }
@@ -6716,10 +6726,10 @@ else {
6716
6726
  var root = scriptEl ? scriptEl.nextElementSibling : null;
6717
6727
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
6718
6728
 
6719
- // SPA fallback: during router navigation, script is appended to <body>
6729
+ // SPA fallback: during router navigation, script is appended to body>
6720
6730
  // (not inside the content container), so nextElementSibling won't find the page content.
6721
6731
  // Only use fallback when we genuinely couldn't find a suitable root element.
6722
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
6732
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
6723
6733
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
6724
6734
  var needsFallback = !root || root === document.body
6725
6735
  || (root && root.tagName === 'SCRIPT');
@@ -7038,7 +7048,7 @@ else {
7038
7048
  mountCallbacks.forEach(fn => fn());
7039
7049
  });
7040
7050
 
7041
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
7051
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
7042
7052
  // top-level element with data-stx (signal-processing.ts marks one element),
7043
7053
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
7044
7054
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -7135,7 +7145,7 @@ else {
7135
7145
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
7136
7146
  });
7137
7147
 
7138
- // Process <head> elements (title, meta) that may contain {{ }} expressions
7148
+ // Process head> elements (title, meta) that may contain {{ }} expressions
7139
7149
  // Use componentScope which now contains variables from processed components
7140
7150
  const headElements = document.querySelectorAll('head title, head meta[content]');
7141
7151
  headElements.forEach(el => {
@@ -7331,7 +7341,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7331
7341
 
7332
7342
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
7333
7343
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
7334
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
7344
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
7335
7345
  var usedLatestSetup = false;
7336
7346
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
7337
7347
  try {
@@ -7415,7 +7425,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7415
7425
 
7416
7426
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
7417
7427
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
7418
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
7428
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
7419
7429
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
7420
7430
  if (!container.__stx_scope) {
7421
7431
  // Dispose previous effects on the container (from prior navigation)
@@ -7525,7 +7535,7 @@ ${B}${_}
7525
7535
  return { ${z} };
7526
7536
  }
7527
7537
  if(window.stx)window.stx._latestSetup=${G};
7528
- </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,(O,V,L)=>{if(H.includes(V.toLowerCase()))return O;return`<${V}${L} data-stx="${G}">`})}return{output:j,setupCode:q}}function lB($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",W=()=>{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===`
7538
+ </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"],O=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(V,L,F)=>{if(O||H.includes(L.toLowerCase()))return V;return O=!0,`<${L}${F} data-stx="${G}">`})}return{output:j,setupCode:q}}function lB($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",W=()=>{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===`
7529
7539
  `)return;Q++}},U=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},_=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},z=()=>{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]==='"')_(Z[Q]);else if(Z[Q]==="`")z();else Q++;continue}Q++}},B=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
7530
7540
  `)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},q=()=>{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 F=j[2];if(!X.has(F))Y.push(F),X.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let A=F.trim();if(!A)return;let N=A.indexOf(":"),R=(N>=0?A.slice(N+1).trim():A).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((F)=>{let A=F.trim().replace(/^\.\.\./,"");if(!A)return;let N=A.split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!X.has(F))Y.push(F),X.add(F);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!X.has(F))Y.push(F),X.add(F)}};while(Q<G){if(B())continue;if(Z[Q]==="'"||Z[Q]==='"'){_(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){z(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&U()){W(),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])))q();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function $2($,Z,Y,X){if(!cZ($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await cB(J,Y,X);if(J=Q,J=await vB(J,Z),J=xB(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
7531
7541
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
@@ -20399,7 +20409,7 @@ else {
20399
20409
  `)}function fN($,Z){let Y=" ".repeat(Z),X=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);X.push(`${K}: ${U}`)}let J=X.length>0?`{ ${X.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:fN(K,Z+1)),G=Q.length>0?`,
20400
20410
  ${Y} [${Q.join(`,
20401
20411
  ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function Cf($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[J,Q]of Y)X.push(`// --- ${J.toUpperCase()} ---`),X.push(`#if ${J.toUpperCase()}`),X.push(Q),X.push("#endif"),X.push("");return X.join(`
20402
- `)}return Y.get(Z.target)||nW($,Z)}function bf($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:hN(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function Pf($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function gN(){return`id_${++yf}`}function hN($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function xf($){return $.charAt(0).toUpperCase()+$.slice(1)}function vf($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function ff($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function rW($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=rW(Y);return Z}function aW($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=aW(Y);return Z}function dN($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var sW,yf=0,gf,hf;var mN=D(()=>{sW=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);gf={compileToNative:bN,createHotReloadServer:dN,NATIVE_COMPONENTS:sW},hf=gf});import{spawn as pN}from"child_process";import y0 from"fs";import df from"os";import Y0 from"path";import v from"process";import{CLI as uf}from"@stacksjs/clapp";var A6="0.2.82";Y$();MW();bG();uG();x4();gG();jW();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",O0=new uf("stx");function cN($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function lN($){try{if(!y0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(y0.existsSync(Y)){let Q=y0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(y0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function oW($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var x5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),mf=($)=>$.endsWith(".stx")||$.endsWith(".md");function y5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}async function cf($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(x5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(df.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=pN(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let z=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
20412
+ `)}return Y.get(Z.target)||nW($,Z)}function bf($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:hN(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function Pf($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function gN(){return`id_${++yf}`}function hN($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function xf($){return $.charAt(0).toUpperCase()+$.slice(1)}function vf($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function ff($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function rW($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=rW(Y);return Z}function aW($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=aW(Y);return Z}function dN($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var sW,yf=0,gf,hf;var mN=D(()=>{sW=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);gf={compileToNative:bN,createHotReloadServer:dN,NATIVE_COMPONENTS:sW},hf=gf});import{spawn as pN}from"child_process";import y0 from"fs";import df from"os";import Y0 from"path";import v from"process";import{CLI as uf}from"@stacksjs/clapp";var A6="0.2.84";Y$();MW();bG();uG();x4();gG();jW();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",O0=new uf("stx");function cN($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function lN($){try{if(!y0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(y0.existsSync(Y)){let Q=y0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(y0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function oW($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var x5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),mf=($)=>$.endsWith(".stx")||$.endsWith(".md");function y5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}async function cf($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(x5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(df.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=pN(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let z=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
20403
20413
  Test run interrupted`),K.kill("SIGINT"),v.exit(1)})})}catch(Y){return console.error("Error running tests:",Y instanceof Error?Y.message:String(Y)),!1}}var lf=v.argv.length>=3&&(mf(v.argv[2])&&y0.existsSync(v.argv[2])||x5(v.argv[2]));if(lf){let $=v.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Y=3;Y<v.argv.length;Y++){let X=v.argv[Y];if(X==="--port"&&Y+1<v.argv.length){let J=cN(v.argv[++Y]);if(!J.isValid)y5(J);Z.port=Number.parseInt(v.argv[Y],10)}else if(X==="--no-watch")Z.watch=!1;else if(X==="--highlight-theme"&&Y+1<v.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=v.argv[++Y]}else if(X==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(X==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(X==="--no-cache")Z.cache=!1;else if(X==="--native")Z.native=!0}if(x5($))try{let Y=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),X=$.endsWith(".stx")?Y.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Y.filter((K)=>K.endsWith(".md")):Y.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),J=$.split("*")[0].replace(/\/$/,"")||".",Q=Y0.resolve(J);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((_)=>/\[.+\]/.test(Y0.basename(_)));for(let _ of U)if(!X.includes(_))X.push(_)}catch{}if(X.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),v.exit(1);if(!await l8(X,Z))v.exit(1)}catch(Y){console.error("Failed to process files:",Y),v.exit(1)}else c8($,Z).catch((Y)=>{console.error("Failed to start dev server:",Y),v.exit(1)})}else{let $=function(X,J){let Q=[];for(let G=0;G<=J.length;G++)Q[G]=[G];for(let G=0;G<=X.length;G++)Q[0][G]=G;for(let G=1;G<=J.length;G++)for(let K=1;K<=X.length;K++)if(J.charAt(G-1)===X.charAt(K-1))Q[G][K]=Q[G-1][K-1];else Q[G][K]=Math.min(Q[G-1][K-1]+1,Q[G][K-1]+1,Q[G-1][K]+1);return Q[J.length][X.length]};O0.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(X)=>{try{if(await CG(X))console.log("Documentation generated successfully."),v.exit(0);else console.error("Documentation generation failed."),v.exit(1)}catch(J){console.error("Error generating documentation:",J),v.exit(1)}}),O0.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(X,J)=>{try{let{fetchCollections:Q,generatePackage:G}=await import("@stacksjs/iconify-generator");if(X==="list"){console.log(`
20404
20414
  \uD83D\uDCDA Fetching available icon collections...
20405
20415
  `);let K=await Q(),W=Object.entries(K).sort((U,_)=>_[1].total-U[1].total);console.log(`Available collections:
@@ -2424,7 +2424,7 @@ window.__stx_reactive = (function() {
2424
2424
 
2425
2425
  return { initScope: initScope, reactive: reactive };
2426
2426
  })();
2427
- `}function w8($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return JSON.stringify(J)}catch{return X}}),Y}function DG($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=w8(X.stateExpr,Z),G=X.initExpr?w8(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
2427
+ `}function w8($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function DG($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=w8(X.stateExpr,Z),G=X.initExpr?w8(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
2428
2428
  (function() {
2429
2429
  var scopeEl = document.querySelector('${X.selector}');
2430
2430
  if (!scopeEl) return;
@@ -4494,6 +4494,13 @@ catch (e2) {
4494
4494
 
4495
4495
  // Known directive names to exclude from generic :attr binding
4496
4496
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
4497
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
4498
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
4499
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
4500
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
4501
+ // a dead duplicate attribute and the real viewBox never updates.
4502
+ 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'};
4503
+ var SVG_NS = 'http://www.w3.org/2000/svg';
4497
4504
  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)/;
4498
4505
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
4499
4506
 
@@ -4518,7 +4525,8 @@ catch (e2) {
4518
4525
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
4519
4526
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
4520
4527
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
4521
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4528
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4529
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
4522
4530
  effect(() => {
4523
4531
  const v = evalAttrExpr(value);
4524
4532
  if (v === false || v === null || v === undefined) {
@@ -4897,10 +4905,12 @@ else {
4897
4905
  });
4898
4906
  }
4899
4907
  else if (Array.isArray(value)) {
4900
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
4908
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
4909
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
4901
4910
  }
4902
4911
  else {
4903
- el.className = originalClasses + (value ? ' ' + value : '');
4912
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
4913
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
4904
4914
  }
4905
4915
  });
4906
4916
  }
@@ -7224,10 +7234,10 @@ else {
7224
7234
  var root = scriptEl ? scriptEl.nextElementSibling : null;
7225
7235
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
7226
7236
 
7227
- // SPA fallback: during router navigation, script is appended to <body>
7237
+ // SPA fallback: during router navigation, script is appended to body>
7228
7238
  // (not inside the content container), so nextElementSibling won't find the page content.
7229
7239
  // Only use fallback when we genuinely couldn't find a suitable root element.
7230
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
7240
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
7231
7241
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
7232
7242
  var needsFallback = !root || root === document.body
7233
7243
  || (root && root.tagName === 'SCRIPT');
@@ -7546,7 +7556,7 @@ else {
7546
7556
  mountCallbacks.forEach(fn => fn());
7547
7557
  });
7548
7558
 
7549
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
7559
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
7550
7560
  // top-level element with data-stx (signal-processing.ts marks one element),
7551
7561
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
7552
7562
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -7643,7 +7653,7 @@ else {
7643
7653
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
7644
7654
  });
7645
7655
 
7646
- // Process <head> elements (title, meta) that may contain {{ }} expressions
7656
+ // Process head> elements (title, meta) that may contain {{ }} expressions
7647
7657
  // Use componentScope which now contains variables from processed components
7648
7658
  const headElements = document.querySelectorAll('head title, head meta[content]');
7649
7659
  headElements.forEach(el => {
@@ -7839,7 +7849,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7839
7849
 
7840
7850
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
7841
7851
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
7842
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
7852
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
7843
7853
  var usedLatestSetup = false;
7844
7854
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
7845
7855
  try {
@@ -7923,7 +7933,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7923
7933
 
7924
7934
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
7925
7935
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
7926
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
7936
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
7927
7937
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
7928
7938
  if (!container.__stx_scope) {
7929
7939
  // Dispose previous effects on the container (from prior navigation)
@@ -8031,7 +8041,7 @@ ${_}${z}
8031
8041
  return { ${U} };
8032
8042
  }
8033
8043
  if(window.stx)window.stx._latestSetup=${G};
8034
- </script>`,j=$;for(let H of J)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 x2($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8044
+ </script>`,j=$;for(let H of J)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 x2($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8035
8045
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},U=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')z(Z[J]);else if(Z[J]==="`")U();else J++;continue}J++}},_=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8036
8046
  `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(J).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(J).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(J).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(J).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(J).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(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){z(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){U(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))B();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function b3($,Z,Y,X){if(!K4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await v2(Q,Y,X);if(Q=J,Q=await E2(Q,Z),Q=D2(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
8037
8047
  </head>`);else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
@@ -2424,7 +2424,7 @@ window.__stx_reactive = (function() {
2424
2424
 
2425
2425
  return { initScope: initScope, reactive: reactive };
2426
2426
  })();
2427
- `}function O8($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return JSON.stringify(J)}catch{return X}}),Y}function IG($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=O8(X.stateExpr,Z),G=X.initExpr?O8(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
2427
+ `}function O8($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function IG($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=O8(X.stateExpr,Z),G=X.initExpr?O8(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
2428
2428
  (function() {
2429
2429
  var scopeEl = document.querySelector('${X.selector}');
2430
2430
  if (!scopeEl) return;
@@ -4456,6 +4456,13 @@ catch (e2) {
4456
4456
 
4457
4457
  // Known directive names to exclude from generic :attr binding
4458
4458
  var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
4459
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
4460
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
4461
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
4462
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
4463
+ // a dead duplicate attribute and the real viewBox never updates.
4464
+ 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'};
4465
+ var SVG_NS = 'http://www.w3.org/2000/svg';
4459
4466
  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)/;
4460
4467
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
4461
4468
 
@@ -4480,7 +4487,8 @@ catch (e2) {
4480
4487
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
4481
4488
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
4482
4489
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
4483
- const attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4490
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
4491
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
4484
4492
  effect(() => {
4485
4493
  const v = evalAttrExpr(value);
4486
4494
  if (v === false || v === null || v === undefined) {
@@ -4859,10 +4867,12 @@ else {
4859
4867
  });
4860
4868
  }
4861
4869
  else if (Array.isArray(value)) {
4862
- el.className = originalClasses + ' ' + value.filter(Boolean).join(' ');
4870
+ var _clsArr = originalClasses + ' ' + value.filter(Boolean).join(' ');
4871
+ if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);
4863
4872
  }
4864
4873
  else {
4865
- el.className = originalClasses + (value ? ' ' + value : '');
4874
+ var _clsStr = originalClasses + (value ? ' ' + value : '');
4875
+ if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);
4866
4876
  }
4867
4877
  });
4868
4878
  }
@@ -7186,10 +7196,10 @@ else {
7186
7196
  var root = scriptEl ? scriptEl.nextElementSibling : null;
7187
7197
  if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
7188
7198
 
7189
- // SPA fallback: during router navigation, script is appended to <body>
7199
+ // SPA fallback: during router navigation, script is appended to body>
7190
7200
  // (not inside the content container), so nextElementSibling won't find the page content.
7191
7201
  // Only use fallback when we genuinely couldn't find a suitable root element.
7192
- // Do NOT fallback just because the script is in <body> \u2014 layout scripts in <body>
7202
+ // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>
7193
7203
  // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.
7194
7204
  var needsFallback = !root || root === document.body
7195
7205
  || (root && root.tagName === 'SCRIPT');
@@ -7508,7 +7518,7 @@ else {
7508
7518
  mountCallbacks.forEach(fn => fn());
7509
7519
  });
7510
7520
 
7511
- // Multi-root fragment fix: a no-<body> setup page tags only the FIRST
7521
+ // Multi-root fragment fix: a no-body> setup page tags only the FIRST
7512
7522
  // top-level element with data-stx (signal-processing.ts marks one element),
7513
7523
  // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text
7514
7524
  // never hydrated, which read as "{{ }} doesn't work under :if/:for". The
@@ -7605,7 +7615,7 @@ else {
7605
7615
  el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
7606
7616
  });
7607
7617
 
7608
- // Process <head> elements (title, meta) that may contain {{ }} expressions
7618
+ // Process head> elements (title, meta) that may contain {{ }} expressions
7609
7619
  // Use componentScope which now contains variables from processed components
7610
7620
  const headElements = document.querySelectorAll('head title, head meta[content]');
7611
7621
  headElements.forEach(el => {
@@ -7801,7 +7811,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7801
7811
 
7802
7812
  // Apply new page's SFC setup function. During SPA navigation, re-executed page
7803
7813
  // scripts set window.stx._latestSetup to the new setup function. This takes priority
7804
- // over the stale data-stx attribute on <body> (which has the PREVIOUS page's function name).
7814
+ // over the stale data-stx attribute on body> (which has the PREVIOUS page's function name).
7805
7815
  var usedLatestSetup = false;
7806
7816
  if (window.stx._latestSetup && typeof window.stx._latestSetup === 'function') {
7807
7817
  try {
@@ -7885,7 +7895,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7885
7895
 
7886
7896
  // Process the container content \u2014 bind {{ }}, :attr, @event directives.
7887
7897
  // Run synchronously (not in setTimeout) so componentScope is captured correctly.
7888
- // The DOMContentLoaded path processes <body> synchronously \u2014 the SPA path must match.
7898
+ // The DOMContentLoaded path processes body> synchronously \u2014 the SPA path must match.
7889
7899
  console.log('[stx:load] container:', container.tagName, '__stx_scope:', !!container.__stx_scope, 'scope keys:', Object.keys(componentScope).slice(0, 10));
7890
7900
  if (!container.__stx_scope) {
7891
7901
  // Dispose previous effects on the container (from prior navigation)
@@ -7993,7 +8003,7 @@ ${_}${z}
7993
8003
  return { ${U} };
7994
8004
  }
7995
8005
  if(window.stx)window.stx._latestSetup=${G};
7996
- </script>`,j=$;for(let H of J)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 B2($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8006
+ </script>`,j=$;for(let H of J)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 B2($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
7997
8007
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},U=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')z(Z[J]);else if(Z[J]==="`")U();else J++;continue}J++}},_=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
7998
8008
  `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(J).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(J).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(J).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(J).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(J).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(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){z(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){U(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))B();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function Z3($,Z,Y,X){if(!t$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await _2(Q,Y,X);if(Q=J,Q=await Q2(Q,Z),Q=J2(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
7999
8009
  </head>`);else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>