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