lwc 2.7.4 → 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 (36) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +663 -470
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +663 -470
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +544 -426
  5. package/dist/engine-dom/iife/es5/engine-dom.js +816 -594
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +624 -497
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +663 -470
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +544 -426
  11. package/dist/engine-dom/umd/es5/engine-dom.js +816 -594
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +624 -497
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +427 -299
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +427 -299
  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 +8 -8
  36. package/LICENSE +0 -10
@@ -10,14 +10,6 @@
10
10
 
11
11
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
12
12
 
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
-
15
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
-
17
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
-
19
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
20
-
21
13
  function _get2() { if (typeof Reflect !== "undefined" && Reflect.get) { _get2 = Reflect.get; } else { _get2 = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get2.apply(this, arguments); }
22
14
 
23
15
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
@@ -44,6 +36,14 @@
44
36
 
45
37
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
46
38
 
39
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
40
+
41
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
42
+
43
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
44
+
45
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
46
+
47
47
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
48
 
49
49
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -348,7 +348,7 @@
348
348
  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
349
349
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
350
350
  var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
351
- /** version: 2.7.4 */
351
+ /** version: 2.10.0 */
352
352
 
353
353
  /*
354
354
  * Copyright (c) 2018, salesforce.com, inc.
@@ -413,7 +413,7 @@
413
413
  };
414
414
  }
415
415
 
416
- function patch(propName) {
416
+ function patch$1(propName) {
417
417
  // Typescript is inferring the wrong function type for this particular
418
418
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
419
419
  // @ts-ignore type-mismatch
@@ -435,7 +435,7 @@
435
435
  var propName = ElementPrototypeAriaPropertyNames[_i2];
436
436
 
437
437
  if (detect(propName)) {
438
- patch(propName);
438
+ patch$1(propName);
439
439
  }
440
440
  }
441
441
  /**
@@ -451,14 +451,15 @@
451
451
 
452
452
 
453
453
  var features = {
454
- ENABLE_REACTIVE_SETTER: null,
455
- ENABLE_HMR: null,
456
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
454
+ DISABLE_MIXED_SHADOW_MODE: null,
457
455
  ENABLE_ELEMENT_PATCH: null,
458
456
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
459
- ENABLE_NODE_LIST_PATCH: null,
457
+ ENABLE_HMR: null,
460
458
  ENABLE_HTML_COLLECTIONS_PATCH: null,
459
+ ENABLE_INNER_OUTER_TEXT_PATCH: null,
460
+ ENABLE_NODE_LIST_PATCH: null,
461
461
  ENABLE_NODE_PATCH: null,
462
+ ENABLE_REACTIVE_SETTER: null,
462
463
  ENABLE_WIRE_SYNC_EMIT: null
463
464
  };
464
465
 
@@ -517,7 +518,7 @@
517
518
 
518
519
  function setFeatureFlagForTest(name, value) {
519
520
  }
520
- /** version: 2.7.4 */
521
+ /** version: 2.10.0 */
521
522
 
522
523
  /* proxy-compat-disable */
523
524
 
@@ -560,6 +561,21 @@
560
561
 
561
562
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
562
563
  } // Borrowed from Vue template compiler.
564
+
565
+
566
+ function cloneAndOmitKey(object, keyToOmit) {
567
+ var result = {};
568
+
569
+ for (var _i4 = 0, _Object$keys = Object.keys(object); _i4 < _Object$keys.length; _i4++) {
570
+ var key = _Object$keys[_i4];
571
+
572
+ if (key !== keyToOmit) {
573
+ result[key] = object[key];
574
+ }
575
+ }
576
+
577
+ return result;
578
+ }
563
579
  // Primitives
564
580
  //
565
581
 
@@ -828,8 +844,8 @@
828
844
  var reactiveObservers = reactiveRecord[key];
829
845
 
830
846
  if (!isUndefined$1(reactiveObservers)) {
831
- for (var _i4 = 0, _len2 = reactiveObservers.length; _i4 < _len2; _i4 += 1) {
832
- var ro = reactiveObservers[_i4];
847
+ for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
848
+ var ro = reactiveObservers[_i5];
833
849
  ro.notify();
834
850
  }
835
851
  }
@@ -898,9 +914,9 @@
898
914
  var len = listeners.length;
899
915
 
