lwc 2.21.0 → 2.23.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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +234 -236
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +234 -236
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +221 -224
  5. package/dist/engine-dom/iife/es5/engine-dom.js +282 -265
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +257 -237
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +234 -236
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +221 -224
  11. package/dist/engine-dom/umd/es5/engine-dom.js +282 -265
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +257 -237
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +138 -445
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +138 -445
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +13 -10
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +13 -10
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +13 -10
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +15 -14
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +15 -14
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +13 -10
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +13 -10
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +15 -14
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +15 -14
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -368,9 +368,9 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.21.0";
371
+ var LWC_VERSION = "2.23.0";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.21.0 */
373
+ /** version: 2.23.0 */
374
374
 
375
375
  /*
376
376
  * Copyright (c) 2018, salesforce.com, inc.
@@ -549,7 +549,7 @@
549
549
  setFeatureFlag(name, value);
550
550
  }
551
551
  }
552
- /** version: 2.21.0 */
552
+ /** version: 2.23.0 */
553
553
 
554
554
  /*
555
555
  * Copyright (c) 2018, salesforce.com, inc.
@@ -855,20 +855,24 @@
855
855
 
856
856
  return ReactiveObserver;
857
857
  }();
858
- /*
859
- * Copyright (c) 2018, salesforce.com, inc.
860
- * All rights reserved.
861
- * SPDX-License-Identifier: MIT
862
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
863
- */
864
-
865
858
 
866
859
  function componentValueMutated(vm, key) {
867
- valueMutated(vm.component, key);
860
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
861
+ {
862
+ valueMutated(vm.component, key);
863
+ }
868
864
  }
869
865
 
870
866
  function componentValueObserved(vm, key) {
871
- valueObserved(vm.component, key);
867
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
868
+ {
869
+ valueObserved(vm.component, key);
870
+ }
871
+ }
872
+
873
+ function createReactiveObserver(callback) {
874
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
875
+ return new ReactiveObserver(callback);
872
876
  }
873
877
  /*
874
878
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1476,6 +1480,15 @@
1476
1480
  function patchLightningElementPrototypeWithRestrictions(proto) {
1477
1481
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1478
1482
  }
1483
+
1484
+ function updateComponentValue(vm, key, newValue) {
1485
+ var cmpFields = vm.cmpFields;
1486
+
1487
+ if (newValue !== cmpFields[key]) {
1488
+ cmpFields[key] = newValue;
1489
+ componentValueMutated(vm, key);
1490
+ }
1491
+ }
1479
1492
  /**
1480
1493
  * Copyright (C) 2017 salesforce.com, inc.
1481
1494
  */
@@ -2283,8 +2296,28 @@
2283
2296
  */
2284
2297
 
2285
2298
  function unwrap(value) {
2299
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2286
2300
  return reactiveMembrane.unwrapProxy(value);
2287
2301
  }
