@stacksjs/stx 0.2.124 → 0.2.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -6038,37 +6038,38 @@ catch (e2) {
6038
6038
  pick.el.__stx_shown_at = performance.now();
6039
6039
  if (!pick.childrenProcessed) {
6040
6040
  pick.childrenProcessed = true;
6041
- // Defer child processing (same rationale as bindIf, CLAUDE.md
6042
- // item 35): keep child effects from subscribing to THIS chain
6043
- // effect's tracked signals.
6044
- (function (branch) {
6045
- setTimeout(function () {
6046
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
6047
- // Components compiled inside any branch of an if/else-if/else
6048
- // chain carry scoped setup scripts with them. Branch nodes are
6049
- // detached before those scripts can execute, so simply
6050
- // re-inserting the selected branch leaves component props,
6051
- // events, directives, and projected slot expressions inert.
6052
- // Hydrate those scopes before the normal subtree walk, matching
6053
- // the single-template :if and :for insertion paths.
6054
- var previouslyTrackedNodes = new Set();
6055
- branch.nodes.forEach(function (n) {
6056
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
6057
- });
6058
- hydrateComponentScopes(branch.nodes, childScope);
6059
- branch.nodes.forEach(function (n) {
6060
- if (n.nodeType !== 1) return; // whitespace/text between template children
6061
- // A scoped component receives its disposer in the outer scope
6062
- // walk immediately after processElement returns from binding
6063
- // this conditional. That first pass intentionally stops at
6064
- // :if, so a disposer does not mean its children were hydrated.
6065
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
6066
- processElement(n, childScope);
6067
- n.removeAttribute('x-cloak');
6068
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
6069
- });
6070
- }, 0);
6071
- })(pick);
6041
+ // Hydrate before the outer scope walk can see the inserted branch.
6042
+ // Chromium executes scripts cloned from template.content as soon as
6043
+ // they are connected, so deferring this pass allowed the global walk
6044
+ // to process projected slot expressions without the loop caller
6045
+ // scope. peek() keeps this synchronous pass from subscribing child
6046
+ // reads to the current chain effect.
6047
+ peek(function () {
6048
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
6049
+ // Components compiled inside any branch of an if/else-if/else
6050
+ // chain carry scoped setup scripts with them. Branch nodes are
6051
+ // detached before those scripts can execute, so simply
6052
+ // re-inserting the selected branch leaves component props,
6053
+ // events, directives, and projected slot expressions inert.
6054
+ // Hydrate those scopes before the normal subtree walk, matching
6055
+ // the single-template :if and :for insertion paths.
6056
+ var previouslyTrackedNodes = new Set();
6057
+ pick.nodes.forEach(function (n) {
6058
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
6059
+ });
6060
+ hydrateComponentScopes(pick.nodes, childScope);
6061
+ pick.nodes.forEach(function (n) {
6062
+ if (n.nodeType !== 1) return; // whitespace/text between template children
6063
+ // A scoped component receives its disposer in the outer scope
6064
+ // walk immediately after processElement returns from binding
6065
+ // this conditional. That first pass intentionally stops at
6066
+ // :if, so a disposer does not mean its children were hydrated.
6067
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
6068
+ processElement(n, childScope);
6069
+ n.removeAttribute('x-cloak');
6070
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
6071
+ });
6072
+ });
6072
6073
  }
6073
6074
  }
6074
6075
 
@@ -6239,10 +6240,13 @@ else if (!value && isInserted) {
6239
6240
  else if (value && isInserted && !childrenProcessed) {
6240
6241
  // Initial template content is cloned before the effect runs. Process
6241
6242
  // it after the condition is confirmed so hidden branches stay inert.
6243
+ // Keep hydration synchronous so the outer scope walk cannot bind
6244
+ // caller-owned slot expressions first, while peek() prevents child
6245
+ // reads from subscribing to this conditional effect.
6242
6246
  childrenProcessed = true;
6243
- setTimeout(function() {
6247
+ peek(function() {
6244
6248
  if (isInserted) processTemplateNodes(currentNodes);
6245
- }, 0);
6249
+ });
6246
6250
  }
6247
6251
  }
