marko 6.0.74 → 6.0.76

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.
@@ -46,6 +46,7 @@ __export(html_exports, {
46
46
  _escape: () => _escape,
47
47
  _escape_script: () => _escape_script,
48
48
  _escape_style: () => _escape_style,
49
+ _escape_textarea_value: () => _escape_textarea_value,
49
50
  _existing_scope: () => _existing_scope,
50
51
  _for_in: () => _for_in,
51
52
  _for_of: () => _for_of,
@@ -171,7 +172,7 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
171
172
  function _escape(val) {
172
173
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
173
174
  }
174
- function escapeTextAreaValue(val) {
175
+ function _escape_textarea_value(val) {
175
176
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
176
177
  }
177
178
  var unsafeScriptReg = /<\/script/g;
@@ -823,7 +824,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
823
824
  ref.debug = DEBUG.get(val);
824
825
  }
825
826
  if (write(state, val, ref)) return true;
826
- state.refs.delete(ref);
827
+ state.refs.delete(val);
827
828
  return false;
828
829
  }
829
830
  function writeRegistered(state, val, parent, accessor, { access, scope, getter }) {
@@ -2712,7 +2713,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2712
2713
  valueChange
2713
2714
  );
2714
2715
  }
2715
- return escapeTextAreaValue(value);
2716
+ return _escape_textarea_value(value);
2716
2717
  }
2717
2718
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
2718
2719
  if (valueChange) {
@@ -3461,6 +3462,7 @@ function NOOP3() {
3461
3462
  _escape,
3462
3463
  _escape_script,
3463
3464
  _escape_style,
3465
+ _escape_textarea_value,
3464
3466
  _existing_scope,
3465
3467
  _for_in,
3466
3468
  _for_of,
@@ -85,7 +85,7 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
85
85
  function _escape(val) {
86
86
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
87
87
  }
88
- function escapeTextAreaValue(val) {
88
+ function _escape_textarea_value(val) {
89
89
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
90
90
  }
91
91
  var unsafeScriptReg = /<\/script/g;
@@ -737,7 +737,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
737
737
  ref.debug = DEBUG.get(val);
738
738
  }
739
739
  if (write(state, val, ref)) return true;
740
- state.refs.delete(ref);
740
+ state.refs.delete(val);
741
741
  return false;
742
742
  }
743
743
  function writeRegistered(state, val, parent, accessor, { access, scope, getter }) {
@@ -2626,7 +2626,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2626
2626
  valueChange
2627
2627
  );
2628
2628
  }
2629
- return escapeTextAreaValue(value);
2629
+ return _escape_textarea_value(value);
2630
2630
  }
