marko 5.29.1 → 5.30.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/bin/markoc.js +18 -18
- package/dist/core-tags/core/await/index.d.marko +10 -0
- package/dist/core-tags/core/await/renderer.js +5 -1
- package/dist/node_modules/@internal/components-beginComponent/index.js +13 -3
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
- package/dist/node_modules/@internal/components-entry/index.js +73 -45
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/dist/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-registry/index-browser.js +70 -43
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +17 -17
- package/dist/node_modules/@internal/components-util/index.js +18 -8
- package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/dist/node_modules/@internal/create-readable/index.js +9 -9
- package/dist/node_modules/@internal/set-immediate/index-browser.js +1 -1
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index.js +2 -2
- package/dist/runtime/RenderResult.js +3 -3
- package/dist/runtime/components/Component.js +146 -148
- package/dist/runtime/components/ComponentDef.js +41 -27
- package/dist/runtime/components/ComponentsContext.js +6 -6
- package/dist/runtime/components/GlobalComponentsContext.js +3 -3
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +27 -27
- package/dist/runtime/components/attach-detach.js +7 -7
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/legacy/browser.json +9 -0
- package/dist/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/dist/runtime/components/legacy/dependencies/html.js +3 -0
- package/dist/runtime/components/legacy/dependencies/index.js +178 -0
- package/dist/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/dist/runtime/components/legacy/index.js +1 -0
- package/dist/runtime/components/legacy/jquery.js +51 -0
- package/dist/runtime/components/legacy/ready.js +152 -0
- package/dist/runtime/components/legacy/renderer-legacy.js +230 -0
- package/dist/runtime/components/renderer.js +30 -26
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +5 -5
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +7 -9
- package/dist/runtime/helpers/style-value.js +7 -2
- package/dist/runtime/html/AsyncStream.js +20 -20
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +19 -6
- package/dist/runtime/html/helpers/attrs.js +7 -0
- package/dist/runtime/html/helpers/data-marko.js +2 -2
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/merge-attrs.js +38 -7
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +9 -6
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +86 -86
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VElement.js +61 -50
- package/dist/runtime/vdom/VFragment.js +8 -8
- package/dist/runtime/vdom/VNode.js +36 -36
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +24 -4
- package/dist/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/hot-reload.js +19 -19
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +5 -5
- package/dist/runtime/vdom/morphdom/index.js +56 -56
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +7 -7
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +14 -14
- package/docs/10-awesome-marko-features.md +1 -1
- package/docs/body-content.md +3 -3
- package/docs/class-components.md +6 -6
- package/docs/cloudflare-workers.md +3 -3
- package/docs/compiler.md +5 -5
- package/docs/express.md +2 -2
- package/docs/http.md +1 -1
- package/docs/koa.md +1 -1
- package/docs/lasso.md +1 -1
- package/docs/marko-vs-react.md +2 -2
- package/docs/rendering.md +6 -6
- package/docs/rollup.md +30 -30
- package/docs/troubleshooting-streaming.md +1 -1
- package/docs/typescript.md +1 -1
- package/docs/vite.md +3 -3
- package/docs/webpack.md +25 -25
- package/docs/why-is-marko-fast.md +2 -2
- package/index.d.ts +1 -0
- package/legacy-components-browser.marko +15 -0
- package/legacy-components.js +7 -0
- package/package.json +51 -45
- package/src/compiler/config.js +1 -1
- package/src/compiler/index.js +5 -5
- package/src/core-tags/core/__flush_here_and_after__.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +1 -1
- package/src/core-tags/core/await/index.d.marko +10 -0
- package/src/core-tags/core/await/renderer.js +8 -4
- package/src/core-tags/core/await/reorderer-renderer.js +1 -1
- package/src/node-require/browser-refresh.js +2 -2
- package/src/node-require/index.js +2 -2
- package/src/node_modules/@internal/components-beginComponent/index.js +16 -6
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index.js +65 -37
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-registry/index-browser.js +33 -6
- package/src/node_modules/@internal/components-util/index.js +10 -0
- package/src/runtime/RenderResult.js +3 -3
- package/src/runtime/components/Component.js +16 -18
- package/src/runtime/components/ComponentDef.js +22 -8
- package/src/runtime/components/ComponentsContext.js +1 -1
- package/src/runtime/components/State.js +2 -2
- package/src/runtime/components/attach-detach.js +1 -1
- package/src/runtime/components/dom-data.js +1 -1
- package/src/runtime/components/legacy/browser.json +9 -0
- package/src/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/src/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/src/runtime/components/legacy/dependencies/html.js +3 -0
- package/src/runtime/components/legacy/dependencies/index.js +178 -0
- package/src/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/src/runtime/components/legacy/index.js +1 -0
- package/src/runtime/components/legacy/jquery.js +51 -0
- package/src/runtime/components/legacy/ready.js +152 -0
- package/src/runtime/components/legacy/renderer-legacy.js +230 -0
- package/src/runtime/components/renderer.js +4 -0
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +1 -1
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/style-value.js +7 -2
- package/src/runtime/html/AsyncStream.js +5 -5
- package/src/runtime/html/BufferedWriter.js +1 -1
- package/src/runtime/html/StringWriter.js +1 -1
- package/src/runtime/html/helpers/attr.js +15 -2
- package/src/runtime/html/helpers/attrs.js +7 -0
- package/src/runtime/html/helpers/merge-attrs.js +38 -7
- package/src/runtime/html/hot-reload.js +1 -1
- package/src/runtime/html/index.js +2 -2
- package/src/runtime/renderable.js +5 -2
- package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
- package/src/runtime/vdom/VComponent.js +1 -1
- package/src/runtime/vdom/VDocumentFragment.js +1 -1
- package/src/runtime/vdom/VElement.js +17 -6
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +1 -1
- package/src/runtime/vdom/VText.js +1 -1
- package/src/runtime/vdom/helpers/attrs.js +26 -6
- package/src/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/src/runtime/vdom/hot-reload.js +1 -1
- package/src/runtime/vdom/index.js +2 -2
- package/src/runtime/vdom/morphdom/fragment.js +1 -1
- package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/src/taglib/index.js +1 -1
- package/tags-html.d.ts +9 -0
- package/dist/core-tags/core/await/index.marko +0 -13
- package/src/core-tags/core/await/index.marko +0 -13
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";var EventEmitter = require("events-light");
|
2
2
|
var vdom = require("./vdom");
|
3
|
-
var VElement = vdom.
|
4
|
-
var VDocumentFragment = vdom.
|
5
|
-
var VText = vdom.
|
6
|
-
var VComponent = vdom.
|
7
|
-
var VFragment = vdom.
|
8
|
-
var virtualizeHTML = vdom.
|
3
|
+
var VElement = vdom.bs_;
|
4
|
+
var VDocumentFragment = vdom.bt_;
|
5
|
+
var VText = vdom.bu_;
|
6
|
+
var VComponent = vdom.bv_;
|
7
|
+
var VFragment = vdom.bw_;
|
8
|
+
var virtualizeHTML = vdom.bx_;
|
9
9
|
var RenderResult = require("../RenderResult");
|
10
10
|
var morphdom = require("./morphdom");
|
11
11
|
var attrsHelper = require("./helpers/attrs");
|
@@ -14,9 +14,9 @@ var EVENT_UPDATE = "update";
|
|
14
14
|
var EVENT_FINISH = "finish";
|
15
15
|
|
16
16
|
function State(tree) {
|
17
|
-
this.
|
18
|
-
this.
|
19
|
-
this.
|
17
|
+
this.by_ = new EventEmitter();
|
18
|
+
this.bz_ = tree;
|
19
|
+
this.bA_ = false;
|
20
20
|
}
|
21
21
|
|
22
22
|
function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
@@ -27,48 +27,48 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
27
27
|
var state;
|
28
28
|
|
29
29
|
if (parentOut) {
|
30
|
-
state = parentOut.
|
30
|
+
state = parentOut.G_;
|
31
31
|
} else {
|
32
32
|
state = new State(parentNode);
|
33
33
|
}
|
34
34
|
|
35
|
-
this.
|
36
|
-
this.
|
37
|
-
this.
|
38
|
-
this.
|
35
|
+
this.bB_ = 1;
|
36
|
+
this.bC_ = 0;
|
37
|
+
this.bD_ = null;
|
38
|
+
this.bE_ = parentOut;
|
39
39
|
|
40
40
|
this.data = {};
|
41
|
-
this.
|
41
|
+
this.G_ = state;
|
42
42
|
this.m_ = parentNode;
|
43
43
|
this.global = globalData || {};
|
44
|
-
this.
|
45
|
-
this.
|
46
|
-
this.
|
44
|
+
this.bF_ = [parentNode];
|
45
|
+
this.bG_ = false;
|
46
|
+
this.bH_ = undefined;
|
47
47
|
this.b_ = null;
|
48
48
|
|
49
49
|
this.h_ = null;
|
50
50
|
this.j_ = null;
|
51
|
-
this.
|
51
|
+
this.b__ = null;
|
52
52
|
}
|
53
53
|
|
54
54
|
var proto = AsyncVDOMBuilder.prototype = {
|
55
|
-
|
56
|
-
|
55
|
+
bn_: true,
|
56
|
+
I_: typeof document === "object" && document,
|
57
57
|
|
58
58
|
bc: function (component, key, ownerComponent) {
|
59
59
|
var vComponent = new VComponent(component, key, ownerComponent);
|
60
|
-
return this.
|
60
|
+
return this.bI_(vComponent, 0, true);
|
61
61
|
},
|
62
62
|
|
63
|
-
|
63
|
+
ba_: function (component, key, ownerComponent) {
|
64
64
|
var vComponent = new VComponent(component, key, ownerComponent, true);
|
65
|
-
this.
|
65
|
+
this.bI_(vComponent, 0);
|
66
66
|
},
|
67
67
|
|
68
|
-
|
69
|
-
this.m_.
|
68
|
+
bI_: function (child, childCount, pushToStack) {
|
69
|
+
this.m_.bJ_(child);
|
70
70
|
if (pushToStack === true) {
|
71
|
-
this.
|
71
|
+
this.bF_.push(child);
|
72
72
|
this.m_ = child;
|
73
73
|
}
|
74
74
|
return childCount === 0 ? this : child;
|
@@ -84,10 +84,10 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
84
84
|
flags,
|
85
85
|
props);
|
86
86
|
|
87
|
-
return this.
|
87
|
+
return this.bI_(element, childCount);
|
88
88
|
},
|
89
89
|
|
90
|
-
|
90
|
+
bk_: function (tagName, attrs, key, componentDef, props) {
|
91
91
|
return this.element(
|
92
92
|
tagName,
|
93
93
|
attrsHelper(attrs),
|
@@ -102,15 +102,15 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
102
102
|
n: function (node, component) {
|
103
103
|
// NOTE: We do a shallow clone since we assume the node is being reused
|
104
104
|
// and a node can only have one parent node.
|
105
|
-
var clone = node.
|
105
|
+
var clone = node.bK_();
|
106
106
|
this.node(clone);
|
107
|
-
clone.
|
107
|
+
clone._P_ = component;
|
108
108
|
|
109
109
|
return this;
|
110
110
|
},
|
111
111
|
|
112
112
|
node: function (node) {
|
113
|
-
this.m_.
|
113
|
+
this.m_.bJ_(node);
|
114
114
|
return this;
|
115
115
|
},
|
116
116
|
|
@@ -129,7 +129,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
129
129
|
text = text.toString();
|
130
130
|
}
|
131
131
|
|
132
|
-
this.m_.
|
132
|
+
this.m_.bJ_(new VText(text, ownerComponent));
|
133
133
|
return this;
|
134
134
|
},
|
135
135
|
|
@@ -160,11 +160,11 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
160
160
|
flags,
|
161
161
|
props);
|
162
162
|
|
163
|
-
this.
|
163
|
+
this.bI_(element, childCount, true);
|
164
164
|
return this;
|
165
165
|
},
|
166
166
|
|
167
|
-
|
167
|
+
bi_: function (tagName, attrs, key, componentDef, props) {
|
168
168
|
return this.beginElement(
|
169
169
|
tagName,
|
170
170
|
attrsHelper(attrs),
|
@@ -178,7 +178,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
178
178
|
|
179
179
|
bf: function (key, component, preserve) {
|
180
180
|
var fragment = new VFragment(key, component, preserve);
|
181
|
-
this.
|
181
|
+
this.bI_(fragment, null, true);
|
182
182
|
return this;
|
183
183
|
},
|
184
184
|
|
@@ -187,7 +187,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
187
187
|
},
|
188
188
|
|
189
189
|
endElement: function () {
|
190
|
-
var stack = this.
|
190
|
+
var stack = this.bF_;
|
191
191
|
stack.pop();
|
192
192
|
this.m_ = stack[stack.length - 1];
|
193
193
|
},
|
@@ -195,44 +195,44 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
195
195
|
end: function () {
|
196
196
|
this.m_ = undefined;
|
197
197
|
|
198
|
-
var remaining = --this.
|
199
|
-
var parentOut = this.
|
198
|
+
var remaining = --this.bB_;
|
199
|
+
var parentOut = this.bE_;
|
200
200
|
|
201
201
|
if (remaining === 0) {
|
202
202
|
if (parentOut) {
|
203
|
-
parentOut.
|
203
|
+
parentOut.bL_();
|
204
204
|
} else {
|
205
|
-
this.
|
205
|
+
this.bM_();
|
206
206
|
}
|
207
|
-
} else if (remaining - this.
|
208
|
-
this.
|
207
|
+
} else if (remaining - this.bC_ === 0) {
|
208
|
+
this.bN_();
|
209
209
|
}
|
210
210
|
|
211
211
|
return this;
|
212
212
|
},
|
213
213
|
|
214
|
-
|
215
|
-
var remaining = --this.
|
214
|
+
bL_: function () {
|
215
|
+
var remaining = --this.bB_;
|
216
216
|
|
217
217
|
if (remaining === 0) {
|
218
|
-
var parentOut = this.
|
218
|
+
var parentOut = this.bE_;
|
219
219
|
if (parentOut) {
|
220
|
-
parentOut.
|
220
|
+
parentOut.bL_();
|
221
221
|
} else {
|
222
|
-
this.
|
222
|
+
this.bM_();
|
223
223
|
}
|
224
|
-
} else if (remaining - this.
|
225
|
-
this.
|
224
|
+
} else if (remaining - this.bC_ === 0) {
|
225
|
+
this.bN_();
|
226
226
|
}
|
227
227
|
},
|
228
228
|
|
229
|
-
|
230
|
-
var state = this.
|
231
|
-
state.
|
232
|
-
state.
|
229
|
+
bM_: function () {
|
230
|
+
var state = this.G_;
|
231
|
+
state.bA_ = true;
|
232
|
+
state.by_.emit(EVENT_FINISH, this.bo_());
|
233
233
|
},
|
234
234
|
|
235
|
-
|
235
|
+
bN_: function () {
|
236
236
|
var lastArray = this._last;
|
237
237
|
|
238
238
|
var i = 0;
|
@@ -267,26 +267,26 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
267
267
|
},
|
268
268
|
|
269
269
|
beginAsync: function (options) {
|
270
|
-
if (this.
|
270
|
+
if (this.bG_) {
|
271
271
|
throw Error(
|
272
272
|
"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942).");
|
273
273
|
|
274
274
|
}
|
275
275
|
|
276
|
-
var state = this.
|
276
|
+
var state = this.G_;
|
277
277
|
|
278
278
|
if (options) {
|
279
279
|
if (options.last) {
|
280
|
-
this.
|
280
|
+
this.bC_++;
|
281
281
|
}
|
282
282
|
}
|
283
283
|
|
284
|
-
this.
|
284
|
+
this.bB_++;
|
285
285
|
|
286
|
-
var documentFragment = this.m_.
|
286
|
+
var documentFragment = this.m_.bO_();
|
287
287
|
var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);
|
288
288
|
|
289
|
-
state.
|
289
|
+
state.by_.emit("beginAsync", {
|
290
290
|
out: asyncOut,
|
291
291
|
parentOut: this
|
292
292
|
});
|
@@ -299,51 +299,51 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
299
299
|
},
|
300
300
|
|
301
301
|
flush: function () {
|
302
|
-
var events = this.
|
302
|
+
var events = this.G_.by_;
|
303
303
|
|
304
304
|
if (events.listenerCount(EVENT_UPDATE)) {
|
305
305
|
events.emit(EVENT_UPDATE, new RenderResult(this));
|
306
306
|
}
|
307
307
|
},
|
308
308
|
|
309
|
-
|
310
|
-
return this.
|
309
|
+
af_: function () {
|
310
|
+
return this.G_.bz_;
|
311
311
|
},
|
312
312
|
|
313
|
-
|
314
|
-
return this.
|
313
|
+
bo_: function () {
|
314
|
+
return this.bP_ || (this.bP_ = new RenderResult(this));
|
315
315
|
},
|
316
316
|
|
317
317
|
on: function (event, callback) {
|
318
|
-
var state = this.
|
318
|
+
var state = this.G_;
|
319
319
|
|
320
|
-
if (event === EVENT_FINISH && state.
|
321
|
-
callback(this.
|
320
|
+
if (event === EVENT_FINISH && state.bA_) {
|
321
|
+
callback(this.bo_());
|
322
322
|
} else if (event === "last") {
|
323
323
|
this.onLast(callback);
|
324
324
|
} else {
|
325
|
-
state.
|
325
|
+
state.by_.on(event, callback);
|
326
326
|
}
|
327
327
|
|
328
328
|
return this;
|
329
329
|
},
|
330
330
|
|
331
331
|
once: function (event, callback) {
|
332
|
-
var state = this.
|
332
|
+
var state = this.G_;
|
333
333
|
|
334
|
-
if (event === EVENT_FINISH && state.
|
335
|
-
callback(this.
|
334
|
+
if (event === EVENT_FINISH && state.bA_) {
|
335
|
+
callback(this.bo_());
|
336
336
|
} else if (event === "last") {
|
337
337
|
this.onLast(callback);
|
338
338
|
} else {
|
339
|
-
state.
|
339
|
+
state.by_.once(event, callback);
|
340
340
|
}
|
341
341
|
|
342
342
|
return this;
|
343
343
|
},
|
344
344
|
|
345
345
|
emit: function (type, arg) {
|
346
|
-
var events = this.
|
346
|
+
var events = this.G_.by_;
|
347
347
|
switch (arguments.length) {
|
348
348
|
case 1:
|
349
349
|
events.emit(type);
|
@@ -359,17 +359,17 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
359
359
|
},
|
360
360
|
|
361
361
|
removeListener: function () {
|
362
|
-
var events = this.
|
362
|
+
var events = this.G_.by_;
|
363
363
|
events.removeListener.apply(events, arguments);
|
364
364
|
return this;
|
365
365
|
},
|
366
366
|
|
367
367
|
sync: function () {
|
368
|
-
this.
|
368
|
+
this.bG_ = true;
|
369
369
|
},
|
370
370
|
|
371
371
|
isSync: function () {
|
372
|
-
return this.
|
372
|
+
return this.bG_;
|
373
373
|
},
|
374
374
|
|
375
375
|
onLast: function (callback) {
|
@@ -384,20 +384,20 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
384
384
|
return this;
|
385
385
|
},
|
386
386
|
|
387
|
-
|
388
|
-
var node = this.
|
387
|
+
ae_: function (host) {
|
388
|
+
var node = this.bH_;
|
389
389
|
if (!node) {
|
390
|
-
var vdomTree = this.
|
390
|
+
var vdomTree = this.af_();
|
391
391
|
|
392
|
-
if (!host) host = this.
|
393
|
-
this.
|
392
|
+
if (!host) host = this.I_;
|
393
|
+
this.bH_ = node = vdomTree.bQ_(host, null);
|
394
394
|
morphdom(node, vdomTree, host, this.b_);
|
395
395
|
}
|
396
396
|
return node;
|
397
397
|
},
|
398
398
|
|
399
399
|
toString: function (host) {
|
400
|
-
var docFragment = this.
|
400
|
+
var docFragment = this.ae_(host);
|
401
401
|
var html = "";
|
402
402
|
|
403
403
|
var child = docFragment.firstChild;
|
@@ -437,13 +437,13 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
437
437
|
c: function (componentDef, key, customEvents) {
|
438
438
|
this.h_ = componentDef;
|
439
439
|
this.j_ = key;
|
440
|
-
this.
|
440
|
+
this.b__ = customEvents;
|
441
441
|
}
|
442
442
|
};
|
443
443
|
|
444
444
|
proto.e = proto.element;
|
445
445
|
proto.be = proto.beginElement;
|
446
|
-
proto.ee = proto.
|
446
|
+
proto.ee = proto.bj_ = proto.endElement;
|
447
447
|
proto.t = proto.text;
|
448
448
|
proto.h = proto.w = proto.write = proto.html;
|
449
449
|
|
@@ -2,14 +2,14 @@
|
|
2
2
|
var inherit = require("raptor-util/inherit");
|
3
3
|
|
4
4
|
function VComponent(component, key, ownerComponent, preserve) {
|
5
|
-
this.
|
6
|
-
this.
|
5
|
+
this.bR_(null /* childCount */, ownerComponent);
|
6
|
+
this.bS_ = key;
|
7
7
|
this.i_ = component;
|
8
8
|
this.o_ = preserve;
|
9
9
|
}
|
10
10
|
|
11
11
|
VComponent.prototype = {
|
12
|
-
|
12
|
+
bT_: 2
|
13
13
|
};
|
14
14
|
|
15
15
|
inherit(VComponent, VNode);
|
@@ -4,25 +4,25 @@ var extend = require("raptor-util/extend");
|
|
4
4
|
|
5
5
|
function VDocumentFragmentClone(other) {
|
6
6
|
extend(this, other);
|
7
|
-
this.
|
8
|
-
this.
|
7
|
+
this.bU_ = null;
|
8
|
+
this.bV_ = null;
|
9
9
|
}
|
10
10
|
|
11
11
|
function VDocumentFragment(out) {
|
12
|
-
this.
|
12
|
+
this.bR_(null /* childCount */);
|
13
13
|
this.A_ = out;
|
14
14
|
}
|
15
15
|
|
16
16
|
VDocumentFragment.prototype = {
|
17
|
-
|
17
|
+
bT_: 11,
|
18
18
|
|
19
|
-
|
19
|
+
bW_: true,
|
20
20
|
|
21
|
-
|
21
|
+
bK_: function () {
|
22
22
|
return new VDocumentFragmentClone(this);
|
23
23
|
},
|
24
24
|
|
25
|
-
|
25
|
+
bQ_: function (host) {
|
26
26
|
return (host.ownerDocument || host).createDocumentFragment();
|
27
27
|
}
|
28
28
|
};
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict"; /* jshint newcap:false */
|
2
2
|
|
3
|
+
|
3
4
|
var domData = require("../components/dom-data");
|
4
5
|
var componentsUtil = require("@internal/components-util");
|
5
|
-
var vElementByDOMNode = domData.
|
6
|
+
var vElementByDOMNode = domData._N_;
|
6
7
|
var VNode = require("./VNode");
|
7
8
|
var inherit = require("raptor-util/inherit");
|
8
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
@@ -30,9 +31,19 @@ function convertAttrValue(type, value) {
|
|
30
31
|
if (value === true) {
|
31
32
|
return "";
|
32
33
|
} else if (type == "object") {
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
switch (value.toString) {
|
35
|
+
case Object.prototype.toString:
|
36
|
+
case Array.prototype.toString:
|
37
|
+
// eslint-disable-next-line no-constant-condition
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
return JSON.stringify(value);
|
44
|
+
case RegExp.prototype.toString:
|
45
|
+
return value.source;}
|
46
|
+
|
36
47
|
}
|
37
48
|
|
38
49
|
return value + "";
|
@@ -63,17 +74,17 @@ function removeAttribute(el, namespaceURI, name) {
|
|
63
74
|
}
|
64
75
|
|
65
76
|
function VElementClone(other) {
|
66
|
-
this.
|
67
|
-
this.
|
68
|
-
this.
|
69
|
-
|
70
|
-
this.
|
71
|
-
this.
|
72
|
-
this.
|
73
|
-
this.
|
77
|
+
this.bX_ = other.bX_;
|
78
|
+
this.bU_ = null;
|
79
|
+
this.bV_ = null;
|
80
|
+
|
81
|
+
this.bS_ = other.bS_;
|
82
|
+
this.bY_ = other.bY_;
|
83
|
+
this._R_ = other._R_;
|
84
|
+
this.bZ_ = other.bZ_;
|
74
85
|
this.C_ = other.C_;
|
75
|
-
this.
|
76
|
-
this.
|
86
|
+
this.c__ = other.c__;
|
87
|
+
this.ca_ = other.ca_;
|
77
88
|
}
|
78
89
|
|
79
90
|
function VElement(
|
@@ -85,7 +96,7 @@ childCount,
|
|
85
96
|
flags,
|
86
97
|
props)
|
87
98
|
{
|
88
|
-
this.
|
99
|
+
this.bR_(childCount, ownerComponent);
|
89
100
|
|
90
101
|
var constId;
|
91
102
|
|
@@ -93,21 +104,21 @@ props)
|
|
93
104
|
constId = props.i;
|
94
105
|
}
|
95
106
|
|
96
|
-
this.
|
107
|
+
this.bS_ = key;
|
97
108
|
this.C_ = flags || 0;
|
98
|
-
this.
|
99
|
-
this.
|
100
|
-
this.
|
101
|
-
this.
|
102
|
-
this.
|
109
|
+
this.bY_ = attrs || EMPTY_OBJECT;
|
110
|
+
this._R_ = props || EMPTY_OBJECT;
|
111
|
+
this.bZ_ = tagName;
|
112
|
+
this.c__ = null;
|
113
|
+
this.ca_ = constId;
|
103
114
|
this.o_ = false;
|
104
115
|
this.n_ = false;
|
105
116
|
}
|
106
117
|
|
107
118
|
VElement.prototype = {
|
108
|
-
|
119
|
+
bT_: 1,
|
109
120
|
|
110
|
-
|
121
|
+
bK_: function () {
|
111
122
|
return new VElementClone(this);
|
112
123
|
},
|
113
124
|
|
@@ -119,7 +130,7 @@ VElement.prototype = {
|
|
119
130
|
* @param {int|null} childCount The number of child nodes (or `null` if not known)
|
120
131
|
*/
|
121
132
|
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
122
|
-
var child = this.
|
133
|
+
var child = this.bJ_(
|
123
134
|
new VElement(
|
124
135
|
tagName,
|
125
136
|
attrs,
|
@@ -132,7 +143,7 @@ VElement.prototype = {
|
|
132
143
|
|
133
144
|
|
134
145
|
if (childCount === 0) {
|
135
|
-
return this.
|
146
|
+
return this.cb_();
|
136
147
|
} else {
|
137
148
|
return child;
|
138
149
|
}
|
@@ -145,15 +156,15 @@ VElement.prototype = {
|
|
145
156
|
* @param {String} value The value for the new Comment node
|
146
157
|
*/
|
147
158
|
n: function (node, ownerComponent) {
|
148
|
-
node = node.
|
149
|
-
node.
|
150
|
-
this.
|
151
|
-
return this.
|
159
|
+
node = node.bK_();
|
160
|
+
node._P_ = ownerComponent;
|
161
|
+
this.bJ_(node);
|
162
|
+
return this.cb_();
|
152
163
|
},
|
153
164
|
|
154
|
-
|
155
|
-
var tagName = this.
|
156
|
-
var attributes = this.
|
165
|
+
bQ_: function (host, parentNamespaceURI) {
|
166
|
+
var tagName = this.bZ_;
|
167
|
+
var attributes = this.bY_;
|
157
168
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
158
169
|
|
159
170
|
var flags = this.C_;
|
@@ -195,11 +206,11 @@ VElement.prototype = {
|
|
195
206
|
return el;
|
196
207
|
},
|
197
208
|
|
198
|
-
|
209
|
+
cc_: function (name) {
|
199
210
|
// We don't care about the namespaces since the there
|
200
211
|
// is no chance that attributes with the same name will have
|
201
212
|
// different namespaces
|
202
|
-
var value = this.
|
213
|
+
var value = this.bY_[name];
|
203
214
|
return value != null && value !== false;
|
204
215
|
}
|
205
216
|
};
|
@@ -211,7 +222,7 @@ var proto = VElementClone.prototype = VElement.prototype;
|
|
211
222
|
["checked", "selected", "disabled"].forEach(function (name) {
|
212
223
|
defineProperty(proto, name, {
|
213
224
|
get: function () {
|
214
|
-
var value = this.
|
225
|
+
var value = this.bY_[name];
|
215
226
|
return value !== false && value != null;
|
216
227
|
}
|
217
228
|
});
|
@@ -219,20 +230,20 @@ var proto = VElementClone.prototype = VElement.prototype;
|
|
219
230
|
|
220
231
|
defineProperty(proto, "q_", {
|
221
232
|
get: function () {
|
222
|
-
var value = this.
|
233
|
+
var value = this.c__;
|
223
234
|
if (value == null) {
|
224
|
-
value = this.
|
235
|
+
value = this.bY_.value;
|
225
236
|
}
|
226
237
|
return value != null && value !== false ?
|
227
238
|
value + "" :
|
228
|
-
this.
|
229
|
-
this.
|
239
|
+
this.bY_.type === "checkbox" ||
|
240
|
+
this.bY_.type === "radio" ?
|
230
241
|
"on" :
|
231
242
|
"";
|
232
243
|
}
|
233
244
|
});
|
234
245
|
|
235
|
-
VElement.
|
246
|
+
VElement.cd_ = function (attrs) {
|
236
247
|
// By default this static method is a no-op, but if there are any
|
237
248
|
// compiled components that have "no-update" attributes then
|
238
249
|
// `preserve-attrs.js` will be imported and this method will be replaced
|
@@ -254,7 +265,7 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
254
265
|
var attrName = attr.name;
|
255
266
|
if (!xmlnsRegExp.test(attrName)) {
|
256
267
|
if (attrName === "data-marko") {
|
257
|
-
props = componentsUtil.
|
268
|
+
props = componentsUtil._t_(node);
|
258
269
|
} else if (attr.namespaceURI === NS_XLINK) {
|
259
270
|
attrs[ATTR_XLINK_HREF] = attr.value;
|
260
271
|
} else {
|
@@ -280,8 +291,8 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
280
291
|
props);
|
281
292
|
|
282
293
|
|
283
|
-
if (vdomEl.
|
284
|
-
vdomEl.
|
294
|
+
if (vdomEl.bZ_ === "textarea") {
|
295
|
+
vdomEl.c__ = node.value;
|
285
296
|
} else if (virtualizeChildNodes) {
|
286
297
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
287
298
|
}
|
@@ -289,18 +300,18 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
289
300
|
return vdomEl;
|
290
301
|
}
|
291
302
|
|
292
|
-
VElement.
|
303
|
+
VElement.ce_ = virtualizeElement;
|
293
304
|
|
294
|
-
VElement.
|
295
|
-
var removePreservedAttributes = VElement.
|
305
|
+
VElement.cf_ = function (fromEl, vFromEl, toEl) {
|
306
|
+
var removePreservedAttributes = VElement.cd_;
|
296
307
|
|
297
308
|
var fromFlags = vFromEl.C_;
|
298
309
|
var toFlags = toEl.C_;
|
299
310
|
|
300
311
|
vElementByDOMNode.set(fromEl, toEl);
|
301
312
|
|
302
|
-
var attrs = toEl.
|
303
|
-
var props = toEl.
|
313
|
+
var attrs = toEl.bY_;
|
314
|
+
var props = toEl._R_;
|
304
315
|
|
305
316
|
if (toFlags & FLAG_CUSTOM_ELEMENT) {
|
306
317
|
return assign(fromEl, attrs);
|
@@ -316,7 +327,7 @@ VElement.bM_ = function (fromEl, vFromEl, toEl) {
|
|
316
327
|
// real VElement node will not have the expando property
|
317
328
|
// so we build the attribute map from the expando property
|
318
329
|
|
319
|
-
var oldAttrs = vFromEl.
|
330
|
+
var oldAttrs = vFromEl.bY_;
|
320
331
|
|
321
332
|
if (oldAttrs) {
|
322
333
|
if (oldAttrs === attrs) {
|
@@ -388,7 +399,7 @@ VElement.bM_ = function (fromEl, vFromEl, toEl) {
|
|
388
399
|
// was not a virtualized node (i.e., a node that was not rendered by a
|
389
400
|
// Marko template, but rather a node that was created from an HTML
|
390
401
|
// string or a real DOM node).
|
391
|
-
if (toEl.
|
402
|
+
if (toEl.bS_ === null || fromFlags & FLAG_SPREAD_ATTRS) {
|
392
403
|
for (attrName in oldAttrs) {
|
393
404
|
if (!(attrName in attrs)) {
|
394
405
|
if (attrName === ATTR_XLINK_HREF) {
|