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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +603 -449
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +603 -449
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +477 -398
  5. package/dist/engine-dom/iife/es5/engine-dom.js +657 -479
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +509 -425
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +603 -449
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +477 -398
  11. package/dist/engine-dom/umd/es5/engine-dom.js +657 -479
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +509 -425
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +391 -285
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +391 -285
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  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 +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  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
@@ -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."); }
@@ -345,7 +345,7 @@ var LWC = (function (exports) {
345
345
  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
346
346
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
347
347
  var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
348
- /** version: 2.9.0 */
348
+ /** version: 2.10.0 */
349
349
 
350
350
  /*
351
351
  * Copyright (c) 2018, salesforce.com, inc.
@@ -410,7 +410,7 @@ var LWC = (function (exports) {
410
410
  };
411
411
  }
412
412
 
413
- function patch(propName) {
413
+ function patch$1(propName) {
414
414
  // Typescript is inferring the wrong function type for this particular
415
415
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
416
416
  // @ts-ignore type-mismatch
@@ -432,7 +432,7 @@ var LWC = (function (exports) {
432
432
  var propName = ElementPrototypeAriaPropertyNames[_i2];
433
433
 
434
434
  if (detect(propName)) {
435
- patch(propName);
435
+ patch$1(propName);
436
436
  }
437
437
  }
438
438
  /**
@@ -448,14 +448,15 @@ var LWC = (function (exports) {
448
448
 
449
449
 
450
450
  var features = {
451
- ENABLE_REACTIVE_SETTER: null,
452
- ENABLE_HMR: null,
453
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
451
+ DISABLE_MIXED_SHADOW_MODE: null,
454
452
  ENABLE_ELEMENT_PATCH: null,
455
453
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
456
- ENABLE_NODE_LIST_PATCH: null,
454
+ ENABLE_HMR: null,
457
455
  ENABLE_HTML_COLLECTIONS_PATCH: null,
456
+ ENABLE_INNER_OUTER_TEXT_PATCH: null,
457
+ ENABLE_NODE_LIST_PATCH: null,
458
458
  ENABLE_NODE_PATCH: null,
459
+ ENABLE_REACTIVE_SETTER: null,
459
460
  ENABLE_WIRE_SYNC_EMIT: null
460
461
  };
461
462
 
@@ -514,7 +515,7 @@ var LWC = (function (exports) {
514
515
 
515
516
  function setFeatureFlagForTest(name, value) {
516
517
  }
517
- /** version: 2.9.0 */
518
+ /** version: 2.10.0 */
518
519
 
519
520
  /* proxy-compat-disable */
520
521
 
@@ -571,7 +572,7 @@ var LWC = (function (exports) {
571
572
  }
572
573
 
573
574
  return result;
574
- } //
575
+ }
575
576
  // Primitives
576
577
  //
577
578
 
@@ -2589,6 +2590,13 @@ var LWC = (function (exports) {
2589
2590
  var meta = signedDecoratorToMetaMap.get(Ctor);
2590
2591
  return isUndefined$1(meta) ? defaultMeta : meta;
2591
2592
  }
2593
+ /*
2594
+ * Copyright (c) 2018, salesforce.com, inc.
2595
+ * All rights reserved.
2596
+ * SPDX-License-Identifier: MIT
2597
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2598
+ */
2599
+
2592
2600
 
2593
2601
  var signedTemplateSet = new Set();
2594
2602
 
@@ -2608,6 +2616,7 @@ var LWC = (function (exports) {
2608
2616
 
2609
2617
 
2610
2618
  function registerTemplate(tpl) {
2619
+
2611
2620
  signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2612
2621
  // assignment of templates easily, without too much transformation
2613
2622
 
@@ -3420,138 +3429,245 @@ var LWC = (function (exports) {
3420
3429
  */
3421
3430
 
3422
3431
 
3423
- var TextHook = {
3424
- create: function create(vnode) {
3425
- var owner = vnode.owner;
3426
- var elm = createText$1(vnode.text);
3427
- linkNodeToShadow(elm, owner);
3428
- vnode.elm = elm;
3429
- },
3430
- update: updateNodeHook,
3431
- insert: insertNode,
3432
- move: insertNode,
3433
- remove: removeNode
3434
- };
3435
- var CommentHook = {
3436
- create: function create(vnode) {
3437
- var owner = vnode.owner,
3438
- text = vnode.text;
3439
- var elm = createComment$1(text);
3440
- linkNodeToShadow(elm, owner);
3441
- vnode.elm = elm;
3442
- },
3443
- update: updateNodeHook,
3444
- insert: insertNode,
3445
- move: insertNode,
3446
- remove: removeNode
3447
- }; // insert is called after update, which is used somewhere else (via a module)
3448
- // to mark the vm as inserted, that means we cannot use update as the main channel
3449
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
3450
- // which breaks some invariants. For that reason, we have the following for any
3451
- // Custom Element that is inserted via a template.
3452
-
3453
- var ElementHook = {
3454
- create: function create(vnode) {
3455
- var sel = vnode.sel,
3456
- owner = vnode.owner,
3457
- svg = vnode.data.svg;
3458
- var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3459
- var elm = createElement$2(sel, namespace);
3460
- linkNodeToShadow(elm, owner);
3461
- fallbackElmHook(elm, vnode);
3462
- vnode.elm = elm;
3463
- patchElementPropsAndAttrs$1(null, vnode);
3464
- },
3465
- update: function update(oldVnode, vnode) {
3466
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3467
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3468
- },
3469
- insert: function insert(vnode, parentNode, referenceNode) {
3470
- insertNode(vnode, parentNode, referenceNode);
3471
- createChildrenHook(vnode);
3472
- },
3473
- move: insertNode,
3474
- remove: function remove(vnode, parentNode) {
3475
- removeNode(vnode, parentNode);
3476
- removeChildren(vnode);
3432
+ function patchChildren(c1, c2, parent) {
3433
+ if (hasDynamicChildren(c2)) {
3434
+ updateDynamicChildren(c1, c2, parent);
3435
+ } else {
3436
+ updateStaticChildren(c1, c2, parent);
3477
3437
  }
3478
- };
3479
- var CustomElementHook = {
3480
- create: function create(vnode) {
3481
- var sel = vnode.sel,
3482
- owner = vnode.owner;
3483
- var UpgradableConstructor = getUpgradableConstructor(sel);
3484
- /**
3485
- * Note: if the upgradable constructor does not expect, or throw when we new it
3486
- * with a callback as the first argument, we could implement a more advanced
3487
- * mechanism that only passes that argument if the constructor is known to be
3488
- * an upgradable custom element.
3489
- */
3438
+ }
3490
3439
 
3491
- var vm;
3492
- var elm = new UpgradableConstructor(function (elm) {
3493
- // the custom element from the registry is expecting an upgrade callback
3494
- vm = createViewModelHook(elm, vnode);
3495
- });
3496
- linkNodeToShadow(elm, owner);
3497
- vnode.elm = elm;
3440
+ function patch(n1, n2) {
3441
+ if (n1 === n2) {
3442
+ return;
3443
+ }
3498
3444
 
3499
- if (vm) {
3500
- allocateChildren(vnode, vm);
3501
- } else if (vnode.ctor !== UpgradableConstructor) {
3502
- throw new TypeError("Incorrect Component Constructor");
3503
- }
3445
+ switch (n2.type) {
3446
+ case 0
3447
+ /* Text */
3448
+ :
3449
+ patchText(n1, n2);
3450
+ break;
3504
3451
 
3505
- patchElementPropsAndAttrs$1(null, vnode);
3506
- },
3507
- update: function update(oldVnode, vnode) {
3508
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3509
- var vm = getAssociatedVMIfPresent(vnode.elm);
3452
+ case 1
3453
+ /* Comment */
3454
+ :
3455
+ patchComment(n1, n2);
3456
+ break;
3510
3457
 
3511
- if (vm) {
3512
- // in fallback mode, the allocation will always set children to
3513
- // empty and delegate the real allocation to the slot elements
3514
- allocateChildren(vnode, vm);
3515
- } // in fallback mode, the children will be always empty, so, nothing
3516
- // will happen, but in native, it does allocate the light dom
3458
+ case 2
3459
+ /* Element */
3460
+ :
3461
+ patchElement(n1, n2);
3462
+ break;
3517
3463
 
3464
+ case 3
3465
+ /* CustomElement */
3466
+ :
3467
+ patchCustomElement(n1, n2);
3468
+ break;
3469
+ }
3470
+ }
3518
3471
 
3519
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3472
+ function mount(node, parent, anchor) {
3473
+ switch (node.type) {
3474
+ case 0
3475
+ /* Text */
3476
+ :
3477
+ mountText(node, parent, anchor);
3478
+ break;
3520
3479
 
3521
- if (vm) {
3522
- // this is important to preserve the top to bottom synchronous rendering phase.
3480
+ case 1
3481
+ /* Comment */
3482
+ :
3483
+ mountComment(node, parent, anchor);
3484
+ break;
3523
3485
 
3486
+ case 2
3487
+ /* Element */
3488
+ :
3489
+ mountElement(node, parent, anchor);
3490
+ break;
3524
3491
 
3525
- rerenderVM(vm);
3526
- }
3527
- },
3528
- insert: function insert(vnode, parentNode, referenceNode) {
3529
- insertNode(vnode, parentNode, referenceNode);
3530
- var vm = getAssociatedVMIfPresent(vnode.elm);
3492
+ case 3
3493
+ /* CustomElement */
3494
+ :
3495
+ mountCustomElement(node, parent, anchor);
3496
+ break;
3497
+ }
3498
+ }
3531
3499
 
3532
- if (vm) {
3500
+ function patchText(n1, n2) {
3501
+ n2.elm = n1.elm;
3533
3502
 
3534
- runConnectedCallback(vm);
3535
- }
3503
+ if (n2.text !== n1.text) {
3504
+ updateTextContent(n2);
3505
+ }
3506
+ }
3507
+
3508
+ function mountText(node, parent, anchor) {
3509
+ var owner = node.owner;
3510
+ var textNode = node.elm = createText$1(node.text);
3511
+ linkNodeToShadow(textNode, owner);
3512
+ insertNode(textNode, parent, anchor);
3513
+ }
3514
+
3515
+ function patchComment(n1, n2) {
3516
+ n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3517
+ // it is the case today.
3518
+
3519
+ if (n2.text !== n1.text) {
3520
+ updateTextContent(n2);
3521
+ }
3522
+ }
3536
3523
 
3537
- createChildrenHook(vnode);
3524
+ function mountComment(node, parent, anchor) {
3525
+ var owner = node.owner;
3526
+ var commentNode = node.elm = createComment$1(node.text);
3527
+ linkNodeToShadow(commentNode, owner);
3528
+ insertNode(commentNode, parent, anchor);
3529
+ }
3530
+
3531
+ function mountElement(vnode, parent, anchor) {
3532
+ var sel = vnode.sel,
3533
+ owner = vnode.owner,
3534
+ svg = vnode.data.svg;
3535
+ var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3536
+ var elm = createElement$2(sel, namespace);
3537
+ linkNodeToShadow(elm, owner);
3538
+ fallbackElmHook(elm, vnode);
3539
+ vnode.elm = elm;
3540
+ patchElementPropsAndAttrs$1(null, vnode);
3541
+ insertNode(elm, parent, anchor);
3542
+ mountVNodes(vnode.children, elm, null);
3543
+ }
3544
+
3545
+ function patchElement(n1, n2) {
3546
+ var elm = n2.elm = n1.elm;
3547
+ patchElementPropsAndAttrs$1(n1, n2);
3548
+ patchChildren(n1.children, n2.children, elm);
3549
+ }
3538
3550
 
3539
- if (vm) {
3540
- appendVM(vm);
3551
+ function mountCustomElement(vnode, parent, anchor) {
3552
+ var sel = vnode.sel,
3553
+ owner = vnode.owner;
3554
+ var UpgradableConstructor = getUpgradableConstructor(sel);
3555
+ /**
3556
+ * Note: if the upgradable constructor does not expect, or throw when we new it
3557
+ * with a callback as the first argument, we could implement a more advanced
3558
+ * mechanism that only passes that argument if the constructor is known to be
3559
+ * an upgradable custom element.
3560
+ */
3561
+
3562
+ var vm;
3563
+ var elm = new UpgradableConstructor(function (elm) {
3564
+ // the custom element from the registry is expecting an upgrade callback
3565
+ vm = createViewModelHook(elm, vnode);
3566
+ });
3567
+ linkNodeToShadow(elm, owner);
3568
+ vnode.elm = elm;
3569
+ vnode.vm = vm;
3570
+
3571
+ if (vm) {
3572
+ allocateChildren(vnode, vm);
3573
+ } else if (vnode.ctor !== UpgradableConstructor) {
3574
+ throw new TypeError("Incorrect Component Constructor");
3575
+ }
3576
+
3577
+ patchElementPropsAndAttrs$1(null, vnode);
3578
+ insertNode(elm, parent, anchor);
3579
+
3580
+ if (vm) {
3581
+
3582
+ runConnectedCallback(vm);
3583
+ }
3584
+
3585
+ mountVNodes(vnode.children, elm, null);
3586
+
3587
+ if (vm) {
3588
+ appendVM(vm);
3589
+ }
3590
+ }
3591
+
3592
+ function patchCustomElement(n1, n2) {
3593
+ var elm = n2.elm = n1.elm;
3594
+ var vm = n2.vm = n1.vm;
3595
+ patchElementPropsAndAttrs$1(n1, n2);
3596
+
3597
+ if (!isUndefined$1(vm)) {
3598
+ // in fallback mode, the allocation will always set children to
3599
+ // empty and delegate the real allocation to the slot elements
3600
+ allocateChildren(n2, vm);
3601
+ } // in fallback mode, the children will be always empty, so, nothing
3602
+ // will happen, but in native, it does allocate the light dom
3603
+
3604
+
3605
+ patchChildren(n1.children, n2.children, elm);
3606
+
3607
+ if (!isUndefined$1(vm)) {
3608
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3609
+ // this is important to preserve the top to bottom synchronous rendering phase.
3610
+ rerenderVM(vm);
3611
+ }
3612
+ }
3613
+
3614
+ function mountVNodes(vnodes, parent, anchor) {
3615
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3616
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3617
+
3618
+ for (; start < end; ++start) {
3619
+ var vnode = vnodes[start];
3620
+
3621
+ if (isVNode(vnode)) {
3622
+ mount(vnode, parent, anchor);
3541
3623
  }
3542
- },
3543
- move: insertNode,
3544
- remove: function remove(vnode, parentNode) {
3545
- removeNode(vnode, parentNode);
3546
- var vm = getAssociatedVMIfPresent(vnode.elm);
3547
-
3548
- if (vm) {
3549
- // for custom elements we don't have to go recursively because the removeVM routine
3550
- // will take care of disconnecting any child VM attached to its shadow as well.
3551
- removeVM(vm);
3624
+ }
3625
+ }
3626
+
3627
+ function unmount(vnode, parent) {
3628
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3629
+ var type = vnode.type,
3630
+ elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3631
+ // subtree root, is the only element worth unmounting from the subtree.
3632
+
3633
+ if (doRemove) {
3634
+ removeNode(elm, parent);
3635
+ }
3636
+
3637
+ switch (type) {
3638
+ case 2
3639
+ /* Element */
3640
+ :
3641
+ unmountVNodes(vnode.children, elm);
3642
+ break;
3643
+
3644
+ case 3
3645
+ /* CustomElement */
3646
+ :
3647
+ {
3648
+ var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
3649
+ // children.
3650
+
3651
+ if (!isUndefined$1(vm)) {
3652
+ removeVM(vm);
3653
+ }
3654
+ }
3655
+ }
3656
+ }
3657
+
3658
+ function unmountVNodes(vnodes, parent) {
3659
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3660
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3661
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3662
+
3663
+ for (; start < end; ++start) {
3664
+ var ch = vnodes[start];
3665
+
3666
+ if (isVNode(ch)) {
3667
+ unmount(ch, parent, doRemove);
3552
3668
  }
3553
3669
  }
3554
- };
3670
+ }
3555
3671
 
3556
3672
  function isVNode(vnode) {
3557
3673
  return vnode != null;
@@ -3592,24 +3708,21 @@ var LWC = (function (exports) {
3592
3708
  }
3593
3709
  }
3594
3710
 
3595
- function updateNodeHook(oldVnode, vnode) {
3711
+ function updateTextContent(vnode) {
3596
3712
  var elm = vnode.elm,
3597
3713
  text = vnode.text;
3598
3714
 
3599
- if (oldVnode.text !== text) {
3600
-
3601
- setText$1(elm, text);
3602
- }
3715
+ setText$1(elm, text);
3603
3716
  }
3604
3717
 
3605
- function insertNode(vnode, parentNode, referenceNode) {
3718
+ function insertNode(node, parent, anchor) {
3606
3719
 
3607
- insert$1(vnode.elm, parentNode, referenceNode);
3720
+ insert$1(node, parent, anchor);
3608
3721
  }
3609
3722
 
3610
- function removeNode(vnode, parentNode) {
3723
+ function removeNode(node, parent) {
3611
3724
 
3612
- remove$1(vnode.elm, parentNode);
3725
+ remove$1(node, parent);
3613
3726
  }
3614
3727
 
3615
3728
  function patchElementPropsAndAttrs$1(oldVnode, vnode) {
@@ -3652,14 +3765,6 @@ var LWC = (function (exports) {
3652
3765
  }
3653
3766
  }
3654
3767
 
3655
- function patchChildren(parent, oldCh, newCh) {
3656
- if (hasDynamicChildren(newCh)) {
3657
- updateDynamicChildren(parent, oldCh, newCh);
3658
- } else {
3659
- updateStaticChildren(parent, oldCh, newCh);
3660
- }
3661
- }
3662
-
3663
3768
  function allocateChildren(vnode, vm) {
3664
3769
  // A component with slots will re-render because:
3665
3770
  // 1- There is a change of the internal state.
@@ -3725,43 +3830,13 @@ var LWC = (function (exports) {
3725
3830
  return vm;
3726
3831
  }
3727
3832
 
3728
- function createChildrenHook(vnode) {
3729
- var elm = vnode.elm,
3730
- children = vnode.children;
3731
-
3732
- for (var j = 0; j < children.length; ++j) {
3733
- var ch = children[j];
3734
-
3735
- if (ch != null) {
3736
- ch.hook.create(ch);
3737
- ch.hook.insert(ch, elm, null);
3738
- }
3739
- }
3740
- }
3741
-
3742
- function removeChildren(vnode) {
3743
- // this method only needs to search on child vnodes from template
3744
- // to trigger the remove hook just in case some of those children
3745
- // are custom elements.
3746
- var children = vnode.children,
3747
- elm = vnode.elm;
3748
-
3749
- for (var j = 0, _len5 = children.length; j < _len5; ++j) {
3750
- var ch = children[j];
3751
-
3752
- if (!isNull(ch)) {
3753
- ch.hook.remove(ch, elm);
3754
- }
3755
- }
3756
- }
3757
-
3758
3833
  function allocateInSlot(vm, children) {
3759
3834
  var _a;
3760
3835
 
3761
3836
  var oldSlots = vm.cmpSlots;
3762
3837
  var cmpSlots = vm.cmpSlots = create(null);
3763
3838
 
3764
- for (var _i13 = 0, _len6 = children.length; _i13 < _len6; _i13 += 1) {
3839
+ for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
3765
3840
  var vnode = children[_i13];
3766
3841
 
3767
3842
  if (isNull(vnode)) {
@@ -3796,7 +3871,7 @@ var LWC = (function (exports) {
3796
3871
  return;
3797
3872
  }
3798
3873
 
3799
- for (var _i14 = 0, _len7 = oldKeys.length; _i14 < _len7; _i14 += 1) {
3874
+ for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
3800
3875
  var key = oldKeys[_i14];
3801
3876
 
3802
3877
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
@@ -3847,28 +3922,7 @@ var LWC = (function (exports) {
3847
3922
  return map;
3848
3923
  }
3849
3924
 
3850
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
3851
- for (; startIdx <= endIdx; ++startIdx) {
3852
- var ch = vnodes[startIdx];
3853
-
3854
- if (isVNode(ch)) {
3855
- ch.hook.create(ch);
3856
- ch.hook.insert(ch, parentElm, before);
3857
- }
3858
- }
3859
- }
3860
-
3861
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
3862
- for (; startIdx <= endIdx; ++startIdx) {
3863
- var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
3864
-
3865
- if (isVNode(ch)) {
3866
- ch.hook.remove(ch, parentElm);
3867
- }
3868
- }
3869
- }
3870
-
3871
- function updateDynamicChildren(parentElm, oldCh, newCh) {
3925
+ function updateDynamicChildren(oldCh, newCh, parent) {
3872
3926
  var oldStartIdx = 0;
3873
3927
  var newStartIdx = 0;
3874
3928
  var oldEndIdx = oldCh.length - 1;
@@ -3894,23 +3948,23 @@ var LWC = (function (exports) {
3894
3948
  } else if (!isVNode(newEndVnode)) {
3895
3949
  newEndVnode = newCh[--newEndIdx];
3896
3950
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
3897
- patchVnode(oldStartVnode, newStartVnode);
3951
+ patch(oldStartVnode, newStartVnode);
3898
3952
  oldStartVnode = oldCh[++oldStartIdx];
3899
3953
  newStartVnode = newCh[++newStartIdx];
3900
3954
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
3901
- patchVnode(oldEndVnode, newEndVnode);
3955
+ patch(oldEndVnode, newEndVnode);
3902
3956
  oldEndVnode = oldCh[--oldEndIdx];
3903
3957
  newEndVnode = newCh[--newEndIdx];
3904
3958
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
3905
3959
  // Vnode moved right
3906
- patchVnode(oldStartVnode, newEndVnode);
3907
- newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
3960
+ patch(oldStartVnode, newEndVnode);
3961
+ insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
3908
3962
  oldStartVnode = oldCh[++oldStartIdx];
3909
3963
  newEndVnode = newCh[--newEndIdx];
3910
3964
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
3911
3965
  // Vnode moved left
3912
- patchVnode(oldEndVnode, newStartVnode);
3913
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
3966
+ patch(oldEndVnode, newStartVnode);
3967
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
3914
3968
  oldEndVnode = oldCh[--oldEndIdx];
3915
3969
  newStartVnode = newCh[++newStartIdx];
3916
3970
  } else {
@@ -3922,8 +3976,7 @@ var LWC = (function (exports) {
3922
3976
 
3923
3977
  if (isUndefined$1(idxInOld)) {
3924
3978
  // New element
3925
- newStartVnode.hook.create(newStartVnode);
3926
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3979
+ mount(newStartVnode, parent, oldStartVnode.elm);
3927
3980
  newStartVnode = newCh[++newStartIdx];
3928
3981
  } else {
3929
3982
  elmToMove = oldCh[idxInOld];
@@ -3931,10 +3984,9 @@ var LWC = (function (exports) {
3931
3984
  if (isVNode(elmToMove)) {
3932
3985
  if (elmToMove.sel !== newStartVnode.sel) {
3933
3986
  // New element
3934
- newStartVnode.hook.create(newStartVnode);
3935
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3987
+ mount(newStartVnode, parent, oldStartVnode.elm);
3936
3988
  } else {
3937
- patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3989
+ patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3938
3990
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3939
3991
  // so we only care about the `oldCh` object inside this function.
3940
3992
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -3947,7 +3999,7 @@ var LWC = (function (exports) {
3947
3999
 
3948
4000
 
3949
4001
  oldCh[idxInOld] = undefined;
3950
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
4002
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm);
3951
4003
  }
3952
4004
  }
3953
4005
 
@@ -3968,65 +4020,55 @@ var LWC = (function (exports) {
3968
4020
  } while (!isVNode(n) && _i15 < newChEnd);
3969
4021
 
3970
4022
  before = isVNode(n) ? n.elm : null;
3971
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
4023
+ mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
3972
4024
  } else {
3973
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
4025
+ unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
3974
4026
  }
3975
4027
  }
3976
4028
  }
3977
4029
 
3978
- function updateStaticChildren(parentElm, oldCh, newCh) {
3979
- var oldChLength = oldCh.length;
3980
- var newChLength = newCh.length;
4030
+ function updateStaticChildren(c1, c2, parent) {
4031
+ var c1Length = c1.length;
4032
+ var c2Length = c2.length;
3981
4033
 
3982
- if (oldChLength === 0) {
4034
+ if (c1Length === 0) {
3983
4035
  // the old list is empty, we can directly insert anything new
3984
- addVnodes(parentElm, null, newCh, 0, newChLength);
4036
+ mountVNodes(c2, parent, null);
3985
4037
  return;
3986
4038
  }
3987
4039
 
3988
- if (newChLength === 0) {
4040
+ if (c2Length === 0) {
3989
4041
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
3990
4042
  // this is the case in which the dynamic children of an if-directive should be removed
3991
- removeVnodes(parentElm, oldCh, 0, oldChLength);
4043
+ unmountVNodes(c1, parent, true);
3992
4044
  return;
3993
4045
  } // if the old list is not empty, the new list MUST have the same
3994
4046
  // amount of nodes, that's why we call this static children
3995
4047
 
3996
4048
 
3997
- var referenceElm = null;
4049
+ var anchor = null;
3998
4050
 
3999
- for (var _i16 = newChLength - 1; _i16 >= 0; _i16 -= 1) {
4000
- var vnode = newCh[_i16];
4001
- var oldVNode = oldCh[_i16];
4051
+ for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
4052
+ var n1 = c1[_i16];
4053
+ var n2 = c2[_i16];
4002
4054
 
4003
- if (vnode !== oldVNode) {
4004
- if (isVNode(oldVNode)) {
4005
- if (isVNode(vnode)) {
4006
- // both vnodes must be equivalent, and se just need to patch them
4007
- patchVnode(oldVNode, vnode);
4008
- referenceElm = vnode.elm;
4055
+ if (n2 !== n1) {
4056
+ if (isVNode(n1)) {
4057
+ if (isVNode(n2)) {
4058
+ // both vnodes are equivalent, and we just need to patch them
4059
+ patch(n1, n2);
4060
+ anchor = n2.elm;
4009
4061
  } else {
4010
4062
  // removing the old vnode since the new one is null
4011
- oldVNode.hook.remove(oldVNode, parentElm);
4063
+ unmount(n1, parent, true);
4012
4064
  }
4013
- } else if (isVNode(vnode)) {
4014
- // this condition is unnecessary
4015
- vnode.hook.create(vnode); // insert the new node one since the old one is null
4016
-
4017
- vnode.hook.insert(vnode, parentElm, referenceElm);
4018
- referenceElm = vnode.elm;
4065
+ } else if (isVNode(n2)) {
4066
+ mount(n2, parent, anchor);
4067
+ anchor = n2.elm;
4019
4068
  }
4020
4069
  }
4021
4070
  }
4022
4071
  }
4023
-
4024
- function patchVnode(oldVnode, vnode) {
4025
- if (oldVnode !== vnode) {
4026
- vnode.elm = oldVnode.elm;
4027
- vnode.hook.update(oldVnode, vnode);
4028
- }
4029
- }
4030
4072
  /*
4031
4073
  * Copyright (c) 2018, salesforce.com, inc.
4032
4074
  * All rights reserved.
@@ -4057,7 +4099,6 @@ var LWC = (function (exports) {
4057
4099
  children: children,
4058
4100
  elm: elm,
4059
4101
  key: key,
4060
- hook: ElementHook,
4061
4102
  owner: vmBeingRendered
4062
4103
  };
4063
4104
  } // [t]ab[i]ndex function
@@ -4106,7 +4147,7 @@ var LWC = (function (exports) {
4106
4147
  var vmBeingRendered = getVMBeingRendered();
4107
4148
 
4108
4149
  var key = data.key;
4109
- var elm;
4150
+ var elm, aChildren, vm;
4110
4151
  var vnode = {
4111
4152
  type: 3
4112
4153
  /* CustomElement */
@@ -4116,11 +4157,11 @@ var LWC = (function (exports) {
4116
4157
  children: children,
4117
4158
  elm: elm,
4118
4159
  key: key,
4119
- hook: CustomElementHook,
4120
4160
  ctor: Ctor,
4121
4161
  owner: vmBeingRendered,
4122
- mode: 'open' // TODO [#1294]: this should be defined in Ctor
4123
-
4162
+ mode: 'open',
4163
+ aChildren: aChildren,
4164
+ vm: vm
4124
4165
  };
4125
4166
  addVNodeToChildLWC(vnode);
4126
4167
  return vnode;
@@ -4201,7 +4242,6 @@ var LWC = (function (exports) {
4201
4242
  text: text,
4202
4243
  elm: elm,
4203
4244
  key: key,
4204
- hook: TextHook,
4205
4245
  owner: getVMBeingRendered()
4206
4246
  };
4207
4247
  } // [co]mment node
@@ -4217,7 +4257,6 @@ var LWC = (function (exports) {
4217
4257
  text: text,
4218
4258
  elm: elm,
4219
4259
  key: key,
4220
- hook: CommentHook,
4221
4260
  owner: getVMBeingRendered()
4222
4261
  };
4223
4262
  } // [d]ynamic text
@@ -4914,6 +4953,7 @@ var LWC = (function (exports) {
4914
4953
 
4915
4954
  function registerComponent(Ctor, _ref2) {
4916
4955
  var tmpl = _ref2.tmpl;
4956
+
4917
4957
  signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
4918
4958
  // without too much transformation
4919
4959
 
@@ -5007,7 +5047,7 @@ var LWC = (function (exports) {
5007
5047
  def = vm.def,
5008
5048
  context = vm.context;
5009
5049
 
5010
- for (var _i22 = 0, _len8 = cbs.length; _i22 < _len8; ++_i22) {
5050
+ for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
5011
5051
  cbs[_i22].call(undefined, component, {}, def, context);
5012
5052
  }
5013
5053
  }
@@ -5019,7 +5059,7 @@ var LWC = (function (exports) {
5019
5059
  */
5020
5060
 
5021
5061
 
5022
- function hydrate$1(vnode, node) {
5062
+ function hydrate(vnode, node) {
5023
5063
  switch (vnode.type) {
5024
5064
  case 0
5025
5065
  /* Text */
@@ -5051,7 +5091,7 @@ var LWC = (function (exports) {
5051
5091
  var _a;
5052
5092
 
5053
5093
 
5054
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5094
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5055
5095
  vnode.elm = node;
5056
5096
  }
5057
5097
 
@@ -5059,7 +5099,7 @@ var LWC = (function (exports) {
5059
5099
  var _a;
5060
5100
 
5061
5101
 
5062
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5102
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5063
5103
  vnode.elm = node;
5064
5104
  }
5065
5105
 
@@ -5078,13 +5118,13 @@ var LWC = (function (exports) {
5078
5118
  var props = vnode.data.props;
5079
5119
 
5080
5120
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5081
- if (elm.innerHTML === props.innerHTML) {
5121
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5082
5122
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5083
5123
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
5084
5124
  props: cloneAndOmitKey(props, 'innerHTML')
5085
5125
  });
5086
5126
  } else {
5087
- logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5127
+ logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5088
5128
  }
5089
5129
  }
5090
5130
  }
@@ -5092,14 +5132,13 @@ var LWC = (function (exports) {
5092
5132
  patchElementPropsAndAttrs(vnode);
5093
5133
 
5094
5134
  if (!isDomManual) {
5095
- hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);
5135
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5096
5136
  }
5097
5137
  }
5098
5138
 
5099
5139
  function hydrateCustomElement(vnode, node) {
5100
5140
 
5101
5141
  var elm = node;
5102
- vnode.elm = elm;
5103
5142
  var sel = vnode.sel,
5104
5143
  mode = vnode.mode,
5105
5144
  ctor = vnode.ctor,
@@ -5109,6 +5148,8 @@ var LWC = (function (exports) {
5109
5148
  owner: owner,
5110
5149
  tagName: sel
5111
5150
  });
5151
+ vnode.elm = elm;
5152
+ vnode.vm = vm;
5112
5153
  allocateChildren(vnode, vm);
5113
5154
  patchElementPropsAndAttrs(vnode); // Insert hook section:
5114
5155
 
@@ -5119,7 +5160,7 @@ var LWC = (function (exports) {
5119
5160
  ) {
5120
5161
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5121
5162
  // Note: for Light DOM, this is handled while hydrating the VM
5122
- hydrateChildren(vnode.elm.childNodes, vnode.children);
5163
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5123
5164
  }
5124
5165
 
5125
5166
  hydrateVM(vm);
@@ -5134,7 +5175,7 @@ var LWC = (function (exports) {
5134
5175
 
5135
5176
  if (!isNull(childVnode)) {
5136
5177
  var childNode = elmChildren[childNodeIndex];
5137
- hydrate$1(childVnode, childNode);
5178
+ hydrate(childVnode, childNode);
5138
5179
  childNodeIndex++;
5139
5180
  }
5140
5181
  }
@@ -5210,7 +5251,19 @@ var LWC = (function (exports) {
5210
5251
  }
5211
5252
 
5212
5253
  function hydrateVM(vm) {
5213
- hydrate(vm);
5254
+ if (isTrue(vm.isDirty)) {
5255
+ // manually diffing/patching here.
5256
+ // This routine is:
5257
+ // patchShadowRoot(vm, children);
5258
+ // -> addVnodes.
5259
+ var children = renderComponent(vm);
5260
+ vm.children = children;
5261
+ var vmChildren = vm.renderMode === 0
5262
+ /* Light */
5263
+ ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5264
+ hydrateChildren(vmChildren, children);
5265
+ runRenderedCallback(vm);
5266
+ }
5214
5267
  } // just in case the component comes back, with this we guarantee re-rendering it
5215
5268
  // while preventing any attempt to rehydration until after reinsertion.
5216
5269
 
@@ -5330,7 +5383,11 @@ var LWC = (function (exports) {
5330
5383
  /* Native */
5331
5384
  ;
5332
5385
  } else if (isNativeShadowDefined$1) {
5333
- if (def.shadowSupportMode === "any"
5386
+ if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
5387
+ shadowMode = 1
5388
+ /* Synthetic */
5389
+ ;
5390
+ } else if (def.shadowSupportMode === "any"
5334
5391
  /* Any */
5335
5392
  ) {
5336
5393
  shadowMode = 0
@@ -5394,22 +5451,6 @@ var LWC = (function (exports) {
5394
5451
  }
5395
5452
  }
5396
5453
 
5397
- function hydrate(vm) {
5398
- if (isTrue(vm.isDirty)) {
5399
- // manually diffing/patching here.
5400
- // This routine is:
5401
- // patchShadowRoot(vm, children);
5402
- // -> addVnodes.
5403
- var children = renderComponent(vm);
5404
- vm.children = children;
5405
- var vmChildren = vm.renderMode === 0
5406
- /* Light */
5407
- ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
5408
- hydrateChildren(vmChildren, children);
5409
- runRenderedCallback(vm);
5410
- }
5411
- }
5412
-
5413
5454
  function patchShadowRoot(vm, newCh) {
5414
5455
  var renderRoot = vm.renderRoot,
5415
5456
  oldCh = vm.children; // caching the new children collection
@@ -5427,7 +5468,7 @@ var LWC = (function (exports) {
5427
5468
  , vm);
5428
5469
  }, function () {
5429
5470
  // job
5430
- patchChildren(renderRoot, oldCh, newCh);
5471
+ patchChildren(oldCh, newCh, renderRoot);
5431
5472
  }, function () {
5432
5473
  // post
5433
5474
  logOperationEnd(2
@@ -5484,13 +5525,13 @@ var LWC = (function (exports) {
5484
5525
  });
5485
5526
  rehydrateQueue = []; // reset to a new queue
5486
5527
 
5487
- for (var _i26 = 0, _len9 = vms.length; _i26 < _len9; _i26 += 1) {
5528
+ for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
5488
5529
  var vm = vms[_i26];
5489
5530
 
5490
5531
  try {
5491
5532
  rehydrate(vm);
5492
5533
  } catch (error) {
5493
- if (_i26 + 1 < _len9) {
5534
+ if (_i26 + 1 < _len8) {
5494
5535
  // pieces of the queue are still pending to be rehydrated, those should have priority
5495
5536
  if (rehydrateQueue.length === 0) {
5496
5537
  addCallbackToNextTick(flushRehydrationQueue);
@@ -5630,7 +5671,7 @@ var LWC = (function (exports) {
5630
5671
 
5631
5672
 
5632
5673
  function recursivelyDisconnectChildren(vnodes) {
5633
- for (var _i28 = 0, _len10 = vnodes.length; _i28 < _len10; _i28 += 1) {
5674
+ for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
5634
5675
  var vnode = vnodes[_i28];
5635
5676
 
5636
5677
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
@@ -5662,7 +5703,7 @@ var LWC = (function (exports) {
5662
5703
  var children = vm.children,
5663
5704
  renderRoot = vm.renderRoot;
5664
5705
 
5665
- for (var _i29 = 0, _len11 = children.length; _i29 < _len11; _i29++) {
5706
+ for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
5666
5707
  var child = children[_i29];
5667
5708
 
5668
5709
  if (!isNull(child) && !isUndefined$1(child.elm)) {
@@ -6013,7 +6054,7 @@ var LWC = (function (exports) {
6013
6054
  function connectWireAdapters(vm) {
6014
6055
  var wiredConnecting = vm.context.wiredConnecting;
6015
6056
 
6016
- for (var _i30 = 0, _len12 = wiredConnecting.length; _i30 < _len12; _i30 += 1) {
6057
+ for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
6017
6058
  wiredConnecting[_i30]();
6018
6059
  }
6019
6060
  }
@@ -6022,7 +6063,7 @@ var LWC = (function (exports) {
6022
6063
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6023
6064
  runWithBoundaryProtection(vm, vm, noop, function () {
6024
6065
  // job
6025
- for (var _i31 = 0, _len13 = wiredDisconnecting.length; _i31 < _len13; _i31 += 1) {
6066
+ for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
6026
6067
  wiredDisconnecting[_i31]();
6027
6068
  }
6028
6069
  }, noop);
@@ -6107,7 +6148,7 @@ var LWC = (function (exports) {
6107
6148
  hooksAreSet = true;
6108
6149
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6109
6150
  }
6110
- /* version: 2.9.0 */
6151
+ /* version: 2.10.0 */
6111
6152
 
6112
6153
  /*
6113
6154
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6124,6 +6165,7 @@ var LWC = (function (exports) {
6124
6165
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6125
6166
 
6126
6167
  var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6168
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6127
6169
  var styleElements = create(null);
6128
6170
  var styleSheets = create(null);
6129
6171
  var nodesToStyleSheets = new WeakMap();
@@ -6179,7 +6221,13 @@ var LWC = (function (exports) {
6179
6221
  }
6180
6222
 
6181
6223
  if (!target.adoptedStyleSheets.includes(styleSheet)) {
6182
- target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
6224
+ if (supportsMutableAdoptedStyleSheets) {
6225
+ // This is only supported in later versions of Chromium:
6226
+ // https://chromestatus.com/feature/5638996492288000
6227
+ target.adoptedStyleSheets.push(styleSheet);
6228
+ } else {
6229
+ target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
6230
+ }
6183
6231
  }
6184
6232
  }
6185
6233
 
@@ -6461,6 +6509,173 @@ var LWC = (function (exports) {
6461
6509
  setSetText(setText);
6462
6510
  setSsr(ssr);
6463
6511
  setAddEventListener(addEventListener);
6512
+ /*
6513
+ * Copyright (c) 2018, salesforce.com, inc.
6514
+ * All rights reserved.
6515
+ * SPDX-License-Identifier: MIT
6516
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6517
+ */
6518
+
6519
+ function resetShadowRootAndLightDom(element, Ctor) {
6520
+ if (element.shadowRoot) {
6521
+ var shadowRoot = element.shadowRoot;
6522
+
6523
+ while (!isNull(shadowRoot.firstChild)) {
6524
+ shadowRoot.removeChild(shadowRoot.firstChild);
6525
+ }
6526
+ }
6527
+
6528
+ if (Ctor.renderMode === 'light') {
6529
+ while (!isNull(element.firstChild)) {
6530
+ element.removeChild(element.firstChild);
6531
+ }
6532
+ }
6533
+ }
6534
+
6535
+ function createVMWithProps(element, Ctor, props) {
6536
+ createVM(element, Ctor, {
6537
+ mode: 'open',
6538
+ owner: null,
6539
+ tagName: element.tagName.toLowerCase()
6540
+ });
6541
+
6542
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
6543
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6544
+ key = _Object$entries2$_i[0],
6545
+ value = _Object$entries2$_i[1];
6546
+
6547
+ element[key] = value;
6548
+ }
6549
+ }
6550
+
6551
+ function hydrateComponent(element, Ctor) {
6552
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6553
+
6554
+ if (!(element instanceof Element)) {
6555
+ throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6556
+ }
6557
+
6558
+ if (!isFunction$1(Ctor)) {
6559
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6560
+ }
6561
+
6562
+ if (!isObject(props) || isNull(props)) {
6563
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6564
+ }
6565
+
6566
+ if (getAssociatedVMIfPresent(element)) {
6567
+ /* eslint-disable-next-line no-console */
6568
+ console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
6569
+ return;
6570
+ }
6571
+
6572
+ try {
6573
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6574
+ // and uses the same algo to create the stylesheets as in SSR.
6575
+ setIsHydrating(true);
6576
+ createVMWithProps(element, Ctor, props);
6577
+ hydrateRootElement(element); // set it back since now we finished hydration.
6578
+
6579
+ setIsHydrating(false);
6580
+ } catch (e) {
6581
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
6582
+ // with the client generated DOM.
6583
+
6584
+ /* eslint-disable-next-line no-console */
6585
+ console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
6586
+
6587
+ resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
6588
+
6589
+ createVMWithProps(element, Ctor, props);
6590
+ setIsHydrating(false);
6591
+ connectRootElement(element);
6592
+ } finally {
6593
+ // in case there's an error during recovery
6594
+ setIsHydrating(false);
6595
+ }
6596
+ }
6597
+ /*
6598
+ * Copyright (c) 2018, salesforce.com, inc.
6599
+ * All rights reserved.
6600
+ * SPDX-License-Identifier: MIT
6601
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6602
+ */
6603
+
6604
+ /**
6605
+ * This function builds a Web Component class from a LWC constructor so it can be
6606
+ * registered as a new element via customElements.define() at any given time.
6607
+ *
6608
+ * @deprecated since version 1.3.11
6609
+ *
6610
+ * @example
6611
+ * ```
6612
+ * import { buildCustomElementConstructor } from 'lwc';
6613
+ * import Foo from 'ns/foo';
6614
+ * const WC = buildCustomElementConstructor(Foo);
6615
+ * customElements.define('x-foo', WC);
6616
+ * const elm = document.createElement('x-foo');
6617
+ * ```
6618
+ */
6619
+
6620
+
6621
+ function deprecatedBuildCustomElementConstructor(Ctor) {
6622
+
6623
+ return Ctor.CustomElementConstructor;
6624
+ } // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
6625
+ // This WeakSet usage is valid because this functionality is not meant to run in IE11.
6626
+
6627
+
6628
+ var hydratedCustomElements = new WeakSet();
6629
+
6630
+ function buildCustomElementConstructor(Ctor) {
6631
+ var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6632
+ return /*#__PURE__*/function (_HtmlPrototype) {
6633
+ _inherits(_class, _HtmlPrototype);
6634
+
6635
+ var _super8 = _createSuper(_class);
6636
+
6637
+ function _class() {
6638
+ var _this6;
6639
+
6640
+ _classCallCheck(this, _class);
6641
+
6642
+ _this6 = _super8.call(this);
6643
+
6644
+ if (_this6.isConnected) {
6645
+ // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
6646
+ hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
6647
+ hydratedCustomElements.add(_assertThisInitialized(_this6));
6648
+ } else {
6649
+ createVM(_assertThisInitialized(_this6), Ctor, {
6650
+ mode: 'open',
6651
+ owner: null,
6652
+ tagName: _this6.tagName
6653
+ });
6654
+ }
6655
+
6656
+ return _this6;
6657
+ }
6658
+
6659
+ _createClass(_class, [{
6660
+ key: "connectedCallback",
6661
+ value: function connectedCallback() {
6662
+ if (hydratedCustomElements.has(this)) {
6663
+ // This is an un-upgraded element that was hydrated in the constructor.
6664
+ hydratedCustomElements.delete(this);
6665
+ } else {
6666
+ connectRootElement(this);
6667
+ }
6668
+ }
6669
+ }, {
6670
+ key: "disconnectedCallback",
6671
+ value: function disconnectedCallback() {
6672
+ disconnectRootElement(this);
6673
+ }
6674
+ }]);
6675
+
6676
+ return _class;
6677
+ }(HtmlPrototype);
6678
+ }
6464
6679
  /*
6465
6680
  * Copyright (c) 2018, salesforce.com, inc.
6466
6681
  * All rights reserved.
@@ -6470,6 +6685,7 @@ var LWC = (function (exports) {
6470
6685
  // TODO [#2472]: Remove this workaround when appropriate.
6471
6686
  // eslint-disable-next-line lwc-internal/no-global-node
6472
6687
 
6688
+
6473
6689
  var _Node$1 = Node;
6474
6690
  var ConnectingSlot = new WeakMap();
6475
6691
  var DisconnectingSlot = new WeakMap();
@@ -6574,138 +6790,6 @@ var LWC = (function (exports) {
6574
6790
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6575
6791
  */
6576
6792
 
6577
-
6578
- function hydrateComponent(element, Ctor) {
6579
- var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6580
-
6581
- if (!(element instanceof Element)) {
6582
- throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6583
- }
6584
-
6585
- if (!isFunction$1(Ctor)) {
6586
- throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6587
- }
6588
-
6589
- if (!isObject(props) || isNull(props)) {
6590
- throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6591
- }
6592
-
6593
- try {
6594
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6595
- // and uses the same algo to create the stylesheets as in SSR.
6596
- setIsHydrating(true);
6597
- createVM(element, Ctor, {
6598
- mode: 'open',
6599
- owner: null,
6600
- tagName: element.tagName.toLowerCase()
6601
- });
6602
-
6603
- for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
6604
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6605
- key = _Object$entries2$_i[0],
6606
- value = _Object$entries2$_i[1];
6607
-
6608
- element[key] = value;
6609
- }
6610
-
6611
- hydrateRootElement(element); // set it back since now we finished hydration.
6612
-
6613
- setIsHydrating(false);
6614
- } catch (e) {
6615
- // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
6616
- // the client generated DOM.
6617
-
6618
- /* eslint-disable-next-line no-console */
6619
- console.error('Recovering from error while hydrating: ', e);
6620
- setIsHydrating(false);
6621
- var newElem = createElement(element.tagName, {
6622
- is: Ctor,
6623
- mode: 'open'
6624
- });
6625
-
6626
- for (var _i34 = 0, _Object$entries3 = Object.entries(props); _i34 < _Object$entries3.length; _i34++) {
6627
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i34], 2),
6628
- _key3 = _Object$entries3$_i[0],
6629
- _value2 = _Object$entries3$_i[1];
6630
-
6631
- newElem[_key3] = _value2;
6632
- }
6633
-
6634
- element.parentNode.replaceChild(newElem, element);
6635
- }
6636
- }
6637
- /*
6638
- * Copyright (c) 2018, salesforce.com, inc.
6639
- * All rights reserved.
6640
- * SPDX-License-Identifier: MIT
6641
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6642
- */
6643
-
6644
- /**
6645
- * This function builds a Web Component class from a LWC constructor so it can be
6646
- * registered as a new element via customElements.define() at any given time.
6647
- *
6648
- * @deprecated since version 1.3.11
6649
- *
6650
- * @example
6651
- * ```
6652
- * import { buildCustomElementConstructor } from 'lwc';
6653
- * import Foo from 'ns/foo';
6654
- * const WC = buildCustomElementConstructor(Foo);
6655
- * customElements.define('x-foo', WC);
6656
- * const elm = document.createElement('x-foo');
6657
- * ```
6658
- */
6659
-
6660
-
6661
- function deprecatedBuildCustomElementConstructor(Ctor) {
6662
-
6663
- return Ctor.CustomElementConstructor;
6664
- }
6665
-
6666
- function buildCustomElementConstructor(Ctor) {
6667
- var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6668
- return /*#__PURE__*/function (_HtmlPrototype) {
6669
- _inherits(_class, _HtmlPrototype);
6670
-
6671
- var _super8 = _createSuper(_class);
6672
-
6673
- function _class() {
6674
- var _this6;
6675
-
6676
- _classCallCheck(this, _class);
6677
-
6678
- _this6 = _super8.call(this);
6679
- createVM(_assertThisInitialized(_this6), Ctor, {
6680
- mode: 'open',
6681
- owner: null,
6682
- tagName: _this6.tagName
6683
- });
6684
- return _this6;
6685
- }
6686
-
6687
- _createClass(_class, [{
6688
- key: "connectedCallback",
6689
- value: function connectedCallback() {
6690
- connectRootElement(this);
6691
- }
6692
- }, {
6693
- key: "disconnectedCallback",
6694
- value: function disconnectedCallback() {
6695
- disconnectRootElement(this);
6696
- }
6697
- }]);
6698
-
6699
- return _class;
6700
- }(HtmlPrototype);
6701
- }
6702
- /*
6703
- * Copyright (c) 2018, salesforce.com, inc.
6704
- * All rights reserved.
6705
- * SPDX-License-Identifier: MIT
6706
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6707
- */
6708
-
6709
6793
  /**
6710
6794
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6711
6795
  * This API is subject to change or being removed.
@@ -6805,7 +6889,7 @@ var LWC = (function (exports) {
6805
6889
  });
6806
6890
  freeze(LightningElement);
6807
6891
  seal(LightningElement.prototype);
6808
- /* version: 2.9.0 */
6892
+ /* version: 2.10.0 */
6809
6893
 
6810
6894
  exports.LightningElement = LightningElement;
6811
6895
  exports.__unstable__ProfilerControl = profilerControl;