marko 6.4.8 → 6.4.9

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 (87) hide show
  1. package/dist/common/constants/closure-signal-prop.d.ts +1 -1
  2. package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
  3. package/dist/debug/dom/catch.feat.js +1 -1
  4. package/dist/debug/dom/catch.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-D8znnhpf.js → dom-QkYva5Qx.js} +35 -61
  24. package/dist/debug/{dom-CFCBDift.mjs → dom-VKjkbuuo.mjs} +36 -50
  25. package/dist/debug/dom.js +4 -4
  26. package/dist/debug/dom.mjs +4 -4
  27. package/dist/debug/html.js +20 -13
  28. package/dist/debug/html.mjs +18 -11
  29. package/dist/dom/catch.feat.js +3 -3
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/compat.d.ts +1 -1
  32. package/dist/dom/control-flow.d.ts +1 -1
  33. package/dist/dom/controllable-input.feat.js +1 -1
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +1 -1
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +1 -1
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +1 -1
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.feat.js +1 -1
  42. package/dist/dom/controllable.feat.mjs +1 -1
  43. package/dist/dom/dom.d.ts +2 -3
  44. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  45. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  46. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  47. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  48. package/dist/dom/lazy.feat.js +1 -1
  49. package/dist/dom/lazy.feat.mjs +1 -1
  50. package/dist/dom/placeholder.feat.js +3 -3
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/resume.d.ts +1 -1
  53. package/dist/dom/scope.d.ts +1 -1
  54. package/dist/dom/signals.d.ts +1 -1
  55. package/dist/{dom-CVAevsbz.mjs → dom-DtKQb840.mjs} +19 -33
  56. package/dist/{dom-Bpkm72vV.js → dom-IujlfJ6b.js} +82 -106
  57. package/dist/dom.js +31 -31
  58. package/dist/dom.mjs +4 -4
  59. package/dist/html/serializer.d.ts +1 -1
  60. package/dist/html/writer.d.ts +3 -3
  61. package/dist/html.d.ts +1 -1
  62. package/dist/html.js +21 -15
  63. package/dist/html.mjs +21 -15
  64. package/dist/translator/core/show.d.ts +3 -4
  65. package/dist/translator/index.js +998 -967
  66. package/dist/translator/util/bindings.d.ts +6 -5
  67. package/dist/translator/util/branch-tag.d.ts +1 -1
  68. package/dist/translator/util/constants/slot-kind.d.ts +1 -1
  69. package/dist/translator/util/module-registrations.d.ts +1 -1
  70. package/dist/translator/util/optional.d.ts +1 -0
  71. package/dist/translator/util/params-tree.d.ts +3 -3
  72. package/dist/translator/util/reasons.d.ts +2 -2
  73. package/dist/translator/util/references.d.ts +13 -10
  74. package/dist/translator/util/replace-with-statements.d.ts +4 -0
  75. package/dist/translator/util/runtime.d.ts +1 -0
  76. package/dist/translator/util/scope-accessor.d.ts +1 -1
  77. package/dist/translator/util/sections.d.ts +38 -14
  78. package/dist/translator/util/signals.d.ts +3 -11
  79. package/dist/translator/util/slots.d.ts +1 -1
  80. package/dist/translator/util/solve-reasons.d.ts +5 -0
  81. package/dist/translator/util/static-text.d.ts +1 -0
  82. package/dist/translator/util/structure.d.ts +3 -2
  83. package/dist/translator/util/tag-import.d.ts +0 -2
  84. package/dist/translator/util/write-guard.d.ts +2 -0
  85. package/dist/translator/visitors/placeholder.d.ts +4 -4
  86. package/package.json +3 -3
  87. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
@@ -46,7 +46,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
46
46
  if (node === lastChild && !newNode) return;
47
47
  }
48
48
  let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
49
- branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
49
+ branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), firstChild.before(...newContent.childNodes), removeChildNodes(firstChild, lastChild);
50
50
  }
