marko 6.3.51 → 6.3.53

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.
Files changed (73) hide show
  1. package/dist/debug/dom/catch.feat.js +1 -1
  2. package/dist/debug/dom/catch.feat.mjs +1 -1
  3. package/dist/debug/dom/controllable-input.feat.js +1 -1
  4. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-open.feat.js +1 -1
  6. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-select.feat.js +1 -1
  8. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable.feat.js +1 -1
  12. package/dist/debug/dom/controllable.feat.mjs +1 -1
  13. package/dist/debug/dom/dynamic-tag-script.feat.js +5 -0
  14. package/dist/debug/dom/dynamic-tag-script.feat.mjs +4 -0
  15. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -4
  16. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -4
  17. package/dist/debug/dom/placeholder.feat.js +2 -2
  18. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  19. package/dist/debug/{dom-BAGeiafn.js → dom-CBLlE8L-.js} +46 -34
  20. package/dist/debug/{dom-C55iHvof.mjs → dom-DQCODUa1.mjs} +29 -23
  21. package/dist/debug/dom.js +11 -11
  22. package/dist/debug/dom.mjs +10 -10
  23. package/dist/debug/html.js +57 -41
  24. package/dist/debug/html.mjs +57 -41
  25. package/dist/dom/catch.feat.js +1 -1
  26. package/dist/dom/catch.feat.mjs +1 -1
  27. package/dist/dom/control-flow.d.ts +1 -3
  28. package/dist/dom/controllable-input.feat.js +1 -1
  29. package/dist/dom/controllable-input.feat.mjs +1 -1
  30. package/dist/dom/controllable-open.feat.js +1 -1
  31. package/dist/dom/controllable-open.feat.mjs +1 -1
  32. package/dist/dom/controllable-select.feat.js +1 -1
  33. package/dist/dom/controllable-select.feat.mjs +1 -1
  34. package/dist/dom/controllable-textarea.feat.js +1 -1
  35. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  36. package/dist/dom/controllable.feat.js +1 -1
  37. package/dist/dom/controllable.feat.mjs +1 -1
  38. package/dist/dom/dynamic-tag-script.feat.d.ts +1 -0
  39. package/dist/dom/dynamic-tag-script.feat.js +4 -0
  40. package/dist/dom/dynamic-tag-script.feat.mjs +4 -0
  41. package/dist/dom/dynamic-tag-var.feat.js +2 -2
  42. package/dist/dom/dynamic-tag-var.feat.mjs +3 -3
  43. package/dist/dom/placeholder.feat.js +2 -2
  44. package/dist/dom/placeholder.feat.mjs +2 -2
  45. package/dist/dom/resume.d.ts +2 -2
  46. package/dist/{dom-BNmfm4st.js → dom-vuB05Hnj.js} +37 -30
  47. package/dist/{dom-BsAS26Ze.mjs → dom-z4IMlmeO.mjs} +21 -19
  48. package/dist/dom.d.ts +2 -2
  49. package/dist/dom.js +15 -15
  50. package/dist/dom.mjs +10 -10
  51. package/dist/html/template.d.ts +3 -1
  52. package/dist/html/writer.d.ts +6 -1
  53. package/dist/html.js +41 -26
  54. package/dist/html.mjs +41 -26
  55. package/dist/translator/core/await.d.ts +0 -7
  56. package/dist/translator/core/try.d.ts +0 -7
  57. package/dist/translator/index.d.ts +1 -1
  58. package/dist/translator/index.js +830 -596
  59. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  60. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  61. package/dist/translator/util/evaluate.d.ts +2 -0
  62. package/dist/translator/util/optional.d.ts +21 -7
  63. package/dist/translator/util/references.d.ts +58 -23
  64. package/dist/translator/util/runtime.d.ts +3 -1
  65. package/dist/translator/util/sections.d.ts +8 -11
  66. package/dist/translator/util/serialize-guard.d.ts +4 -0
  67. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  68. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  69. package/dist/translator/util/tag-name-type.d.ts +8 -3
  70. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  71. package/index.d.ts +0 -5
  72. package/package.json +4 -4
  73. package/tags-html.d.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/catch.feat.ts