6248
6252
  else {
@@ -22440,7 +22444,7 @@ else {
22440
22444
  `)}function QR($,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:""}"`:QR(K,Z+1)),G=Q.length>0?`,
22441
22445
  ${Y} [${Q.join(`,
22442
22446
  ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function ih($,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(`
22443
- `)}return Y.get(Z.target)||fU($,Z)}function nh($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:KR(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 rh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function GR(){return`id_${++ah}`}function KR($){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 sh($){return $.charAt(0).toUpperCase()+$.slice(1)}function oh($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function th($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function WR($){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 dU,ah=0,eh,$d;var zR=D(()=>{dU=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"}]]);eh={compileToNative:$R,createHotReloadServer:WR,NATIVE_COMPONENTS:dU},$d=eh});import{spawn as qR}from"child_process";import f0 from"fs";import Zd from"os";import Y0 from"path";import v from"process";import{CLI as Yd}from"@stacksjs/clapp";var E6="0.2.124";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Yd("stx");function _R($){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 BR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.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(f0.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 uU($){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 e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Xd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Jd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Qd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(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(Zd.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=qR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
22447
+ `)}return Y.get(Z.target)||fU($,Z)}function nh($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:KR(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 rh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function GR(){return`id_${++ah}`}function KR($){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 sh($){return $.charAt(0).toUpperCase()+$.slice(1)}function oh($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function th($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function WR($){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 dU,ah=0,eh,$d;var zR=D(()=>{dU=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"}]]);eh={compileToNative:$R,createHotReloadServer:WR,NATIVE_COMPONENTS:dU},$d=eh});import{spawn as qR}from"child_process";import f0 from"fs";import Zd from"os";import Y0 from"path";import v from"process";import{CLI as Yd}from"@stacksjs/clapp";var E6="0.2.125";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Yd("stx");function _R($){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 BR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.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(f0.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 uU($){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 e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Xd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Jd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Qd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(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(Zd.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=qR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
22444
22448
  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 Gd=v.argv.length>=3&&(Xd(v.argv[2])&&f0.existsSync(v.argv[2])||e5(v.argv[2]));if(Gd){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=_R(v.argv[++Y]);if(!J.isValid)t5(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(e5($))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((z)=>/\[.+\]/.test(Y0.basename(z)));for(let z of U)if(!X.includes(z))X.push(z)}catch{}if(X.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),v.exit(1);if(!await w3(X,Z))v.exit(1)}catch(Y){console.error("Failed to process files:",Y),v.exit(1)}else N3($,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]};V0.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 FK(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)}}),V0.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(`
22445
22449
  \uD83D\uDCDA Fetching available icon collections...
22446
22450
  `);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections:
package/dist/craft.js CHANGED
@@ -5798,37 +5798,38 @@ catch (e2) {
5798
5798
  pick.el.__stx_shown_at = performance.now();
5799
5799
  if (!pick.childrenProcessed) {
5800
5800
  pick.childrenProcessed = true;
5801
- // Defer child processing (same rationale as bindIf, CLAUDE.md
5802
- // item 35): keep child effects from subscribing to THIS chain
5803
- // effect's tracked signals.
5804
- (function (branch) {
5805
- setTimeout(function () {
5806
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
5807
- // Components compiled inside any branch of an if/else-if/else
5808
- // chain carry scoped setup scripts with them. Branch nodes are
5809
- // detached before those scripts can execute, so simply
5810
- // re-inserting the selected branch leaves component props,
5811
- // events, directives, and projected slot expressions inert.
5812
- // Hydrate those scopes before the normal subtree walk, matching
5813
- // the single-template :if and :for insertion paths.
5814
- var previouslyTrackedNodes = new Set();
5815
- branch.nodes.forEach(function (n) {
5816
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
5817
- });
5818
- hydrateComponentScopes(branch.nodes, childScope);
5819
- branch.nodes.forEach(function (n) {
5820
- if (n.nodeType !== 1) return; // whitespace/text between template children
5821
- // A scoped component receives its disposer in the outer scope
5822
- // walk immediately after processElement returns from binding
5823
- // this conditional. That first pass intentionally stops at
5824
- // :if, so a disposer does not mean its children were hydrated.
5825
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
5826
- processElement(n, childScope);
5827
- n.removeAttribute('x-cloak');
5828
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
5829
- });
5830
- }, 0);
5831
- })(pick);
5801
+ // Hydrate before the outer scope walk can see the inserted branch.
5802
+ // Chromium executes scripts cloned from template.content as soon as
5803
+ // they are connected, so deferring this pass allowed the global walk
5804
+ // to process projected slot expressions without the loop caller
5805
+ // scope. peek() keeps this synchronous pass from subscribing child
5806
+ // reads to the current chain effect.
5807
+ peek(function () {
5808
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
5809
+ // Components compiled inside any branch of an if/else-if/else
5810
+ // chain carry scoped setup scripts with them. Branch nodes are
5811
+ // detached before those scripts can execute, so simply
5812
+ // re-inserting the selected branch leaves component props,
5813
+ // events, directives, and projected slot expressions inert.
5814
+ // Hydrate those scopes before the normal subtree walk, matching
5815
+ // the single-template :if and :for insertion paths.
5816
+ var previouslyTrackedNodes = new Set();
5817
+ pick.nodes.forEach(function (n) {
5818
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
5819
+ });
5820
+ hydrateComponentScopes(pick.nodes, childScope);
5821
+ pick.nodes.forEach(function (n) {
5822
+ if (n.nodeType !== 1) return; // whitespace/text between template children
5823
+ // A scoped component receives its disposer in the outer scope
5824
+ // walk immediately after processElement returns from binding
5825
+ // this conditional. That first pass intentionally stops at
5826
+ // :if, so a disposer does not mean its children were hydrated.
5827
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
5828
+ processElement(n, childScope);
5829
+ n.removeAttribute('x-cloak');
5830
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
5831
+ });
5832
+ });
5832
5833
  }
5833
5834
  }
5834
5835
 
@@ -5999,10 +6000,13 @@ else if (!value && isInserted) {
5999
6000
  else if (value && isInserted && !childrenProcessed) {
6000
6001
  // Initial template content is cloned before the effect runs. Process
6001
6002
  // it after the condition is confirmed so hidden branches stay inert.
6003
+ // Keep hydration synchronous so the outer scope walk cannot bind
6004
+ // caller-owned slot expressions first, while peek() prevents child
6005
+ // reads from subscribing to this conditional effect.
6002
6006
  childrenProcessed = true;
6003
- setTimeout(function() {
6007
+ peek(function() {
6004
6008
  if (isInserted) processTemplateNodes(currentNodes);
6005
- }, 0);
6009
+ });
6006
6010
  }
6007
6011
  }
6008
6012
  else {
package/dist/pwa.js CHANGED
@@ -5707,37 +5707,38 @@ catch (e2) {
5707
5707
  pick.el.__stx_shown_at = performance.now();
5708
5708
  if (!pick.childrenProcessed) {
5709
5709
  pick.childrenProcessed = true;
5710
- // Defer child processing (same rationale as bindIf, CLAUDE.md
5711
- // item 35): keep child effects from subscribing to THIS chain
5712
- // effect's tracked signals.
5713
- (function (branch) {
5714
- setTimeout(function () {
5715
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
5716
- // Components compiled inside any branch of an if/else-if/else
5717
- // chain carry scoped setup scripts with them. Branch nodes are
5718
- // detached before those scripts can execute, so simply
5719
- // re-inserting the selected branch leaves component props,
5720
- // events, directives, and projected slot expressions inert.
5721
- // Hydrate those scopes before the normal subtree walk, matching
5722
- // the single-template :if and :for insertion paths.
5723
- var previouslyTrackedNodes = new Set();
5724
- branch.nodes.forEach(function (n) {
5725
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
5726
- });
5727
- hydrateComponentScopes(branch.nodes, childScope);
5728
- branch.nodes.forEach(function (n) {
5729
- if (n.nodeType !== 1) return; // whitespace/text between template children
5730
- // A scoped component receives its disposer in the outer scope
5731
- // walk immediately after processElement returns from binding
5732
- // this conditional. That first pass intentionally stops at
5733
- // :if, so a disposer does not mean its children were hydrated.
5734
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
5735
- processElement(n, childScope);
5736
- n.removeAttribute('x-cloak');
5737
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
5738
- });
5739
- }, 0);
5740
- })(pick);
5710
+ // Hydrate before the outer scope walk can see the inserted branch.
5711
+ // Chromium executes scripts cloned from template.content as soon as
5712
+ // they are connected, so deferring this pass allowed the global walk
5713
+ // to process projected slot expressions without the loop caller
5714
+ // scope. peek() keeps this synchronous pass from subscribing child
5715
+ // reads to the current chain effect.
5716
+ peek(function () {
5717
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
5718
+ // Components compiled inside any branch of an if/else-if/else
5719
+ // chain carry scoped setup scripts with them. Branch nodes are
5720
+ // detached before those scripts can execute, so simply
5721
+ // re-inserting the selected branch leaves component props,
5722
+ // events, directives, and projected slot expressions inert.
5723
+ // Hydrate those scopes before the normal subtree walk, matching
5724
+ // the single-template :if and :for insertion paths.
5725
+ var previouslyTrackedNodes = new Set();
5726
+ pick.nodes.forEach(function (n) {
5727
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
5728
+ });
5729
+ hydrateComponentScopes(pick.nodes, childScope);
5730
+ pick.nodes.forEach(function (n) {
5731
+ if (n.nodeType !== 1) return; // whitespace/text between template children
5732
+ // A scoped component receives its disposer in the outer scope
5733
+ // walk immediately after processElement returns from binding
5734
+ // this conditional. That first pass intentionally stops at
5735
+ // :if, so a disposer does not mean its children were hydrated.
5736
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
5737
+ processElement(n, childScope);
5738
+ n.removeAttribute('x-cloak');
5739
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
5740
+ });
5741
+ });
5741
5742
  }
5742
5743
  }
5743
5744
 
@@ -5908,10 +5909,13 @@ else if (!value && isInserted) {
5908
5909
  else if (value && isInserted && !childrenProcessed) {
5909
5910
  // Initial template content is cloned before the effect runs. Process
5910
5911
  // it after the condition is confirmed so hidden branches stay inert.
5912
+ // Keep hydration synchronous so the outer scope walk cannot bind
5913
+ // caller-owned slot expressions first, while peek() prevents child
5914
+ // reads from subscribing to this conditional effect.
5911
5915
  childrenProcessed = true;
5912
- setTimeout(function() {
5916
+ peek(function() {
5913
5917
  if (isInserted) processTemplateNodes(currentNodes);
5914
- }, 0);
5918
+ });
5915
5919
  }
5916
5920
  }
5917
5921
  else {
package/dist/signals.js CHANGED
@@ -3782,37 +3782,38 @@ catch (e2) {
3782
3782
  pick.el.__stx_shown_at = performance.now();
3783
3783
  if (!pick.childrenProcessed) {
3784
3784
  pick.childrenProcessed = true;
3785
- // Defer child processing (same rationale as bindIf, CLAUDE.md
3786
- // item 35): keep child effects from subscribing to THIS chain
3787
- // effect's tracked signals.
3788
- (function (branch) {
3789
- setTimeout(function () {
3790
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
3791
- // Components compiled inside any branch of an if/else-if/else
3792
- // chain carry scoped setup scripts with them. Branch nodes are
3793
- // detached before those scripts can execute, so simply
3794
- // re-inserting the selected branch leaves component props,
3795
- // events, directives, and projected slot expressions inert.
3796
- // Hydrate those scopes before the normal subtree walk, matching
3797
- // the single-template :if and :for insertion paths.
3798
- var previouslyTrackedNodes = new Set();
3799
- branch.nodes.forEach(function (n) {
3800
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
3801
- });
3802
- hydrateComponentScopes(branch.nodes, childScope);
3803
- branch.nodes.forEach(function (n) {
3804
- if (n.nodeType !== 1) return; // whitespace/text between template children
3805
- // A scoped component receives its disposer in the outer scope
3806
- // walk immediately after processElement returns from binding
3807
- // this conditional. That first pass intentionally stops at
3808
- // :if, so a disposer does not mean its children were hydrated.
3809
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
3810
- processElement(n, childScope);
3811
- n.removeAttribute('x-cloak');
3812
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
3813
- });
3814
- }, 0);
3815
- })(pick);
3785
+ // Hydrate before the outer scope walk can see the inserted branch.
3786
+ // Chromium executes scripts cloned from template.content as soon as
3787
+ // they are connected, so deferring this pass allowed the global walk
3788
+ // to process projected slot expressions without the loop caller
3789
+ // scope. peek() keeps this synchronous pass from subscribing child
3790
+ // reads to the current chain effect.
3791
+ peek(function () {
3792
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
3793
+ // Components compiled inside any branch of an if/else-if/else
3794
+ // chain carry scoped setup scripts with them. Branch nodes are
3795
+ // detached before those scripts can execute, so simply
3796
+ // re-inserting the selected branch leaves component props,
3797
+ // events, directives, and projected slot expressions inert.
3798
+ // Hydrate those scopes before the normal subtree walk, matching
3799
+ // the single-template :if and :for insertion paths.
3800
+ var previouslyTrackedNodes = new Set();
3801
+ pick.nodes.forEach(function (n) {
3802
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
3803
+ });
3804
+ hydrateComponentScopes(pick.nodes, childScope);
3805
+ pick.nodes.forEach(function (n) {
3806
+ if (n.nodeType !== 1) return; // whitespace/text between template children
3807
+ // A scoped component receives its disposer in the outer scope
3808
+ // walk immediately after processElement returns from binding
3809
+ // this conditional. That first pass intentionally stops at
3810
+ // :if, so a disposer does not mean its children were hydrated.
3811
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
3812
+ processElement(n, childScope);
3813
+ n.removeAttribute('x-cloak');
3814
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
3815
+ });
3816
+ });
3816
3817
  }
3817
3818
  }
3818
3819
 
@@ -3983,10 +3984,13 @@ else if (!value && isInserted) {
3983
3984
  else if (value && isInserted && !childrenProcessed) {
3984
3985
  // Initial template content is cloned before the effect runs. Process
3985
3986
  // it after the condition is confirmed so hidden branches stay inert.
3987
+ // Keep hydration synchronous so the outer scope walk cannot bind
3988
+ // caller-owned slot expressions first, while peek() prevents child
3989
+ // reads from subscribing to this conditional effect.
3986
3990
  childrenProcessed = true;
3987
- setTimeout(function() {
3991
+ peek(function() {
3988
3992
  if (isInserted) processTemplateNodes(currentNodes);
3989
- }, 0);
3993
+ });
3990
3994
  }
3991
3995
  }
3992
3996
  else {
package/dist/ssg.js CHANGED
@@ -4516,37 +4516,38 @@ catch (e2) {
4516
4516
  pick.el.__stx_shown_at = performance.now();
4517
4517
  if (!pick.childrenProcessed) {
4518
4518
  pick.childrenProcessed = true;
4519
- // Defer child processing (same rationale as bindIf, CLAUDE.md
4520
- // item 35): keep child effects from subscribing to THIS chain
4521
- // effect's tracked signals.
4522
- (function (branch) {
4523
- setTimeout(function () {
4524
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
4525
- // Components compiled inside any branch of an if/else-if/else
4526
- // chain carry scoped setup scripts with them. Branch nodes are
4527
- // detached before those scripts can execute, so simply
4528
- // re-inserting the selected branch leaves component props,
4529
- // events, directives, and projected slot expressions inert.
4530
- // Hydrate those scopes before the normal subtree walk, matching
4531
- // the single-template :if and :for insertion paths.
4532
- var previouslyTrackedNodes = new Set();
4533
- branch.nodes.forEach(function (n) {
4534
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
4535
- });
4536
- hydrateComponentScopes(branch.nodes, childScope);
4537
- branch.nodes.forEach(function (n) {
4538
- if (n.nodeType !== 1) return; // whitespace/text between template children
4539
- // A scoped component receives its disposer in the outer scope
4540
- // walk immediately after processElement returns from binding
4541
- // this conditional. That first pass intentionally stops at
4542
- // :if, so a disposer does not mean its children were hydrated.
4543
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
4544
- processElement(n, childScope);
4545
- n.removeAttribute('x-cloak');
4546
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
4547
- });
4548
- }, 0);
4549
- })(pick);
4519
+ // Hydrate before the outer scope walk can see the inserted branch.
4520
+ // Chromium executes scripts cloned from template.content as soon as
4521
+ // they are connected, so deferring this pass allowed the global walk
4522
+ // to process projected slot expressions without the loop caller
4523
+ // scope. peek() keeps this synchronous pass from subscribing child
4524
+ // reads to the current chain effect.
4525
+ peek(function () {
4526
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
4527
+ // Components compiled inside any branch of an if/else-if/else
4528
+ // chain carry scoped setup scripts with them. Branch nodes are
4529
+ // detached before those scripts can execute, so simply
4530
+ // re-inserting the selected branch leaves component props,
4531
+ // events, directives, and projected slot expressions inert.
4532
+ // Hydrate those scopes before the normal subtree walk, matching
4533
+ // the single-template :if and :for insertion paths.
4534
+ var previouslyTrackedNodes = new Set();
4535
+ pick.nodes.forEach(function (n) {
4536
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
4537
+ });
4538
+ hydrateComponentScopes(pick.nodes, childScope);
4539
+ pick.nodes.forEach(function (n) {
4540
+ if (n.nodeType !== 1) return; // whitespace/text between template children
4541
+ // A scoped component receives its disposer in the outer scope
4542
+ // walk immediately after processElement returns from binding
4543
+ // this conditional. That first pass intentionally stops at
4544
+ // :if, so a disposer does not mean its children were hydrated.
4545
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
4546
+ processElement(n, childScope);
4547
+ n.removeAttribute('x-cloak');
4548
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
4549
+ });
4550
+ });
4550
4551
  }
4551
4552
  }
4552
4553
 
@@ -4717,10 +4718,13 @@ else if (!value && isInserted) {
4717
4718
  else if (value && isInserted && !childrenProcessed) {
4718
4719
  // Initial template content is cloned before the effect runs. Process
4719
4720
  // it after the condition is confirmed so hidden branches stay inert.
4721
+ // Keep hydration synchronous so the outer scope walk cannot bind
4722
+ // caller-owned slot expressions first, while peek() prevents child
4723
+ // reads from subscribing to this conditional effect.
4720
4724
  childrenProcessed = true;
4721
- setTimeout(function() {
4725
+ peek(function() {
4722
4726
  if (isInserted) processTemplateNodes(currentNodes);
4723
- }, 0);
4727
+ });
4724
4728
  }
4725
4729
  }
4726
4730
  else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.124",
4
+ "version": "0.2.125",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -117,12 +117,12 @@
117
117
  "dependencies": {
118
118
  "@cwcss/crosswind": "^0.2.12",
119
119
  "@stacksjs/clapp": "^0.2.0",
120
- "@stacksjs/desktop": "0.2.124",
121
- "@stacksjs/sanitizer": "0.2.124",
120
+ "@stacksjs/desktop": "0.2.125",
121
+ "@stacksjs/sanitizer": "0.2.125",
122
122
  "@stacksjs/ts-i18n": "^0.1.11",
123
- "bun-plugin-stx": "0.2.124",
123
+ "bun-plugin-stx": "0.2.125",
124
124
  "bunfig": "^0.15.15",
125
- "stx-router": "0.2.124",
125
+ "stx-router": "0.2.125",
126
126
  "ts-broadcasting": "^0.0.9",
127
127
  "ts-images": "^0.1.9",
128
128
  "ts-syntax-highlighter": "^0.2.1"