@torpor/view 0.4.16 → 0.4.17
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/compile.cjs +11 -4
- package/dist/compile.mjs +11 -4
- package/dist/compile.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compile.cjs
CHANGED
|
@@ -506,6 +506,11 @@ function elementTypeName(node) {
|
|
|
506
506
|
case "a": return "HTMLAnchorElement";
|
|
507
507
|
case "img": return "HTMLImageElement";
|
|
508
508
|
case "textarea": return "HTMLTextAreaElement";
|
|
509
|
+
case "svg": return "SVGElement";
|
|
510
|
+
case "line":
|
|
511
|
+
case "text":
|
|
512
|
+
case "path":
|
|
513
|
+
case "rect": return `SVG${node.tagName.substring(0, 1).toUpperCase() + node.tagName.substring(1)}Element`;
|
|
509
514
|
}
|
|
510
515
|
return "HTMLElement";
|
|
511
516
|
}
|
|
@@ -1611,8 +1616,9 @@ function buildElementAttributes$1(node, varName, status, b) {
|
|
|
1611
1616
|
const propName = status.ns ? "className.baseVal" : "className";
|
|
1612
1617
|
stashRun(fragment, `${status.ns ? "// @ts-ignore\n" : ""}${varName}.${propName} = t_class(`, params.join(", "), ");", span, status);
|
|
1613
1618
|
} else if (name === "style") {
|
|
1619
|
+
status.imports.add("t_attribute");
|
|
1614
1620
|
status.imports.add("t_style");
|
|
1615
|
-
stashRun(fragment,
|
|
1621
|
+
stashRun(fragment, `t_attribute(${varName}, "style", t_style(`, value, ") || null);", span, status);
|
|
1616
1622
|
} else if (name.includes("-")) {
|
|
1617
1623
|
status.imports.add("t_attribute");
|
|
1618
1624
|
stashRun(fragment, `t_attribute(${varName}, "${name}", `, value, ");", span, status);
|
|
@@ -2430,13 +2436,14 @@ function buildElementAttributes(node, status) {
|
|
|
2430
2436
|
params.push(`"torp-${status.styleHash}"`);
|
|
2431
2437
|
needsClass = false;
|
|
2432
2438
|
}
|
|
2433
|
-
|
|
2439
|
+
value = params.join(", ");
|
|
2440
|
+
attributes.push(`\${t_class(${value}) !== "" ? \`class="\${t_class(${value})}"\` : ""}`);
|
|
2434
2441
|
} else if (name === "style") {
|
|
2435
2442
|
status.imports.add("t_style");
|
|
2436
|
-
attributes.push(
|
|
2443
|
+
attributes.push(`\${t_style(${value}) !== "" ? \`style="\${t_style(${value})}"\` : ""}`);
|
|
2437
2444
|
} else {
|
|
2438
2445
|
status.imports.add("t_attr");
|
|
2439
|
-
attributes.push(`\${${value} ? \`${name}="\${t_attr(${value})}"\` :
|
|
2446
|
+
attributes.push(`\${${value} ? \`${name}="\${t_attr(${value})}"\` : ""}`);
|
|
2440
2447
|
}
|
|
2441
2448
|
else if (value != null && reactive) {
|
|
2442
2449
|
status.imports.add("t_attr");
|
package/dist/compile.mjs
CHANGED
|
@@ -505,6 +505,11 @@ function elementTypeName(node) {
|
|
|
505
505
|
case "a": return "HTMLAnchorElement";
|
|
506
506
|
case "img": return "HTMLImageElement";
|
|
507
507
|
case "textarea": return "HTMLTextAreaElement";
|
|
508
|
+
case "svg": return "SVGElement";
|
|
509
|
+
case "line":
|
|
510
|
+
case "text":
|
|
511
|
+
case "path":
|
|
512
|
+
case "rect": return `SVG${node.tagName.substring(0, 1).toUpperCase() + node.tagName.substring(1)}Element`;
|
|
508
513
|
}
|
|
509
514
|
return "HTMLElement";
|
|
510
515
|
}
|
|
@@ -1610,8 +1615,9 @@ function buildElementAttributes$1(node, varName, status, b) {
|
|
|
1610
1615
|
const propName = status.ns ? "className.baseVal" : "className";
|
|
1611
1616
|
stashRun(fragment, `${status.ns ? "// @ts-ignore\n" : ""}${varName}.${propName} = t_class(`, params.join(", "), ");", span, status);
|
|
1612
1617
|
} else if (name === "style") {
|
|
1618
|
+
status.imports.add("t_attribute");
|
|
1613
1619
|
status.imports.add("t_style");
|
|
1614
|
-
stashRun(fragment,
|
|
1620
|
+
stashRun(fragment, `t_attribute(${varName}, "style", t_style(`, value, ") || null);", span, status);
|
|
1615
1621
|
} else if (name.includes("-")) {
|
|
1616
1622
|
status.imports.add("t_attribute");
|
|
1617
1623
|
stashRun(fragment, `t_attribute(${varName}, "${name}", `, value, ");", span, status);
|
|
@@ -2429,13 +2435,14 @@ function buildElementAttributes(node, status) {
|
|
|
2429
2435
|
params.push(`"torp-${status.styleHash}"`);
|
|
2430
2436
|
needsClass = false;
|
|
2431
2437
|
}
|
|
2432
|
-
|
|
2438
|
+
value = params.join(", ");
|
|
2439
|
+
attributes.push(`\${t_class(${value}) !== "" ? \`class="\${t_class(${value})}"\` : ""}`);
|
|
2433
2440
|
} else if (name === "style") {
|
|
2434
2441
|
status.imports.add("t_style");
|
|
2435
|
-
attributes.push(
|
|
2442
|
+
attributes.push(`\${t_style(${value}) !== "" ? \`style="\${t_style(${value})}"\` : ""}`);
|
|
2436
2443
|
} else {
|
|
2437
2444
|
status.imports.add("t_attr");
|
|
2438
|
-
attributes.push(`\${${value} ? \`${name}="\${t_attr(${value})}"\` :
|
|
2445
|
+
attributes.push(`\${${value} ? \`${name}="\${t_attr(${value})}"\` : ""}`);
|
|
2439
2446
|
}
|
|
2440
2447
|
else if (value != null && reactive) {
|
|
2441
2448
|
status.imports.add("t_attr");
|