marko 5.35.7 → 5.35.8
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/bin/markoc.js +0 -2
- package/dist/compiler/index.js +2 -0
- package/dist/core-tags/core/await/AsyncValue.js +1 -0
- package/dist/core-tags/core/await/renderer.js +1 -0
- package/dist/node-require/hot-reload.js +1 -3
- package/dist/node-require/index.js +1 -1
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -2
- package/dist/node_modules/@internal/components-entry/index.js +13 -13
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +4 -3
- package/dist/node_modules/@internal/components-registry/index-browser.js +40 -36
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +16 -16
- package/dist/node_modules/@internal/components-util/index.js +7 -7
- package/dist/node_modules/@internal/create-readable/index-browser.js +2 -2
- package/dist/node_modules/@internal/create-readable/index.js +9 -9
- package/dist/node_modules/@internal/preserve-tag/index-browser.js +5 -5
- package/dist/node_modules/@internal/preserve-tag/index.js +1 -1
- package/dist/node_modules/@internal/require/index-webpack.js +1 -0
- 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 +4 -3
- package/dist/runtime/components/Component.js +107 -106
- package/dist/runtime/components/ComponentDef.js +25 -25
- 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 +8 -7
- package/dist/runtime/components/State.js +20 -24
- package/dist/runtime/components/attach-detach.js +7 -7
- package/dist/runtime/components/defineComponent.js +0 -1
- package/dist/runtime/components/dom-data.js +5 -5
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +14 -13
- package/dist/runtime/components/legacy/dependencies/index.js +9 -10
- package/dist/runtime/components/legacy/jquery.js +1 -0
- package/dist/runtime/components/legacy/renderer-legacy.js +33 -32
- package/dist/runtime/components/renderer.js +29 -29
- package/dist/runtime/components/update-manager.js +4 -4
- 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 +18 -13
- package/dist/runtime/helpers/render-tag.js +1 -1
- package/dist/runtime/helpers/serialize-noop.js +5 -0
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -0
- package/dist/runtime/helpers/tags-compat/dom.mjs +1 -0
- package/dist/runtime/helpers/tags-compat/html-debug.js +1 -1
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +3 -2
- package/dist/runtime/helpers/tags-compat/html.js +3 -1
- package/dist/runtime/helpers/tags-compat/html.mjs +3 -2
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +38 -35
- package/dist/runtime/helpers/tags-compat/runtime-html.js +24 -65
- package/dist/runtime/html/AsyncStream.js +25 -24
- 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 +4 -3
- package/dist/runtime/html/helpers/attrs.js +1 -0
- package/dist/runtime/html/helpers/data-marko.js +2 -3
- 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 +1 -0
- package/dist/runtime/html/index.js +1 -1
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +86 -85
- package/dist/runtime/vdom/VComponent.js +4 -4
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VElement.js +41 -42
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +34 -35
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +1 -0
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +14 -14
- package/dist/runtime/vdom/index.js +1 -1
- 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 +67 -68
- package/dist/runtime/vdom/vdom.js +14 -14
- package/dist/taglib/index.js +1 -0
- package/index.d.ts +1 -5
- package/package.json +2 -2
- package/src/compiler/index.js +2 -0
- package/src/core-tags/core/await/AsyncValue.js +1 -0
- package/src/core-tags/core/await/renderer.js +1 -0
- package/src/node-require/hot-reload.js +0 -2
- package/src/node-require/index.js +1 -1
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -2
- package/src/node_modules/@internal/components-entry/index.js +2 -2
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +1 -0
- package/src/node_modules/@internal/components-registry/index-browser.js +8 -4
- package/src/node_modules/@internal/components-util/index-browser.js +1 -1
- package/src/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/src/node_modules/@internal/require/index-webpack.js +1 -0
- package/src/runtime/RenderResult.js +1 -0
- package/src/runtime/components/Component.js +2 -1
- package/src/runtime/components/ComponentDef.js +4 -4
- package/src/runtime/components/ServerComponent.js +1 -0
- package/src/runtime/components/State.js +6 -10
- package/src/runtime/components/defineComponent.js +0 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +1 -0
- package/src/runtime/components/legacy/dependencies/index.js +0 -1
- package/src/runtime/components/legacy/jquery.js +1 -0
- package/src/runtime/components/legacy/renderer-legacy.js +1 -0
- package/src/runtime/helpers/dynamic-tag.js +11 -6
- package/src/runtime/helpers/serialize-noop.js +5 -0
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -0
- package/src/runtime/helpers/tags-compat/dom.mjs +1 -0
- package/src/runtime/helpers/tags-compat/html-debug.js +1 -1
- package/src/runtime/helpers/tags-compat/html-debug.mjs +3 -2
- package/src/runtime/helpers/tags-compat/html.js +3 -1
- package/src/runtime/helpers/tags-compat/html.mjs +3 -2
- package/src/runtime/helpers/tags-compat/runtime-dom.js +23 -20
- package/src/runtime/helpers/tags-compat/runtime-html.js +18 -59
- package/src/runtime/html/AsyncStream.js +1 -0
- package/src/runtime/html/helpers/attr.js +1 -0
- package/src/runtime/html/helpers/attrs.js +1 -0
- package/src/runtime/html/helpers/data-marko.js +0 -1
- package/src/runtime/html/helpers/merge-attrs.js +1 -0
- package/src/runtime/vdom/AsyncVDOMBuilder.js +1 -0
- package/src/runtime/vdom/VElement.js +1 -2
- package/src/runtime/vdom/VNode.js +0 -1
- package/src/runtime/vdom/helpers/attrs.js +1 -0
- package/src/runtime/vdom/morphdom/index.js +0 -1
- package/src/taglib/index.js +1 -0
- package/tags-html.d.ts +7 -9
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* jshint newcap:false */
|
|
3
2
|
|
|
3
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
4
4
|
|
|
5
5
|
var EventEmitter = require("events-light");
|
|
6
6
|
var SubscriptionTracker = require("listener-tracker");
|
|
7
7
|
var inherit = require("raptor-util/inherit");
|
|
8
8
|
var componentsUtil = require("@internal/components-util");
|
|
9
|
-
var componentLookup = componentsUtil.
|
|
10
|
-
var destroyNodeRecursive = componentsUtil.
|
|
9
|
+
var componentLookup = componentsUtil._l_;
|
|
10
|
+
var destroyNodeRecursive = componentsUtil._R_;
|
|
11
11
|
var defaultCreateOut = require("../createOut");
|
|
12
12
|
var domInsert = require("../dom-insert");
|
|
13
13
|
var RenderResult = require("../RenderResult");
|
|
@@ -17,8 +17,8 @@ require("./ComponentsContext").S_;
|
|
|
17
17
|
var domData = require("./dom-data");
|
|
18
18
|
var eventDelegation = require("./event-delegation");
|
|
19
19
|
var updateManager = require("./update-manager");
|
|
20
|
-
var componentsByDOMNode = domData.
|
|
21
|
-
var keyedElementsByComponentId = domData.
|
|
20
|
+
var componentsByDOMNode = domData._p_;
|
|
21
|
+
var keyedElementsByComponentId = domData._o_;
|
|
22
22
|
var CONTEXT_KEY = "__subtree_context__";
|
|
23
23
|
|
|
24
24
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -65,7 +65,7 @@ extraArgs)
|
|
|
65
65
|
args = extraArgs.concat(args);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
var targetComponent = componentLookup[component.
|
|
68
|
+
var targetComponent = componentLookup[component.X_];
|
|
69
69
|
var targetMethod =
|
|
70
70
|
typeof targetMethodName === "function" ?
|
|
71
71
|
targetMethodName :
|
|
@@ -127,8 +127,8 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
127
127
|
handlerMethod.call(component, newValue, oldValue);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
component.
|
|
131
|
-
component.
|
|
130
|
+
component._y_();
|
|
131
|
+
component._t_();
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
return true;
|
|
@@ -169,20 +169,20 @@ function Component(id) {
|
|
|
169
169
|
EventEmitter.call(this);
|
|
170
170
|
this.id = id;
|
|
171
171
|
this.z_ = null;
|
|
172
|
-
this.
|
|
173
|
-
this.ah_ = null;
|
|
174
|
-
this._v_ = null;
|
|
175
|
-
this.X_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
176
|
-
this.V_ = null;
|
|
177
|
-
this.W_ = null;
|
|
172
|
+
this._E_ = null;
|
|
178
173
|
this.ai_ = null;
|
|
174
|
+
this._w_ = null;
|
|
175
|
+
this.Y_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
176
|
+
this.W_ = null;
|
|
177
|
+
this.X_ = null;
|
|
178
|
+
this.aj_ = null;
|
|
179
179
|
this.O_ = undefined;
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
180
|
+
this._x_ = false;
|
|
181
|
+
this.ak_ = undefined;
|
|
182
182
|
this.I_ = false;
|
|
183
|
-
this.
|
|
184
|
-
this.ak_ = false;
|
|
183
|
+
this._b_ = false;
|
|
185
184
|
this.al_ = false;
|
|
185
|
+
this.am_ = false;
|
|
186
186
|
this.B_ = undefined;
|
|
187
187
|
|
|
188
188
|
var ssrKeyedElements = keyedElementsByComponentId[id];
|
|
@@ -204,8 +204,8 @@ Component.prototype = componentProto = {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
var subscriptions =
|
|
207
|
-
this.
|
|
208
|
-
this.
|
|
207
|
+
this.ai_ || (
|
|
208
|
+
this.ai_ = new SubscriptionTracker());
|
|
209
209
|
|
|
210
210
|
var subscribeToOptions = target.x_ ?
|
|
211
211
|
COMPONENT_SUBSCRIBE_TO_OPTIONS :
|
|
@@ -215,7 +215,7 @@ Component.prototype = componentProto = {
|
|
|
215
215
|
},
|
|
216
216
|
|
|
217
217
|
emit: function (eventType) {
|
|
218
|
-
var customEvents = this.
|
|
218
|
+
var customEvents = this.W_;
|
|
219
219
|
var target;
|
|
220
220
|
|
|
221
221
|
if (customEvents && (target = customEvents[eventType])) {
|
|
@@ -304,16 +304,16 @@ Component.prototype = componentProto = {
|
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
var root = this.
|
|
307
|
+
var root = this._E_;
|
|
308
308
|
|
|
309
|
-
this.
|
|
309
|
+
this._N_();
|
|
310
310
|
|
|
311
311
|
var nodes = root.nodes;
|
|
312
312
|
|
|
313
313
|
nodes.forEach(function (node) {
|
|
314
314
|
destroyNodeRecursive(node);
|
|
315
315
|
|
|
316
|
-
if (eventDelegation.
|
|
316
|
+
if (eventDelegation.an_(node) !== false) {
|
|
317
317
|
node.parentNode.removeChild(node);
|
|
318
318
|
}
|
|
319
319
|
});
|
|
@@ -324,25 +324,25 @@ Component.prototype = componentProto = {
|
|
|
324
324
|
this.K_ = {};
|
|
325
325
|
},
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
_N_: function () {
|
|
328
328
|
if (this.I_) {
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
this.
|
|
332
|
+
this.ao_();
|
|
333
333
|
this.I_ = true;
|
|
334
334
|
|
|
335
|
-
componentsByDOMNode.set(this.
|
|
335
|
+
componentsByDOMNode.set(this._E_, undefined);
|
|
336
336
|
|
|
337
|
-
this.
|
|
337
|
+
this._E_ = null;
|
|
338
338
|
|
|
339
339
|
// Unsubscribe from all DOM events
|
|
340
|
-
this.
|
|
340
|
+
this._v_();
|
|
341
341
|
|
|
342
|
-
var subscriptions = this.
|
|
342
|
+
var subscriptions = this.ai_;
|
|
343
343
|
if (subscriptions) {
|
|
344
344
|
subscriptions.removeAllListeners();
|
|
345
|
-
this.
|
|
345
|
+
this.ai_ = null;
|
|
346
346
|
}
|
|
347
347
|
},
|
|
348
348
|
|
|
@@ -362,10 +362,10 @@ Component.prototype = componentProto = {
|
|
|
362
362
|
state = this.z_ = new this.P_(this);
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
state.
|
|
365
|
+
state.ap_(newState || {});
|
|
366
366
|
|
|
367
|
-
if (state.
|
|
368
|
-
this.
|
|
367
|
+
if (state.al_) {
|
|
368
|
+
this.aq_();
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
if (!newState) {
|
|
@@ -383,11 +383,11 @@ Component.prototype = componentProto = {
|
|
|
383
383
|
var newState = name;
|
|
384
384
|
for (var k in newState) {
|
|
385
385
|
if (hasOwnProperty.call(newState, k)) {
|
|
386
|
-
state.
|
|
386
|
+
state.ar_(k, newState[k], true /* ensure:true */);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
} else {
|
|
390
|
-
state.
|
|
390
|
+
state.ar_(name, value, true /* ensure:true */);
|
|
391
391
|
}
|
|
392
392
|
},
|
|
393
393
|
|
|
@@ -398,7 +398,7 @@ Component.prototype = componentProto = {
|
|
|
398
398
|
value = state[name];
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
state.
|
|
401
|
+
state.ar_(
|
|
402
402
|
name,
|
|
403
403
|
value,
|
|
404
404
|
true /* ensure:true */,
|
|
@@ -407,46 +407,46 @@ Component.prototype = componentProto = {
|
|
|
407
407
|
},
|
|
408
408
|
|
|
409
409
|
replaceState: function (newState) {
|
|
410
|
-
this.z_.
|
|
410
|
+
this.z_.ap_(newState);
|
|
411
411
|
},
|
|
412
412
|
|
|
413
413
|
get input() {
|
|
414
414
|
return this.O_;
|
|
415
415
|
},
|
|
416
416
|
set input(newInput) {
|
|
417
|
-
if (this.
|
|
417
|
+
if (this.am_) {
|
|
418
418
|
this.O_ = newInput;
|
|
419
419
|
} else {
|
|
420
|
-
this.
|
|
420
|
+
this._i_(newInput);
|
|
421
421
|
}
|
|
422
422
|
},
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
_i_: function (newInput, onInput, out) {
|
|
425
425
|
onInput = onInput || this.onInput;
|
|
426
426
|
var updatedInput;
|
|
427
427
|
|
|
428
428
|
var oldInput = this.O_;
|
|
429
429
|
this.O_ = undefined;
|
|
430
|
-
this.
|
|
430
|
+
this.as_ = out && out[CONTEXT_KEY] || this.as_;
|
|
431
431
|
|
|
432
432
|
if (onInput) {
|
|
433
433
|
// We need to set a flag to preview `this.input = foo` inside
|
|
434
434
|
// onInput causing infinite recursion
|
|
435
|
-
this.
|
|
435
|
+
this.am_ = true;
|
|
436
436
|
updatedInput = onInput.call(this, newInput || {}, out);
|
|
437
|
-
this.
|
|
437
|
+
this.am_ = false;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
newInput = this.
|
|
440
|
+
newInput = this.aj_ = updatedInput || newInput;
|
|
441
441
|
|
|
442
|
-
if (this.
|
|
443
|
-
this.
|
|
442
|
+
if (this.al_ = checkInputChanged(this, oldInput, newInput)) {
|
|
443
|
+
this.aq_();
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
if (this.O_ === undefined) {
|
|
447
447
|
this.O_ = newInput;
|
|
448
448
|
if (newInput && newInput.$global) {
|
|
449
|
-
this.
|
|
449
|
+
this.ak_ = newInput.$global;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -454,57 +454,57 @@ Component.prototype = componentProto = {
|
|
|
454
454
|
},
|
|
455
455
|
|
|
456
456
|
forceUpdate: function () {
|
|
457
|
-
this.
|
|
458
|
-
this.
|
|
457
|
+
this.al_ = true;
|
|
458
|
+
this.aq_();
|
|
459
459
|
},
|
|
460
460
|
|
|
461
|
-
|
|
462
|
-
if (!this.
|
|
463
|
-
this.
|
|
464
|
-
updateManager.
|
|
461
|
+
aq_: function () {
|
|
462
|
+
if (!this._b_) {
|
|
463
|
+
this._b_ = true;
|
|
464
|
+
updateManager.at_(this);
|
|
465
465
|
}
|
|
466
466
|
},
|
|
467
467
|
|
|
468
468
|
update: function () {
|
|
469
|
-
if (this.I_ === true || this.
|
|
469
|
+
if (this.I_ === true || this.au_ === false) {
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
var input = this.O_;
|
|
474
474
|
var state = this.z_;
|
|
475
475
|
|
|
476
|
-
if (this.
|
|
477
|
-
if (processUpdateHandlers(this, state.
|
|
478
|
-
state.
|
|
476
|
+
if (this.al_ === false && state !== null && state.al_ === true) {
|
|
477
|
+
if (processUpdateHandlers(this, state.av_, state.aw_, state)) {
|
|
478
|
+
state.al_ = false;
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
if (this.
|
|
482
|
+
if (this.au_ === true) {
|
|
483
483
|
// The UI component is still dirty after process state handlers
|
|
484
484
|
// then we should rerender
|
|
485
485
|
|
|
486
486
|
if (this.shouldUpdate(input, state) !== false) {
|
|
487
|
-
this.
|
|
487
|
+
this.ax_();
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
this.
|
|
491
|
+
this._t_();
|
|
492
492
|
},
|
|
493
493
|
|
|
494
|
-
get
|
|
494
|
+
get au_() {
|
|
495
495
|
return (
|
|
496
|
-
this.
|
|
497
|
-
this.z_ !== null && this.z_.
|
|
496
|
+
this.al_ === true ||
|
|
497
|
+
this.z_ !== null && this.z_.al_ === true);
|
|
498
498
|
|
|
499
499
|
},
|
|
500
500
|
|
|
501
|
-
|
|
502
|
-
this.
|
|
503
|
-
this.
|
|
504
|
-
this.
|
|
501
|
+
_t_: function () {
|
|
502
|
+
this.al_ = false;
|
|
503
|
+
this._b_ = false;
|
|
504
|
+
this.aj_ = null;
|
|
505
505
|
var state = this.z_;
|
|
506
506
|
if (state) {
|
|
507
|
-
state.
|
|
507
|
+
state._t_();
|
|
508
508
|
}
|
|
509
509
|
},
|
|
510
510
|
|
|
@@ -512,7 +512,8 @@ Component.prototype = componentProto = {
|
|
|
512
512
|
return true;
|
|
513
513
|
},
|
|
514
514
|
|
|
515
|
-
|
|
515
|
+
ax_: function () {
|
|
516
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
516
517
|
var self = this;
|
|
517
518
|
var renderer = self.Q_;
|
|
518
519
|
|
|
@@ -520,64 +521,64 @@ Component.prototype = componentProto = {
|
|
|
520
521
|
throw TypeError();
|
|
521
522
|
}
|
|
522
523
|
|
|
523
|
-
var input = this.
|
|
524
|
+
var input = this.aj_ || this.O_;
|
|
524
525
|
|
|
525
|
-
updateManager.
|
|
526
|
-
self.
|
|
526
|
+
updateManager.ay_(function () {
|
|
527
|
+
self._F_(input, false).afterInsert(self.B_);
|
|
527
528
|
});
|
|
528
529
|
|
|
529
|
-
this.
|
|
530
|
+
this._t_();
|
|
530
531
|
},
|
|
531
532
|
|
|
532
|
-
|
|
533
|
+
_F_: function (input, isHydrate) {
|
|
533
534
|
var host = this.B_;
|
|
534
|
-
var globalData = this.
|
|
535
|
-
var rootNode = this.
|
|
535
|
+
var globalData = this.ak_;
|
|
536
|
+
var rootNode = this._E_;
|
|
536
537
|
var renderer = this.Q_;
|
|
537
538
|
var createOut = renderer.createOut || defaultCreateOut;
|
|
538
539
|
var out = createOut(globalData);
|
|
539
540
|
out.sync();
|
|
540
541
|
out.B_ = this.B_;
|
|
541
|
-
out[CONTEXT_KEY] = this.
|
|
542
|
+
out[CONTEXT_KEY] = this.as_;
|
|
542
543
|
|
|
543
544
|
var componentsContext = getComponentsContext(out);
|
|
544
545
|
var globalComponentsContext = componentsContext.p_;
|
|
545
|
-
globalComponentsContext.
|
|
546
|
-
globalComponentsContext.
|
|
546
|
+
globalComponentsContext.az_ = this;
|
|
547
|
+
globalComponentsContext._Z_ = isHydrate;
|
|
547
548
|
|
|
548
549
|
renderer(input, out);
|
|
549
550
|
|
|
550
551
|
var result = new RenderResult(out);
|
|
551
552
|
|
|
552
|
-
var targetNode = out.
|
|
553
|
+
var targetNode = out.ah_().aA_;
|
|
553
554
|
|
|
554
555
|
morphdom(rootNode, targetNode, host, componentsContext);
|
|
555
556
|
|
|
556
557
|
return result;
|
|
557
558
|
},
|
|
558
559
|
|
|
559
|
-
|
|
560
|
-
var root = this.
|
|
560
|
+
aB_: function () {
|
|
561
|
+
var root = this._E_;
|
|
561
562
|
root.remove();
|
|
562
563
|
return root;
|
|
563
564
|
},
|
|
564
565
|
|
|
565
|
-
|
|
566
|
-
var eventListenerHandles = this.
|
|
566
|
+
_v_: function () {
|
|
567
|
+
var eventListenerHandles = this._w_;
|
|
567
568
|
if (eventListenerHandles) {
|
|
568
569
|
eventListenerHandles.forEach(removeListener);
|
|
569
|
-
this.
|
|
570
|
+
this._w_ = null;
|
|
570
571
|
}
|
|
571
572
|
},
|
|
572
573
|
|
|
573
|
-
get
|
|
574
|
+
get aC_() {
|
|
574
575
|
var state = this.z_;
|
|
575
576
|
return state && state.A_;
|
|
576
577
|
},
|
|
577
578
|
|
|
578
|
-
|
|
579
|
-
var finalCustomEvents = this.
|
|
580
|
-
this.
|
|
579
|
+
aD_: function (customEvents, scope) {
|
|
580
|
+
var finalCustomEvents = this.W_ = {};
|
|
581
|
+
this.X_ = scope;
|
|
581
582
|
|
|
582
583
|
customEvents.forEach(function (customEvent) {
|
|
583
584
|
var eventType = customEvent[0];
|
|
@@ -592,7 +593,7 @@ Component.prototype = componentProto = {
|
|
|
592
593
|
},
|
|
593
594
|
|
|
594
595
|
get el() {
|
|
595
|
-
return walkFragments(this.
|
|
596
|
+
return walkFragments(this._E_);
|
|
596
597
|
},
|
|
597
598
|
|
|
598
599
|
get els() {
|
|
@@ -602,43 +603,43 @@ Component.prototype = componentProto = {
|
|
|
602
603
|
|
|
603
604
|
|
|
604
605
|
|
|
605
|
-
return (this.
|
|
606
|
+
return (this._E_ ? this._E_.nodes : []).filter(
|
|
606
607
|
function (el) {
|
|
607
608
|
return el.nodeType === ELEMENT_NODE;
|
|
608
609
|
}
|
|
609
610
|
);
|
|
610
611
|
},
|
|
611
612
|
|
|
612
|
-
|
|
613
|
-
|
|
613
|
+
aE_: emit,
|
|
614
|
+
aF_(input, out) {
|
|
614
615
|
this.onCreate && this.onCreate(input, out);
|
|
615
|
-
this.
|
|
616
|
+
this.aE_("create", input, out);
|
|
616
617
|
},
|
|
617
618
|
|
|
618
|
-
|
|
619
|
+
aG_(out) {
|
|
619
620
|
this.onRender && this.onRender(out);
|
|
620
|
-
this.
|
|
621
|
+
this.aE_("render", out);
|
|
621
622
|
},
|
|
622
623
|
|
|
623
|
-
|
|
624
|
+
_y_() {
|
|
624
625
|
this.onUpdate && this.onUpdate();
|
|
625
|
-
this.
|
|
626
|
+
this.aE_("update");
|
|
626
627
|
},
|
|
627
628
|
|
|
628
|
-
|
|
629
|
+
_z_() {
|
|
629
630
|
this.onMount && this.onMount();
|
|
630
|
-
this.
|
|
631
|
+
this.aE_("mount");
|
|
631
632
|
},
|
|
632
633
|
|
|
633
|
-
|
|
634
|
+
ao_() {
|
|
634
635
|
this.onDestroy && this.onDestroy();
|
|
635
|
-
this.
|
|
636
|
+
this.aE_("destroy");
|
|
636
637
|
}
|
|
637
638
|
};
|
|
638
639
|
|
|
639
640
|
componentProto.elId = componentProto.getElId;
|
|
640
|
-
componentProto.
|
|
641
|
-
componentProto.
|
|
641
|
+
componentProto.aH_ = componentProto.update;
|
|
642
|
+
componentProto.aI_ = componentProto.destroy;
|
|
642
643
|
|
|
643
644
|
// Add all of the following DOM methods to Component.prototype:
|
|
644
645
|
// - appendTo(referenceEl)
|
|
@@ -650,7 +651,7 @@ componentProto.aH_ = componentProto.destroy;
|
|
|
650
651
|
domInsert(
|
|
651
652
|
componentProto,
|
|
652
653
|
function getEl(component) {
|
|
653
|
-
return component.
|
|
654
|
+
return component.aB_();
|
|
654
655
|
},
|
|
655
656
|
function afterInsert(component) {
|
|
656
657
|
return component;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
2
3
|
|
|
3
4
|
var extend = require("raptor-util/extend");
|
|
4
|
-
var w10Noop = require("warp10/constants").NOOP;
|
|
5
5
|
var componentUtil = require("@internal/components-util");
|
|
6
|
-
var
|
|
6
|
+
var w10NOOP = require("../helpers/serialize-noop").aJ_;
|
|
7
|
+
var attachBubblingEvent = componentUtil._T_;
|
|
7
8
|
var addDelegatedEventHandler =
|
|
8
|
-
require("./event-delegation").
|
|
9
|
+
require("./event-delegation")._s_;
|
|
9
10
|
var KeySequence = require("./KeySequence");
|
|
10
11
|
var EMPTY_OBJECT = {};
|
|
11
12
|
|
|
@@ -20,25 +21,25 @@ var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
|
|
20
21
|
* later (after the rendered HTML has been added to the DOM)
|
|
21
22
|
*/
|
|
22
23
|
function ComponentDef(component, componentId, componentsContext) {
|
|
23
|
-
this.
|
|
24
|
+
this.aK_ = componentsContext; // The AsyncWriter that this component is associated with
|
|
24
25
|
this.s_ = component;
|
|
25
26
|
this.id = componentId;
|
|
26
27
|
|
|
27
|
-
this.
|
|
28
|
+
this._c_ = undefined; // An array of DOM events that need to be added (in sets of three)
|
|
28
29
|
|
|
29
|
-
this.
|
|
30
|
+
this._u_ = false;
|
|
30
31
|
|
|
31
32
|
this.t_ = false;
|
|
32
33
|
this.u_ = 0;
|
|
33
34
|
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
35
|
+
this.aL_ = 0; // The unique integer to use for the next scoped ID
|
|
36
|
+
this.aM_ = null;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
ComponentDef.prototype = {
|
|
39
|
-
|
|
40
|
+
aN_: function (key) {
|
|
40
41
|
return (
|
|
41
|
-
this.
|
|
42
|
+
this.aM_ || (this.aM_ = new KeySequence())).aN_(
|
|
42
43
|
key);
|
|
43
44
|
},
|
|
44
45
|
|
|
@@ -72,8 +73,8 @@ ComponentDef.prototype = {
|
|
|
72
73
|
/**
|
|
73
74
|
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
|
|
74
75
|
*/
|
|
75
|
-
|
|
76
|
-
return this.id + "-c" + this.
|
|
76
|
+
aO_: function () {
|
|
77
|
+
return this.id + "-c" + this.aL_++;
|
|
77
78
|
},
|
|
78
79
|
|
|
79
80
|
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
|
|
@@ -81,14 +82,14 @@ ComponentDef.prototype = {
|
|
|
81
82
|
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
|
|
82
83
|
},
|
|
83
84
|
|
|
84
|
-
get
|
|
85
|
-
return this.s_.
|
|
85
|
+
get _q_() {
|
|
86
|
+
return this.s_._q_;
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
|
|
89
|
-
ComponentDef.prototype.nk = ComponentDef.prototype.
|
|
90
|
+
ComponentDef.prototype.nk = ComponentDef.prototype.aN_;
|
|
90
91
|
|
|
91
|
-
ComponentDef.
|
|
92
|
+
ComponentDef._D_ = function (o, types, global, registry) {
|
|
92
93
|
var id = o[0];
|
|
93
94
|
var typeName = types[o[1]];
|
|
94
95
|
var input = o[2] || null;
|
|
@@ -98,19 +99,20 @@ ComponentDef._C_ = function (o, types, global, registry) {
|
|
|
98
99
|
var componentProps = extra.w || EMPTY_OBJECT;
|
|
99
100
|
var flags = extra.f;
|
|
100
101
|
var isLegacy = flags & FLAG_IS_LEGACY;
|
|
101
|
-
var renderBody = flags & FLAG_HAS_RENDER_BODY ?
|
|
102
|
+
var renderBody = flags & FLAG_HAS_RENDER_BODY ? w10NOOP : extra.r;
|
|
102
103
|
|
|
103
104
|
var component =
|
|
104
105
|
typeName /* legacy */ &&
|
|
105
|
-
registry.
|
|
106
|
+
registry._G_(typeName, id, isLegacy);
|
|
106
107
|
|
|
107
108
|
// Prevent newly created component from being queued for update since we area
|
|
108
109
|
// just building it from the server info
|
|
109
|
-
component.
|
|
110
|
+
component._b_ = true;
|
|
111
|
+
component.ak_ = global;
|
|
110
112
|
|
|
111
113
|
if (isLegacy) {
|
|
112
114
|
component.widgetConfig = componentProps;
|
|
113
|
-
component.
|
|
115
|
+
component.Z_ = renderBody;
|
|
114
116
|
} else if (renderBody) {
|
|
115
117
|
(input || (input = {})).renderBody = renderBody;
|
|
116
118
|
}
|
|
@@ -147,21 +149,19 @@ ComponentDef._C_ = function (o, types, global, registry) {
|
|
|
147
149
|
component.O_ = input;
|
|
148
150
|
|
|
149
151
|
if (extra.b) {
|
|
150
|
-
component.
|
|
152
|
+
component.Y_ = extra.b;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
var scope = extra.p;
|
|
154
156
|
var customEvents = extra.e;
|
|
155
157
|
if (customEvents) {
|
|
156
|
-
component.
|
|
158
|
+
component.aD_(customEvents, scope);
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
component.aj_ = global;
|
|
160
|
-
|
|
161
161
|
return {
|
|
162
162
|
id: id,
|
|
163
163
|
s_: component,
|
|
164
|
-
|
|
164
|
+
_c_: extra.d,
|
|
165
165
|
u_: extra.f || 0
|
|
166
166
|
};
|
|
167
167
|
};
|
|
@@ -11,9 +11,9 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
|
11
11
|
|
|
12
12
|
var nestedContextsForParent;
|
|
13
13
|
if (
|
|
14
|
-
!(nestedContextsForParent = parentComponentsContext.
|
|
14
|
+
!(nestedContextsForParent = parentComponentsContext._d_))
|
|
15
15
|
{
|
|
16
|
-
nestedContextsForParent = parentComponentsContext.
|
|
16
|
+
nestedContextsForParent = parentComponentsContext._d_ = [];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
nestedContextsForParent.push(this);
|
|
@@ -29,18 +29,18 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
|
29
29
|
this.b_ = [];
|
|
30
30
|
this.r_ = out;
|
|
31
31
|
this.o_ = componentDef;
|
|
32
|
-
this.
|
|
32
|
+
this._d_ = undefined;
|
|
33
33
|
this.v_ =
|
|
34
34
|
parentComponentsContext && parentComponentsContext.v_;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
ComponentsContext.prototype = {
|
|
38
|
-
|
|
38
|
+
af_: function (host) {
|
|
39
39
|
var componentDefs = this.b_;
|
|
40
40
|
|
|
41
|
-
ComponentsContext.
|
|
41
|
+
ComponentsContext._I_(componentDefs, host);
|
|
42
42
|
|
|
43
|
-
this.r_.emit("
|
|
43
|
+
this.r_.emit("aP_");
|
|
44
44
|
|
|
45
45
|
// Reset things stored in global since global is retained for
|
|
46
46
|
// future renders
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";var nextComponentIdProvider =
|
|
2
|
-
require("@internal/components-util").
|
|
2
|
+
require("@internal/components-util")._S_;
|
|
3
3
|
|
|
4
4
|
function GlobalComponentsContext(out) {
|
|
5
5
|
this.q_ = {};
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
6
|
+
this.az_ = undefined;
|
|
7
|
+
this.aO_ = nextComponentIdProvider(out);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = GlobalComponentsContext;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";function KeySequence() {
|
|
2
|
-
this.
|
|
2
|
+
this.aQ_ = Object.create(null);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
KeySequence.prototype.
|
|
6
|
-
var lookup = this.
|
|
5
|
+
KeySequence.prototype.aN_ = function (key) {
|
|
6
|
+
var lookup = this.aQ_;
|
|
7
7
|
|
|
8
8
|
if (lookup[key]) {
|
|
9
9
|
return key + "_" + lookup[key]++;
|