51
51
  }), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableSpreadHelpers = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
52
52
  nodeAccessor = decodeAccessor(nodeAccessor);
@@ -55,19 +55,14 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
55
55
  return (scope, newBranch) => {
56
56
  newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
57
57
  };
58
- }), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
59
- nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor)), endNodeAccessor !== void 0 && (endNodeAccessor = decodeAccessor(endNodeAccessor));
58
+ }), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
59
+ nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor));
60
60
  let rangeAccessor = "A" + nodeAccessor;
61
61
  return (scope, display) => {
62
62
  let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType === 1, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
63
- range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.firstChild : scope[startNodeAccessor], range.K = onlyChild ? parentNode.lastChild : endNodeAccessor === void 0 ? referenceNode.previousSibling : scope[endNodeAccessor]);
63
+ range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.insertBefore(new Text(), parentNode.firstChild) : startNodeAccessor ? scope[startNodeAccessor] : referenceNode.previousSibling);
64
64
  let startNode = range.S;
65
- if (range.L && startNode === range.K && startNode.tagName === "T") {
66
- let wrapper = startNode;
67
- wrapper.firstChild || wrapper.appendChild(new Text()), range = scope[rangeAccessor] = {}, range.S = startNode = wrapper.firstChild, range.K = wrapper.lastChild, wrapper.replaceWith(...wrapper.childNodes);
68
- }
69
- let inDom = onlyChild ? !!parentNode.firstChild : startNode.parentNode === parentNode;
70
- display ? inDom || insertBranchBefore(range, parentNode, onlyChild ? null : referenceNode) : inDom && (onlyChild && (range.S = parentNode.firstChild, range.K = parentNode.lastChild), tempDetachBranch(range));
65
+ range.L && startNode.tagName === "T" ? display && startNode.replaceWith(range.S = new Text(), ...startNode.childNodes) : display ? startNode.parentNode !== parentNode && parentNode.insertBefore(startNode.parentNode, onlyChild ? null : referenceNode) : startNode.parentNode === parentNode && (range.K = onlyChild ? parentNode.lastChild : referenceNode.previousSibling, detachBranch(range));
71
66
  };
72
67
  }), _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
73
68
  let scopeOffsetAccessor = getTagVar && decodeAccessor(nodeAccessor + 1);
@@ -389,9 +384,9 @@ function removeAndDestroyBranch(branch) {
389
384
  destroyBranch(branch), removeChildNodes(branch.S, branch.K);
390
385
  }
391
386
  function insertBranchBefore(branch, parentNode, nextSibling) {
392
- insertChildNodes(parentNode, nextSibling, branch.S, branch.K);
387
+ parentNode.insertBefore(branch.S.parentNode || branch.S, nextSibling);
393
388
  }
394
- function tempDetachBranch(branch) {
389
+ function detachBranch(branch) {
395
390
  let fragment = new DocumentFragment();
396
391
  fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
397
392
  }
@@ -646,7 +641,7 @@ function runResumeEffects(render) {
646
641
  isResuming = 0;
647
642
  }
648
643
  }
649
- function getRegisteredWithScope(id, scope) {
644
+ function getRegisteredWithScope(scope, id) {
650
645
  return scope ? _resumed[id](scope) : _resumed[id];
651
646
  }
652
647
  function _var_resume(id, signal) {
@@ -718,12 +713,12 @@ function _content_closures(renderer, closureFns) {
718
713
  };
719
714
  }
720
715
  function createCloneableHTML(html, ns) {
721
- let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
716
+ let { firstChild, lastChild } = parseHTML(html, ns), parent = new DocumentFragment();
722
717
  return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
723
718
  walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
724
719
  } : (branch, walks) => {
725
720
  let clone = parent.cloneNode(!0);
726
- walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
721
+ clone.namespaceURI = ns, walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
727
722
  };
728
723
  }
