marko 6.0.146 → 6.0.148

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.
@@ -3521,7 +3521,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
3521
3521
  [scopeIdentifier],
3522
3522
  getScopeExpression(section, closure.section)
3523
3523
  ),
3524
- some(closure.closureSections, underTryPlaceholder) ? import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure)) : void 0
3524
+ some(closure.closureSections, underTryPlaceholder) ? import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure, "pending")) : void 0
3525
3525
  );
3526
3526
  };
3527
3527
  }
@@ -4136,7 +4136,9 @@ function writeHTMLResumeStatements(path7) {
4136
4136
  callRuntime(
4137
4137
  "_script",
4138
4138
  getScopeIdIdentifier(section),
4139
- import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure))
4139
+ import_compiler22.types.stringLiteral(
4140
+ getResumeRegisterId(section, closure, "pending")
4141
+ )
4140
4142
  )
4141
4143
  )
4142
4144
  )
@@ -5633,7 +5635,7 @@ var native_tag_default = {
5633
5635
  }
5634
5636
  }
5635
5637
  }
5636
- if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || getRelatedControllable(tagName, seen)?.special) {
5638
+ if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || isDynamicControllable(getRelatedControllable(tagName, seen))) {
5637
5639
  const tagExtra = node.extra ??= {};
5638
5640
  const tagSection = getOrCreateSection(tag);
5639
5641
  const nodeBinding = tagExtra[kNativeTagBinding] = createBinding(
@@ -5713,6 +5715,7 @@ var native_tag_default = {
5713
5715
  write`${callRuntime("_attr_nonce")}`;
5714
5716
  }
5715
5717
  if (staticControllable) {
5718
+ const hasChangeHandler = !!staticControllable.attrs[1];
5716
5719
  if (tagName !== "select" && tagName !== "textarea") {
5717
5720
  write`${callRuntime(
5718
5721
  staticControllable.helper,
@@ -5721,7 +5724,7 @@ var native_tag_default = {
5721
5724
  ...staticControllable.attrs.map((attr) => attr?.value)
5722
5725
  )}`;
5723
5726
  }
5724
- if (!(staticControllable.special && !staticControllable.attrs[1])) {
5727
+ if (hasChangeHandler) {
5725
5728
  addHTMLEffectCall(tagSection, void 0);
5726
5729
  }
5727
5730
  }
@@ -6002,25 +6005,34 @@ var native_tag_default = {
6002
6005
  );
6003
6006
  }
6004
6007
  if (staticControllable) {
6005
- const { helper, attrs } = staticControllable;
6006
- const firstAttr = attrs.find(Boolean);
6008
+ const hasChangeHandler = !!staticControllable.attrs[1];
6009
+ const firstAttr = staticControllable.attrs.find(Boolean);
6007
6010
  const referencedBindings = firstAttr.value.extra?.referencedBindings;
6008
- const values = attrs.map((attr) => attr?.value);
6011
+ const values = (hasChangeHandler ? staticControllable.attrs : staticControllable.attrs.toSpliced(1, 1)).map((attr) => attr?.value);
6009
6012
  addStatement(
6010
6013
  "render",
6011
6014
  tagSection,
6012
6015
  referencedBindings,
6013
6016
  import_compiler32.types.expressionStatement(
6014
- callRuntime(helper, scopeIdentifier, visitAccessor, ...values)
6017
+ callRuntime(
6018
+ hasChangeHandler ? staticControllable.helper : `${staticControllable.helper}_default`,
6019
+ scopeIdentifier,
6020
+ visitAccessor,
6021
+ ...values
6022
+ )
6015
6023
  )
6016
6024
  );
6017
- if (!(staticControllable.special && !attrs[1])) {
6025
+ if (hasChangeHandler) {
6018
6026
  addStatement(
6019
6027
  "effect",
6020
6028
  tagSection,
6021
6029
  void 0,
6022
6030
  import_compiler32.types.expressionStatement(
6023
- callRuntime(`${helper}_script`, scopeIdentifier, visitAccessor)
6031
+ callRuntime(
6032
+ `${staticControllable.helper}_script`,
6033
+ scopeIdentifier,
6034
+ visitAccessor
6035
+ )
6024
6036
  )
6025
6037
  );
6026
6038
  }
@@ -6345,7 +6357,7 @@ function getUsedAttrs(tagName, tag) {
6345
6357
  }
6346
6358
  if (!spreadProps) {
6347
6359
  staticControllable = getRelatedControllable(tagName, seen);
6348
- if (staticControllable?.special === false && !staticControllable.attrs[1]) {
6360
+ if (!isDynamicControllable(staticControllable)) {
6349
6361
  staticControllable = void 0;
6350
6362
  }
6351
6363
  }
@@ -6513,6 +6525,12 @@ function trackDelimitedAttrObjectProperties(obj, meta) {
6513
6525
  (meta.dynamicItems ||= []).push(import_compiler32.types.objectExpression(dynamicProps));
6514
6526
  }
6515
6527
  }
6528
+ function isDynamicControllable(controllable) {
6529
+ if (controllable) {
6530
+ return controllable.special || !!(controllable.attrs[1] || controllable.attrs.find(Boolean).value.extra?.referencedBindings);
6531
+ }
6532
+ return false;
6533
+ }
6516
6534
  function buildUndefined2() {
6517
6535
  return import_compiler32.types.unaryExpression("void", import_compiler32.types.numericLiteral(0));
6518
6536
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.146",
3
+ "version": "6.0.148",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",