2631
2631
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
2632
2632
  if (valueChange) {
@@ -3374,6 +3374,7 @@ export {
3374
3374
  _escape,
3375
3375
  _escape_script,
3376
3376
  _escape_style,
3377
+ _escape_textarea_value,
3377
3378
  _existing_scope,
3378
3379
  _for_in,
3379
3380
  _for_of,
@@ -1,5 +1,5 @@
1
1
  export declare function _unescaped(val: unknown): string;
2
2
  export declare function _escape(val: unknown): string;
3
- export declare function escapeTextAreaValue(val: unknown): string;
3
+ export declare function _escape_textarea_value(val: unknown): string;
4
4
  export declare function _escape_script(val: unknown): string;
5
5
  export declare function _escape_style(val: unknown): string;
package/dist/html.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
3
3
  export { compat } from "./html/compat";
4
- export { _escape, _escape_script, _escape_style, _unescaped, } from "./html/content";
4
+ export { _escape, _escape_script, _escape_style, _escape_textarea_value, _unescaped, } from "./html/content";
5
5
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
6
6
  export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
7
7
  export { _template } from "./html/template";
package/dist/html.js CHANGED
@@ -43,6 +43,7 @@ __export(html_exports, {
43
43
  _escape: () => _escape,
44
44
  _escape_script: () => _escape_script,
45
45
  _escape_style: () => _escape_style,
46
+ _escape_textarea_value: () => _escape_textarea_value,
46
47
  _existing_scope: () => _existing_scope,
47
48
  _for_in: () => _for_in,
48
49
  _for_of: () => _for_of,
@@ -140,7 +141,7 @@ var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt
140
141
  function _escape(val) {
141
142
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
142
143
  }
143
- function escapeTextAreaValue(val) {
144
+ function _escape_textarea_value(val) {
144
145
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
145
146
  }
146
147
  var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
@@ -580,7 +581,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
580
581
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(
581
582
  val,
582
583
  ref = new Reference(parent, accessor, state.flush, state.buf.length)
583
- ), write(state, val, ref) ? !0 : (state.refs.delete(ref), !1));
584
+ ), write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
584
585
  }
585
586
  function writeRegistered(state, val, parent, accessor, { access, scope, getter }) {
586
587
  if (scope) {
@@ -1725,7 +1726,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1725
1726
  nodeAccessor,
1726
1727
  void 0,
1727
1728
  valueChange
1728
- ), escapeTextAreaValue(value);
1729
+ ), _escape_textarea_value(value);
1729
1730
  }
1730
1731
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
1731
1732
  return valueChange && writeControlledScope(
@@ -2254,6 +2255,7 @@ function NOOP3() {
2254
2255
  _escape,
2255
2256
  _escape_script,
2256
2257
  _escape_style,
2258
+ _escape_textarea_value,
2257
2259
  _existing_scope,
2258
2260
  _for_in,
2259
2261
  _for_of,
package/dist/html.mjs CHANGED
@@ -57,7 +57,7 @@ var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt
57
57
  function _escape(val) {
58
58
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
59
59
  }
60
- function escapeTextAreaValue(val) {
60
+ function _escape_textarea_value(val) {
61
61
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
62
62
  }
63
63
  var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
@@ -497,7 +497,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
497
497
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(
498
498
  val,
499
499
  ref = new Reference(parent, accessor, state.flush, state.buf.length)
500
- ), write(state, val, ref) ? !0 : (state.refs.delete(ref), !1));
500
+ ), write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
501
501
  }
502
502
  function writeRegistered(state, val, parent, accessor, { access, scope, getter }) {
503
503
  if (scope) {
@@ -1642,7 +1642,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1642
1642
  nodeAccessor,
1643
1643
  void 0,
1644
1644
  valueChange
1645
- ), escapeTextAreaValue(value);
1645
+ ), _escape_textarea_value(value);
1646
1646
  }
