marko 6.0.146 → 6.0.147
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/debug/dom.js +160 -127
- package/dist/debug/dom.mjs +160 -127
- package/dist/dom/controllable.d.ts +5 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +94 -81
- package/dist/dom.mjs +94 -81
- package/dist/translator/index.js +25 -9
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
|
@@ -5633,7 +5633,7 @@ var native_tag_default = {
|
|
|
5633
5633
|
}
|
|
5634
5634
|
}
|
|
5635
5635
|
}
|
|
5636
|
-
if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || getRelatedControllable(tagName, seen)
|
|
5636
|
+
if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || isDynamicControllable(getRelatedControllable(tagName, seen))) {
|
|
5637
5637
|
const tagExtra = node.extra ??= {};
|
|
5638
5638
|
const tagSection = getOrCreateSection(tag);
|
|
5639
5639
|
const nodeBinding = tagExtra[kNativeTagBinding] = createBinding(
|
|
@@ -5713,6 +5713,7 @@ var native_tag_default = {
|
|
|
5713
5713
|
write`${callRuntime("_attr_nonce")}`;
|
|
5714
5714
|
}
|
|
5715
5715
|
if (staticControllable) {
|
|
5716
|
+
const hasChangeHandler = !!staticControllable.attrs[1];
|
|
5716
5717
|
if (tagName !== "select" && tagName !== "textarea") {
|
|
5717
5718
|
write`${callRuntime(
|
|
5718
5719
|
staticControllable.helper,
|
|
@@ -5721,7 +5722,7 @@ var native_tag_default = {
|
|
|
5721
5722
|
...staticControllable.attrs.map((attr) => attr?.value)
|
|
5722
5723
|
)}`;
|
|
5723
5724
|
}
|
|
5724
|
-
if (
|
|
5725
|
+
if (hasChangeHandler) {
|
|
5725
5726
|
addHTMLEffectCall(tagSection, void 0);
|
|
5726
5727
|
}
|
|
5727
5728
|
}
|
|
@@ -6002,25 +6003,34 @@ var native_tag_default = {
|
|
|
6002
6003
|
);
|
|
6003
6004
|
}
|
|
6004
6005
|
if (staticControllable) {
|
|
6005
|
-
const
|
|
6006
|
-
const firstAttr = attrs.find(Boolean);
|
|
6006
|
+
const hasChangeHandler = !!staticControllable.attrs[1];
|
|
6007
|
+
const firstAttr = staticControllable.attrs.find(Boolean);
|
|
6007
6008
|
const referencedBindings = firstAttr.value.extra?.referencedBindings;
|
|
6008
|
-
const values = attrs.map((attr) => attr?.value);
|
|
6009
|
+
const values = (hasChangeHandler ? staticControllable.attrs : staticControllable.attrs.toSpliced(1, 1)).map((attr) => attr?.value);
|
|
6009
6010
|
addStatement(
|
|
6010
6011
|
"render",
|
|
6011
6012
|
tagSection,
|
|
6012
6013
|
referencedBindings,
|
|
6013
6014
|
import_compiler32.types.expressionStatement(
|
|
6014
|
-
callRuntime(
|
|
6015
|
+
callRuntime(
|
|
6016
|
+
hasChangeHandler ? staticControllable.helper : `${staticControllable.helper}_default`,
|
|
6017
|
+
scopeIdentifier,
|
|
6018
|
+
visitAccessor,
|
|
6019
|
+
...values
|
|
6020
|
+
)
|
|
6015
6021
|
)
|
|
6016
6022
|
);
|
|
6017
|
-
if (
|
|
6023
|
+
if (hasChangeHandler) {
|
|
6018
6024
|
addStatement(
|
|
6019
6025
|
"effect",
|
|
6020
6026
|
tagSection,
|
|
6021
6027
|
void 0,
|
|
6022
6028
|
import_compiler32.types.expressionStatement(
|
|
6023
|
-
callRuntime(
|
|
6029
|
+
callRuntime(
|
|
6030
|
+
`${staticControllable.helper}_script`,
|
|
6031
|
+
scopeIdentifier,
|
|
6032
|
+
visitAccessor
|
|
6033
|
+
)
|
|
6024
6034
|
)
|
|
6025
6035
|
);
|
|
6026
6036
|
}
|
|
@@ -6345,7 +6355,7 @@ function getUsedAttrs(tagName, tag) {
|
|
|
6345
6355
|
}
|
|
6346
6356
|
if (!spreadProps) {
|
|
6347
6357
|
staticControllable = getRelatedControllable(tagName, seen);
|
|
6348
|
-
if (
|
|
6358
|
+
if (!isDynamicControllable(staticControllable)) {
|
|
6349
6359
|
staticControllable = void 0;
|
|
6350
6360
|
}
|
|
6351
6361
|
}
|
|
@@ -6513,6 +6523,12 @@ function trackDelimitedAttrObjectProperties(obj, meta) {
|
|
|
6513
6523
|
(meta.dynamicItems ||= []).push(import_compiler32.types.objectExpression(dynamicProps));
|
|
6514
6524
|
}
|
|
6515
6525
|
}
|
|
6526
|
+
function isDynamicControllable(controllable) {
|
|
6527
|
+
if (controllable) {
|
|
6528
|
+
return controllable.special || !!(controllable.attrs[1] || controllable.attrs.find(Boolean).value.extra?.referencedBindings);
|
|
6529
|
+
}
|
|
6530
|
+
return false;
|
|
6531
|
+
}
|
|
6516
6532
|
function buildUndefined2() {
|
|
6517
6533
|
return import_compiler32.types.unaryExpression("void", import_compiler32.types.numericLiteral(0));
|
|
6518
6534
|
}
|