@sprlab/wccompiler 0.16.11 → 0.16.12
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 +1 -18
- package/package.json +1 -1
package/lib/codegen.js
CHANGED
|
@@ -1165,16 +1165,6 @@ export function generateComponent(parseResult, options = {}) {
|
|
|
1165
1165
|
lines.push(" child.removeAttribute('slot-props');");
|
|
1166
1166
|
lines.push(" __slotMap[slotName] = { content: propsExpr ? child.innerHTML : child.outerHTML, propsExpr };");
|
|
1167
1167
|
lines.push(" } else if (child.nodeType === 1) {");
|
|
1168
|
-
// NEW: check for slot-template-<name> attributes (React/Angular string attribute pattern)
|
|
1169
|
-
lines.push(" for (const attr of Array.from(child.attributes)) {");
|
|
1170
|
-
lines.push(" if (attr.name.startsWith('slot-template-')) {");
|
|
1171
|
-
lines.push(" const slotName = attr.name.slice('slot-template-'.length);");
|
|
1172
|
-
lines.push(" if (!__slotMap[slotName]) {");
|
|
1173
|
-
lines.push(" __slotMap[slotName] = { content: attr.value, propsExpr: '' };");
|
|
1174
|
-
lines.push(" }");
|
|
1175
|
-
lines.push(" child.removeAttribute(attr.name);");
|
|
1176
|
-
lines.push(" }");
|
|
1177
|
-
lines.push(" }");
|
|
1178
1168
|
lines.push(" __defaultSlotNodes.push(child);");
|
|
1179
1169
|
lines.push(" } else if (child.nodeType === 3 && child.textContent.trim()) {");
|
|
1180
1170
|
lines.push(' __defaultSlotNodes.push(child);');
|
|
@@ -1327,15 +1317,8 @@ export function generateComponent(parseResult, options = {}) {
|
|
|
1327
1317
|
lines.push(" __sm[sn] = { content: pe ? child.innerHTML : child.outerHTML, propsExpr: pe };");
|
|
1328
1318
|
lines.push(" child.remove();");
|
|
1329
1319
|
lines.push(" } else if (child.nodeType === 1) {");
|
|
1330
|
-
lines.push(" for (const attr of Array.from(child.attributes)) {");
|
|
1331
|
-
lines.push(" if (attr.name.startsWith('slot-template-')) {");
|
|
1332
|
-
lines.push(" const sn = attr.name.slice('slot-template-'.length);");
|
|
1333
|
-
lines.push(" if (!__sm[sn]) { __sm[sn] = { content: attr.value, propsExpr: '' }; }");
|
|
1334
|
-
lines.push(" child.removeAttribute(attr.name);");
|
|
1335
|
-
lines.push(" }");
|
|
1336
|
-
lines.push(" }");
|
|
1337
1320
|
lines.push(" __dn.push(child);");
|
|
1338
|
-
lines.push(" } else if (child.nodeType === 3 && child.textContent.trim()) {");
|
|
1321
|
+
lines.push(" } else if (child.nodeType === 3 && child.textContent.trim()) {",);
|
|
1339
1322
|
lines.push(" __dn.push(child);");
|
|
1340
1323
|
lines.push(' }');
|
|
1341
1324
|
lines.push(' }');
|
package/package.json
CHANGED