2302
+
2303
+ function getReadOnlyProxy(value) {
2304
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2305
+ // them from their parents. This applies to both the client and server.
2306
+ return reactiveMembrane.getReadOnlyProxy(value);
2307
+ }
2308
+
2309
+ function getReactiveProxy(value) {
2310
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2311
+ return reactiveMembrane.getProxy(value);
2312
+ } // Making the component instance a live value when using Locker to support expandos.
2313
+
2314
+
2315
+ function markLockerLiveObject(obj) {
2316
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2317
+ {
2318
+ obj[lockerLivePropertyKey] = undefined;
2319
+ }
2320
+ }
2288
2321
  /*
2289
2322
  * Copyright (c) 2018, salesforce.com, inc.
2290
2323
  * All rights reserved.
@@ -2351,11 +2384,7 @@
2351
2384
  assert.invariant(!isObject(newValue) || isNull(newValue), "Invalid value \"".concat(newValue, "\" for \"").concat(propName, "\" of ").concat(vm, ". Value cannot be an object, must be a primitive value."));
2352
2385
  }
2353
2386
 
2354
- if (newValue !== vm.cmpProps[propName]) {
2355
- vm.cmpProps[propName] = newValue;
2356
- componentValueMutated(vm, propName);
2357
- }
2358
-
2387
+ updateComponentValue(vm, propName, newValue);
2359
2388
  return _set.call(vm.elm, newValue);
2360
2389
  }
2361
2390
  };
@@ -2399,10 +2428,9 @@
2399
2428
  vm.callHook = _callHook;
2400
2429
  vm.setHook = _setHook;
2401
2430
  vm.getHook = _getHook;
2402
- } // Making the component instance a live value when using Locker to support expandos.
2403
-
2431
+ }
2404
2432
 
2405
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2433
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2406
2434
 
2407
2435
  associateVM(component, vm);
2408
2436
  associateVM(elm, vm);
@@ -2732,60 +2760,7 @@
2732
2760
  },
2733
2761
  set: function set(newValue) {
2734
2762
  var vm = getAssociatedVM(this);
2735
-
2736
- if (newValue !== vm.cmpFields[key]) {
2737
- vm.cmpFields[key] = newValue;
2738
- componentValueMutated(vm, key);
2739
- }
2740
- },
2741
- enumerable: true,
2742
- configurable: true
2743
- };
2744
- }
2745
- /*
2746
- * Copyright (c) 2018, salesforce.com, inc.
2747
- * All rights reserved.
2748
- * SPDX-License-Identifier: MIT
2749
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2750
- */
2751
-
2752
-
2753
- function api$1() {
2754
- if (process.env.NODE_ENV !== 'production') {
2755
- assert.fail("@api decorator can only be used as a decorator function.");
2756
- }
2757
-
2758
- throw new Error();
2759
- }
2760
-
2761
- function createPublicPropertyDescriptor(key) {
2762
- return {
2763
- get: function get() {
2764
- var vm = getAssociatedVM(this);
2765
-
2766
- if (isBeingConstructed(vm)) {
2767
- if (process.env.NODE_ENV !== 'production') {
2768
- logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2769
- }
2770
-
2771
- return;
2772
- }
2773
-
2774
- componentValueObserved(vm, key);
2775
- return vm.cmpProps[key];
2776
- },
2777
- set: function set(newValue) {
2778
- var vm = getAssociatedVM(this);
2779
-
2780
- if (process.env.NODE_ENV !== 'production') {
2781
- var _vmBeingRendered3 = getVMBeingRendered();
2782
-
2783
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2784
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2785
- }
2786
-
2787
- vm.cmpProps[key] = newValue;
2788
- componentValueMutated(vm, key);
2763
+ updateComponentValue(vm, key, newValue);
2789
2764
  },
2790
2765
  enumerable: true,
2791
2766
  configurable: true
@@ -2849,6 +2824,60 @@
2849
2824
  return AccessorReactiveObserver;
2850
2825
  }(ReactiveObserver);
2851
2826
 
2827
+ function createAccessorReactiveObserver(vm, set) {
2828
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2829
+ return new AccessorReactiveObserver(vm, set);
2830
+ }
2831
+ /*
2832
+ * Copyright (c) 2018, salesforce.com, inc.
2833
+ * All rights reserved.
2834
+ * SPDX-License-Identifier: MIT
2835
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2836
+ */
2837
+
2838
+
2839
+ function api$1() {
2840
+ if (process.env.NODE_ENV !== 'production') {
2841
+ assert.fail("@api decorator can only be used as a decorator function.");
2842
+ }
2843
+
2844
+ throw new Error();
2845
+ }
2846
+
2847
+ function createPublicPropertyDescriptor(key) {
2848
+ return {
2849
+ get: function get() {
2850
+ var vm = getAssociatedVM(this);
2851
+
2852
+ if (isBeingConstructed(vm)) {
2853
+ if (process.env.NODE_ENV !== 'production') {
2854
+ logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2855
+ }
2856
+
2857
+ return;
2858
+ }
2859
+
2860
+ componentValueObserved(vm, key);
2861
+ return vm.cmpProps[key];
2862
+ },
2863
+ set: function set(newValue) {
2864
+ var vm = getAssociatedVM(this);
2865
+
2866
+ if (process.env.NODE_ENV !== 'production') {
2867
+ var _vmBeingRendered3 = getVMBeingRendered();
2868
+
2869
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2870
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2871
+ }
2872
+
2873
+ vm.cmpProps[key] = newValue;
2874
+ componentValueMutated(vm, key);
2875
+ },
2876
+ enumerable: true,
2877
+ configurable: true
2878
+ };
2879
+ }
2880
+
2852
2881
  function createPublicAccessorDescriptor(key, descriptor) {
2853
2882
  var _get3 = descriptor.get,
2854
2883
  _set2 = descriptor.set,
@@ -2889,7 +2918,7 @@
2889
2918
  var ro = vm.oar[key];
2890
2919
 
2891
2920
  if (isUndefined$1(ro)) {
2892
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2921
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2893
2922
  } // every time we invoke this setter from outside (through this wrapper setter)
2894
2923
  // we should reset the value and then debounce just in case there is a pending
2895
2924
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2921,7 +2950,7 @@
2921
2950
 
2922
2951
  function track(target) {
2923
2952
  if (arguments.length === 1) {
2924
- return reactiveMembrane.getProxy(target);
2953
+ return getReactiveProxy(target);
2925
2954
  }
2926
2955
 
2927
2956
  if (process.env.NODE_ENV !== 'production') {
@@ -2948,12 +2977,8 @@
2948
2977
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2949
2978
  }
2950
2979
 
2951
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2952
-
2953
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2954
- vm.cmpFields[key] = reactiveOrAnyValue;
2955
- componentValueMutated(vm, key);
2956
- }
2980
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2981
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2957
2982
  },
2958
2983
  enumerable: true,
2959
2984
  configurable: true
@@ -2997,10 +3022,7 @@
2997
3022
  * system to be backward compatible.
2998
3023
  */
2999
3024
 
3000
- if (value !== vm.cmpFields[key]) {
3001
- vm.cmpFields[key] = value;
3002
- componentValueMutated(vm, key);
3003
- }
3025
+ updateComponentValue(vm, key, value);
3004
3026
  },
