lwc 2.9.0 → 2.10.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/dist/engine-dom/esm/es2017/engine-dom.js +603 -449
- package/dist/engine-dom/iife/es2017/engine-dom.js +603 -449
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +477 -398
- package/dist/engine-dom/iife/es5/engine-dom.js +657 -479
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +509 -425
- package/dist/engine-dom/umd/es2017/engine-dom.js +603 -449
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +477 -398
- package/dist/engine-dom/umd/es5/engine-dom.js +657 -479
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +509 -425
- package/dist/engine-server/commonjs/es2017/engine-server.js +391 -285
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +391 -285
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -10,14 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
12
12
|
|
|
13
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
-
|
|
15
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
|
|
17
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
-
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
|
|
21
13
|
function _get2() { if (typeof Reflect !== "undefined" && Reflect.get) { _get2 = Reflect.get; } else { _get2 = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get2.apply(this, arguments); }
|
|
22
14
|
|
|
23
15
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
|
|
@@ -44,6 +36,14 @@
|
|
|
44
36
|
|
|
45
37
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
46
38
|
|
|
39
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
40
|
+
|
|
41
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
42
|
+
|
|
43
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
44
|
+
|
|
45
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
46
|
+
|
|
47
47
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
48
48
|
|
|
49
49
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -355,7 +355,17 @@
|
|
|
355
355
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
356
356
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
357
357
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
358
|
-
|
|
358
|
+
/*
|
|
359
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
360
|
+
* All rights reserved.
|
|
361
|
+
* SPDX-License-Identifier: MIT
|
|
362
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
363
|
+
*/
|
|
364
|
+
// Increment whenever the LWC template compiler changes
|
|
365
|
+
|
|
366
|
+
var LWC_VERSION = "2.10.0";
|
|
367
|
+
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
368
|
+
/** version: 2.10.0 */
|
|
359
369
|
|
|
360
370
|
/*
|
|
361
371
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -420,7 +430,7 @@
|
|
|
420
430
|
};
|
|
421
431
|
}
|
|
422
432
|
|
|
423
|
-
function patch(propName) {
|
|
433
|
+
function patch$1(propName) {
|
|
424
434
|
// Typescript is inferring the wrong function type for this particular
|
|
425
435
|
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
426
436
|
// @ts-ignore type-mismatch
|
|
@@ -442,7 +452,7 @@
|
|
|
442
452
|
var propName = ElementPrototypeAriaPropertyNames[_i2];
|
|
443
453
|
|
|
444
454
|
if (detect(propName)) {
|
|
445
|
-
patch(propName);
|
|
455
|
+
patch$1(propName);
|
|
446
456
|
}
|
|
447
457
|
}
|
|
448
458
|
/**
|
|
@@ -458,14 +468,15 @@
|
|
|
458
468
|
|
|
459
469
|
|
|
460
470
|
var features = {
|
|
461
|
-
|
|
462
|
-
ENABLE_HMR: null,
|
|
463
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
471
|
+
DISABLE_MIXED_SHADOW_MODE: null,
|
|
464
472
|
ENABLE_ELEMENT_PATCH: null,
|
|
465
473
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
466
|
-
|
|
474
|
+
ENABLE_HMR: null,
|
|
467
475
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
476
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
477
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
468
478
|
ENABLE_NODE_PATCH: null,
|
|
479
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
469
480
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
470
481
|
};
|
|
471
482
|
|
|
@@ -532,7 +543,7 @@
|
|
|
532
543
|
setFeatureFlag(name, value);
|
|
533
544
|
}
|
|
534
545
|
}
|
|
535
|
-
/** version: 2.
|
|
546
|
+
/** version: 2.10.0 */
|
|
536
547
|
|
|
537
548
|
/* proxy-compat-disable */
|
|
538
549
|
|
|
@@ -635,6 +646,31 @@
|
|
|
635
646
|
}
|
|
636
647
|
|
|
637
648
|
return result;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function flattenStylesheets(stylesheets) {
|
|
652
|
+
var list = [];
|
|
653
|
+
|
|
654
|
+
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
655
|
+
_step2;
|
|
656
|
+
|
|
657
|
+
try {
|
|
658
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
659
|
+
var stylesheet = _step2.value;
|
|
660
|
+
|
|
661
|
+
if (!Array.isArray(stylesheet)) {
|
|
662
|
+
list.push(stylesheet);
|
|
663
|
+
} else {
|
|
664
|
+
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
} catch (err) {
|
|
668
|
+
_iterator2.e(err);
|
|
669
|
+
} finally {
|
|
670
|
+
_iterator2.f();
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
return list;
|
|
638
674
|
} //
|
|
639
675
|
// Primitives
|
|
640
676
|
//
|
|
@@ -3395,6 +3431,55 @@
|
|
|
3395
3431
|
var meta = signedDecoratorToMetaMap.get(Ctor);
|
|
3396
3432
|
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
3397
3433
|
}
|
|
3434
|
+
/*
|
|
3435
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3436
|
+
* All rights reserved.
|
|
3437
|
+
* SPDX-License-Identifier: MIT
|
|
3438
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3439
|
+
*/
|
|
3440
|
+
|
|
3441
|
+
|
|
3442
|
+
var warned = false;
|
|
3443
|
+
|
|
3444
|
+
if (process.env.NODE_ENV === 'development') {
|
|
3445
|
+
// @ts-ignore
|
|
3446
|
+
window.__lwcResetWarnedOnVersionMismatch = function () {
|
|
3447
|
+
warned = false;
|
|
3448
|
+
};
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
function checkVersionMismatch(func, type) {
|
|
3452
|
+
var versionMatcher = func.toString().match(LWC_VERSION_COMMENT_REGEX);
|
|
3453
|
+
|
|
3454
|
+
if (!isNull(versionMatcher) && !warned) {
|
|
3455
|
+
var version = versionMatcher[1];
|
|
3456
|
+
|
|
3457
|
+
var _version$split = version.split('.'),
|
|
3458
|
+
_version$split2 = _slicedToArray(_version$split, 2),
|
|
3459
|
+
major = _version$split2[0],
|
|
3460
|
+
minor = _version$split2[1];
|
|
3461
|
+
|
|
3462
|
+
var _LWC_VERSION$split = LWC_VERSION.split('.'),
|
|
3463
|
+
_LWC_VERSION$split2 = _slicedToArray(_LWC_VERSION$split, 2),
|
|
3464
|
+
expectedMajor = _LWC_VERSION$split2[0],
|
|
3465
|
+
expectedMinor = _LWC_VERSION$split2[1];
|
|
3466
|
+
|
|
3467
|
+
if (major !== expectedMajor || minor !== expectedMinor) {
|
|
3468
|
+
warned = true; // only warn once to avoid flooding the console
|
|
3469
|
+
// stylesheets and templates do not have user-meaningful names, but components do
|
|
3470
|
+
|
|
3471
|
+
var friendlyName = type === 'component' ? "".concat(type, " ").concat(func.name) : type;
|
|
3472
|
+
logError("LWC WARNING: current engine is v".concat(LWC_VERSION, ", but ").concat(friendlyName, " was compiled with v").concat(version, ".\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear."));
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
/*
|
|
3477
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3478
|
+
* All rights reserved.
|
|
3479
|
+
* SPDX-License-Identifier: MIT
|
|
3480
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3481
|
+
*/
|
|
3482
|
+
|
|
3398
3483
|
|
|
3399
3484
|
var signedTemplateSet = new Set();
|
|
3400
3485
|
|
|
@@ -3407,6 +3492,26 @@
|
|
|
3407
3492
|
function isTemplateRegistered(tpl) {
|
|
3408
3493
|
return signedTemplateSet.has(tpl);
|
|
3409
3494
|
}
|
|
3495
|
+
|
|
3496
|
+
function checkTemplateVersionMismatch(template) {
|
|
3497
|
+
checkVersionMismatch(template, 'template');
|
|
3498
|
+
|
|
3499
|
+
if (!isUndefined$1(template.stylesheets)) {
|
|
3500
|
+
var _iterator3 = _createForOfIteratorHelper(flattenStylesheets(template.stylesheets)),
|
|
3501
|
+
_step3;
|
|
3502
|
+
|
|
3503
|
+
try {
|
|
3504
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
3505
|
+
var stylesheet = _step3.value;
|
|
3506
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3507
|
+
}
|
|
3508
|
+
} catch (err) {
|
|
3509
|
+
_iterator3.e(err);
|
|
3510
|
+
} finally {
|
|
3511
|
+
_iterator3.f();
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3410
3515
|
/**
|
|
3411
3516
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3412
3517
|
* will prevent this function from being imported by userland code.
|
|
@@ -3414,6 +3519,10 @@
|
|
|
3414
3519
|
|
|
3415
3520
|
|
|
3416
3521
|
function registerTemplate(tpl) {
|
|
3522
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3523
|
+
checkTemplateVersionMismatch(tpl);
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3417
3526
|
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
3418
3527
|
// assignment of templates easily, without too much transformation
|
|
3419
3528
|
|
|
@@ -3709,31 +3818,6 @@
|
|
|
3709
3818
|
return canRefreshAllInstances;
|
|
3710
3819
|
}
|
|
3711
3820
|
|
|
3712
|
-
function flattenStylesheets(stylesheets) {
|
|
3713
|
-
var list = [];
|
|
3714
|
-
|
|
3715
|
-
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
3716
|
-
_step2;
|
|
3717
|
-
|
|
3718
|
-
try {
|
|
3719
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3720
|
-
var stylesheet = _step2.value;
|
|
3721
|
-
|
|
3722
|
-
if (!Array.isArray(stylesheet)) {
|
|
3723
|
-
list.push(stylesheet);
|
|
3724
|
-
} else {
|
|
3725
|
-
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
} catch (err) {
|
|
3729
|
-
_iterator2.e(err);
|
|
3730
|
-
} finally {
|
|
3731
|
-
_iterator2.f();
|
|
3732
|
-
}
|
|
3733
|
-
|
|
3734
|
-
return list;
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
3821
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3738
3822
|
if (process.env.NODE_ENV === 'production') {
|
|
3739
3823
|
// this method should never leak to prod
|
|
@@ -4542,146 +4626,262 @@
|
|
|
4542
4626
|
*/
|
|
4543
4627
|
|
|
4544
4628
|
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
vnode.elm = elm;
|
|
4551
|
-
},
|
|
4552
|
-
update: updateNodeHook,
|
|
4553
|
-
insert: insertNode,
|
|
4554
|
-
move: insertNode,
|
|
4555
|
-
remove: removeNode
|
|
4556
|
-
};
|
|
4557
|
-
var CommentHook = {
|
|
4558
|
-
create: function create(vnode) {
|
|
4559
|
-
var owner = vnode.owner,
|
|
4560
|
-
text = vnode.text;
|
|
4561
|
-
var elm = createComment$1(text);
|
|
4562
|
-
linkNodeToShadow(elm, owner);
|
|
4563
|
-
vnode.elm = elm;
|
|
4564
|
-
},
|
|
4565
|
-
update: updateNodeHook,
|
|
4566
|
-
insert: insertNode,
|
|
4567
|
-
move: insertNode,
|
|
4568
|
-
remove: removeNode
|
|
4569
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4570
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4571
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
4572
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
4573
|
-
// Custom Element that is inserted via a template.
|
|
4574
|
-
|
|
4575
|
-
var ElementHook = {
|
|
4576
|
-
create: function create(vnode) {
|
|
4577
|
-
var sel = vnode.sel,
|
|
4578
|
-
owner = vnode.owner,
|
|
4579
|
-
svg = vnode.data.svg;
|
|
4580
|
-
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4581
|
-
var elm = createElement$2(sel, namespace);
|
|
4582
|
-
linkNodeToShadow(elm, owner);
|
|
4583
|
-
fallbackElmHook(elm, vnode);
|
|
4584
|
-
vnode.elm = elm;
|
|
4585
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
4586
|
-
},
|
|
4587
|
-
update: function update(oldVnode, vnode) {
|
|
4588
|
-
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4589
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4590
|
-
},
|
|
4591
|
-
insert: function insert(vnode, parentNode, referenceNode) {
|
|
4592
|
-
insertNode(vnode, parentNode, referenceNode);
|
|
4593
|
-
createChildrenHook(vnode);
|
|
4594
|
-
},
|
|
4595
|
-
move: insertNode,
|
|
4596
|
-
remove: function remove(vnode, parentNode) {
|
|
4597
|
-
removeNode(vnode, parentNode);
|
|
4598
|
-
removeChildren(vnode);
|
|
4629
|
+
function patchChildren(c1, c2, parent) {
|
|
4630
|
+
if (hasDynamicChildren(c2)) {
|
|
4631
|
+
updateDynamicChildren(c1, c2, parent);
|
|
4632
|
+
} else {
|
|
4633
|
+
updateStaticChildren(c1, c2, parent);
|
|
4599
4634
|
}
|
|
4600
|
-
}
|
|
4601
|
-
var CustomElementHook = {
|
|
4602
|
-
create: function create(vnode) {
|
|
4603
|
-
var sel = vnode.sel,
|
|
4604
|
-
owner = vnode.owner;
|
|
4605
|
-
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4606
|
-
/**
|
|
4607
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4608
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
4609
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
4610
|
-
* an upgradable custom element.
|
|
4611
|
-
*/
|
|
4635
|
+
}
|
|
4612
4636
|
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
});
|
|
4618
|
-
linkNodeToShadow(elm, owner);
|
|
4619
|
-
vnode.elm = elm;
|
|
4637
|
+
function patch(n1, n2) {
|
|
4638
|
+
if (n1 === n2) {
|
|
4639
|
+
return;
|
|
4640
|
+
}
|
|
4620
4641
|
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4642
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4643
|
+
if (!isSameVnode(n1, n2)) {
|
|
4644
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
4645
|
+
sel: n1.sel,
|
|
4646
|
+
key: n1.key
|
|
4647
|
+
}) + ', ' + JSON.stringify({
|
|
4648
|
+
sel: n2.sel,
|
|
4649
|
+
key: n2.key
|
|
4650
|
+
}));
|
|
4625
4651
|
}
|
|
4652
|
+
}
|
|
4626
4653
|
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4654
|
+
switch (n2.type) {
|
|
4655
|
+
case 0
|
|
4656
|
+
/* Text */
|
|
4657
|
+
:
|
|
4658
|
+
patchText(n1, n2);
|
|
4659
|
+
break;
|
|
4632
4660
|
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
// will happen, but in native, it does allocate the light dom
|
|
4661
|
+
case 1
|
|
4662
|
+
/* Comment */
|
|
4663
|
+
:
|
|
4664
|
+
patchComment(n1, n2);
|
|
4665
|
+
break;
|
|
4639
4666
|
|
|
4667
|
+
case 2
|
|
4668
|
+
/* Element */
|
|
4669
|
+
:
|
|
4670
|
+
patchElement(n1, n2);
|
|
4671
|
+
break;
|
|
4640
4672
|
|
|
4641
|
-
|
|
4673
|
+
case 3
|
|
4674
|
+
/* CustomElement */
|
|
4675
|
+
:
|
|
4676
|
+
patchCustomElement(n1, n2);
|
|
4677
|
+
break;
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4642
4680
|
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4681
|
+
function mount(node, parent, anchor) {
|
|
4682
|
+
switch (node.type) {
|
|
4683
|
+
case 0
|
|
4684
|
+
/* Text */
|
|
4685
|
+
:
|
|
4686
|
+
mountText(node, parent, anchor);
|
|
4687
|
+
break;
|
|
4648
4688
|
|
|
4689
|
+
case 1
|
|
4690
|
+
/* Comment */
|
|
4691
|
+
:
|
|
4692
|
+
mountComment(node, parent, anchor);
|
|
4693
|
+
break;
|
|
4649
4694
|
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4695
|
+
case 2
|
|
4696
|
+
/* Element */
|
|
4697
|
+
:
|
|
4698
|
+
mountElement(node, parent, anchor);
|
|
4699
|
+
break;
|
|
4656
4700
|
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4701
|
+
case 3
|
|
4702
|
+
/* CustomElement */
|
|
4703
|
+
:
|
|
4704
|
+
mountCustomElement(node, parent, anchor);
|
|
4705
|
+
break;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
function patchText(n1, n2) {
|
|
4710
|
+
n2.elm = n1.elm;
|
|
4711
|
+
|
|
4712
|
+
if (n2.text !== n1.text) {
|
|
4713
|
+
updateTextContent(n2);
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
function mountText(node, parent, anchor) {
|
|
4718
|
+
var owner = node.owner;
|
|
4719
|
+
var textNode = node.elm = createText$1(node.text);
|
|
4720
|
+
linkNodeToShadow(textNode, owner);
|
|
4721
|
+
insertNode(textNode, parent, anchor);
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
function patchComment(n1, n2) {
|
|
4725
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
4726
|
+
// it is the case today.
|
|
4727
|
+
|
|
4728
|
+
if (n2.text !== n1.text) {
|
|
4729
|
+
updateTextContent(n2);
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
function mountComment(node, parent, anchor) {
|
|
4734
|
+
var owner = node.owner;
|
|
4735
|
+
var commentNode = node.elm = createComment$1(node.text);
|
|
4736
|
+
linkNodeToShadow(commentNode, owner);
|
|
4737
|
+
insertNode(commentNode, parent, anchor);
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4740
|
+
function mountElement(vnode, parent, anchor) {
|
|
4741
|
+
var sel = vnode.sel,
|
|
4742
|
+
owner = vnode.owner,
|
|
4743
|
+
svg = vnode.data.svg;
|
|
4744
|
+
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4745
|
+
var elm = createElement$2(sel, namespace);
|
|
4746
|
+
linkNodeToShadow(elm, owner);
|
|
4747
|
+
fallbackElmHook(elm, vnode);
|
|
4748
|
+
vnode.elm = elm;
|
|
4749
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4750
|
+
insertNode(elm, parent, anchor);
|
|
4751
|
+
mountVNodes(vnode.children, elm, null);
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
function patchElement(n1, n2) {
|
|
4755
|
+
var elm = n2.elm = n1.elm;
|
|
4756
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4757
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4758
|
+
}
|
|
4759
|
+
|
|
4760
|
+
function mountCustomElement(vnode, parent, anchor) {
|
|
4761
|
+
var sel = vnode.sel,
|
|
4762
|
+
owner = vnode.owner;
|
|
4763
|
+
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4764
|
+
/**
|
|
4765
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4766
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4767
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4768
|
+
* an upgradable custom element.
|
|
4769
|
+
*/
|
|
4770
|
+
|
|
4771
|
+
var vm;
|
|
4772
|
+
var elm = new UpgradableConstructor(function (elm) {
|
|
4773
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4774
|
+
vm = createViewModelHook(elm, vnode);
|
|
4775
|
+
});
|
|
4776
|
+
linkNodeToShadow(elm, owner);
|
|
4777
|
+
vnode.elm = elm;
|
|
4778
|
+
vnode.vm = vm;
|
|
4779
|
+
|
|
4780
|
+
if (vm) {
|
|
4781
|
+
allocateChildren(vnode, vm);
|
|
4782
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4783
|
+
throw new TypeError("Incorrect Component Constructor");
|
|
4784
|
+
}
|
|
4663
4785
|
|
|
4664
|
-
|
|
4786
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4787
|
+
insertNode(elm, parent, anchor);
|
|
4788
|
+
|
|
4789
|
+
if (vm) {
|
|
4790
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4791
|
+
assert.isTrue(vm.state === 0
|
|
4792
|
+
/* created */
|
|
4793
|
+
, "".concat(vm, " cannot be recycled."));
|
|
4665
4794
|
}
|
|
4666
4795
|
|
|
4667
|
-
|
|
4796
|
+
runConnectedCallback(vm);
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4799
|
+
mountVNodes(vnode.children, elm, null);
|
|
4800
|
+
|
|
4801
|
+
if (vm) {
|
|
4802
|
+
appendVM(vm);
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4806
|
+
function patchCustomElement(n1, n2) {
|
|
4807
|
+
var elm = n2.elm = n1.elm;
|
|
4808
|
+
var vm = n2.vm = n1.vm;
|
|
4809
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4810
|
+
|
|
4811
|
+
if (!isUndefined$1(vm)) {
|
|
4812
|
+
// in fallback mode, the allocation will always set children to
|
|
4813
|
+
// empty and delegate the real allocation to the slot elements
|
|
4814
|
+
allocateChildren(n2, vm);
|
|
4815
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4816
|
+
// will happen, but in native, it does allocate the light dom
|
|
4817
|
+
|
|
4818
|
+
|
|
4819
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4668
4820
|
|
|
4669
|
-
|
|
4670
|
-
|
|
4821
|
+
if (!isUndefined$1(vm)) {
|
|
4822
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4823
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4824
|
+
rerenderVM(vm);
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4828
|
+
function mountVNodes(vnodes, parent, anchor) {
|
|
4829
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
4830
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
4831
|
+
|
|
4832
|
+
for (; start < end; ++start) {
|
|
4833
|
+
var vnode = vnodes[start];
|
|
4834
|
+
|
|
4835
|
+
if (isVNode(vnode)) {
|
|
4836
|
+
mount(vnode, parent, anchor);
|
|
4671
4837
|
}
|
|
4672
|
-
}
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
function unmount(vnode, parent) {
|
|
4842
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4843
|
+
var type = vnode.type,
|
|
4844
|
+
elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4845
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
4846
|
+
|
|
4847
|
+
if (doRemove) {
|
|
4848
|
+
removeNode(elm, parent);
|
|
4849
|
+
}
|
|
4850
|
+
|
|
4851
|
+
switch (type) {
|
|
4852
|
+
case 2
|
|
4853
|
+
/* Element */
|
|
4854
|
+
:
|
|
4855
|
+
unmountVNodes(vnode.children, elm);
|
|
4856
|
+
break;
|
|
4857
|
+
|
|
4858
|
+
case 3
|
|
4859
|
+
/* CustomElement */
|
|
4860
|
+
:
|
|
4861
|
+
{
|
|
4862
|
+
var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
4863
|
+
// children.
|
|
4864
|
+
|
|
4865
|
+
if (!isUndefined$1(vm)) {
|
|
4866
|
+
removeVM(vm);
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
|
|
4872
|
+
function unmountVNodes(vnodes, parent) {
|
|
4873
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4874
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
4875
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
4876
|
+
|
|
4877
|
+
for (; start < end; ++start) {
|
|
4878
|
+
var ch = vnodes[start];
|
|
4677
4879
|
|
|
4678
|
-
if (
|
|
4679
|
-
|
|
4680
|
-
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4681
|
-
removeVM(vm);
|
|
4880
|
+
if (isVNode(ch)) {
|
|
4881
|
+
unmount(ch, parent, doRemove);
|
|
4682
4882
|
}
|
|
4683
4883
|
}
|
|
4684
|
-
}
|
|
4884
|
+
}
|
|
4685
4885
|
|
|
4686
4886
|
function isVNode(vnode) {
|
|
4687
4887
|
return vnode != null;
|
|
@@ -4722,41 +4922,39 @@
|
|
|
4722
4922
|
}
|
|
4723
4923
|
}
|
|
4724
4924
|
|
|
4725
|
-
function
|
|
4925
|
+
function updateTextContent(vnode) {
|
|
4726
4926
|
var elm = vnode.elm,
|
|
4727
4927
|
text = vnode.text;
|
|
4728
4928
|
|
|
4729
|
-
if (
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
}
|
|
4929
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4930
|
+
unlockDomMutation();
|
|
4931
|
+
}
|
|
4733
4932
|
|
|
4734
|
-
|
|
4933
|
+
setText$1(elm, text);
|
|
4735
4934
|
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
}
|
|
4935
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4936
|
+
lockDomMutation();
|
|
4739
4937
|
}
|
|
4740
4938
|
}
|
|
4741
4939
|
|
|
4742
|
-
function insertNode(
|
|
4940
|
+
function insertNode(node, parent, anchor) {
|
|
4743
4941
|
if (process.env.NODE_ENV !== 'production') {
|
|
4744
4942
|
unlockDomMutation();
|
|
4745
4943
|
}
|
|
4746
4944
|
|
|
4747
|
-
insert$1(
|
|
4945
|
+
insert$1(node, parent, anchor);
|
|
4748
4946
|
|
|
4749
4947
|
if (process.env.NODE_ENV !== 'production') {
|
|
4750
4948
|
lockDomMutation();
|
|
4751
4949
|
}
|
|
4752
4950
|
}
|
|
4753
4951
|
|
|
4754
|
-
function removeNode(
|
|
4952
|
+
function removeNode(node, parent) {
|
|
4755
4953
|
if (process.env.NODE_ENV !== 'production') {
|
|
4756
4954
|
unlockDomMutation();
|
|
4757
4955
|
}
|
|
4758
4956
|
|
|
4759
|
-
remove$1(
|
|
4957
|
+
remove$1(node, parent);
|
|
4760
4958
|
|
|
4761
4959
|
if (process.env.NODE_ENV !== 'production') {
|
|
4762
4960
|
lockDomMutation();
|
|
@@ -4817,14 +5015,6 @@
|
|
|
4817
5015
|
}
|
|
4818
5016
|
}
|
|
4819
5017
|
|
|
4820
|
-
function patchChildren(parent, oldCh, newCh) {
|
|
4821
|
-
if (hasDynamicChildren(newCh)) {
|
|
4822
|
-
updateDynamicChildren(parent, oldCh, newCh);
|
|
4823
|
-
} else {
|
|
4824
|
-
updateStaticChildren(parent, oldCh, newCh);
|
|
4825
|
-
}
|
|
4826
|
-
}
|
|
4827
|
-
|
|
4828
5018
|
function allocateChildren(vnode, vm) {
|
|
4829
5019
|
// A component with slots will re-render because:
|
|
4830
5020
|
// 1- There is a change of the internal state.
|
|
@@ -4894,43 +5084,13 @@
|
|
|
4894
5084
|
return vm;
|
|
4895
5085
|
}
|
|
4896
5086
|
|
|
4897
|
-
function createChildrenHook(vnode) {
|
|
4898
|
-
var elm = vnode.elm,
|
|
4899
|
-
children = vnode.children;
|
|
4900
|
-
|
|
4901
|
-
for (var j = 0; j < children.length; ++j) {
|
|
4902
|
-
var ch = children[j];
|
|
4903
|
-
|
|
4904
|
-
if (ch != null) {
|
|
4905
|
-
ch.hook.create(ch);
|
|
4906
|
-
ch.hook.insert(ch, elm, null);
|
|
4907
|
-
}
|
|
4908
|
-
}
|
|
4909
|
-
}
|
|
4910
|
-
|
|
4911
|
-
function removeChildren(vnode) {
|
|
4912
|
-
// this method only needs to search on child vnodes from template
|
|
4913
|
-
// to trigger the remove hook just in case some of those children
|
|
4914
|
-
// are custom elements.
|
|
4915
|
-
var children = vnode.children,
|
|
4916
|
-
elm = vnode.elm;
|
|
4917
|
-
|
|
4918
|
-
for (var j = 0, _len5 = children.length; j < _len5; ++j) {
|
|
4919
|
-
var ch = children[j];
|
|
4920
|
-
|
|
4921
|
-
if (!isNull(ch)) {
|
|
4922
|
-
ch.hook.remove(ch, elm);
|
|
4923
|
-
}
|
|
4924
|
-
}
|
|
4925
|
-
}
|
|
4926
|
-
|
|
4927
5087
|
function allocateInSlot(vm, children) {
|
|
4928
5088
|
var _a;
|
|
4929
5089
|
|
|
4930
5090
|
var oldSlots = vm.cmpSlots;
|
|
4931
5091
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
4932
5092
|
|
|
4933
|
-
for (var _i13 = 0,
|
|
5093
|
+
for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
|
|
4934
5094
|
var vnode = children[_i13];
|
|
4935
5095
|
|
|
4936
5096
|
if (isNull(vnode)) {
|
|
@@ -4965,7 +5125,7 @@
|
|
|
4965
5125
|
return;
|
|
4966
5126
|
}
|
|
4967
5127
|
|
|
4968
|
-
for (var _i14 = 0,
|
|
5128
|
+
for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
|
|
4969
5129
|
var key = oldKeys[_i14];
|
|
4970
5130
|
|
|
4971
5131
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
@@ -5016,28 +5176,7 @@
|
|
|
5016
5176
|
return map;
|
|
5017
5177
|
}
|
|
5018
5178
|
|
|
5019
|
-
function
|
|
5020
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
5021
|
-
var ch = vnodes[startIdx];
|
|
5022
|
-
|
|
5023
|
-
if (isVNode(ch)) {
|
|
5024
|
-
ch.hook.create(ch);
|
|
5025
|
-
ch.hook.insert(ch, parentElm, before);
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
}
|
|
5029
|
-
|
|
5030
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
5031
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
5032
|
-
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
5033
|
-
|
|
5034
|
-
if (isVNode(ch)) {
|
|
5035
|
-
ch.hook.remove(ch, parentElm);
|
|
5036
|
-
}
|
|
5037
|
-
}
|
|
5038
|
-
}
|
|
5039
|
-
|
|
5040
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
5179
|
+
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
5041
5180
|
var oldStartIdx = 0;
|
|
5042
5181
|
var newStartIdx = 0;
|
|
5043
5182
|
var oldEndIdx = oldCh.length - 1;
|
|
@@ -5063,23 +5202,23 @@
|
|
|
5063
5202
|
} else if (!isVNode(newEndVnode)) {
|
|
5064
5203
|
newEndVnode = newCh[--newEndIdx];
|
|
5065
5204
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
5066
|
-
|
|
5205
|
+
patch(oldStartVnode, newStartVnode);
|
|
5067
5206
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
5068
5207
|
newStartVnode = newCh[++newStartIdx];
|
|
5069
5208
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
5070
|
-
|
|
5209
|
+
patch(oldEndVnode, newEndVnode);
|
|
5071
5210
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
5072
5211
|
newEndVnode = newCh[--newEndIdx];
|
|
5073
5212
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
5074
5213
|
// Vnode moved right
|
|
5075
|
-
|
|
5076
|
-
|
|
5214
|
+
patch(oldStartVnode, newEndVnode);
|
|
5215
|
+
insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
|
|
5077
5216
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
5078
5217
|
newEndVnode = newCh[--newEndIdx];
|
|
5079
5218
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
5080
5219
|
// Vnode moved left
|
|
5081
|
-
|
|
5082
|
-
newStartVnode.
|
|
5220
|
+
patch(oldEndVnode, newStartVnode);
|
|
5221
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
5083
5222
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
5084
5223
|
newStartVnode = newCh[++newStartIdx];
|
|
5085
5224
|
} else {
|
|
@@ -5091,8 +5230,7 @@
|
|
|
5091
5230
|
|
|
5092
5231
|
if (isUndefined$1(idxInOld)) {
|
|
5093
5232
|
// New element
|
|
5094
|
-
newStartVnode.
|
|
5095
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5233
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
5096
5234
|
newStartVnode = newCh[++newStartIdx];
|
|
5097
5235
|
} else {
|
|
5098
5236
|
elmToMove = oldCh[idxInOld];
|
|
@@ -5100,10 +5238,9 @@
|
|
|
5100
5238
|
if (isVNode(elmToMove)) {
|
|
5101
5239
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
5102
5240
|
// New element
|
|
5103
|
-
newStartVnode.
|
|
5104
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5241
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
5105
5242
|
} else {
|
|
5106
|
-
|
|
5243
|
+
patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
|
|
5107
5244
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
5108
5245
|
// so we only care about the `oldCh` object inside this function.
|
|
5109
5246
|
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
@@ -5116,7 +5253,7 @@
|
|
|
5116
5253
|
|
|
5117
5254
|
|
|
5118
5255
|
oldCh[idxInOld] = undefined;
|
|
5119
|
-
|
|
5256
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
5120
5257
|
}
|
|
5121
5258
|
}
|
|
5122
5259
|
|
|
@@ -5137,65 +5274,55 @@
|
|
|
5137
5274
|
} while (!isVNode(n) && _i15 < newChEnd);
|
|
5138
5275
|
|
|
5139
5276
|
before = isVNode(n) ? n.elm : null;
|
|
5140
|
-
|
|
5277
|
+
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
5141
5278
|
} else {
|
|
5142
|
-
|
|
5279
|
+
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
5143
5280
|
}
|
|
5144
5281
|
}
|
|
5145
5282
|
}
|
|
5146
5283
|
|
|
5147
|
-
function updateStaticChildren(
|
|
5148
|
-
var
|
|
5149
|
-
var
|
|
5284
|
+
function updateStaticChildren(c1, c2, parent) {
|
|
5285
|
+
var c1Length = c1.length;
|
|
5286
|
+
var c2Length = c2.length;
|
|
5150
5287
|
|
|
5151
|
-
if (
|
|
5288
|
+
if (c1Length === 0) {
|
|
5152
5289
|
// the old list is empty, we can directly insert anything new
|
|
5153
|
-
|
|
5290
|
+
mountVNodes(c2, parent, null);
|
|
5154
5291
|
return;
|
|
5155
5292
|
}
|
|
5156
5293
|
|
|
5157
|
-
if (
|
|
5294
|
+
if (c2Length === 0) {
|
|
5158
5295
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
5159
5296
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
5160
|
-
|
|
5297
|
+
unmountVNodes(c1, parent, true);
|
|
5161
5298
|
return;
|
|
5162
5299
|
} // if the old list is not empty, the new list MUST have the same
|
|
5163
5300
|
// amount of nodes, that's why we call this static children
|
|
5164
5301
|
|
|
5165
5302
|
|
|
5166
|
-
var
|
|
5303
|
+
var anchor = null;
|
|
5167
5304
|
|
|
5168
|
-
for (var _i16 =
|
|
5169
|
-
var
|
|
5170
|
-
var
|
|
5305
|
+
for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
|
|
5306
|
+
var n1 = c1[_i16];
|
|
5307
|
+
var n2 = c2[_i16];
|
|
5171
5308
|
|
|
5172
|
-
if (
|
|
5173
|
-
if (isVNode(
|
|
5174
|
-
if (isVNode(
|
|
5175
|
-
// both vnodes
|
|
5176
|
-
|
|
5177
|
-
|
|
5309
|
+
if (n2 !== n1) {
|
|
5310
|
+
if (isVNode(n1)) {
|
|
5311
|
+
if (isVNode(n2)) {
|
|
5312
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
5313
|
+
patch(n1, n2);
|
|
5314
|
+
anchor = n2.elm;
|
|
5178
5315
|
} else {
|
|
5179
5316
|
// removing the old vnode since the new one is null
|
|
5180
|
-
|
|
5317
|
+
unmount(n1, parent, true);
|
|
5181
5318
|
}
|
|
5182
|
-
} else if (isVNode(
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
5187
|
-
referenceElm = vnode.elm;
|
|
5319
|
+
} else if (isVNode(n2)) {
|
|
5320
|
+
mount(n2, parent, anchor);
|
|
5321
|
+
anchor = n2.elm;
|
|
5188
5322
|
}
|
|
5189
5323
|
}
|
|
5190
5324
|
}
|
|
5191
5325
|
}
|
|
5192
|
-
|
|
5193
|
-
function patchVnode(oldVnode, vnode) {
|
|
5194
|
-
if (oldVnode !== vnode) {
|
|
5195
|
-
vnode.elm = oldVnode.elm;
|
|
5196
|
-
vnode.hook.update(oldVnode, vnode);
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
5326
|
/*
|
|
5200
5327
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5201
5328
|
* All rights reserved.
|
|
@@ -5246,7 +5373,6 @@
|
|
|
5246
5373
|
children: children,
|
|
5247
5374
|
elm: elm,
|
|
5248
5375
|
key: key,
|
|
5249
|
-
hook: ElementHook,
|
|
5250
5376
|
owner: vmBeingRendered
|
|
5251
5377
|
};
|
|
5252
5378
|
} // [t]ab[i]ndex function
|
|
@@ -5330,7 +5456,7 @@
|
|
|
5330
5456
|
}
|
|
5331
5457
|
|
|
5332
5458
|
var key = data.key;
|
|
5333
|
-
var elm;
|
|
5459
|
+
var elm, aChildren, vm;
|
|
5334
5460
|
var vnode = {
|
|
5335
5461
|
type: 3
|
|
5336
5462
|
/* CustomElement */
|
|
@@ -5340,11 +5466,11 @@
|
|
|
5340
5466
|
children: children,
|
|
5341
5467
|
elm: elm,
|
|
5342
5468
|
key: key,
|
|
5343
|
-
hook: CustomElementHook,
|
|
5344
5469
|
ctor: Ctor,
|
|
5345
5470
|
owner: vmBeingRendered,
|
|
5346
|
-
mode: 'open'
|
|
5347
|
-
|
|
5471
|
+
mode: 'open',
|
|
5472
|
+
aChildren: aChildren,
|
|
5473
|
+
vm: vm
|
|
5348
5474
|
};
|
|
5349
5475
|
addVNodeToChildLWC(vnode);
|
|
5350
5476
|
return vnode;
|
|
@@ -5471,7 +5597,6 @@
|
|
|
5471
5597
|
text: text,
|
|
5472
5598
|
elm: elm,
|
|
5473
5599
|
key: key,
|
|
5474
|
-
hook: TextHook,
|
|
5475
5600
|
owner: getVMBeingRendered()
|
|
5476
5601
|
};
|
|
5477
5602
|
} // [co]mment node
|
|
@@ -5487,7 +5612,6 @@
|
|
|
5487
5612
|
text: text,
|
|
5488
5613
|
elm: elm,
|
|
5489
5614
|
key: key,
|
|
5490
|
-
hook: CommentHook,
|
|
5491
5615
|
owner: getVMBeingRendered()
|
|
5492
5616
|
};
|
|
5493
5617
|
} // [d]ynamic text
|
|
@@ -6320,6 +6444,11 @@
|
|
|
6320
6444
|
|
|
6321
6445
|
function registerComponent(Ctor, _ref2) {
|
|
6322
6446
|
var tmpl = _ref2.tmpl;
|
|
6447
|
+
|
|
6448
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6449
|
+
checkVersionMismatch(Ctor, 'component');
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6323
6452
|
signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
6324
6453
|
// without too much transformation
|
|
6325
6454
|
|
|
@@ -6429,7 +6558,7 @@
|
|
|
6429
6558
|
def = vm.def,
|
|
6430
6559
|
context = vm.context;
|
|
6431
6560
|
|
|
6432
|
-
for (var _i22 = 0,
|
|
6561
|
+
for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
|
|
6433
6562
|
cbs[_i22].call(undefined, component, {}, def, context);
|
|
6434
6563
|
}
|
|
6435
6564
|
}
|
|
@@ -6441,7 +6570,7 @@
|
|
|
6441
6570
|
*/
|
|
6442
6571
|
|
|
6443
6572
|
|
|
6444
|
-
function hydrate
|
|
6573
|
+
function hydrate(vnode, node) {
|
|
6445
6574
|
switch (vnode.type) {
|
|
6446
6575
|
case 0
|
|
6447
6576
|
/* Text */
|
|
@@ -6473,16 +6602,18 @@
|
|
|
6473
6602
|
var _a;
|
|
6474
6603
|
|
|
6475
6604
|
if (process.env.NODE_ENV !== 'production') {
|
|
6476
|
-
|
|
6477
|
-
|
|
6605
|
+
validateNodeType(vnode, node, 3
|
|
6606
|
+
/* TEXT */
|
|
6607
|
+
);
|
|
6608
|
+
var nodeValue = getProperty$1(node, 'nodeValue');
|
|
6478
6609
|
|
|
6479
|
-
if (
|
|
6610
|
+
if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === '')) {
|
|
6480
6611
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6481
6612
|
}
|
|
6482
6613
|
} // always set the text value to the one from the vnode.
|
|
6483
6614
|
|
|
6484
6615
|
|
|
6485
|
-
node
|
|
6616
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6486
6617
|
vnode.elm = node;
|
|
6487
6618
|
}
|
|
6488
6619
|
|
|
@@ -6490,23 +6621,25 @@
|
|
|
6490
6621
|
var _a;
|
|
6491
6622
|
|
|
6492
6623
|
if (process.env.NODE_ENV !== 'production') {
|
|
6493
|
-
|
|
6494
|
-
|
|
6624
|
+
validateNodeType(vnode, node, 8
|
|
6625
|
+
/* COMMENT */
|
|
6626
|
+
);
|
|
6495
6627
|
|
|
6496
|
-
if (node
|
|
6628
|
+
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
6497
6629
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6498
6630
|
}
|
|
6499
6631
|
} // always set the text value to the one from the vnode.
|
|
6500
6632
|
|
|
6501
6633
|
|
|
6502
|
-
node
|
|
6634
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6503
6635
|
vnode.elm = node;
|
|
6504
6636
|
}
|
|
6505
6637
|
|
|
6506
6638
|
function hydrateElement(vnode, node) {
|
|
6507
6639
|
if (process.env.NODE_ENV !== 'production') {
|
|
6508
|
-
|
|
6509
|
-
|
|
6640
|
+
validateNodeType(vnode, node, 1
|
|
6641
|
+
/* ELEMENT */
|
|
6642
|
+
);
|
|
6510
6643
|
validateElement(vnode, node);
|
|
6511
6644
|
}
|
|
6512
6645
|
|
|
@@ -6523,13 +6656,13 @@
|
|
|
6523
6656
|
var props = vnode.data.props;
|
|
6524
6657
|
|
|
6525
6658
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6526
|
-
if (elm
|
|
6659
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6527
6660
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6528
6661
|
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
6529
6662
|
props: cloneAndOmitKey(props, 'innerHTML')
|
|
6530
6663
|
});
|
|
6531
6664
|
} else {
|
|
6532
|
-
logWarn("Mismatch hydrating element <".concat(elm
|
|
6665
|
+
logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
6533
6666
|
}
|
|
6534
6667
|
}
|
|
6535
6668
|
}
|
|
@@ -6537,19 +6670,19 @@
|
|
|
6537
6670
|
patchElementPropsAndAttrs(vnode);
|
|
6538
6671
|
|
|
6539
6672
|
if (!isDomManual) {
|
|
6540
|
-
hydrateChildren(vnode.elm
|
|
6673
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
6541
6674
|
}
|
|
6542
6675
|
}
|
|
6543
6676
|
|
|
6544
6677
|
function hydrateCustomElement(vnode, node) {
|
|
6545
6678
|
if (process.env.NODE_ENV !== 'production') {
|
|
6546
|
-
|
|
6547
|
-
|
|
6679
|
+
validateNodeType(vnode, node, 1
|
|
6680
|
+
/* ELEMENT */
|
|
6681
|
+
);
|
|
6548
6682
|
validateElement(vnode, node);
|
|
6549
6683
|
}
|
|
6550
6684
|
|
|
6551
6685
|
var elm = node;
|
|
6552
|
-
vnode.elm = elm;
|
|
6553
6686
|
var sel = vnode.sel,
|
|
6554
6687
|
mode = vnode.mode,
|
|
6555
6688
|
ctor = vnode.ctor,
|
|
@@ -6559,6 +6692,8 @@
|
|
|
6559
6692
|
owner: owner,
|
|
6560
6693
|
tagName: sel
|
|
6561
6694
|
});
|
|
6695
|
+
vnode.elm = elm;
|
|
6696
|
+
vnode.vm = vm;
|
|
6562
6697
|
allocateChildren(vnode, vm);
|
|
6563
6698
|
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
6564
6699
|
|
|
@@ -6575,7 +6710,7 @@
|
|
|
6575
6710
|
) {
|
|
6576
6711
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6577
6712
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6578
|
-
hydrateChildren(vnode.elm
|
|
6713
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
6579
6714
|
}
|
|
6580
6715
|
|
|
6581
6716
|
hydrateVM(vm);
|
|
@@ -6600,7 +6735,7 @@
|
|
|
6600
6735
|
|
|
6601
6736
|
if (!isNull(childVnode)) {
|
|
6602
6737
|
var childNode = elmChildren[childNodeIndex];
|
|
6603
|
-
hydrate
|
|
6738
|
+
hydrate(childVnode, childNode);
|
|
6604
6739
|
childNodeIndex++;
|
|
6605
6740
|
}
|
|
6606
6741
|
}
|
|
@@ -6616,15 +6751,15 @@
|
|
|
6616
6751
|
}
|
|
6617
6752
|
|
|
6618
6753
|
function validateNodeType(vnode, node, nodeType) {
|
|
6619
|
-
if (node
|
|
6754
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6620
6755
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6621
6756
|
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
6622
6757
|
}
|
|
6623
6758
|
}
|
|
6624
6759
|
|
|
6625
6760
|
function validateElement(vnode, elm) {
|
|
6626
|
-
if (vnode.sel.toLowerCase() !== elm
|
|
6627
|
-
logError("Hydration mismatch: expecting element with tag \"".concat(vnode.sel.toLowerCase(), "\" but found \"").concat(elm
|
|
6761
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6762
|
+
logError("Hydration mismatch: expecting element with tag \"".concat(vnode.sel.toLowerCase(), "\" but found \"").concat(getProperty$1(elm, 'tagName').toLowerCase(), "\"."), vnode.owner);
|
|
6628
6763
|
throwHydrationError();
|
|
6629
6764
|
}
|
|
6630
6765
|
|
|
@@ -6652,7 +6787,7 @@
|
|
|
6652
6787
|
var elmAttrValue = getAttribute$1(elm, attrName);
|
|
6653
6788
|
|
|
6654
6789
|
if (String(attrValue) !== elmAttrValue) {
|
|
6655
|
-
logError("Mismatch hydrating element <".concat(elm
|
|
6790
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
6656
6791
|
nodesAreCompatible = false;
|
|
6657
6792
|
}
|
|
6658
6793
|
}
|
|
@@ -6667,7 +6802,7 @@
|
|
|
6667
6802
|
var nodesAreCompatible = true;
|
|
6668
6803
|
var vnodeClassName;
|
|
6669
6804
|
|
|
6670
|
-
if (!isUndefined$1(className) && String(className) !== elm
|
|
6805
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6671
6806
|
// className is used when class is bound to an expr.
|
|
6672
6807
|
nodesAreCompatible = false;
|
|
6673
6808
|
vnodeClassName = className;
|
|
@@ -6692,7 +6827,7 @@
|
|
|
6692
6827
|
}
|
|
6693
6828
|
|
|
6694
6829
|
if (!nodesAreCompatible) {
|
|
6695
|
-
logError("Mismatch hydrating element <".concat(elm
|
|
6830
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(getProperty$1(elm, 'className'), "\""), vnode.owner);
|
|
6696
6831
|
}
|
|
6697
6832
|
|
|
6698
6833
|
return nodesAreCompatible;
|
|
@@ -6740,7 +6875,7 @@
|
|
|
6740
6875
|
|
|
6741
6876
|
if (!nodesAreCompatible) {
|
|
6742
6877
|
// style is used when class is bound to an expr.
|
|
6743
|
-
logError("Mismatch hydrating element <".concat(elm
|
|
6878
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
6744
6879
|
}
|
|
6745
6880
|
|
|
6746
6881
|
return nodesAreCompatible;
|
|
@@ -6811,7 +6946,19 @@
|
|
|
6811
6946
|
}
|
|
6812
6947
|
|
|
6813
6948
|
function hydrateVM(vm) {
|
|
6814
|
-
|
|
6949
|
+
if (isTrue(vm.isDirty)) {
|
|
6950
|
+
// manually diffing/patching here.
|
|
6951
|
+
// This routine is:
|
|
6952
|
+
// patchShadowRoot(vm, children);
|
|
6953
|
+
// -> addVnodes.
|
|
6954
|
+
var children = renderComponent(vm);
|
|
6955
|
+
vm.children = children;
|
|
6956
|
+
var vmChildren = vm.renderMode === 0
|
|
6957
|
+
/* Light */
|
|
6958
|
+
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
6959
|
+
hydrateChildren(vmChildren, children, vm);
|
|
6960
|
+
runRenderedCallback(vm);
|
|
6961
|
+
}
|
|
6815
6962
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6816
6963
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6817
6964
|
|
|
@@ -6954,7 +7101,11 @@
|
|
|
6954
7101
|
/* Native */
|
|
6955
7102
|
;
|
|
6956
7103
|
} else if (isNativeShadowDefined$1) {
|
|
6957
|
-
if (
|
|
7104
|
+
if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
|
|
7105
|
+
shadowMode = 1
|
|
7106
|
+
/* Synthetic */
|
|
7107
|
+
;
|
|
7108
|
+
} else if (def.shadowSupportMode === "any"
|
|
6958
7109
|
/* Any */
|
|
6959
7110
|
) {
|
|
6960
7111
|
shadowMode = 0
|
|
@@ -7034,22 +7185,6 @@
|
|
|
7034
7185
|
}
|
|
7035
7186
|
}
|
|
7036
7187
|
|
|
7037
|
-
function hydrate(vm) {
|
|
7038
|
-
if (isTrue(vm.isDirty)) {
|
|
7039
|
-
// manually diffing/patching here.
|
|
7040
|
-
// This routine is:
|
|
7041
|
-
// patchShadowRoot(vm, children);
|
|
7042
|
-
// -> addVnodes.
|
|
7043
|
-
var children = renderComponent(vm);
|
|
7044
|
-
vm.children = children;
|
|
7045
|
-
var vmChildren = vm.renderMode === 0
|
|
7046
|
-
/* Light */
|
|
7047
|
-
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
7048
|
-
hydrateChildren(vmChildren, children, vm);
|
|
7049
|
-
runRenderedCallback(vm);
|
|
7050
|
-
}
|
|
7051
|
-
}
|
|
7052
|
-
|
|
7053
7188
|
function patchShadowRoot(vm, newCh) {
|
|
7054
7189
|
var renderRoot = vm.renderRoot,
|
|
7055
7190
|
oldCh = vm.children; // caching the new children collection
|
|
@@ -7067,7 +7202,7 @@
|
|
|
7067
7202
|
, vm);
|
|
7068
7203
|
}, function () {
|
|
7069
7204
|
// job
|
|
7070
|
-
patchChildren(
|
|
7205
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
7071
7206
|
}, function () {
|
|
7072
7207
|
// post
|
|
7073
7208
|
logOperationEnd(2
|
|
@@ -7128,13 +7263,13 @@
|
|
|
7128
7263
|
});
|
|
7129
7264
|
rehydrateQueue = []; // reset to a new queue
|
|
7130
7265
|
|
|
7131
|
-
for (var _i26 = 0,
|
|
7266
|
+
for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
|
|
7132
7267
|
var vm = vms[_i26];
|
|
7133
7268
|
|
|
7134
7269
|
try {
|
|
7135
7270
|
rehydrate(vm);
|
|
7136
7271
|
} catch (error) {
|
|
7137
|
-
if (_i26 + 1 <
|
|
7272
|
+
if (_i26 + 1 < _len8) {
|
|
7138
7273
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
7139
7274
|
if (rehydrateQueue.length === 0) {
|
|
7140
7275
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
@@ -7279,7 +7414,7 @@
|
|
|
7279
7414
|
|
|
7280
7415
|
|
|
7281
7416
|
function recursivelyDisconnectChildren(vnodes) {
|
|
7282
|
-
for (var _i28 = 0,
|
|
7417
|
+
for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
|
|
7283
7418
|
var vnode = vnodes[_i28];
|
|
7284
7419
|
|
|
7285
7420
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
@@ -7311,7 +7446,7 @@
|
|
|
7311
7446
|
var children = vm.children,
|
|
7312
7447
|
renderRoot = vm.renderRoot;
|
|
7313
7448
|
|
|
7314
|
-
for (var _i29 = 0,
|
|
7449
|
+
for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
|
|
7315
7450
|
var child = children[_i29];
|
|
7316
7451
|
|
|
7317
7452
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
@@ -7686,7 +7821,7 @@
|
|
|
7686
7821
|
function connectWireAdapters(vm) {
|
|
7687
7822
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
7688
7823
|
|
|
7689
|
-
for (var _i30 = 0,
|
|
7824
|
+
for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
|
|
7690
7825
|
wiredConnecting[_i30]();
|
|
7691
7826
|
}
|
|
7692
7827
|
}
|
|
@@ -7695,7 +7830,7 @@
|
|
|
7695
7830
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7696
7831
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7697
7832
|
// job
|
|
7698
|
-
for (var _i31 = 0,
|
|
7833
|
+
for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
|
|
7699
7834
|
wiredDisconnecting[_i31]();
|
|
7700
7835
|
}
|
|
7701
7836
|
}, noop);
|
|
@@ -7786,7 +7921,7 @@
|
|
|
7786
7921
|
hooksAreSet = true;
|
|
7787
7922
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7788
7923
|
}
|
|
7789
|
-
/* version: 2.
|
|
7924
|
+
/* version: 2.10.0 */
|
|
7790
7925
|
|
|
7791
7926
|
/*
|
|
7792
7927
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7813,6 +7948,7 @@
|
|
|
7813
7948
|
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
7814
7949
|
|
|
7815
7950
|
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
7951
|
+
var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
7816
7952
|
var styleElements = create(null);
|
|
7817
7953
|
var styleSheets = create(null);
|
|
7818
7954
|
var nodesToStyleSheets = new WeakMap();
|
|
@@ -7868,7 +8004,13 @@
|
|
|
7868
8004
|
}
|
|
7869
8005
|
|
|
7870
8006
|
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7871
|
-
|
|
8007
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
8008
|
+
// This is only supported in later versions of Chromium:
|
|
8009
|
+
// https://chromestatus.com/feature/5638996492288000
|
|
8010
|
+
target.adoptedStyleSheets.push(styleSheet);
|
|
8011
|
+
} else {
|
|
8012
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
|
|
8013
|
+
}
|
|
7872
8014
|
}
|
|
7873
8015
|
}
|
|
7874
8016
|
|
|
@@ -8168,6 +8310,177 @@
|
|
|
8168
8310
|
setSetText(setText);
|
|
8169
8311
|
setSsr(ssr);
|
|
8170
8312
|
setAddEventListener(addEventListener);
|
|
8313
|
+
/*
|
|
8314
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8315
|
+
* All rights reserved.
|
|
8316
|
+
* SPDX-License-Identifier: MIT
|
|
8317
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8318
|
+
*/
|
|
8319
|
+
|
|
8320
|
+
function resetShadowRootAndLightDom(element, Ctor) {
|
|
8321
|
+
if (element.shadowRoot) {
|
|
8322
|
+
var shadowRoot = element.shadowRoot;
|
|
8323
|
+
|
|
8324
|
+
while (!isNull(shadowRoot.firstChild)) {
|
|
8325
|
+
shadowRoot.removeChild(shadowRoot.firstChild);
|
|
8326
|
+
}
|
|
8327
|
+
}
|
|
8328
|
+
|
|
8329
|
+
if (Ctor.renderMode === 'light') {
|
|
8330
|
+
while (!isNull(element.firstChild)) {
|
|
8331
|
+
element.removeChild(element.firstChild);
|
|
8332
|
+
}
|
|
8333
|
+
}
|
|
8334
|
+
}
|
|
8335
|
+
|
|
8336
|
+
function createVMWithProps(element, Ctor, props) {
|
|
8337
|
+
createVM(element, Ctor, {
|
|
8338
|
+
mode: 'open',
|
|
8339
|
+
owner: null,
|
|
8340
|
+
tagName: element.tagName.toLowerCase()
|
|
8341
|
+
});
|
|
8342
|
+
|
|
8343
|
+
for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
|
|
8344
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
|
|
8345
|
+
key = _Object$entries2$_i[0],
|
|
8346
|
+
value = _Object$entries2$_i[1];
|
|
8347
|
+
|
|
8348
|
+
element[key] = value;
|
|
8349
|
+
}
|
|
8350
|
+
}
|
|
8351
|
+
|
|
8352
|
+
function hydrateComponent(element, Ctor) {
|
|
8353
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8354
|
+
|
|
8355
|
+
if (!(element instanceof Element)) {
|
|
8356
|
+
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8359
|
+
if (!isFunction$1(Ctor)) {
|
|
8360
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
8361
|
+
}
|
|
8362
|
+
|
|
8363
|
+
if (!isObject(props) || isNull(props)) {
|
|
8364
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
8365
|
+
}
|
|
8366
|
+
|
|
8367
|
+
if (getAssociatedVMIfPresent(element)) {
|
|
8368
|
+
/* eslint-disable-next-line no-console */
|
|
8369
|
+
console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
|
|
8370
|
+
return;
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8373
|
+
try {
|
|
8374
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8375
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8376
|
+
setIsHydrating(true);
|
|
8377
|
+
createVMWithProps(element, Ctor, props);
|
|
8378
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8379
|
+
|
|
8380
|
+
setIsHydrating(false);
|
|
8381
|
+
} catch (e) {
|
|
8382
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
8383
|
+
// with the client generated DOM.
|
|
8384
|
+
|
|
8385
|
+
/* eslint-disable-next-line no-console */
|
|
8386
|
+
console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
|
|
8387
|
+
|
|
8388
|
+
resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
8389
|
+
|
|
8390
|
+
createVMWithProps(element, Ctor, props);
|
|
8391
|
+
setIsHydrating(false);
|
|
8392
|
+
connectRootElement(element);
|
|
8393
|
+
} finally {
|
|
8394
|
+
// in case there's an error during recovery
|
|
8395
|
+
setIsHydrating(false);
|
|
8396
|
+
}
|
|
8397
|
+
}
|
|
8398
|
+
/*
|
|
8399
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8400
|
+
* All rights reserved.
|
|
8401
|
+
* SPDX-License-Identifier: MIT
|
|
8402
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8403
|
+
*/
|
|
8404
|
+
|
|
8405
|
+
/**
|
|
8406
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8407
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8408
|
+
*
|
|
8409
|
+
* @deprecated since version 1.3.11
|
|
8410
|
+
*
|
|
8411
|
+
* @example
|
|
8412
|
+
* ```
|
|
8413
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8414
|
+
* import Foo from 'ns/foo';
|
|
8415
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8416
|
+
* customElements.define('x-foo', WC);
|
|
8417
|
+
* const elm = document.createElement('x-foo');
|
|
8418
|
+
* ```
|
|
8419
|
+
*/
|
|
8420
|
+
|
|
8421
|
+
|
|
8422
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8423
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8424
|
+
/* eslint-disable-next-line no-console */
|
|
8425
|
+
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
|
|
8426
|
+
}
|
|
8427
|
+
|
|
8428
|
+
return Ctor.CustomElementConstructor;
|
|
8429
|
+
} // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
|
|
8430
|
+
// This WeakSet usage is valid because this functionality is not meant to run in IE11.
|
|
8431
|
+
|
|
8432
|
+
|
|
8433
|
+
var hydratedCustomElements = new WeakSet();
|
|
8434
|
+
|
|
8435
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8436
|
+
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
8437
|
+
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
8438
|
+
_inherits(_class, _HtmlPrototype);
|
|
8439
|
+
|
|
8440
|
+
var _super8 = _createSuper(_class);
|
|
8441
|
+
|
|
8442
|
+
function _class() {
|
|
8443
|
+
var _this6;
|
|
8444
|
+
|
|
8445
|
+
_classCallCheck(this, _class);
|
|
8446
|
+
|
|
8447
|
+
_this6 = _super8.call(this);
|
|
8448
|
+
|
|
8449
|
+
if (_this6.isConnected) {
|
|
8450
|
+
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
8451
|
+
hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
|
|
8452
|
+
hydratedCustomElements.add(_assertThisInitialized(_this6));
|
|
8453
|
+
} else {
|
|
8454
|
+
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
8455
|
+
mode: 'open',
|
|
8456
|
+
owner: null,
|
|
8457
|
+
tagName: _this6.tagName
|
|
8458
|
+
});
|
|
8459
|
+
}
|
|
8460
|
+
|
|
8461
|
+
return _this6;
|
|
8462
|
+
}
|
|
8463
|
+
|
|
8464
|
+
_createClass(_class, [{
|
|
8465
|
+
key: "connectedCallback",
|
|
8466
|
+
value: function connectedCallback() {
|
|
8467
|
+
if (hydratedCustomElements.has(this)) {
|
|
8468
|
+
// This is an un-upgraded element that was hydrated in the constructor.
|
|
8469
|
+
hydratedCustomElements.delete(this);
|
|
8470
|
+
} else {
|
|
8471
|
+
connectRootElement(this);
|
|
8472
|
+
}
|
|
8473
|
+
}
|
|
8474
|
+
}, {
|
|
8475
|
+
key: "disconnectedCallback",
|
|
8476
|
+
value: function disconnectedCallback() {
|
|
8477
|
+
disconnectRootElement(this);
|
|
8478
|
+
}
|
|
8479
|
+
}]);
|
|
8480
|
+
|
|
8481
|
+
return _class;
|
|
8482
|
+
}(HtmlPrototype);
|
|
8483
|
+
}
|
|
8171
8484
|
/*
|
|
8172
8485
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
8173
8486
|
* All rights reserved.
|
|
@@ -8177,6 +8490,7 @@
|
|
|
8177
8490
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
8178
8491
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
8179
8492
|
|
|
8493
|
+
|
|
8180
8494
|
var _Node$1 = Node;
|
|
8181
8495
|
var ConnectingSlot = new WeakMap();
|
|
8182
8496
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -8284,142 +8598,6 @@
|
|
|
8284
8598
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8285
8599
|
*/
|
|
8286
8600
|
|
|
8287
|
-
|
|
8288
|
-
function hydrateComponent(element, Ctor) {
|
|
8289
|
-
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8290
|
-
|
|
8291
|
-
if (!(element instanceof Element)) {
|
|
8292
|
-
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
8293
|
-
}
|
|
8294
|
-
|
|
8295
|
-
if (!isFunction$1(Ctor)) {
|
|
8296
|
-
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
8297
|
-
}
|
|
8298
|
-
|
|
8299
|
-
if (!isObject(props) || isNull(props)) {
|
|
8300
|
-
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
8301
|
-
}
|
|
8302
|
-
|
|
8303
|
-
try {
|
|
8304
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8305
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
8306
|
-
setIsHydrating(true);
|
|
8307
|
-
createVM(element, Ctor, {
|
|
8308
|
-
mode: 'open',
|
|
8309
|
-
owner: null,
|
|
8310
|
-
tagName: element.tagName.toLowerCase()
|
|
8311
|
-
});
|
|
8312
|
-
|
|
8313
|
-
for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
|
|
8314
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
|
|
8315
|
-
key = _Object$entries2$_i[0],
|
|
8316
|
-
value = _Object$entries2$_i[1];
|
|
8317
|
-
|
|
8318
|
-
element[key] = value;
|
|
8319
|
-
}
|
|
8320
|
-
|
|
8321
|
-
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8322
|
-
|
|
8323
|
-
setIsHydrating(false);
|
|
8324
|
-
} catch (e) {
|
|
8325
|
-
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8326
|
-
// the client generated DOM.
|
|
8327
|
-
|
|
8328
|
-
/* eslint-disable-next-line no-console */
|
|
8329
|
-
console.error('Recovering from error while hydrating: ', e);
|
|
8330
|
-
setIsHydrating(false);
|
|
8331
|
-
var newElem = createElement(element.tagName, {
|
|
8332
|
-
is: Ctor,
|
|
8333
|
-
mode: 'open'
|
|
8334
|
-
});
|
|
8335
|
-
|
|
8336
|
-
for (var _i34 = 0, _Object$entries3 = Object.entries(props); _i34 < _Object$entries3.length; _i34++) {
|
|
8337
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i34], 2),
|
|
8338
|
-
_key3 = _Object$entries3$_i[0],
|
|
8339
|
-
_value2 = _Object$entries3$_i[1];
|
|
8340
|
-
|
|
8341
|
-
newElem[_key3] = _value2;
|
|
8342
|
-
}
|
|
8343
|
-
|
|
8344
|
-
element.parentNode.replaceChild(newElem, element);
|
|
8345
|
-
}
|
|
8346
|
-
}
|
|
8347
|
-
/*
|
|
8348
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8349
|
-
* All rights reserved.
|
|
8350
|
-
* SPDX-License-Identifier: MIT
|
|
8351
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8352
|
-
*/
|
|
8353
|
-
|
|
8354
|
-
/**
|
|
8355
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8356
|
-
* registered as a new element via customElements.define() at any given time.
|
|
8357
|
-
*
|
|
8358
|
-
* @deprecated since version 1.3.11
|
|
8359
|
-
*
|
|
8360
|
-
* @example
|
|
8361
|
-
* ```
|
|
8362
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
8363
|
-
* import Foo from 'ns/foo';
|
|
8364
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
8365
|
-
* customElements.define('x-foo', WC);
|
|
8366
|
-
* const elm = document.createElement('x-foo');
|
|
8367
|
-
* ```
|
|
8368
|
-
*/
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8372
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
8373
|
-
/* eslint-disable-next-line no-console */
|
|
8374
|
-
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
|
|
8375
|
-
}
|
|
8376
|
-
|
|
8377
|
-
return Ctor.CustomElementConstructor;
|
|
8378
|
-
}
|
|
8379
|
-
|
|
8380
|
-
function buildCustomElementConstructor(Ctor) {
|
|
8381
|
-
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
8382
|
-
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
8383
|
-
_inherits(_class, _HtmlPrototype);
|
|
8384
|
-
|
|
8385
|
-
var _super8 = _createSuper(_class);
|
|
8386
|
-
|
|
8387
|
-
function _class() {
|
|
8388
|
-
var _this6;
|
|
8389
|
-
|
|
8390
|
-
_classCallCheck(this, _class);
|
|
8391
|
-
|
|
8392
|
-
_this6 = _super8.call(this);
|
|
8393
|
-
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
8394
|
-
mode: 'open',
|
|
8395
|
-
owner: null,
|
|
8396
|
-
tagName: _this6.tagName
|
|
8397
|
-
});
|
|
8398
|
-
return _this6;
|
|
8399
|
-
}
|
|
8400
|
-
|
|
8401
|
-
_createClass(_class, [{
|
|
8402
|
-
key: "connectedCallback",
|
|
8403
|
-
value: function connectedCallback() {
|
|
8404
|
-
connectRootElement(this);
|
|
8405
|
-
}
|
|
8406
|
-
}, {
|
|
8407
|
-
key: "disconnectedCallback",
|
|
8408
|
-
value: function disconnectedCallback() {
|
|
8409
|
-
disconnectRootElement(this);
|
|
8410
|
-
}
|
|
8411
|
-
}]);
|
|
8412
|
-
|
|
8413
|
-
return _class;
|
|
8414
|
-
}(HtmlPrototype);
|
|
8415
|
-
}
|
|
8416
|
-
/*
|
|
8417
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8418
|
-
* All rights reserved.
|
|
8419
|
-
* SPDX-License-Identifier: MIT
|
|
8420
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8421
|
-
*/
|
|
8422
|
-
|
|
8423
8601
|
/**
|
|
8424
8602
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
8425
8603
|
* This API is subject to change or being removed.
|
|
@@ -8519,7 +8697,7 @@
|
|
|
8519
8697
|
});
|
|
8520
8698
|
freeze(LightningElement);
|
|
8521
8699
|
seal(LightningElement.prototype);
|
|
8522
|
-
/* version: 2.
|
|
8700
|
+
/* version: 2.10.0 */
|
|
8523
8701
|
|
|
8524
8702
|
exports.LightningElement = LightningElement;
|
|
8525
8703
|
exports.__unstable__ProfilerControl = profilerControl;
|