4
4
  const handlePendingTry = (fn, scope, branch) => {
5
5
  while (branch) {
@@ -1,4 +1,4 @@
1
- import { An as ParentBranch, Cn as Scope, Mn as PendingRenders, Sn as Pending, Tn as ClosestBranch, g as renderCatch, jn as PendingEffects, nn as installCatch, rn as placeholderShown, tn as caughtError } from "../dom-C55iHvof.mjs";
1
+ import { Cn as Pending, En as ClosestBranch, Mn as PendingEffects, Nn as PendingRenders, g as renderCatch, jn as ParentBranch, nn as installCatch, rn as placeholderShown, tn as caughtError, wn as Scope } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/catch.feat.ts
3
3
  const handlePendingTry = (fn, scope, branch) => {
4
4
  while (branch) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/controllable-input.feat.ts
4
4
  require_control_flow.controllableScripts[0] = require_control_flow._attr_input_checked_script;
5
5
  require_control_flow.controllableScripts[1] = require_control_flow._attr_input_checkedValue_script;
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-C55iHvof.mjs";
1
+ import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/controllable-input.feat.ts
3
3
  controllableScripts[0] = _attr_input_checked_script;
4
4
  controllableScripts[1] = _attr_input_checkedValue_script;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/controllable-open.feat.ts
4
4
  require_control_flow.controllableScripts[4] = require_control_flow._attr_details_or_dialog_open_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-C55iHvof.mjs";
1
+ import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/controllable-select.feat.ts
4
4
  require_control_flow.controllableScripts[3] = require_control_flow._attr_select_value_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-C55iHvof.mjs";
1
+ import { N as _attr_select_value_script, z as controllableScripts } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/controllable-textarea.feat.ts
4
4
  require_control_flow.controllableScripts[2] = require_control_flow._attr_input_value_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-C55iHvof.mjs";
1
+ import { A as _attr_input_value_script, z as controllableScripts } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  require("./controllable-input.feat.js");
4
4
  require("./controllable-open.feat.js");
5
5
  require("./controllable-select.feat.js");
@@ -1,4 +1,4 @@
1
- import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-C55iHvof.mjs";
1
+ import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-DQCODUa1.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
+ //#region src/dom/dynamic-tag-script.feat.ts
4
+ require_control_flow._resumed[require_control_flow.DYNAMIC_TAG_SCRIPT_REGISTER_ID] = require_control_flow.withBranches(require_control_flow.dynamicTagScript);
5
+ //#endregion
@@ -0,0 +1,4 @@
1
+ import { Xt as DYNAMIC_TAG_SCRIPT_REGISTER_ID, _t as _resumed, p as dynamicTagScript, vn as withBranches } from "../dom-DQCODUa1.mjs";
2
+ //#region src/dom/dynamic-tag-script.feat.ts
3
+ _resumed[DYNAMIC_TAG_SCRIPT_REGISTER_ID] = withBranches(dynamicTagScript);
4
+ //#endregion
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/dynamic-tag-var.feat.ts
4
- const elementGetter = (branch) => () => require_control_flow._el_read(branch[require_control_flow.StartNode]);
5
- require_control_flow.installDynamicTagVar((branch) => branch[require_control_flow.TagVariable](elementGetter(branch)));
6
- require_control_flow._resume(require_control_flow.DYNAMIC_TAG_VAR_REGISTER_ID, elementGetter);
4
+ require_control_flow.installDynamicTagVar((branch) => branch[require_control_flow.TagVariable](() => require_control_flow._el_read(branch[require_control_flow.StartNode])));
7
5
  //#endregion
@@ -1,6 +1,4 @@
1
- import { Fn as TagVariable, Pn as StartNode, Zt as DYNAMIC_TAG_VAR_REGISTER_ID, gt as _resume, kt as _el_read, m as installDynamicTagVar } from "../dom-C55iHvof.mjs";
1
+ import { Fn as StartNode, In as TagVariable, kt as _el_read, m as installDynamicTagVar } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/dynamic-tag-var.feat.ts
3
- const elementGetter = (branch) => () => _el_read(branch[StartNode]);
4
- installDynamicTagVar((branch) => branch[TagVariable](elementGetter(branch)));
5
- _resume(DYNAMIC_TAG_VAR_REGISTER_ID, elementGetter);
3
+ installDynamicTagVar((branch) => branch[TagVariable](() => _el_read(branch[StartNode])));
6
4
  //#endregion
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-BAGeiafn.js");
2
+ const require_control_flow = require("../dom-CBLlE8L-.js");
3
3
  //#region src/dom/placeholder.feat.ts
4
- require_control_flow.registeredValues[require_control_flow.PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
4
+ require_control_flow._resumed[require_control_flow.PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
5
5
  if (tryBranch["#PlaceholderBranch"]) {
6
6
  require_control_flow.destroyBranch(tryBranch[require_control_flow.PlaceholderBranch]);
7
7
  tryBranch[require_control_flow.PlaceholderBranch] = 0;
@@ -1,6 +1,6 @@
1
- import { Ct as registeredValues, Kt as destroyBranch, Nn as PlaceholderBranch, Qt as PLACEHOLDER_DISMISS_REGISTER_ID } from "../dom-C55iHvof.mjs";
1
+ import { Kt as destroyBranch, Pn as PlaceholderBranch, Zt as PLACEHOLDER_DISMISS_REGISTER_ID, _t as _resumed } from "../dom-DQCODUa1.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
- registeredValues[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
3
+ _resumed[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
4
4
  if (tryBranch["#PlaceholderBranch"]) {
5
5
  destroyBranch(tryBranch[PlaceholderBranch]);
6
6
  tryBranch[PlaceholderBranch] = 0;
@@ -455,11 +455,6 @@ function abort(ctrl) {
455
455
  ctrl.abort();
456
456
  }
457
457
  //#endregion
458
- //#region src/common/meta.ts
459
- const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
460
- const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
461
- const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
462
- //#endregion
463
458
  //#region src/common/opt.ts
464
459
  function toArray(opt) {
465
460
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
@@ -503,6 +498,11 @@ function parseHTML(html, ns) {
503
498
  return parser.content || parser;
504
499
  }
505
500
  //#endregion
501
+ //#region src/common/meta.ts
502
+ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
503
+ const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
504
+ const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
505
+ //#endregion
506
506
  //#region src/dom/scope.ts
507
507
  let nextScopeId = 1e6;
508
508
  let collectingScopes;
@@ -739,7 +739,7 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
739
739
  });
740
740
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
741
741
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
742
- resumeId && _resume(resumeId, closureSignal);
742
+ if (resumeId) _resumed[resumeId] = closureSignal;
743
743
  return closureSignal;
744
744
  }
745
745
  function _child_setup(setup) {
@@ -773,7 +773,7 @@ function _id(scope, accessor) {
773
773
  return id;
774
774
  }
775
775
  function _script(id, fn) {
776
- _resume(id, fn);
776
+ _resumed[id] = fn;
777
777
  return (scope) => {
778
778
  queueEffect(scope, fn);
779
779
  };
@@ -803,7 +803,7 @@ function _hoist(...path) {
803
803
  };
804
804
  }
805
805
  function _hoist_resume(id, ...path) {
806
- return _resume(id, _hoist(...path));
806
+ return _resumed[id] = _hoist(...path);
807
807
  }
808
808
  //#endregion
809
809
  //#region src/dom/walker.ts
@@ -861,7 +861,7 @@ const walkNextNode = () => {
861
861
  const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
862
862
  //#endregion
863
863
  //#region src/dom/resume.ts
864
- const registeredValues = {};
864
+ const _resumed = {};
865
865
  let curRenders;
866
866
  let embedRenders;
867
867
  let readyIds;
@@ -933,7 +933,7 @@ function init(runtimeId = "M") {
933
933
  }
934
934
  }
935
935
  };
936
- const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data));
936
+ const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
937
937
  const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
938
938
  return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
939
939
  if (visitType === "*") {
@@ -993,7 +993,7 @@ function init(runtimeId = "M") {
993
993
  if (typeof serialized === "string") {
994
994
  lastTokenIndex = 0;
995
995
  visitText = serialized;
996
- while (nextToken()) if (/\D/.test(lastToken)) lastEffect = registeredValues[lastToken];
996
+ while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
997
997
  else effects.push(lastEffect, getScope(lastToken));
998
998
  } else if (Array.isArray(serialized)) {
999
999
  if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
@@ -1017,7 +1017,7 @@ function init(runtimeId = "M") {
1017
1017
  let visitBranches;
1018
1018
  let htmlStart;
1019
1019
  let embedAnchor;
1020
- serializeContext._ = registeredValues;
1020
+ serializeContext._ = _resumed;
1021
1021
  if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
1022
1022
  render.m = (effects) => {
1023
1023
  processResumes(render.r, effects);
@@ -1081,18 +1081,20 @@ function runResumeEffects(render) {
1081
1081
  }
1082
1082
  }
1083
1083
  function getRegisteredWithScope(id, scope) {
1084
- const val = registeredValues[id];
1085
- return scope ? val(scope) : val;
1086
- }
1087
- function _resume(id, obj) {
1088
- return registeredValues[id] = obj;
1084
+ return scope ? _resumed[id](scope) : _resumed[id];
1089
1085
  }
1090
1086
  function _var_resume(id, signal) {
1091
- _resume(id, (scope) => (value) => signal(scope, value));
1087
+ _resumed[id] = (scope) => (value) => signal(scope, value);
1092
1088
  return signal;
1093
1089
  }
1094
1090
  function _el(id, accessor) {
1095
- return _resume(id, (scope) => () => _el_read(scope[accessor]));
1091
+ return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1092
+ }
1093
+ function _resume_dynamic_tag_var(accessor) {
1094
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1095
+ const node = scope[accessor];
1096
+ return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1097
+ };
1096
1098
  }
1097
1099
  //#endregion
1098
1100
  //#region src/dom/renderer.ts
@@ -1139,7 +1141,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
1139
1141
  };
1140
1142
  }
1141
1143
  function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
1142
- return _resume(id, _content(id, template, walks, setup, params, dynamicScopesAccessor));
1144
+ return _resumed[id] = _content(id, template, walks, setup, params, dynamicScopesAccessor);
1143
1145
  }
1144
1146
  function _content_closures(renderer, closureFns) {
1145
1147
  const closureSignals = {};
@@ -1305,7 +1307,12 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1305
1307
  const parentNode = firstChild.parentNode;
1306
1308
  const lastChild = scope["DynamicHTMLLastChild:" + accessor] || firstChild;
1307
1309
  const newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
1308
- insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope[DynamicHTMLLastChild + accessor] = newContent.lastChild);
1310
+ const newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text());
1311
+ const newLastChild = scope[DynamicHTMLLastChild + accessor] = newContent.lastChild;
1312
+ const branch = scope[ClosestBranch];
1313
+ if (branch?.["#StartNode"] === firstChild) branch[StartNode] = newFirstChild;
1314
+ if (branch?.["#EndNode"] === lastChild) branch[EndNode] = newLastChild;
1315
+ insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild);
1309
1316
  removeChildNodes(firstChild, lastChild);
1310
1317
  });
1311
1318
  function normalizeClientRender(value) {
@@ -1947,7 +1954,6 @@ let bindNativeTagVar;
1947
1954
  function installDynamicTagVar(bind) {
1948
1955
  bindNativeTagVar = bind;
1949
1956
  }
1950
- const _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript));
1951
1957
  function dynamicTagScript(branch) {
1952
1958
  _attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
1953
1959
  }
