lwc 2.9.0 → 2.11.1

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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +4353 -5789
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +4353 -5789
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3299 -4566
  5. package/dist/engine-dom/iife/es5/engine-dom.js +674 -505
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +542 -448
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +4353 -5789
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3299 -4566
  11. package/dist/engine-dom/umd/es5/engine-dom.js +674 -505
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +542 -448
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +4061 -5290
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +4061 -5290
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +2952 -3673
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +2952 -3673
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +2825 -3532
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +11 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +11 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +2952 -3673
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +2825 -3532
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +11 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +11 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +128 -174
  27. package/dist/wire-service/iife/es2017/wire-service.js +128 -174
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +128 -174
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +128 -174
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +128 -174
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. 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."); }
@@ -348,7 +348,7 @@
348
348
  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
349
349
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
350
350
  var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
351
- /** version: 2.9.0 */
351
+ /** version: 2.11.1 */
352
352
 
353
353
  /*
354
354
  * Copyright (c) 2018, salesforce.com, inc.
@@ -413,7 +413,7 @@
413
413
  };
414
414
  }
415
415
 
416
- function patch(propName) {
416
+ function patch$1(propName) {
417
417
  // Typescript is inferring the wrong function type for this particular
418
418
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
419
419
  // @ts-ignore type-mismatch
@@ -435,7 +435,7 @@
435
435
  var propName = ElementPrototypeAriaPropertyNames[_i2];
436
436
 
437
437
  if (detect(propName)) {
438
- patch(propName);
438
+ patch$1(propName);
439
439
  }
440
440
  }
441
441
  /**
@@ -451,14 +451,15 @@
451
451
 
452
452
 
453
453
  var features = {
454
- ENABLE_REACTIVE_SETTER: null,
455
- ENABLE_HMR: null,
456
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
457
454
  ENABLE_ELEMENT_PATCH: null,
458
455
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
459
- ENABLE_NODE_LIST_PATCH: null,
456
+ ENABLE_HMR: null,
460
457
  ENABLE_HTML_COLLECTIONS_PATCH: null,
458
+ ENABLE_INNER_OUTER_TEXT_PATCH: null,
459
+ ENABLE_MIXED_SHADOW_MODE: null,
460
+ ENABLE_NODE_LIST_PATCH: null,
461
461
  ENABLE_NODE_PATCH: null,
462
+ ENABLE_REACTIVE_SETTER: null,
462
463
  ENABLE_WIRE_SYNC_EMIT: null
463
464
  };
464
465
 
@@ -517,7 +518,7 @@
517
518
 
518
519
  function setFeatureFlagForTest(name, value) {
519
520
  }
520
- /** version: 2.9.0 */
521
+ /** version: 2.11.1 */
521
522
 
522
523
  /* proxy-compat-disable */
523
524
 
@@ -574,7 +575,7 @@
574
575
  }
575
576
 
576
577
  return result;
577
- } //
578
+ }
578
579
  // Primitives
579
580
  //
580
581
 
@@ -1053,6 +1054,7 @@
1053
1054
  * SPDX-License-Identifier: MIT
1054
1055
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1055
1056
  */
1057
+ // These properties get added to LWCElement.prototype publicProps automatically
1056
1058
 
1057
1059
  var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
1058
1060
 
@@ -2611,6 +2613,7 @@
2611
2613
 
2612
2614
 