900
916
  if (len > 0) {
901
- for (var _i5 = 0; _i5 < len; _i5 += 1) {
902
- var set = listeners[_i5];
903
- var pos = ArrayIndexOf.call(listeners[_i5], this);
917
+ for (var _i6 = 0; _i6 < len; _i6 += 1) {
918
+ var set = listeners[_i6];
919
+ var pos = ArrayIndexOf.call(listeners[_i6], this);
904
920
  ArraySplice.call(set, pos, 1);
905
921
  }
906
922
 
@@ -2120,7 +2136,7 @@
2120
2136
 
2121
2137
 
2122
2138
  var _loop = function _loop() {
2123
- var childGetter = _childGetters[_i6];
2139
+ var childGetter = _childGetters[_i7];
2124
2140
  queryAndChildGetterDescriptors[childGetter] = {
2125
2141
  get: function get() {
2126
2142
  var vm = getAssociatedVM(this);
@@ -2133,7 +2149,7 @@
2133
2149
  };
2134
2150
  };
2135
2151
 
2136
- for (var _i6 = 0, _childGetters = childGetters; _i6 < _childGetters.length; _i6++) {
2152
+ for (var _i7 = 0, _childGetters = childGetters; _i7 < _childGetters.length; _i7++) {
2137
2153
  _loop();
2138
2154
  }
2139
2155
 
@@ -2157,7 +2173,7 @@
2157
2173
 
2158
2174
 
2159
2175
  var _loop2 = function _loop2() {
2160
- var queryMethod = _queryMethods[_i7];
2176
+ var queryMethod = _queryMethods[_i8];
2161
2177
  queryAndChildGetterDescriptors[queryMethod] = {
2162
2178
  value: function value(arg) {
2163
2179
  var vm = getAssociatedVM(this);
@@ -2171,7 +2187,7 @@
2171
2187
  };
2172
2188
  };
2173
2189
 
2174
- for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
2190
+ for (var _i8 = 0, _queryMethods = queryMethods; _i8 < _queryMethods.length; _i8++) {
2175
2191
  _loop2();
2176
2192
  }
2177
2193
 
@@ -2532,8 +2548,8 @@
2532
2548
  }
2533
2549
 
2534
2550
  if (!isUndefined$1(fields)) {
2535
- for (var _i8 = 0, n = fields.length; _i8 < n; _i8++) {
2536
- var _fieldName2 = fields[_i8];
2551
+ for (var _i9 = 0, n = fields.length; _i9 < n; _i9++) {
2552
+ var _fieldName2 = fields[_i9];
2537
2553
  descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
2538
2554
  // tracked property. This is only here for backward compatibility purposes.
2539
2555
 
@@ -2577,6 +2593,13 @@
2577
2593
  var meta = signedDecoratorToMetaMap.get(Ctor);
2578
2594
  return isUndefined$1(meta) ? defaultMeta : meta;
2579
2595
  }
2596
+ /*
2597
+ * Copyright (c) 2018, salesforce.com, inc.
2598
+ * All rights reserved.
2599
+ * SPDX-License-Identifier: MIT
2600
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2601
+ */
2602
+
2580
2603
 
2581
2604
  var signedTemplateSet = new Set();
2582
2605
 
@@ -2596,6 +2619,7 @@
2596
2619
 
2597
2620
 
2598
2621
  function registerTemplate(tpl) {
2622
+
2599
2623
  signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2600
2624
  // assignment of templates easily, without too much transformation
2601
2625
 
@@ -2750,8 +2774,8 @@
2750
2774
  superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
2751
2775
  var descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge
2752
2776
 
2753
- for (var _i9 = 0, _len3 = props.length; _i9 < _len3; _i9 += 1) {
2754
- var _propName2 = props[_i9];
2777
+ for (var _i10 = 0, _len3 = props.length; _i10 < _len3; _i10 += 1) {
2778
+ var _propName2 = props[_i10];
2755
2779
  attributeToPropMap[htmlPropertyToAttribute(_propName2)] = _propName2;
2756
2780
  descriptors[_propName2] = {
2757
2781
  get: createGetter(_propName2),
@@ -2762,8 +2786,8 @@
2762
2786
  } // expose public methods as props on the new Element Bridge
2763
2787
 
2764
2788
 
2765
- for (var _i10 = 0, _len4 = methods.length; _i10 < _len4; _i10 += 1) {
2766
- var methodName = methods[_i10];
2789
+ for (var _i11 = 0, _len4 = methods.length; _i11 < _len4; _i11 += 1) {
2790
+ var methodName = methods[_i11];
2767
2791
  descriptors[methodName] = {
2768
2792
  value: createMethodCaller(methodName),
2769
2793
  writable: true,
@@ -3391,8 +3415,8 @@
3391
3415
  return;
3392
3416
  }
3393
3417
 
3394
- for (var _i11 = 0; _i11 < styleDecls.length; _i11++) {
3395
- var _styleDecls$_i = _slicedToArray(styleDecls[_i11], 3),
3418
+ for (var _i12 = 0; _i12 < styleDecls.length; _i12++) {
3419
+ var _styleDecls$_i = _slicedToArray(styleDecls[_i12], 3),
3396
3420
  prop = _styleDecls$_i[0],
3397
3421
  value = _styleDecls$_i[1],
3398
3422
  important = _styleDecls$_i[2];
@@ -3408,138 +3432,245 @@
3408
3432
  */
3409
3433
 
3410
3434
 
3411
- var TextHook = {
3412
- create: function create(vnode) {
3413
- var owner = vnode.owner;
3414
- var elm = createText$1(vnode.text);
3415
- linkNodeToShadow(elm, owner);
3416
- vnode.elm = elm;
3417
- },
3418
- update: updateNodeHook,
3419
- insert: insertNode,
3420
- move: insertNode,
3421
- remove: removeNode
3422
- };
3423
- var CommentHook = {
3424
- create: function create(vnode) {
3425
- var owner = vnode.owner,
3426
- text = vnode.text;
3427
- var elm = createComment$1(text);
3428
- linkNodeToShadow(elm, owner);
3429
- vnode.elm = elm;
3430
- },
3431
- update: updateNodeHook,
3432
- insert: insertNode,
3433
- move: insertNode,
3434
- remove: removeNode
3435
- }; // insert is called after update, which is used somewhere else (via a module)
3436
- // to mark the vm as inserted, that means we cannot use update as the main channel
3437
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
3438
- // which breaks some invariants. For that reason, we have the following for any
3439
- // Custom Element that is inserted via a template.
3440
-
3441
- var ElementHook = {
3442
- create: function create(vnode) {
3443
- var sel = vnode.sel,
3444
- owner = vnode.owner,
3445
- svg = vnode.data.svg;
3446
- var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3447
- var elm = createElement$2(sel, namespace);
3448
- linkNodeToShadow(elm, owner);
3449
- fallbackElmHook(elm, vnode);
3450
- vnode.elm = elm;
3451
- patchElementPropsAndAttrs$1(null, vnode);
3452
- },
3453
- update: function update(oldVnode, vnode) {
3454
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3455
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3456
- },
3457
- insert: function insert(vnode, parentNode, referenceNode) {
3458
- insertNode(vnode, parentNode, referenceNode);
3459
- createChildrenHook(vnode);
3460
- },
3461
- move: insertNode,
3462
- remove: function remove(vnode, parentNode) {
3463
- removeNode(vnode, parentNode);
3464
- removeChildren(vnode);
3435
+ function patchChildren(c1, c2, parent) {
3436
+ if (hasDynamicChildren(c2)) {
3437
+ updateDynamicChildren(c1, c2, parent);
3438
+ } else {
3439
+ updateStaticChildren(c1, c2, parent);
3465
3440
  }
3466
- };
3467
- var CustomElementHook = {
3468
- create: function create(vnode) {
3469
- var sel = vnode.sel,
3470
- owner = vnode.owner;
3471
- var 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
- */
3441
+ }
3478
3442
 
3479
- var vm;
3480
- var elm = new UpgradableConstructor(function (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;
3443
+ function patch(n1, n2) {
3444
+ if (n1 === n2) {
3445
+ return;
3446
+ }
3486
3447
 
3487
- if (vm) {
3488
- allocateChildren(vnode, vm);
3489
- } else if (vnode.ctor !== UpgradableConstructor) {
3490
- throw new TypeError("Incorrect Component Constructor");
3491
- }
3448
+ switch (n2.type) {
3449
+ case 0
3450
+ /* Text */
3451
+ :
3452
+ patchText(n1, n2);
3453
+ break;
3492
3454
 
3493
- patchElementPropsAndAttrs$1(null, vnode);
3494
- },
3495
- update: function update(oldVnode, vnode) {
3496
- patchElementPropsAndAttrs$1(oldVnode, vnode);
3497
- var vm = getAssociatedVMIfPresent(vnode.elm);
3455
+ case 1
3456
+ /* Comment */
3457
+ :
3458
+ patchComment(n1, n2);
3459
+ break;
3498
3460
 
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
3461
+ case 2
3462
+ /* Element */
3463
+ :
3464
+ patchElement(n1, n2);
3465
+ break;
3505
3466
 
3467
+ case 3
3468
+ /* CustomElement */
3469
+ :
3470
+ patchCustomElement(n1, n2);
3471
+ break;
3472
+ }
3473
+ }
3506
3474
 
3507
- patchChildren(vnode.elm, oldVnode.children, vnode.children);
3475
+ function mount(node, parent, anchor) {
3476
+ switch (node.type) {
3477
+ case 0
3478
+ /* Text */
3479
+ :
3480
+ mountText(node, parent, anchor);
3481
+ break;
3508
3482
 
3509
- if (vm) {
3510
- // this is important to preserve the top to bottom synchronous rendering phase.
3483
+ case 1
3484
+ /* Comment */
3485
+ :
3486
+ mountComment(node, parent, anchor);
3487
+ break;
3511
3488
 
3489
+ case 2
3490
+ /* Element */
3491
+ :
3492
+ mountElement(node, parent, anchor);
3493
+ break;
3512
3494
 
3513
- rerenderVM(vm);
3514
- }
3515
- },
3516
- insert: function insert(vnode, parentNode, referenceNode) {
3517
- insertNode(vnode, parentNode, referenceNode);
3518
- var vm = getAssociatedVMIfPresent(vnode.elm);
3495
+ case 3
3496
+ /* CustomElement */
3497
+ :
3498
+ mountCustomElement(node, parent, anchor);
3499
+ break;
3500
+ }
3501
+ }
3519
3502
 
3520
- if (vm) {
3503
+ function patchText(n1, n2) {
3504
+ n2.elm = n1.elm;
3521
3505
 
3522
- runConnectedCallback(vm);
3523
- }
3506
+ if (n2.text !== n1.text) {
3507
+ updateTextContent(n2);
3508
+ }
3509
+ }
3510
+
3511
+ function mountText(node, parent, anchor) {
3512
+ var owner = node.owner;
3513
+ var textNode = node.elm = createText$1(node.text);
3514
+ linkNodeToShadow(textNode, owner);
3515
+ insertNode(textNode, parent, anchor);
3516
+ }
3517
+
3518
+ function patchComment(n1, n2) {
3519
+ n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3520
+ // it is the case today.
3521
+
3522
+ if (n2.text !== n1.text) {
3523
+ updateTextContent(n2);
3524
+ }
3525
+ }
3526
+
3527
+ function mountComment(node, parent, anchor) {
3528
+ var owner = node.owner;
3529
+ var commentNode = node.elm = createComment$1(node.text);
3530
+ linkNodeToShadow(commentNode, owner);
3531
+ insertNode(commentNode, parent, anchor);
3532
+ }
3524
3533
 
3525
- createChildrenHook(vnode);
3534
+ function mountElement(vnode, parent, anchor) {
3535
+ var sel = vnode.sel,
3536
+ owner = vnode.owner,
3537
+ svg = vnode.data.svg;
3538
+ var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3539
+ var elm = createElement$2(sel, namespace);
3540
+ linkNodeToShadow(elm, owner);
3541
+ fallbackElmHook(elm, vnode);
3542
+ vnode.elm = elm;
3543
+ patchElementPropsAndAttrs$1(null, vnode);
3544
+ insertNode(elm, parent, anchor);
3545
+ mountVNodes(vnode.children, elm, null);
3546
+ }
3526
3547
 
3527
- if (vm) {
3528
- appendVM(vm);
3548
+ function patchElement(n1, n2) {
3549
+ var elm = n2.elm = n1.elm;
3550
+ patchElementPropsAndAttrs$1(n1, n2);
3551
+ patchChildren(n1.children, n2.children, elm);
3552
+ }
3553
+
3554
+ function mountCustomElement(vnode, parent, anchor) {
3555
+ var sel = vnode.sel,
3556
+ owner = vnode.owner;
3557
+ var UpgradableConstructor = getUpgradableConstructor(sel);
3558
+ /**
3559
+ * Note: if the upgradable constructor does not expect, or throw when we new it
3560
+ * with a callback as the first argument, we could implement a more advanced
3561
+ * mechanism that only passes that argument if the constructor is known to be
3562
+ * an upgradable custom element.
3563
+ */
3564
+
3565
+ var vm;
3566
+ var elm = new UpgradableConstructor(function (elm) {
3567
+ // the custom element from the registry is expecting an upgrade callback
3568
+ vm = createViewModelHook(elm, vnode);
3569
+ });
3570
+ linkNodeToShadow(elm, owner);
3571
+ vnode.elm = elm;
3572
+ vnode.vm = vm;
3573
+
3574
+ if (vm) {
3575
+ allocateChildren(vnode, vm);
3576
+ } else if (vnode.ctor !== UpgradableConstructor) {
3577
+ throw new TypeError("Incorrect Component Constructor");
3578
+ }
3579
+
3580
+ patchElementPropsAndAttrs$1(null, vnode);
3581
+ insertNode(elm, parent, anchor);
3582
+
3583
+ if (vm) {
3584
+
3585
+ runConnectedCallback(vm);
3586
+ }
3587
+
3588
+ mountVNodes(vnode.children, elm, null);
3589
+
3590
+ if (vm) {
3591
+ appendVM(vm);
3592
+ }
3593
+ }
3594
+
3595
+ function patchCustomElement(n1, n2) {
3596
+ var elm = n2.elm = n1.elm;
3597
+ var vm = n2.vm = n1.vm;
3598
+ patchElementPropsAndAttrs$1(n1, n2);
3599
+
3600
+ if (!isUndefined$1(vm)) {
3601
+ // in fallback mode, the allocation will always set children to
3602
+ // empty and delegate the real allocation to the slot elements
3603
+ allocateChildren(n2, vm);
3604
+ } // in fallback mode, the children will be always empty, so, nothing
3605
+ // will happen, but in native, it does allocate the light dom
3606
+
3607
+
3608
+ patchChildren(n1.children, n2.children, elm);
3609
+
3610
+ if (!isUndefined$1(vm)) {
3611
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3612
+ // this is important to preserve the top to bottom synchronous rendering phase.
3613
+ rerenderVM(vm);
3614
+ }
3615
+ }
3616
+
3617
+ function mountVNodes(vnodes, parent, anchor) {
3618
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3619
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3620
+
3621
+ for (; start < end; ++start) {
3622
+ var vnode = vnodes[start];
3623
+
3624
+ if (isVNode(vnode)) {
3625
+ mount(vnode, parent, anchor);
3529
3626
  }
3530
- },
3531
- move: insertNode,
3532
- remove: function remove(vnode, parentNode) {
3533
- removeNode(vnode, parentNode);
3534
- var 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);
3627
+ }
3628
+ }
3629
+
3630
+ function unmount(vnode, parent) {
3631
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3632
+ var type = vnode.type,
3633
+ elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3634
+ // subtree root, is the only element worth unmounting from the subtree.
3635
+
3636
+ if (doRemove) {
3637
+ removeNode(elm, parent);
3638
+ }
3639
+
3640
+ switch (type) {
3641
+ case 2
3642
+ /* Element */
3643
+ :
3644
+ unmountVNodes(vnode.children, elm);
3645
+ break;
3646
+
3647
+ case 3
3648
+ /* CustomElement */
3649
+ :
3650
+ {
3651
+ var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
3652
+ // children.
3653
+
3654
+ if (!isUndefined$1(vm)) {
3655
+ removeVM(vm);
3656
+ }
3657
+ }
3658
+ }
3659
+ }
3660
+
3661
+ function unmountVNodes(vnodes, parent) {
3662
+ var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3663
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
3664
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
3665
+
3666
+ for (; start < end; ++start) {
3667
+ var ch = vnodes[start];
3668
+
3669
+ if (isVNode(ch)) {
3670
+ unmount(ch, parent, doRemove);
3540
3671
  }
3541
3672
  }
3542
- };
3673
+ }
3543
3674
 
3544
3675
  function isVNode(vnode) {
3545
3676
  return vnode != null;
@@ -3580,24 +3711,21 @@
3580
3711
  }
3581
3712
  }
3582
3713
 
3583
- function updateNodeHook(oldVnode, vnode) {
3714
+ function updateTextContent(vnode) {
3584
3715
  var elm = vnode.elm,
3585
3716
  text = vnode.text;
3586
3717
 
3587
- if (oldVnode.text !== text) {
3588
-
3589
- setText$1(elm, text);
3590
- }
3718
+ setText$1(elm, text);
3591
3719
  }
3592
3720
 
3593
- function insertNode(vnode, parentNode, referenceNode) {
3721
+ function insertNode(node, parent, anchor) {
3594
3722
 
3595
- insert$1(vnode.elm, parentNode, referenceNode);
3723
+ insert$1(node, parent, anchor);
3596
3724
  }
3597
3725
 
3598
- function removeNode(vnode, parentNode) {
3726
+ function removeNode(node, parent) {
3599
3727
 
3600
- remove$1(vnode.elm, parentNode);
3728
+ remove$1(node, parent);
3601
3729
  }
3602
3730
 
3603
3731
  function patchElementPropsAndAttrs$1(oldVnode, vnode) {
@@ -3630,19 +3758,13 @@
3630
3758
  ) {
3631
3759
  // this element will now accept any manual content inserted into it
3632
3760
  observeElementChildNodes(elm);
3633
- } // when running in synthetic shadow mode, we need to set the shadowToken value
3634
- // into each element from the template, so they can be styled accordingly.
3635
-
3636
-
3637
- setElementShadowToken(elm, stylesheetToken);
3638
- }
3639
- }
3761
+ }
3640
3762
 
3641
- function patchChildren(parent, oldCh, newCh) {
3642
- if (hasDynamicChildren(newCh)) {
3643
- updateDynamicChildren(parent, oldCh, newCh);
3644
- } else {
3645
- updateStaticChildren(parent, oldCh, newCh);
3763
+ if (!isUndefined$1(stylesheetToken)) {
3764
+ // when running in synthetic shadow mode, we need to set the shadowToken value
3765
+ // into each element from the template, so they can be styled accordingly.
3766
+ setElementShadowToken(elm, stylesheetToken);
3767
+ }
3646
3768
  }
3647
3769
  }
3648
3770
 
@@ -3697,7 +3819,9 @@
3697
3819
  var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
3698
3820
  // into each element from the template, so they can be styled accordingly.
3699
3821
 
3700
- setElementShadowToken(elm, stylesheetToken);
3822
+ if (!isUndefined$1(stylesheetToken)) {
3823
+ setElementShadowToken(elm, stylesheetToken);
3824
+ }
3701
3825
  }
3702
3826
 
3703
3827
  vm = createVM(elm, ctor, {
@@ -3709,44 +3833,14 @@
3709
3833
  return vm;
3710
3834
  }
3711
3835
 
3712
- function createChildrenHook(vnode) {
3713
- var elm = vnode.elm,
3714
- children = vnode.children;
3715
-
3716
- for (var j = 0; j < children.length; ++j) {
3717
- var ch = children[j];
3718
-
3719
- if (ch != null) {
3720
- ch.hook.create(ch);
3721
- ch.hook.insert(ch, elm, null);
3722
- }
3723
- }
3724
- }
3725
-
3726
- function removeChildren(vnode) {
3727
- // this method only needs to search on child vnodes from template
3728
- // to trigger the remove hook just in case some of those children
3729
- // are custom elements.
3730
- var children = vnode.children,
3731
- elm = vnode.elm;
3732
-
3733
- for (var j = 0, _len5 = children.length; j < _len5; ++j) {
3734
- var ch = children[j];
3735
-
3736
- if (!isNull(ch)) {
3737
- ch.hook.remove(ch, elm);
3738
- }
3739
- }
3740
- }
3741
-
3742
3836
  function allocateInSlot(vm, children) {
3743
3837
  var _a;
3744
3838
 
3745
3839
  var oldSlots = vm.cmpSlots;
3746
3840
  var cmpSlots = vm.cmpSlots = create(null);
3747
3841
 
3748
- for (var _i12 = 0, _len6 = children.length; _i12 < _len6; _i12 += 1) {
3749
- var vnode = children[_i12];
3842
+ for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
3843
+ var vnode = children[_i13];
3750
3844
 
3751
3845
  if (isNull(vnode)) {
3752
3846
  continue;
@@ -3780,8 +3874,8 @@
3780
3874
  return;
3781
3875
  }
3782
3876
 
3783
- for (var _i13 = 0, _len7 = oldKeys.length; _i13 < _len7; _i13 += 1) {
3784
- var key = oldKeys[_i13];
3877
+ for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
3878
+ var key = oldKeys[_i14];
3785
3879
 
3786
3880
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
3787
3881
  markComponentAsDirty(vm);
@@ -3831,28 +3925,7 @@
3831
3925
  return map;
3832
3926
  }
3833
3927
 
3834
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
3835
- for (; startIdx <= endIdx; ++startIdx) {
3836
- var ch = vnodes[startIdx];
3837
-
3838
- if (isVNode(ch)) {
3839
- ch.hook.create(ch);
3840
- ch.hook.insert(ch, parentElm, before);
3841
- }
3842
- }
3843
- }
3844
-
3845
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
3846
- for (; startIdx <= endIdx; ++startIdx) {
3847
- var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
3848
-
3849
- if (isVNode(ch)) {
3850
- ch.hook.remove(ch, parentElm);
3851
- }
3852
- }
3853
- }
3854
-
3855
- function updateDynamicChildren(parentElm, oldCh, newCh) {
3928
+ function updateDynamicChildren(oldCh, newCh, parent) {
3856
3929
  var oldStartIdx = 0;
3857
3930
  var newStartIdx = 0;
3858
3931
  var oldEndIdx = oldCh.length - 1;
@@ -3866,6 +3939,7 @@
3866
3939
  var idxInOld;
3867
3940
  var elmToMove;
3868
3941
  var before;
3942
+ var clonedOldCh = false;
3869
3943
 
3870
3944
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
3871
3945
  if (!isVNode(oldStartVnode)) {
@@ -3877,23 +3951,23 @@
3877
3951
  } else if (!isVNode(newEndVnode)) {
3878
3952
  newEndVnode = newCh[--newEndIdx];
3879
3953
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
3880
- patchVnode(oldStartVnode, newStartVnode);
3954
+ patch(oldStartVnode, newStartVnode);
3881
3955
  oldStartVnode = oldCh[++oldStartIdx];
3882
3956
  newStartVnode = newCh[++newStartIdx];
3883
3957
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
3884
- patchVnode(oldEndVnode, newEndVnode);
3958
+ patch(oldEndVnode, newEndVnode);
3885
3959
  oldEndVnode = oldCh[--oldEndIdx];
3886
3960
  newEndVnode = newCh[--newEndIdx];
3887
3961
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
3888
3962
  // Vnode moved right
3889
- patchVnode(oldStartVnode, newEndVnode);
3890
- newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
3963
+ patch(oldStartVnode, newEndVnode);
3964
+ insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
3891
3965
  oldStartVnode = oldCh[++oldStartIdx];
3892
3966
  newEndVnode = newCh[--newEndIdx];
3893
3967
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
3894
3968
  // Vnode moved left
3895
- patchVnode(oldEndVnode, newStartVnode);
3896
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
3969
+ patch(oldEndVnode, newStartVnode);
3970
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
3897
3971
  oldEndVnode = oldCh[--oldEndIdx];
3898
3972
  newStartVnode = newCh[++newStartIdx];
3899
3973
  } else {
@@ -3905,8 +3979,7 @@
3905
3979
 
3906
3980
  if (isUndefined$1(idxInOld)) {
3907
3981
  // New element
3908
- newStartVnode.hook.create(newStartVnode);
3909
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3982
+ mount(newStartVnode, parent, oldStartVnode.elm);
3910
3983
  newStartVnode = newCh[++newStartIdx];
3911
3984
  } else {
3912
3985
  elmToMove = oldCh[idxInOld];
@@ -3914,12 +3987,22 @@
3914
3987
  if (isVNode(elmToMove)) {
3915
3988
  if (elmToMove.sel !== newStartVnode.sel) {
3916
3989
  // New element
3917
- newStartVnode.hook.create(newStartVnode);
3918
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
3990
+ mount(newStartVnode, parent, oldStartVnode.elm);
3919
3991
  } else {
3920
- patchVnode(elmToMove, newStartVnode);
3992
+ patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
3993
+ // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3994
+ // so we only care about the `oldCh` object inside this function.
3995
+ // To avoid cloning over and over again, we check `clonedOldCh`
3996
+ // and only clone once.
3997
+
3998
+ if (!clonedOldCh) {
3999
+ clonedOldCh = true;
4000
+ oldCh = _toConsumableArray(oldCh);
4001
+ } // We've already cloned at least once, so it's no longer read-only
4002
+
4003
+
3921
4004
  oldCh[idxInOld] = undefined;
3922
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
4005
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm);
3923
4006
  }
3924
4007
  }
3925
4008
 
@@ -3932,73 +4015,63 @@
3932
4015
  if (oldStartIdx > oldEndIdx) {
3933
4016
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
3934
4017
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
3935
- var _i14 = newEndIdx;
4018
+ var _i15 = newEndIdx;
3936
4019
  var n;
3937
4020
 
3938
4021
  do {
3939
- n = newCh[++_i14];
3940
- } while (!isVNode(n) && _i14 < newChEnd);
4022
+ n = newCh[++_i15];
4023
+ } while (!isVNode(n) && _i15 < newChEnd);
3941
4024
 
3942
4025
  before = isVNode(n) ? n.elm : null;
3943
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
4026
+ mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
3944
4027
  } else {
3945
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
4028
+ unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
3946
4029
  }
3947
4030
  }
3948
4031
  }
3949
4032
 
3950
- function updateStaticChildren(parentElm, oldCh, newCh) {
3951
- var oldChLength = oldCh.length;
3952
- var newChLength = newCh.length;
4033
+ function updateStaticChildren(c1, c2, parent) {
4034
+ var c1Length = c1.length;
4035
+ var c2Length = c2.length;
3953
4036
 
3954
- if (oldChLength === 0) {
4037
+ if (c1Length === 0) {
3955
4038
  // the old list is empty, we can directly insert anything new
3956
- addVnodes(parentElm, null, newCh, 0, newChLength);
4039
+ mountVNodes(c2, parent, null);
3957
4040
  return;
3958
4041
  }
3959
4042
 
3960
- if (newChLength === 0) {
4043
+ if (c2Length === 0) {
3961
4044
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
3962
4045
  // this is the case in which the dynamic children of an if-directive should be removed
3963
- removeVnodes(parentElm, oldCh, 0, oldChLength);
4046
+ unmountVNodes(c1, parent, true);
3964
4047
  return;
3965
4048
  } // if the old list is not empty, the new list MUST have the same
3966
4049
  // amount of nodes, that's why we call this static children
3967
4050
 
3968
4051
 
3969
- var referenceElm = null;
4052
+ var anchor = null;
3970
4053
 
3971
- for (var _i15 = newChLength - 1; _i15 >= 0; _i15 -= 1) {
3972
- var vnode = newCh[_i15];
3973
- var oldVNode = oldCh[_i15];
4054
+ for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
4055
+ var n1 = c1[_i16];
4056
+ var n2 = c2[_i16];
3974
4057
 
3975
- if (vnode !== oldVNode) {
3976
- if (isVNode(oldVNode)) {
3977
- if (isVNode(vnode)) {
3978
- // both vnodes must be equivalent, and se just need to patch them
3979
- patchVnode(oldVNode, vnode);
3980
- referenceElm = vnode.elm;
4058
+ if (n2 !== n1) {
4059
+ if (isVNode(n1)) {
4060
+ if (isVNode(n2)) {
4061
+ // both vnodes are equivalent, and we just need to patch them
4062
+ patch(n1, n2);
4063
+ anchor = n2.elm;
3981
4064
  } else {
3982
4065
  // removing the old vnode since the new one is null
3983
- oldVNode.hook.remove(oldVNode, parentElm);
4066
+ unmount(n1, parent, true);
3984
4067
  }
3985
- } else if (isVNode(vnode)) {
3986
- // this condition is unnecessary
3987
- vnode.hook.create(vnode); // insert the new node one since the old one is null
3988
-
3989
- vnode.hook.insert(vnode, parentElm, referenceElm);
3990
- referenceElm = vnode.elm;
4068
+ } else if (isVNode(n2)) {
4069
+ mount(n2, parent, anchor);
4070
+ anchor = n2.elm;
3991
4071
  }
3992
4072
  }
3993
4073
  }
3994
4074
  }
3995
-
3996
- function patchVnode(oldVnode, vnode) {
3997
- if (oldVnode !== vnode) {
3998
- vnode.elm = oldVnode.elm;
3999
- vnode.hook.update(oldVnode, vnode);
4000
- }
4001
- }
4002
4075
  /*
4003
4076
  * Copyright (c) 2018, salesforce.com, inc.
4004
4077
  * All rights reserved.
@@ -4014,7 +4087,8 @@
4014
4087
  } // [h]tml node
4015
4088
 
4016
4089
 
4017
- function h(sel, data, children) {
4090
+ function h(sel, data) {
4091
+ var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyArray;
4018
4092
  var vmBeingRendered = getVMBeingRendered();
4019
4093
 
4020
4094
  var elm;
@@ -4028,7 +4102,6 @@
4028
4102
  children: children,
4029
4103
  elm: elm,
4030
4104
  key: key,
4031
- hook: ElementHook,
4032
4105
  owner: vmBeingRendered
4033
4106
  };
4034
4107
  } // [t]ab[i]ndex function
@@ -4077,7 +4150,7 @@
4077
4150
  var vmBeingRendered = getVMBeingRendered();
4078
4151
 
4079
4152
  var key = data.key;
4080
- var elm;
4153
+ var elm, aChildren, vm;
4081
4154
  var vnode = {
4082
4155
  type: 3
4083
4156
  /* CustomElement */
@@ -4087,11 +4160,11 @@
4087
4160
  children: children,
4088
4161
  elm: elm,
4089
4162
  key: key,
4090
- hook: CustomElementHook,
4091
4163
  ctor: Ctor,
4092
4164
  owner: vmBeingRendered,
4093
- mode: 'open' // TODO [#1294]: this should be defined in Ctor
4094
-
4165
+ mode: 'open',
4166
+ aChildren: aChildren,
4167
+ vm: vm
4095
4168
  };
4096
4169
  addVNodeToChildLWC(vnode);
4097
4170
  return vnode;
@@ -4172,7 +4245,6 @@
4172
4245
  text: text,
4173
4246
  elm: elm,
4174
4247
  key: key,
4175
- hook: TextHook,
4176
4248
  owner: getVMBeingRendered()
4177
4249
  };
4178
4250
  } // [co]mment node
@@ -4188,7 +4260,6 @@
4188
4260
  text: text,
4189
4261
  elm: elm,
4190
4262
  key: key,
4191
- hook: CommentHook,
4192
4263
  owner: getVMBeingRendered()
4193
4264
  };
4194
4265
  } // [d]ynamic text
@@ -4288,7 +4359,8 @@
4288
4359
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4289
4360
  */
4290
4361
 
4291
- function dc(sel, Ctor, data, children) {
4362
+ function dc(sel, Ctor, data) {
4363
+ var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
4292
4364
 
4293
4365
 
4294
4366
  if (Ctor == null) {
@@ -4307,10 +4379,14 @@
4307
4379
  } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4308
4380
  // to identify different constructors as vnodes with different keys to avoid reusing the
4309
4381
  // element used for previous constructors.
4382
+ // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4383
+ // hoisting optimization.
4310
4384
 
4311
4385
 
4312
- data.key = "dc:".concat(idx, ":").concat(data.key);
4313
- return c(sel, Ctor, data, children);
4386
+ var newData = Object.assign(Object.assign({}, data), {
4387
+ key: "dc:".concat(idx, ":").concat(data.key)
4388
+ });
4389
+ return c(sel, Ctor, newData, children);
4314
4390
  }
4315
4391
  /**
4316
4392
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -4419,12 +4495,14 @@
4419
4495
  oldHasTokenInClass = context.hasTokenInClass,
4420
4496
  oldHasTokenInAttribute = context.hasTokenInAttribute;
4421
4497
 
4422
- if (oldHasTokenInClass) {
4423
- getClassList$1(elm).remove(makeHostToken(oldToken));
4424
- }
4498
+ if (!isUndefined$1(oldToken)) {
4499
+ if (oldHasTokenInClass) {
4500
+ getClassList$1(elm).remove(makeHostToken(oldToken));
4501
+ }
4425
4502
 
4426
- if (oldHasTokenInAttribute) {
4427
- removeAttribute$1(elm, makeHostToken(oldToken));
4503
+ if (oldHasTokenInAttribute) {
4504
+ removeAttribute$1(elm, makeHostToken(oldToken));
4505
+ }
4428
4506
  } // Apply the new template styling token to the host element, if the new template has any
4429
4507
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
4430
4508
 
@@ -4456,8 +4534,8 @@
4456
4534
  var content = [];
4457
4535
  var root;
4458
4536
 
4459
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4460
- var stylesheet = stylesheets[_i16];
4537
+ for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
4538
+ var stylesheet = stylesheets[_i17];
4461
4539
 
4462
4540
  if (isArray$1(stylesheet)) {
4463
4541
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
@@ -4561,8 +4639,8 @@
4561
4639
  && shadowMode === 1
4562
4640
  /* Synthetic */
4563
4641
  ) {
4564
- for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
4565
- insertGlobalStylesheet$1(stylesheets[_i17]);
4642
+ for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
4643
+ insertGlobalStylesheet$1(stylesheets[_i18]);
4566
4644
  }
4567
4645
  } else if (ssr$1 || isHydrating$1()) {
4568
4646
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
@@ -4576,12 +4654,12 @@
4576
4654
  var root = getNearestNativeShadowComponent(vm);
4577
4655
  var isGlobal = isNull(root);
4578
4656
 
4579
- for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
4657
+ for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
4580
4658
  if (isGlobal) {
4581
- insertGlobalStylesheet$1(stylesheets[_i18]);
4659
+ insertGlobalStylesheet$1(stylesheets[_i19]);
4582
4660
  } else {
4583
4661
  // local level
4584
- insertStylesheet$1(stylesheets[_i18], root.shadowRoot);
4662
+ insertStylesheet$1(stylesheets[_i19], root.shadowRoot);
4585
4663
  }
4586
4664
  }
4587
4665
  }
@@ -4766,8 +4844,8 @@
4766
4844
  var stylesheets = template.stylesheets;
4767
4845
 
4768
4846
  if (!isUndefined$1(stylesheets)) {
4769
- for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
4770
- if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
4847
+ for (var _i20 = 0; _i20 < stylesheets.length; _i20++) {
4848
+ if (isTrue(stylesheets[_i20][KEY__SCOPED_CSS])) {
4771
4849
  return true;
4772
4850
  }
4773
4851
  }
@@ -4878,6 +4956,7 @@
4878
4956
 
4879
4957
  function registerComponent(Ctor, _ref2) {
4880
4958
  var tmpl = _ref2.tmpl;
4959
+
4881
4960
  signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
4882
4961
  // without too much transformation
4883
4962
 
@@ -4950,8 +5029,8 @@
4950
5029
 
4951
5030
  function register(service) {
4952
5031
 
4953
- for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
4954
- var hookName = hooks[_i20];
5032
+ for (var _i21 = 0; _i21 < hooks.length; ++_i21) {
5033
+ var hookName = hooks[_i21];
4955
5034
 
4956
5035
  if (hookName in service) {
4957
5036
  var l = Services[hookName];
@@ -4971,8 +5050,8 @@
4971
5050
  def = vm.def,
4972
5051
  context = vm.context;
4973
5052
 
4974
- for (var _i21 = 0, _len8 = cbs.length; _i21 < _len8; ++_i21) {
4975
- cbs[_i21].call(undefined, component, {}, def, context);
5053
+ for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
5054
+ cbs[_i22].call(undefined, component, {}, def, context);
4976
5055
  }
4977
5056
  }
4978
5057
  /*
@@ -4983,7 +5062,7 @@
4983
5062
  */
4984
5063
 
4985
5064
 
4986
- function hydrate$1(vnode, node) {
5065
+ function hydrate(vnode, node) {
4987
5066
  switch (vnode.type) {
4988
5067
  case 0
4989
5068
  /* Text */
@@ -5015,7 +5094,7 @@
5015
5094
  var _a;
5016
5095
 
5017
5096
 
5018
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5097
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5019
5098
  vnode.elm = node;
5020
5099
  }
5021
5100
 
@@ -5023,7 +5102,7 @@
5023
5102
  var _a;
5024
5103
 
5025
5104
 
5026
- node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
5105
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5027
5106
  vnode.elm = node;
5028
5107
  }
5029
5108
 
@@ -5042,10 +5121,13 @@
5042
5121
  var props = vnode.data.props;
5043
5122
 
5044
5123
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5045
- if (elm.innerHTML === props.innerHTML) {
5046
- delete props.innerHTML;
5124
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5125
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5126
+ vnode.data = Object.assign(Object.assign({}, vnode.data), {
5127
+ props: cloneAndOmitKey(props, 'innerHTML')
5128
+ });
5047
5129
  } else {
5048
- logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5130
+ logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5049
5131
  }
5050
5132
  }
5051
5133
  }
@@ -5053,14 +5135,13 @@
5053
5135
  patchElementPropsAndAttrs(vnode);
5054
5136
 
5055
5137
  if (!isDomManual) {
5056
- hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);
5138
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5057
5139
  }
5058
5140
  }
5059
5141
 
5060
5142
  function hydrateCustomElement(vnode, node) {
5061
5143
 
5062
5144
  var elm = node;
5063
- vnode.elm = elm;
5064
5145
  var sel = vnode.sel,
5065
5146
  mode = vnode.mode,
5066
5147
  ctor = vnode.ctor,
@@ -5070,6 +5151,8 @@
5070
5151
  owner: owner,
5071
5152
  tagName: sel
5072
5153
  });
5154
+ vnode.elm = elm;
5155
+ vnode.vm = vm;
5073
5156
  allocateChildren(vnode, vm);
5074
5157
  patchElementPropsAndAttrs(vnode); // Insert hook section:
5075
5158
 
@@ -5080,7 +5163,7 @@
5080
5163
  ) {
5081
5164
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5082
5165
  // Note: for Light DOM, this is handled while hydrating the VM
5083
- hydrateChildren(vnode.elm.childNodes, vnode.children);
5166
+ hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5084
5167
  }
5085
5168
 
5086
5169
  hydrateVM(vm);
@@ -5090,12 +5173,12 @@
5090
5173
 
5091
5174
  var childNodeIndex = 0;
5092
5175
 
5093
- for (var _i22 = 0; _i22 < children.length; _i22++) {
5094
- var childVnode = children[_i22];
5176
+ for (var _i23 = 0; _i23 < children.length; _i23++) {
5177
+ var childVnode = children[_i23];
5095
5178
 
5096
5179
  if (!isNull(childVnode)) {
5097
5180
  var childNode = elmChildren[childNodeIndex];
5098
- hydrate$1(childVnode, childNode);
5181
+ hydrate(childVnode, childNode);
5099
5182
  childNodeIndex++;
5100
5183
  }
5101
5184
  }
@@ -5171,7 +5254,19 @@
5171
5254
  }
5172
5255
 
5173
5256
  function hydrateVM(vm) {
5174
- hydrate(vm);
5257
+ if (isTrue(vm.isDirty)) {
5258
+ // manually diffing/patching here.
5259
+ // This routine is:
5260
+ // patchShadowRoot(vm, children);
5261
+ // -> addVnodes.
5262
+ var children = renderComponent(vm);
5263
+ vm.children = children;
5264
+ var vmChildren = vm.renderMode === 0
5265
+ /* Light */
5266
+ ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5267
+ hydrateChildren(vmChildren, children);
5268
+ runRenderedCallback(vm);
5269
+ }
5175
5270
  } // just in case the component comes back, with this we guarantee re-rendering it
5176
5271
  // while preventing any attempt to rehydration until after reinsertion.
5177
5272
 
@@ -5291,7 +5386,11 @@
5291
5386
  /* Native */
5292
5387
  ;
5293
5388
  } else if (isNativeShadowDefined$1) {
5294
- if (def.shadowSupportMode === "any"
5389
+ if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
5390
+ shadowMode = 1
5391
+ /* Synthetic */
5392
+ ;
5393
+ } else if (def.shadowSupportMode === "any"
5295
5394
  /* Any */
5296
5395
  ) {
5297
5396
  shadowMode = 0
@@ -5355,22 +5454,6 @@
5355
5454
  }
5356
5455
  }
5357
5456
 
5358
- function hydrate(vm) {
5359
- if (isTrue(vm.isDirty)) {
5360
- // manually diffing/patching here.
5361
- // This routine is:
5362
- // patchShadowRoot(vm, children);
5363
- // -> addVnodes.
5364
- var children = renderComponent(vm);
5365
- vm.children = children;
5366
- var vmChildren = vm.renderMode === 0
5367
- /* Light */
5368
- ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
5369
- hydrateChildren(vmChildren, children);
5370
- runRenderedCallback(vm);
5371
- }
5372
- }
5373
-
5374
5457
  function patchShadowRoot(vm, newCh) {
5375
5458
  var renderRoot = vm.renderRoot,
5376
5459
  oldCh = vm.children; // caching the new children collection
@@ -5388,7 +5471,7 @@
5388
5471
  , vm);
5389
5472
  }, function () {
5390
5473
  // job
5391
- patchChildren(renderRoot, oldCh, newCh);
5474
+ patchChildren(oldCh, newCh, renderRoot);
5392
5475
  }, function () {
5393
5476
  // post
5394
5477
  logOperationEnd(2
@@ -5445,19 +5528,19 @@
5445
5528
  });
5446
5529
  rehydrateQueue = []; // reset to a new queue
5447
5530
 
5448
- for (var _i25 = 0, _len9 = vms.length; _i25 < _len9; _i25 += 1) {
5449
- var vm = vms[_i25];
5531
+ for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
5532
+ var vm = vms[_i26];
5450
5533
 
5451
5534
  try {
5452
5535
  rehydrate(vm);
5453
5536
  } catch (error) {
5454
- if (_i25 + 1 < _len9) {
5537
+ if (_i26 + 1 < _len8) {
5455
5538
  // pieces of the queue are still pending to be rehydrated, those should have priority
5456
5539
  if (rehydrateQueue.length === 0) {
5457
5540
  addCallbackToNextTick(flushRehydrationQueue);
5458
5541
  }
5459
5542
 
5460
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i25 + 1));
5543
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i26 + 1));
5461
5544
  } // we need to end the measure before throwing.
5462
5545
 
5463
5546
 
@@ -5556,8 +5639,8 @@
5556
5639
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
5557
5640
  // inserted in reserved order.
5558
5641
 
5559
- for (var _i26 = vCustomElementCollection.length - 1; _i26 >= 0; _i26 -= 1) {
5560
- var elm = vCustomElementCollection[_i26].elm; // There are two cases where the element could be undefined:
5642
+ for (var _i27 = vCustomElementCollection.length - 1; _i27 >= 0; _i27 -= 1) {
5643
+ var elm = vCustomElementCollection[_i27].elm; // There are two cases where the element could be undefined:
5561
5644
  // * when there is an error during the construction phase, and an error
5562
5645
  // boundary picks it, there is a possibility that the VCustomElement
5563
5646
  // is not properly initialized, and therefore is should be ignored.
@@ -5591,8 +5674,8 @@
5591
5674
 
5592
5675
 
5593
5676
  function recursivelyDisconnectChildren(vnodes) {
5594
- for (var _i27 = 0, _len10 = vnodes.length; _i27 < _len10; _i27 += 1) {
5595
- var vnode = vnodes[_i27];
5677
+ for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
5678
+ var vnode = vnodes[_i28];
5596
5679
 
5597
5680
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
5598
5681
  switch (vnode.type) {
@@ -5623,8 +5706,8 @@
5623
5706
  var children = vm.children,
5624
5707
  renderRoot = vm.renderRoot;
5625
5708
 
5626
- for (var _i28 = 0, _len11 = children.length; _i28 < _len11; _i28++) {
5627
- var child = children[_i28];
5709
+ for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
5710
+ var child = children[_i29];
5628
5711
 
5629
5712
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5630
5713
  remove$1(child.elm, renderRoot);
@@ -5974,8 +6057,8 @@
5974
6057
  function connectWireAdapters(vm) {
5975
6058
  var wiredConnecting = vm.context.wiredConnecting;
5976
6059
 
5977
- for (var _i29 = 0, _len12 = wiredConnecting.length; _i29 < _len12; _i29 += 1) {
5978
- wiredConnecting[_i29]();
6060
+ for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
6061
+ wiredConnecting[_i30]();
5979
6062
  }
5980
6063
  }
5981
6064
 
@@ -5983,8 +6066,8 @@
5983
6066
  var wiredDisconnecting = vm.context.wiredDisconnecting;
5984
6067
  runWithBoundaryProtection(vm, vm, noop, function () {
5985
6068
  // job
5986
- for (var _i30 = 0, _len13 = wiredDisconnecting.length; _i30 < _len13; _i30 += 1) {
5987
- wiredDisconnecting[_i30]();
6069
+ for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
6070
+ wiredDisconnecting[_i31]();
5988
6071
  }
5989
6072
  }, noop);
5990
6073
  }
@@ -6068,7 +6151,7 @@
6068
6151
  hooksAreSet = true;
6069
6152
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6070
6153
  }
6071
- /* version: 2.7.4 */
6154
+ /* version: 2.10.0 */
6072
6155
 
6073
6156
  /*
6074
6157
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6085,6 +6168,7 @@
6085
6168
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6086
6169
 
6087
6170
  var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6171
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6088
6172
  var styleElements = create(null);
6089
6173
  var styleSheets = create(null);
6090
6174
  var nodesToStyleSheets = new WeakMap();
@@ -6140,7 +6224,13 @@
6140
6224
  }
6141
6225
 
6142
6226
  if (!target.adoptedStyleSheets.includes(styleSheet)) {
6143
- target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
6227
+ if (supportsMutableAdoptedStyleSheets) {
6228
+ // This is only supported in later versions of Chromium:
6229
+ // https://chromestatus.com/feature/5638996492288000
6230
+ target.adoptedStyleSheets.push(styleSheet);
6231
+ } else {
6232
+ target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
6233
+ }
6144
6234
  }
6145
6235
  }
6146
6236
 
@@ -6422,6 +6512,173 @@
6422
6512
  setSetText(setText);
6423
6513
  setSsr(ssr);
6424
6514
  setAddEventListener(addEventListener);
6515
+ /*
6516
+ * Copyright (c) 2018, salesforce.com, inc.
6517
+ * All rights reserved.
6518
+ * SPDX-License-Identifier: MIT
6519
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6520
+ */
6521
+
6522
+ function resetShadowRootAndLightDom(element, Ctor) {
6523
+ if (element.shadowRoot) {
6524
+ var shadowRoot = element.shadowRoot;
6525
+
6526
+ while (!isNull(shadowRoot.firstChild)) {
6527
+ shadowRoot.removeChild(shadowRoot.firstChild);
6528
+ }
6529
+ }
6530
+
6531
+ if (Ctor.renderMode === 'light') {
6532
+ while (!isNull(element.firstChild)) {
6533
+ element.removeChild(element.firstChild);
6534
+ }
6535
+ }
6536
+ }
6537
+
6538
+ function createVMWithProps(element, Ctor, props) {
6539
+ createVM(element, Ctor, {
6540
+ mode: 'open',
6541
+ owner: null,
6542
+ tagName: element.tagName.toLowerCase()
6543
+ });
6544
+
6545
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
6546
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6547
+ key = _Object$entries2$_i[0],
6548
+ value = _Object$entries2$_i[1];
6549
+
6550
+ element[key] = value;
6551
+ }
6552
+ }
6553
+
6554
+ function hydrateComponent(element, Ctor) {
6555
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6556
+
6557
+ if (!(element instanceof Element)) {
6558
+ throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6559
+ }
6560
+
6561
+ if (!isFunction$1(Ctor)) {
6562
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6563
+ }
6564
+
6565
+ if (!isObject(props) || isNull(props)) {
6566
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6567
+ }
6568
+
6569
+ if (getAssociatedVMIfPresent(element)) {
6570
+ /* eslint-disable-next-line no-console */
6571
+ console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
6572
+ return;
6573
+ }
6574
+
6575
+ try {
6576
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6577
+ // and uses the same algo to create the stylesheets as in SSR.
6578
+ setIsHydrating(true);
6579
+ createVMWithProps(element, Ctor, props);
6580
+ hydrateRootElement(element); // set it back since now we finished hydration.
6581
+
6582
+ setIsHydrating(false);
6583
+ } catch (e) {
6584
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
6585
+ // with the client generated DOM.
6586
+
6587
+ /* eslint-disable-next-line no-console */
6588
+ console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
6589
+
6590
+ resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
6591
+
6592
+ createVMWithProps(element, Ctor, props);
6593
+ setIsHydrating(false);
6594
+ connectRootElement(element);
6595
+ } finally {
6596
+ // in case there's an error during recovery
6597
+ setIsHydrating(false);
6598
+ }
6599
+ }
6600
+ /*
6601
+ * Copyright (c) 2018, salesforce.com, inc.
6602
+ * All rights reserved.
6603
+ * SPDX-License-Identifier: MIT
6604
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6605
+ */
6606
+
6607
+ /**
6608
+ * This function builds a Web Component class from a LWC constructor so it can be
6609
+ * registered as a new element via customElements.define() at any given time.
6610
+ *
6611
+ * @deprecated since version 1.3.11
6612
+ *
6613
+ * @example
6614
+ * ```
6615
+ * import { buildCustomElementConstructor } from 'lwc';
6616
+ * import Foo from 'ns/foo';
6617
+ * const WC = buildCustomElementConstructor(Foo);
6618
+ * customElements.define('x-foo', WC);
6619
+ * const elm = document.createElement('x-foo');
6620
+ * ```
6621
+ */
6622
+
6623
+
6624
+ function deprecatedBuildCustomElementConstructor(Ctor) {
6625
+
6626
+ return Ctor.CustomElementConstructor;
6627
+ } // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
6628
+ // This WeakSet usage is valid because this functionality is not meant to run in IE11.
6629
+
6630
+
6631
+ var hydratedCustomElements = new WeakSet();
6632
+
6633
+ function buildCustomElementConstructor(Ctor) {
6634
+ var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6635
+ return /*#__PURE__*/function (_HtmlPrototype) {
6636
+ _inherits(_class, _HtmlPrototype);
6637
+
6638
+ var _super8 = _createSuper(_class);
6639
+
6640
+ function _class() {
6641
+ var _this6;
6642
+
6643
+ _classCallCheck(this, _class);
6644
+
6645
+ _this6 = _super8.call(this);
6646
+
6647
+ if (_this6.isConnected) {
6648
+ // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
6649
+ hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
6650
+ hydratedCustomElements.add(_assertThisInitialized(_this6));
6651
+ } else {
6652
+ createVM(_assertThisInitialized(_this6), Ctor, {
6653
+ mode: 'open',
6654
+ owner: null,
6655
+ tagName: _this6.tagName
6656
+ });
6657
+ }
6658
+
6659
+ return _this6;
6660
+ }
6661
+
6662
+ _createClass(_class, [{
6663
+ key: "connectedCallback",
6664
+ value: function connectedCallback() {
6665
+ if (hydratedCustomElements.has(this)) {
6666
+ // This is an un-upgraded element that was hydrated in the constructor.
6667
+ hydratedCustomElements.delete(this);
6668
+ } else {
6669
+ connectRootElement(this);
6670
+ }
6671
+ }
6672
+ }, {
6673
+ key: "disconnectedCallback",
6674
+ value: function disconnectedCallback() {
6675
+ disconnectRootElement(this);
6676
+ }
6677
+ }]);
6678
+
6679
+ return _class;
6680
+ }(HtmlPrototype);
6681
+ }
6425
6682
  /*
6426
6683
  * Copyright (c) 2018, salesforce.com, inc.
6427
6684
  * All rights reserved.
@@ -6431,6 +6688,7 @@
6431
6688
  // TODO [#2472]: Remove this workaround when appropriate.
6432
6689
  // eslint-disable-next-line lwc-internal/no-global-node
6433
6690
 
6691
+
6434
6692
  var _Node$1 = Node;
6435
6693
  var ConnectingSlot = new WeakMap();
6436
6694
  var DisconnectingSlot = new WeakMap();
@@ -6535,138 +6793,6 @@
6535
6793
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6536
6794
  */
6537
6795
 
6538
-
6539
- function hydrateComponent(element, Ctor) {
6540
- var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6541
-
6542
- if (!(element instanceof Element)) {
6543
- throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
6544
- }
6545
-
6546
- if (!isFunction$1(Ctor)) {
6547
- throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6548
- }
6549
-
6550
- if (!isObject(props) || isNull(props)) {
6551
- throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6552
- }
6553
-
6554
- try {
6555
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6556
- // and uses the same algo to create the stylesheets as in SSR.
6557
- setIsHydrating(true);
6558
- createVM(element, Ctor, {
6559
- mode: 'open',
6560
- owner: null,
6561
- tagName: element.tagName.toLowerCase()
6562
- });
6563
-
6564
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
6565
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
6566
- key = _Object$entries2$_i[0],
6567
- value = _Object$entries2$_i[1];
6568
-
6569
- element[key] = value;
6570
- }
6571
-
6572
- hydrateRootElement(element); // set it back since now we finished hydration.
6573
-
6574
- setIsHydrating(false);
6575
- } catch (e) {
6576
- // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
6577
- // the client generated DOM.
6578
-
6579
- /* eslint-disable-next-line no-console */
6580
- console.error('Recovering from error while hydrating: ', e);
6581
- setIsHydrating(false);
6582
- var newElem = createElement(element.tagName, {
6583
- is: Ctor,
6584
- mode: 'open'
6585
- });
6586
-
6587
- for (var _i33 = 0, _Object$entries3 = Object.entries(props); _i33 < _Object$entries3.length; _i33++) {
6588
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i33], 2),
6589
- _key3 = _Object$entries3$_i[0],
6590
- _value2 = _Object$entries3$_i[1];
6591
-
6592
- newElem[_key3] = _value2;
6593
- }
6594
-
6595
- element.parentNode.replaceChild(newElem, element);
6596
- }
6597
- }
6598
- /*
6599
- * Copyright (c) 2018, salesforce.com, inc.
6600
- * All rights reserved.
6601
- * SPDX-License-Identifier: MIT
6602
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6603
- */
6604
-
6605
- /**
6606
- * This function builds a Web Component class from a LWC constructor so it can be
6607
- * registered as a new element via customElements.define() at any given time.
6608
- *
6609
- * @deprecated since version 1.3.11
6610
- *
6611
- * @example
6612
- * ```
6613
- * import { buildCustomElementConstructor } from 'lwc';
6614
- * import Foo from 'ns/foo';
6615
- * const WC = buildCustomElementConstructor(Foo);
6616
- * customElements.define('x-foo', WC);
6617
- * const elm = document.createElement('x-foo');
6618
- * ```
6619
- */
6620
-
6621
-
6622
- function deprecatedBuildCustomElementConstructor(Ctor) {
6623
-
6624
- return Ctor.CustomElementConstructor;
6625
- }
6626
-
6627
- function buildCustomElementConstructor(Ctor) {
6628
- var HtmlPrototype = getComponentHtmlPrototype(Ctor);
6629
- return /*#__PURE__*/function (_HtmlPrototype) {
6630
- _inherits(_class, _HtmlPrototype);
6631
-
6632
- var _super8 = _createSuper(_class);
6633
-
6634
- function _class() {
6635
- var _this6;
6636
-
6637
- _classCallCheck(this, _class);
6638
-
6639
- _this6 = _super8.call(this);
6640
- createVM(_assertThisInitialized(_this6), Ctor, {
6641
- mode: 'open',
6642
- owner: null,
6643
- tagName: _this6.tagName
6644
- });
6645
- return _this6;
6646
- }
6647
-
6648
- _createClass(_class, [{
6649
- key: "connectedCallback",
6650
- value: function connectedCallback() {
6651
- connectRootElement(this);
6652
- }
6653
- }, {
6654
- key: "disconnectedCallback",
6655
- value: function disconnectedCallback() {
6656
- disconnectRootElement(this);
6657
- }
6658
- }]);
6659
-
6660
- return _class;
6661
- }(HtmlPrototype);
6662
- }
6663
- /*
6664
- * Copyright (c) 2018, salesforce.com, inc.
6665
- * All rights reserved.
6666
- * SPDX-License-Identifier: MIT
6667
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6668
- */
6669
-
6670
6796
  /**
6671
6797
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6672
6798
  * This API is subject to change or being removed.
@@ -6698,30 +6824,31 @@
6698
6824
 
6699
6825
  var _Node = Node;
6700
6826
  /**
6701
- * EXPERIMENTAL: This function detects whether or not a Node is controlled by a LWC template. This
6702
- * API is subject to change or being removed.
6827
+ * EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
6828
+ * ONCE LOCKER V1 IS NO LONGER SUPPORTED.
6703
6829
  */
6704
6830
 
6705
- function isNodeFromTemplate(node) {
6831
+ function isNodeShadowed(node) {
6706
6832
  if (isFalse(node instanceof _Node)) {
6707
6833
  return false;
6708
- } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit
6709
- // this with locker
6834
+ } // It's debatable whether shadow root instances should be considered as shadowed, but we keep
6835
+ // this unchanged for legacy reasons (#1250).
6710
6836
 
6711
6837
 
6712
6838
  if (node instanceof ShadowRoot) {
6713
6839
  return false;
6714
6840
  }
6715
6841
 
6716
- if (isSyntheticShadowDefined) {
6717
- // TODO [#1252]: old behavior that is still used by some pieces of the platform,
6718
- // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
6719
- // used, will be considered global elements.
6720
- return !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
6721
- }
6842
+ var rootNode = node.getRootNode(); // Handle the native case. We can return early here because an invariant of LWC is that
6843
+ // synthetic roots cannot be descendants of native roots.
6844
+
6845
+ if (rootNode instanceof ShadowRoot && isFalse(hasOwnProperty$1.call(getPrototypeOf$1(rootNode), 'synthetic'))) {
6846
+ return true;
6847
+ } // TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
6848
+ // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
6849
+
6722
6850
 
6723
- var root = node.getRootNode();
6724
- return root instanceof ShadowRoot;
6851
+ return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
6725
6852
  }
6726
6853
  /*
6727
6854
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6765,7 +6892,7 @@
6765
6892
  });
6766
6893
  freeze(LightningElement);
6767
6894
  seal(LightningElement.prototype);
6768
- /* version: 2.7.4 */
6895
+ /* version: 2.10.0 */
6769
6896
 
6770
6897
  exports.LightningElement = LightningElement;
6771
6898
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6777,7 +6904,7 @@
6777
6904
  exports.getComponentDef = getComponentDef;
6778
6905
  exports.hydrateComponent = hydrateComponent;
6779
6906
  exports.isComponentConstructor = isComponentConstructor;
6780
- exports.isNodeFromTemplate = isNodeFromTemplate;
6907
+ exports.isNodeFromTemplate = isNodeShadowed;
6781
6908
  exports.readonly = readonly;
6782
6909
  exports.register = register;
6783
6910
  exports.registerComponent = registerComponent;