@@ -2131,10 +2137,10 @@ Object.defineProperty(exports, "ClosestBranch", {
2131
2137
  return ClosestBranch;
2132
2138
  }
2133
2139
  });
2134
- Object.defineProperty(exports, "DYNAMIC_TAG_VAR_REGISTER_ID", {
2140
+ Object.defineProperty(exports, "DYNAMIC_TAG_SCRIPT_REGISTER_ID", {
2135
2141
  enumerable: true,
2136
2142
  get: function() {
2137
- return DYNAMIC_TAG_VAR_REGISTER_ID;
2143
+ return DYNAMIC_TAG_SCRIPT_REGISTER_ID;
2138
2144
  }
2139
2145
  });
2140
2146
  Object.defineProperty(exports, "EndNode", {
@@ -2653,16 +2659,16 @@ Object.defineProperty(exports, "_or", {
2653
2659
  return _or;
2654
2660
  }
2655
2661
  });
2656
- Object.defineProperty(exports, "_resume", {
2662
+ Object.defineProperty(exports, "_resume_dynamic_tag_var", {
2657
2663
  enumerable: true,
2658
2664
  get: function() {
2659
- return _resume;
2665
+ return _resume_dynamic_tag_var;
2660
2666
  }
2661
2667
  });
2662
- Object.defineProperty(exports, "_resume_dynamic_tag", {
2668
+ Object.defineProperty(exports, "_resumed", {
2663
2669
  enumerable: true,
2664
2670
  get: function() {
2665
- return _resume_dynamic_tag;
2671
+ return _resumed;
2666
2672
  }
2667
2673
  });
2668
2674
  Object.defineProperty(exports, "_return", {
@@ -2785,6 +2791,12 @@ Object.defineProperty(exports, "destroyBranch", {
2785
2791
  return destroyBranch;
2786
2792
  }
2787
2793
  });
2794
+ Object.defineProperty(exports, "dynamicTagScript", {
2795
+ enumerable: true,
2796
+ get: function() {
2797
+ return dynamicTagScript;
2798
+ }
2799
+ });
2788
2800
  Object.defineProperty(exports, "forIn", {
2789
2801
  enumerable: true,
2790
2802
  get: function() {
@@ -2899,12 +2911,6 @@ Object.defineProperty(exports, "readyFailed", {
2899
2911
  return readyFailed;
2900
2912
  }
2901
2913
  });
2902
- Object.defineProperty(exports, "registeredValues", {
2903
- enumerable: true,
2904
- get: function() {
2905
- return registeredValues;
2906
- }
2907
- });
2908
2914
  Object.defineProperty(exports, "removeAndDestroyBranch", {
2909
2915
  enumerable: true,
2910
2916
  get: function() {
@@ -2953,6 +2959,12 @@ Object.defineProperty(exports, "toInsertNode", {
2953
2959
  return toInsertNode;
2954
2960
  }
2955
2961
  });
2962
+ Object.defineProperty(exports, "withBranches", {
2963
+ enumerable: true,
2964
+ get: function() {
2965
+ return withBranches;
2966
+ }
2967
+ });
2956
2968
  Object.defineProperty(exports, "withLazy", {
2957
2969
  enumerable: true,
2958
2970
  get: function() {
@@ -454,11 +454,6 @@ function abort(ctrl) {
454
454
  ctrl.abort();
455
455
  }
456
456
  //#endregion
457
- //#region src/common/meta.ts
458
- const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
459
- const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
460
- const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
461
- //#endregion
462
457
  //#region src/common/opt.ts
463
458
  function toArray(opt) {
464
459
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
@@ -502,6 +497,11 @@ function parseHTML(html, ns) {
502
497
  return parser.content || parser;
503
498
  }
504
499
  //#endregion
500
+ //#region src/common/meta.ts
501
+ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
502
+ const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
503
+ const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
504
+ //#endregion
505
505
  //#region src/dom/scope.ts
506
506
  let nextScopeId = 1e6;
507
507
  let collectingScopes;
@@ -738,7 +738,7 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
738
738
  });
739
739
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
740
740
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
741
- resumeId && _resume(resumeId, closureSignal);
741
+ if (resumeId) _resumed[resumeId] = closureSignal;
742
742
  return closureSignal;
743
743
  }
744
744
  function _child_setup(setup) {
@@ -772,7 +772,7 @@ function _id(scope, accessor) {
772
772
  return id;
773
773
  }
774
774
  function _script(id, fn) {
775
- _resume(id, fn);
775
+ _resumed[id] = fn;
776
776
  return (scope) => {
777
777
  queueEffect(scope, fn);
778
778
  };
@@ -802,7 +802,7 @@ function _hoist(...path) {
802
802
  };
803
803
  }
804
804
  function _hoist_resume(id, ...path) {
805
- return _resume(id, _hoist(...path));
805
+ return _resumed[id] = _hoist(...path);
806
806
  }
807
807
  //#endregion
808
808
  //#region src/dom/walker.ts
@@ -860,7 +860,7 @@ const walkNextNode = () => {
860
860
  const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
861
861
  //#endregion
862
862
  //#region src/dom/resume.ts
863
- const registeredValues = {};
863
+ const _resumed = {};
864
864
  let curRenders;
865
865
  let embedRenders;
866
866
  let readyIds;
@@ -932,7 +932,7 @@ function init(runtimeId = "M") {
932
932
  }
933
933
  }
934
934
  };
935
- const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data));
935
+ const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
936
936
  const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
937
937
  return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
938
938
  if (visitType === "*") {
@@ -992,7 +992,7 @@ function init(runtimeId = "M") {
992
992
  if (typeof serialized === "string") {
993
993
  lastTokenIndex = 0;
994
994
  visitText = serialized;
995
- while (nextToken()) if (/\D/.test(lastToken)) lastEffect = registeredValues[lastToken];
995
+ while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
996
996
  else effects.push(lastEffect, getScope(lastToken));
997
997
  } else if (Array.isArray(serialized)) {
998
998
  if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
@@ -1016,7 +1016,7 @@ function init(runtimeId = "M") {
1016
1016
  let visitBranches;
1017
1017
  let htmlStart;
1018
1018
  let embedAnchor;
1019
- serializeContext._ = registeredValues;
1019
+ serializeContext._ = _resumed;
1020
1020
  if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
1021
1021
  render.m = (effects) => {
1022
1022
  processResumes(render.r, effects);
@@ -1080,18 +1080,20 @@ function runResumeEffects(render) {
1080
1080
  }
1081
1081
  }
1082
1082
  function getRegisteredWithScope(id, scope) {
1083
- const val = registeredValues[id];
1084
- return scope ? val(scope) : val;
1085
- }
1086
- function _resume(id, obj) {
1087
- return registeredValues[id] = obj;
1083
+ return scope ? _resumed[id](scope) : _resumed[id];
1088
1084
  }
1089
1085
  function _var_resume(id, signal) {
1090
- _resume(id, (scope) => (value) => signal(scope, value));
1086
+ _resumed[id] = (scope) => (value) => signal(scope, value);
1091
1087
  return signal;
1092
1088
  }
1093
1089
  function _el(id, accessor) {
1094
- return _resume(id, (scope) => () => _el_read(scope[accessor]));
1090
+ return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1091
+ }
1092
+ function _resume_dynamic_tag_var(accessor) {
1093
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1094
+ const node = scope[accessor];
1095
+ return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1096
+ };
1095
1097
  }
1096
1098
  //#endregion
1097
1099
  //#region src/dom/renderer.ts
@@ -1138,7 +1140,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
1138
1140
  };
1139
1141
  }
1140
1142
  function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
1141
- return _resume(id, _content(id, template, walks, setup, params, dynamicScopesAccessor));
1143
+ return _resumed[id] = _content(id, template, walks, setup, params, dynamicScopesAccessor);
1142
1144
  }
1143
1145
  function _content_closures(renderer, closureFns) {
1144
1146
  const closureSignals = {};
@@ -1304,7 +1306,12 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1304
1306
  const parentNode = firstChild.parentNode;
1305
1307
  const lastChild = scope["DynamicHTMLLastChild:" + accessor] || firstChild;
1306
1308
  const newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
1307
- insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope[DynamicHTMLLastChild + accessor] = newContent.lastChild);
1309
+ const newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text());
1310
+ const newLastChild = scope[DynamicHTMLLastChild + accessor] = newContent.lastChild;
1311
+ const branch = scope[ClosestBranch];
1312
+ if (branch?.["#StartNode"] === firstChild) branch[StartNode] = newFirstChild;
1313
+ if (branch?.["#EndNode"] === lastChild) branch[EndNode] = newLastChild;
1314
+ insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild);
1308
1315
  removeChildNodes(firstChild, lastChild);
1309
1316
  });
1310
1317
  function normalizeClientRender(value) {
@@ -1946,7 +1953,6 @@ let bindNativeTagVar;
1946
1953
  function installDynamicTagVar(bind) {
1947
1954
  bindNativeTagVar = bind;
1948
1955
  }
1949
- const _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript));
1950
1956
  function dynamicTagScript(branch) {
1951
1957
  _attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
1952
1958
  }
@@ -2100,4 +2106,4 @@ function byFirstArg(name) {
2100
2106
  return name;
2101
2107
  }
2102
2108
  //#endregion
2103
- export { _attrs_script as $, $signal as $t, _attr_input_value_script as A, ParentBranch as An, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, Scope as Cn, registeredValues as Ct, _attr_input_value_attribute_default as D, Gen$1 as Dn, _closure_get as Dt, _attr_input_value as E, EndNode as En, _closure as Et, _controllable_open as F, TagVariable as Fn, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, PendingRenders as Mn, _global_read as Mt, _attr_select_value_script as N, PlaceholderBranch as Nn, _hoist as Nt, _attr_input_value_default as O, Global as On, _const as Ot, _controllable_input as P, StartNode as Pn, _hoist_resume as Pt, _attrs_partial_content as Q, PLACEHOLDER_DISMISS_REGISTER_ID as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, Pending as Sn, readyFailed as St, _attr_input_checked_script as T, ClosestBranch as Tn, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, _on as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, DYNAMIC_TAG_VAR_REGISTER_ID as Zt, _attr_details_or_dialog_open as _, _call as _n, _var_resume as _t, _for_in as a, queueAsyncRender as an, _text_content as at, _attr_input_checked as b, Params as bn, initEmbedded as bt, _for_until as c, run as cn, toInsertNode as ct, _show as d, forIn as dn, _content_resume as dt, $signalReset as en, _html as et, _try as f, forOf as fn, createAndSetupBranch as ft, renderCatch as g, _hoist_read_error as gn, _resume as gt, patchDynamicTag as h, _assert_hoist as hn, _el as ht, _dynamic_tag_content as i, prepareEffects as in, _text as it, _attr_select_value as j, PendingEffects as jn, _for_selector as jt, _attr_input_value_dynamic_default as k, Load as kn, _el_read as kt, _if as l, runEffects as ln, _content as lt, installDynamicTagVar as m, forUntil as mn, setupBranch as mt, _await_promise as n, installCatch as nn, _style_rule_item as nt, _for_of as o, queueEffect as on, _to_text as ot, addAwaitCounter as p, forTo as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, placeholderShown as rn, _style_shell as rt, _for_to as s, queueRender as sn, insertChildNodes as st, _await_content as t, caughtError as tn, _lifecycle as tt, _resume_dynamic_tag as u, runId as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, Clone as vn, getRegisteredWithScope as vt, _attr_input_checked_default as w, AwaitCounter as wn, withLazy as wt, _attr_input_checkedValue as x, Setup as xn, ready as xt, _attr_details_or_dialog_open_script as y, Owner as yn, init as yt, controllableScripts as z, _or as zt };
2109
+ export { _attrs_script as $, $signal as $t, _attr_input_value_script as A, Load as An, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, Pending as Cn, readyFailed as Ct, _attr_input_value_attribute_default as D, EndNode as Dn, _closure_get as Dt, _attr_input_value as E, ClosestBranch as En, _closure as Et, _controllable_open as F, StartNode as Fn, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, TagVariable as In, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, PendingEffects as Mn, _global_read as Mt, _attr_select_value_script as N, PendingRenders as Nn, _hoist as Nt, _attr_input_value_default as O, Gen$1 as On, _const as Ot, _controllable_input as P, PlaceholderBranch as Pn, _hoist_resume as Pt, _attrs_partial_content as Q, _on as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, Setup as Sn, ready as St, _attr_input_checked_script as T, AwaitCounter as Tn, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, DYNAMIC_TAG_SCRIPT_REGISTER_ID as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, PLACEHOLDER_DISMISS_REGISTER_ID as Zt, _attr_details_or_dialog_open as _, _call as _n, _resumed as _t, _for_in as a, queueAsyncRender as an, _text_content as at, _attr_input_checked as b, Owner as bn, init as bt, _for_until as c, run as cn, toInsertNode as ct, _try as d, forIn as dn, _content_resume as dt, $signalReset as en, _html as et, addAwaitCounter as f, forOf as fn, createAndSetupBranch as ft, renderCatch as g, _hoist_read_error as gn, _resume_dynamic_tag_var as gt, patchDynamicTag as h, _assert_hoist as hn, _el as ht, _dynamic_tag_content as i, prepareEffects as in, _text as it, _attr_select_value as j, ParentBranch as jn, _for_selector as jt, _attr_input_value_dynamic_default as k, Global as kn, _el_read as kt, _if as l, runEffects as ln, _content as lt, installDynamicTagVar as m, forUntil as mn, setupBranch as mt, _await_promise as n, installCatch as nn, _style_rule_item as nt, _for_of as o, queueEffect as on, _to_text as ot, dynamicTagScript as p, forTo as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, placeholderShown as rn, _style_shell as rt, _for_to as s, queueRender as sn, insertChildNodes as st, _await_content as t, caughtError as tn, _lifecycle as tt, _show as u, runId as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, withBranches as vn, _var_resume as vt, _attr_input_checked_default as w, Scope as wn, withLazy as wt, _attr_input_checkedValue as x, Params as xn, initEmbedded as xt, _attr_details_or_dialog_open_script as y, Clone as yn, getRegisteredWithScope as yt, controllableScripts as z, _or as zt };
package/dist/debug/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_control_flow = require("./dom-BAGeiafn.js");
3
+ const require_control_flow = require("./dom-CBLlE8L-.js");
4
4
  //#region src/common/attr-tag.ts
5
5
  const empty = [];
6
6
  const rest = Symbol("Attribute Tag");
@@ -41,21 +41,21 @@ const compat = {
41
41
  patchDynamicTag: require_control_flow.patchDynamicTag,
42
42
  queueEffect: require_control_flow.queueEffect,
43
43
  init(warp10Noop) {
44
- require_control_flow._resume(SET_SCOPE_REGISTER_ID, (scope) => {
44
+ require_control_flow._resumed[SET_SCOPE_REGISTER_ID] = (scope) => {
45
45
  getRenderScopes(scope[require_control_flow.Global])[scope["#Id"]] = scope;
46
46
  if (scope.m5c) classIdToBranch.set(scope.m5c, scope);
47
47
  if (classEventResolver) for (const key in scope) {
48
48
  const resolved = classEventResolver(scope[key], scope);
49
49
  if (resolved !== scope[key]) scope[key] = resolved;
50
50
  }
51
- });
52
- require_control_flow._resume(RENDER_BODY_ID, warp10Noop);
51
+ };
52
+ require_control_flow._resumed[RENDER_BODY_ID] = warp10Noop;
53
53
  },
54
54
  setClassEventResolver(fn) {
55
55
  classEventResolver = fn;
56
56
  },
57
57
  resumeClassFunction(id, build) {
58
- require_control_flow._resume(id, build);
58
+ require_control_flow._resumed[id] = build;
59
59
  },
60
60
  getScope($global, scopeId) {
61
61
  return getRenderScopes($global)?.[scopeId];
@@ -127,7 +127,7 @@ const _template = (id, template, walks, setup, inputSignal) => {
127
127
  renderer.render = () => {
128
128
  throw new Error(`render() is not implemented for the DOM compilation of a Marko template`);
129
129
  };
130
- return require_control_flow._resume(id, renderer);
130
+ return require_control_flow._resumed[id] = renderer;
131
131
  };
132
132
  function mount(input = {}, reference, position) {
133
133
  let branch;
@@ -194,6 +194,7 @@ function mount(input = {}, reference, position) {
194
194
  }
195
195
  //#endregion
196
196
  //#region src/dom/load.ts
197
+ const noop = (_) => 0;
197
198
  const _load_template = /*@__PURE__*/ require_control_flow.withLazy((id, load) => {
198
199
  let pending;
199
200
  const lazyTemplate = _template(id, 0, 0, (branch) => {
@@ -203,7 +204,7 @@ const _load_template = /*@__PURE__*/ require_control_flow.withLazy((id, load) =>
203
204
  Object.assign(lazyTemplate, renderer);
204
205
  require_control_flow.queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch[require_control_flow.StartNode], awaitCounter));
205
206
  }, loadFailed(branch, awaitCounter));
206
- }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r[require_control_flow.Params] }))));
207
+ }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r["params"] || noop }))));
207
208
  return lazyTemplate;
