marko 5.33.3 → 5.33.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -0
  2. package/dist/runtime/helpers/tags-compat/dom-debug.mjs +3 -0
  3. package/dist/runtime/helpers/tags-compat/dom.js +1 -0
  4. package/dist/runtime/helpers/tags-compat/dom.mjs +3 -0
  5. package/dist/runtime/helpers/tags-compat/html-debug.js +3 -0
  6. package/dist/runtime/helpers/tags-compat/html-debug.mjs +3 -0
  7. package/dist/runtime/helpers/tags-compat/html.js +1 -0
  8. package/dist/runtime/helpers/tags-compat/html.mjs +3 -0
  9. package/dist/runtime/helpers/tags-compat/runtime-dom.js +231 -0
  10. package/dist/runtime/helpers/tags-compat/runtime-html.js +171 -0
  11. package/dist/runtime/html/AsyncStream.js +12 -12
  12. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  13. package/dist/runtime/html/helpers/attr.js +3 -3
  14. package/dist/runtime/html/helpers/data-marko.js +1 -1
  15. package/dist/runtime/html/helpers/escape-quotes.js +1 -1
  16. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  17. package/dist/runtime/renderable.js +3 -3
  18. package/dist/runtime/vdom/AsyncVDOMBuilder.js +67 -67
  19. package/dist/runtime/vdom/VComponent.js +3 -3
  20. package/dist/runtime/vdom/VDocumentFragment.js +7 -7
  21. package/dist/runtime/vdom/VElement.js +35 -35
  22. package/dist/runtime/vdom/VFragment.js +5 -5
  23. package/dist/runtime/vdom/VNode.js +30 -30
  24. package/dist/runtime/vdom/VText.js +8 -8
  25. package/dist/runtime/vdom/helpers/const-element.js +3 -3
  26. package/dist/runtime/vdom/hot-reload.js +2 -2
  27. package/dist/runtime/vdom/morphdom/fragment.js +3 -3
  28. package/dist/runtime/vdom/morphdom/helpers.js +1 -1
  29. package/dist/runtime/vdom/morphdom/index.js +31 -31
  30. package/dist/runtime/vdom/vdom.js +14 -14
  31. package/package.json +4 -4
  32. package/src/runtime/helpers/tags-compat/dom-debug.js +1 -0
  33. package/src/runtime/helpers/tags-compat/dom-debug.mjs +3 -0
  34. package/src/runtime/helpers/tags-compat/dom.js +1 -0
  35. package/src/runtime/helpers/tags-compat/dom.mjs +3 -0
  36. package/src/runtime/helpers/tags-compat/html-debug.js +3 -0
  37. package/src/runtime/helpers/tags-compat/html-debug.mjs +3 -0
  38. package/src/runtime/helpers/tags-compat/html.js +1 -0
  39. package/src/runtime/helpers/tags-compat/html.mjs +3 -0
  40. package/src/runtime/helpers/tags-compat/runtime-dom.js +231 -0
  41. package/src/runtime/helpers/tags-compat/runtime-html.js +171 -0
  42. package/dist/runtime/helpers/tags-compat-dom.js +0 -276
  43. package/dist/runtime/helpers/tags-compat-html.js +0 -172
  44. package/src/runtime/helpers/tags-compat-dom.js +0 -276
  45. package/src/runtime/helpers/tags-compat-html.js +0 -172
@@ -2,21 +2,21 @@
2
2
  var VNode = require("./VNode");
3
3
 
4
4
  function VText(value, ownerComponent) {
5
- this.c__(-1 /* no children */, ownerComponent);
6
- this.ct_ = value;
5
+ this.bT_(-1 /* no children */, ownerComponent);
6
+ this.cm_ = value;
7
7
  }
8
8
 
