marko 5.29.2 → 5.30.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/README.md +1 -1
- package/bin/markoc.js +18 -18
- 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/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
|
@@ -17,9 +17,9 @@ if (String(OutgoingMessageProto.flush).indexOf("deprecated") !== -1) {
|
|
|
17
17
|
class Readable extends stream.Readable {
|
|
18
18
|
constructor(template, data) {
|
|
19
19
|
super();
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
20
|
+
this._Z_ = template;
|
|
21
|
+
this.a__ = data;
|
|
22
|
+
this.aa_ = false;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
write(data) {
|
|
@@ -33,19 +33,19 @@ class Readable extends stream.Readable {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
_read() {
|
|
36
|
-
if (this.
|
|
36
|
+
if (this.aa_) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
this.
|
|
41
|
-
var template = this.
|
|
42
|
-
var data = this.
|
|
40
|
+
this.aa_ = true;
|
|
41
|
+
var template = this._Z_;
|
|
42
|
+
var data = this.a__;
|
|
43
43
|
var globalData = data && data.$global;
|
|
44
|
-
var out = this.
|
|
44
|
+
var out = this._Z_.createOut(
|
|
45
45
|
globalData,
|
|
46
46
|
this,
|
|
47
47
|
undefined,
|
|
48
|
-
template.
|
|
48
|
+
template._Y_);
|
|
49
49
|
|
|
50
50
|
template.render(data, out);
|
|
51
51
|
out.end();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.
|
|
2
|
-
exports.
|
|
1
|
+
"use strict";exports.ab_ = setTimeout;
|
|
2
|
+
exports.ac_ = clearTimeout;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.
|
|
2
|
-
exports.
|
|
1
|
+
"use strict";exports.ab_ = setImmediate;
|
|
2
|
+
exports.ac_ = clearImmediate;
|
|
@@ -50,7 +50,7 @@ var proto = RenderResult.prototype = {
|
|
|
50
50
|
var out = this.A_;
|
|
51
51
|
var componentsContext = out.b_;
|
|
52
52
|
if (componentsContext) {
|
|
53
|
-
this.b_ = componentsContext.
|
|
53
|
+
this.b_ = componentsContext.ad_(host);
|
|
54
54
|
} else {
|
|
55
55
|
this.b_ = null;
|
|
56
56
|
}
|
|
@@ -58,10 +58,10 @@ var proto = RenderResult.prototype = {
|
|
|
58
58
|
return this;
|
|
59
59
|
},
|
|
60
60
|
getNode: function (host) {
|
|
61
|
-
return this.A_.
|
|
61
|
+
return this.A_.ae_(host);
|
|
62
62
|
},
|
|
63
63
|
getOutput: function () {
|
|
64
|
-
return this.A_.
|
|
64
|
+
return this.A_.af_();
|
|
65
65
|
},
|
|
66
66
|
toString: function () {
|
|
67
67
|
return this.A_.toString();
|
|
@@ -8,8 +8,8 @@ var defaultCreateOut = require("../createOut");
|
|
|
8
8
|
var getComponentsContext =
|
|
9
9
|
require("./ComponentsContext").e_;
|
|
10
10
|
var componentsUtil = require("@internal/components-util");
|
|
11
|
-
var componentLookup = componentsUtil.
|
|
12
|
-
var destroyNodeRecursive = componentsUtil.
|
|
11
|
+
var componentLookup = componentsUtil._o_;
|
|
12
|
+
var destroyNodeRecursive = componentsUtil._U_;
|
|
13
13
|
var EventEmitter = require("events-light");
|
|
14
14
|
var RenderResult = require("../RenderResult");
|
|
15
15
|
var SubscriptionTracker = require("listener-tracker");
|
|
@@ -18,8 +18,8 @@ var updateManager = require("./update-manager");
|
|
|
18
18
|
var morphdom = require("../vdom/morphdom");
|
|
19
19
|
var eventDelegation = require("./event-delegation");
|
|
20
20
|
var domData = require("./dom-data");
|
|
21
|
-
var componentsByDOMNode = domData.
|
|
22
|
-
var keyedElementsByComponentId = domData.
|
|
21
|
+
var componentsByDOMNode = domData._r_;
|
|
22
|
+
var keyedElementsByComponentId = domData._q_;
|
|
23
23
|
var CONTEXT_KEY = "__subtree_context__";
|
|
24
24
|
|
|
25
25
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -66,7 +66,7 @@ extraArgs)
|
|
|
66
66
|
args = extraArgs.concat(args);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
var targetComponent = componentLookup[component.
|
|
69
|
+
var targetComponent = componentLookup[component._a_];
|
|
70
70
|
var targetMethod =
|
|
71
71
|
typeof targetMethodName === "function" ?
|
|
72
72
|
targetMethodName :
|
|
@@ -128,8 +128,8 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
128
128
|
handlerMethod.call(component, newValue, oldValue);
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
component.
|
|
132
|
-
component.
|
|
131
|
+
component._A_();
|
|
132
|
+
component._v_();
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return true;
|
|
@@ -169,22 +169,22 @@ var componentProto;
|
|
|
169
169
|
function Component(id) {
|
|
170
170
|
EventEmitter.call(this);
|
|
171
171
|
this.id = id;
|
|
172
|
-
this.J_ = null;
|
|
173
|
-
this._m_ = null;
|
|
174
|
-
this._N_ = null;
|
|
175
|
-
this._e_ = null;
|
|
176
|
-
this.I_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
177
172
|
this.G_ = null;
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
173
|
+
this._G_ = null;
|
|
174
|
+
this.ag_ = null;
|
|
175
|
+
this._y_ = null;
|
|
176
|
+
this._b_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
177
|
+
this.___ = null;
|
|
178
|
+
this._a_ = null;
|
|
179
|
+
this.ah_ = null;
|
|
180
|
+
this.U_ = undefined;
|
|
181
|
+
this._z_ = false;
|
|
182
|
+
this.ai_ = undefined;
|
|
183
|
+
this.P_ = false;
|
|
181
184
|
this._f_ = false;
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
this._R_ = false;
|
|
186
|
-
this._S_ = false;
|
|
187
|
-
this._b_ = undefined;
|
|
185
|
+
this.aj_ = false;
|
|
186
|
+
this.ak_ = false;
|
|
187
|
+
this.I_ = undefined;
|
|
188
188
|
|
|
189
189
|
var ssrKeyedElements = keyedElementsByComponentId[id];
|
|
190
190
|
|
|
@@ -197,7 +197,7 @@ function Component(id) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
Component.prototype = componentProto = {
|
|
200
|
-
|
|
200
|
+
E_: true,
|
|
201
201
|
|
|
202
202
|
subscribeTo: function (target) {
|
|
203
203
|
if (!target) {
|
|
@@ -205,10 +205,10 @@ Component.prototype = componentProto = {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
var subscriptions =
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
208
|
+
this.ag_ || (
|
|
209
|
+
this.ag_ = new SubscriptionTracker());
|
|
210
210
|
|
|
211
|
-
var subscribeToOptions = target.
|
|
211
|
+
var subscribeToOptions = target.E_ ?
|
|
212
212
|
COMPONENT_SUBSCRIBE_TO_OPTIONS :
|
|
213
213
|
NON_COMPONENT_SUBSCRIBE_TO_OPTIONS;
|
|
214
214
|
|
|
@@ -216,7 +216,7 @@ Component.prototype = componentProto = {
|
|
|
216
216
|
},
|
|
217
217
|
|
|
218
218
|
emit: function (eventType) {
|
|
219
|
-
var customEvents = this.
|
|
219
|
+
var customEvents = this.___;
|
|
220
220
|
var target;
|
|
221
221
|
|
|
222
222
|
if (customEvents && (target = customEvents[eventType])) {
|
|
@@ -247,20 +247,18 @@ Component.prototype = componentProto = {
|
|
|
247
247
|
},
|
|
248
248
|
getEl: function (key, index) {
|
|
249
249
|
if (key) {
|
|
250
|
-
var
|
|
251
|
-
this.l_["@" +
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
var resolvedKey = resolveKeyHelper(key, index);
|
|
251
|
+
var keyedElement = this.l_["@" + resolvedKey];
|
|
252
|
+
if (keyedElement && keyedElement.nodeType === 12 /** FRAGMENT_NODE */) {
|
|
253
|
+
// eslint-disable-next-line no-constant-condition
|
|
258
254
|
|
|
259
255
|
|
|
260
256
|
|
|
261
257
|
|
|
262
258
|
|
|
263
259
|
|
|
260
|
+
return walkFragments(keyedElement);
|
|
261
|
+
}
|
|
264
262
|
|
|
265
263
|
return keyedElement;
|
|
266
264
|
} else {
|
|
@@ -281,15 +279,15 @@ Component.prototype = componentProto = {
|
|
|
281
279
|
},
|
|
282
280
|
getComponent: function (key, index) {
|
|
283
281
|
var rootNode = this.l_["@" + resolveKeyHelper(key, index)];
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
282
|
+
if (/\[\]$/.test(key)) {
|
|
283
|
+
// eslint-disable-next-line no-constant-condition
|
|
288
284
|
|
|
289
285
|
|
|
290
286
|
|
|
291
287
|
|
|
292
288
|
|
|
289
|
+
rootNode = rootNode && rootNode[Object.keys(rootNode)[0]];
|
|
290
|
+
}
|
|
293
291
|
return rootNode && componentsByDOMNode.get(rootNode);
|
|
294
292
|
},
|
|
295
293
|
getComponents: function (key) {
|
|
@@ -303,20 +301,20 @@ Component.prototype = componentProto = {
|
|
|
303
301
|
[];
|
|
304
302
|
},
|
|
305
303
|
destroy: function () {
|
|
306
|
-
if (this.
|
|
304
|
+
if (this.P_) {
|
|
307
305
|
return;
|
|
308
306
|
}
|
|
309
307
|
|
|
310
|
-
var root = this.
|
|
308
|
+
var root = this._G_;
|
|
311
309
|
|
|
312
|
-
this.
|
|
310
|
+
this._Q_();
|
|
313
311
|
|
|
314
312
|
var nodes = root.nodes;
|
|
315
313
|
|
|
316
314
|
nodes.forEach(function (node) {
|
|
317
315
|
destroyNodeRecursive(node);
|
|
318
316
|
|
|
319
|
-
if (eventDelegation.
|
|
317
|
+
if (eventDelegation.al_(node) !== false) {
|
|
320
318
|
node.parentNode.removeChild(node);
|
|
321
319
|
}
|
|
322
320
|
});
|
|
@@ -327,81 +325,81 @@ Component.prototype = componentProto = {
|
|
|
327
325
|
this.l_ = {};
|
|
328
326
|
},
|
|
329
327
|
|
|
330
|
-
|
|
331
|
-
if (this.
|
|
328
|
+
_Q_: function () {
|
|
329
|
+
if (this.P_) {
|
|
332
330
|
return;
|
|
333
331
|
}
|
|
334
332
|
|
|
335
|
-
this.
|
|
336
|
-
this.
|
|
333
|
+
this.am_();
|
|
334
|
+
this.P_ = true;
|
|
337
335
|
|
|
338
|
-
componentsByDOMNode.set(this.
|
|
336
|
+
componentsByDOMNode.set(this._G_, undefined);
|
|
339
337
|
|
|
340
|
-
this.
|
|
338
|
+
this._G_ = null;
|
|
341
339
|
|
|
342
340
|
// Unsubscribe from all DOM events
|
|
343
|
-
this.
|
|
341
|
+
this._x_();
|
|
344
342
|
|
|
345
|
-
var subscriptions = this.
|
|
343
|
+
var subscriptions = this.ag_;
|
|
346
344
|
if (subscriptions) {
|
|
347
345
|
subscriptions.removeAllListeners();
|
|
348
|
-
this.
|
|
346
|
+
this.ag_ = null;
|
|
349
347
|
}
|
|
350
348
|
},
|
|
351
349
|
|
|
352
350
|
isDestroyed: function () {
|
|
353
|
-
return this.
|
|
351
|
+
return this.P_;
|
|
354
352
|
},
|
|
355
353
|
get state() {
|
|
356
|
-
return this.
|
|
354
|
+
return this.G_;
|
|
357
355
|
},
|
|
358
356
|
set state(newState) {
|
|
359
|
-
var state = this.
|
|
357
|
+
var state = this.G_;
|
|
360
358
|
if (!state && !newState) {
|
|
361
359
|
return;
|
|
362
360
|
}
|
|
363
361
|
|
|
364
362
|
if (!state) {
|
|
365
|
-
state = this.
|
|
363
|
+
state = this.G_ = new this.V_(this);
|
|
366
364
|
}
|
|
367
365
|
|
|
368
|
-
state.
|
|
366
|
+
state.an_(newState || {});
|
|
369
367
|
|
|
370
|
-
if (state.
|
|
371
|
-
this.
|
|
368
|
+
if (state.aj_) {
|
|
369
|
+
this.ao_();
|
|
372
370
|
}
|
|
373
371
|
|
|
374
372
|
if (!newState) {
|
|
375
|
-
this.
|
|
373
|
+
this.G_ = null;
|
|
376
374
|
}
|
|
377
375
|
},
|
|
378
376
|
setState: function (name, value) {
|
|
379
|
-
var state = this.
|
|
377
|
+
var state = this.G_;
|
|
380
378
|
|
|
381
379
|
if (!state) {
|
|
382
|
-
state = this.
|
|
380
|
+
state = this.G_ = new this.V_(this);
|
|
383
381
|
}
|
|
384
382
|
if (typeof name == "object") {
|
|
385
383
|
// Merge in the new state with the old state
|
|
386
384
|
var newState = name;
|
|
387
385
|
for (var k in newState) {
|
|
388
386
|
if (hasOwnProperty.call(newState, k)) {
|
|
389
|
-
state.
|
|
387
|
+
state.ap_(k, newState[k], true /* ensure:true */);
|
|
390
388
|
}
|
|
391
389
|
}
|
|
392
390
|
} else {
|
|
393
|
-
state.
|
|
391
|
+
state.ap_(name, value, true /* ensure:true */);
|
|
394
392
|
}
|
|
395
393
|
},
|
|
396
394
|
|
|
397
395
|
setStateDirty: function (name, value) {
|
|
398
|
-
var state = this.
|
|
396
|
+
var state = this.G_;
|
|
399
397
|
|
|
400
398
|
if (arguments.length == 1) {
|
|
401
399
|
value = state[name];
|
|
402
400
|
}
|
|
403
401
|
|
|
404
|
-
state.
|
|
402
|
+
state.ap_(
|
|
405
403
|
name,
|
|
406
404
|
value,
|
|
407
405
|
true /* ensure:true */,
|
|
@@ -410,46 +408,46 @@ Component.prototype = componentProto = {
|
|
|
410
408
|
},
|
|
411
409
|
|
|
412
410
|
replaceState: function (newState) {
|
|
413
|
-
this.
|
|
411
|
+
this.G_.an_(newState);
|
|
414
412
|
},
|
|
415
413
|
|
|
416
414
|
get input() {
|
|
417
|
-
return this.
|
|
415
|
+
return this.U_;
|
|
418
416
|
},
|
|
419
417
|
set input(newInput) {
|
|
420
|
-
if (this.
|
|
421
|
-
this.
|
|
418
|
+
if (this.ak_) {
|
|
419
|
+
this.U_ = newInput;
|
|
422
420
|
} else {
|
|
423
|
-
this.
|
|
421
|
+
this._m_(newInput);
|
|
424
422
|
}
|
|
425
423
|
},
|
|
426
424
|
|
|
427
|
-
|
|
425
|
+
_m_: function (newInput, onInput, out) {
|
|
428
426
|
onInput = onInput || this.onInput;
|
|
429
427
|
var updatedInput;
|
|
430
428
|
|
|
431
|
-
var oldInput = this.
|
|
432
|
-
this.
|
|
433
|
-
this.
|
|
429
|
+
var oldInput = this.U_;
|
|
430
|
+
this.U_ = undefined;
|
|
431
|
+
this.aq_ = out && out[CONTEXT_KEY] || this.aq_;
|
|
434
432
|
|
|
435
433
|
if (onInput) {
|
|
436
434
|
// We need to set a flag to preview `this.input = foo` inside
|
|
437
435
|
// onInput causing infinite recursion
|
|
438
|
-
this.
|
|
436
|
+
this.ak_ = true;
|
|
439
437
|
updatedInput = onInput.call(this, newInput || {}, out);
|
|
440
|
-
this.
|
|
438
|
+
this.ak_ = false;
|
|
441
439
|
}
|
|
442
440
|
|
|
443
|
-
newInput = this.
|
|
441
|
+
newInput = this.ah_ = updatedInput || newInput;
|
|
444
442
|
|
|
445
|
-
if (this.
|
|
446
|
-
this.
|
|
443
|
+
if (this.aj_ = checkInputChanged(this, oldInput, newInput)) {
|
|
444
|
+
this.ao_();
|
|
447
445
|
}
|
|
448
446
|
|
|
449
|
-
if (this.
|
|
450
|
-
this.
|
|
447
|
+
if (this.U_ === undefined) {
|
|
448
|
+
this.U_ = newInput;
|
|
451
449
|
if (newInput && newInput.$global) {
|
|
452
|
-
this.
|
|
450
|
+
this.ai_ = newInput.$global;
|
|
453
451
|
}
|
|
454
452
|
}
|
|
455
453
|
|
|
@@ -457,57 +455,57 @@ Component.prototype = componentProto = {
|
|
|
457
455
|
},
|
|
458
456
|
|
|
459
457
|
forceUpdate: function () {
|
|
460
|
-
this.
|
|
461
|
-
this.
|
|
458
|
+
this.aj_ = true;
|
|
459
|
+
this.ao_();
|
|
462
460
|
},
|
|
463
461
|
|
|
464
|
-
|
|
465
|
-
if (!this.
|
|
466
|
-
this.
|
|
467
|
-
updateManager.
|
|
462
|
+
ao_: function () {
|
|
463
|
+
if (!this._f_) {
|
|
464
|
+
this._f_ = true;
|
|
465
|
+
updateManager.ar_(this);
|
|
468
466
|
}
|
|
469
467
|
},
|
|
470
468
|
|
|
471
469
|
update: function () {
|
|
472
|
-
if (this.
|
|
470
|
+
if (this.P_ === true || this.as_ === false) {
|
|
473
471
|
return;
|
|
474
472
|
}
|
|
475
473
|
|
|
476
|
-
var input = this.
|
|
477
|
-
var state = this.
|
|
474
|
+
var input = this.U_;
|
|
475
|
+
var state = this.G_;
|
|
478
476
|
|
|
479
|
-
if (this.
|
|
480
|
-
if (processUpdateHandlers(this, state.
|
|
481
|
-
state.
|
|
477
|
+
if (this.aj_ === false && state !== null && state.aj_ === true) {
|
|
478
|
+
if (processUpdateHandlers(this, state.at_, state.au_, state)) {
|
|
479
|
+
state.aj_ = false;
|
|
482
480
|
}
|
|
483
481
|
}
|
|
484
482
|
|
|
485
|
-
if (this.
|
|
483
|
+
if (this.as_ === true) {
|
|
486
484
|
// The UI component is still dirty after process state handlers
|
|
487
485
|
// then we should rerender
|
|
488
486
|
|
|
489
487
|
if (this.shouldUpdate(input, state) !== false) {
|
|
490
|
-
this.
|
|
488
|
+
this.av_();
|
|
491
489
|
}
|
|
492
490
|
}
|
|
493
491
|
|
|
494
|
-
this.
|
|
492
|
+
this._v_();
|
|
495
493
|
},
|
|
496
494
|
|
|
497
|
-
get
|
|
495
|
+
get as_() {
|
|
498
496
|
return (
|
|
499
|
-
this.
|
|
500
|
-
this.
|
|
497
|
+
this.aj_ === true ||
|
|
498
|
+
this.G_ !== null && this.G_.aj_ === true);
|
|
501
499
|
|
|
502
500
|
},
|
|
503
501
|
|
|
504
|
-
|
|
505
|
-
this.
|
|
506
|
-
this.
|
|
507
|
-
this.
|
|
508
|
-
var state = this.
|
|
502
|
+
_v_: function () {
|
|
503
|
+
this.aj_ = false;
|
|
504
|
+
this._f_ = false;
|
|
505
|
+
this.ah_ = null;
|
|
506
|
+
var state = this.G_;
|
|
509
507
|
if (state) {
|
|
510
|
-
state.
|
|
508
|
+
state._v_();
|
|
511
509
|
}
|
|
512
510
|
},
|
|
513
511
|
|
|
@@ -515,72 +513,72 @@ Component.prototype = componentProto = {
|
|
|
515
513
|
return true;
|
|
516
514
|
},
|
|
517
515
|
|
|
518
|
-
|
|
516
|
+
av_: function () {
|
|
519
517
|
var self = this;
|
|
520
|
-
var renderer = self.
|
|
518
|
+
var renderer = self.W_;
|
|
521
519
|
|
|
522
520
|
if (!renderer) {
|
|
523
521
|
throw TypeError();
|
|
524
522
|
}
|
|
525
523
|
|
|
526
|
-
var input = this.
|
|
524
|
+
var input = this.ah_ || this.U_;
|
|
527
525
|
|
|
528
|
-
updateManager.
|
|
529
|
-
self.
|
|
526
|
+
updateManager.aw_(function () {
|
|
527
|
+
self._H_(input, false).afterInsert(self.I_);
|
|
530
528
|
});
|
|
531
529
|
|
|
532
|
-
this.
|
|
530
|
+
this._v_();
|
|
533
531
|
},
|
|
534
532
|
|
|
535
|
-
|
|
536
|
-
var host = this.
|
|
537
|
-
var globalData = this.
|
|
538
|
-
var rootNode = this.
|
|
539
|
-
var renderer = this.
|
|
533
|
+
_H_: function (input, isHydrate) {
|
|
534
|
+
var host = this.I_;
|
|
535
|
+
var globalData = this.ai_;
|
|
536
|
+
var rootNode = this._G_;
|
|
537
|
+
var renderer = this.W_;
|
|
540
538
|
var createOut = renderer.createOut || defaultCreateOut;
|
|
541
539
|
var out = createOut(globalData);
|
|
542
540
|
out.sync();
|
|
543
|
-
out.
|
|
544
|
-
out[CONTEXT_KEY] = this.
|
|
541
|
+
out.I_ = this.I_;
|
|
542
|
+
out[CONTEXT_KEY] = this.aq_;
|
|
545
543
|
|
|
546
544
|
var componentsContext = getComponentsContext(out);
|
|
547
545
|
var globalComponentsContext = componentsContext.f_;
|
|
548
|
-
globalComponentsContext.
|
|
546
|
+
globalComponentsContext.ax_ = this;
|
|
549
547
|
globalComponentsContext.g_ = isHydrate;
|
|
550
548
|
|
|
551
549
|
renderer(input, out);
|
|
552
550
|
|
|
553
551
|
var result = new RenderResult(out);
|
|
554
552
|
|
|
555
|
-
var targetNode = out.
|
|
553
|
+
var targetNode = out.af_().ay_;
|
|
556
554
|
|
|
557
555
|
morphdom(rootNode, targetNode, host, componentsContext);
|
|
558
556
|
|
|
559
557
|
return result;
|
|
560
558
|
},
|
|
561
559
|
|
|
562
|
-
|
|
563
|
-
var root = this.
|
|
560
|
+
az_: function () {
|
|
561
|
+
var root = this._G_;
|
|
564
562
|
root.remove();
|
|
565
563
|
return root;
|
|
566
564
|
},
|
|
567
565
|
|
|
568
|
-
|
|
569
|
-
var eventListenerHandles = this.
|
|
566
|
+
_x_: function () {
|
|
567
|
+
var eventListenerHandles = this._y_;
|
|
570
568
|
if (eventListenerHandles) {
|
|
571
569
|
eventListenerHandles.forEach(removeListener);
|
|
572
|
-
this.
|
|
570
|
+
this._y_ = null;
|
|
573
571
|
}
|
|
574
572
|
},
|
|
575
573
|
|
|
576
|
-
get
|
|
577
|
-
var state = this.
|
|
578
|
-
return state && state.
|
|
574
|
+
get aA_() {
|
|
575
|
+
var state = this.G_;
|
|
576
|
+
return state && state.H_;
|
|
579
577
|
},
|
|
580
578
|
|
|
581
|
-
|
|
582
|
-
var finalCustomEvents = this.
|
|
583
|
-
this.
|
|
579
|
+
aB_: function (customEvents, scope) {
|
|
580
|
+
var finalCustomEvents = this.___ = {};
|
|
581
|
+
this._a_ = scope;
|
|
584
582
|
|
|
585
583
|
customEvents.forEach(function (customEvent) {
|
|
586
584
|
var eventType = customEvent[0];
|
|
@@ -595,7 +593,7 @@ Component.prototype = componentProto = {
|
|
|
595
593
|
},
|
|
596
594
|
|
|
597
595
|
get el() {
|
|
598
|
-
return walkFragments(this.
|
|
596
|
+
return walkFragments(this._G_);
|
|
599
597
|
},
|
|
600
598
|
|
|
601
599
|
get els() {
|
|
@@ -605,43 +603,43 @@ Component.prototype = componentProto = {
|
|
|
605
603
|
|
|
606
604
|
|
|
607
605
|
|
|
608
|
-
return (this.
|
|
606
|
+
return (this._G_ ? this._G_.nodes : []).filter(function (
|
|
609
607
|
el)
|
|
610
608
|
{
|
|
611
609
|
return el.nodeType === ELEMENT_NODE;
|
|
612
610
|
});
|
|
613
611
|
},
|
|
614
612
|
|
|
615
|
-
|
|
616
|
-
|
|
613
|
+
aC_: emit,
|
|
614
|
+
aD_(input, out) {
|
|
617
615
|
this.onCreate && this.onCreate(input, out);
|
|
618
|
-
this.
|
|
616
|
+
this.aC_("create", input, out);
|
|
619
617
|
},
|
|
620
618
|
|
|
621
|
-
|
|
619
|
+
aE_(out) {
|
|
622
620
|
this.onRender && this.onRender(out);
|
|
623
|
-
this.
|
|
621
|
+
this.aC_("render", out);
|
|
624
622
|
},
|
|
625
623
|
|
|
626
|
-
|
|
624
|
+
_A_() {
|
|
627
625
|
this.onUpdate && this.onUpdate();
|
|
628
|
-
this.
|
|
626
|
+
this.aC_("update");
|
|
629
627
|
},
|
|
630
628
|
|
|
631
|
-
|
|
629
|
+
_B_() {
|
|
632
630
|
this.onMount && this.onMount();
|
|
633
|
-
this.
|
|
631
|
+
this.aC_("mount");
|
|
634
632
|
},
|
|
635
633
|
|
|
636
|
-
|
|
634
|
+
am_() {
|
|
637
635
|
this.onDestroy && this.onDestroy();
|
|
638
|
-
this.
|
|
636
|
+
this.aC_("destroy");
|
|
639
637
|
}
|
|
640
638
|
};
|
|
641
639
|
|
|
642
640
|
componentProto.elId = componentProto.getElId;
|
|
643
|
-
componentProto.
|
|
644
|
-
componentProto.
|
|
641
|
+
componentProto.aF_ = componentProto.update;
|
|
642
|
+
componentProto.aG_ = componentProto.destroy;
|
|
645
643
|
|
|
646
644
|
// Add all of the following DOM methods to Component.prototype:
|
|
647
645
|
// - appendTo(referenceEl)
|
|
@@ -653,7 +651,7 @@ componentProto.ar_ = componentProto.destroy;
|
|
|
653
651
|
domInsert(
|
|
654
652
|
componentProto,
|
|
655
653
|
function getEl(component) {
|
|
656
|
-
return component.
|
|
654
|
+
return component.az_();
|
|
657
655
|
},
|
|
658
656
|
function afterInsert(component) {
|
|
659
657
|
return component;
|