@marko/runtime-tags 6.0.118 → 6.0.119
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/translator/index.js +63 -60
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
|
@@ -5528,7 +5528,7 @@ var native_tag_default = {
|
|
|
5528
5528
|
);
|
|
5529
5529
|
}
|
|
5530
5530
|
const tagName = getCanonicalTagName(tag);
|
|
5531
|
-
const
|
|
5531
|
+
const isTextOnly = isTextOnlyNativeTag(tag);
|
|
5532
5532
|
const seen = {};
|
|
5533
5533
|
const { attributes } = tag.node;
|
|
5534
5534
|
let injectNonce = isInjectNonceTag(tagName);
|
|
@@ -5573,7 +5573,7 @@ var native_tag_default = {
|
|
|
5573
5573
|
throw tag.get("name").buildCodeFrameError(msg);
|
|
5574
5574
|
});
|
|
5575
5575
|
let textPlaceholders;
|
|
5576
|
-
if (
|
|
5576
|
+
if (isTextOnly) {
|
|
5577
5577
|
for (const child of tag.node.body.body) {
|
|
5578
5578
|
if (import_compiler33.types.isMarkoPlaceholder(child)) {
|
|
5579
5579
|
(textPlaceholders ||= []).push(child.value);
|
|
@@ -5762,10 +5762,11 @@ var native_tag_default = {
|
|
|
5762
5762
|
}
|
|
5763
5763
|
}
|
|
5764
5764
|
const isOpenOnly = !!(tagDef && tagDef.parseOptions?.openTagOnly);
|
|
5765
|
+
const isTextOnly = isTextOnlyNativeTag(tag);
|
|
5765
5766
|
const hasChildren = !!tag.node.body.body.length;
|
|
5766
5767
|
if (spreadExpression) {
|
|
5767
5768
|
addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
|
|
5768
|
-
if (isOpenOnly || hasChildren || staticContentAttr) {
|
|
5769
|
+
if (isTextOnly || isOpenOnly || hasChildren || staticContentAttr) {
|
|
5769
5770
|
if (skipExpression) {
|
|
5770
5771
|
write`${callRuntime(
|
|
5771
5772
|
"_attrs_partial",
|
|
@@ -5796,57 +5797,57 @@ var native_tag_default = {
|
|
|
5796
5797
|
write`>`;
|
|
5797
5798
|
break;
|
|
5798
5799
|
}
|
|
5799
|
-
} else {
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5800
|
+
} else if (isTextOnly) {
|
|
5801
|
+
write`>`;
|
|
5802
|
+
} else if (staticContentAttr) {
|
|
5803
|
+
write`>`;
|
|
5804
|
+
tagExtra[kTagContentAttr] = true;
|
|
5805
|
+
tag.node.body.body = [
|
|
5806
|
+
import_compiler33.types.expressionStatement(
|
|
5807
|
+
callRuntime(
|
|
5808
|
+
"_attr_content",
|
|
5809
|
+
visitAccessor,
|
|
5810
|
+
getScopeIdIdentifier(tagSection),
|
|
5811
|
+
staticContentAttr.value,
|
|
5812
|
+
getSerializeGuard(
|
|
5813
|
+
tagSection,
|
|
5814
|
+
nodeBinding && getSerializeReason(tagSection, nodeBinding),
|
|
5815
|
+
true
|
|
5815
5816
|
)
|
|
5816
5817
|
)
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
) : import_compiler33.types.expressionStatement(
|
|
5837
|
-
callRuntime(
|
|
5838
|
-
"_attrs_content",
|
|
5839
|
-
spreadExpression,
|
|
5840
|
-
visitAccessor,
|
|
5841
|
-
getScopeIdIdentifier(tagSection),
|
|
5842
|
-
import_compiler33.types.stringLiteral(tagName),
|
|
5843
|
-
serializeReason
|
|
5844
|
-
)
|
|
5818
|
+
)
|
|
5819
|
+
];
|
|
5820
|
+
} else if (spreadExpression && !hasChildren) {
|
|
5821
|
+
const serializeReason = getSerializeGuard(
|
|
5822
|
+
tagSection,
|
|
5823
|
+
nodeBinding && getSerializeReason(tagSection, nodeBinding),
|
|
5824
|
+
true
|
|
5825
|
+
);
|
|
5826
|
+
tagExtra[kTagContentAttr] = true;
|
|
5827
|
+
tag.node.body.body = [
|
|
5828
|
+
skipExpression ? import_compiler33.types.expressionStatement(
|
|
5829
|
+
callRuntime(
|
|
5830
|
+
"_attrs_partial_content",
|
|
5831
|
+
spreadExpression,
|
|
5832
|
+
skipExpression,
|
|
5833
|
+
visitAccessor,
|
|
5834
|
+
getScopeIdIdentifier(tagSection),
|
|
5835
|
+
import_compiler33.types.stringLiteral(tagName),
|
|
5836
|
+
serializeReason
|
|
5845
5837
|
)
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5838
|
+
) : import_compiler33.types.expressionStatement(
|
|
5839
|
+
callRuntime(
|
|
5840
|
+
"_attrs_content",
|
|
5841
|
+
spreadExpression,
|
|
5842
|
+
visitAccessor,
|
|
5843
|
+
getScopeIdIdentifier(tagSection),
|
|
5844
|
+
import_compiler33.types.stringLiteral(tagName),
|
|
5845
|
+
serializeReason
|
|
5846
|
+
)
|
|
5847
|
+
)
|
|
5848
|
+
];
|
|
5849
|
+
} else {
|
|
5850
|
+
write`>`;
|
|
5850
5851
|
}
|
|
5851
5852
|
if (writeAtStartOfBody) {
|
|
5852
5853
|
write`${writeAtStartOfBody}`;
|
|
@@ -5855,8 +5856,8 @@ var native_tag_default = {
|
|
|
5855
5856
|
exit(tag) {
|
|
5856
5857
|
const tagExtra = tag.node.extra;
|
|
5857
5858
|
const nodeBinding = tagExtra[kNativeTagBinding];
|
|
5858
|
-
const
|
|
5859
|
-
const
|
|
5859
|
+
const isOpenOnly = (0, import_babel_utils21.getTagDef)(tag)?.parseOptions?.openTagOnly;
|
|
5860
|
+
const isTextOnly = isTextOnlyNativeTag(tag);
|
|
5860
5861
|
const selectArgs = htmlSelectArgs.get(tag.node);
|
|
5861
5862
|
const tagName = getCanonicalTagName(tag);
|
|
5862
5863
|
const tagSection = getSection(tag);
|
|
@@ -5888,7 +5889,7 @@ var native_tag_default = {
|
|
|
5888
5889
|
)
|
|
5889
5890
|
)
|
|
5890
5891
|
);
|
|
5891
|
-
} else if (
|
|
5892
|
+
} else if (isTextOnly) {
|
|
5892
5893
|
for (const child of tag.node.body.body) {
|
|
5893
5894
|
if (import_compiler33.types.isMarkoText(child)) {
|
|
5894
5895
|
write`${child.value}`;
|
|
@@ -5899,7 +5900,7 @@ var native_tag_default = {
|
|
|
5899
5900
|
} else {
|
|
5900
5901
|
tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
|
|
5901
5902
|
}
|
|
5902
|
-
if (!tagExtra[kSkipEndTag] && !
|
|
5903
|
+
if (!tagExtra[kSkipEndTag] && !isOpenOnly && !selectArgs) {
|
|
5903
5904
|
write`</${tagName}>`;
|
|
5904
5905
|
}
|
|
5905
5906
|
if (markerSerializeReason) {
|
|
@@ -5930,6 +5931,7 @@ var native_tag_default = {
|
|
|
5930
5931
|
injectNonce
|
|
5931
5932
|
} = getUsedAttrs(tagName, tag.node);
|
|
5932
5933
|
const isOpenOnly = !!(tagDef && tagDef.parseOptions?.openTagOnly);
|
|
5934
|
+
const isTextOnly = isTextOnlyNativeTag(tag);
|
|
5933
5935
|
const hasChildren = !!tag.node.body.body.length;
|
|
5934
5936
|
if (injectNonce) {
|
|
5935
5937
|
addStatement(
|
|
@@ -6069,7 +6071,7 @@ var native_tag_default = {
|
|
|
6069
6071
|
}
|
|
6070
6072
|
}
|
|
6071
6073
|
if (spreadExpression) {
|
|
6072
|
-
const canHaveAttrContent = !(isOpenOnly || hasChildren || staticContentAttr);
|
|
6074
|
+
const canHaveAttrContent = !(isTextOnly || isOpenOnly || hasChildren || staticContentAttr);
|
|
6073
6075
|
if (skipExpression) {
|
|
6074
6076
|
addStatement(
|
|
6075
6077
|
"render",
|
|
@@ -6144,12 +6146,13 @@ var native_tag_default = {
|
|
|
6144
6146
|
const tagExtra = tag.node.extra;
|
|
6145
6147
|
const nodeBinding = tagExtra[kNativeTagBinding];
|
|
6146
6148
|
const openTagOnly = (0, import_babel_utils21.getTagDef)(tag)?.parseOptions?.openTagOnly;
|
|
6147
|
-
const
|
|
6149
|
+
const tagName = getCanonicalTagName(tag);
|
|
6148
6150
|
if (!openTagOnly) {
|
|
6149
|
-
|
|
6151
|
+
const write = writeTo(tag);
|
|
6152
|
+
if (tagName !== "textarea" && isTextOnlyNativeTag(tag)) {
|
|
6150
6153
|
const textLiteral = bodyToTextLiteral(tag.node.body);
|
|
6151
6154
|
if (import_compiler33.types.isStringLiteral(textLiteral)) {
|
|
6152
|
-
|
|
6155
|
+
write`${textLiteral}`;
|
|
6153
6156
|
} else {
|
|
6154
6157
|
addStatement(
|
|
6155
6158
|
"render",
|
|
@@ -6167,7 +6170,7 @@ var native_tag_default = {
|
|
|
6167
6170
|
} else {
|
|
6168
6171
|
tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
|
|
6169
6172
|
}
|
|
6170
|
-
|
|
6173
|
+
write`</${tagName}>`;
|
|
6171
6174
|
}
|
|
6172
6175
|
exit2(tag);
|
|
6173
6176
|
tag.remove();
|