3005
3027
  enumerable: true,
3006
3028
  configurable: true
@@ -3423,7 +3445,7 @@
3423
3445
  fn = cachedSetterByKey[key] = function (newValue) {
3424
3446
  var vm = getAssociatedVM(this);
3425
3447
  var setHook = vm.setHook;
3426
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3448
+ newValue = getReadOnlyProxy(newValue);
3427
3449
  setHook(vm.component, key, newValue);
3428
3450
  };
3429
3451
  }
@@ -4323,9 +4345,7 @@
4323
4345
  function createStylesheet(vm, stylesheets) {
4324
4346
  var renderMode = vm.renderMode,
4325
4347
  shadowMode = vm.shadowMode,
4326
- _vm$renderer2 = vm.renderer,
4327
- ssr = _vm$renderer2.ssr,
4328
- insertStylesheet = _vm$renderer2.insertStylesheet;
4348
+ insertStylesheet = vm.renderer.insertStylesheet;
4329
4349
 
4330
4350
  if (renderMode === 1
4331
4351
  /* RenderMode.Shadow */
@@ -4335,7 +4355,7 @@
4335
4355
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4336
4356
  insertStylesheet(stylesheets[_i12]);
4337
4357
  }
4338
- } else if (ssr || vm.hydrated) {
4358
+ } else if (vm.hydrated) {
4339
4359
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4340
4360
  // This works in the client, because the stylesheets are created, and cached in the VM
4341
4361
  // the first time the VM renders.
@@ -4721,7 +4741,7 @@
4721
4741
  }
4722
4742
  }
4723
4743
 
4724
- function patch(n1, n2, renderer) {
4744
+ function patch(n1, n2, parent, renderer) {
4725
4745
  var _a, _b;
4726
4746
 
4727
4747
  if (n1 === n2) {
@@ -4770,7 +4790,7 @@
4770
4790
  case 3
4771
4791
  /* VNodeType.CustomElement */
4772
4792
  :
4773
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4793
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4774
4794
  break;
4775
4795
  }
4776
4796
  }
@@ -4855,10 +4875,11 @@
4855
4875
  svg = vnode.data.svg;
4856
4876
  var createElement = renderer.createElement;
4857
4877
  var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
4858
- var elm = createElement(sel, namespace);
4878
+ var elm = vnode.elm = createElement(sel, namespace);
4859
4879
  linkNodeToShadow(elm, owner, renderer);
4860
- fallbackElmHook(elm, vnode, renderer);
4861
- vnode.elm = elm;
4880
+ applyStyleScoping(elm, owner, renderer);
4881
+ applyDomManual(elm, vnode);
4882
+ applyElementRestrictions(elm, vnode);
4862
4883
  patchElementPropsAndAttrs$1(null, vnode, renderer);
4863
4884
  insertNode(elm, parent, anchor, renderer);
4864
4885
  mountVNodes(vnode.children, elm, renderer, null);
@@ -4875,7 +4896,8 @@
4875
4896
  var cloneNode = renderer.cloneNode,
4876
4897
  isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
4877
4898
  var elm = vnode.elm = cloneNode(vnode.fragment, true);
4878
- linkNodeToShadow(elm, owner, renderer); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4899
+ linkNodeToShadow(elm, owner, renderer);
4900
+ applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4879
4901
 
4880
4902
  var renderMode = owner.renderMode,
4881
4903
  shadowMode = owner.shadowMode;
@@ -4890,16 +4912,6 @@
4890
4912
  }