1647
1647
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
1648
1648
  return valueChange && writeControlledScope(
@@ -2170,6 +2170,7 @@ export {
2170
2170
  _escape,
2171
2171
  _escape_script,
2172
2172
  _escape_style,
2173
+ _escape_textarea_value,
2173
2174
  _existing_scope,
2174
2175
  _for_in,
2175
2176
  _for_of,
@@ -4775,7 +4775,7 @@ function trackParamsReferences(body, type, upstreamAlias) {
4775
4775
  section,
4776
4776
  paramsBinding,
4777
4777
  void 0,
4778
- addNumericPropertiesUntil(void 0, i - 1)
4778
+ i > 0 ? addNumericPropertiesUntil(void 0, i - 1) : void 0
4779
4779
  );
4780
4780
  } else if (import_compiler25.types.isLVal(param)) {
4781
4781
  createBindingsAndTrackReferences(
@@ -4978,10 +4978,7 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
4978
4978
  i++;
4979
4979
  if (element) {
4980
4980
  if (element.type === "RestElement") {
4981
- excludeProperties = addNumericPropertiesUntil(
4982
- excludeProperties,
4983
- i - 1
4984
- );
4981
+ excludeProperties = i > 0 ? addNumericPropertiesUntil(excludeProperties, i - 1) : void 0;
4985
4982
  createBindingsAndTrackReferences(
4986
4983
  element.argument,
4987
4984
  type,
@@ -6392,7 +6389,7 @@ var native_tag_default = {
6392
6389
  }
6393
6390
  }
6394
6391
  assertExclusiveControllableGroups(tag, seen);
6395
- if (node.var || hasEventHandlers || hasDynamicAttributes) {
6392
+ if (node.var || hasEventHandlers || hasDynamicAttributes || getRelatedControllable(tagName, seen)?.special) {
6396
6393
  const tagExtra = node.extra ??= {};
6397
6394
  const tagSection = getOrCreateSection(tag);
6398
6395
  const nodeBinding = tagExtra[kNativeTagBinding] = createBinding(
@@ -6400,7 +6397,9 @@ var native_tag_default = {
6400
6397
  0 /* dom */,
6401
6398
  tagSection
6402
6399
  );
6403
- (0, import_babel_utils25.getProgram)().node.extra.isInteractive ||= hasEventHandlers;
6400
+ if (hasEventHandlers) {
6401
+ (0, import_babel_utils25.getProgram)().node.extra.isInteractive = true;
6402
+ }
6404
6403
  if (spreadReferenceNodes) {
6405
6404
  if (relatedControllable && !relatedControllable.attrs.every(Boolean)) {
6406
6405
  for (const attr of relatedControllable.attrs) {
@@ -6486,12 +6485,17 @@ var native_tag_default = {
6486
6485
  const { staticAttrs, staticControllable, skipExpression } = usedAttrs;
6487
6486
  let { spreadExpression } = usedAttrs;
6488
6487
  if (staticControllable) {
6489
- const { helper, attrs } = staticControllable;
6490
6488
  if (tagName !== "select" && tagName !== "textarea") {
6491
- const values = attrs.map((attr) => attr?.value);
6492
- write`${callRuntime(helper, getScopeIdIdentifier(tagSection), visitAccessor, ...values)}`;
6489
+ write`${callRuntime(
6490
+ staticControllable.helper,
6491
+ getScopeIdIdentifier(tagSection),
6492
+ visitAccessor,
6493
+ ...staticControllable.attrs.map((attr) => attr?.value)
6494
+ )}`;
6495
+ }
6496
+ if (!(staticControllable.special && !staticControllable.attrs[1])) {
6497
+ addHTMLEffectCall(tagSection, void 0);
6493
6498
  }
6494
- addHTMLEffectCall(tagSection, void 0);
6495
6499
  }
6496
6500
  let writeAtStartOfBody;
6497
6501
  if (tagName === "select") {
@@ -6539,14 +6543,16 @@ var native_tag_default = {
6539
6543
  );
6540
6544
  spreadExpression = spreadIdentifier;
6541
6545
  }
6542
- if (value || valueChange) {
6546
+ if (valueChange) {
6543
6547
  writeAtStartOfBody = callRuntime(
6544
6548
  "_attr_textarea_value",
6545
6549
  getScopeIdIdentifier(getSection(tag)),
6546
- getScopeAccessorLiteral(nodeBinding),
6550
+ visitAccessor,
6547
6551
  value,
6548
6552
  valueChange
6549
6553
  );
6554
+ } else if (value) {
6555
+ writeAtStartOfBody = callRuntime("_escape_textarea_value", value);
6550
6556
  }
6551
6557
  }
6552
6558
  for (const attr of staticAttrs) {
@@ -6683,7 +6689,7 @@ var native_tag_default = {
6683
6689
  callRuntime(
6684
6690
  "_attr_select_value",
6685
6691
  getScopeIdIdentifier(getSection(tag)),
6686
- getScopeAccessorLiteral(nodeBinding),
6692
+ nodeBinding && getScopeAccessorLiteral(nodeBinding),
6687
6693
  selectArgs.value,
6688
6694
  selectArgs.valueChange,
6689
6695
  import_compiler32.types.arrowFunctionExpression(
@@ -6798,14 +6804,16 @@ var native_tag_default = {
6798
6804
  callRuntime(helper, scopeIdentifier, visitAccessor, ...values)
6799
6805
  )
6800
6806
  );
6801
- addStatement(
6802
- "effect",
6803
- tagSection,
6804
- void 0,
6805
- import_compiler32.types.expressionStatement(
6806
- callRuntime(`${helper}_script`, scopeIdentifier, visitAccessor)
6807
- )
6808
- );
6807
+ if (!(staticControllable.special && !attrs[1])) {
6808
+ addStatement(
6809
+ "effect",
6810
+ tagSection,
6811
+ void 0,
6812
+ import_compiler32.types.expressionStatement(
6813
+ callRuntime(`${helper}_script`, scopeIdentifier, visitAccessor)
6814
+ )
6815
+ );
6816
+ }
6809
6817
  }
6810
6818
  for (const attr of staticAttrs) {
6811
6819
  const { name: name2, value } = attr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.74",
3
+ "version": "6.0.76",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",