@sprlab/wccompiler 0.5.13 → 0.5.14

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 (2) hide show
  1. package/lib/tree-walker.js +10 -8
  2. package/package.json +1 -1
@@ -369,17 +369,19 @@ export function walkBranch(html, signalNames, computedNames, propNames) {
369
369
  const { document } = parseHTML(`<div id="__branchRoot">${html}</div>`);
370
370
  const branchRoot = document.getElementById('__branchRoot');
371
371
 
372
- // Use walkTree on the branch root to discover bindings/events
373
- const result = walkTree(branchRoot, signalNames, computedNames, propNames);
374
-
375
- // Detect nested each directives within the branch template
372
+ // Process nested structural directives FIRST (before walkTree modifies the DOM).
373
+ // This is critical because walkTree clears textContent of elements with sole
374
+ // {{interpolation}} children, which would destroy content needed by
375
+ // processForBlocks/processIfChains when they clone nested elements for their
376
+ // own walkBranch calls.
376
377
  const forBlocks = processForBlocks(branchRoot, [], signalNames, computedNames, propNames);
377
-
378
- // Detect nested if/else-if/else chains within the branch template
379
378
  const ifBlocks = processIfChains(branchRoot, [], signalNames, computedNames, propNames);
380
379
 
381
- // Capture the processed HTML AFTER all processing (walkTree + processForBlocks + processIfChains)
382
- // since processForBlocks/processIfChains modify the DOM by replacing elements with comment nodes
380
+ // Now run walkTree on the remaining DOM (nested directive elements have been
381
+ // replaced with comment nodes, so walkTree won't process their contents).
382
+ const result = walkTree(branchRoot, signalNames, computedNames, propNames);
383
+
384
+ // Capture the processed HTML AFTER all processing
383
385
  const processedHtml = branchRoot.innerHTML;
384
386
 
385
387
  // Strip the first path segment from all paths since at runtime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "Zero-runtime compiler that transforms .wcc single-file components into native web components with signals-based reactivity",
5
5
  "type": "module",
6
6
  "bin": {