2613
2615
  function registerTemplate(tpl) {
2616
+
2614
2617
  signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2615
2618
  // assignment of templates easily, without too much transformation
2616
2619
 
@@ -2633,6 +2636,7 @@
2633
2636
  * SPDX-License-Identifier: MIT
2634
2637
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2635
2638
  */
2639
+ // A bridge descriptor is a descriptor whose job is just to get the component instance
2636
2640
  // from the element instance, and get the value or set a new value on the component.
2637
2641
  // This means that across different elements, similar names can get the exact same
2638
2642
  // descriptor, so we can cache them:
@@ -3326,6 +3330,7 @@
3326
3330
  * SPDX-License-Identifier: MIT
3327
3331
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3328
3332
  */
3333
+ // The style property is a string when defined via an expression in the template.
3329
3334
 
3330
3335
 
3331
3336
  function patchStyleAttribute(oldVnode, vnode) {
@@ -3370,6 +3375,7 @@
3370
3375
  * SPDX-License-Identifier: MIT
3371
3376
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3372
3377
  */
3378
+ // The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
3373
3379
  // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
3374
3380
  // different classnames properties individually instead of via a string.
3375
3381
 
@@ -3394,6 +3400,7 @@
3394
3400
  * SPDX-License-Identifier: MIT
3395
3401
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3396
3402
  */
3403
+ // The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
3397
3404
  // The compiler takes care of transforming the inline style into an object. It's faster to set the
3398
3405
  // different style properties individually instead of via a string.
3399
3406
 
@@ -3423,138 +3430,245 @@
3423
3430
  */
3424
3431
 
3425
3432
 
3426
- var TextHook = {
3427
- create: function create(vnode) {
3428
- var owner = vnode.owner;
3429
- var elm = createText$1(vnode.text);
3430
- linkNodeToShadow(elm, owner);
3431
- vnode.elm = elm;
3432
- },
3433
- update: updateNodeHook,
3434
- insert: insertNode,
3435
- move: insertNode,
3436
- remove: removeNode
3437
- };
3438
- var CommentHook = {
3439
- create: function create(vnode) {
3440
- var owner = vnode.owner,
3441
- text = vnode.text;
3442
- var elm = createComment$1(text);
3443
- linkNodeToShadow(elm, owner);
3444
- vnode.elm = elm;
3445
- },
3446
- update: updateNodeHook,
3447
- insert: insertNode,
3448
- move: insertNode,
3449
- remove: removeNode
3450
- }; // insert is called after update, which is used somewhere else (via a module)
3451
- // to mark the vm as inserted, that means we cannot use update as the main channel
3452
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
3453
- // which breaks some invariants. For that reason, we have the following for any
3454
- // Custom Element that is inserted via a template.
3455
-
3456
- var ElementHook = {
3457
- create: function create(vnode) {
3458
- var sel = vnode.sel,
3459
- owner = vnode.owner,
3460
- svg = vnode.data.svg;
3461
- var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3462
- var elm = createElement$2(sel, namespace);
3463
- linkNodeToShadow(elm, owner);
3464
- fallbackElmHook(elm, vnode);
3465
- vnode.elm = elm;
3466
- patchElementPropsAndAttrs$1(null, vnode);
3467
- },
3468
- update: function update(oldVnode, vnode) {
3469
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3470
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3471
- },
3472
- insert: function insert(vnode, parentNode, referenceNode) {
3473
- insertNode(vnode, parentNode, referenceNode);
3474
- createChildrenHook(vnode);
3475
- },
3476
- move: insertNode,
3477
- remove: function remove(vnode, parentNode) {
3478
- removeNode(vnode, parentNode);
3479
- removeChildren(vnode);
3433
+ function patchChildren(c1, c2, parent) {
3434
+ if (hasDynamicChildren(c2)) {
3435
+ updateDynamicChildren(c1, c2, parent);
3436
+ } else {
3437
+ updateStaticChildren(c1, c2, parent);
3480
3438
  }
3481
- };
3482
- var CustomElementHook = {
3483
- create: function create(vnode) {
3484
- var sel = vnode.sel,
3485
- owner = vnode.owner;
3486
- var UpgradableConstructor = getUpgradableConstructor(sel);
3487
- /**
3488
- * Note: if the upgradable constructor does not expect, or throw when we new it
3489
- * with a callback as the first argument, we could implement a more advanced
3490
- * mechanism that only passes that argument if the constructor is known to be
3491
- * an upgradable custom element.
3492
- */
3439
+ }
3493
3440
 
3494
- var vm;
3495
- var elm = new UpgradableConstructor(function (elm) {
3496
- // the custom element from the registry is expecting an upgrade callback
3497
- vm = createViewModelHook(elm, vnode);
3498
- });
3499
- linkNodeToShadow(elm, owner);
3500
- vnode.elm = elm;
3441
+ function patch(n1, n2) {
3442
+ if (n1 === n2) {
3443
+ return;
3444
+ }
3501
3445
 
3502
- if (vm) {
3503
- allocateChildren(vnode, vm);
3504
- } else if (vnode.ctor !== UpgradableConstructor) {
3505
- throw new TypeError("Incorrect Component Constructor");
3506
- }
3446
+ switch (n2.type) {
3447
+ case 0
3448
+ /* Text */
3449
+ :
3450
+ patchText(n1, n2);
3451
+ break;
3507
3452
 
3508
- patchElementPropsAndAttrs$1(null, vnode);
3509
- },
3510
- update: function update(oldVnode, vnode) {
3511
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3512
- var vm = getAssociatedVMIfPresent(vnode.elm);
3453
+ case 1
3454
+ /* Comment */
3455
+ :
3456
+ patchComment(n1, n2);
3457
+ break;
3513
3458
 
3514
- if (vm) {
3515
- // in fallback mode, the allocation will always set children to
3516
- // empty and delegate the real allocation to the slot elements
3517
- allocateChildren(vnode, vm);
3518
- } // in fallback mode, the children will be always empty, so, nothing
3519
- // will happen, but in native, it does allocate the light dom
3459
+ case 2
3460
+ /* Element */
3461
+ :
3462
+ patchElement(n1, n2);
3463
+ break;
3520
3464
 
3465
+ case 3
3466
+ /* CustomElement */
3467
+ :
3468
+ patchCustomElement(n1, n2);
3469
+ break;
3470
+ }
3471
+ }
3521
3472
 
3522
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3473
+ function mount(node, parent, anchor) {
3474
+ switch (node.type) {
3475
+ case 0
3476
+ /* Text */
3477
+ :
3478
+ mountText(node, parent, anchor);
3479
+ break;
3523
3480
 
3524
- if (vm) {
3525
- // this is important to preserve the top to bottom synchronous rendering phase.
3481
+ case 1
3482
+ /* Comment */
3483
+ :
3484
+ mountComment(node, parent, anchor);
3485
+ break;
3526
3486
 
3487
+ case 2
3488
+ /* Element */
3489
+ :
3490
+ mountElement(node, parent, anchor);
3491
+ break;
3527
3492
 
3528
- rerenderVM(vm);
3529
- }
3530
- },
3531
- insert: function insert(vnode, parentNode, referenceNode) {
3532
- insertNode(vnode, parentNode, referenceNode);
3533
- var vm = getAssociatedVMIfPresent(vnode.elm);
3493
+ case 3
3494
+ /* CustomElement */
3495
+ :
3496
+ mountCustomElement(node, parent, anchor);
3497
+ break;
3498
+ }
3499
+ }
3534
3500
 
3535
- if (vm) {
3501
+ function patchText(n1, n2) {
3502
+ n2.elm = n1.elm;
3536
3503
 
3537
- runConnectedCallback(vm);
3538
- }
3504
+ if (n2.text !== n1.text) {
3505
+ updateTextContent(n2);
3506
+ }
3507
+ }
3539
3508
 
3540
- createChildrenHook(vnode);
3509
+ function mountText(node, parent, anchor) {
3510
+ var owner = node.owner;
3511
+ var textNode = node.elm = createText$1(node.text);
3512
+ linkNodeToShadow(textNode, owner);
3513
+ insertNode(textNode, parent, anchor);
3514
+ }
3515
+
3516
+ function patchComment(n1, n2) {
3517
+ n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3518
+ // it is the case today.
3519
+
3520
+ if (n2.text !== n1.text) {
3521
+ updateTextContent(n2);
3522
+ }
3523
+ }
3524
+
3525
+ function mountComment(node, parent, anchor) {
3526
+ var owner = node.owner;
3527
+ var commentNode = node.elm = createComment$1(node.text);
3528
+ linkNodeToShadow(commentNode, owner);
3529
+ insertNode(commentNode, parent, anchor);
3530
+ }
3531
+
3532
+ function mountElement(vnode, parent, anchor) {
3533
+ var sel = vnode.sel,
3534
+ owner = vnode.owner,
3535
+ svg = vnode.data.svg;
3536
+ var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3537
+ var elm = createElement$2(sel, namespace);
3538
+ linkNodeToShadow(elm, owner);
3539
+ fallbackElmHook(elm, vnode);
3540
+ vnode.elm = elm;
3541
+ patchElementPropsAndAttrs$1(null, vnode);
3542
+ insertNode(elm, parent, anchor);
3543
+ mountVNodes(vnode.children, elm, null);
3544
+ }
3545
+
3546
+ function patchElement(n1, n2) {
3547
+ var elm = n2.elm = n1.elm;
3548
+ patchElementPropsAndAttrs$1(n1, n2);
3549
+ patchChildren(n1.children, n2.children, elm);
3550
+ }
3551
+
3552
+ function mountCustomElement(vnode, parent, anchor) {
3553
+ var sel = vnode.sel,
3554
+ owner = vnode.owner;
3555
+ var UpgradableConstructor = getUpgradableConstructor(sel);
3556
+ /**
3557
+ * Note: if the upgradable constructor does not expect, or throw when we new it
3558
+ * with a callback as the first argument, we could implement a more advanced
3559
+ * mechanism that only passes that argument if the constructor is known to be
3560
+ * an upgradable custom element.
3561
+ */
3562
+
3563
+ var vm;
3564
+ var elm = new UpgradableConstructor(function (elm) {
3565
+ // the custom element from the registry is expecting an upgrade callback
3566
+ vm = createViewModelHook(elm, vnode);
3567
+ });
3568
+ linkNodeToShadow(elm, owner);
3569
+ vnode.elm = elm;
3570
+ vnode.vm = vm;
3571
+
3572
+ if (vm) {
3573
+ allocateChildren(vnode, vm);
3574
+ } else if (vnode.ctor !== UpgradableConstructor) {
3575
+ throw new TypeError("Incorrect Component Constructor");
3576
+ }
3577
+
3578
+ patchElementPropsAndAttrs$1(null, vnode);
3579
+ insertNode(elm, parent, anchor);
3580
+
3581
+ if (vm) {
3582
+
3583
+ runConnectedCallback(vm);
3584
+ }
3585
+
3586
+ mountVNodes(vnode.children, elm, null);
3587
+
3588
+ if (vm) {
3589
+ appendVM(vm);
3590
+ }
3591
+ }
3541
3592
 
3542
- if (vm) {
3543
- appendVM(vm);
3593
+ function patchCustomElement(n1, n2) {
3594
+ var elm = n2.elm = n1.elm;
3595
+ var vm = n2.vm = n1.vm;
3596
+ patchElementPropsAndAttrs$1(n1, n2);
3597
+
3598
+ if (!isUndefined$1(vm)) {
3599
+ // in fallback mode, the allocation will always set children to
3600
+ // empty and delegate the real allocation to the slot elements
3601
+ allocateChildren(n2, vm);
3602
+ } // in fallback mode, the children will be always empty, so, nothing
3603
+ // will happen, but in native, it does allocate the light dom
3604
+
3605
+
3606
+ patchChildren(n1.children, n2.children, elm);
3607
+
3608
+ if (!isUndefined$1(vm)) {
3609
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3610
+ // this is important to preserve the top to bottom synchronous rendering phase.
3611
+ rerenderVM(vm);
3612
+ }
3613
+ }
3614
+
3615
+ function mountVNodes(vnodes, parent, anchor) {
3616
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3617
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3618
+
3619
+ for (; start < end; ++start) {
3620
+ var vnode = vnodes[start];
3621
+
3622
+ if (isVNode(vnode)) {
3623
+ mount(vnode, parent, anchor);
3544
3624
  }
3545
- },
3546
- move: insertNode,
3547
- remove: function remove(vnode, parentNode) {
3548
- removeNode(vnode, parentNode);
3549
- var vm = getAssociatedVMIfPresent(vnode.elm);
3550
-
3551
- if (vm) {
3552
- // for custom elements we don't have to go recursively because the removeVM routine
3553
- // will take care of disconnecting any child VM attached to its shadow as well.
3554
- removeVM(vm);
3625
+ }
3626
+ }
3627
+
3628
+ function unmount(vnode, parent) {
3629
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3630
+ var type = vnode.type,
3631
+ elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3632
+ // subtree root, is the only element worth unmounting from the subtree.
3633
+
3634
+ if (doRemove) {
3635
+ removeNode(elm, parent);
3636
+ }
3637
+
3638
+ switch (type) {
3639
+ case 2
3640
+ /* Element */
3641
+ :
3642
+ unmountVNodes(vnode.children, elm);
3643
+ break;
3644
+
3645
+ case 3
3646
+ /* CustomElement */
3647
+ :
3648
+ {
3649
+ var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
3650
+ // children.
3651
+
3652
+ if (!isUndefined$1(vm)) {
3653
+ removeVM(vm);
3654
+ }
3655
+ }
3656
+ }
3657
+ }
3658
+
3659
+ function unmountVNodes(vnodes, parent) {
3660
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3661
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3662
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3663
+
3664
+ for (; start < end; ++start) {
3665
+ var ch = vnodes[start];
3666
+
3667
+ if (isVNode(ch)) {
3668
+ unmount(ch, parent, doRemove);
3555
3669
  }
3556
3670
  }
3557
- };
3671
+ }
3558
3672
 
3559
3673
  function isVNode(vnode) {
3560
3674
  return vnode != null;
@@ -3595,24 +3709,21 @@
3595
3709
  }
3596
3710
  }
3597
3711
 
3598
- function updateNodeHook(oldVnode, vnode) {
3712
+ function updateTextContent(vnode) {
3599
3713
  var elm = vnode.elm,
3600
3714
  text = vnode.text;
3601
3715
 
3602
- if (oldVnode.text !== text) {
3603
-
3604
- setText$1(elm, text);
3605
- }
3716
+ setText$1(elm, text);
3606
3717
  }
3607
3718
 
3608
- function insertNode(vnode, parentNode, referenceNode) {
3719
+ function insertNode(node, parent, anchor) {
3609
3720
 
3610
- insert$1(vnode.elm, parentNode, referenceNode);
3721
+ insert$1(node, parent, anchor);
3611
3722
  }
3612
3723
 
3613
- function removeNode(vnode, parentNode) {
3724
+ function removeNode(node, parent) {
3614
3725
 
3615
- remove$1(vnode.elm, parentNode);
3726
+ remove$1(node, parent);
3616
3727
  }
3617
3728
 
3618
3729
  function patchElementPropsAndAttrs$1(oldVnode, vnode) {
@@ -3655,14 +3766,6 @@
3655
3766
  }
3656
3767
  }
3657
3768
 
3658
- function patchChildren(parent, oldCh, newCh) {
3659
- if (hasDynamicChildren(newCh)) {
3660
- updateDynamicChildren(parent, oldCh, newCh);
3661
- } else {
3662
- updateStaticChildren(parent, oldCh, newCh);
3663
- }
3664
- }
3665
-
3666
3769
  function allocateChildren(vnode, vm) {
3667
3770
  // A component with slots will re-render because:
3668
3771
  // 1- There is a change of the internal state.
@@ -3728,43 +3831,13 @@
3728
3831
  return vm;
3729
3832
  }
3730
3833
 
3731
- function createChildrenHook(vnode) {
3732
- var elm = vnode.elm,
3733
- children = vnode.children;
3734
-
3735
- for (var j = 0; j < children.length; ++j) {
3736
- var ch = children[j];
3737
-
3738
- if (ch != null) {
3739
- ch.hook.create(ch);
3740
- ch.hook.insert(ch, elm, null);
3741
- }
3742
- }
3743
- }
3744
-
3745
- function removeChildren(vnode) {
3746
- // this method only needs to search on child vnodes from template
3747
- // to trigger the remove hook just in case some of those children
3748
- // are custom elements.
3749
- var children = vnode.children,
3750
- elm = vnode.elm;
3751
-
3752
- for (var j = 0, _len5 = children.length; j < _len5; ++j) {
3753
- var ch = children[j];
3754
-
3755
- if (!isNull(ch)) {
3756
- ch.hook.remove(ch, elm);
3757
- }
3758
- }
3759
- }
3760
-
3761
3834
  function allocateInSlot(vm, children) {
3762
3835
  var _a;
3763
3836
 
3764
3837
  var oldSlots = vm.cmpSlots;
3765
3838
  var cmpSlots = vm.cmpSlots = create(null);
3766
3839
 
3767
- for (var _i13 = 0, _len6 = children.length; _i13 < _len6; _i13 += 1) {
3840
+ for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
3768
3841
  var vnode = children[_i13];
3769
3842
 
3770
3843
  if (isNull(vnode)) {
@@ -3799,7 +3872,7 @@
3799
3872
  return;
3800
3873
  }
3801
3874
 
3802
- for (var _i14 = 0, _len7 = oldKeys.length; _i14 < _len7; _i14 += 1) {
3875
+ for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
3803
3876
  var key = oldKeys[_i14];
3804
3877
 
3805
3878
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
@@ -3850,28 +3923,7 @@
3850
3923
  return map;
3851
3924
  }
3852
3925
 
3853
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
3854
- for (; startIdx <= endIdx; ++startIdx) {
3855
- var ch = vnodes[startIdx];
3856
-
3857
- if (isVNode(ch)) {
3858
- ch.hook.create(ch);
3859
- ch.hook.insert(ch, parentElm, before);
3860
- }
3861
- }
3862
- }
3863
-
3864
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
3865
- for (; startIdx <= endIdx; ++startIdx) {
3866
- var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
3867
-
3868
- if (isVNode(ch)) {
3869
- ch.hook.remove(ch, parentElm);
3870
- }
3871
- }
3872
- }
3873
-
3874
- function updateDynamicChildren(parentElm, oldCh, newCh) {
3926
+ function updateDynamicChildren(oldCh, newCh, parent) {
3875
3927
  var oldStartIdx = 0;
3876
3928
  var newStartIdx = 0;
3877
3929
  var oldEndIdx = oldCh.length - 1;
@@ -3897,23 +3949,23 @@
3897
3949
  } else if (!isVNode(newEndVnode)) {
3898
3950
  newEndVnode = newCh[--newEndIdx];
3899
3951
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
3900
- patchVnode(oldStartVnode, newStartVnode);
3952
+ patch(oldStartVnode, newStartVnode);
3901
3953
  oldStartVnode = oldCh[++oldStartIdx];
3902
3954
  newStartVnode = newCh[++newStartIdx];
3903
3955
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
3904
- patchVnode(oldEndVnode, newEndVnode);
3956
+ patch(oldEndVnode, newEndVnode);
3905
3957
  oldEndVnode = oldCh[--oldEndIdx];
3906
3958
  newEndVnode = newCh[--newEndIdx];
3907
3959
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
3908
3960
  // Vnode moved right
3909
- patchVnode(oldStartVnode, newEndVnode);
3910
- newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
3961
+ patch(oldStartVnode, newEndVnode);
3962
+ insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
3911
3963
  oldStartVnode = oldCh[++oldStartIdx];
3912
3964
  newEndVnode = newCh[--newEndIdx];
3913
3965
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
3914
3966
  // Vnode moved left
3915
- patchVnode(oldEndVnode, newStartVnode);
3916
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
3967
+ patch(oldEndVnode, newStartVnode);
3968
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
3917
3969
  oldEndVnode = oldCh[--oldEndIdx];
3918
3970
  newStartVnode = newCh[++newStartIdx];
3919
3971
  } else {
@@ -3925,8 +3977,7 @@
3925
3977
 
3926
3978
  if (isUndefined$1(idxInOld)) {
3927
3979
  // New element
3928
- newStartVnode.hook.create(newStartVnode);
3929
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3980
+ mount(newStartVnode, parent, oldStartVnode.elm);
3930
3981
  newStartVnode = newCh[++newStartIdx];
3931
3982
  } else {
3932
3983
  elmToMove = oldCh[idxInOld];
@@ -3934,10 +3985,9 @@
3934
3985
  if (isVNode(elmToMove)) {
3935
3986
  if (elmToMove.sel !== newStartVnode.sel) {
3936
3987
  // New element
3937
- newStartVnode.hook.create(newStartVnode);
3938
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3988
+ mount(newStartVnode, parent, oldStartVnode.elm);
3939
3989
  } else {
3940
- patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3990
+ patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3941
3991
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3942
3992
  // so we only care about the `oldCh` object inside this function.
3943
3993
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -3950,7 +4000,7 @@
3950
4000
 
3951
4001
 
3952
4002
  oldCh[idxInOld] = undefined;
3953
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
4003
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm);
3954
4004
  }
3955
4005
  }
3956
4006
 
@@ -3971,65 +4021,55 @@
3971
4021
  } while (!isVNode(n) && _i15 < newChEnd);
3972
4022
 
3973
4023
  before = isVNode(n) ? n.elm : null;
3974
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
4024
+ mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
3975
4025
  } else {
3976
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
4026
+ unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
3977
4027
  }
3978
4028
  }
3979
4029
  }
3980
4030
 
3981
- function updateStaticChildren(parentElm, oldCh, newCh) {
3982
- var oldChLength = oldCh.length;
3983
- var newChLength = newCh.length;
4031
+ function updateStaticChildren(c1, c2, parent) {
4032
+ var c1Length = c1.length;
4033
+ var c2Length = c2.length;
3984
4034
 
3985
- if (oldChLength === 0) {
4035
+ if (c1Length === 0) {
3986
4036
  // the old list is empty, we can directly insert anything new
3987
- addVnodes(parentElm, null, newCh, 0, newChLength);
4037
+ mountVNodes(c2, parent, null);
3988
4038
  return;
3989
4039
  }
3990
4040
 
3991
- if (newChLength === 0) {
4041
+ if (c2Length === 0) {
3992
4042
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
3993
4043
  // this is the case in which the dynamic children of an if-directive should be removed
3994
- removeVnodes(parentElm, oldCh, 0, oldChLength);
4044
+ unmountVNodes(c1, parent, true);
3995
4045
  return;
3996
4046
  } // if the old list is not empty, the new list MUST have the same
3997
4047
  // amount of nodes, that's why we call this static children
3998
4048
 
3999
4049
 
4000
- var referenceElm = null;
4050
+ var anchor = null;
4001
4051
 
4002
- for (var _i16 = newChLength - 1; _i16 >= 0; _i16 -= 1) {
4003
- var vnode = newCh[_i16];
4004
- var oldVNode = oldCh[_i16];
4052
+ for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
4053
+ var n1 = c1[_i16];
4054
+ var n2 = c2[_i16];
4005
4055
 
4006
- if (vnode !== oldVNode) {
4007
- if (isVNode(oldVNode)) {
4008
- if (isVNode(vnode)) {
4009
- // both vnodes must be equivalent, and se just need to patch them
4010
- patchVnode(oldVNode, vnode);
4011
- referenceElm = vnode.elm;
4056
+ if (n2 !== n1) {
4057
+ if (isVNode(n1)) {
4058
+ if (isVNode(n2)) {
4059
+ // both vnodes are equivalent, and we just need to patch them
4060
+ patch(n1, n2);
4061
+ anchor = n2.elm;
4012
4062
  } else {
4013
4063
  // removing the old vnode since the new one is null
4014
- oldVNode.hook.remove(oldVNode, parentElm);
4064
+ unmount(n1, parent, true);
4015
4065
  }
4016
- } else if (isVNode(vnode)) {
4017
- // this condition is unnecessary
4018
- vnode.hook.create(vnode); // insert the new node one since the old one is null
4019
-
4020
- vnode.hook.insert(vnode, parentElm, referenceElm);
4021
- referenceElm = vnode.elm;
4066
+ } else if (isVNode(n2)) {
4067
+ mount(n2, parent, anchor);
4068
+ anchor = n2.elm;
4022
4069
  }
4023
4070
  }
4024
4071
  }
4025
4072
  }
4026
-
4027
- function patchVnode(oldVnode, vnode) {
4028
- if (oldVnode !== vnode) {
4029
- vnode.elm = oldVnode.elm;
4030
- vnode.hook.update(oldVnode, vnode);
4031
- }
4032
- }
4033
4073
  /*
4034
4074
  * Copyright (c) 2018, salesforce.com, inc.
4035
4075
  * All rights reserved.
@@ -4060,7 +4100,6 @@
4060
4100
  children: children,
4061
4101
  elm: elm,
4062
4102
  key: key,
4063
- hook: ElementHook,
4064
4103
  owner: vmBeingRendered
4065
4104
  };
4066
4105
  } // [t]ab[i]ndex function
@@ -4109,7 +4148,7 @@
4109
4148
  var vmBeingRendered = getVMBeingRendered();
4110
4149
 
4111
4150
  var key = data.key;
4112
- var elm;
4151
+ var elm, aChildren, vm;
4113
4152
  var vnode = {
4114
4153
  type: 3
4115
4154
  /* CustomElement */
@@ -4119,11 +4158,11 @@
4119
4158
  children: children,
4120
4159
  elm: elm,
4121
4160
  key: key,
4122
- hook: CustomElementHook,
4123
4161
  ctor: Ctor,
4124
4162
  owner: vmBeingRendered,
4125
- mode: 'open' // TODO [#1294]: this should be defined in Ctor
4126
-
4163
+ mode: 'open',
4164
+ aChildren: aChildren,
4165
+ vm: vm
4127
4166
  };
4128
4167
  addVNodeToChildLWC(vnode);
4129
4168
  return vnode;
@@ -4204,7 +4243,6 @@
4204
4243
  text: text,
4205
4244
  elm: elm,
4206
4245
  key: key,
4207
- hook: TextHook,
4208
4246
  owner: getVMBeingRendered()
4209
4247
  };
4210
4248
  } // [co]mment node
@@ -4220,7 +4258,6 @@
4220
4258
  text: text,
4221
4259
  elm: elm,
4222
4260
  key: key,
4223
- hook: CommentHook,
4224
4261
  owner: getVMBeingRendered()
4225
4262
  };
4226
4263
  } // [d]ynamic text
@@ -4915,11 +4952,17 @@
4915
4952
  * will prevent this function from being imported by userland code.
4916
4953
  */
4917
4954
 
4918
- function registerComponent(Ctor, _ref2) {
4955
+ function registerComponent( // We typically expect a LightningElementConstructor, but technically you can call this with anything
4956
+ Ctor, _ref2) {
4919
4957
  var tmpl = _ref2.tmpl;
4920
- signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
4958
+
4959
+ if (isFunction$1(Ctor)) {
4960
+
4961
+ signedTemplateMap.set(Ctor, tmpl);
4962
+ } // chaining this method as a way to wrap existing assignment of component constructor easily,
4921
4963
  // without too much transformation
4922
4964
 
4965
+
4923
4966
  return Ctor;
4924
4967
  }
4925
4968
 
@@ -5010,7 +5053,7 @@
5010
5053
  def = vm.def,
5011
5054
  context = vm.context;
5012
5055
 
5013
- for (var _i22 = 0, _len8 = cbs.length; _i22 < _len8; ++_i22) {
5056
+ for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
5014
5057
  cbs[_i22].call(undefined, component, {}, def, context);
5015
5058
  }
5016
5059
  }
@@ -5022,7 +5065,7 @@
5022
5065
  */
5023
5066
 
5024
5067
 
5025
- function hydrate$1(vnode, node) {
5068
+ function hydrate(vnode, node) {
5026
5069
  switch (vnode.type) {
5027
5070
  case 0
5028
5071
  /* Text */
@@ -5054,7 +5097,7 @@
5054
5097
  var _a;
5055
5098
 
5056
5099
 
5057
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5100
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5058
5101
  vnode.elm = node;
5059
5102
  }
5060
5103
 
@@ -5062,7 +5105,7 @@
5062
5105
  var _a;
5063
5106
 
5064
5107
 
5065
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5108
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5066
5109
  vnode.elm = node;
5067
5110
  }
5068
5111
 
@@ -5081,13 +5124,13 @@
5081
5124
  var props = vnode.data.props;
5082
5125
 
5083
5126
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5084
- if (elm.innerHTML === props.innerHTML) {
5127
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5085
5128
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5086
5129
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
5087
5130
  props: cloneAndOmitKey(props, 'innerHTML')
5088
5131
  });
5089
5132
  } else {
5090
- logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5133
+ logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5091
5134
  }
5092
5135
  }
5093
5136
  }
@@ -5095,14 +5138,13 @@
5095
5138
  patchElementPropsAndAttrs(vnode);
5096
5139
 
5097
5140
  if (!isDomManual) {
5098
- hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);
5141
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5099
5142
  }
5100
5143
  }
5101
5144
 
5102
5145
  function hydrateCustomElement(vnode, node) {
5103
5146
 
5104
5147
  var elm = node;
5105
- vnode.elm = elm;
5106
5148
  var sel = vnode.sel,
5107
5149
  mode = vnode.mode,
5108
5150
  ctor = vnode.ctor,
@@ -5112,6 +5154,8 @@
5112
5154
  owner: owner,
5113
5155
  tagName: sel
5114
5156
  });