729
724
  //#endregion
@@ -847,25 +842,16 @@ function _lifecycle(scope, thisObj, index = 0) {
847
842
  instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
848
843
  }
849
844
  function removeChildNodes(startNode, endNode) {
850
- let stop = endNode.nextSibling;
851
- for (; startNode !== stop;) {
845
+ for (endNode = endNode.nextSibling; startNode !== endNode;) {
852
846
  let next = startNode.nextSibling;
853
847
  startNode.remove(), startNode = next;
854
848
  }
855
849
  }
856
850
  function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
857
- if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
858
- else {
859
- let stop = endNode.nextSibling;
860
- for (; startNode !== stop;) {
861
- let next = startNode.nextSibling;
862
- parentNode.insertBefore(startNode, referenceNode), startNode = next;
863
- }
851
+ for (endNode = endNode.nextSibling; startNode !== endNode;) {
852
+ let next = startNode.nextSibling;
853
+ parentNode.insertBefore(startNode, referenceNode), startNode = next;
864
854
  }
865
- return parentNode;
866
- }
867
- function toInsertNode(startNode, endNode) {
868
- return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
869
855
  }
870
856
  //#endregion
871
857
  //#region src/dom/resolve-cursor-position.ts
@@ -1103,7 +1089,7 @@ function _await_promise(nodeAccessor, params) {
1103
1089
  }
1104
1090
  }
1105
1091
  })), countAwait(awaitCounter, scope, (_) => {
1106
- awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
1092
+ awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), detachBranch(tryBranch));
1107
1093
  })) : awaitCounter = startAwait(scope, tryBranch));
1108
1094
  let thisPromise = scope[promiseAccessor] = promise.then((data) => {
1109
1095
  if (thisPromise === scope[promiseAccessor]) {
@@ -1134,7 +1120,7 @@ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1134
1120
  if (!tryBranch) return;
1135
1121
  let awaitCounter = tryBranch.O;
1136
1122
  return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch))), countAwait(awaitCounter, tryBranch, (_) => {
1137
- (tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
1123
+ (tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), detachBranch(tryBranch);
1138
1124
  }), awaitCounter;
1139
1125
  }
1140
1126
  function countAwait(awaitCounter, scope, render) {
@@ -1171,7 +1157,7 @@ function runPendingEffects(tryBranch) {
1171
1157
  }
1172
1158
  function dismissPlaceholder(tryBranch) {
1173
1159
  let placeholderBranch = tryBranch.P;
1174
- placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
1160
+ placeholderBranch && (tryBranch.P = 0, insertBranchBefore(tryBranch, placeholderBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
1175
1161
  }
1176
1162
  function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1177
1163
  nodeAccessor = decodeAccessor(nodeAccessor);
@@ -1230,7 +1216,7 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
1230
1216
  }
1231
1217
  }
1232
1218
  for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
1233
- for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
1219
+ for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : (~sources[i] && detachBranch(newScopes[start + i]), insertBranchBefore(newScopes[start + i], parentNode, afterReference)), afterReference = newScopes[start + i].S;
1234
1220
  }