4891
4913
  }
4892
4914
 
4893
- if (process.env.NODE_ENV !== 'production') {
4894
- var isLight = renderMode === 0
4895
- /* RenderMode.Light */
4896
- ;
4897
- patchElementWithRestrictions(elm, {
4898
- isPortal: false,
4899
- isLight: isLight
4900
- });
4901
- }
4902
-
4903
4915
  insertNode(elm, parent, anchor, renderer);
4904
4916
  }
4905
4917
 
@@ -4919,9 +4931,10 @@
4919
4931
  // the custom element from the registry is expecting an upgrade callback
4920
4932
  vm = createViewModelHook(elm, vnode, renderer);
4921
4933
  });
4922
- linkNodeToShadow(elm, owner, renderer);
4923
4934
  vnode.elm = elm;
4924
4935
  vnode.vm = vm;
4936
+ linkNodeToShadow(elm, owner, renderer);
4937
+ applyStyleScoping(elm, owner, renderer);
4925
4938
 
4926
4939
  if (vm) {
4927
4940
  allocateChildren(vnode, vm);
@@ -4949,25 +4962,34 @@
4949
4962
  }
4950
4963
  }
4951
4964
 
4952
- function patchCustomElement(n1, n2, renderer) {
4953
- var elm = n2.elm = n1.elm;
4954
- var vm = n2.vm = n1.vm;
4955
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4965
+ function patchCustomElement(n1, n2, parent, renderer) {
4966
+ if (n1.ctor !== n2.ctor) {
4967
+ // If the constructor, unmount the current component and mount a new one using the new
4968
+ // constructor.
4969
+ var anchor = renderer.nextSibling(n1.elm);
4970
+ unmount(n1, parent, renderer, true);
4971
+ mountCustomElement(n2, parent, anchor, renderer);
4972
+ } else {
4973
+ // Otherwise patch the existing component with new props/attrs/etc.
4974
+ var elm = n2.elm = n1.elm;
4975
+ var vm = n2.vm = n1.vm;
4976
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4956
4977
 
4957
- if (!isUndefined$1(vm)) {
4958
- // in fallback mode, the allocation will always set children to
4959
- // empty and delegate the real allocation to the slot elements
4960
- allocateChildren(n2, vm);
4961
- } // in fallback mode, the children will be always empty, so, nothing
4962
- // will happen, but in native, it does allocate the light dom
4978
+ if (!isUndefined$1(vm)) {
4979
+ // in fallback mode, the allocation will always set children to
4980
+ // empty and delegate the real allocation to the slot elements
4981
+ allocateChildren(n2, vm);
4982
+ } // in fallback mode, the children will be always empty, so, nothing
4983
+ // will happen, but in native, it does allocate the light dom
4963
4984
 
4964
4985
 
4965
- patchChildren(n1.children, n2.children, elm, renderer);
4986
+ patchChildren(n1.children, n2.children, elm, renderer);
4966
4987
 
4967
- if (!isUndefined$1(vm)) {
4968
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4969
- // this is important to preserve the top to bottom synchronous rendering phase.
4970
- rerenderVM(vm);
4988
+ if (!isUndefined$1(vm)) {
4989
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4990
+ // this is important to preserve the top to bottom synchronous rendering phase.
4991
+ rerenderVM(vm);
4992
+ }
4971
4993
  }
4972
4994
  }
4973
4995
 
@@ -5043,26 +5065,6 @@
5043
5065
  return vnode != null;
5044
5066
  }
5045
5067
 
5046
- function observeElementChildNodes(elm) {
5047
- elm.$domManual$ = true;
5048
- }
5049
-
5050
- function setElementShadowToken(elm, token) {
5051
- elm.$shadowToken$ = token;
5052
- } // Set the scope token class for *.scoped.css styles
5053
-
5054
-
5055
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
5056
- var token = getScopeTokenClass(owner);
5057
-
5058
- if (!isNull(token)) {
5059
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5060
- // probably we should have a renderer api for just the add operation
5061
-
5062
- _getClassList(elm).add(token);
5063
- }
5064
- }
5065
-
5066
5068
  function linkNodeToShadow(elm, owner, renderer) {
5067
5069
  var renderRoot = owner.renderRoot,
5068
5070
  renderMode = owner.renderMode,
@@ -5135,36 +5137,52 @@
5135
5137
  patchProps(oldVnode, vnode, renderer);
5136
5138
  }