5157
+ vnode.elm = elm;
5158
+ vnode.vm = vm;
5115
5159
  allocateChildren(vnode, vm);
5116
5160
  patchElementPropsAndAttrs(vnode); // Insert hook section:
5117
5161
 
@@ -5122,7 +5166,7 @@
5122
5166
  ) {
5123
5167
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5124
5168
  // Note: for Light DOM, this is handled while hydrating the VM
5125
- hydrateChildren(vnode.elm.childNodes, vnode.children);
5169
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5126
5170
  }
5127
5171
 
5128
5172
  hydrateVM(vm);
@@ -5137,7 +5181,7 @@
5137
5181
 
5138
5182
  if (!isNull(childVnode)) {
5139
5183
  var childNode = elmChildren[childNodeIndex];
5140
- hydrate$1(childVnode, childNode);
5184
+ hydrate(childVnode, childNode);
5141
5185
  childNodeIndex++;
5142
5186
  }
5143
5187
  }
@@ -5213,7 +5257,19 @@
5213
5257
  }
5214
5258
 
5215
5259
  function hydrateVM(vm) {
5216
- hydrate(vm);
5260
+ if (isTrue(vm.isDirty)) {
5261
+ // manually diffing/patching here.
5262
+ // This routine is:
5263
+ // patchShadowRoot(vm, children);
5264
+ // -> addVnodes.
5265
+ var children = renderComponent(vm);
5266
+ vm.children = children;
5267
+ var vmChildren = vm.renderMode === 0
5268
+ /* Light */
5269
+ ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5270
+ hydrateChildren(vmChildren, children);
5271
+ runRenderedCallback(vm);
5272
+ }
5217
5273
  } // just in case the component comes back, with this we guarantee re-rendering it