1235
1221
  function bySecondArg(_item, index) {
1236
1222
  return index;
@@ -1239,4 +1225,4 @@ function byFirstArg(name) {
1239
1225
  return name;
1240
1226
  }
1241
1227
  //#endregion
1242
- export { _attr_style_items as $, removeAndDestroyBranch as $t, _attr_input_value as A, withLazy as At, _controllable_select as B, _id as Bt, _attr_details_or_dialog_open_script as C, withBranches as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, initEmbedded as Dt, _attr_input_checkedValue_default as E, init as Et, _attr_select_value as F, _for_closure as Ft, _attr_class as G, _return as Gt, controllableScripts as H, _let as Ht, _attr_select_value_default as I, _for_selector as It, _attr_class_names as J, _var as Jt, _attr_class_item as K, _return_change as Kt, _attr_select_value_script as L, _global_read as Lt, _attr_input_value_default as M, _closure_get as Mt, _attr_input_value_dynamic_default as N, _const as Nt, _attr_input_checked_default as O, ready as Ot, _attr_input_value_script as P, _el_read as Pt, _attr_style_item as Q, insertBranchBefore as Qt, _controllable_input as R, _hoist as Rt, _attr_details_or_dialog_open_default as S, _call as Sn, _el as St, _attr_input_checkedValue as T, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, _let_change as Ut, _controllable_textarea as V, _if_closure as Vt, _attr as W, _or as Wt, _attr_nonce as X, _assert_init as Xt, _attr_content as Y, _var_change as Yt, _attr_style as Z, destroyBranch as Zt, patchDynamicTag as _, forTo as _n, _return_setup as _t, _for_in as a, installBranchRenders as an, _html as at, startAwait as b, _assert_hoist as bn, setupBranch as bt, _for_to as c, queueAsyncRender as cn, _style_shell as ct, _for_until_unkeyed as d, rendering as dn, _to_text as dt, syncGen as en, _attrs as et, _if as f, run as fn, insertChildNodes as ft, installDynamicTagVar as g, forOf as gn, _content_resume as gt, dynamicTagScript as h, forIn as hn, _content_closures as ht, _dynamic_tag_content as i, createBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, _closure as jt, _attr_input_checked_script as k, readyFailed as kt, _for_to_unkeyed as l, queueEffect as ln, _text as lt, _try as m, runId as mn, _content as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installCatch as on, _lifecycle as ot, _show as p, runEffects as pn, toInsertNode as pt, _attr_class_items as q, _script as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueRender as un, _text_content as ut, renderCatch as v, forUntil as vn, createAndSetupBranch as vt, _attr_input_checked as w, _var_resume as wt, _attr_details_or_dialog_open as x, _hoist_read_error as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, _assert_class_toggles as yn, createBranch as yt, _controllable_open as z, _hoist_resume as zt };
1228
+ export { _attr_style_items as $, _on as $t, _attr_input_value as A, _closure_get as At, _controllable_select as B, _let as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _global_read as Ft, _attr_class as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_default as I, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, _var as Kt, _attr_select_value_script as L, _hoist_resume as Lt, _attr_input_value_default as M, _el_read as Mt, _attr_input_value_dynamic_default as N, _for_closure as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, _id as Rt, _attr_details_or_dialog_open_default as S, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableSpreadHelpers as U, _return as Ut, _controllable_textarea as V, _let_change as Vt, _attr as W, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, _assert_class_toggles as _n, createBranch as _t, _for_in as a, prepareEffects as an, _html as at, startAwait as b, _call as bn, _el as bt, _for_to as c, queueRender as cn, _style_shell as ct, _for_until_unkeyed as d, runEffects as dn, _to_text as dt, $signal as en, _attrs as et, _if as f, runId as fn, _content as ft, installDynamicTagVar as g, forUntil as gn, createAndSetupBranch as gt, dynamicTagScript as h, forTo as hn, _return_setup as ht, _dynamic_tag_content as i, installCatch as in, _attrs_script as it, _attr_input_value_attribute_default as j, _const as jt, _attr_input_checked_script as k, _closure as kt, _for_to_unkeyed as l, rendering as ln, _text as lt, _try as m, forOf as mn, _content_resume as mt, _await_promise as n, createBranchRenders as nn, _attrs_partial as nt, _for_of as o, queueAsyncRender as on, _lifecycle as ot, _show as p, forIn as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, installBranchRenders as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, queueEffect as sn, _style_rule_item as st, _await_content as t, $signalReset as tn, _attrs_content as tt, _for_until as u, run as un, _text_content as ut, renderCatch as v, _assert_hoist as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, withBranches as xn, _resumed as xt, runPendingEffects as y, _hoist_read_error as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _if_closure as zt };