@sprlab/wccompiler 0.9.0 → 0.9.1
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/lib/codegen.js +7 -5
- package/package.json +1 -1
package/lib/codegen.js
CHANGED
|
@@ -1170,16 +1170,18 @@ export function generateComponent(parseResult, options = {}) {
|
|
|
1170
1170
|
// ── Deferred slot re-check (Angular compatibility) ──
|
|
1171
1171
|
// Angular connects custom elements to DOM BEFORE projecting children.
|
|
1172
1172
|
// If no slot content was found on first pass, schedule a microtask retry.
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1173
|
+
// We save a reference to the rendered root node so the microtask can filter it out
|
|
1174
|
+
// and only process children that were projected by the framework after connectedCallback.
|
|
1175
1175
|
if (slots.length > 0) {
|
|
1176
1176
|
lines.push(' if (Object.keys(__slotMap).length === 0 && __defaultSlotNodes.length === 0) {');
|
|
1177
|
+
lines.push(' const __renderedRoot = this.firstElementChild;');
|
|
1177
1178
|
lines.push(' queueMicrotask(() => {');
|
|
1178
1179
|
lines.push(' const __sm = {};');
|
|
1179
1180
|
lines.push(' const __dn = [];');
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
lines.push('
|
|
1181
|
+
lines.push(' for (const child of Array.from(this.childNodes)) {');
|
|
1182
|
+
// Skip the rendered template root and any whitespace text nodes that were there before
|
|
1183
|
+
lines.push(' if (child === __renderedRoot) continue;');
|
|
1184
|
+
lines.push(' if (child.nodeType === 3 && !child.textContent.trim()) continue;');
|
|
1183
1185
|
lines.push(" if (child.nodeName === 'TEMPLATE') {");
|
|
1184
1186
|
lines.push(' for (const attr of child.attributes) {');
|
|
1185
1187
|
lines.push(" if (attr.name.startsWith('#')) {");
|
package/package.json
CHANGED