5218
5274
  // while preventing any attempt to rehydration until after reinsertion.
5219
5275
 
@@ -5333,30 +5389,38 @@
5333
5389
  /* Native */
5334
5390
  ;
5335
5391
  } else if (isNativeShadowDefined$1) {
5336
- if (def.shadowSupportMode === "any"
5337
- /* Any */
5338
- ) {
5339
- shadowMode = 0
5340
- /* Native */
5341
- ;
5342
- } else {
5343
- var shadowAncestor = getNearestShadowAncestor(vm);
5344
-
5345
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5346
- /* Native */
5392
+ // Not combined with above condition because @lwc/features only supports identifiers in
5393
+ // the if-condition.
5394
+ if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5395
+ if (def.shadowSupportMode === "any"
5396
+ /* Any */
5347
5397
  ) {
5348
- // Transitive support for native Shadow DOM. A component in native mode
5349
- // transitively opts all of its descendants into native.
5350
5398
  shadowMode = 0
5351
5399
  /* Native */
5352
5400
  ;
5353
5401
  } else {
5354
- // Synthetic if neither this component nor any of its ancestors are configured
5355
- // to be native.
5356
- shadowMode = 1
5357
- /* Synthetic */
5358
- ;
5402
+ var shadowAncestor = getNearestShadowAncestor(vm);
5403
+
5404
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5405
+ /* Native */
5406
+ ) {
5407
+ // Transitive support for native Shadow DOM. A component in native mode
5408
+ // transitively opts all of its descendants into native.
5409
+ shadowMode = 0
5410
+ /* Native */
5411
+ ;
5412
+ } else {
5413
+ // Synthetic if neither this component nor any of its ancestors are configured
5414
+ // to be native.
5415
+ shadowMode = 1
5416
+ /* Synthetic */
5417
+ ;
5418
+ }
5359
5419
  }
5420
+ } else {
5421
+ shadowMode = 1
5422
+ /* Synthetic */
5423
+ ;
5360
5424
  }