208
209
  });
209
210
  const _load_setup = /*@__PURE__*/ require_control_flow.withLazy((nodeAccessor, childScopeAccessor, load) => {
@@ -261,7 +262,7 @@ const _load_signal = /*@__PURE__*/ require_control_flow.withLazy((load) => {
261
262
  pending ||= load();
262
263
  if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === require_control_flow.runId) (scope[require_control_flow.Load] ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]);
263
264
  else if (apply._) apply._(scope, value);
264
- else pending.then((mod) => require_control_flow.queueAsyncRender(scope, apply._ = mod._, value), () => 0);
265
+ else pending.then((mod) => require_control_flow.queueAsyncRender(scope, apply._ = mod._, value), noop);
265
266
  };
266
267
  return apply;
267
268
  });
@@ -284,7 +285,6 @@ function _load_media_trigger(query) {
284
285
  return (load) => () => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: true }))).then(load);
285
286
  }
286
287
  function _load_race_trigger(...triggers) {
287
- const noop = () => Promise.resolve();
288
288
  let pending;
289
289
  return (load) => () => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
290
290
  }
@@ -383,8 +383,8 @@ exports._load_template = _load_template;
383
383
  exports._load_visible_trigger = _load_visible_trigger;
384
384
  exports._on = require_control_flow._on;
385
385
  exports._or = require_control_flow._or;
386
- exports._resume = require_control_flow._resume;
387
- exports._resume_dynamic_tag = require_control_flow._resume_dynamic_tag;
386
+ exports._resume_dynamic_tag_var = require_control_flow._resume_dynamic_tag_var;
387
+ exports._resumed = require_control_flow._resumed;
388
388
  exports._return = require_control_flow._return;
389
389
  exports._return_change = require_control_flow._return_change;
390
390
  exports._script = require_control_flow._script;