marko 5.39.50 → 5.40.0
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/compiler/index.js +0 -2
- package/dist/core-tags/core/await/index.d.marko +17 -0
- package/dist/core-tags/core/script.d.marko +6 -1
- 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 +39 -58
- 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 -35
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/taglib/index.js +3 -6
- package/dist/translator/index.js +8 -23
- package/dist/translator/tag/attribute/index.js +0 -16
- package/dist/translator/tag/attribute-tag.js +4 -11
- package/dist/translator/tag/custom-tag.js +1 -2
- package/dist/translator/tag/native-tag[html]/index.js +1 -13
- package/dist/translator/tag/native-tag[vdom]/index.js +0 -12
- package/dist/translator/tag/util.js +69 -55
- package/dist/translator/taglib/core/index.js +17 -366
- package/dist/translator/util/get-component-files.js +1 -1
- package/dist/translator/util/runtime-flags.js +2 -3
- package/dist/translator.js +4 -2
- package/docs/marko-json.md +3 -6
- package/index.d.ts +3 -8
- package/package.json +4 -4
- package/src/compiler/index.js +0 -2
- package/src/core-tags/core/await/index.d.marko +17 -0
- package/src/core-tags/core/script.d.marko +6 -1
- 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/runtime/vdom/VElement.js +10 -29
- package/src/runtime/vdom/morphdom/index.js +0 -1
- package/src/taglib/index.js +3 -6
- package/src/translator/index.js +6 -21
- package/src/translator/tag/attribute/index.js +1 -17
- package/src/translator/tag/attribute-tag.js +4 -11
- package/src/translator/tag/custom-tag.js +1 -2
- package/src/translator/tag/native-tag[html]/index.js +0 -12
- package/src/translator/tag/native-tag[vdom]/index.js +1 -13
- package/src/translator/tag/util.js +69 -55
- package/src/translator/taglib/core/index.js +0 -349
- package/src/translator/util/runtime-flags.js +1 -2
- package/src/translator.js +2 -0
- package/translator/index.d.ts +1 -0
|
@@ -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;
|
|
@@ -35,7 +35,6 @@ var FRAGMENT_NODE = 12;
|
|
|
35
35
|
var DOCTYPE_NODE = 10;
|
|
36
36
|
|
|
37
37
|
// var FLAG_SIMPLE_ATTRS = 1;
|
|
38
|
-
// var FLAG_CUSTOM_ELEMENT = 2;
|
|
39
38
|
// var FLAG_SPREAD_ATTRS = 4;
|
|
40
39
|
|
|
41
40
|
function isAutoKey(key) {
|
|
@@ -43,7 +42,7 @@ function isAutoKey(key) {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
function compareNodeNames(fromEl, toEl) {
|
|
46
|
-
return fromEl.
|
|
45
|
+
return fromEl.cm_ === toEl.cm_;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
function caseInsensitiveCompare(a, b) {
|
|
@@ -74,12 +73,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
74
73
|
ownerComponent,
|
|
75
74
|
parentComponent)
|
|
76
75
|
{
|
|
77
|
-
var realNode = vNode.
|
|
76
|
+
var realNode = vNode.bw_(host, parentEl.namespaceURI);
|
|
78
77
|
insertBefore(realNode, referenceEl, parentEl);
|
|
79
78
|
|
|
80
79
|
if (
|
|
81
|
-
vNode.
|
|
82
|
-
vNode.
|
|
80
|
+
vNode.cf_ === ELEMENT_NODE ||
|
|
81
|
+
vNode.cf_ === FRAGMENT_NODE)
|
|
83
82
|
{
|
|
84
83
|
if (key) {
|
|
85
84
|
keysByDOMNode.set(realNode, key);
|
|
@@ -88,7 +87,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
88
87
|
realNode;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
if (!isTextOnly(vNode.
|
|
90
|
+
if (!isTextOnly(vNode.cm_)) {
|
|
92
91
|
morphChildren(realNode, vNode, parentComponent);
|
|
93
92
|
}
|
|
94
93
|
|
|
@@ -162,9 +161,9 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
162
161
|
var fromComponent;
|
|
163
162
|
|
|
164
163
|
outer: while (curToNodeChild) {
|
|
165
|
-
toNextSibling = curToNodeChild.
|
|
166
|
-
curToNodeType = curToNodeChild.
|
|
167
|
-
curToNodeKey = curToNodeChild.
|
|
164
|
+
toNextSibling = curToNodeChild.cv_;
|
|
165
|
+
curToNodeType = curToNodeChild.cf_;
|
|
166
|
+
curToNodeKey = curToNodeChild.cg_;
|
|
168
167
|
|
|
169
168
|
// Skip <!doctype>
|
|
170
169
|
if (curFromNodeChild && curFromNodeChild.nodeType === DOCTYPE_NODE) {
|
|
@@ -283,7 +282,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
283
282
|
|
|
284
283
|
if (
|
|
285
284
|
curVFromNodeChild &&
|
|
286
|
-
curToNodeType === curVFromNodeChild.
|
|
285
|
+
curToNodeType === curVFromNodeChild.cf_ && (
|
|
287
286
|
curToNodeType !== ELEMENT_NODE ||
|
|
288
287
|
compareNodeNames(curToNodeChild, curVFromNodeChild)))
|
|
289
288
|
{
|
|
@@ -328,11 +327,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
328
327
|
curToNodeChild.ag_ ||
|
|
329
328
|
caseInsensitiveCompare(
|
|
330
329
|
curFromNodeChild.nodeName,
|
|
331
|
-
curToNodeChild.
|
|
330
|
+
curToNodeChild.cm_ || ""
|
|
332
331
|
)))
|
|
333
332
|
{
|
|
334
333
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
|
335
|
-
curVFromNodeChild.
|
|
334
|
+
curVFromNodeChild.cm_ = curToNodeChild.cm_;
|
|
336
335
|
keysByDOMNode.set(curFromNodeChild, curToNodeKey);
|
|
337
336
|
referenceComponent.L_[curToNodeKey] =
|
|
338
337
|
curFromNodeChild;
|
|
@@ -352,7 +351,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
352
351
|
curFromNodeChild = fromNextSibling;
|
|
353
352
|
continue;
|
|
354
353
|
} else if (
|
|
355
|
-
curToNodeChild.
|
|
354
|
+
curToNodeChild.cf_ === FRAGMENT_NODE &&
|
|
356
355
|
curFromNodeChild.nodeType === COMMENT_NODE)
|
|
357
356
|
{
|
|
358
357
|
var content = curFromNodeChild.nodeValue;
|
|
@@ -418,7 +417,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
418
417
|
|
|
419
418
|
if (
|
|
420
419
|
curVFromNodeChild &&
|
|
421
|
-
curToNodeType === curVFromNodeChild.
|
|
420
|
+
curToNodeType === curVFromNodeChild.cf_ && (
|
|
422
421
|
curToNodeType !== ELEMENT_NODE ||
|
|
423
422
|
compareNodeNames(curVFromNodeChild, curToNodeChild)))
|
|
424
423
|
{
|
|
@@ -436,7 +435,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
436
435
|
|
|
437
436
|
if (
|
|
438
437
|
toNextSibling &&
|
|
439
|
-
toNextSibling.
|
|
438
|
+
toNextSibling.cg_ === curFromNodeKey)
|
|
440
439
|
{
|
|
441
440
|
// Single element swap
|
|
442
441
|
|
|
@@ -549,18 +548,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
549
548
|
|
|
550
549
|
if (
|
|
551
550
|
caseInsensitiveCompare(
|
|
552
|
-
curVFromNodeChild.
|
|
553
|
-
curToNodeChild.
|
|
551
|
+
curVFromNodeChild.cm_,
|
|
552
|
+
curToNodeChild.cm_
|
|
554
553
|
))
|
|
555
554
|
{
|
|
556
|
-
curVFromNodeChild.
|
|
555
|
+
curVFromNodeChild.cm_ = curToNodeChild.cm_;
|
|
557
556
|
}
|
|
558
557
|
} else {
|
|
559
558
|
// Skip over nodes that don't look like ours...
|
|
560
559
|
curFromNodeChild = fromNextSibling;
|
|
561
560
|
continue;
|
|
562
561
|
}
|
|
563
|
-
} else if (curVFromNodeChild.
|
|
562
|
+
} else if (curVFromNodeChild.cg_) {
|
|
564
563
|
// We have a keyed element here but our target VDOM node
|
|
565
564
|
// is not keyed so this not doesn't belong
|
|
566
565
|
isCompatible = false;
|
|
@@ -587,18 +586,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
587
586
|
{
|
|
588
587
|
// Both nodes being compared are Text or Comment nodes
|
|
589
588
|
isCompatible = true;
|
|
590
|
-
var curToNodeValue = curToNodeChild.
|
|
589
|
+
var curToNodeValue = curToNodeChild.ce_;
|
|
591
590
|
var curFromNodeValue = curFromNodeChild.nodeValue;
|
|
592
591
|
if (curFromNodeValue !== curToNodeValue) {
|
|
593
592
|
if (
|
|
594
593
|
isHydrate &&
|
|
595
594
|
toNextSibling &&
|
|
596
595
|
curFromNodeType === TEXT_NODE &&
|
|
597
|
-
toNextSibling.
|
|
596
|
+
toNextSibling.cf_ === TEXT_NODE &&
|
|
598
597
|
curFromNodeValue.startsWith(curToNodeValue) &&
|
|
599
598
|
curFromNodeValue.
|
|
600
599
|
slice(curToNodeValue.length).
|
|
601
|
-
startsWith(toNextSibling.
|
|
600
|
+
startsWith(toNextSibling.ce_))
|
|
602
601
|
{
|
|
603
602
|
// In hydrate mode we can use splitText to more efficiently handle
|
|
604
603
|
// adjacent text vdom nodes that were merged.
|
|
@@ -643,10 +642,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
643
642
|
}
|
|
644
643
|
|
|
645
644
|
// We have processed all of the "to nodes".
|
|
646
|
-
if (fromNode.
|
|
645
|
+
if (fromNode.cy_) {
|
|
647
646
|
// If we are in an unfinished fragment, we have reached the end of the nodes
|
|
648
647
|
// we were matching up and need to end the fragment
|
|
649
|
-
fromNode.
|
|
648
|
+
fromNode.cy_(curFromNodeChild);
|
|
650
649
|
} else {
|
|
651
650
|
// If curFromNodeChild is non-null then we still have some from nodes
|
|
652
651
|
// left over that need to be removed
|
|
@@ -686,11 +685,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
686
685
|
}
|
|
687
686
|
|
|
688
687
|
function morphEl(fromEl, vFromEl, toEl, parentComponent) {
|
|
689
|
-
var nodeName = toEl.
|
|
690
|
-
var constId = toEl.
|
|
688
|
+
var nodeName = toEl.cm_;
|
|
689
|
+
var constId = toEl.co_;
|
|
691
690
|
vElementByDOMNode.set(fromEl, toEl);
|
|
692
691
|
|
|
693
|
-
if (constId !== undefined && vFromEl.
|
|
692
|
+
if (constId !== undefined && vFromEl.co_ === constId) {
|
|
694
693
|
return;
|
|
695
694
|
}
|
|
696
695
|
|
|
@@ -701,11 +700,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
|
701
700
|
}
|
|
702
701
|
|
|
703
702
|
if (isTextOnly(nodeName)) {
|
|
704
|
-
if (toEl.
|
|
703
|
+
if (toEl.cn_ !== vFromEl.cn_) {
|
|
705
704
|
if (nodeName === "textarea") {
|
|
706
|
-
fromEl.value = toEl.
|
|
705
|
+
fromEl.value = toEl.cn_;
|
|
707
706
|
} else {
|
|
708
|
-
fromEl.textContent = toEl.
|
|
707
|
+
fromEl.textContent = toEl.cn_;
|
|
709
708
|
}
|
|
710
709
|
}
|
|
711
710
|
} 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/taglib/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// eslint-disable-next-line no-constant-binary-expression
|
|
4
4
|
|
|
5
5
|
const compiler = require("@marko/compiler");
|
|
6
|
+
const path = require("path");
|
|
6
7
|
|
|
7
8
|
function clearCache() {
|
|
8
9
|
compiler.taglib.clearCaches();
|
|
@@ -12,11 +13,9 @@ function register(taglibProps, taglibPath) {
|
|
|
12
13
|
return compiler.taglib.register(taglibPath, taglibProps);
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
// A path relative to the working directory, as it was read before.
|
|
15
17
|
function registerFromFile(taglibPath) {
|
|
16
|
-
return register(
|
|
17
|
-
compiler.taglib._loader.loadTaglibFromFile(taglibPath),
|
|
18
|
-
taglibPath
|
|
19
|
-
);
|
|
18
|
+
return register(undefined, path.resolve(taglibPath));
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
exports.clearCache = clearCache;
|
|
@@ -25,8 +24,6 @@ exports.registerFromFile = registerFromFile;
|
|
|
25
24
|
exports.buildLookup = compiler.taglib.buildLookup;
|
|
26
25
|
exports.excludeDir = compiler.taglib.excludeDir;
|
|
27
26
|
exports.excludePackage = compiler.taglib.excludePackage;
|
|
28
|
-
exports.loader = compiler.taglib._loader;
|
|
29
|
-
exports.finder = compiler.taglib._finder;
|
|
30
27
|
exports.lookup = {
|
|
31
28
|
buildLookup: function (dir, translator) {
|
|
32
29
|
if (!translator || !Array.isArray(translator.taglibs)) {
|
package/dist/translator/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.analyze = void 0;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.version = exports.translate = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.optionalTaglibs = exports.internalEntryBuilder = void 0;var
|
|
2
|
-
|
|
3
|
-
var _compiler = require("@marko/compiler");
|
|
1
|
+
"use strict";exports.__esModule = true;exports.classTaglibs = exports.analyze = void 0;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.version = exports.translate = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.optionalTaglibs = exports.internalEntryBuilder = void 0;var _compiler = require("@marko/compiler");
|
|
4
2
|
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
5
3
|
|
|
6
4
|
|
|
@@ -39,9 +37,12 @@ var _optimizeVdomCreate = require("./util/optimize-vdom-create");
|
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
|
|
42
|
-
var _taglib = _interopRequireWildcard(require("./taglib"));exports.optionalTaglibs = _taglib.optionalTaglibs;exports.taglibs = _taglib.default;function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const CLASS_HYDRATION_SELF = "self";const CLASS_HYDRATION_DESCENDANT = "descendant";const version = exports.version = _package.default.version;const tagDiscoveryDirs = exports.tagDiscoveryDirs = ["components"];
|
|
43
40
|
|
|
44
41
|
|
|
42
|
+
|
|
43
|
+
var _taglib = _interopRequireWildcard(require("./taglib"));exports.optionalTaglibs = _taglib.optionalTaglibs;exports.taglibs = _taglib.default;function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const CLASS_HYDRATION_SELF = "self";const CLASS_HYDRATION_DESCENDANT = "descendant";const version = exports.version = _package.default.version;const tagDiscoveryDirs = exports.tagDiscoveryDirs = ["components"]; // Its taglibs declare attributes, nested tags and renderers, and its tag folders
|
|
44
|
+
// take renderers, hook files and older template names.
|
|
45
|
+
const classTaglibs = exports.classTaglibs = true;
|
|
45
46
|
const preferAPI = exports.preferAPI = "class";
|
|
46
47
|
const analyze = exports.analyze = {
|
|
47
48
|
Program: {
|
|
@@ -105,19 +106,7 @@ const analyze = exports.analyze = {
|
|
|
105
106
|
let relativePath;
|
|
106
107
|
|
|
107
108
|
if (tagDef) {
|
|
108
|
-
if (
|
|
109
|
-
if (tagDef.htmlType === "custom-element") {
|
|
110
|
-
if (tagDef.parseOptions && tagDef.parseOptions.import) {
|
|
111
|
-
// TODO: the taglib should be updated to support this as a top level option.
|
|
112
|
-
meta.deps.push(
|
|
113
|
-
(0, _path.resolve)(
|
|
114
|
-
tagDef.dir,
|
|
115
|
-
(0, _path.resolve)(tagDef.dir, tagDef.parseOptions.import)
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} else if (_compiler.types.isStringLiteral(tag.node.name)) {
|
|
109
|
+
if (!(0, _babelUtils.isNativeTag)(tag)) {
|
|
121
110
|
relativePath = resolveRelativeTagEntry(file, tagDef);
|
|
122
111
|
}
|
|
123
112
|
|
|
@@ -130,11 +119,7 @@ const analyze = exports.analyze = {
|
|
|
130
119
|
const tagName = tag.node.name.value;
|
|
131
120
|
const binding =
|
|
132
121
|
/^[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
|
-
{
|
|
122
|
+
if (binding && binding.path.isImportDefaultSpecifier()) {
|
|
138
123
|
const importSource = binding.path.parent.source.value;
|
|
139
124
|
relativePath = (0, _babelUtils.resolveTagImport)(tag, importSource) || importSource;
|
|
140
125
|
tag.node.extra = tag.node.extra || {};
|
|
@@ -168,7 +153,7 @@ const analyze = exports.analyze = {
|
|
|
168
153
|
// expression (identifiers, conditionals, etc.) to detect the boundary.
|
|
169
154
|
const markIfTagsImport = (scope, name) => {
|
|
170
155
|
const binding = name && scope.getBinding(name);
|
|
171
|
-
if (binding && binding.kind === "module"
|
|
156
|
+
if (binding && binding.kind === "module") {
|
|
172
157
|
const childFile = (0, _babelUtils.loadFileForImport)(
|
|
173
158
|
file,
|
|
174
159
|
binding.path.parent.source.value
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";exports.__esModule = true;exports.default = void 0;var _babelUtils = require("@marko/compiler/babel-utils");
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
3
|
var _directives = _interopRequireDefault(require("./directives"));
|
|
8
4
|
var _modifiers = _interopRequireDefault(require("./modifiers"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
|
|
9
5
|
|
|
@@ -91,18 +87,6 @@ const attachedDetachedLoaded = new WeakSet();var _default = exports.default =
|
|
|
91
87
|
return;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
const tagDef = (0, _babelUtils.getTagDef)(tag);
|
|
95
|
-
|
|
96
|
-
if (tagDef) {
|
|
97
|
-
if (!tagDef.html && !tagDef.getAttribute(name)) {
|
|
98
|
-
throw attr.buildCodeFrameError(
|
|
99
|
-
`<${
|
|
100
|
-
tag.get("name.value").node}> does not support the "${
|
|
101
|
-
name}" attribute.`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
90
|
if (args && args.length) {
|
|
107
91
|
throw attr.buildCodeFrameError(
|
|
108
92
|
`Unsupported arguments on the "${name}" attribute.`
|
|
@@ -35,17 +35,10 @@ function analyzeAttributeTags(rootTag) {
|
|
|
35
35
|
(0, _babelUtils.assertNoArgs)(child);
|
|
36
36
|
const tagDef = (0, _babelUtils.getTagDef)(child) || {};
|
|
37
37
|
const name = (0, _babelUtils.getFullyResolvedTagName)(child);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const preserveName =
|
|
44
|
-
tagDef.preserveName === true || tagDef.removeDashes === false;
|
|
45
|
-
|
|
46
|
-
if (!preserveName) {
|
|
47
|
-
targetProperty = removeDashes(targetProperty);
|
|
48
|
-
}
|
|
38
|
+
const { isRepeated = false } = tagDef;
|
|
39
|
+
const targetProperty = removeDashes(
|
|
40
|
+
tagDef.targetProperty || child.node.name.value.slice(1)
|
|
41
|
+
);
|
|
49
42
|
|
|
50
43
|
const attrTagMeta = (attributeTags ||= {})[name] ||= {
|
|
51
44
|
targetProperty,
|
|
@@ -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 ?
|