5361
5425
  } else {
5362
5426
  // Synthetic if there is no native Shadow DOM support.
@@ -5397,22 +5461,6 @@
5397
5461
  }
5398
5462
  }
5399
5463
 
5400
- function hydrate(vm) {
5401
- if (isTrue(vm.isDirty)) {
5402
- // manually diffing/patching here.
5403
- // This routine is:
5404
- // patchShadowRoot(vm, children);
5405
- // -> addVnodes.
5406
- var children = renderComponent(vm);
5407
- vm.children = children;
5408
- var vmChildren = vm.renderMode === 0
5409
- /* Light */
5410
- ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
5411
- hydrateChildren(vmChildren, children);
5412
- runRenderedCallback(vm);
5413
- }
5414
- }
5415
-
5416
5464
  function patchShadowRoot(vm, newCh) {
5417
5465
  var renderRoot = vm.renderRoot,
5418
5466
  oldCh = vm.children; // caching the new children collection
@@ -5430,7 +5478,7 @@
5430
5478
  , vm);
5431
5479
  }, function () {
5432
5480
  // job
5433
- patchChildren(renderRoot, oldCh, newCh);
5481
+ patchChildren(oldCh, newCh, renderRoot);
5434
5482
  }, function () {
5435
5483
  // post
5436
5484
  logOperationEnd(2
@@ -5487,13 +5535,13 @@
5487
5535
  });
