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
@@ -302,7 +302,7 @@ var LWC = (function (exports) {
302
302
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
303
303
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
304
304
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
305
- /** version: 2.9.0 */
305
+ /** version: 2.10.0 */
306
306
 
307
307
  /*
308
308
  * Copyright (c) 2018, salesforce.com, inc.
@@ -369,7 +369,7 @@ var LWC = (function (exports) {
369
369
  };
370
370
  }
371
371
 
372
- function patch(propName) {
372
+ function patch$1(propName) {
373
373
  // Typescript is inferring the wrong function type for this particular
374
374
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
375
375
  // @ts-ignore type-mismatch
@@ -391,7 +391,7 @@ var LWC = (function (exports) {
391
391
  const propName = ElementPrototypeAriaPropertyNames[i];
392
392
 
393
393
  if (detect(propName)) {
394
- patch(propName);
394
+ patch$1(propName);
395
395
  }
396
396
  }
397
397
  /**
@@ -407,14 +407,15 @@ var LWC = (function (exports) {
407
407
 
408
408
 
409
409
  const features = {
410
- ENABLE_REACTIVE_SETTER: null,
411
- ENABLE_HMR: null,
412
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
410
+ DISABLE_MIXED_SHADOW_MODE: null,
413
411
  ENABLE_ELEMENT_PATCH: null,
414
412
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
415
- ENABLE_NODE_LIST_PATCH: null,
413
+ ENABLE_HMR: null,
416
414
  ENABLE_HTML_COLLECTIONS_PATCH: null,
415
+ ENABLE_INNER_OUTER_TEXT_PATCH: null,
416
+ ENABLE_NODE_LIST_PATCH: null,
417
417
  ENABLE_NODE_PATCH: null,
418
+ ENABLE_REACTIVE_SETTER: null,
418
419
  ENABLE_WIRE_SYNC_EMIT: null
419
420
  };
420
421
 
@@ -471,7 +472,7 @@ var LWC = (function (exports) {
471
472
 
472
473
  function setFeatureFlagForTest(name, value) {
473
474
  }
474
- /** version: 2.9.0 */
475
+ /** version: 2.10.0 */
475
476
 
476
477
  /* proxy-compat-disable */
477
478
 
@@ -526,7 +527,7 @@ var LWC = (function (exports) {
526
527
  }
527
528
 
528
529
  return result;
529
- } //
530
+ }
530
531
  // Primitives
531
532
  //
532
533
 
@@ -2547,6 +2548,13 @@ var LWC = (function (exports) {
2547
2548
  const meta = signedDecoratorToMetaMap.get(Ctor);
2548
2549
  return isUndefined$1(meta) ? defaultMeta : meta;
2549
2550
  }
2551
+ /*
2552
+ * Copyright (c) 2018, salesforce.com, inc.
2553
+ * All rights reserved.
2554
+ * SPDX-License-Identifier: MIT
2555
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2556
+ */
2557
+
2550
2558
 
2551
2559
  const signedTemplateSet = new Set();
2552
2560
 
@@ -2566,6 +2574,7 @@ var LWC = (function (exports) {
2566
2574
 
2567
2575
 
2568
2576
  function registerTemplate(tpl) {
2577
+
2569
2578
  signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2570
2579
  // assignment of templates easily, without too much transformation
2571
2580
 
@@ -3398,148 +3407,251 @@ var LWC = (function (exports) {
3398
3407
  */
3399
3408
 
3400
3409
 
3401
- const TextHook = {
3402
- create: vnode => {
3403
- const {
3404
- owner
3405
- } = vnode;
3406
- const elm = createText$1(vnode.text);
3407
- linkNodeToShadow(elm, owner);
3408
- vnode.elm = elm;
3409
- },
3410
- update: updateNodeHook,
3411
- insert: insertNode,
3412
- move: insertNode,
3413
- remove: removeNode
3414
- };
3415
- const CommentHook = {
3416
- create: vnode => {
3417
- const {
3418
- owner,
3419
- text
3420
- } = vnode;
3421
- const elm = createComment$1(text);
3422
- linkNodeToShadow(elm, owner);
3423
- vnode.elm = elm;
3424
- },
3425
- update: updateNodeHook,
3426
- insert: insertNode,
3427
- move: insertNode,
3428
- remove: removeNode
3429
- }; // insert is called after update, which is used somewhere else (via a module)
3430
- // to mark the vm as inserted, that means we cannot use update as the main channel
3431
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
3432
- // which breaks some invariants. For that reason, we have the following for any
3433
- // Custom Element that is inserted via a template.
3434
-
3435
- const ElementHook = {
3436
- create: vnode => {
3437
- const {
3438
- sel,
3439
- owner,
3440
- data: {
3441
- svg
3442
- }
3443
- } = vnode;
3444
- const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3445
- const elm = createElement$2(sel, namespace);
3446
- linkNodeToShadow(elm, owner);
3447
- fallbackElmHook(elm, vnode);
3448
- vnode.elm = elm;
3449
- patchElementPropsAndAttrs$1(null, vnode);
3450
- },
3451
- update: (oldVnode, vnode) => {
3452
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3453
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3454
- },
3455
- insert: (vnode, parentNode, referenceNode) => {
3456
- insertNode(vnode, parentNode, referenceNode);
3457
- createChildrenHook(vnode);
3458
- },
3459
- move: insertNode,
3460
- remove: (vnode, parentNode) => {
3461
- removeNode(vnode, parentNode);
3462
- removeChildren(vnode);
3410
+ function patchChildren(c1, c2, parent) {
3411
+ if (hasDynamicChildren(c2)) {
3412
+ updateDynamicChildren(c1, c2, parent);
3413
+ } else {
3414
+ updateStaticChildren(c1, c2, parent);
3463
3415
  }
3464
- };
3465
- const CustomElementHook = {
3466
- create: vnode => {
3467
- const {
3468
- sel,
3469
- owner
3470
- } = vnode;
3471
- const UpgradableConstructor = getUpgradableConstructor(sel);
3472
- /**
3473
- * Note: if the upgradable constructor does not expect, or throw when we new it
3474
- * with a callback as the first argument, we could implement a more advanced
3475
- * mechanism that only passes that argument if the constructor is known to be
3476
- * an upgradable custom element.
3477
- */
3478
-
3479
- let vm;
3480
- const elm = new UpgradableConstructor(elm => {
3481
- // the custom element from the registry is expecting an upgrade callback
3482
- vm = createViewModelHook(elm, vnode);
3483
- });
3484
- linkNodeToShadow(elm, owner);
3485
- vnode.elm = elm;
3416
+ }
3486
3417
 
3487
- if (vm) {
3488
- allocateChildren(vnode, vm);
3489
- } else if (vnode.ctor !== UpgradableConstructor) {
3490
- throw new TypeError(`Incorrect Component Constructor`);
3491
- }
3418
+ function patch(n1, n2) {
3419
+ if (n1 === n2) {
3420
+ return;
3421
+ }
3492
3422
 
3493
- patchElementPropsAndAttrs$1(null, vnode);
3494
- },
3495
- update: (oldVnode, vnode) => {
3496
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3497
- const vm = getAssociatedVMIfPresent(vnode.elm);
3423
+ switch (n2.type) {
3424
+ case 0
3425
+ /* Text */
3426
+ :
3427
+ patchText(n1, n2);
3428
+ break;
3498
3429
 
3499
- if (vm) {
3500
- // in fallback mode, the allocation will always set children to
3501
- // empty and delegate the real allocation to the slot elements
3502
- allocateChildren(vnode, vm);
3503
- } // in fallback mode, the children will be always empty, so, nothing
3504
- // will happen, but in native, it does allocate the light dom
3430
+ case 1
3431
+ /* Comment */
3432
+ :
3433
+ patchComment(n1, n2);
3434
+ break;
3505
3435
 
3436
+ case 2
3437
+ /* Element */
3438
+ :
3439
+ patchElement(n1, n2);
3440
+ break;
3506
3441
 
3507
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3442
+ case 3
3443
+ /* CustomElement */
3444
+ :
3445
+ patchCustomElement(n1, n2);
3446
+ break;
3447
+ }
3448
+ }
3508
3449
 
3509
- if (vm) {
3510
- // this is important to preserve the top to bottom synchronous rendering phase.
3450
+ function mount(node, parent, anchor) {
3451
+ switch (node.type) {
3452
+ case 0
3453
+ /* Text */
3454
+ :
3455
+ mountText(node, parent, anchor);
3456
+ break;
3511
3457
 
3458
+ case 1
3459
+ /* Comment */
3460
+ :
3461
+ mountComment(node, parent, anchor);
3462
+ break;
3512
3463
 
3513
- rerenderVM(vm);
3514
- }
3515
- },
3516
- insert: (vnode, parentNode, referenceNode) => {
3517
- insertNode(vnode, parentNode, referenceNode);
3518
- const vm = getAssociatedVMIfPresent(vnode.elm);
3464
+ case 2
3465
+ /* Element */
3466
+ :
3467
+ mountElement(node, parent, anchor);
3468
+ break;
3469
+
3470
+ case 3
3471
+ /* CustomElement */
3472
+ :
3473
+ mountCustomElement(node, parent, anchor);
3474
+ break;
3475
+ }
3476
+ }
3477
+
3478
+ function patchText(n1, n2) {
3479
+ n2.elm = n1.elm;
3480
+
3481
+ if (n2.text !== n1.text) {
3482
+ updateTextContent(n2);
3483
+ }
3484
+ }
3485
+
3486
+ function mountText(node, parent, anchor) {
3487
+ const {
3488
+ owner
3489
+ } = node;
3490
+ const textNode = node.elm = createText$1(node.text);
3491
+ linkNodeToShadow(textNode, owner);
3492
+ insertNode(textNode, parent, anchor);
3493
+ }
3494
+
3495
+ function patchComment(n1, n2) {
3496
+ n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3497
+ // it is the case today.
3519
3498
 
3520
- if (vm) {
3499
+ if (n2.text !== n1.text) {
3500
+ updateTextContent(n2);
3501
+ }
3502
+ }
3521
3503
 
3522
- runConnectedCallback(vm);
3504
+ function mountComment(node, parent, anchor) {
3505
+ const {
3506
+ owner
3507
+ } = node;
3508
+ const commentNode = node.elm = createComment$1(node.text);
3509
+ linkNodeToShadow(commentNode, owner);
3510
+ insertNode(commentNode, parent, anchor);
3511
+ }
3512
+
3513
+ function mountElement(vnode, parent, anchor) {
3514
+ const {
3515
+ sel,
3516
+ owner,
3517
+ data: {
3518
+ svg
3523
3519
  }
3520
+ } = vnode;
3521
+ const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3522
+ const elm = createElement$2(sel, namespace);
3523
+ linkNodeToShadow(elm, owner);
3524
+ fallbackElmHook(elm, vnode);
3525
+ vnode.elm = elm;
3526
+ patchElementPropsAndAttrs$1(null, vnode);
3527
+ insertNode(elm, parent, anchor);
3528
+ mountVNodes(vnode.children, elm, null);
3529
+ }
3530
+
3531
+ function patchElement(n1, n2) {
3532
+ const elm = n2.elm = n1.elm;
3533
+ patchElementPropsAndAttrs$1(n1, n2);
3534
+ patchChildren(n1.children, n2.children, elm);
3535
+ }
3536
+
3537
+ function mountCustomElement(vnode, parent, anchor) {
3538
+ const {
3539
+ sel,
3540
+ owner
3541
+ } = vnode;
3542
+ const UpgradableConstructor = getUpgradableConstructor(sel);
3543
+ /**
3544
+ * Note: if the upgradable constructor does not expect, or throw when we new it
3545
+ * with a callback as the first argument, we could implement a more advanced
3546
+ * mechanism that only passes that argument if the constructor is known to be
3547
+ * an upgradable custom element.
3548
+ */
3549
+
3550
+ let vm;
3551
+ const elm = new UpgradableConstructor(elm => {
3552
+ // the custom element from the registry is expecting an upgrade callback
3553
+ vm = createViewModelHook(elm, vnode);
3554
+ });
3555
+ linkNodeToShadow(elm, owner);
3556
+ vnode.elm = elm;
3557
+ vnode.vm = vm;
3558
+
3559
+ if (vm) {
3560
+ allocateChildren(vnode, vm);
3561
+ } else if (vnode.ctor !== UpgradableConstructor) {
3562
+ throw new TypeError(`Incorrect Component Constructor`);
3563
+ }
3564
+
3565
+ patchElementPropsAndAttrs$1(null, vnode);
3566
+ insertNode(elm, parent, anchor);
3567
+
3568
+ if (vm) {
3524
3569
 
3525
- createChildrenHook(vnode);
3570
+ runConnectedCallback(vm);
3571
+ }
3572
+
3573
+ mountVNodes(vnode.children, elm, null);
3574
+
3575
+ if (vm) {
3576
+ appendVM(vm);
3577
+ }
3578
+ }
3579
+
3580
+ function patchCustomElement(n1, n2) {
3581
+ const elm = n2.elm = n1.elm;
3582
+ const vm = n2.vm = n1.vm;
3583
+ patchElementPropsAndAttrs$1(n1, n2);
3584
+
3585
+ if (!isUndefined$1(vm)) {
3586
+ // in fallback mode, the allocation will always set children to
3587
+ // empty and delegate the real allocation to the slot elements
3588
+ allocateChildren(n2, vm);
3589
+ } // in fallback mode, the children will be always empty, so, nothing
3590
+ // will happen, but in native, it does allocate the light dom
3591
+
3592
+
3593
+ patchChildren(n1.children, n2.children, elm);
3594
+
3595
+ if (!isUndefined$1(vm)) {
3596
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3597
+ // this is important to preserve the top to bottom synchronous rendering phase.
3598
+ rerenderVM(vm);
3599
+ }
3600
+ }
3526
3601
 
3527
- if (vm) {
3528
- appendVM(vm);
3602
+ function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
3603
+ for (; start < end; ++start) {
3604
+ const vnode = vnodes[start];
3605
+
3606
+ if (isVNode(vnode)) {
3607
+ mount(vnode, parent, anchor);
3529
3608
  }
3530
- },
3531
- move: insertNode,
3532
- remove: (vnode, parentNode) => {
3533
- removeNode(vnode, parentNode);
3534
- const vm = getAssociatedVMIfPresent(vnode.elm);
3535
-
3536
- if (vm) {
3537
- // for custom elements we don't have to go recursively because the removeVM routine
3538
- // will take care of disconnecting any child VM attached to its shadow as well.
3539
- removeVM(vm);
3609
+ }
3610
+ }
3611
+
3612
+ function unmount(vnode, parent, doRemove = false) {
3613
+ const {
3614
+ type,
3615
+ elm
3616
+ } = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3617
+ // subtree root, is the only element worth unmounting from the subtree.
3618
+
3619
+ if (doRemove) {
3620
+ removeNode(elm, parent);
3621
+ }
3622
+
3623
+ switch (type) {
3624
+ case 2
3625
+ /* Element */
3626
+ :
3627
+ unmountVNodes(vnode.children, elm);
3628
+ break;
3629
+
3630
+ case 3
3631
+ /* CustomElement */
3632
+ :
3633
+ {
3634
+ const {
3635
+ vm
3636
+ } = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
3637
+ // children.
3638
+
3639
+ if (!isUndefined$1(vm)) {
3640
+ removeVM(vm);
3641
+ }
3642
+ }
3643
+ }
3644
+ }
3645
+
3646
+ function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
3647
+ for (; start < end; ++start) {
3648
+ const ch = vnodes[start];
3649
+
3650
+ if (isVNode(ch)) {
3651
+ unmount(ch, parent, doRemove);
3540
3652
  }
3541
3653
  }
3542
- };
3654
+ }
3543
3655
 
3544
3656
  function isVNode(vnode) {
3545
3657
  return vnode != null;
@@ -3584,26 +3696,23 @@ var LWC = (function (exports) {
3584
3696
  }
3585
3697
  }
3586
3698
 
3587
- function updateNodeHook(oldVnode, vnode) {
3699
+ function updateTextContent(vnode) {
3588
3700
  const {
3589
3701
  elm,
3590
3702
  text
3591
3703
  } = vnode;
3592
3704
 
3593
- if (oldVnode.text !== text) {
3594
-
3595
- setText$1(elm, text);
3596
- }
3705
+ setText$1(elm, text);
3597
3706
  }
3598
3707
 
3599
- function insertNode(vnode, parentNode, referenceNode) {
3708
+ function insertNode(node, parent, anchor) {
3600
3709
 
3601
- insert$1(vnode.elm, parentNode, referenceNode);
3710
+ insert$1(node, parent, anchor);
3602
3711
  }
3603
3712
 
3604
- function removeNode(vnode, parentNode) {
3713
+ function removeNode(node, parent) {
3605
3714
 
3606
- remove$1(vnode.elm, parentNode);
3715
+ remove$1(node, parent);
3607
3716
  }
3608
3717
 
3609
3718
  function patchElementPropsAndAttrs$1(oldVnode, vnode) {
@@ -3654,14 +3763,6 @@ var LWC = (function (exports) {
3654
3763
  }
3655
3764
  }
3656
3765
 
3657
- function patchChildren(parent, oldCh, newCh) {
3658
- if (hasDynamicChildren(newCh)) {
3659
- updateDynamicChildren(parent, oldCh, newCh);
3660
- } else {
3661
- updateStaticChildren(parent, oldCh, newCh);
3662
- }
3663
- }
3664
-
3665
3766
  function allocateChildren(vnode, vm) {
3666
3767
  // A component with slots will re-render because:
3667
3768
  // 1- There is a change of the internal state.
@@ -3733,40 +3834,6 @@ var LWC = (function (exports) {
3733
3834
  return vm;
3734
3835
  }
3735
3836
 
3736
- function createChildrenHook(vnode) {
3737
- const {
3738
- elm,
3739
- children
3740
- } = vnode;
3741
-
3742
- for (let j = 0; j < children.length; ++j) {
3743
- const ch = children[j];
3744
-
3745
- if (ch != null) {
3746
- ch.hook.create(ch);
3747
- ch.hook.insert(ch, elm, null);
3748
- }
3749
- }
3750
- }
3751
-
3752
- function removeChildren(vnode) {
3753
- // this method only needs to search on child vnodes from template
3754
- // to trigger the remove hook just in case some of those children
3755
- // are custom elements.
3756
- const {
3757
- children,
3758
- elm
3759
- } = vnode;
3760
-
3761
- for (let j = 0, len = children.length; j < len; ++j) {
3762
- const ch = children[j];
3763
-
3764
- if (!isNull(ch)) {
3765
- ch.hook.remove(ch, elm);
3766
- }
3767
- }
3768
- }
3769
-
3770
3837
  function allocateInSlot(vm, children) {
3771
3838
  var _a;
3772
3839
 
@@ -3863,28 +3930,7 @@ var LWC = (function (exports) {
3863
3930
  return map;
3864
3931
  }
3865
3932
 
3866
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
3867
- for (; startIdx <= endIdx; ++startIdx) {
3868
- const ch = vnodes[startIdx];
3869
-
3870
- if (isVNode(ch)) {
3871
- ch.hook.create(ch);
3872
- ch.hook.insert(ch, parentElm, before);
3873
- }
3874
- }
3875
- }
3876
-
3877
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
3878
- for (; startIdx <= endIdx; ++startIdx) {
3879
- const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
3880
-
3881
- if (isVNode(ch)) {
3882
- ch.hook.remove(ch, parentElm);
3883
- }
3884
- }
3885
- }
3886
-
3887
- function updateDynamicChildren(parentElm, oldCh, newCh) {
3933
+ function updateDynamicChildren(oldCh, newCh, parent) {
3888
3934
  let oldStartIdx = 0;
3889
3935
  let newStartIdx = 0;
3890
3936
  let oldEndIdx = oldCh.length - 1;
@@ -3910,23 +3956,23 @@ var LWC = (function (exports) {
3910
3956
  } else if (!isVNode(newEndVnode)) {
3911
3957
  newEndVnode = newCh[--newEndIdx];
3912
3958
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
3913
- patchVnode(oldStartVnode, newStartVnode);
3959
+ patch(oldStartVnode, newStartVnode);
3914
3960
  oldStartVnode = oldCh[++oldStartIdx];
3915
3961
  newStartVnode = newCh[++newStartIdx];
3916
3962
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
3917
- patchVnode(oldEndVnode, newEndVnode);
3963
+ patch(oldEndVnode, newEndVnode);
3918
3964
  oldEndVnode = oldCh[--oldEndIdx];
3919
3965
  newEndVnode = newCh[--newEndIdx];
3920
3966
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
3921
3967
  // Vnode moved right
3922
- patchVnode(oldStartVnode, newEndVnode);
3923
- newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
3968
+ patch(oldStartVnode, newEndVnode);
3969
+ insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
3924
3970
  oldStartVnode = oldCh[++oldStartIdx];
3925
3971
  newEndVnode = newCh[--newEndIdx];
3926
3972
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
3927
3973
  // Vnode moved left
3928
- patchVnode(oldEndVnode, newStartVnode);
3929
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
3974
+ patch(oldEndVnode, newStartVnode);
3975
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
3930
3976
  oldEndVnode = oldCh[--oldEndIdx];
3931
3977
  newStartVnode = newCh[++newStartIdx];
3932
3978
  } else {
@@ -3938,8 +3984,7 @@ var LWC = (function (exports) {
3938
3984
 
3939
3985
  if (isUndefined$1(idxInOld)) {
3940
3986
  // New element
3941
- newStartVnode.hook.create(newStartVnode);
3942
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3987
+ mount(newStartVnode, parent, oldStartVnode.elm);
3943
3988
  newStartVnode = newCh[++newStartIdx];
3944
3989
  } else {
3945
3990
  elmToMove = oldCh[idxInOld];
@@ -3947,10 +3992,9 @@ var LWC = (function (exports) {
3947
3992
  if (isVNode(elmToMove)) {
3948
3993
  if (elmToMove.sel !== newStartVnode.sel) {
3949
3994
  // New element
3950
- newStartVnode.hook.create(newStartVnode);
3951
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3995
+ mount(newStartVnode, parent, oldStartVnode.elm);
3952
3996
  } else {
3953
- patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3997
+ patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3954
3998
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3955
3999
  // so we only care about the `oldCh` object inside this function.
3956
4000
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -3963,7 +4007,7 @@ var LWC = (function (exports) {
3963
4007
 
3964
4008
 
3965
4009
  oldCh[idxInOld] = undefined;
3966
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
4010
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm);
3967
4011
  }
3968
4012
  }
3969
4013
 
@@ -3984,65 +4028,55 @@ var LWC = (function (exports) {
3984
4028
  } while (!isVNode(n) && i < newChEnd);
3985
4029
 
3986
4030
  before = isVNode(n) ? n.elm : null;
3987
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
4031
+ mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
3988
4032
  } else {
3989
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
4033
+ unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
3990
4034
  }
3991
4035
  }
3992
4036
  }
3993
4037
 
3994
- function updateStaticChildren(parentElm, oldCh, newCh) {
3995
- const oldChLength = oldCh.length;
3996
- const newChLength = newCh.length;
4038
+ function updateStaticChildren(c1, c2, parent) {
4039
+ const c1Length = c1.length;
4040
+ const c2Length = c2.length;
3997
4041
 
3998
- if (oldChLength === 0) {
4042
+ if (c1Length === 0) {
3999
4043
  // the old list is empty, we can directly insert anything new
4000
- addVnodes(parentElm, null, newCh, 0, newChLength);
4044
+ mountVNodes(c2, parent, null);
4001
4045
  return;
4002
4046
  }
4003
4047
 
4004
- if (newChLength === 0) {
4048
+ if (c2Length === 0) {
4005
4049
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4006
4050
  // this is the case in which the dynamic children of an if-directive should be removed
4007
- removeVnodes(parentElm, oldCh, 0, oldChLength);
4051
+ unmountVNodes(c1, parent, true);
4008
4052
  return;
4009
4053
  } // if the old list is not empty, the new list MUST have the same
4010
4054
  // amount of nodes, that's why we call this static children
4011
4055
 
4012
4056
 
4013
- let referenceElm = null;
4057
+ let anchor = null;
4014
4058
 
4015
- for (let i = newChLength - 1; i >= 0; i -= 1) {
4016
- const vnode = newCh[i];
4017
- const oldVNode = oldCh[i];
4059
+ for (let i = c2Length - 1; i >= 0; i -= 1) {
4060
+ const n1 = c1[i];
4061
+ const n2 = c2[i];
4018
4062
 
4019
- if (vnode !== oldVNode) {
4020
- if (isVNode(oldVNode)) {
4021
- if (isVNode(vnode)) {
4022
- // both vnodes must be equivalent, and se just need to patch them
4023
- patchVnode(oldVNode, vnode);
4024
- referenceElm = vnode.elm;
4063
+ if (n2 !== n1) {
4064
+ if (isVNode(n1)) {
4065
+ if (isVNode(n2)) {
4066
+ // both vnodes are equivalent, and we just need to patch them
4067
+ patch(n1, n2);
4068
+ anchor = n2.elm;
4025
4069
  } else {
4026
4070
  // removing the old vnode since the new one is null
4027
- oldVNode.hook.remove(oldVNode, parentElm);
4071
+ unmount(n1, parent, true);
4028
4072
  }
4029
- } else if (isVNode(vnode)) {
4030
- // this condition is unnecessary
4031
- vnode.hook.create(vnode); // insert the new node one since the old one is null
4032
-
4033
- vnode.hook.insert(vnode, parentElm, referenceElm);
4034
- referenceElm = vnode.elm;
4073
+ } else if (isVNode(n2)) {
4074
+ mount(n2, parent, anchor);
4075
+ anchor = n2.elm;
4035
4076
  }
4036
4077
  }
4037
4078
  }
4038
4079
  }
4039
-
4040
- function patchVnode(oldVnode, vnode) {
4041
- if (oldVnode !== vnode) {
4042
- vnode.elm = oldVnode.elm;
4043
- vnode.hook.update(oldVnode, vnode);
4044
- }
4045
- }
4046
4080
  /*
4047
4081
  * Copyright (c) 2018, salesforce.com, inc.
4048
4082
  * All rights reserved.
@@ -4074,7 +4108,6 @@ var LWC = (function (exports) {
4074
4108
  children,
4075
4109
  elm,
4076
4110
  key,
4077
- hook: ElementHook,
4078
4111
  owner: vmBeingRendered
4079
4112
  };
4080
4113
  } // [t]ab[i]ndex function
@@ -4126,7 +4159,7 @@ var LWC = (function (exports) {
4126
4159
  const {
4127
4160
  key
4128
4161
  } = data;
4129
- let elm;
4162
+ let elm, aChildren, vm;
4130
4163
  const vnode = {
4131
4164
  type: 3
4132
4165
  /* CustomElement */
@@ -4136,11 +4169,11 @@ var LWC = (function (exports) {
4136
4169
  children,
4137
4170
  elm,
4138
4171
  key,
4139
- hook: CustomElementHook,
4140
4172
  ctor: Ctor,
4141
4173
  owner: vmBeingRendered,
4142
- mode: 'open' // TODO [#1294]: this should be defined in Ctor
4143
-
4174
+ mode: 'open',
4175
+ aChildren,
4176
+ vm
4144
4177
  };
4145
4178
  addVNodeToChildLWC(vnode);
4146
4179
  return vnode;
@@ -4222,7 +4255,6 @@ var LWC = (function (exports) {
4222
4255
  text,
4223
4256
  elm,
4224
4257
  key,
4225
- hook: TextHook,
4226
4258
  owner: getVMBeingRendered()
4227
4259
  };
4228
4260
  } // [co]mment node
@@ -4238,7 +4270,6 @@ var LWC = (function (exports) {
4238
4270
  text,
4239
4271
  elm,
4240
4272
  key,
4241
- hook: CommentHook,
4242
4273
  owner: getVMBeingRendered()
4243
4274
  };
4244
4275
  } // [d]ynamic text
@@ -4967,6 +4998,7 @@ var LWC = (function (exports) {
4967
4998
  function registerComponent(Ctor, {
4968
4999
  tmpl
4969
5000
  }) {
5001
+
4970
5002
  signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
4971
5003
  // without too much transformation
4972
5004
 
@@ -5076,7 +5108,7 @@ var LWC = (function (exports) {
5076
5108
  */
5077
5109
 
5078
5110
 
5079
- function hydrate$1(vnode, node) {
5111
+ function hydrate(vnode, node) {
5080
5112
  switch (vnode.type) {
5081
5113
  case 0
5082
5114
  /* Text */
@@ -5108,7 +5140,7 @@ var LWC = (function (exports) {
5108
5140
  var _a;
5109
5141
 
5110
5142
 
5111
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5143
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5112
5144
  vnode.elm = node;
5113
5145
  }
5114
5146
 
@@ -5116,7 +5148,7 @@ var LWC = (function (exports) {
5116
5148
  var _a;
5117
5149
 
5118
5150
 
5119
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5151
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5120
5152
  vnode.elm = node;
5121
5153
  }
5122
5154
 
@@ -5139,13 +5171,13 @@ var LWC = (function (exports) {
5139
5171
  } = vnode.data;
5140
5172
 
5141
5173
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5142
- if (elm.innerHTML === props.innerHTML) {
5174
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5143
5175
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5144
5176
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
5145
5177
  props: cloneAndOmitKey(props, 'innerHTML')
5146
5178
  });
5147
5179
  } else {
5148
- logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
5180
+ logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
5149
5181
  }
5150
5182
  }
5151
5183
  }
@@ -5153,14 +5185,13 @@ var LWC = (function (exports) {
5153
5185
  patchElementPropsAndAttrs(vnode);
5154
5186
 
5155
5187
  if (!isDomManual) {
5156
- hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);
5188
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5157
5189
  }
5158
5190
  }
5159
5191
 
5160
5192
  function hydrateCustomElement(vnode, node) {
5161
5193
 
5162
5194
  const elm = node;
5163
- vnode.elm = elm;
5164
5195
  const {
5165
5196
  sel,
5166
5197
  mode,
@@ -5172,6 +5203,8 @@ var LWC = (function (exports) {
5172
5203
  owner,
5173
5204
  tagName: sel
5174
5205
  });
5206
+ vnode.elm = elm;
5207
+ vnode.vm = vm;
5175
5208
  allocateChildren(vnode, vm);
5176
5209
  patchElementPropsAndAttrs(vnode); // Insert hook section:
5177
5210
 
@@ -5182,7 +5215,7 @@ var LWC = (function (exports) {
5182
5215
  ) {
5183
5216
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5184
5217
  // Note: for Light DOM, this is handled while hydrating the VM
5185
- hydrateChildren(vnode.elm.childNodes, vnode.children);
5218
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5186
5219
  }
5187
5220
 
5188
5221
  hydrateVM(vm);
@@ -5197,7 +5230,7 @@ var LWC = (function (exports) {
5197
5230
 
5198
5231
  if (!isNull(childVnode)) {
5199
5232
  const childNode = elmChildren[childNodeIndex];
5200
- hydrate$1(childVnode, childNode);
5233
+ hydrate(childVnode, childNode);
5201
5234
  childNodeIndex++;
5202
5235
  }
5203
5236
  }
@@ -5272,7 +5305,19 @@ var LWC = (function (exports) {
5272
5305
  }
5273
5306
 
5274
5307
  function hydrateVM(vm) {
5275
- hydrate(vm);
5308
+ if (isTrue(vm.isDirty)) {
5309
+ // manually diffing/patching here.
5310
+ // This routine is:
5311
+ // patchShadowRoot(vm, children);
5312
+ // -> addVnodes.
5313
+ const children = renderComponent(vm);
5314
+ vm.children = children;
5315
+ const vmChildren = vm.renderMode === 0
5316
+ /* Light */
5317
+ ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5318
+ hydrateChildren(vmChildren, children);
5319
+ runRenderedCallback(vm);
5320
+ }
5276
5321
  } // just in case the component comes back, with this we guarantee re-rendering it
5277
5322
  // while preventing any attempt to rehydration until after reinsertion.
5278
5323
 
@@ -5400,7 +5445,11 @@ var LWC = (function (exports) {
5400
5445
  /* Native */
5401
5446
  ;
5402
5447
  } else if (isNativeShadowDefined$1) {
5403
- if (def.shadowSupportMode === "any"
5448
+ if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
5449
+ shadowMode = 1
5450
+ /* Synthetic */
5451
+ ;
5452
+ } else if (def.shadowSupportMode === "any"
5404
5453
  /* Any */
5405
5454
  ) {
5406
5455
  shadowMode = 0
@@ -5464,22 +5513,6 @@ var LWC = (function (exports) {
5464
5513
  }
5465
5514
  }
5466
5515
 
5467
- function hydrate(vm) {
5468
- if (isTrue(vm.isDirty)) {
5469
- // manually diffing/patching here.
5470
- // This routine is:
5471
- // patchShadowRoot(vm, children);
5472
- // -> addVnodes.
5473
- const children = renderComponent(vm);
5474
- vm.children = children;
5475
- const vmChildren = vm.renderMode === 0
5476
- /* Light */
5477
- ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
5478
- hydrateChildren(vmChildren, children);
5479
- runRenderedCallback(vm);
5480
- }
5481
- }
5482
-
5483
5516
  function patchShadowRoot(vm, newCh) {
5484
5517
  const {
5485
5518
  renderRoot,
@@ -5499,7 +5532,7 @@ var LWC = (function (exports) {
5499
5532
  , vm);
5500
5533
  }, () => {
5501
5534
  // job
5502
- patchChildren(renderRoot, oldCh, newCh);
5535
+ patchChildren(oldCh, newCh, renderRoot);
5503
5536
  }, () => {
5504
5537
  // post
5505
5538
  logOperationEnd(2
@@ -6209,7 +6242,7 @@ var LWC = (function (exports) {
6209
6242
  hooksAreSet = true;
6210
6243
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6211
6244
  }
6212
- /* version: 2.9.0 */
6245
+ /* version: 2.10.0 */
6213
6246
 
6214
6247
  /*
6215
6248
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6226,6 +6259,7 @@ var LWC = (function (exports) {
6226
6259
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6227
6260
 
6228
6261
  const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6262
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6229
6263
  const styleElements = create(null);
6230
6264
  const styleSheets = create(null);
6231
6265
  const nodesToStyleSheets = new WeakMap();
@@ -6269,7 +6303,13 @@ var LWC = (function (exports) {
6269
6303
  }
6270
6304
 
6271
6305
  if (!target.adoptedStyleSheets.includes(styleSheet)) {
6272
- target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];
6306
+ if (supportsMutableAdoptedStyleSheets) {
6307
+ // This is only supported in later versions of Chromium:
6308
+ // https://chromestatus.com/feature/5638996492288000
6309
+ target.adoptedStyleSheets.push(styleSheet);
6310
+ } else {
6311
+ target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];
6312
+ }
6273
6313
  }
6274
6314
  }
6275
6315
 
@@ -6553,6 +6593,152 @@ var LWC = (function (exports) {
6553
6593
  setSetText(setText);
6554
6594
  setSsr(ssr);
6555
6595
  setAddEventListener(addEventListener);
6596
+ /*
6597
+ * Copyright (c) 2018, salesforce.com, inc.
6598
+ * All rights reserved.
6599
+ * SPDX-License-Identifier: MIT
6600
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6601
+ */
6602
+
6603
+ function resetShadowRootAndLightDom(element, Ctor) {
6604
+ if (element.shadowRoot) {
6605
+ const shadowRoot = element.shadowRoot;
6606
+
6607
+ while (!isNull(shadowRoot.firstChild)) {
6608
+ shadowRoot.removeChild(shadowRoot.firstChild);
6609
+ }
6610
+ }
6611
+
6612
+ if (Ctor.renderMode === 'light') {
6613
+ while (!isNull(element.firstChild)) {
6614
+ element.removeChild(element.firstChild);
6615
+ }
6616
+ }
6617
+ }
6618
+
6619
+ function createVMWithProps(element, Ctor, props) {
6620
+ createVM(element, Ctor, {
6621
+ mode: 'open',
6622
+ owner: null,
6623
+ tagName: element.tagName.toLowerCase()
6624
+ });
6625
+
6626
+ for (const [key, value] of Object.entries(props)) {
6627
+ element[key] = value;
6628
+ }
6629
+ }
6630
+
6631
+ function hydrateComponent(element, Ctor, props = {}) {
6632
+ if (!(element instanceof Element)) {
6633
+ throw new TypeError(`"hydrateComponent" expects a valid DOM element as the first parameter but instead received ${element}.`);
6634
+ }
6635
+
6636
+ if (!isFunction$1(Ctor)) {
6637
+ throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
6638
+ }
6639
+
6640
+ if (!isObject(props) || isNull(props)) {
6641
+ throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
6642
+ }
6643
+
6644
+ if (getAssociatedVMIfPresent(element)) {
6645
+ /* eslint-disable-next-line no-console */
6646
+ console.warn(`"hydrateComponent" expects an element that is not hydrated.`, element);
6647
+ return;
6648
+ }
6649
+
6650
+ try {
6651
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6652
+ // and uses the same algo to create the stylesheets as in SSR.
6653
+ setIsHydrating(true);
6654
+ createVMWithProps(element, Ctor, props);
6655
+ hydrateRootElement(element); // set it back since now we finished hydration.
6656
+
6657
+ setIsHydrating(false);
6658
+ } catch (e) {
6659
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
6660
+ // with the client generated DOM.
6661
+
6662
+ /* eslint-disable-next-line no-console */
6663
+ console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
6664
+
6665
+ resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
6666
+
6667
+ createVMWithProps(element, Ctor, props);
6668
+ setIsHydrating(false);
6669
+ connectRootElement(element);
6670
+ } finally {
6671
+ // in case there's an error during recovery
6672
+ setIsHydrating(false);
6673
+ }
6674
+ }
6675
+ /*
6676
+ * Copyright (c) 2018, salesforce.com, inc.
6677
+ * All rights reserved.
6678
+ * SPDX-License-Identifier: MIT
6679
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6680
+ */
6681
+
6682
+ /**
6683
+ * This function builds a Web Component class from a LWC constructor so it can be
6684
+ * registered as a new element via customElements.define() at any given time.
6685
+ *
6686
+ * @deprecated since version 1.3.11
6687
+ *
6688
+ * @example
6689
+ * ```
6690
+ * import { buildCustomElementConstructor } from 'lwc';
6691
+ * import Foo from 'ns/foo';
6692
+ * const WC = buildCustomElementConstructor(Foo);
6693
+ * customElements.define('x-foo', WC);
6694
+ * const elm = document.createElement('x-foo');
6695
+ * ```
6696
+ */
6697
+
6698
+
6699
+ function deprecatedBuildCustomElementConstructor(Ctor) {
6700
+
6701
+ return Ctor.CustomElementConstructor;
6702
+ } // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
6703
+ // This WeakSet usage is valid because this functionality is not meant to run in IE11.
6704
+
6705
+
6706
+ const hydratedCustomElements = new WeakSet();
6707
+
6708
+ function buildCustomElementConstructor(Ctor) {
6709
+ const HtmlPrototype = getComponentHtmlPrototype(Ctor);
6710
+ return class extends HtmlPrototype {
6711
+ constructor() {
6712
+ super();
6713
+
6714
+ if (this.isConnected) {
6715
+ // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
6716
+ hydrateComponent(this, Ctor, {});
6717
+ hydratedCustomElements.add(this);
6718
+ } else {
6719
+ createVM(this, Ctor, {
6720
+ mode: 'open',
6721
+ owner: null,
6722
+ tagName: this.tagName
6723
+ });
6724
+ }
6725
+ }
6726
+
6727
+ connectedCallback() {
6728
+ if (hydratedCustomElements.has(this)) {
6729
+ // This is an un-upgraded element that was hydrated in the constructor.
6730
+ hydratedCustomElements.delete(this);
6731
+ } else {
6732
+ connectRootElement(this);
6733
+ }
6734
+ }
6735
+
6736
+ disconnectedCallback() {
6737
+ disconnectRootElement(this);
6738
+ }
6739
+
6740
+ };
6741
+ }
6556
6742
  /*
6557
6743
  * Copyright (c) 2018, salesforce.com, inc.
6558
6744
  * All rights reserved.
@@ -6562,6 +6748,7 @@ var LWC = (function (exports) {
6562
6748
  // TODO [#2472]: Remove this workaround when appropriate.
6563
6749
  // eslint-disable-next-line lwc-internal/no-global-node
6564
6750
 
6751
+
6565
6752
  const _Node$1 = Node;
6566
6753
  const ConnectingSlot = new WeakMap();
6567
6754
  const DisconnectingSlot = new WeakMap();
@@ -6667,114 +6854,6 @@ var LWC = (function (exports) {
6667
6854
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6668
6855
  */
6669
6856
 
6670
-
6671
- function hydrateComponent(element, Ctor, props = {}) {
6672
- if (!(element instanceof Element)) {
6673
- throw new TypeError(`"hydrateComponent" expects a valid DOM element as the first parameter but instead received ${element}.`);
6674
- }
6675
-
6676
- if (!isFunction$1(Ctor)) {
6677
- throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
6678
- }
6679
-
6680
- if (!isObject(props) || isNull(props)) {
6681
- throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
6682
- }
6683
-
6684
- try {
6685
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6686
- // and uses the same algo to create the stylesheets as in SSR.
6687
- setIsHydrating(true);
6688
- createVM(element, Ctor, {
6689
- mode: 'open',
6690
- owner: null,
6691
- tagName: element.tagName.toLowerCase()
6692
- });
6693
-
6694
- for (const [key, value] of Object.entries(props)) {
6695
- element[key] = value;
6696
- }
6697
-
6698
- hydrateRootElement(element); // set it back since now we finished hydration.
6699
-
6700
- setIsHydrating(false);
6701
- } catch (e) {
6702
- // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
6703
- // the client generated DOM.
6704
-
6705
- /* eslint-disable-next-line no-console */
6706
- console.error('Recovering from error while hydrating: ', e);
6707
- setIsHydrating(false);
6708
- const newElem = createElement(element.tagName, {
6709
- is: Ctor,
6710
- mode: 'open'
6711
- });
6712
-
6713
- for (const [key, value] of Object.entries(props)) {
6714
- newElem[key] = value;
6715
- }
6716
-
6717
- element.parentNode.replaceChild(newElem, element);
6718
- }
6719
- }
6720
- /*
6721
- * Copyright (c) 2018, salesforce.com, inc.
6722
- * All rights reserved.
6723
- * SPDX-License-Identifier: MIT
6724
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6725
- */
6726
-
6727
- /**
6728
- * This function builds a Web Component class from a LWC constructor so it can be
6729
- * registered as a new element via customElements.define() at any given time.
6730
- *
6731
- * @deprecated since version 1.3.11
6732
- *
6733
- * @example
6734
- * ```
6735
- * import { buildCustomElementConstructor } from 'lwc';
6736
- * import Foo from 'ns/foo';
6737
- * const WC = buildCustomElementConstructor(Foo);
6738
- * customElements.define('x-foo', WC);
6739
- * const elm = document.createElement('x-foo');
6740
- * ```
6741
- */
6742
-
6743
-
6744
- function deprecatedBuildCustomElementConstructor(Ctor) {
6745
-
6746
- return Ctor.CustomElementConstructor;
6747
- }
6748
-
6749
- function buildCustomElementConstructor(Ctor) {
6750
- const HtmlPrototype = getComponentHtmlPrototype(Ctor);
6751
- return class extends HtmlPrototype {
6752
- constructor() {
6753
- super();
6754
- createVM(this, Ctor, {
6755
- mode: 'open',
6756
- owner: null,
6757
- tagName: this.tagName
6758
- });
6759
- }
6760
-
6761
- connectedCallback() {
6762
- connectRootElement(this);
6763
- }
6764
-
6765
- disconnectedCallback() {
6766
- disconnectRootElement(this);
6767
- }
6768
-
6769
- };
6770
- }
6771
- /*
6772
- * Copyright (c) 2018, salesforce.com, inc.
6773
- * All rights reserved.
6774
- * SPDX-License-Identifier: MIT
6775
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6776
- */
6777
-
6778
6857
  /**
6779
6858
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6780
6859
  * This API is subject to change or being removed.
@@ -6875,7 +6954,7 @@ var LWC = (function (exports) {
6875
6954
  });
6876
6955
  freeze(LightningElement);
6877
6956
  seal(LightningElement.prototype);
6878
- /* version: 2.9.0 */
6957
+ /* version: 2.10.0 */
6879
6958
 
6880
6959
  exports.LightningElement = LightningElement;
6881
6960
  exports.__unstable__ProfilerControl = profilerControl;