9
9
  VText.prototype = {
10
- cs_: true,
10
+ cl_: true,
11
11
 
12
- cb_: 3,
12
+ bV_: 3,
13
13
 
14
- bo_: function (host) {
15
- return (host.ownerDocument || host).createTextNode(this.ct_);
14
+ bl_: function (host) {
15
+ return (host.ownerDocument || host).createTextNode(this.cm_);
16
16
  },
17
17
 
18
- bU_: function () {
19
- return new VText(this.ct_);
18
+ bN_: function () {
19
+ return new VText(this.cm_);
20
20
  }
21
21
  };
22
22
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var VElement = require("../vdom").bC_;
3
+ var VElement = require("../vdom").bv_;
4
4
  var i = 0;
5
5
 
6
6
  module.exports = function (tagName, attrs, childCount) {
@@ -13,12 +13,12 @@ function ConstVElement(tagName, attrs, childCount) {
13
13
 
14
14
  ConstVElement.prototype = Object.create(VElement.prototype);
15
15
  ConstVElement.prototype.e = function (tagName, attrs, childCount) {
16
- var child = this.bT_(
16
+ var child = this.bM_(
17
17
  new ConstVElement(tagName, attrs, childCount)
18
18
  );
19
19
 
20
20
  if (childCount === 0) {
21
- return this.ck_();
21
+ return this.cd_();
22
22
  } else {
23
23
  return child;
24
24
  }
@@ -44,7 +44,7 @@ exports.t = runtime.t = function (typeName) {
44
44
  instance.P_(input, out);
45
45
  };
46
46
 
47
- instance.cu_ = true;
47
+ instance.cn_ = true;
48
48
  instance.am_();
49
49
  instance._t_ = false;
50
50
 
@@ -78,7 +78,7 @@ registry._C_ = function (typeName, id) {
78
78
  if (instances) {
79
79
  instances.add(instance);
80
80
  instance.once("destroy", function () {
81
- if (!instance.cu_) {
81
+ if (!instance.cn_) {
82
82
  instances.delete(instance);
83
83
  }
84
84
  });
@@ -80,8 +80,8 @@ function createFragmentNode(startNode, nextNode, parentNode) {
80
80
 
81
81
  function beginFragmentNode(startNode, parentNode) {
82
82
  var fragment = createFragmentNode(startNode, null, parentNode);
83
- fragment.cv_ = function (nextNode) {
84
- fragment.cv_ = null;
83
+ fragment.co_ = function (nextNode) {
84
+ fragment.co_ = null;
85
85
  insertBefore(
86
86
  fragment.endNode,
87
87
  nextNode,
@@ -92,4 +92,4 @@ function beginFragmentNode(startNode, parentNode) {
92
92
  }
93
93
 
94
94
  exports._h_ = createFragmentNode;
95
- exports.cw_ = beginFragmentNode;
95
+ exports.cp_ = beginFragmentNode;
@@ -37,6 +37,6 @@ function removeChild(node) {
37
37
 
38
38
  exports.bc_ = insertBefore;
39
39
  exports.bd_ = insertAfter;
40
- exports.cr_ = nextSibling;
40
+ exports.ck_ = nextSibling;
41
41
  exports.ay_ = firstChild;
42
42
  exports.be_ = removeChild;
@@ -8,11 +8,11 @@ var normalizeComponentKey = componentsUtil._R_;
8
8
  var domData = require("../../components/dom-data");
9
9
  var eventDelegation = require("../../components/event-delegation");
10
10
  var KeySequence = require("../../components/KeySequence");
11
- var VElement = require("../vdom").bC_;
11
+ var VElement = require("../vdom").bv_;
12
12
  var fragment = require("./fragment");
13
13
  var helpers = require("./helpers");
14
- var virtualizeElement = VElement.cm_;
15
- var morphAttrs = VElement.cn_;
14
+ var virtualizeElement = VElement.cf_;
15
+ var morphAttrs = VElement.cg_;
16
16
  var keysByDOMNode = domData._G_;
17
17
  var componentByDOMNode = domData._l_;
18
18
  var vElementByDOMNode = domData._H_;
@@ -20,11 +20,11 @@ var detachedByDOMNode = domData.aT_;
20
20
 
21
21
  var insertBefore = helpers.bc_;
22
22
  var insertAfter = helpers.bd_;
23
- var nextSibling = helpers.cr_;
23
+ var nextSibling = helpers.ck_;
24
24
  var firstChild = helpers.ay_;
25
25
  var removeChild = helpers.be_;
26
26
  var createFragmentNode = fragment._h_;
27
- var beginFragmentNode = fragment.cw_;
27
+ var beginFragmentNode = fragment.cp_;
28
28
 
29
29
  var ELEMENT_NODE = 1;
30
30
  var TEXT_NODE = 3;
@@ -42,7 +42,7 @@ function isAutoKey(key) {
42
42
  }
43
43
 
44
44
  function compareNodeNames(fromEl, toEl) {
45
- return fromEl.ch_ === toEl.ch_;
45
+ return fromEl.ca_ === toEl.ca_;
46
46
  }
47
47
 
48
48
  function caseInsensitiveCompare(a, b) {
@@ -73,12 +73,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
73
73
  ownerComponent,
74
74
  parentComponent)
75
75
  {
76
- var realNode = vNode.bo_(host, parentEl.namespaceURI);
76
+ var realNode = vNode.bl_(host, parentEl.namespaceURI);
77
77
  insertBefore(realNode, referenceEl, parentEl);
78
78
 
79
79
  if (
80
- vNode.cb_ === ELEMENT_NODE ||
81
- vNode.cb_ === FRAGMENT_NODE)
80
+ vNode.bV_ === ELEMENT_NODE ||
81
+ vNode.bV_ === FRAGMENT_NODE)
82
82
  {
83
83
  if (key) {
84
84
  keysByDOMNode.set(realNode, key);
@@ -87,7 +87,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
87
87
  realNode;
88
88
  }
89
89
 
90
- if (vNode.ch_ !== "textarea") {
90
+ if (vNode.ca_ !== "textarea") {
91
91
  morphChildren(realNode, vNode, parentComponent);
92
92
  }
93
93
 
@@ -161,9 +161,9 @@ function morphdom(fromNode, toNode, host, componentsContext) {
161
161
  var fromComponent;
162
162
 
163
163
  outer: while (curToNodeChild) {
164
- toNextSibling = curToNodeChild.cr_;
165
- curToNodeType = curToNodeChild.cb_;
166
- curToNodeKey = curToNodeChild.ca_;
164
+ toNextSibling = curToNodeChild.ck_;
165
+ curToNodeType = curToNodeChild.bV_;
166
+ curToNodeKey = curToNodeChild.bU_;
167
167
 
168
168
  // Skip <!doctype>
169
169
  if (curFromNodeChild && curFromNodeChild.nodeType === DOCTYPE_NODE) {
@@ -282,7 +282,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
282
282
 
283
283
  if (
284
284
  curVFromNodeChild &&
285
- curToNodeType === curVFromNodeChild.cb_ && (
285
+ curToNodeType === curVFromNodeChild.bV_ && (
286
286
  curToNodeType !== ELEMENT_NODE ||
287
287
  compareNodeNames(curToNodeChild, curVFromNodeChild)))
288
288
  {
@@ -327,11 +327,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
327
327
  curToNodeChild.aa_ ||
328
328
  caseInsensitiveCompare(
329
329
  curFromNodeChild.nodeName,
330
- curToNodeChild.ch_ || ""
330
+ curToNodeChild.ca_ || ""
331
331
  )))
332
332
  {
333
333
  curVFromNodeChild = virtualizeElement(curFromNodeChild);
334
- curVFromNodeChild.ch_ = curToNodeChild.ch_;
334
+ curVFromNodeChild.ca_ = curToNodeChild.ca_;
335
335
  keysByDOMNode.set(curFromNodeChild, curToNodeKey);
336
336
  referenceComponent.J_[curToNodeKey] =
337
337
  curFromNodeChild;
@@ -351,7 +351,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
351
351
  curFromNodeChild = fromNextSibling;
352
352
  continue;
353
353
  } else if (
354
- curToNodeChild.cb_ === FRAGMENT_NODE &&
354
+ curToNodeChild.bV_ === FRAGMENT_NODE &&
355
355
  curFromNodeChild.nodeType === COMMENT_NODE)
356
356
  {
357
357
  var content = curFromNodeChild.nodeValue;
@@ -418,7 +418,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
418
418
 
419
419
  if (
420
420
  curVFromNodeChild &&
421
- curToNodeType === curVFromNodeChild.cb_ && (
421
+ curToNodeType === curVFromNodeChild.bV_ && (
422
422
  curToNodeType !== ELEMENT_NODE ||
423
423
  compareNodeNames(curVFromNodeChild, curToNodeChild)))
424
424
  {
@@ -436,7 +436,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
436
436
 
437
437
  if (
438
438
  toNextSibling &&
439
- toNextSibling.ca_ === curFromNodeKey)
439
+ toNextSibling.bU_ === curFromNodeKey)
440
440
  {
441
441
  // Single element swap
442
442
 
@@ -549,18 +549,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
549
549
 
550
550
  if (
551
551
  caseInsensitiveCompare(
552
- curVFromNodeChild.ch_,
553
- curToNodeChild.ch_
552
+ curVFromNodeChild.ca_,
553
+ curToNodeChild.ca_
554
554
  ))
555
555
  {
556
- curVFromNodeChild.ch_ = curToNodeChild.ch_;
556
+ curVFromNodeChild.ca_ = curToNodeChild.ca_;
557
557
  }
558
558
  } else {
559
559
  // Skip over nodes that don't look like ours...
560
560
  curFromNodeChild = fromNextSibling;
561
561
  continue;
562
562
  }
563
- } else if (curFromNodeKey = curVFromNodeChild.ca_) {
563
+ } else if (curFromNodeKey = curVFromNodeChild.bU_) {
564
564
  // We have a keyed element here but our target VDOM node
565
565
  // is not keyed so this not doesn't belong
566
566
  isCompatible = false;
@@ -587,7 +587,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
587
587
  {
588
588
  // Both nodes being compared are Text or Comment nodes
589
589
  isCompatible = true;
590
- var curToNodeValue = curToNodeChild.ct_;
590
+ var curToNodeValue = curToNodeChild.cm_;
591
591
  var curFromNodeValue = curFromNodeChild.nodeValue;
592
592
  if (curFromNodeValue !== curToNodeValue) {
593
593
  if (
@@ -638,10 +638,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
638
638
  }
639
639
 
640
640
  // We have processed all of the "to nodes".
641
- if (fromNode.cv_) {
641
+ if (fromNode.co_) {
642
642
  // If we are in an unfinished fragment, we have reached the end of the nodes
643
643
  // we were matching up and need to end the fragment
644
- fromNode.cv_(curFromNodeChild);
644
+ fromNode.co_(curFromNodeChild);
645
645
  } else {
646
646
  // If curFromNodeChild is non-null then we still have some from nodes
647
647
  // left over that need to be removed
@@ -681,11 +681,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
681
681
  }
682
682
 
683
683
  function morphEl(fromEl, vFromEl, toEl, parentComponent) {
684
- var nodeName = toEl.ch_;
685
- var constId = toEl.cj_;
684
+ var nodeName = toEl.ca_;
685
+ var constId = toEl.cc_;
686
686
  vElementByDOMNode.set(fromEl, toEl);
687
687
 
688
- if (constId !== undefined && vFromEl.cj_ === constId) {
688
+ if (constId !== undefined && vFromEl.cc_ === constId) {
689
689
  return;
690
690
  }
691
691
 
@@ -696,8 +696,8 @@ function morphdom(fromNode, toNode, host, componentsContext) {
696
696
  }
697
697
 
698
698
  if (nodeName === "textarea") {
699
- if (toEl.ci_ !== vFromEl.ci_) {
700
- fromEl.value = toEl.ci_;
699
+ if (toEl.cb_ !== vFromEl.cb_) {
700
+ fromEl.value = toEl.cb_;
701
701
  }
702
702
  } else {
703
703
  morphChildren(fromEl, toEl, parentComponent);
@@ -11,7 +11,7 @@ var specialHtmlRegexp = /[&<]/;
11
11
  function virtualizeChildNodes(node, vdomParent, ownerComponent) {
12
12
  var curChild = node.firstChild;
13
13
  while (curChild) {
14
- vdomParent.bT_(virtualize(curChild, ownerComponent));
14
+ vdomParent.bM_(virtualize(curChild, ownerComponent));
15
15
  curChild = curChild.nextSibling;
16
16
  }
17
17
  }
@@ -19,7 +19,7 @@ function virtualizeChildNodes(node, vdomParent, ownerComponent) {
19
19
  function virtualize(node, ownerComponent) {
20
20
  switch (node.nodeType) {
21
21
  case 1:
22
- return VElement.cm_(node, virtualizeChildNodes, ownerComponent);
22
+ return VElement.cf_(node, virtualizeChildNodes, ownerComponent);
23
23
  case 3:
24
24
  return new VText(node.nodeValue, ownerComponent);
25
25
  case 11:
@@ -38,7 +38,7 @@ function virtualizeHTML(html, ownerComponent) {
38
38
  var curChild = parseHTML(html);
39
39
 
40
40
  while (curChild) {
41
- vdomFragment.bT_(virtualize(curChild, ownerComponent));
41
+ vdomFragment.bM_(virtualize(curChild, ownerComponent));
42
42
  curChild = curChild.nextSibling;
43
43
  }
44
44
 
@@ -65,18 +65,18 @@ Node_prototype.t = function (value) {
65
65
  }
66
66
  }
67
67
 
68
- this.bT_(vdomNode || new VText(value.toString()));
69
- return this.ck_();
68
+ this.bM_(vdomNode || new VText(value.toString()));
69
+ return this.cd_();
70
70
  };
71
71
 
72
- Node_prototype.bY_ = function () {
73
- return this.bT_(new VDocumentFragment());
72
+ Node_prototype.bR_ = function () {
73
+ return this.bM_(new VDocumentFragment());
74
74
  };
75
75
 
76
- exports.bD_ = VDocumentFragment;
77
- exports.bC_ = VElement;
78
- exports.bE_ = VText;
79
- exports.bF_ = VComponent;
80
- exports.bG_ = VFragment;
81
- exports.cm_ = virtualize;
82
- exports.bH_ = virtualizeHTML;
76
+ exports.bw_ = VDocumentFragment;
77
+ exports.bv_ = VElement;
78
+ exports.bx_ = VText;
79
+ exports.by_ = VComponent;
80
+ exports.bz_ = VFragment;
81
+ exports.cf_ = virtualize;
82
+ exports.bA_ = virtualizeHTML;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.33.3",
3
+ "version": "5.33.5",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -61,11 +61,11 @@
61
61
  "tags-html.d.ts"
62
62
  ],
63
63
  "scripts": {
64
- "build": "babel ./src --out-dir ./dist --copy-files --config-file ../../babel.config.js --env-name=production"
64
+ "build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
65
65
  },
66
66
  "dependencies": {
67
- "@marko/compiler": "^5.35.1",
68
- "@marko/translator-default": "^5.32.1",
67
+ "@marko/compiler": "^5.35.4",
68
+ "@marko/translator-default": "^5.32.3",
69
69
  "app-module-path": "^2.2.0",
70
70
  "argly": "^1.2.0",
71
71
  "browser-refresh-client": "1.1.4",
@@ -0,0 +1 @@
1
+ require("./runtime-dom.js").p(require("@marko/runtime-tags/debug/dom").compat);
@@ -0,0 +1,3 @@
1
+ import { compat } from "@marko/runtime-tags/debug/dom";
2
+ import { p } from "./runtime-dom.js";
3
+ p(compat);
@@ -0,0 +1 @@
1
+ require("./runtime-dom.js").p(require("@marko/runtime-tags/dom").compat);
@@ -0,0 +1,3 @@
1
+ import { compat } from "@marko/runtime-tags/dom";
2
+ import { p } from "./runtime-dom.js";
3
+ p(compat);
@@ -0,0 +1,3 @@
1
+ exports.s = require("./runtime-html.js").p(
2
+ require("@marko/runtime-tags/debug/html"),
3
+ );
@@ -0,0 +1,3 @@
1
+ import * as api from "@marko/runtime-tags/debug/html";
2
+ import { p } from "./runtime-html.js";
3
+ export const s = p(api);
@@ -0,0 +1 @@
1
+ exports.s = require("./runtime-html.js").p(require("@marko/runtime-tags/html"));
@@ -0,0 +1,3 @@
1
+ import * as api from "@marko/runtime-tags/html";
2
+ import { p } from "./runtime-html.js";
3
+ export const s = p(api);
@@ -0,0 +1,231 @@
1
+ const { ___componentLookup } = require("@internal/components-util");
2
+ const {
3
+ ___getComponentsContext,
4
+ } = require("../../components/ComponentsContext");
5
+ const defineComponent = require("../../components/defineComponent");
6
+ const { r: registerComponent } = require("../../components/registry");
7
+ const createRenderer = require("../../components/renderer");
8
+ const defaultCreateOut = require("../../createOut");
9
+ const morphdom = require("../../vdom/morphdom");
10
+ const { ___createFragmentNode } = require("../../vdom/morphdom/fragment");
11
+ const dynamicTag = require("../dynamic-tag");
12
+
13
+ exports.p = function (domCompat) {
14
+ dynamicTag.___runtimeCompat = function tagsToVdom(
15
+ renderer,
16
+ renderBody,
17
+ args,
18
+ ) {
19
+ const tagsRenderer = domCompat.resolveRenderer(renderer || renderBody);
20
+
21
+ if (tagsRenderer) {
22
+ return (input, out) =>
23
+ TagsCompat({ i: args ? args : input, r: tagsRenderer }, out);
24
+ }
25
+
26
+ return renderer;
27
+ };
28
+
29
+ const TagsCompatId = "tags-compat";
30
+ const TagsCompat = createRenderer(
31
+ function (_, out, componentDef, component) {
32
+ const isHydrate =
33
+ ___getComponentsContext(out).___globalContext.___isHydrate;
34
+ const input = Array.isArray(_.i) ? _.i : [_.i];
35
+ const tagsRenderer = domCompat.resolveRenderer(_.r);
36
+ const newNode = domCompat.render(
37
+ isHydrate,
38
+ out,
39
+ component,
40
+ tagsRenderer,
41
+ input,
42
+ );
43
+
44
+ out.bf(out.___assignedKey, component, !newNode);
45
+ if (newNode) {
46
+ out.node({ ___actualize: () => newNode });
47
+ }
48
+ out.ef();
49
+ },
50
+ // eslint-disable-next-line no-constant-condition
51
+ "MARKO_DEBUG"
52
+ ? {
53
+ t: TagsCompatId,
54
+ d: true,
55
+ }
56
+ : {
57
+ t: TagsCompatId,
58
+ },
59
+ {},
60
+ );
61
+
62
+ registerComponent(TagsCompatId, () => ({
63
+ _: TagsCompat,
64
+ Component: defineComponent(
65
+ {
66
+ onMount: domCompat.runComponentEffects,
67
+ onUpdate: domCompat.runComponentEffects,
68
+ },
69
+ TagsCompat,
70
+ ),
71
+ }));
72
+
73
+ // (
74
+ // nodeAccessor: Accessor,
75
+ // dynamicTagAttrs?: IntersectionSignal,
76
+ // intersection?: IntersectionSignal,
77
+ // valueWithIntersection?: ValueSignal
78
+ // )
79
+
80
+ const rendererCache = new WeakMap();
81
+
82
+ domCompat.patchConditionals((conditional) => (...args) => {
83
+ const signal = conditional(...args);
84
+ const hasAttrs = args.length > 1;
85
+ return (scope, renderer, clean) => {
86
+ return signal(scope, create5to6Renderer(renderer, hasAttrs), clean);
87
+ };
88
+ });
89
+
90
+ function create5to6Renderer(renderer, hasAttrs) {
91
+ let newRenderer = renderer;
92
+ if (renderer && typeof renderer !== "string") {
93
+ const rendererFromAnywhere =
94
+ renderer._ ||
95
+ renderer.render ||
96
+ (renderer.renderer && renderer.renderer.renderer) ||
97
+ renderer.renderer;
98
+
99
+ if (!domCompat.isRenderer(rendererFromAnywhere || renderer)) {
100
+ newRenderer = rendererCache.get(renderer);
101
+ if (!newRenderer) {
102
+ const { Component } = renderer;
103
+ if (Component) {
104
+ const setCustomEvents = Component.prototype.___setCustomEvents;
105
+ Component.prototype.___setCustomEvents = function (
106
+ customEvents,
107
+ scopeId,
108
+ ) {
109
+ for (const customEvent of customEvents) {
110
+ customEvent[1] = domCompat.resolveRenderer(customEvent[1]);
111
+ }
112
+
113
+ setCustomEvents.call(this, customEvents, scopeId);
114
+ };
115
+ }
116
+ newRenderer = domCompat.createRenderer(
117
+ (scope) => {
118
+ if (!hasAttrs) {
119
+ renderAndMorph(scope, rendererFromAnywhere, renderer, {});
120
+ }
121
+ },
122
+ () => {
123
+ const realFragment = document.createDocumentFragment();
124
+ ___createFragmentNode(null, null, realFragment);
125
+ return realFragment;
126
+ },
127
+ (scope, input, clean) => {
128
+ if (clean) return;
129
+ renderAndMorph(scope, rendererFromAnywhere, renderer, input);
130
+ },
131
+ );
132
+ rendererCache.set(renderer, newRenderer);
133
+ }
134
+ }
135
+ }
136
+ return newRenderer;
137
+ }
138
+
139
+ domCompat.register("@marko/tags-compat-5-to-6", create5to6Renderer);
140
+
141
+ function renderAndMorph(scope, renderer, renderBody, input) {
142
+ const out = defaultCreateOut();
143
+ let host = domCompat.getStartNode(scope);
144
+ let rootNode = host.fragment;
145
+ if (!rootNode) {
146
+ const component = (scope.marko5Component = ___componentLookup[scope.m5c]);
147
+ rootNode = component.___rootNode;
148
+ host = rootNode.startNode;
149
+ domCompat.setScopeNodes(host, rootNode.endNode);
150
+ }
151
+ const existingComponent = scope.marko5Component;
152
+ const componentsContext = ___getComponentsContext(out);
153
+ const globalComponentsContext = componentsContext.___globalContext;
154
+ let customEvents;
155
+ globalComponentsContext.___rerenderComponent = existingComponent;
156
+ out.sync();
157
+ if (renderer) {
158
+ const [rawInput] = input;
159
+ const normalizedInput = {};
160
+
161
+ for (const key in rawInput) {
162
+ let value = rawInput[key];
163
+ if (key.startsWith("on")) {
164
+ const c = key[2];
165
+ customEvents = customEvents || {};
166
+ customEvents[(c === "-" ? "" : c.toLowerCase()) + key.slice(3)] = [
167
+ value,
168
+ ];
169
+ } else {
170
+ normalizedInput[key] = rawInput[key];
171
+ }
172
+ }
173
+
174
+ renderer(normalizedInput, out);
175
+ } else {
176
+ RenderBodyComponent({ renderBody, args: input }, out);
177
+ }
178
+
179
+ domCompat.queueEffect(scope, () => {
180
+ const targetNode = out.___getOutput().___firstChild;
181
+ morphdom(rootNode, targetNode, host, componentsContext);
182
+ const componentDefs = componentsContext.___initComponents(
183
+ getRootNode(host),
184
+ );
185
+ const component = componentDefs[0].___component;
186
+ component.___rootNode = rootNode;
187
+ component.___input = input[0];
188
+ component.___customEvents = customEvents;
189
+ scope.marko5Component = component;
190
+ });
191
+ }
192
+
193
+ function getRootNode(el) {
194
+ var cur = el;
195
+ while (cur.parentNode) cur = cur.parentNode;
196
+ return cur;
197
+ }
198
+
199
+ const RenderBodyComponentId = "renderbody-renderer";
200
+ const RenderBodyComponent = createRenderer(
201
+ function (input, out, _componentDef) {
202
+ dynamicTag(
203
+ out,
204
+ input.renderBody,
205
+ null,
206
+ null,
207
+ input.args,
208
+ null,
209
+ _componentDef,
210
+ "0",
211
+ );
212
+ },
213
+ // eslint-disable-next-line no-constant-condition
214
+ "MARKO_DEBUG"
215
+ ? {
216
+ t: RenderBodyComponentId,
217
+ i: true,
218
+ d: true,
219
+ }
220
+ : {
221
+ t: RenderBodyComponentId,
222
+ i: true,
223
+ },
224
+ {},
225
+ );
226
+
227
+ registerComponent(RenderBodyComponentId, () => ({
228
+ _: RenderBodyComponent,
229
+ Component: defineComponent({}, RenderBodyComponent),
230
+ }));
231
+ };