5137
5139
 
5138
- function fallbackElmHook(elm, vnode, renderer) {
5139
- var owner = vnode.owner;
5140
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5140
+ function applyStyleScoping(elm, owner, renderer) {
5141
+ // Set the class name for `*.scoped.css` style scoping.
5142
+ var scopeToken = getScopeTokenClass(owner);
5143
+
5144
+ if (!isNull(scopeToken)) {
5145
+ var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5146
+ // probably we should have a renderer api for just the add operation
5147
+
5148
+ _getClassList(elm).add(scopeToken);
5149
+ } // Set property element for synthetic shadow DOM style scoping.
5150
+
5151
+
5152
+ var syntheticToken = owner.context.stylesheetToken;
5141
5153
 
5142
5154
  if (owner.shadowMode === 1
5143
5155
  /* ShadowMode.Synthetic */
5144
- ) {
5145
- var context = vnode.data.context;
5146
- var stylesheetToken = owner.context.stylesheetToken;
5156
+ && !isUndefined$1(syntheticToken)) {
5157
+ elm.$shadowToken$ = syntheticToken;
5158
+ }
5159
+ }
5147
5160
 
5148
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5149
- /* LwcDomMode.Manual */
5150
- ) {
5151
- // this element will now accept any manual content inserted into it
5152
- observeElementChildNodes(elm);
5153
- }
5161
+ function applyDomManual(elm, vnode) {
5162
+ var _a;
5154
5163
 
5155
- if (!isUndefined$1(stylesheetToken)) {
5156
- // when running in synthetic shadow mode, we need to set the shadowToken value
5157
- // into each element from the template, so they can be styled accordingly.
5158
- setElementShadowToken(elm, stylesheetToken);
5159
- }
5164
+ var owner = vnode.owner,
5165
+ context = vnode.data.context;
5166
+
5167
+ if (owner.shadowMode === 1
5168
+ /* ShadowMode.Synthetic */
5169
+ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
5170
+ /* LwcDomMode.Manual */
5171
+ ) {
5172
+ elm.$domManual$ = true;
5160
5173
  }
5174
+ }
5175
+
5176
+ function applyElementRestrictions(elm, vnode) {
5177
+ var _a, _b;
5161
5178
 
5162
5179
  if (process.env.NODE_ENV !== 'production') {
5163
- var _context = vnode.data.context;
5164
- var isPortal = !isUndefined$1(_context) && !isUndefined$1(_context.lwc) && _context.lwc.dom === "manual"
5180
+ var isPortal = vnode.type === 2
5181
+ /* VNodeType.Element */
5182
+ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
5165
5183
  /* LwcDomMode.Manual */
5166
5184
  ;
5167
- var isLight = owner.renderMode === 0
5185
+ var isLight = vnode.owner.renderMode === 0
5168
5186
  /* RenderMode.Light */
5169
5187
  ;
5170
5188
  patchElementWithRestrictions(elm, {
@@ -5217,19 +5235,6 @@
5217
5235
  mode = vnode.mode,
5218
5236
  ctor = vnode.ctor,
5219
5237
  owner = vnode.owner;
5220
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5221
-
5222
- if (owner.shadowMode === 1
5223
- /* ShadowMode.Synthetic */
5224
- ) {
5225
- var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
5226
- // into each element from the template, so they can be styled accordingly.
5227
-
5228
- if (!isUndefined$1(stylesheetToken)) {
5229
- setElementShadowToken(elm, stylesheetToken);
5230
- }
5231
- }
5232
-
5233
5238
  vm = createVM(elm, ctor, renderer, {
5234
5239
  mode: mode,
5235
5240
  owner: owner,
@@ -5353,22 +5358,22 @@
5353
5358
  } else if (!isVNode(newEndVnode)) {
5354
5359
  newEndVnode = newCh[--newEndIdx];
5355
5360
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5356
- patch(oldStartVnode, newStartVnode, renderer);
5361
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5357
5362
  oldStartVnode = oldCh[++oldStartIdx];
5358
5363
  newStartVnode = newCh[++newStartIdx];
5359
5364
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5360
- patch(oldEndVnode, newEndVnode, renderer);
5365
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5361
5366
  oldEndVnode = oldCh[--oldEndIdx];
5362
5367
  newEndVnode = newCh[--newEndIdx];
5363
5368
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5364
5369
  // Vnode moved right
5365
- patch(oldStartVnode, newEndVnode, renderer);
5370
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5366
5371
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5367
5372
  oldStartVnode = oldCh[++oldStartIdx];
5368
5373
  newEndVnode = newCh[--newEndIdx];
5369
5374
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5370
5375
  // Vnode moved left
5371
- patch(oldEndVnode, newStartVnode, renderer);
5376
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5372
5377
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5373
5378
  oldEndVnode = oldCh[--oldEndIdx];
5374
5379
  newStartVnode = newCh[++newStartIdx];
@@ -5391,7 +5396,7 @@
5391
5396
  // New element
5392
5397
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5393
5398
  } else {
5394
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5399
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5395
5400
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5396
5401
  // so we only care about the `oldCh` object inside this function.
5397
5402
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5461,7 +5466,7 @@
5461
5466
  if (isVNode(n1)) {
5462
5467
  if (isVNode(n2)) {
5463
5468
  // both vnodes are equivalent, and we just need to patch them
5464
- patch(n1, n2, renderer);
5469
+ patch(n1, n2, parent, renderer);
5465
5470
  anchor = n2.elm;
5466
5471
  } else {
5467
5472
  // removing the old vnode since the new one is null
@@ -5876,19 +5881,11 @@
5876
5881
 
5877
5882
  return url;
5878
5883
  }
5879
- /**
5880
- * Map to store an index value assigned to any dynamic component reference ingested
5881
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5882
- * component reference to avoid diffing algo mismatches.
5883
- */
5884
-
5885
-
5886
- var DynamicImportedComponentMap = new Map();
5887
- var dynamicImportedComponentCounter = 0;
5888
5884
  /**
5889
5885
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5890
5886
  */
5891
5887
 
5888
+
5892
5889
  function dc(sel, Ctor, data) {
5893
5890
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5894
5891
 
@@ -5907,22 +5904,7 @@
5907
5904
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5908
5905
  }
5909
5906
 
5910
- var idx = DynamicImportedComponentMap.get(Ctor);
5911
-
5912
- if (isUndefined$1(idx)) {
5913
- idx = dynamicImportedComponentCounter++;
5914
- DynamicImportedComponentMap.set(Ctor, idx);
5915
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5916
- // to identify different constructors as vnodes with different keys to avoid reusing the
5917
- // element used for previous constructors.
5918
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5919
- // hoisting optimization.
5920
-
5921
-
5922
- var newData = Object.assign(Object.assign({}, data), {
5923
- key: "dc:".concat(idx, ":").concat(data.key)
5924
- });
5925
- return c(sel, Ctor, newData, children);
5907
+ return c(sel, Ctor, data, children);
5926
5908
  }
5927
5909
  /**
5928
5910
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6496,7 +6478,7 @@
6496
6478
  }
6497
6479
 
6498
6480
  function getTemplateReactiveObserver(vm) {
6499
- return new ReactiveObserver(function () {
6481
+ return createReactiveObserver(function () {
6500
6482
  var isDirty = vm.isDirty;
6501
6483
 
6502
6484
  if (isFalse(isDirty)) {
@@ -6930,13 +6912,7 @@
6930
6912
  }
6931
6913
 
6932
6914
  function runRenderedCallback(vm) {
6933
- var renderedCallback = vm.def.renderedCallback,
6934
- ssr = vm.renderer.ssr;
6935
-
6936
- if (isTrue(ssr)) {
6937
- return;
6938
- }
6939
-
6915
+ var renderedCallback = vm.def.renderedCallback;
6940
6916
  var rendered = Services.rendered;
6941
6917
 
6942
6918
  if (rendered) {
@@ -7168,9 +7144,7 @@
7168
7144
  }
7169
7145
 
7170
7146
  function scheduleRehydration(vm) {
7171
- var ssr = vm.renderer.ssr;
7172
-
7173
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7147
+ if (isTrue(vm.isScheduled)) {
7174
7148
  return;
7175
7149
  }
7176
7150
 
@@ -7292,13 +7266,8 @@
7292
7266
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7293
7267
 
7294
7268
  function createFieldDataCallback(vm, name) {
7295
- var cmpFields = vm.cmpFields;
7296
7269
  return function (value) {
7297
- if (value !== vm.cmpFields[name]) {
7298
- // storing the value in the underlying storage
7299
- cmpFields[name] = value;
7300
- componentValueMutated(vm, name);
7301
- }
7270
+ updateComponentValue(vm, name, value);
7302
7271
  };
7303
7272
  }
7304
7273
 
@@ -7315,7 +7284,7 @@
7315
7284
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7316
7285
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7317
7286
 
7318
- var ro = new ReactiveObserver(function () {
7287
+ var ro = createReactiveObserver(function () {
7319
7288
  if (hasPendingConfig === false) {
7320
7289
  hasPendingConfig = true; // collect new config in the micro-task
7321
7290
 
@@ -7616,7 +7585,7 @@
7616
7585
  }
7617
7586
  }
7618
7587
 
7619
- return reactiveMembrane.getReadOnlyProxy(obj);
7588
+ return getReadOnlyProxy(obj);
7620
7589
  }
7621
7590
  /*
7622
7591
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8297,7 +8266,7 @@
8297
8266
 
8298
8267
  return ctor;
8299
8268
  }
8300
- /* version: 2.21.0 */
8269
+ /* version: 2.23.0 */
8301
8270
 
8302
8271
  /*
8303
8272
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8465,6 +8434,85 @@
8465
8434
  */
8466
8435
 
8467
8436
 
8437
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8438
+ var createFragment;
8439
+
8440
+ if (SUPPORTS_TEMPLATE) {
8441
+ // Parse the fragment HTML string into DOM
8442
+ createFragment = function createFragment(html) {
8443
+ var template = document.createElement('template');
8444
+ template.innerHTML = html;
8445
+ return template.content.firstChild;
8446
+ };
8447
+ } else {
8448
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8449
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8450
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8451
+ // With other elements added from:
8452
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8453
+ // Using the test:
8454
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8455
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8456
+ var topLevelWrappingMap = {
8457
+ caption: ['table'],
8458
+ col: ['colgroup', 'table'],
8459
+ colgroup: ['table'],
8460
+ option: ['select'],
8461
+ tbody: ['table'],
8462
+ td: ['tr', 'tbody', 'table'],
8463
+ th: ['tr', 'tbody', 'table'],
8464
+ thead: ['table'],
8465
+ tfoot: ['table'],
8466
+ tr: ['tbody', 'table']
8467
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8468
+
8469
+ var getTagName = function getTagName(text) {
8470
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8471
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8472
+
8473
+
8474
+ createFragment = function createFragment(html) {
8475
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8476
+
8477
+ if (!isUndefined$1(wrapperTags)) {
8478
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8479
+ _step5;
8480
+
8481
+ try {
8482
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8483
+ var wrapperTag = _step5.value;
8484
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8485
+ }
8486
+ } catch (err) {
8487
+ _iterator5.e(err);
8488
+ } finally {
8489
+ _iterator5.f();
8490
+ }
8491
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8492
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8493
+
8494
+
8495
+ var doc = document.implementation.createHTMLDocument('');
8496
+ doc.body.innerHTML = html;
8497
+ var content = doc.body;
8498
+
8499
+ if (!isUndefined$1(wrapperTags)) {
8500
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8501
+ content = content.firstChild;
8502
+ }
8503
+ }
8504
+
8505
+ return content.firstChild;
8506
+ };
8507
+ }
8508
+ /*
8509
+ * Copyright (c) 2018, salesforce.com, inc.
8510
+ * All rights reserved.
8511
+ * SPDX-License-Identifier: MIT
8512
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8513
+ */
8514
+
8515
+
8468
8516
  var getCustomElement;
8469
8517
  var defineCustomElement;
8470
8518
  var HTMLElementConstructor;
@@ -8546,18 +8594,6 @@
8546
8594
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8547
8595
  }
8548
8596
 
8549
- var hydrating = false;
8550
-
8551
- function setIsHydrating(value) {
8552
- hydrating = value;
8553
- }
8554
-
8555
- var ssr = false;
8556
-
8557
- function isHydrating() {
8558
- return hydrating;
8559
- }
8560
-
8561
8597
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8562
8598
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8563
8599
 
@@ -8565,10 +8601,6 @@
8565
8601
  return node.cloneNode(deep);
8566
8602
  }
8567
8603
 
8568
- function createFragment(html) {
8569
- return document.createRange().createContextualFragment(html).firstChild;
8570
- }
8571
-
8572
8604
  function createElement$1(tagName, namespace) {
8573
8605
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8574
8606
  }
@@ -8594,15 +8626,11 @@
8594
8626
  }
8595
8627
 
8596
8628
  function attachShadow(element, options) {
8597
- // `hydrating` will be true in two cases:
8629
+ // `shadowRoot` will be non-null in two cases:
8598
8630
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8599
8631
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
8600
- // root component with customeElement.define('c-app', Ctor)
8601
- //
8602
- // The second case can be treated as a failed hydration with nominal impact
8603
- // to performance. However, because <c-app> won't have a <template shadowroot>
8604
- // declarative child, `element.shadowRoot` is `null`.
8605
- if (hydrating && element.shadowRoot) {
8632
+ // root component with customElement.define('c-app', Ctor)
8633
+ if (!isNull(element.shadowRoot)) {
8606
8634
  return element.shadowRoot;
8607
8635
  }
8608
8636
 
@@ -8720,11 +8748,9 @@
8720
8748
 
8721
8749
  var HTMLElementExported = HTMLElementConstructor;
8722
8750
  var renderer = {
8723
- ssr: ssr,
8724
8751
  isNativeShadowDefined: isNativeShadowDefined,
8725
8752
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8726
8753
  HTMLElementExported: HTMLElementExported,
8727
- isHydrating: isHydrating,
8728
8754
  insert: insert,
8729
8755
  remove: remove,
8730
8756
  cloneNode: cloneNode,
@@ -8793,8 +8819,8 @@
8793
8819
  hydrated: true
8794
8820
  });
8795
8821
 
8796
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8797
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8822
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8823
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8798
8824
  key = _Object$entries2$_i[0],
8799
8825
  value = _Object$entries2$_i[1];
8800
8826
 
@@ -8826,13 +8852,8 @@
8826
8852
  }
8827
8853
 
8828
8854
  try {
8829
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8830
- // and uses the same algo to create the stylesheets as in SSR.
8831
- setIsHydrating(true);
8832
8855
  var vm = createVMWithProps(element, Ctor, props);
8833
- hydrateRoot(vm); // set it back since now we finished hydration.
8834
-
8835
- setIsHydrating(false);
8856
+ hydrateRoot(vm);
8836
8857
  } catch (e) {
8837
8858
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8838
8859
  // with the client generated DOM.
@@ -8843,11 +8864,7 @@
8843
8864
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8844
8865
 
8845
8866
  createVMWithProps(element, Ctor, props);
8846
- setIsHydrating(false);
8847
8867
  connectRootElement(element);
8848
- } finally {
8849
- // in case there's an error during recovery
8850
- setIsHydrating(false);
8851
8868
  }
8852
8869
  }
8853
8870
  /*
@@ -9126,7 +9143,7 @@
9126
9143
  });
9127
9144
  freeze(LightningElement);
9128
9145
  seal(LightningElement.prototype);
9129
- /* version: 2.21.0 */
9146
+ /* version: 2.23.0 */
9130
9147
 
9131
9148
  exports.LightningElement = LightningElement;
9132
9149
  exports.__unstable__ProfilerControl = profilerControl;