marko 5.35.14 → 5.35.16
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/node_modules/@internal/components-entry/index.js +2 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +67 -62
- package/dist/runtime/vdom/VComment.js +24 -0
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +6 -6
- package/dist/runtime/vdom/VElement.js +32 -32
- package/dist/runtime/vdom/VFragment.js +4 -4
- package/dist/runtime/vdom/VNode.js +29 -29
- package/dist/runtime/vdom/VText.js +7 -7
- package/dist/runtime/vdom/helpers/const-element.js +2 -2
- 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 +31 -31
- package/dist/runtime/vdom/vdom.js +19 -13
- package/package.json +3 -3
- package/src/node_modules/@internal/components-entry/index.js +2 -1
- package/src/runtime/vdom/AsyncVDOMBuilder.js +5 -0
- package/src/runtime/vdom/VComment.js +24 -0
- package/src/runtime/vdom/vdom.js +7 -1
@@ -139,7 +139,8 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
139
139
|
|
140
140
|
if (typeof renderBody === "function" && renderBody.toJSON === w10ToJSON) {
|
141
141
|
flags |= FLAG_HAS_RENDER_BODY;
|
142
|
-
renderBody =
|
142
|
+
renderBody = undefined;
|
143
|
+
if (input) input.renderBody = undefined;
|
143
144
|
}
|
144
145
|
|
145
146
|
var extra = {
|
@@ -4,19 +4,20 @@ var attrsHelper = require("./helpers/attrs");
|
|
4
4
|
var morphdom = require("./morphdom");
|
5
5
|
var vdom = require("./vdom");
|
6
6
|
var VElement = vdom.bz_;
|
7
|
-
var
|
8
|
-
var
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var
|
7
|
+
var VComment = vdom.bA_;
|
8
|
+
var VDocumentFragment = vdom.bB_;
|
9
|
+
var VText = vdom.bC_;
|
10
|
+
var VComponent = vdom.bD_;
|
11
|
+
var VFragment = vdom.bE_;
|
12
|
+
var virtualizeHTML = vdom.bF_;
|
12
13
|
|
13
14
|
var EVENT_UPDATE = "update";
|
14
15
|
var EVENT_FINISH = "finish";
|
15
16
|
|
16
17
|
function State(tree) {
|
17
|
-
this.
|
18
|
-
this.
|
19
|
-
this.
|
18
|
+
this.bG_ = new EventEmitter();
|
19
|
+
this.bH_ = tree;
|
20
|
+
this.bI_ = false;
|
20
21
|
}
|
21
22
|
|
22
23
|
function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
@@ -32,18 +33,18 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
32
33
|
state = new State(parentNode);
|
33
34
|
}
|
34
35
|
|
35
|
-
this.
|
36
|
-
this.
|
37
|
-
this.
|
38
|
-
this.
|
36
|
+
this.bJ_ = 1;
|
37
|
+
this.bK_ = 0;
|
38
|
+
this.bL_ = null;
|
39
|
+
this.bM_ = parentOut;
|
39
40
|
|
40
41
|
this.data = {};
|
41
42
|
this.z_ = state;
|
42
43
|
this.ab_ = parentNode;
|
43
44
|
this.global = globalData || {};
|
44
|
-
this.
|
45
|
-
this.
|
46
|
-
this.
|
45
|
+
this.bN_ = [parentNode];
|
46
|
+
this.bO_ = false;
|
47
|
+
this.bP_ = undefined;
|
47
48
|
this.b_ = null;
|
48
49
|
|
49
50
|
this.a__ = null;
|
@@ -57,18 +58,18 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
57
58
|
|
58
59
|
bc: function (component, key, ownerComponent) {
|
59
60
|
var vComponent = new VComponent(component, key, ownerComponent);
|
60
|
-
return this.
|
61
|
+
return this.bQ_(vComponent, 0, true);
|
61
62
|
},
|
62
63
|
|
63
64
|
bd_: function (component, key, ownerComponent) {
|
64
65
|
var vComponent = new VComponent(component, key, ownerComponent, true);
|
65
|
-
this.
|
66
|
+
this.bQ_(vComponent, 0);
|
66
67
|
},
|
67
68
|
|
68
|
-
|
69
|
-
this.ab_.
|
69
|
+
bQ_: function (child, childCount, pushToStack) {
|
70
|
+
this.ab_.bR_(child);
|
70
71
|
if (pushToStack === true) {
|
71
|
-
this.
|
72
|
+
this.bN_.push(child);
|
72
73
|
this.ab_ = child;
|
73
74
|
}
|
74
75
|
return childCount === 0 ? this : child;
|
@@ -84,7 +85,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
84
85
|
flags,
|
85
86
|
props
|
86
87
|
);
|
87
|
-
return this.
|
88
|
+
return this.bQ_(element, childCount);
|
88
89
|
},
|
89
90
|
|
90
91
|
bm_: function (tagName, attrs, key, componentDef, props) {
|
@@ -102,7 +103,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
102
103
|
n: function (node, component) {
|
103
104
|
// NOTE: We do a shallow clone since we assume the node is being reused
|
104
105
|
// and a node can only have one parent node.
|
105
|
-
var clone = node.
|
106
|
+
var clone = node.bS_();
|
106
107
|
this.node(clone);
|
107
108
|
clone._M_ = component;
|
108
109
|
|
@@ -110,7 +111,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
110
111
|
},
|
111
112
|
|
112
113
|
node: function (node) {
|
113
|
-
this.ab_.
|
114
|
+
this.ab_.bR_(node);
|
114
115
|
return this;
|
115
116
|
},
|
116
117
|
|
@@ -129,10 +130,14 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
129
130
|
text = text.toString();
|
130
131
|
}
|
131
132
|
|
132
|
-
this.ab_.
|
133
|
+
this.ab_.bR_(new VText(text, ownerComponent));
|
133
134
|
return this;
|
134
135
|
},
|
135
136
|
|
137
|
+
comment: function (comment, ownerComponent) {
|
138
|
+
return this.node(new VComment(comment, ownerComponent));
|
139
|
+
},
|
140
|
+
|
136
141
|
html: function (html, ownerComponent) {
|
137
142
|
if (html != null) {
|
138
143
|
var vdomNode = virtualizeHTML(html, ownerComponent);
|
@@ -160,7 +165,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
160
165
|
flags,
|
161
166
|
props
|
162
167
|
);
|
163
|
-
this.
|
168
|
+
this.bQ_(element, childCount, true);
|
164
169
|
return this;
|
165
170
|
},
|
166
171
|
|
@@ -178,7 +183,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
178
183
|
|
179
184
|
bf: function (key, component, preserve) {
|
180
185
|
var fragment = new VFragment(key, component, preserve);
|
181
|
-
this.
|
186
|
+
this.bQ_(fragment, null, true);
|
182
187
|
return this;
|
183
188
|
},
|
184
189
|
|
@@ -187,7 +192,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
187
192
|
},
|
188
193
|
|
189
194
|
endElement: function () {
|
190
|
-
var stack = this.
|
195
|
+
var stack = this.bN_;
|
191
196
|
stack.pop();
|
192
197
|
this.ab_ = stack[stack.length - 1];
|
193
198
|
},
|
@@ -195,44 +200,44 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
195
200
|
end: function () {
|
196
201
|
this.ab_ = undefined;
|
197
202
|
|
198
|
-
var remaining = --this.
|
199
|
-
var parentOut = this.
|
203
|
+
var remaining = --this.bJ_;
|
204
|
+
var parentOut = this.bM_;
|
200
205
|
|
201
206
|
if (remaining === 0) {
|
202
207
|
if (parentOut) {
|
203
|
-
parentOut.
|
208
|
+
parentOut.bT_();
|
204
209
|
} else {
|
205
|
-
this.
|
210
|
+
this.bU_();
|
206
211
|
}
|
207
|
-
} else if (remaining - this.
|
208
|
-
this.
|
212
|
+
} else if (remaining - this.bK_ === 0) {
|
213
|
+
this.bV_();
|
209
214
|
}
|
210
215
|
|
211
216
|
return this;
|
212
217
|
},
|
213
218
|
|
214
|
-
|
215
|
-
var remaining = --this.
|
219
|
+
bT_: function () {
|
220
|
+
var remaining = --this.bJ_;
|
216
221
|
|
217
222
|
if (remaining === 0) {
|
218
|
-
var parentOut = this.
|
223
|
+
var parentOut = this.bM_;
|
219
224
|
if (parentOut) {
|
220
|
-
parentOut.
|
225
|
+
parentOut.bT_();
|
221
226
|
} else {
|
222
|
-
this.
|
227
|
+
this.bU_();
|
223
228
|
}
|
224
|
-
} else if (remaining - this.
|
225
|
-
this.
|
229
|
+
} else if (remaining - this.bK_ === 0) {
|
230
|
+
this.bV_();
|
226
231
|
}
|
227
232
|
},
|
228
233
|
|
229
|
-
|
234
|
+
bU_: function () {
|
230
235
|
var state = this.z_;
|
231
|
-
state.
|
232
|
-
state.
|
236
|
+
state.bI_ = true;
|
237
|
+
state.bG_.emit(EVENT_FINISH, this.bv_());
|
233
238
|
},
|
234
239
|
|
235
|
-
|
240
|
+
bV_: function () {
|
236
241
|
var lastArray = this._last;
|
237
242
|
|
238
243
|
var i = 0;
|
@@ -267,7 +272,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
267
272
|
},
|
268
273
|
|
269
274
|
beginAsync: function (options) {
|
270
|
-
if (this.
|
275
|
+
if (this.bO_) {
|
271
276
|
throw Error(
|
272
277
|
"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942)."
|
273
278
|
);
|
@@ -277,16 +282,16 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
277
282
|
|
278
283
|
if (options) {
|
279
284
|
if (options.last) {
|
280
|
-
this.
|
285
|
+
this.bK_++;
|
281
286
|
}
|
282
287
|
}
|
283
288
|
|
284
|
-
this.
|
289
|
+
this.bJ_++;
|
285
290
|
|
286
|
-
var documentFragment = this.ab_.
|
291
|
+
var documentFragment = this.ab_.bW_();
|
287
292
|
var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);
|
288
293
|
|
289
|
-
state.
|
294
|
+
state.bG_.emit("beginAsync", {
|
290
295
|
out: asyncOut,
|
291
296
|
parentOut: this
|
292
297
|
});
|
@@ -299,7 +304,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
299
304
|
},
|
300
305
|
|
301
306
|
flush: function () {
|
302
|
-
var events = this.z_.
|
307
|
+
var events = this.z_.bG_;
|
303
308
|
|
304
309
|
if (events.listenerCount(EVENT_UPDATE)) {
|
305
310
|
events.emit(EVENT_UPDATE, new RenderResult(this));
|
@@ -307,22 +312,22 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
307
312
|
},
|
308
313
|
|
309
314
|
ah_: function () {
|
310
|
-
return this.z_.
|
315
|
+
return this.z_.bH_;
|
311
316
|
},
|
312
317
|
|
313
318
|
bv_: function () {
|
314
|
-
return this.
|
319
|
+
return this.bX_ || (this.bX_ = new RenderResult(this));
|
315
320
|
},
|
316
321
|
|
317
322
|
on: function (event, callback) {
|
318
323
|
var state = this.z_;
|
319
324
|
|
320
|
-
if (event === EVENT_FINISH && state.
|
325
|
+
if (event === EVENT_FINISH && state.bI_) {
|
321
326
|
callback(this.bv_());
|
322
327
|
} else if (event === "last") {
|
323
328
|
this.onLast(callback);
|
324
329
|
} else {
|
325
|
-
state.
|
330
|
+
state.bG_.on(event, callback);
|
326
331
|
}
|
327
332
|
|
328
333
|
return this;
|
@@ -331,19 +336,19 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
331
336
|
once: function (event, callback) {
|
332
337
|
var state = this.z_;
|
333
338
|
|
334
|
-
if (event === EVENT_FINISH && state.
|
339
|
+
if (event === EVENT_FINISH && state.bI_) {
|
335
340
|
callback(this.bv_());
|
336
341
|
} else if (event === "last") {
|
337
342
|
this.onLast(callback);
|
338
343
|
} else {
|
339
|
-
state.
|
344
|
+
state.bG_.once(event, callback);
|
340
345
|
}
|
341
346
|
|
342
347
|
return this;
|
343
348
|
},
|
344
349
|
|
345
350
|
emit: function (type, arg) {
|
346
|
-
var events = this.z_.
|
351
|
+
var events = this.z_.bG_;
|
347
352
|
switch (arguments.length) {
|
348
353
|
case 1:
|
349
354
|
events.emit(type);
|
@@ -359,17 +364,17 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
359
364
|
},
|
360
365
|
|
361
366
|
removeListener: function () {
|
362
|
-
var events = this.z_.
|
367
|
+
var events = this.z_.bG_;
|
363
368
|
events.removeListener.apply(events, arguments);
|
364
369
|
return this;
|
365
370
|
},
|
366
371
|
|
367
372
|
sync: function () {
|
368
|
-
this.
|
373
|
+
this.bO_ = true;
|
369
374
|
},
|
370
375
|
|
371
376
|
isSync: function () {
|
372
|
-
return this.
|
377
|
+
return this.bO_;
|
373
378
|
},
|
374
379
|
|
375
380
|
onLast: function (callback) {
|
@@ -385,12 +390,12 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
385
390
|
},
|
386
391
|
|
387
392
|
ag_: function (host) {
|
388
|
-
var node = this.
|
393
|
+
var node = this.bP_;
|
389
394
|
if (!node) {
|
390
395
|
var vdomTree = this.ah_();
|
391
396
|
|
392
397
|
if (!host) host = this.B_;
|
393
|
-
this.
|
398
|
+
this.bP_ = node = vdomTree.bo_(host, null);
|
394
399
|
morphdom(node, vdomTree, host, this.b_);
|
395
400
|
}
|
396
401
|
return node;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";var VNode = require("./VNode");
|
2
|
+
var inherit = require("raptor-util/inherit");
|
3
|
+
|
4
|
+
function VComment(value, ownerComponent) {
|
5
|
+
this.bY_(-1 /* no children */, ownerComponent);
|
6
|
+
this.bZ_ = value;
|
7
|
+
}
|
8
|
+
|
9
|
+
VComment.prototype = {
|
10
|
+
c__: 8,
|
11
|
+
|
12
|
+
bo_: function (doc) {
|
13
|
+
var nodeValue = this.bZ_;
|
14
|
+
return doc.createComment(nodeValue);
|
15
|
+
},
|
16
|
+
|
17
|
+
bS_: function () {
|
18
|
+
return new VComment(this.bZ_);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
inherit(VComment, VNode);
|
23
|
+
|
24
|
+
module.exports = VComment;
|
@@ -2,14 +2,14 @@
|
|
2
2
|
var VNode = require("./VNode");
|
3
3
|
|
4
4
|
function VComponent(component, key, ownerComponent, preserve) {
|
5
|
-
this.
|
6
|
-
this.
|
5
|
+
this.bY_(null /* childCount */, ownerComponent);
|
6
|
+
this.ca_ = key;
|
7
7
|
this.s_ = component;
|
8
8
|
this.ad_ = preserve;
|
9
9
|
}
|
10
10
|
|
11
11
|
VComponent.prototype = {
|
12
|
-
|
12
|
+
c__: 2
|
13
13
|
};
|
14
14
|
|
15
15
|
inherit(VComponent, VNode);
|
@@ -4,21 +4,21 @@ var VNode = require("./VNode");
|
|
4
4
|
|
5
5
|
function VDocumentFragmentClone(other) {
|
6
6
|
extend(this, other);
|
7
|
-
this.
|
8
|
-
this.
|
7
|
+
this.cb_ = null;
|
8
|
+
this.cc_ = null;
|
9
9
|
}
|
10
10
|
|
11
11
|
function VDocumentFragment(out) {
|
12
|
-
this.
|
12
|
+
this.bY_(null /* childCount */);
|
13
13
|
this.r_ = out;
|
14
14
|
}
|
15
15
|
|
16
16
|
VDocumentFragment.prototype = {
|
17
|
-
|
17
|
+
c__: 11,
|
18
18
|
|
19
|
-
|
19
|
+
cd_: true,
|
20
20
|
|
21
|
-
|
21
|
+
bS_: function () {
|
22
22
|
return new VDocumentFragmentClone(this);
|
23
23
|
},
|
24
24
|
|
@@ -80,17 +80,17 @@ function assign(a, b) {
|
|
80
80
|
}
|
81
81
|
|
82
82
|
function VElementClone(other) {
|
83
|
-
this.cc_ = other.cc_;
|
84
|
-
this.c__ = null;
|
85
|
-
this.ca_ = null;
|
86
|
-
|
87
|
-
this.bY_ = other.bY_;
|
88
|
-
this.cd_ = other.cd_;
|
89
|
-
this._O_ = other._O_;
|
90
83
|
this.ce_ = other.ce_;
|
91
|
-
this.
|
84
|
+
this.cb_ = null;
|
85
|
+
this.cc_ = null;
|
86
|
+
|
87
|
+
this.ca_ = other.ca_;
|
92
88
|
this.cf_ = other.cf_;
|
89
|
+
this._O_ = other._O_;
|
93
90
|
this.cg_ = other.cg_;
|
91
|
+
this.u_ = other.u_;
|
92
|
+
this.ch_ = other.ch_;
|
93
|
+
this.ci_ = other.ci_;
|
94
94
|
}
|
95
95
|
|
96
96
|
function VElement(
|
@@ -102,7 +102,7 @@ childCount,
|
|
102
102
|
flags,
|
103
103
|
props)
|
104
104
|
{
|
105
|
-
this.
|
105
|
+
this.bY_(childCount, ownerComponent);
|
106
106
|
|
107
107
|
var constId;
|
108
108
|
|
@@ -110,21 +110,21 @@ props)
|
|
110
110
|
constId = props.i;
|
111
111
|
}
|
112
112
|
|
113
|
-
this.
|
113
|
+
this.ca_ = key;
|
114
114
|
this.u_ = flags || 0;
|
115
|
-
this.
|
115
|
+
this.cf_ = attrs || EMPTY_OBJECT;
|
116
116
|
this._O_ = props || EMPTY_OBJECT;
|
117
|
-
this.
|
118
|
-
this.
|
119
|
-
this.
|
117
|
+
this.cg_ = tagName;
|
118
|
+
this.ch_ = "";
|
119
|
+
this.ci_ = constId;
|
120
120
|
this.ad_ = false;
|
121
121
|
this.ac_ = false;
|
122
122
|
}
|
123
123
|
|
124
124
|
VElement.prototype = {
|
125
|
-
|
125
|
+
c__: 1,
|
126
126
|
|
127
|
-
|
127
|
+
bS_: function () {
|
128
128
|
return new VElementClone(this);
|
129
129
|
},
|
130
130
|
|
@@ -136,7 +136,7 @@ VElement.prototype = {
|
|
136
136
|
* @param {int|null} childCount The number of child nodes (or `null` if not known)
|
137
137
|
*/
|
138
138
|
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
139
|
-
var child = this.
|
139
|
+
var child = this.bR_(
|
140
140
|
new VElement(
|
141
141
|
tagName,
|
142
142
|
attrs,
|
@@ -149,7 +149,7 @@ VElement.prototype = {
|
|
149
149
|
);
|
150
150
|
|
151
151
|
if (childCount === 0) {
|
152
|
-
return this.
|
152
|
+
return this.cj_();
|
153
153
|
} else {
|
154
154
|
return child;
|
155
155
|
}
|
@@ -162,15 +162,15 @@ VElement.prototype = {
|
|
162
162
|
* @param {String} value The value for the new Comment node
|
163
163
|
*/
|
164
164
|
n: function (node, ownerComponent) {
|
165
|
-
node = node.
|
165
|
+
node = node.bS_();
|
166
166
|
node._M_ = ownerComponent;
|
167
|
-
this.
|
168
|
-
return this.
|
167
|
+
this.bR_(node);
|
168
|
+
return this.cj_();
|
169
169
|
},
|
170
170
|
|
171
171
|
bo_: function (host, parentNamespaceURI) {
|
172
|
-
var tagName = this.
|
173
|
-
var attributes = this.
|
172
|
+
var tagName = this.cg_;
|
173
|
+
var attributes = this.cf_;
|
174
174
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
175
175
|
|
176
176
|
var flags = this.u_;
|
@@ -195,7 +195,7 @@ VElement.prototype = {
|
|
195
195
|
}
|
196
196
|
|
197
197
|
if (tagName === "textarea") {
|
198
|
-
el.defaultValue = this.
|
198
|
+
el.defaultValue = this.ch_;
|
199
199
|
}
|
200
200
|
}
|
201
201
|
|
@@ -249,8 +249,8 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
249
249
|
props
|
250
250
|
);
|
251
251
|
|
252
|
-
if (vdomEl.
|
253
|
-
vdomEl.
|
252
|
+
if (vdomEl.cg_ === "textarea") {
|
253
|
+
vdomEl.ch_ = node.value;
|
254
254
|
} else if (virtualizeChildNodes) {
|
255
255
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
256
256
|
}
|
@@ -258,12 +258,12 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
258
258
|
return vdomEl;
|
259
259
|
}
|
260
260
|
|
261
|
-
VElement.
|
261
|
+
VElement.ck_ = virtualizeElement;
|
262
262
|
|
263
|
-
VElement.
|
263
|
+
VElement.cl_ = function (fromEl, vFromEl, toEl) {
|
264
264
|
var fromFlags = vFromEl.u_;
|
265
265
|
var toFlags = toEl.u_;
|
266
|
-
var attrs = toEl.
|
266
|
+
var attrs = toEl.cf_;
|
267
267
|
|
268
268
|
if (toFlags & FLAG_CUSTOM_ELEMENT) {
|
269
269
|
return assign(fromEl, attrs);
|
@@ -280,7 +280,7 @@ VElement.cj_ = function (fromEl, vFromEl, toEl) {
|
|
280
280
|
// real VElement node will not have the expando property
|
281
281
|
// so we build the attribute map from the expando property
|
282
282
|
|
283
|
-
var oldAttrs = vFromEl.
|
283
|
+
var oldAttrs = vFromEl.cf_;
|
284
284
|
|
285
285
|
if (oldAttrs === attrs) {
|
286
286
|
// For constant attributes the same object will be provided
|
@@ -318,7 +318,7 @@ VElement.cj_ = function (fromEl, vFromEl, toEl) {
|
|
318
318
|
}
|
319
319
|
|
320
320
|
var preserve = props && props.pa || EMPTY_OBJECT;
|
321
|
-
var specialAttrs = specialElHandlers[toEl.
|
321
|
+
var specialAttrs = specialElHandlers[toEl.cg_] || EMPTY_OBJECT;
|
322
322
|
var specialAttr;
|
323
323
|
|
324
324
|
// Loop over all of the attributes in the attribute map and compare
|
@@ -356,7 +356,7 @@ VElement.cj_ = function (fromEl, vFromEl, toEl) {
|
|
356
356
|
// was not a virtualized node (i.e., a node that was not rendered by a
|
357
357
|
// Marko template, but rather a node that was created from an HTML
|
358
358
|
// string or a real DOM node).
|
359
|
-
if (toEl.
|
359
|
+
if (toEl.ca_ === null || fromFlags & FLAG_SPREAD_ATTRS) {
|
360
360
|
for (attrName in oldAttrs) {
|
361
361
|
if (!(attrName in attrs)) {
|
362
362
|
if (specialAttr = specialAttrs[attrName]) {
|
@@ -6,16 +6,16 @@ var createFragmentNode = require("./morphdom/fragment")._k_;
|
|
6
6
|
var VNode = require("./VNode");
|
7
7
|
|
8
8
|
function VFragment(key, ownerComponent, preserve) {
|
9
|
-
this.
|
10
|
-
this.
|
9
|
+
this.bY_(null /* childCount */, ownerComponent);
|
10
|
+
this.ca_ = key;
|
11
11
|
this.ad_ = preserve;
|
12
12
|
}
|
13
13
|
|
14
14
|
VFragment.prototype = {
|
15
|
-
|
15
|
+
c__: 12,
|
16
16
|
bo_: function () {
|
17
17
|
var fragment = createFragmentNode();
|
18
|
-
keysByDOMNode.set(fragment, this.
|
18
|
+
keysByDOMNode.set(fragment, this.ca_);
|
19
19
|
vElementByDOMNode.set(fragment, this);
|
20
20
|
return fragment;
|
21
21
|
}
|
@@ -1,78 +1,78 @@
|
|
1
1
|
"use strict";function VNode() {}
|
2
2
|
|
3
3
|
VNode.prototype = {
|
4
|
-
|
5
|
-
this.
|
6
|
-
this.
|
4
|
+
bY_: function (finalChildCount, ownerComponent) {
|
5
|
+
this.cm_ = finalChildCount;
|
6
|
+
this.cn_ = 0;
|
7
|
+
this.ce_ = null;
|
8
|
+
this.co_ = null;
|
9
|
+
this.cb_ = null;
|
7
10
|
this.cc_ = null;
|
8
|
-
this.cm_ = null;
|
9
|
-
this.c__ = null;
|
10
|
-
this.ca_ = null;
|
11
11
|
this._M_ = ownerComponent;
|
12
12
|
},
|
13
13
|
|
14
14
|
get aA_() {
|
15
|
-
var firstChild = this.
|
15
|
+
var firstChild = this.ce_;
|
16
16
|
|
17
|
-
if (firstChild && firstChild.
|
17
|
+
if (firstChild && firstChild.cd_) {
|
18
18
|
var nestedFirstChild = firstChild.aA_;
|
19
19
|
// The first child is a DocumentFragment node.
|
20
20
|
// If the DocumentFragment node has a first child then we will return that.
|
21
21
|
// Otherwise, the DocumentFragment node is not *really* the first child and
|
22
22
|
// we need to skip to its next sibling
|
23
|
-
return nestedFirstChild || firstChild.
|
23
|
+
return nestedFirstChild || firstChild.cp_;
|
24
24
|
}
|
25
25
|
|
26
26
|
return firstChild;
|
27
27
|
},
|
28
28
|
|
29
|
-
get
|
30
|
-
var nextSibling = this.
|
29
|
+
get cp_() {
|
30
|
+
var nextSibling = this.cc_;
|
31
31
|
|
32
32
|
if (nextSibling) {
|
33
|
-
if (nextSibling.
|
33
|
+
if (nextSibling.cd_) {
|
34
34
|
var firstChild = nextSibling.aA_;
|
35
|
-
return firstChild || nextSibling.
|
35
|
+
return firstChild || nextSibling.cp_;
|
36
36
|
}
|
37
37
|
} else {
|
38
|
-
var parentNode = this.
|
39
|
-
if (parentNode && parentNode.
|
40
|
-
return parentNode.
|
38
|
+
var parentNode = this.cb_;
|
39
|
+
if (parentNode && parentNode.cd_) {
|
40
|
+
return parentNode.cp_;
|
41
41
|
}
|
42
42
|
}
|
43
43
|
|
44
44
|
return nextSibling;
|
45
45
|
},
|
46
46
|
|
47
|
-
|
48
|
-
this.
|
47
|
+
bR_: function (child) {
|
48
|
+
this.cn_++;
|
49
49
|
|
50
|
-
if (this.
|
51
|
-
if (child.
|
52
|
-
this.
|
50
|
+
if (this.cg_ === "textarea") {
|
51
|
+
if (child.cq_) {
|
52
|
+
this.ch_ += child.bZ_;
|
53
53
|
} else {
|
54
54
|
throw TypeError();
|
55
55
|
}
|
56
56
|
} else {
|
57
|
-
var lastChild = this.
|
57
|
+
var lastChild = this.co_;
|
58
58
|
|
59
|
-
child.
|
59
|
+
child.cb_ = this;
|
60
60
|
|
61
61
|
if (lastChild) {
|
62
|
-
lastChild.
|
62
|
+
lastChild.cc_ = child;
|
63
63
|
} else {
|
64
|
-
this.
|
64
|
+
this.ce_ = child;
|
65
65
|
}
|
66
66
|
|
67
|
-
this.
|
67
|
+
this.co_ = child;
|
68
68
|
}
|
69
69
|
|
70
70
|
return child;
|
71
71
|
},
|
72
72
|
|
73
|
-
|
74
|
-
if (this.
|
75
|
-
return this.
|
73
|
+
cj_: function finishChild() {
|
74
|
+
if (this.cn_ === this.cm_ && this.cb_) {
|
75
|
+
return this.cb_.cj_();
|
76
76
|
} else {
|
77
77
|
return this;
|
78
78
|
}
|
@@ -2,21 +2,21 @@
|
|
2
2
|
var VNode = require("./VNode");
|
3
3
|
|
4
4
|
function VText(value, ownerComponent) {
|
5
|
-
this.
|
6
|
-
this.
|
5
|
+
this.bY_(-1 /* no children */, ownerComponent);
|
6
|
+
this.bZ_ = value;
|
7
7
|
}
|
8
8
|
|
9
9
|
VText.prototype = {
|
10
|
-
|
10
|
+
cq_: true,
|
11
11
|
|
12
|
-
|
12
|
+
c__: 3,
|
13
13
|
|
14
14
|
bo_: function (host) {
|
15
|
-
return (host.ownerDocument || host).createTextNode(this.
|
15
|
+
return (host.ownerDocument || host).createTextNode(this.bZ_);
|
16
16
|
},
|
17
17
|
|
18
|
-
|
19
|
-
return new VText(this.
|
18
|
+
bS_: function () {
|
19
|
+
return new VText(this.bZ_);
|
20
20
|
}
|
21
21
|
};
|
22
22
|
|
@@ -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.bR_(
|
17
17
|
new ConstVElement(tagName, attrs, childCount)
|
18
18
|
);
|
19
19
|
|
20
20
|
if (childCount === 0) {
|
21
|
-
return this.
|
21
|
+
return this.cj_();
|
22
22
|
} else {
|
23
23
|
return child;
|
24
24
|
}
|
@@ -44,7 +44,7 @@ exports.t = runtime.t = function (typeName) {
|
|
44
44
|
instance.Q_(input, out);
|
45
45
|
};
|
46
46
|
|
47
|
-
instance.
|
47
|
+
instance.cr_ = true;
|
48
48
|
instance.ao_();
|
49
49
|
instance._x_ = false;
|
50
50
|
|
@@ -78,7 +78,7 @@ registry._G_ = function (typeName, id) {
|
|
78
78
|
if (instances) {
|
79
79
|
instances.add(instance);
|
80
80
|
instance.once("destroy", function () {
|
81
|
-
if (!instance.
|
81
|
+
if (!instance.cr_) {
|
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.
|
84
|
-
fragment.
|
83
|
+
fragment.cs_ = function (nextNode) {
|
84
|
+
fragment.cs_ = 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._k_ = createFragmentNode;
|
95
|
-
exports.
|
95
|
+
exports.ct_ = beginFragmentNode;
|
@@ -11,8 +11,8 @@ var KeySequence = require("../../components/KeySequence");
|
|
11
11
|
var VElement = require("../vdom").bz_;
|
12
12
|
var fragment = require("./fragment");
|
13
13
|
var helpers = require("./helpers");
|
14
|
-
var virtualizeElement = VElement.
|
15
|
-
var morphAttrs = VElement.
|
14
|
+
var virtualizeElement = VElement.ck_;
|
15
|
+
var morphAttrs = VElement.cl_;
|
16
16
|
var keysByDOMNode = domData._n_;
|
17
17
|
var componentByDOMNode = domData._p_;
|
18
18
|
var vElementByDOMNode = domData._K_;
|
@@ -20,11 +20,11 @@ var detachedByDOMNode = domData.aW_;
|
|
20
20
|
|
21
21
|
var insertBefore = helpers.bf_;
|
22
22
|
var insertAfter = helpers.bg_;
|
23
|
-
var nextSibling = helpers.
|
23
|
+
var nextSibling = helpers.cp_;
|
24
24
|
var firstChild = helpers.aA_;
|
25
25
|
var removeChild = helpers.bh_;
|
26
26
|
var createFragmentNode = fragment._k_;
|
27
|
-
var beginFragmentNode = fragment.
|
27
|
+
var beginFragmentNode = fragment.ct_;
|
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.
|
45
|
+
return fromEl.cg_ === toEl.cg_;
|
46
46
|
}
|
47
47
|
|
48
48
|
function caseInsensitiveCompare(a, b) {
|
@@ -77,8 +77,8 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
77
77
|
insertBefore(realNode, referenceEl, parentEl);
|
78
78
|
|
79
79
|
if (
|
80
|
-
vNode.
|
81
|
-
vNode.
|
80
|
+
vNode.c__ === ELEMENT_NODE ||
|
81
|
+
vNode.c__ === 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.
|
90
|
+
if (vNode.cg_ !== "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.
|
165
|
-
curToNodeType = curToNodeChild.
|
166
|
-
curToNodeKey = curToNodeChild.
|
164
|
+
toNextSibling = curToNodeChild.cp_;
|
165
|
+
curToNodeType = curToNodeChild.c__;
|
166
|
+
curToNodeKey = curToNodeChild.ca_;
|
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.
|
285
|
+
curToNodeType === curVFromNodeChild.c__ && (
|
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.ad_ ||
|
328
328
|
caseInsensitiveCompare(
|
329
329
|
curFromNodeChild.nodeName,
|
330
|
-
curToNodeChild.
|
330
|
+
curToNodeChild.cg_ || ""
|
331
331
|
)))
|
332
332
|
{
|
333
333
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
334
|
-
curVFromNodeChild.
|
334
|
+
curVFromNodeChild.cg_ = curToNodeChild.cg_;
|
335
335
|
keysByDOMNode.set(curFromNodeChild, curToNodeKey);
|
336
336
|
referenceComponent.K_[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.
|
354
|
+
curToNodeChild.c__ === FRAGMENT_NODE &&
|
355
355
|
curFromNodeChild.nodeType === COMMENT_NODE)
|
356
356
|
{
|
357
357
|
var content = curFromNodeChild.nodeValue;
|
@@ -417,7 +417,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
417
417
|
|
418
418
|
if (
|
419
419
|
curVFromNodeChild &&
|
420
|
-
curToNodeType === curVFromNodeChild.
|
420
|
+
curToNodeType === curVFromNodeChild.c__ && (
|
421
421
|
curToNodeType !== ELEMENT_NODE ||
|
422
422
|
compareNodeNames(curVFromNodeChild, curToNodeChild)))
|
423
423
|
{
|
@@ -435,7 +435,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
435
435
|
|
436
436
|
if (
|
437
437
|
toNextSibling &&
|
438
|
-
toNextSibling.
|
438
|
+
toNextSibling.ca_ === curFromNodeKey)
|
439
439
|
{
|
440
440
|
// Single element swap
|
441
441
|
|
@@ -548,18 +548,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
548
548
|
|
549
549
|
if (
|
550
550
|
caseInsensitiveCompare(
|
551
|
-
curVFromNodeChild.
|
552
|
-
curToNodeChild.
|
551
|
+
curVFromNodeChild.cg_,
|
552
|
+
curToNodeChild.cg_
|
553
553
|
))
|
554
554
|
{
|
555
|
-
curVFromNodeChild.
|
555
|
+
curVFromNodeChild.cg_ = curToNodeChild.cg_;
|
556
556
|
}
|
557
557
|
} else {
|
558
558
|
// Skip over nodes that don't look like ours...
|
559
559
|
curFromNodeChild = fromNextSibling;
|
560
560
|
continue;
|
561
561
|
}
|
562
|
-
} else if (curFromNodeKey = curVFromNodeChild.
|
562
|
+
} else if (curFromNodeKey = curVFromNodeChild.ca_) {
|
563
563
|
// We have a keyed element here but our target VDOM node
|
564
564
|
// is not keyed so this not doesn't belong
|
565
565
|
isCompatible = false;
|
@@ -586,18 +586,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
586
586
|
{
|
587
587
|
// Both nodes being compared are Text or Comment nodes
|
588
588
|
isCompatible = true;
|
589
|
-
var curToNodeValue = curToNodeChild.
|
589
|
+
var curToNodeValue = curToNodeChild.bZ_;
|
590
590
|
var curFromNodeValue = curFromNodeChild.nodeValue;
|
591
591
|
if (curFromNodeValue !== curToNodeValue) {
|
592
592
|
if (
|
593
593
|
isHydrate &&
|
594
594
|
toNextSibling &&
|
595
595
|
curFromNodeType === TEXT_NODE &&
|
596
|
-
toNextSibling.
|
596
|
+
toNextSibling.c__ === TEXT_NODE &&
|
597
597
|
curFromNodeValue.startsWith(curToNodeValue) &&
|
598
598
|
curFromNodeValue.
|
599
599
|
slice(curToNodeValue.length).
|
600
|
-
startsWith(toNextSibling.
|
600
|
+
startsWith(toNextSibling.bZ_))
|
601
601
|
{
|
602
602
|
// In hydrate mode we can use splitText to more efficiently handle
|
603
603
|
// adjacent text vdom nodes that were merged.
|
@@ -642,10 +642,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
642
642
|
}
|
643
643
|
|
644
644
|
// We have processed all of the "to nodes".
|
645
|
-
if (fromNode.
|
645
|
+
if (fromNode.cs_) {
|
646
646
|
// If we are in an unfinished fragment, we have reached the end of the nodes
|
647
647
|
// we were matching up and need to end the fragment
|
648
|
-
fromNode.
|
648
|
+
fromNode.cs_(curFromNodeChild);
|
649
649
|
} else {
|
650
650
|
// If curFromNodeChild is non-null then we still have some from nodes
|
651
651
|
// left over that need to be removed
|
@@ -685,11 +685,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
685
685
|
}
|
686
686
|
|
687
687
|
function morphEl(fromEl, vFromEl, toEl, parentComponent) {
|
688
|
-
var nodeName = toEl.
|
689
|
-
var constId = toEl.
|
688
|
+
var nodeName = toEl.cg_;
|
689
|
+
var constId = toEl.ci_;
|
690
690
|
vElementByDOMNode.set(fromEl, toEl);
|
691
691
|
|
692
|
-
if (constId !== undefined && vFromEl.
|
692
|
+
if (constId !== undefined && vFromEl.ci_ === constId) {
|
693
693
|
return;
|
694
694
|
}
|
695
695
|
|
@@ -700,8 +700,8 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
700
700
|
}
|
701
701
|
|
702
702
|
if (nodeName === "textarea") {
|
703
|
-
if (toEl.
|
704
|
-
fromEl.value = toEl.
|
703
|
+
if (toEl.ch_ !== vFromEl.ch_) {
|
704
|
+
fromEl.value = toEl.ch_;
|
705
705
|
}
|
706
706
|
} else {
|
707
707
|
morphChildren(fromEl, toEl, parentComponent);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";var parseHTML = require("./parse-html");
|
2
|
+
var VComment = require("./VComment");
|
2
3
|
var VComponent = require("./VComponent");
|
3
4
|
var VDocumentFragment = require("./VDocumentFragment");
|
4
5
|
var VElement = require("./VElement");
|
@@ -11,7 +12,7 @@ var specialHtmlRegexp = /[&<]/;
|
|
11
12
|
function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
12
13
|
var curChild = node.firstChild;
|
13
14
|
while (curChild) {
|
14
|
-
vdomParent.
|
15
|
+
vdomParent.bR_(virtualize(curChild, ownerComponent));
|
15
16
|
curChild = curChild.nextSibling;
|
16
17
|
}
|
17
18
|
}
|
@@ -19,9 +20,11 @@ function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
|
19
20
|
function virtualize(node, ownerComponent) {
|
20
21
|
switch (node.nodeType) {
|
21
22
|
case 1:
|
22
|
-
return VElement.
|
23
|
+
return VElement.ck_(node, virtualizeChildNodes, ownerComponent);
|
23
24
|
case 3:
|
24
25
|
return new VText(node.nodeValue, ownerComponent);
|
26
|
+
case 8:
|
27
|
+
return new VComment(node.nodeValue, ownerComponent);
|
25
28
|
case 11:
|
26
29
|
var vdomDocFragment = new VDocumentFragment();
|
27
30
|
virtualizeChildNodes(node, vdomDocFragment, ownerComponent);
|
@@ -36,9 +39,11 @@ function virtualizeHTML(html, ownerComponent) {
|
|
36
39
|
|
37
40
|
var vdomFragment = new VDocumentFragment();
|
38
41
|
var curChild = parseHTML(html);
|
42
|
+
var virtualized;
|
39
43
|
|
40
44
|
while (curChild) {
|
41
|
-
|
45
|
+
virtualized = virtualize(curChild, ownerComponent);
|
46
|
+
if (virtualized) vdomFragment.bR_(virtualized);
|
42
47
|
curChild = curChild.nextSibling;
|
43
48
|
}
|
44
49
|
|
@@ -65,18 +70,19 @@ Node_prototype.t = function (value) {
|
|
65
70
|
}
|
66
71
|
}
|
67
72
|
|
68
|
-
this.
|
69
|
-
return this.
|
73
|
+
this.bR_(vdomNode || new VText(value.toString()));
|
74
|
+
return this.cj_();
|
70
75
|
};
|
71
76
|
|
72
|
-
Node_prototype.
|
73
|
-
return this.
|
77
|
+
Node_prototype.bW_ = function () {
|
78
|
+
return this.bR_(new VDocumentFragment());
|
74
79
|
};
|
75
80
|
|
76
|
-
exports.bA_ =
|
81
|
+
exports.bA_ = VComment;
|
82
|
+
exports.bB_ = VDocumentFragment;
|
77
83
|
exports.bz_ = VElement;
|
78
|
-
exports.
|
79
|
-
exports.
|
80
|
-
exports.
|
81
|
-
exports.
|
82
|
-
exports.
|
84
|
+
exports.bC_ = VText;
|
85
|
+
exports.bD_ = VComponent;
|
86
|
+
exports.bE_ = VFragment;
|
87
|
+
exports.ck_ = virtualize;
|
88
|
+
exports.bF_ = virtualizeHTML;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.35.
|
3
|
+
"version": "5.35.16",
|
4
4
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
5
5
|
"keywords": [
|
6
6
|
"front-end",
|
@@ -65,8 +65,8 @@
|
|
65
65
|
"build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
|
66
66
|
},
|
67
67
|
"dependencies": {
|
68
|
-
"@marko/compiler": "^5.37.
|
69
|
-
"@marko/translator-default": "^6.0.
|
68
|
+
"@marko/compiler": "^5.37.11",
|
69
|
+
"@marko/translator-default": "^6.0.13",
|
70
70
|
"app-module-path": "^2.2.0",
|
71
71
|
"argly": "^1.2.0",
|
72
72
|
"browser-refresh-client": "1.1.4",
|
@@ -139,7 +139,8 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
139
139
|
|
140
140
|
if (typeof renderBody === "function" && renderBody.toJSON === w10ToJSON) {
|
141
141
|
flags |= FLAG_HAS_RENDER_BODY;
|
142
|
-
renderBody =
|
142
|
+
renderBody = undefined;
|
143
|
+
if (input) input.renderBody = undefined;
|
143
144
|
}
|
144
145
|
|
145
146
|
var extra = {
|
@@ -4,6 +4,7 @@ var attrsHelper = require("./helpers/attrs");
|
|
4
4
|
var morphdom = require("./morphdom");
|
5
5
|
var vdom = require("./vdom");
|
6
6
|
var VElement = vdom.___VElement;
|
7
|
+
var VComment = vdom.___VComment;
|
7
8
|
var VDocumentFragment = vdom.___VDocumentFragment;
|
8
9
|
var VText = vdom.___VText;
|
9
10
|
var VComponent = vdom.___VComponent;
|
@@ -133,6 +134,10 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
133
134
|
return this;
|
134
135
|
},
|
135
136
|
|
137
|
+
comment: function (comment, ownerComponent) {
|
138
|
+
return this.node(new VComment(comment, ownerComponent));
|
139
|
+
},
|
140
|
+
|
136
141
|
html: function (html, ownerComponent) {
|
137
142
|
if (html != null) {
|
138
143
|
var vdomNode = virtualizeHTML(html, ownerComponent);
|
@@ -0,0 +1,24 @@
|
|
1
|
+
var VNode = require("./VNode");
|
2
|
+
var inherit = require("raptor-util/inherit");
|
3
|
+
|
4
|
+
function VComment(value, ownerComponent) {
|
5
|
+
this.___VNode(-1 /* no children */, ownerComponent);
|
6
|
+
this.___nodeValue = value;
|
7
|
+
}
|
8
|
+
|
9
|
+
VComment.prototype = {
|
10
|
+
___nodeType: 8,
|
11
|
+
|
12
|
+
___actualize: function (doc) {
|
13
|
+
var nodeValue = this.___nodeValue;
|
14
|
+
return doc.createComment(nodeValue);
|
15
|
+
},
|
16
|
+
|
17
|
+
___cloneNode: function () {
|
18
|
+
return new VComment(this.___nodeValue);
|
19
|
+
},
|
20
|
+
};
|
21
|
+
|
22
|
+
inherit(VComment, VNode);
|
23
|
+
|
24
|
+
module.exports = VComment;
|
package/src/runtime/vdom/vdom.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
var parseHTML = require("./parse-html");
|
2
|
+
var VComment = require("./VComment");
|
2
3
|
var VComponent = require("./VComponent");
|
3
4
|
var VDocumentFragment = require("./VDocumentFragment");
|
4
5
|
var VElement = require("./VElement");
|
@@ -22,6 +23,8 @@ function virtualize(node, ownerComponent) {
|
|
22
23
|
return VElement.___virtualize(node, virtualizeChildNodes, ownerComponent);
|
23
24
|
case 3:
|
24
25
|
return new VText(node.nodeValue, ownerComponent);
|
26
|
+
case 8:
|
27
|
+
return new VComment(node.nodeValue, ownerComponent);
|
25
28
|
case 11:
|
26
29
|
var vdomDocFragment = new VDocumentFragment();
|
27
30
|
virtualizeChildNodes(node, vdomDocFragment, ownerComponent);
|
@@ -36,9 +39,11 @@ function virtualizeHTML(html, ownerComponent) {
|
|
36
39
|
|
37
40
|
var vdomFragment = new VDocumentFragment();
|
38
41
|
var curChild = parseHTML(html);
|
42
|
+
var virtualized;
|
39
43
|
|
40
44
|
while (curChild) {
|
41
|
-
|
45
|
+
virtualized = virtualize(curChild, ownerComponent);
|
46
|
+
if (virtualized) vdomFragment.___appendChild(virtualized);
|
42
47
|
curChild = curChild.nextSibling;
|
43
48
|
}
|
44
49
|
|
@@ -73,6 +78,7 @@ Node_prototype.___appendDocumentFragment = function () {
|
|
73
78
|
return this.___appendChild(new VDocumentFragment());
|
74
79
|
};
|
75
80
|
|
81
|
+
exports.___VComment = VComment;
|
76
82
|
exports.___VDocumentFragment = VDocumentFragment;
|
77
83
|
exports.___VElement = VElement;
|
78
84
|
exports.___VText = VText;
|