marko 5.21.2 → 5.21.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -6
- package/bin/markoc.js +13 -1
- package/dist/core-tags/core/await/reorderer-renderer.js +26 -6
- package/dist/runtime/RenderResult.js +7 -7
- package/dist/runtime/components/Component.js +129 -129
- package/dist/runtime/components/ComponentDef.js +25 -25
- package/dist/runtime/components/ComponentsContext.js +8 -8
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +25 -25
- package/dist/runtime/components/attach-detach.js +8 -8
- package/dist/runtime/components/beginComponent/index-browser.js +2 -2
- package/dist/runtime/components/beginComponent/index.js +7 -7
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +3 -3
- package/dist/runtime/components/endComponent/index.js +2 -2
- package/dist/runtime/components/entry/index-browser.js +4 -4
- package/dist/runtime/components/entry/index.js +15 -15
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/init-components/index-browser.js +34 -34
- package/dist/runtime/components/registry/index-browser.js +7 -7
- package/dist/runtime/components/registry/index.js +2 -2
- package/dist/runtime/components/renderer.js +26 -26
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/components/util/index-browser.js +17 -17
- package/dist/runtime/components/util/index.js +9 -9
- 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 -7
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/html/AsyncStream.js +20 -20
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/StringWriter.js +1 -1
- package/dist/runtime/html/helpers/attr.js +1 -1
- package/dist/runtime/html/helpers/data-marko.js +4 -4
- 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/props-script.js +1 -1
- package/dist/runtime/html/index.js +1 -1
- package/dist/runtime/renderable.js +4 -4
- package/dist/runtime/setImmediate/index-browser.js +1 -1
- package/dist/runtime/setImmediate/index-worker.js +2 -2
- package/dist/runtime/setImmediate/index.js +2 -2
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +28 -28
- package/dist/runtime/vdom/VDocumentFragment.js +1 -1
- package/dist/runtime/vdom/VElement.js +11 -11
- package/dist/runtime/vdom/VFragment.js +3 -3
- package/dist/runtime/vdom/VNode.js +4 -4
- package/dist/runtime/vdom/hot-reload.js +15 -15
- package/dist/runtime/vdom/index.js +1 -1
- package/dist/runtime/vdom/morphdom/fragment.js +2 -2
- package/dist/runtime/vdom/morphdom/helpers.js +4 -4
- package/dist/runtime/vdom/morphdom/index.js +28 -28
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/docs/10-awesome-marko-features.md +3 -4
- package/docs/class-components.md +5 -5
- package/docs/cloudflare-workers.md +4 -6
- package/docs/compiler.md +13 -2
- package/docs/core-tags.md +9 -1
- package/docs/express.md +2 -2
- package/docs/http.md +2 -2
- package/docs/koa.md +2 -2
- package/docs/marko-5-upgrade.md +3 -4
- package/docs/marko-vs-react.md +7 -7
- package/docs/redux.md +6 -6
- package/docs/rendering.md +48 -41
- package/docs/troubleshooting-streaming.md +5 -5
- package/docs/webpack.md +9 -9
- package/package.json +3 -3
- package/src/core-tags/core/await/reorderer-renderer.js +27 -7
- package/docs/server-side-rendering.md +0 -144
@@ -8,8 +8,8 @@ var defaultCreateOut = require("../createOut");
|
|
8
8
|
var getComponentsContext =
|
9
9
|
require("./ComponentsContext").o_;
|
10
10
|
var componentsUtil = require("./util");
|
11
|
-
var componentLookup = componentsUtil.
|
12
|
-
var destroyNodeRecursive = componentsUtil.
|
11
|
+
var componentLookup = componentsUtil.D_;
|
12
|
+
var destroyNodeRecursive = componentsUtil.E_;
|
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.F_;
|
22
|
+
var keyedElementsByComponentId = domData.G_;
|
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.H_];
|
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.H_();
|
132
131
|
component.I_();
|
132
|
+
component.J_();
|
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
172
|
this.K_ = null;
|
174
173
|
this.L_ = null;
|
175
174
|
this.M_ = null;
|
176
|
-
this.N_ = null;
|
177
|
-
this.O_ = null;
|
178
|
-
this.G_ = null;
|
175
|
+
this.N_ = null;
|
176
|
+
this.O_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
179
177
|
this.P_ = null;
|
180
|
-
this.
|
181
|
-
this.
|
182
|
-
this.
|
183
|
-
this.
|
178
|
+
this.H_ = null;
|
179
|
+
this.Q_ = null;
|
180
|
+
this.R_ = undefined;
|
181
|
+
this.S_ = false;
|
182
|
+
this.T_ = undefined;
|
184
183
|
this.U_ = false;
|
185
184
|
this.V_ = false;
|
186
185
|
this.W_ = false;
|
187
|
-
this.X_ =
|
186
|
+
this.X_ = false;
|
187
|
+
this.Y_ = 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
|
+
Z_: 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.M_ || (
|
209
|
+
this.M_ = new SubscriptionTracker());
|
210
210
|
|
211
|
-
var subscribeToOptions = target.
|
211
|
+
var subscribeToOptions = target.Z_ ?
|
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.P_;
|
220
220
|
var target;
|
221
221
|
|
222
222
|
if (customEvents && (target = customEvents[eventType])) {
|
@@ -303,20 +303,20 @@ Component.prototype = componentProto = {
|
|
303
303
|
[];
|
304
304
|
},
|
305
305
|
destroy: function () {
|
306
|
-
if (this.
|
306
|
+
if (this.U_) {
|
307
307
|
return;
|
308
308
|
}
|
309
309
|
|
310
|
-
var root = this.
|
310
|
+
var root = this.L_;
|
311
311
|
|
312
|
-
this.
|
312
|
+
this.___();
|
313
313
|
|
314
314
|
var nodes = root.nodes;
|
315
315
|
|
316
316
|
nodes.forEach(function (node) {
|
317
317
|
destroyNodeRecursive(node);
|
318
318
|
|
319
|
-
if (eventDelegation.
|
319
|
+
if (eventDelegation._a_(node) !== false) {
|
320
320
|
node.parentNode.removeChild(node);
|
321
321
|
}
|
322
322
|
});
|
@@ -327,81 +327,81 @@ Component.prototype = componentProto = {
|
|
327
327
|
this.k_ = {};
|
328
328
|
},
|
329
329
|
|
330
|
-
|
331
|
-
if (this.
|
330
|
+
___: function () {
|
331
|
+
if (this.U_) {
|
332
332
|
return;
|
333
333
|
}
|
334
334
|
|
335
|
-
this.
|
336
|
-
this.
|
335
|
+
this._b_();
|
336
|
+
this.U_ = true;
|
337
337
|
|
338
|
-
componentsByDOMNode.set(this.
|
338
|
+
componentsByDOMNode.set(this.L_, undefined);
|
339
339
|
|
340
|
-
this.
|
340
|
+
this.L_ = null;
|
341
341
|
|
342
342
|
// Unsubscribe from all DOM events
|
343
|
-
this.
|
343
|
+
this._c_();
|
344
344
|
|
345
|
-
var subscriptions = this.
|
345
|
+
var subscriptions = this.M_;
|
346
346
|
if (subscriptions) {
|
347
347
|
subscriptions.removeAllListeners();
|
348
|
-
this.
|
348
|
+
this.M_ = null;
|
349
349
|
}
|
350
350
|
},
|
351
351
|
|
352
352
|
isDestroyed: function () {
|
353
|
-
return this.
|
353
|
+
return this.U_;
|
354
354
|
},
|
355
355
|
get state() {
|
356
|
-
return this.
|
356
|
+
return this.K_;
|
357
357
|
},
|
358
358
|
set state(newState) {
|
359
|
-
var state = this.
|
359
|
+
var state = this.K_;
|
360
360
|
if (!state && !newState) {
|
361
361
|
return;
|
362
362
|
}
|
363
363
|
|
364
364
|
if (!state) {
|
365
|
-
state = this.
|
365
|
+
state = this.K_ = new this._d_(this);
|
366
366
|
}
|
367
367
|
|
368
|
-
state.
|
368
|
+
state._e_(newState || {});
|
369
369
|
|
370
|
-
if (state.
|
371
|
-
this.
|
370
|
+
if (state.W_) {
|
371
|
+
this._f_();
|
372
372
|
}
|
373
373
|
|
374
374
|
if (!newState) {
|
375
|
-
this.
|
375
|
+
this.K_ = null;
|
376
376
|
}
|
377
377
|
},
|
378
378
|
setState: function (name, value) {
|
379
|
-
var state = this.
|
379
|
+
var state = this.K_;
|
380
380
|
|
381
381
|
if (!state) {
|
382
|
-
state = this.
|
382
|
+
state = this.K_ = new this._d_(this);
|
383
383
|
}
|
384
384
|
if (typeof name == "object") {
|
385
385
|
// Merge in the new state with the old state
|
386
386
|
var newState = name;
|
387
387
|
for (var k in newState) {
|
388
388
|
if (hasOwnProperty.call(newState, k)) {
|
389
|
-
state.
|
389
|
+
state._g_(k, newState[k], true /* ensure:true */);
|
390
390
|
}
|
391
391
|
}
|
392
392
|
} else {
|
393
|
-
state.
|
393
|
+
state._g_(name, value, true /* ensure:true */);
|
394
394
|
}
|
395
395
|
},
|
396
396
|
|
397
397
|
setStateDirty: function (name, value) {
|
398
|
-
var state = this.
|
398
|
+
var state = this.K_;
|
399
399
|
|
400
400
|
if (arguments.length == 1) {
|
401
401
|
value = state[name];
|
402
402
|
}
|
403
403
|
|
404
|
-
state.
|
404
|
+
state._g_(
|
405
405
|
name,
|
406
406
|
value,
|
407
407
|
true /* ensure:true */,
|
@@ -410,46 +410,46 @@ Component.prototype = componentProto = {
|
|
410
410
|
},
|
411
411
|
|
412
412
|
replaceState: function (newState) {
|
413
|
-
this.
|
413
|
+
this.K_._e_(newState);
|
414
414
|
},
|
415
415
|
|
416
416
|
get input() {
|
417
|
-
return this.
|
417
|
+
return this.R_;
|
418
418
|
},
|
419
419
|
set input(newInput) {
|
420
|
-
if (this.
|
421
|
-
this.
|
420
|
+
if (this.X_) {
|
421
|
+
this.R_ = newInput;
|
422
422
|
} else {
|
423
|
-
this.
|
423
|
+
this._h_(newInput);
|
424
424
|
}
|
425
425
|
},
|
426
426
|
|
427
|
-
|
427
|
+
_h_: function (newInput, onInput, out) {
|
428
428
|
onInput = onInput || this.onInput;
|
429
429
|
var updatedInput;
|
430
430
|
|
431
|
-
var oldInput = this.
|
432
|
-
this.
|
433
|
-
this.
|
431
|
+
var oldInput = this.R_;
|
432
|
+
this.R_ = undefined;
|
433
|
+
this._i_ = out && out[CONTEXT_KEY] || this._i_;
|
434
434
|
|
435
435
|
if (onInput) {
|
436
436
|
// We need to set a flag to preview `this.input = foo` inside
|
437
437
|
// onInput causing infinite recursion
|
438
|
-
this.
|
438
|
+
this.X_ = true;
|
439
439
|
updatedInput = onInput.call(this, newInput || {}, out);
|
440
|
-
this.
|
440
|
+
this.X_ = false;
|
441
441
|
}
|
442
442
|
|
443
|
-
newInput = this.
|
443
|
+
newInput = this.Q_ = updatedInput || newInput;
|
444
444
|
|
445
|
-
if (this.
|
446
|
-
this.
|
445
|
+
if (this.W_ = checkInputChanged(this, oldInput, newInput)) {
|
446
|
+
this._f_();
|
447
447
|
}
|
448
448
|
|
449
|
-
if (this.
|
450
|
-
this.
|
449
|
+
if (this.R_ === undefined) {
|
450
|
+
this.R_ = newInput;
|
451
451
|
if (newInput && newInput.$global) {
|
452
|
-
this.
|
452
|
+
this.T_ = newInput.$global;
|
453
453
|
}
|
454
454
|
}
|
455
455
|
|
@@ -457,57 +457,57 @@ Component.prototype = componentProto = {
|
|
457
457
|
},
|
458
458
|
|
459
459
|
forceUpdate: function () {
|
460
|
-
this.
|
461
|
-
this.
|
460
|
+
this.W_ = true;
|
461
|
+
this._f_();
|
462
462
|
},
|
463
463
|
|
464
|
-
|
465
|
-
if (!this.
|
466
|
-
this.
|
467
|
-
updateManager.
|
464
|
+
_f_: function () {
|
465
|
+
if (!this.V_) {
|
466
|
+
this.V_ = true;
|
467
|
+
updateManager._j_(this);
|
468
468
|
}
|
469
469
|
},
|
470
470
|
|
471
471
|
update: function () {
|
472
|
-
if (this.
|
472
|
+
if (this.U_ === true || this._k_ === false) {
|
473
473
|
return;
|
474
474
|
}
|
475
475
|
|
476
|
-
var input = this.
|
477
|
-
var state = this.
|
476
|
+
var input = this.R_;
|
477
|
+
var state = this.K_;
|
478
478
|
|
479
|
-
if (this.
|
480
|
-
if (processUpdateHandlers(this, state.
|
481
|
-
state.
|
479
|
+
if (this.W_ === false && state !== null && state.W_ === true) {
|
480
|
+
if (processUpdateHandlers(this, state._l_, state._m_, state)) {
|
481
|
+
state.W_ = false;
|
482
482
|
}
|
483
483
|
}
|
484
484
|
|
485
|
-
if (this.
|
485
|
+
if (this._k_ === true) {
|
486
486
|
// The UI component is still dirty after process state handlers
|
487
487
|
// then we should rerender
|
488
488
|
|
489
489
|
if (this.shouldUpdate(input, state) !== false) {
|
490
|
-
this.
|
490
|
+
this._n_();
|
491
491
|
}
|
492
492
|
}
|
493
493
|
|
494
|
-
this.
|
494
|
+
this.J_();
|
495
495
|
},
|
496
496
|
|
497
|
-
get
|
497
|
+
get _k_() {
|
498
498
|
return (
|
499
|
-
this.
|
500
|
-
this.
|
499
|
+
this.W_ === true ||
|
500
|
+
this.K_ !== null && this.K_.W_ === true);
|
501
501
|
|
502
502
|
},
|
503
503
|
|
504
|
-
|
504
|
+
J_: function () {
|
505
|
+
this.W_ = false;
|
505
506
|
this.V_ = false;
|
506
|
-
this.
|
507
|
-
|
508
|
-
var state = this.J_;
|
507
|
+
this.Q_ = null;
|
508
|
+
var state = this.K_;
|
509
509
|
if (state) {
|
510
|
-
state.
|
510
|
+
state.J_();
|
511
511
|
}
|
512
512
|
},
|
513
513
|
|
@@ -515,72 +515,72 @@ Component.prototype = componentProto = {
|
|
515
515
|
return true;
|
516
516
|
},
|
517
517
|
|
518
|
-
|
518
|
+
_n_: function () {
|
519
519
|
var self = this;
|
520
|
-
var renderer = self.
|
520
|
+
var renderer = self._o_;
|
521
521
|
|
522
522
|
if (!renderer) {
|
523
523
|
throw TypeError();
|
524
524
|
}
|
525
525
|
|
526
|
-
var input = this.
|
526
|
+
var input = this.Q_ || this.R_;
|
527
527
|
|
528
|
-
updateManager.
|
529
|
-
self.
|
528
|
+
updateManager._p_(function () {
|
529
|
+
self._q_(input, false).afterInsert(self.Y_);
|
530
530
|
});
|
531
531
|
|
532
|
-
this.
|
532
|
+
this.J_();
|
533
533
|
},
|
534
534
|
|
535
|
-
|
536
|
-
var host = this.
|
537
|
-
var globalData = this.
|
538
|
-
var rootNode = this.
|
539
|
-
var renderer = this.
|
535
|
+
_q_: function (input, isHydrate) {
|
536
|
+
var host = this.Y_;
|
537
|
+
var globalData = this.T_;
|
538
|
+
var rootNode = this.L_;
|
539
|
+
var renderer = this._o_;
|
540
540
|
var createOut = renderer.createOut || defaultCreateOut;
|
541
541
|
var out = createOut(globalData);
|
542
542
|
out.sync();
|
543
|
-
out.
|
544
|
-
out[CONTEXT_KEY] = this.
|
543
|
+
out.Y_ = this.Y_;
|
544
|
+
out[CONTEXT_KEY] = this._i_;
|
545
545
|
|
546
546
|
var componentsContext = getComponentsContext(out);
|
547
547
|
var globalComponentsContext = componentsContext.e_;
|
548
|
-
globalComponentsContext.
|
548
|
+
globalComponentsContext._r_ = this;
|
549
549
|
globalComponentsContext.f_ = isHydrate;
|
550
550
|
|
551
551
|
renderer(input, out);
|
552
552
|
|
553
553
|
var result = new RenderResult(out);
|
554
554
|
|
555
|
-
var targetNode = out.
|
555
|
+
var targetNode = out.C_()._s_;
|
556
556
|
|
557
557
|
morphdom(rootNode, targetNode, host, componentsContext);
|
558
558
|
|
559
559
|
return result;
|
560
560
|
},
|
561
561
|
|
562
|
-
|
563
|
-
var root = this.
|
562
|
+
_t_: function () {
|
563
|
+
var root = this.L_;
|
564
564
|
root.remove();
|
565
565
|
return root;
|
566
566
|
},
|
567
567
|
|
568
|
-
|
569
|
-
var eventListenerHandles = this.
|
568
|
+
_c_: function () {
|
569
|
+
var eventListenerHandles = this.N_;
|
570
570
|
if (eventListenerHandles) {
|
571
571
|
eventListenerHandles.forEach(removeListener);
|
572
|
-
this.
|
572
|
+
this.N_ = null;
|
573
573
|
}
|
574
574
|
},
|
575
575
|
|
576
|
-
get
|
577
|
-
var state = this.
|
578
|
-
return state && state.
|
576
|
+
get _u_() {
|
577
|
+
var state = this.K_;
|
578
|
+
return state && state._v_;
|
579
579
|
},
|
580
580
|
|
581
|
-
|
582
|
-
var finalCustomEvents = this.
|
583
|
-
this.
|
581
|
+
_w_: function (customEvents, scope) {
|
582
|
+
var finalCustomEvents = this.P_ = {};
|
583
|
+
this.H_ = scope;
|
584
584
|
|
585
585
|
customEvents.forEach(function (customEvent) {
|
586
586
|
var eventType = customEvent[0];
|
@@ -595,7 +595,7 @@ Component.prototype = componentProto = {
|
|
595
595
|
},
|
596
596
|
|
597
597
|
get el() {
|
598
|
-
return walkFragments(this.
|
598
|
+
return walkFragments(this.L_);
|
599
599
|
},
|
600
600
|
|
601
601
|
get els() {
|
@@ -605,43 +605,43 @@ Component.prototype = componentProto = {
|
|
605
605
|
|
606
606
|
|
607
607
|
|
608
|
-
return (this.
|
608
|
+
return (this.L_ ? this.L_.nodes : []).filter(function (
|
609
609
|
el)
|
610
610
|
{
|
611
611
|
return el.nodeType === ELEMENT_NODE;
|
612
612
|
});
|
613
613
|
},
|
614
614
|
|
615
|
-
|
616
|
-
|
615
|
+
_x_: emit,
|
616
|
+
_y_(input, out) {
|
617
617
|
this.onCreate && this.onCreate(input, out);
|
618
|
-
this.
|
618
|
+
this._x_("create", input, out);
|
619
619
|
},
|
620
620
|
|
621
|
-
|
621
|
+
_z_(out) {
|
622
622
|
this.onRender && this.onRender(out);
|
623
|
-
this.
|
623
|
+
this._x_("render", out);
|
624
624
|
},
|
625
625
|
|
626
|
-
|
626
|
+
I_() {
|
627
627
|
this.onUpdate && this.onUpdate();
|
628
|
-
this.
|
628
|
+
this._x_("update");
|
629
629
|
},
|
630
630
|
|
631
|
-
|
631
|
+
_A_() {
|
632
632
|
this.onMount && this.onMount();
|
633
|
-
this.
|
633
|
+
this._x_("mount");
|
634
634
|
},
|
635
635
|
|
636
|
-
|
636
|
+
_b_() {
|
637
637
|
this.onDestroy && this.onDestroy();
|
638
|
-
this.
|
638
|
+
this._x_("destroy");
|
639
639
|
} };
|
640
640
|
|
641
641
|
|
642
642
|
componentProto.elId = componentProto.getElId;
|
643
|
-
componentProto.
|
644
|
-
componentProto.
|
643
|
+
componentProto._B_ = componentProto.update;
|
644
|
+
componentProto._C_ = componentProto.destroy;
|
645
645
|
|
646
646
|
// Add all of the following DOM methods to Component.prototype:
|
647
647
|
// - appendTo(referenceEl)
|
@@ -653,7 +653,7 @@ componentProto._B_ = componentProto.destroy;
|
|
653
653
|
domInsert(
|
654
654
|
componentProto,
|
655
655
|
function getEl(component) {
|
656
|
-
return component.
|
656
|
+
return component._t_();
|
657
657
|
},
|
658
658
|
function afterInsert(component) {
|
659
659
|
return component;
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
var w10Noop = require("warp10/constants").NOOP;
|
4
4
|
var componentUtil = require("./util");
|
5
|
-
var attachBubblingEvent = componentUtil.
|
5
|
+
var attachBubblingEvent = componentUtil._D_;
|
6
6
|
var addDelegatedEventHandler =
|
7
|
-
require("./event-delegation").
|
7
|
+
require("./event-delegation")._E_;
|
8
8
|
var extend = require("raptor-util/extend");
|
9
9
|
var KeySequence = require("./KeySequence");
|
10
10
|
var EMPTY_OBJECT = {};
|
@@ -18,25 +18,25 @@ var FLAG_HAS_RENDER_BODY = 2;
|
|
18
18
|
* later (after the rendered HTML has been added to the DOM)
|
19
19
|
*/
|
20
20
|
function ComponentDef(component, componentId, componentsContext) {
|
21
|
-
this.
|
21
|
+
this._F_ = componentsContext; // The AsyncWriter that this component is associated with
|
22
22
|
this.h_ = component;
|
23
23
|
this.id = componentId;
|
24
24
|
|
25
|
-
this.
|
26
|
-
|
27
|
-
this._G_ = false;
|
25
|
+
this._G_ = undefined; // An array of DOM events that need to be added (in sets of three)
|
28
26
|
|
29
27
|
this._H_ = false;
|
30
|
-
this._I_ = 0;
|
31
28
|
|
32
|
-
this.
|
33
|
-
this.
|
29
|
+
this._I_ = false;
|
30
|
+
this._J_ = 0;
|
31
|
+
|
32
|
+
this._K_ = 0; // The unique integer to use for the next scoped ID
|
33
|
+
this._L_ = null;
|
34
34
|
}
|
35
35
|
|
36
36
|
ComponentDef.prototype = {
|
37
|
-
|
37
|
+
_M_: function (key) {
|
38
38
|
return (
|
39
|
-
this.
|
39
|
+
this._L_ || (this._L_ = new KeySequence()))._M_(
|
40
40
|
key);
|
41
41
|
},
|
42
42
|
|
@@ -70,8 +70,8 @@ ComponentDef.prototype = {
|
|
70
70
|
/**
|
71
71
|
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
|
72
72
|
*/
|
73
|
-
|
74
|
-
return this.id + "-c" + this.
|
73
|
+
_N_: function () {
|
74
|
+
return this.id + "-c" + this._K_++;
|
75
75
|
},
|
76
76
|
|
77
77
|
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
|
@@ -79,14 +79,14 @@ ComponentDef.prototype = {
|
|
79
79
|
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
|
80
80
|
},
|
81
81
|
|
82
|
-
get
|
83
|
-
return this.h_.
|
82
|
+
get _O_() {
|
83
|
+
return this.h_._O_;
|
84
84
|
} };
|
85
85
|
|
86
86
|
|
87
|
-
ComponentDef.prototype.nk = ComponentDef.prototype.
|
87
|
+
ComponentDef.prototype.nk = ComponentDef.prototype._M_;
|
88
88
|
|
89
|
-
ComponentDef.
|
89
|
+
ComponentDef._P_ = function (o, types, global, registry) {
|
90
90
|
var id = o[0];
|
91
91
|
var typeName = types[o[1]];
|
92
92
|
var input = o[2] || null;
|
@@ -95,11 +95,11 @@ ComponentDef._O_ = function (o, types, global, registry) {
|
|
95
95
|
var state = extra.s;
|
96
96
|
var componentProps = extra.w;
|
97
97
|
var flags = extra.f;
|
98
|
-
var component = registry.
|
98
|
+
var component = registry._Q_(typeName, id);
|
99
99
|
|
100
100
|
// Prevent newly created component from being queued for update since we area
|
101
101
|
// just building it from the server info
|
102
|
-
component.
|
102
|
+
component.V_ = true;
|
103
103
|
|
104
104
|
if (flags & FLAG_HAS_RENDER_BODY) {
|
105
105
|
(input || (input = {})).renderBody = w10Noop;
|
@@ -130,25 +130,25 @@ ComponentDef._O_ = function (o, types, global, registry) {
|
|
130
130
|
}
|
131
131
|
}
|
132
132
|
|
133
|
-
component.
|
133
|
+
component.R_ = input;
|
134
134
|
|
135
135
|
if (extra.b) {
|
136
|
-
component.
|
136
|
+
component.O_ = extra.b;
|
137
137
|
}
|
138
138
|
|
139
139
|
var scope = extra.p;
|
140
140
|
var customEvents = extra.e;
|
141
141
|
if (customEvents) {
|
142
|
-
component.
|
142
|
+
component._w_(customEvents, scope);
|
143
143
|
}
|
144
144
|
|
145
|
-
component.
|
145
|
+
component.T_ = global;
|
146
146
|
|
147
147
|
return {
|
148
148
|
id: id,
|
149
149
|
h_: component,
|
150
|
-
|
151
|
-
|
150
|
+
_G_: extra.d,
|
151
|
+
_J_: extra.f || 0 };
|
152
152
|
|
153
153
|
};
|
154
154
|
|