marko 5.39.49 → 5.39.51
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.
- package/dist/runtime/helpers/dynamic-tag.js +11 -4
- package/dist/runtime/helpers/load-tag.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/dom.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html.js +3 -1
- package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +50 -51
- package/dist/runtime/helpers/tags-compat/runtime-html.js +18 -20
- package/dist/runtime/html/AsyncStream.js +10 -10
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/renderable.js +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -65
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +6 -6
- package/dist/runtime/vdom/VElement.js +30 -30
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +29 -29
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +3 -3
- package/dist/runtime/vdom/morphdom/helpers.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +34 -34
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/translator/index.js +4 -7
- package/dist/translator/tag/custom-tag.js +1 -2
- package/dist/translator/tag/util.js +5 -2
- package/dist/translator/taglib/core/translate-await.js +6 -7
- package/dist/translator/util/get-component-files.js +1 -1
- package/index.d.ts +3 -8
- package/package.json +4 -4
- package/src/runtime/helpers/dynamic-tag.js +10 -3
- package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/dom.js +1 -1
- package/src/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html.js +3 -1
- package/src/runtime/helpers/tags-compat/html.mjs +1 -1
- package/src/runtime/helpers/tags-compat/runtime-dom.js +40 -41
- package/src/runtime/helpers/tags-compat/runtime-html.js +14 -16
- package/src/translator/index.js +4 -7
- package/src/translator/tag/custom-tag.js +1 -2
- package/src/translator/tag/util.js +5 -2
- package/src/translator/taglib/core/translate-await.js +6 -7
|
@@ -3,78 +3,78 @@
|
|
|
3
3
|
function VNode() {}
|
|
4
4
|
|
|
5
5
|
VNode.prototype = {
|
|
6
|
-
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.cg_ = null;
|
|
6
|
+
cd_: function (finalChildCount, ownerComponent) {
|
|
7
|
+
this.cs_ = finalChildCount;
|
|
8
|
+
this.ct_ = 0;
|
|
9
|
+
this.ck_ = null;
|
|
10
|
+
this.cu_ = null;
|
|
12
11
|
this.ch_ = null;
|
|
12
|
+
this.ci_ = null;
|
|
13
13
|
this._P_ = ownerComponent;
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
get aD_() {
|
|
17
|
-
var firstChild = this.
|
|
17
|
+
var firstChild = this.ck_;
|
|
18
18
|
|
|
19
|
-
if (firstChild && firstChild.
|
|
19
|
+
if (firstChild && firstChild.cj_) {
|
|
20
20
|
var nestedFirstChild = firstChild.aD_;
|
|
21
21
|
// The first child is a DocumentFragment node.
|
|
22
22
|
// If the DocumentFragment node has a first child then we will return that.
|
|
23
23
|
// Otherwise, the DocumentFragment node is not *really* the first child and
|
|
24
24
|
// we need to skip to its next sibling
|
|
25
|
-
return nestedFirstChild || firstChild.
|
|
25
|
+
return nestedFirstChild || firstChild.cv_;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return firstChild;
|
|
29
29
|
},
|
|
30
30
|
|
|
31
|
-
get
|
|
32
|
-
var nextSibling = this.
|
|
31
|
+
get cv_() {
|
|
32
|
+
var nextSibling = this.ci_;
|
|
33
33
|
|
|
34
34
|
if (nextSibling) {
|
|
35
|
-
if (nextSibling.
|
|
35
|
+
if (nextSibling.cj_) {
|
|
36
36
|
var firstChild = nextSibling.aD_;
|
|
37
|
-
return firstChild || nextSibling.
|
|
37
|
+
return firstChild || nextSibling.cv_;
|
|
38
38
|
}
|
|
39
39
|
} else {
|
|
40
|
-
var parentNode = this.
|
|
41
|
-
if (parentNode && parentNode.
|
|
42
|
-
return parentNode.
|
|
40
|
+
var parentNode = this.ch_;
|
|
41
|
+
if (parentNode && parentNode.cj_) {
|
|
42
|
+
return parentNode.cv_;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return nextSibling;
|
|
47
47
|
},
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
this.
|
|
49
|
+
bX_: function (child) {
|
|
50
|
+
this.ct_++;
|
|
51
51
|
|
|
52
|
-
if (hasTextContent(this.
|
|
53
|
-
if (child.
|
|
54
|
-
this.
|
|
52
|
+
if (hasTextContent(this.cm_)) {
|
|
53
|
+
if (child.cw_) {
|
|
54
|
+
this.cn_ += child.ce_;
|
|
55
55
|
} else {
|
|
56
56
|
throw TypeError();
|
|
57
57
|
}
|
|
58
58
|
} else {
|
|
59
|
-
var lastChild = this.
|
|
59
|
+
var lastChild = this.cu_;
|
|
60
60
|
|
|
61
|
-
child.
|
|
61
|
+
child.ch_ = this;
|
|
62
62
|
|
|
63
63
|
if (lastChild) {
|
|
64
|
-
lastChild.
|
|
64
|
+
lastChild.ci_ = child;
|
|
65
65
|
} else {
|
|
66
|
-
this.
|
|
66
|
+
this.ck_ = child;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
this.
|
|
69
|
+
this.cu_ = child;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return child;
|
|
73
73
|
},
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
if (this.
|
|
77
|
-
return this.
|
|
75
|
+
cp_: function finishChild() {
|
|
76
|
+
if (this.ct_ === this.cs_ && this.ch_) {
|
|
77
|
+
return this.ch_.cp_();
|
|
78
78
|
} else {
|
|
79
79
|
return this;
|
|
80
80
|
}
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
var VNode = require("./VNode");
|
|
3
3
|
|
|
4
4
|
function VText(value, ownerComponent) {
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
5
|
+
this.cd_(-1 /* no children */, ownerComponent);
|
|
6
|
+
this.ce_ = value;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
VText.prototype = {
|
|
10
|
-
|
|
10
|
+
cw_: true,
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
cf_: 3,
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
return (host.ownerDocument || host).createTextNode(this.
|
|
14
|
+
bw_: function (host) {
|
|
15
|
+
return (host.ownerDocument || host).createTextNode(this.ce_);
|
|
16
16
|
},
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
return new VText(this.
|
|
18
|
+
bY_: function () {
|
|
19
|
+
return new VText(this.ce_);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var VElement = require("../vdom").
|
|
3
|
+
var VElement = require("../vdom").bF_;
|
|
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.
|
|
16
|
+
var child = this.bX_(
|
|
17
17
|
new ConstVElement(tagName, attrs, childCount)
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
if (childCount === 0) {
|
|
21
|
-
return this.
|
|
21
|
+
return this.cp_();
|
|
22
22
|
} else {
|
|
23
23
|
return child;
|
|
24
24
|
}
|
|
@@ -51,7 +51,7 @@ exports.t = runtime.t = function (typeName) {
|
|
|
51
51
|
instance.R_(input, out);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
instance.
|
|
54
|
+
instance.cx_ = true;
|
|
55
55
|
instance.ar_();
|
|
56
56
|
instance._z_ = false;
|
|
57
57
|
|
|
@@ -85,7 +85,7 @@ registry._I_ = function (typeName, id) {
|
|
|
85
85
|
if (instances) {
|
|
86
86
|
instances.add(instance);
|
|
87
87
|
instance.once("destroy", function () {
|
|
88
|
-
if (!instance.
|
|
88
|
+
if (!instance.cx_) {
|
|
89
89
|
instances.delete(instance);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
@@ -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.
|
|
84
|
-
fragment.
|
|
83
|
+
fragment.cy_ = function (nextNode) {
|
|
84
|
+
fragment.cy_ = 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._m_ = createFragmentNode;
|
|
95
|
-
exports.
|
|
95
|
+
exports.cz_ = beginFragmentNode;
|
|
@@ -8,12 +8,12 @@ var normalizeComponentKey = componentsUtil._X_;
|
|
|
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").
|
|
11
|
+
var VElement = require("../vdom").bF_;
|
|
12
12
|
var fragment = require("./fragment");
|
|
13
13
|
var helpers = require("./helpers");
|
|
14
14
|
var isTextOnly = require("../is-text-only");
|
|
15
|
-
var virtualizeElement = VElement.
|
|
16
|
-
var morphAttrs = VElement.
|
|
15
|
+
var virtualizeElement = VElement.cq_;
|
|
16
|
+
var morphAttrs = VElement.cr_;
|
|
17
17
|
var keysByDOMNode = domData._p_;
|
|
18
18
|
var componentByDOMNode = domData._r_;
|
|
19
19
|
var vElementByDOMNode = domData._N_;
|
|
@@ -21,11 +21,11 @@ var detachedByDOMNode = domData.aZ_;
|
|
|
21
21
|
|
|
22
22
|
var insertBefore = helpers.bi_;
|
|
23
23
|
var insertAfter = helpers.bj_;
|
|
24
|
-
var nextSibling = helpers.
|
|
24
|
+
var nextSibling = helpers.cv_;
|
|
25
25
|
var firstChild = helpers.aD_;
|
|
26
26
|
var removeChild = helpers.bk_;
|
|
27
27
|
var createFragmentNode = fragment._m_;
|
|
28
|
-
var beginFragmentNode = fragment.
|
|
28
|
+
var beginFragmentNode = fragment.cz_;
|
|
29
29
|
|
|
30
30
|
var ELEMENT_NODE = 1;
|
|
31
31
|
var TEXT_NODE = 3;
|
|
@@ -43,7 +43,7 @@ function isAutoKey(key) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function compareNodeNames(fromEl, toEl) {
|
|
46
|
-
return fromEl.
|
|
46
|
+
return fromEl.cm_ === toEl.cm_;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function caseInsensitiveCompare(a, b) {
|
|
@@ -74,12 +74,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
74
74
|
ownerComponent,
|
|
75
75
|
parentComponent)
|
|
76
76
|
{
|
|
77
|
-
var realNode = vNode.
|
|
77
|
+
var realNode = vNode.bw_(host, parentEl.namespaceURI);
|
|
78
78
|
insertBefore(realNode, referenceEl, parentEl);
|
|
79
79
|
|
|
80
80
|
if (
|
|
81
|
-
vNode.
|
|
82
|
-
vNode.
|
|
81
|
+
vNode.cf_ === ELEMENT_NODE ||
|
|
82
|
+
vNode.cf_ === FRAGMENT_NODE)
|
|
83
83
|
{
|
|
84
84
|
if (key) {
|
|
85
85
|
keysByDOMNode.set(realNode, key);
|
|
@@ -88,7 +88,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
88
88
|
realNode;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
if (!isTextOnly(vNode.
|
|
91
|
+
if (!isTextOnly(vNode.cm_)) {
|
|
92
92
|
morphChildren(realNode, vNode, parentComponent);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -162,9 +162,9 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
162
162
|
var fromComponent;
|
|
163
163
|
|
|
164
164
|
outer: while (curToNodeChild) {
|
|
165
|
-
toNextSibling = curToNodeChild.
|
|
166
|
-
curToNodeType = curToNodeChild.
|
|
167
|
-
curToNodeKey = curToNodeChild.
|
|
165
|
+
toNextSibling = curToNodeChild.cv_;
|
|
166
|
+
curToNodeType = curToNodeChild.cf_;
|
|
167
|
+
curToNodeKey = curToNodeChild.cg_;
|
|
168
168
|
|
|
169
169
|
// Skip <!doctype>
|
|
170
170
|
if (curFromNodeChild && curFromNodeChild.nodeType === DOCTYPE_NODE) {
|
|
@@ -283,7 +283,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
283
283
|
|
|
284
284
|
if (
|
|
285
285
|
curVFromNodeChild &&
|
|
286
|
-
curToNodeType === curVFromNodeChild.
|
|
286
|
+
curToNodeType === curVFromNodeChild.cf_ && (
|
|
287
287
|
curToNodeType !== ELEMENT_NODE ||
|
|
288
288
|
compareNodeNames(curToNodeChild, curVFromNodeChild)))
|
|
289
289
|
{
|
|
@@ -328,11 +328,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
328
328
|
curToNodeChild.ag_ ||
|
|
329
329
|
caseInsensitiveCompare(
|
|
330
330
|
curFromNodeChild.nodeName,
|
|
331
|
-
curToNodeChild.
|
|
331
|
+
curToNodeChild.cm_ || ""
|
|
332
332
|
)))
|
|
333
333
|
{
|
|
334
334
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
|
335
|
-
curVFromNodeChild.
|
|
335
|
+
curVFromNodeChild.cm_ = curToNodeChild.cm_;
|
|
336
336
|
keysByDOMNode.set(curFromNodeChild, curToNodeKey);
|
|
337
337
|
referenceComponent.L_[curToNodeKey] =
|
|
338
338
|
curFromNodeChild;
|
|
@@ -352,7 +352,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
352
352
|
curFromNodeChild = fromNextSibling;
|
|
353
353
|
continue;
|
|
354
354
|
} else if (
|
|
355
|
-
curToNodeChild.
|
|
355
|
+
curToNodeChild.cf_ === FRAGMENT_NODE &&
|
|
356
356
|
curFromNodeChild.nodeType === COMMENT_NODE)
|
|
357
357
|
{
|
|
358
358
|
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.
|
|
421
|
+
curToNodeType === curVFromNodeChild.cf_ && (
|
|
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.
|
|
439
|
+
toNextSibling.cg_ === 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.
|
|
553
|
-
curToNodeChild.
|
|
552
|
+
curVFromNodeChild.cm_,
|
|
553
|
+
curToNodeChild.cm_
|
|
554
554
|
))
|
|
555
555
|
{
|
|
556
|
-
curVFromNodeChild.
|
|
556
|
+
curVFromNodeChild.cm_ = curToNodeChild.cm_;
|
|
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 (curVFromNodeChild.
|
|
563
|
+
} else if (curVFromNodeChild.cg_) {
|
|
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,18 +587,18 @@ 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.
|
|
590
|
+
var curToNodeValue = curToNodeChild.ce_;
|
|
591
591
|
var curFromNodeValue = curFromNodeChild.nodeValue;
|
|
592
592
|
if (curFromNodeValue !== curToNodeValue) {
|
|
593
593
|
if (
|
|
594
594
|
isHydrate &&
|
|
595
595
|
toNextSibling &&
|
|
596
596
|
curFromNodeType === TEXT_NODE &&
|
|
597
|
-
toNextSibling.
|
|
597
|
+
toNextSibling.cf_ === TEXT_NODE &&
|
|
598
598
|
curFromNodeValue.startsWith(curToNodeValue) &&
|
|
599
599
|
curFromNodeValue.
|
|
600
600
|
slice(curToNodeValue.length).
|
|
601
|
-
startsWith(toNextSibling.
|
|
601
|
+
startsWith(toNextSibling.ce_))
|
|
602
602
|
{
|
|
603
603
|
// In hydrate mode we can use splitText to more efficiently handle
|
|
604
604
|
// adjacent text vdom nodes that were merged.
|
|
@@ -643,10 +643,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
// We have processed all of the "to nodes".
|
|
646
|
-
if (fromNode.
|
|
646
|
+
if (fromNode.cy_) {
|
|
647
647
|
// If we are in an unfinished fragment, we have reached the end of the nodes
|
|
648
648
|
// we were matching up and need to end the fragment
|
|
649
|
-
fromNode.
|
|
649
|
+
fromNode.cy_(curFromNodeChild);
|
|
650
650
|
} else {
|
|
651
651
|
// If curFromNodeChild is non-null then we still have some from nodes
|
|
652
652
|
// left over that need to be removed
|
|
@@ -686,11 +686,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
686
686
|
}
|
|
687
687
|
|
|
688
688
|
function morphEl(fromEl, vFromEl, toEl, parentComponent) {
|
|
689
|
-
var nodeName = toEl.
|
|
690
|
-
var constId = toEl.
|
|
689
|
+
var nodeName = toEl.cm_;
|
|
690
|
+
var constId = toEl.co_;
|
|
691
691
|
vElementByDOMNode.set(fromEl, toEl);
|
|
692
692
|
|
|
693
|
-
if (constId !== undefined && vFromEl.
|
|
693
|
+
if (constId !== undefined && vFromEl.co_ === constId) {
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
696
|
|
|
@@ -701,11 +701,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
701
701
|
}
|
|
702
702
|
|
|
703
703
|
if (isTextOnly(nodeName)) {
|
|
704
|
-
if (toEl.
|
|
704
|
+
if (toEl.cn_ !== vFromEl.cn_) {
|
|
705
705
|
if (nodeName === "textarea") {
|
|
706
|
-
fromEl.value = toEl.
|
|
706
|
+
fromEl.value = toEl.cn_;
|
|
707
707
|
} else {
|
|
708
|
-
fromEl.textContent = toEl.
|
|
708
|
+
fromEl.textContent = toEl.cn_;
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
} else {
|
|
@@ -12,7 +12,7 @@ var specialHtmlRegexp = /[&<]/;
|
|
|
12
12
|
function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
|
13
13
|
var curChild = node.firstChild;
|
|
14
14
|
while (curChild) {
|
|
15
|
-
vdomParent.
|
|
15
|
+
vdomParent.bX_(virtualize(curChild, ownerComponent));
|
|
16
16
|
curChild = curChild.nextSibling;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
|
|
20
20
|
function virtualize(node, ownerComponent) {
|
|
21
21
|
switch (node.nodeType) {
|
|
22
22
|
case 1:
|
|
23
|
-
return VElement.
|
|
23
|
+
return VElement.cq_(node, virtualizeChildNodes, ownerComponent);
|
|
24
24
|
case 3:
|
|
25
25
|
return new VText(node.nodeValue, ownerComponent);
|
|
26
26
|
case 8:
|
|
@@ -43,7 +43,7 @@ function virtualizeHTML(html, ownerComponent) {
|
|
|
43
43
|
|
|
44
44
|
while (curChild) {
|
|
45
45
|
virtualized = virtualize(curChild, ownerComponent);
|
|
46
|
-
if (virtualized) vdomFragment.
|
|
46
|
+
if (virtualized) vdomFragment.bX_(virtualized);
|
|
47
47
|
curChild = curChild.nextSibling;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -70,19 +70,19 @@ Node_prototype.t = function (value) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
this.
|
|
74
|
-
return this.
|
|
73
|
+
this.bX_(vdomNode || new VText(value.toString()));
|
|
74
|
+
return this.cp_();
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
Node_prototype.
|
|
78
|
-
return this.
|
|
77
|
+
Node_prototype.cb_ = function () {
|
|
78
|
+
return this.bX_(new VDocumentFragment());
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.
|
|
86
|
-
exports.
|
|
87
|
-
exports.
|
|
88
|
-
exports.
|
|
81
|
+
exports.bG_ = VComment;
|
|
82
|
+
exports.bH_ = VDocumentFragment;
|
|
83
|
+
exports.bF_ = VElement;
|
|
84
|
+
exports.bI_ = VText;
|
|
85
|
+
exports.bJ_ = VComponent;
|
|
86
|
+
exports.bK_ = VFragment;
|
|
87
|
+
exports.cq_ = virtualize;
|
|
88
|
+
exports.bL_ = virtualizeHTML;
|
package/dist/translator/index.js
CHANGED
|
@@ -130,11 +130,7 @@ const analyze = exports.analyze = {
|
|
|
130
130
|
const tagName = tag.node.name.value;
|
|
131
131
|
const binding =
|
|
132
132
|
/^[A-Z][a-zA-Z0-9_$]*$/.test(tagName) && tag.scope.getBinding(tagName);
|
|
133
|
-
if (
|
|
134
|
-
binding &&
|
|
135
|
-
binding.path.isImportDefaultSpecifier() &&
|
|
136
|
-
binding.identifier.loc)
|
|
137
|
-
{
|
|
133
|
+
if (binding && binding.path.isImportDefaultSpecifier()) {
|
|
138
134
|
const importSource = binding.path.parent.source.value;
|
|
139
135
|
relativePath = (0, _babelUtils.resolveTagImport)(tag, importSource) || importSource;
|
|
140
136
|
tag.node.extra = tag.node.extra || {};
|
|
@@ -168,7 +164,7 @@ const analyze = exports.analyze = {
|
|
|
168
164
|
// expression (identifiers, conditionals, etc.) to detect the boundary.
|
|
169
165
|
const markIfTagsImport = (scope, name) => {
|
|
170
166
|
const binding = name && scope.getBinding(name);
|
|
171
|
-
if (binding && binding.kind === "module"
|
|
167
|
+
if (binding && binding.kind === "module") {
|
|
172
168
|
const childFile = (0, _babelUtils.loadFileForImport)(
|
|
173
169
|
file,
|
|
174
170
|
binding.path.parent.source.value
|
|
@@ -773,7 +769,8 @@ function getClassHydrationMode(file, visited = new Set()) {
|
|
|
773
769
|
|
|
774
770
|
visited.add(fileName);
|
|
775
771
|
|
|
776
|
-
|
|
772
|
+
// A legacy `w-bind` widget can register through a dependency instead of `component`.
|
|
773
|
+
if (meta.component || meta.widgetBind) {
|
|
777
774
|
return meta.classHydration = CLASS_HYDRATION_SELF;
|
|
778
775
|
}
|
|
779
776
|
|
|
@@ -57,8 +57,7 @@ function _default(path, isNullable) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
if (binding && !binding.identifier.loc) binding = null;
|
|
60
|
+
const binding = !relativePath && path.scope.getBinding(tagName);
|
|
62
61
|
|
|
63
62
|
if (relativePath) {
|
|
64
63
|
tagIdentifier = node.extra?.tagNameLoad ?
|
|
@@ -25,6 +25,7 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
25
25
|
const foundProperties = {};
|
|
26
26
|
const hasAttributeTags = !!attributeTags.length;
|
|
27
27
|
const isTagsAPI = findRootTag(path)?.node.extra?.featureType === "tags";
|
|
28
|
+
const isTagsAttrTag = isTagsAPI && isAttrTag;
|
|
28
29
|
const renderBodyKey = isTagsAPI ? "content" : "renderBody";
|
|
29
30
|
|
|
30
31
|
for (let i = 0; i < attrsLen; i++) {
|
|
@@ -79,7 +80,9 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
// `attr-tag.js` › `i` stores a returned body as `renderBody`, so a Tags
|
|
84
|
+
// attribute tag keeps its body keyed even beside nested attribute tags.
|
|
85
|
+
if (childLen && (!hasAttributeTags || isTagsAttrTag)) {
|
|
83
86
|
properties.push(
|
|
84
87
|
_compiler.types.objectProperty(
|
|
85
88
|
_compiler.types.stringLiteral(renderBodyKey),
|
|
@@ -126,7 +129,7 @@ function getAttrs(path, preserveNames, isAttrTag) {
|
|
|
126
129
|
if (hasAttributeTags) {
|
|
127
130
|
let attrTagBody = attributeTags;
|
|
128
131
|
|
|
129
|
-
if (body.length) {
|
|
132
|
+
if (body.length && !isTagsAttrTag) {
|
|
130
133
|
attrTagBody = attrTagBody.concat(
|
|
131
134
|
_compiler.types.returnStatement(
|
|
132
135
|
_compiler.types.arrowFunctionExpression(
|
|
@@ -10,14 +10,13 @@ function enter(path) {
|
|
|
10
10
|
'You must provide a promise argument to the "<await>" tag, eg: "<await(promise)>".'
|
|
11
11
|
);
|
|
12
12
|
} else if (args.length > 1) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
loc: { end }
|
|
18
|
-
} = args[args.length - 1].node;
|
|
13
|
+
// A built argument has no loc, so the error then marks the tag.
|
|
14
|
+
const first = args[1].node;
|
|
15
|
+
const last = args[args.length - 1].node;
|
|
19
16
|
throw path.hub.file.buildCodeFrameError(
|
|
20
|
-
|
|
17
|
+
first.loc && last.loc ?
|
|
18
|
+
{ loc: { start: first.loc.start, end: last.loc.end } } :
|
|
19
|
+
path.node,
|
|
21
20
|
'You can only pass one argument to the "<await>" tag.'
|
|
22
21
|
);
|
|
23
22
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _escapeRegexp = require("./escape-regexp");function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
|
|
4
4
|
|
|
5
|
-
const COMPONENT_FILES_KEY = "
|
|
5
|
+
const COMPONENT_FILES_KEY = "cA_";
|
|
6
6
|
|
|
7
7
|
function getComponentFiles({ hub: { file } }) {
|
|
8
8
|
const meta = file.metadata.marko;
|
package/index.d.ts
CHANGED
|
@@ -287,7 +287,7 @@ declare global {
|
|
|
287
287
|
input: Marko.TemplateInput<Input>,
|
|
288
288
|
reference: Node,
|
|
289
289
|
position?: "afterbegin" | "afterend" | "beforebegin" | "beforeend",
|
|
290
|
-
): Marko.MountedTemplate<typeof input>;
|
|
290
|
+
): Marko.MountedTemplate<typeof input, Return>;
|
|
291
291
|
/** @marko-overload-end */
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -363,9 +363,7 @@ declare global {
|
|
|
363
363
|
? Name extends keyof NativeTags
|
|
364
364
|
? NativeTags[Name]["input"]
|
|
365
365
|
: Record<string, unknown>
|
|
366
|
-
: Name extends
|
|
367
|
-
| Template<infer Input, any>
|
|
368
|
-
| { _(): () => (input: infer Input) => any }
|
|
366
|
+
: Name extends Template<infer Input, any>
|
|
369
367
|
? Input
|
|
370
368
|
: Name extends Body<infer Args, any>
|
|
371
369
|
? Args extends {
|
|
@@ -385,10 +383,7 @@ declare global {
|
|
|
385
383
|
? Name extends keyof NativeTags
|
|
386
384
|
? NativeTags[Name]["return"]
|
|
387
385
|
: () => Element
|
|
388
|
-
: Name extends
|
|
389
|
-
| { _(): () => (input: any) => { return: infer Return } }
|
|
390
|
-
| Template<any, infer Return>
|
|
391
|
-
| Body<any, infer Return>
|
|
386
|
+
: Name extends Template<any, infer Return> | Body<any, infer Return>
|
|
392
387
|
? Return
|
|
393
388
|
: never;
|
|
394
389
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.51",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "index.d.ts",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@marko/compiler": "^5.42.
|
|
71
|
-
"@marko/runtime-tags": "
|
|
70
|
+
"@marko/compiler": "^5.42.18",
|
|
71
|
+
"@marko/runtime-tags": "6.4.12",
|
|
72
72
|
"app-module-path": "^2.2.0",
|
|
73
73
|
"argly": "^1.2.0",
|
|
74
74
|
"browser-refresh-client": "1.1.4",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"warp10": "^2.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"marko": "5.39.
|
|
86
|
+
"marko": "5.39.51"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=22.12.0"
|
|
@@ -69,9 +69,7 @@ module.exports = function dynamicTag(
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
var renderer =
|
|
73
|
-
tag._ ||
|
|
74
|
-
(tag.renderer ? tag.renderer.renderer || tag.renderer : tag.render);
|
|
72
|
+
var renderer = getRenderer(tag);
|
|
75
73
|
var render = (tag && tag.renderBody) || tag;
|
|
76
74
|
|
|
77
75
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -244,4 +242,13 @@ function addEvents(componentDef, customEvents, props) {
|
|
|
244
242
|
return result;
|
|
245
243
|
}
|
|
246
244
|
|
|
245
|
+
// A template's Class renderer, from any of the shapes a template or component takes.
|
|
246
|
+
function getRenderer(tag) {
|
|
247
|
+
var renderer =
|
|
248
|
+
tag._ ||
|
|
249
|
+
(tag.renderer ? tag.renderer.renderer || tag.renderer : tag.render);
|
|
250
|
+
return typeof renderer === "function" ? renderer : undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
module.exports.___getRenderer = getRenderer;
|
|
247
254
|
module.exports.___CLASS_EVENT_MARKER = CLASS_EVENT_MARKER;
|