5488
5536
  rehydrateQueue = []; // reset to a new queue
5489
5537
 
5490
- for (var _i26 = 0, _len9 = vms.length; _i26 < _len9; _i26 += 1) {
5538
+ for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
5491
5539
  var vm = vms[_i26];
5492
5540
 
5493
5541
  try {
5494
5542
  rehydrate(vm);
5495
5543
  } catch (error) {
5496
- if (_i26 + 1 < _len9) {
5544
+ if (_i26 + 1 < _len8) {
5497
5545
  // pieces of the queue are still pending to be rehydrated, those should have priority
5498
5546
  if (rehydrateQueue.length === 0) {
5499
5547
  addCallbackToNextTick(flushRehydrationQueue);
@@ -5633,7 +5681,7 @@
5633
5681
 
5634
5682
 
5635
5683
  function recursivelyDisconnectChildren(vnodes) {
5636
- for (var _i28 = 0, _len10 = vnodes.length; _i28 < _len10; _i28 += 1) {
5684
+ for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
5637
5685
  var vnode = vnodes[_i28];
5638
5686
 
5639
5687
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
@@ -5665,7 +5713,7 @@
5665
5713
  var children = vm.children,
5666
5714
  renderRoot = vm.renderRoot;
5667
5715
 
5668
- for (var _i29 = 0, _len11 = children.length; _i29 < _len11; _i29++) {
5716
+ for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
5669
5717
  var child = children[_i29];
5670
5718
 
5671
5719
  if (!isNull(child) && !isUndefined$1(child.elm)) {
@@ -6016,7 +6064,7 @@
6016
6064
  function connectWireAdapters(vm) {
6017
6065
  var wiredConnecting = vm.context.wiredConnecting;
6018
6066
 
6019
- for (var _i30 = 0, _len12 = wiredConnecting.length; _i30 < _len12; _i30 += 1) {
6067
+ for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
6020
6068
  wiredConnecting[_i30]();
6021
6069
  }
6022
6070
  }
@@ -6025,7 +6073,7 @@
6025
6073
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6026
6074
  runWithBoundaryProtection(vm, vm, noop, function () {
6027
6075
  // job
6028
- for (var _i31 = 0, _len13 = wiredDisconnecting.length; _i31 < _len13; _i31 += 1) {
6076
+ for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
6029
6077
  wiredDisconnecting[_i31]();
6030
6078
  }
6031
6079
  }, noop);
@@ -6036,6 +6084,7 @@
6036
6084
  * SPDX-License-Identifier: MIT
6037
6085
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6038
6086
  */
6087
+ // this is lwc internal implementation
6039
6088
 
6040
6089
 
6041
6090
  function createContextProvider(adapter) {
@@ -6110,7 +6159,7 @@
6110
6159
  hooksAreSet = true;
6111
6160
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6112
6161
  }
6113
- /* version: 2.9.0 */
6162
+ /* version: 2.11.1 */
6114
6163
 
6115
6164
  /*
6116
6165
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6127,9 +6176,10 @@
6127
6176
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6128
6177
 
6129
6178
  var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6179
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6130
6180
  var styleElements = create(null);
6131
6181
  var styleSheets = create(null);
6132
- var nodesToStyleSheets = new WeakMap();
6182
+ var shadowRootsToStyleSheets = new WeakMap();
6133
6183
  var getCustomElement;
6134
6184
  var defineCustomElement;
6135
6185
  var HTMLElementConstructor;
@@ -6181,18 +6231,26 @@
6181
6231
  styleSheets[content] = styleSheet;
6182
6232
  }
6183
6233
 
6184
- if (!target.adoptedStyleSheets.includes(styleSheet)) {
6185
- target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
6234
+ var adoptedStyleSheets = target.adoptedStyleSheets;
6235
+
6236
+ if (!adoptedStyleSheets.includes(styleSheet)) {
6237
+ if (supportsMutableAdoptedStyleSheets) {
6238
+ // This is only supported in later versions of Chromium:
6239
+ // https://chromestatus.com/feature/5638996492288000
6240
+ adoptedStyleSheets.push(styleSheet);
6241
+ } else {
6242
+ target.adoptedStyleSheets = [].concat(_toConsumableArray(adoptedStyleSheets), [styleSheet]);
6243
+ }
6186
6244
  }
6187
6245
  }
6188
6246
 
6189
6247
  function insertStyleElement(content, target) {
6190
6248
  // Avoid inserting duplicate `<style>`s
6191
- var sheets = nodesToStyleSheets.get(target);
6249
+ var sheets = shadowRootsToStyleSheets.get(target);
6192
6250
 
6193
6251
  if (isUndefined$1(sheets)) {
6194
6252
  sheets = create(null);
6195
- nodesToStyleSheets.set(target, sheets);
6253
+ shadowRootsToStyleSheets.set(target, sheets);
6196
6254
  }
6197
6255
 
6198
6256
  if (sheets[content]) {
@@ -6464,6 +6522,173 @@
6464
6522
  setSetText(setText);
6465
6523
  setSsr(ssr);
6466
6524
  setAddEventListener(addEventListener);
6525
+ /*
6526
+ * Copyright (c) 2018, salesforce.com, inc.
6527
+ * All rights reserved.
6528
+ * SPDX-License-Identifier: MIT
6529
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6530
+ */
6531
+
6532
+ function resetShadowRootAndLightDom(element, Ctor) {
6533
+ if (element.shadowRoot) {
6534
+ var shadowRoot = element.shadowRoot;
6535
+
6536
+ while (!isNull(shadowRoot.firstChild)) {
6537
+ shadowRoot.removeChild(shadowRoot.firstChild);
6538
+ }
6539
+ }
6540
+
6541
+ if (Ctor.renderMode === 'light') {
6542
+ while (!isNull(element.firstChild)) {
6543
+ element.removeChild(element.firstChild);
6544
+ }
6545
+ }
6546
+ }
6547
+
6548
+ function createVMWithProps(element, Ctor, props) {
6549
+ createVM(element, Ctor, {
6550
+ mode: 'open',
6551
+ owner: null,
6552
+ tagName: element.tagName.toLowerCase()
6553
+ });
6554
+
6555
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
6556
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6557
+ key = _Object$entries2$_i[0],
6558
+ value = _Object$entries2$_i[1];
6559
+
6560
+ element[key] = value;
6561
+ }
6562
+ }
6563
+
6564
+ function hydrateComponent(element, Ctor) {
6565
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6566
+
6567
+ if (!(element instanceof Element)) {
6568
+ throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6569
+ }
6570
+
6571
+ if (!isFunction$1(Ctor)) {
6572
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6573
+ }
6574
+
6575
+ if (!isObject(props) || isNull(props)) {
6576
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6577
+ }
6578
+
6579
+ if (getAssociatedVMIfPresent(element)) {
6580
+ /* eslint-disable-next-line no-console */
6581
+ console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
6582
+ return;
6583
+ }
6584
+
6585
+ try {
6586
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6587
+ // and uses the same algo to create the stylesheets as in SSR.
6588
+ setIsHydrating(true);
6589
+ createVMWithProps(element, Ctor, props);
6590
+ hydrateRootElement(element); // set it back since now we finished hydration.
6591
+
6592
+ setIsHydrating(false);
6593
+ } catch (e) {
6594
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
6595
+ // with the client generated DOM.
6596
+
6597
+ /* eslint-disable-next-line no-console */
6598
+ console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
6599
+
6600
+ resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
6601
+
6602
+ createVMWithProps(element, Ctor, props);
6603
+ setIsHydrating(false);
6604
+ connectRootElement(element);
6605
+ } finally {
6606
+ // in case there's an error during recovery
6607
+ setIsHydrating(false);
6608
+ }
6609
+ }
6610
+ /*
6611
+ * Copyright (c) 2018, salesforce.com, inc.
6612
+ * All rights reserved.
6613
+ * SPDX-License-Identifier: MIT
6614
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6615
+ */
6616
+
6617
+ /**
6618
+ * This function builds a Web Component class from a LWC constructor so it can be
6619
+ * registered as a new element via customElements.define() at any given time.
6620
+ *
6621
+ * @deprecated since version 1.3.11
6622
+ *
6623
+ * @example
6624
+ * ```
6625
+ * import { buildCustomElementConstructor } from 'lwc';
6626
+ * import Foo from 'ns/foo';
6627
+ * const WC = buildCustomElementConstructor(Foo);
6628
+ * customElements.define('x-foo', WC);
6629
+ * const elm = document.createElement('x-foo');
6630
+ * ```
6631
+ */
6632
+
6633
+
6634
+ function deprecatedBuildCustomElementConstructor(Ctor) {
6635
+
6636
+ return Ctor.CustomElementConstructor;
6637
+ } // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
6638
+ // This WeakSet usage is valid because this functionality is not meant to run in IE11.
6639
+
6640
+
6641
+ var hydratedCustomElements = new WeakSet();
6642
+
6643
+ function buildCustomElementConstructor(Ctor) {
6644
+ var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6645
+ return /*#__PURE__*/function (_HtmlPrototype) {
6646
+ _inherits(_class, _HtmlPrototype);
6647
+
6648
+ var _super8 = _createSuper(_class);
6649
+
6650
+ function _class() {
6651
+ var _this6;
6652
+
6653
+ _classCallCheck(this, _class);
6654
+
6655
+ _this6 = _super8.call(this);
6656
+
6657
+ if (_this6.isConnected) {
6658
+ // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
6659
+ hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
6660
+ hydratedCustomElements.add(_assertThisInitialized(_this6));
6661
+ } else {
6662
+ createVM(_assertThisInitialized(_this6), Ctor, {
6663
+ mode: 'open',
6664
+ owner: null,
6665
+ tagName: _this6.tagName
6666
+ });
6667
+ }
6668
+
6669
+ return _this6;
6670
+ }
6671
+
6672
+ _createClass(_class, [{
6673
+ key: "connectedCallback",
6674
+ value: function connectedCallback() {
6675
+ if (hydratedCustomElements.has(this)) {
6676
+ // This is an un-upgraded element that was hydrated in the constructor.
6677
+ hydratedCustomElements.delete(this);
6678
+ } else {
6679
+ connectRootElement(this);
6680
+ }
6681
+ }
6682
+ }, {
6683
+ key: "disconnectedCallback",
6684
+ value: function disconnectedCallback() {
6685
+ disconnectRootElement(this);
6686
+ }
6687
+ }]);
6688
+
6689
+ return _class;
6690
+ }(HtmlPrototype);
6691
+ }
6467
6692
  /*
6468
6693
  * Copyright (c) 2018, salesforce.com, inc.
6469
6694
  * All rights reserved.
@@ -6473,6 +6698,7 @@
6473
6698
  // TODO [#2472]: Remove this workaround when appropriate.
6474
6699
  // eslint-disable-next-line lwc-internal/no-global-node
6475
6700
 
6701
+
6476
6702
  var _Node$1 = Node;
6477
6703
  var ConnectingSlot = new WeakMap();
6478
6704
  var DisconnectingSlot = new WeakMap();
@@ -6577,138 +6803,6 @@
6577
6803
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6578
6804
  */
6579
6805
 
6580
-
6581
- function hydrateComponent(element, Ctor) {
6582
- var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6583
-
6584
- if (!(element instanceof Element)) {
6585
- throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6586
- }
6587
-
6588
- if (!isFunction$1(Ctor)) {
6589
- throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6590
- }
6591
-
6592
- if (!isObject(props) || isNull(props)) {
6593
- throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6594
- }
6595
-
6596
- try {
6597
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6598
- // and uses the same algo to create the stylesheets as in SSR.
6599
- setIsHydrating(true);
6600
- createVM(element, Ctor, {
6601
- mode: 'open',
6602
- owner: null,
6603
- tagName: element.tagName.toLowerCase()
6604
- });
6605
-
6606
- for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
6607
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6608
- key = _Object$entries2$_i[0],
6609
- value = _Object$entries2$_i[1];
6610
-
6611
- element[key] = value;
6612
- }
6613
-
6614
- hydrateRootElement(element); // set it back since now we finished hydration.
6615
-
6616
- setIsHydrating(false);
6617
- } catch (e) {
6618
- // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
6619
- // the client generated DOM.
6620
-
6621
- /* eslint-disable-next-line no-console */
6622
- console.error('Recovering from error while hydrating: ', e);
6623
- setIsHydrating(false);
6624
- var newElem = createElement(element.tagName, {
6625
- is: Ctor,
6626
- mode: 'open'
6627
- });
6628
-
6629
- for (var _i34 = 0, _Object$entries3 = Object.entries(props); _i34 < _Object$entries3.length; _i34++) {
6630
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i34], 2),
6631
- _key3 = _Object$entries3$_i[0],
6632
- _value2 = _Object$entries3$_i[1];
6633
-
6634
- newElem[_key3] = _value2;
6635
- }
6636
-
6637
- element.parentNode.replaceChild(newElem, element);
6638
- }
6639
- }
6640
- /*
6641
- * Copyright (c) 2018, salesforce.com, inc.
6642
- * All rights reserved.
6643
- * SPDX-License-Identifier: MIT
6644
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6645
- */
6646
-
6647
- /**
6648
- * This function builds a Web Component class from a LWC constructor so it can be
6649
- * registered as a new element via customElements.define() at any given time.
6650
- *
6651
- * @deprecated since version 1.3.11
6652
- *
6653
- * @example
6654
- * ```
6655
- * import { buildCustomElementConstructor } from 'lwc';
6656
- * import Foo from 'ns/foo';
6657
- * const WC = buildCustomElementConstructor(Foo);
6658
- * customElements.define('x-foo', WC);
6659
- * const elm = document.createElement('x-foo');
6660
- * ```
6661
- */
6662
-
6663
-
6664
- function deprecatedBuildCustomElementConstructor(Ctor) {
6665
-
6666
- return Ctor.CustomElementConstructor;
6667
- }
6668
-
6669
- function buildCustomElementConstructor(Ctor) {
6670
- var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6671
- return /*#__PURE__*/function (_HtmlPrototype) {
6672
- _inherits(_class, _HtmlPrototype);
6673
-
6674
- var _super8 = _createSuper(_class);
6675
-
6676
- function _class() {
6677
- var _this6;
6678
-
6679
- _classCallCheck(this, _class);
6680
-
6681
- _this6 = _super8.call(this);
6682
- createVM(_assertThisInitialized(_this6), Ctor, {
6683
- mode: 'open',
6684
- owner: null,
6685
- tagName: _this6.tagName
6686
- });
6687
- return _this6;
6688
- }
6689
-
6690
- _createClass(_class, [{
6691
- key: "connectedCallback",
6692
- value: function connectedCallback() {
6693
- connectRootElement(this);
6694
- }
6695
- }, {
6696
- key: "disconnectedCallback",
6697
- value: function disconnectedCallback() {
6698
- disconnectRootElement(this);
6699
- }
6700
- }]);
6701
-
6702
- return _class;
6703
- }(HtmlPrototype);
6704
- }
6705
- /*
6706
- * Copyright (c) 2018, salesforce.com, inc.
6707
- * All rights reserved.
6708
- * SPDX-License-Identifier: MIT
6709
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6710
- */
6711
-
6712
6806
  /**
6713
6807
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6714
6808
  * This API is subject to change or being removed.
@@ -6808,7 +6902,7 @@
6808
6902
  });
6809
6903
  freeze(LightningElement);
6810
6904
  seal(LightningElement.prototype);
6811
- /* version: 2.9.0 */
6905
+ /* version: 2.11.1 */
6812
6906
 
6813
6907
  exports.LightningElement = LightningElement;
6814
6908
  exports.__unstable__ProfilerControl = profilerControl;