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
@@ -365,9 +365,9 @@ var LWC = (function (exports) {
365
365
  // Increment whenever the LWC template compiler changes
366
366
 
367
367
 
368
- var LWC_VERSION = "2.21.0";
368
+ var LWC_VERSION = "2.23.0";
369
369
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.21.0 */
370
+ /** version: 2.23.0 */
371
371
 
372
372
  /*
373
373
  * Copyright (c) 2018, salesforce.com, inc.
@@ -546,7 +546,7 @@ var LWC = (function (exports) {
546
546
  setFeatureFlag(name, value);
547
547
  }
548
548
  }
549
- /** version: 2.21.0 */
549
+ /** version: 2.23.0 */
550
550
 
551
551
  /*
552
552
  * Copyright (c) 2018, salesforce.com, inc.
@@ -852,20 +852,24 @@ var LWC = (function (exports) {
852
852
 
853
853
  return ReactiveObserver;
854
854
  }();
855
- /*
856
- * Copyright (c) 2018, salesforce.com, inc.
857
- * All rights reserved.
858
- * SPDX-License-Identifier: MIT
859
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
860
- */
861
-
862
855
 
863
856
  function componentValueMutated(vm, key) {
864
- valueMutated(vm.component, key);
857
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
858
+ {
859
+ valueMutated(vm.component, key);
860
+ }
865
861
  }
866
862
 
867
863
  function componentValueObserved(vm, key) {
868
- valueObserved(vm.component, key);
864
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
865
+ {
866
+ valueObserved(vm.component, key);
867
+ }
868
+ }
869
+
870
+ function createReactiveObserver(callback) {
871
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
872
+ return new ReactiveObserver(callback);
869
873
  }
870
874
  /*
871
875
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1473,6 +1477,15 @@ var LWC = (function (exports) {
1473
1477
  function patchLightningElementPrototypeWithRestrictions(proto) {
1474
1478
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1475
1479
  }
1480
+
1481
+ function updateComponentValue(vm, key, newValue) {
1482
+ var cmpFields = vm.cmpFields;
1483
+
1484
+ if (newValue !== cmpFields[key]) {
1485
+ cmpFields[key] = newValue;
1486
+ componentValueMutated(vm, key);
1487
+ }
1488
+ }
1476
1489
  /**
1477
1490
  * Copyright (C) 2017 salesforce.com, inc.
1478
1491
  */
@@ -2280,8 +2293,28 @@ var LWC = (function (exports) {
2280
2293
  */
2281
2294
 
2282
2295
  function unwrap(value) {
2296
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2283
2297
  return reactiveMembrane.unwrapProxy(value);
2284
2298
  }
2299
+
2300
+ function getReadOnlyProxy(value) {
2301
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2302
+ // them from their parents. This applies to both the client and server.
2303
+ return reactiveMembrane.getReadOnlyProxy(value);
2304
+ }
2305
+
2306
+ function getReactiveProxy(value) {
2307
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2308
+ return reactiveMembrane.getProxy(value);
2309
+ } // Making the component instance a live value when using Locker to support expandos.
2310
+
2311
+
2312
+ function markLockerLiveObject(obj) {
2313
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2314
+ {
2315
+ obj[lockerLivePropertyKey] = undefined;
2316
+ }
2317
+ }
2285
2318
  /*
2286
2319
  * Copyright (c) 2018, salesforce.com, inc.
2287
2320
  * All rights reserved.
@@ -2348,11 +2381,7 @@ var LWC = (function (exports) {
2348
2381
  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."));
2349
2382
  }
2350
2383
 
2351
- if (newValue !== vm.cmpProps[propName]) {
2352
- vm.cmpProps[propName] = newValue;
2353
- componentValueMutated(vm, propName);
2354
- }
2355
-
2384
+ updateComponentValue(vm, propName, newValue);
2356
2385
  return _set.call(vm.elm, newValue);
2357
2386
  }
2358
2387
  };
@@ -2396,10 +2425,9 @@ var LWC = (function (exports) {
2396
2425
  vm.callHook = _callHook;
2397
2426
  vm.setHook = _setHook;
2398
2427
  vm.getHook = _getHook;
2399
- } // Making the component instance a live value when using Locker to support expandos.
2400
-
2428
+ }
2401
2429
 
2402
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2430
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2403
2431
 
2404
2432
  associateVM(component, vm);
2405
2433
  associateVM(elm, vm);
@@ -2729,60 +2757,7 @@ var LWC = (function (exports) {
2729
2757
  },
2730
2758
  set: function set(newValue) {
2731
2759
  var vm = getAssociatedVM(this);
2732
-
2733
- if (newValue !== vm.cmpFields[key]) {
2734
- vm.cmpFields[key] = newValue;
2735
- componentValueMutated(vm, key);
2736
- }
2737
- },
2738
- enumerable: true,
2739
- configurable: true
2740
- };
2741
- }
2742
- /*
2743
- * Copyright (c) 2018, salesforce.com, inc.
2744
- * All rights reserved.
2745
- * SPDX-License-Identifier: MIT
2746
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2747
- */
2748
-
2749
-
2750
- function api$1() {
2751
- if (process.env.NODE_ENV !== 'production') {
2752
- assert.fail("@api decorator can only be used as a decorator function.");
2753
- }
2754
-
2755
- throw new Error();
2756
- }
2757
-
2758
- function createPublicPropertyDescriptor(key) {
2759
- return {
2760
- get: function get() {
2761
- var vm = getAssociatedVM(this);
2762
-
2763
- if (isBeingConstructed(vm)) {
2764
- if (process.env.NODE_ENV !== 'production') {
2765
- 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);
2766
- }
2767
-
2768
- return;
2769
- }
2770
-
2771
- componentValueObserved(vm, key);
2772
- return vm.cmpProps[key];
2773
- },
2774
- set: function set(newValue) {
2775
- var vm = getAssociatedVM(this);
2776
-
2777
- if (process.env.NODE_ENV !== 'production') {
2778
- var _vmBeingRendered3 = getVMBeingRendered();
2779
-
2780
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2781
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2782
- }
2783
-
2784
- vm.cmpProps[key] = newValue;
2785
- componentValueMutated(vm, key);
2760
+ updateComponentValue(vm, key, newValue);
2786
2761
  },
2787
2762
  enumerable: true,
2788
2763
  configurable: true
@@ -2846,6 +2821,60 @@ var LWC = (function (exports) {
2846
2821
  return AccessorReactiveObserver;
2847
2822
  }(ReactiveObserver);
2848
2823
 
2824
+ function createAccessorReactiveObserver(vm, set) {
2825
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2826
+ return new AccessorReactiveObserver(vm, set);
2827
+ }
2828
+ /*
2829
+ * Copyright (c) 2018, salesforce.com, inc.
2830
+ * All rights reserved.
2831
+ * SPDX-License-Identifier: MIT
2832
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2833
+ */
2834
+
2835
+
2836
+ function api$1() {
2837
+ if (process.env.NODE_ENV !== 'production') {
2838
+ assert.fail("@api decorator can only be used as a decorator function.");
2839
+ }
2840
+
2841
+ throw new Error();
2842
+ }
2843
+
2844
+ function createPublicPropertyDescriptor(key) {
2845
+ return {
2846
+ get: function get() {
2847
+ var vm = getAssociatedVM(this);
2848
+
2849
+ if (isBeingConstructed(vm)) {
2850
+ if (process.env.NODE_ENV !== 'production') {
2851
+ 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);
2852
+ }
2853
+
2854
+ return;
2855
+ }
2856
+
2857
+ componentValueObserved(vm, key);
2858
+ return vm.cmpProps[key];
2859
+ },
2860
+ set: function set(newValue) {
2861
+ var vm = getAssociatedVM(this);
2862
+
2863
+ if (process.env.NODE_ENV !== 'production') {
2864
+ var _vmBeingRendered3 = getVMBeingRendered();
2865
+
2866
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2867
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2868
+ }
2869
+
2870
+ vm.cmpProps[key] = newValue;
2871
+ componentValueMutated(vm, key);
2872
+ },
2873
+ enumerable: true,
2874
+ configurable: true
2875
+ };
2876
+ }
2877
+
2849
2878
  function createPublicAccessorDescriptor(key, descriptor) {
2850
2879
  var _get3 = descriptor.get,
2851
2880
  _set2 = descriptor.set,
@@ -2886,7 +2915,7 @@ var LWC = (function (exports) {
2886
2915
  var ro = vm.oar[key];
2887
2916
 
2888
2917
  if (isUndefined$1(ro)) {
2889
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2918
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2890
2919
  } // every time we invoke this setter from outside (through this wrapper setter)
2891
2920
  // we should reset the value and then debounce just in case there is a pending
2892
2921
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2918,7 +2947,7 @@ var LWC = (function (exports) {
2918
2947
 
2919
2948
  function track(target) {
2920
2949
  if (arguments.length === 1) {
2921
- return reactiveMembrane.getProxy(target);
2950
+ return getReactiveProxy(target);
2922
2951
  }
2923
2952
 
2924
2953
  if (process.env.NODE_ENV !== 'production') {
@@ -2945,12 +2974,8 @@ var LWC = (function (exports) {
2945
2974
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2946
2975
  }
2947
2976
 
2948
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2949
-
2950
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2951
- vm.cmpFields[key] = reactiveOrAnyValue;
2952
- componentValueMutated(vm, key);
2953
- }
2977
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2978
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2954
2979
  },
2955
2980
  enumerable: true,
2956
2981
  configurable: true
@@ -2994,10 +3019,7 @@ var LWC = (function (exports) {
2994
3019
  * system to be backward compatible.
2995
3020
  */
2996
3021
 
2997
- if (value !== vm.cmpFields[key]) {
2998
- vm.cmpFields[key] = value;
2999
- componentValueMutated(vm, key);
3000
- }
3022
+ updateComponentValue(vm, key, value);
3001
3023
  },
3002
3024
  enumerable: true,
3003
3025
  configurable: true
@@ -3420,7 +3442,7 @@ var LWC = (function (exports) {
3420
3442
  fn = cachedSetterByKey[key] = function (newValue) {
3421
3443
  var vm = getAssociatedVM(this);
3422
3444
  var setHook = vm.setHook;
3423
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3445
+ newValue = getReadOnlyProxy(newValue);
3424
3446
  setHook(vm.component, key, newValue);
3425
3447
  };
3426
3448
  }
@@ -4320,9 +4342,7 @@ var LWC = (function (exports) {
4320
4342
  function createStylesheet(vm, stylesheets) {
4321
4343
  var renderMode = vm.renderMode,
4322
4344
  shadowMode = vm.shadowMode,
4323
- _vm$renderer2 = vm.renderer,
4324
- ssr = _vm$renderer2.ssr,
4325
- insertStylesheet = _vm$renderer2.insertStylesheet;
4345
+ insertStylesheet = vm.renderer.insertStylesheet;
4326
4346
 
4327
4347
  if (renderMode === 1
4328
4348
  /* RenderMode.Shadow */
@@ -4332,7 +4352,7 @@ var LWC = (function (exports) {
4332
4352
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4333
4353
  insertStylesheet(stylesheets[_i12]);
4334
4354
  }
4335
- } else if (ssr || vm.hydrated) {
4355
+ } else if (vm.hydrated) {
4336
4356
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4337
4357
  // This works in the client, because the stylesheets are created, and cached in the VM
4338
4358
  // the first time the VM renders.
@@ -4718,7 +4738,7 @@ var LWC = (function (exports) {
4718
4738
  }
4719
4739
  }
4720
4740
 
4721
- function patch(n1, n2, renderer) {
4741
+ function patch(n1, n2, parent, renderer) {
4722
4742
  var _a, _b;
4723
4743
 
4724
4744
  if (n1 === n2) {
@@ -4767,7 +4787,7 @@ var LWC = (function (exports) {
4767
4787
  case 3
4768
4788
  /* VNodeType.CustomElement */
4769
4789
  :
4770
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4790
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4771
4791
  break;
4772
4792
  }
4773
4793
  }
@@ -4852,10 +4872,11 @@ var LWC = (function (exports) {
4852
4872
  svg = vnode.data.svg;
4853
4873
  var createElement = renderer.createElement;
4854
4874
  var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
4855
- var elm = createElement(sel, namespace);
4875
+ var elm = vnode.elm = createElement(sel, namespace);
4856
4876
  linkNodeToShadow(elm, owner, renderer);
4857
- fallbackElmHook(elm, vnode, renderer);
4858
- vnode.elm = elm;
4877
+ applyStyleScoping(elm, owner, renderer);
4878
+ applyDomManual(elm, vnode);
4879
+ applyElementRestrictions(elm, vnode);
4859
4880
  patchElementPropsAndAttrs$1(null, vnode, renderer);
4860
4881
  insertNode(elm, parent, anchor, renderer);
4861
4882
  mountVNodes(vnode.children, elm, renderer, null);
@@ -4872,7 +4893,8 @@ var LWC = (function (exports) {
4872
4893
  var cloneNode = renderer.cloneNode,
4873
4894
  isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
4874
4895
  var elm = vnode.elm = cloneNode(vnode.fragment, true);
4875
- linkNodeToShadow(elm, owner, renderer); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4896
+ linkNodeToShadow(elm, owner, renderer);
4897
+ applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4876
4898
 
4877
4899
  var renderMode = owner.renderMode,
4878
4900
  shadowMode = owner.shadowMode;
@@ -4887,16 +4909,6 @@ var LWC = (function (exports) {
4887
4909
  }
4888
4910
  }
4889
4911
 
4890
- if (process.env.NODE_ENV !== 'production') {
4891
- var isLight = renderMode === 0
4892
- /* RenderMode.Light */
4893
- ;
4894
- patchElementWithRestrictions(elm, {
4895
- isPortal: false,
4896
- isLight: isLight
4897
- });
4898
- }
4899
-
4900
4912
  insertNode(elm, parent, anchor, renderer);
4901
4913
  }
4902
4914
 
@@ -4916,9 +4928,10 @@ var LWC = (function (exports) {
4916
4928
  // the custom element from the registry is expecting an upgrade callback
4917
4929
  vm = createViewModelHook(elm, vnode, renderer);
4918
4930
  });
4919
- linkNodeToShadow(elm, owner, renderer);
4920
4931
  vnode.elm = elm;
4921
4932
  vnode.vm = vm;
4933
+ linkNodeToShadow(elm, owner, renderer);
4934
+ applyStyleScoping(elm, owner, renderer);
4922
4935
 
4923
4936
  if (vm) {
4924
4937
  allocateChildren(vnode, vm);
@@ -4946,25 +4959,34 @@ var LWC = (function (exports) {
4946
4959
  }
4947
4960
  }
4948
4961
 
4949
- function patchCustomElement(n1, n2, renderer) {
4950
- var elm = n2.elm = n1.elm;
4951
- var vm = n2.vm = n1.vm;
4952
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4962
+ function patchCustomElement(n1, n2, parent, renderer) {
4963
+ if (n1.ctor !== n2.ctor) {
4964
+ // If the constructor, unmount the current component and mount a new one using the new
4965
+ // constructor.
4966
+ var anchor = renderer.nextSibling(n1.elm);
4967
+ unmount(n1, parent, renderer, true);
4968
+ mountCustomElement(n2, parent, anchor, renderer);
4969
+ } else {
4970
+ // Otherwise patch the existing component with new props/attrs/etc.
4971
+ var elm = n2.elm = n1.elm;
4972
+ var vm = n2.vm = n1.vm;
4973
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4953
4974
 
4954
- if (!isUndefined$1(vm)) {
4955
- // in fallback mode, the allocation will always set children to
4956
- // empty and delegate the real allocation to the slot elements
4957
- allocateChildren(n2, vm);
4958
- } // in fallback mode, the children will be always empty, so, nothing
4959
- // will happen, but in native, it does allocate the light dom
4975
+ if (!isUndefined$1(vm)) {
4976
+ // in fallback mode, the allocation will always set children to
4977
+ // empty and delegate the real allocation to the slot elements
4978
+ allocateChildren(n2, vm);
4979
+ } // in fallback mode, the children will be always empty, so, nothing
4980
+ // will happen, but in native, it does allocate the light dom
4960
4981
 
4961
4982
 
4962
- patchChildren(n1.children, n2.children, elm, renderer);
4983
+ patchChildren(n1.children, n2.children, elm, renderer);
4963
4984
 
4964
- if (!isUndefined$1(vm)) {
4965
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4966
- // this is important to preserve the top to bottom synchronous rendering phase.
4967
- rerenderVM(vm);
4985
+ if (!isUndefined$1(vm)) {
4986
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4987
+ // this is important to preserve the top to bottom synchronous rendering phase.
4988
+ rerenderVM(vm);
4989
+ }
4968
4990
  }
4969
4991
  }
4970
4992
 
@@ -5040,26 +5062,6 @@ var LWC = (function (exports) {
5040
5062
  return vnode != null;
5041
5063
  }
5042
5064
 
5043
- function observeElementChildNodes(elm) {
5044
- elm.$domManual$ = true;
5045
- }
5046
-
5047
- function setElementShadowToken(elm, token) {
5048
- elm.$shadowToken$ = token;
5049
- } // Set the scope token class for *.scoped.css styles
5050
-
5051
-
5052
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
5053
- var token = getScopeTokenClass(owner);
5054
-
5055
- if (!isNull(token)) {
5056
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5057
- // probably we should have a renderer api for just the add operation
5058
-
5059
- _getClassList(elm).add(token);
5060
- }
5061
- }
5062
-
5063
5065
  function linkNodeToShadow(elm, owner, renderer) {
5064
5066
  var renderRoot = owner.renderRoot,
5065
5067
  renderMode = owner.renderMode,
@@ -5132,36 +5134,52 @@ var LWC = (function (exports) {
5132
5134
  patchProps(oldVnode, vnode, renderer);
5133
5135
  }
5134
5136
 
5135
- function fallbackElmHook(elm, vnode, renderer) {
5136
- var owner = vnode.owner;
5137
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5137
+ function applyStyleScoping(elm, owner, renderer) {
5138
+ // Set the class name for `*.scoped.css` style scoping.
5139
+ var scopeToken = getScopeTokenClass(owner);
5140
+
5141
+ if (!isNull(scopeToken)) {
5142
+ var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5143
+ // probably we should have a renderer api for just the add operation
5144
+
5145
+ _getClassList(elm).add(scopeToken);
5146
+ } // Set property element for synthetic shadow DOM style scoping.
5147
+
5148
+
5149
+ var syntheticToken = owner.context.stylesheetToken;
5138
5150
 
5139
5151
  if (owner.shadowMode === 1
5140
5152
  /* ShadowMode.Synthetic */
5141
- ) {
5142
- var context = vnode.data.context;
5143
- var stylesheetToken = owner.context.stylesheetToken;
5153
+ && !isUndefined$1(syntheticToken)) {
5154
+ elm.$shadowToken$ = syntheticToken;
5155
+ }
5156
+ }
5144
5157
 
5145
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5146
- /* LwcDomMode.Manual */
5147
- ) {
5148
- // this element will now accept any manual content inserted into it
5149
- observeElementChildNodes(elm);
5150
- }
5158
+ function applyDomManual(elm, vnode) {
5159
+ var _a;
5151
5160
 
5152
- if (!isUndefined$1(stylesheetToken)) {
5153
- // when running in synthetic shadow mode, we need to set the shadowToken value
5154
- // into each element from the template, so they can be styled accordingly.
5155
- setElementShadowToken(elm, stylesheetToken);
5156
- }
5161
+ var owner = vnode.owner,
5162
+ context = vnode.data.context;
5163
+
5164
+ if (owner.shadowMode === 1
5165
+ /* ShadowMode.Synthetic */
5166
+ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
5167
+ /* LwcDomMode.Manual */
5168
+ ) {
5169
+ elm.$domManual$ = true;
5157
5170
  }
5171
+ }
5172
+
5173
+ function applyElementRestrictions(elm, vnode) {
5174
+ var _a, _b;
5158
5175
 
5159
5176
  if (process.env.NODE_ENV !== 'production') {
5160
- var _context = vnode.data.context;
5161
- var isPortal = !isUndefined$1(_context) && !isUndefined$1(_context.lwc) && _context.lwc.dom === "manual"
5177
+ var isPortal = vnode.type === 2
5178
+ /* VNodeType.Element */
5179
+ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
5162
5180
  /* LwcDomMode.Manual */
5163
5181
  ;
5164
- var isLight = owner.renderMode === 0
5182
+ var isLight = vnode.owner.renderMode === 0
5165
5183
  /* RenderMode.Light */
5166
5184
  ;
5167
5185
  patchElementWithRestrictions(elm, {
@@ -5214,19 +5232,6 @@ var LWC = (function (exports) {
5214
5232
  mode = vnode.mode,
5215
5233
  ctor = vnode.ctor,
5216
5234
  owner = vnode.owner;
5217
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5218
-
5219
- if (owner.shadowMode === 1
5220
- /* ShadowMode.Synthetic */
5221
- ) {
5222
- var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
5223
- // into each element from the template, so they can be styled accordingly.
5224
-
5225
- if (!isUndefined$1(stylesheetToken)) {
5226
- setElementShadowToken(elm, stylesheetToken);
5227
- }
5228
- }
5229
-
5230
5235
  vm = createVM(elm, ctor, renderer, {
5231
5236
  mode: mode,
5232
5237
  owner: owner,
@@ -5350,22 +5355,22 @@ var LWC = (function (exports) {
5350
5355
  } else if (!isVNode(newEndVnode)) {
5351
5356
  newEndVnode = newCh[--newEndIdx];
5352
5357
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5353
- patch(oldStartVnode, newStartVnode, renderer);
5358
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5354
5359
  oldStartVnode = oldCh[++oldStartIdx];
5355
5360
  newStartVnode = newCh[++newStartIdx];
5356
5361
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5357
- patch(oldEndVnode, newEndVnode, renderer);
5362
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5358
5363
  oldEndVnode = oldCh[--oldEndIdx];
5359
5364
  newEndVnode = newCh[--newEndIdx];
5360
5365
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5361
5366
  // Vnode moved right
5362
- patch(oldStartVnode, newEndVnode, renderer);
5367
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5363
5368
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5364
5369
  oldStartVnode = oldCh[++oldStartIdx];
5365
5370
  newEndVnode = newCh[--newEndIdx];
5366
5371
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5367
5372
  // Vnode moved left
5368
- patch(oldEndVnode, newStartVnode, renderer);
5373
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5369
5374
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5370
5375
  oldEndVnode = oldCh[--oldEndIdx];
5371
5376
  newStartVnode = newCh[++newStartIdx];
@@ -5388,7 +5393,7 @@ var LWC = (function (exports) {
5388
5393
  // New element
5389
5394
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5390
5395
  } else {
5391
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5396
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5392
5397
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5393
5398
  // so we only care about the `oldCh` object inside this function.
5394
5399
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5458,7 +5463,7 @@ var LWC = (function (exports) {
5458
5463
  if (isVNode(n1)) {
5459
5464
  if (isVNode(n2)) {
5460
5465
  // both vnodes are equivalent, and we just need to patch them
5461
- patch(n1, n2, renderer);
5466
+ patch(n1, n2, parent, renderer);
5462
5467
  anchor = n2.elm;
5463
5468
  } else {
5464
5469
  // removing the old vnode since the new one is null
@@ -5873,19 +5878,11 @@ var LWC = (function (exports) {
5873
5878
 
5874
5879
  return url;
5875
5880
  }
5876
- /**
5877
- * Map to store an index value assigned to any dynamic component reference ingested
5878
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5879
- * component reference to avoid diffing algo mismatches.
5880
- */
5881
-
5882
-
5883
- var DynamicImportedComponentMap = new Map();
5884
- var dynamicImportedComponentCounter = 0;
5885
5881
  /**
5886
5882
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5887
5883
  */
5888
5884
 
5885
+
5889
5886
  function dc(sel, Ctor, data) {
5890
5887
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5891
5888
 
@@ -5904,22 +5901,7 @@ var LWC = (function (exports) {
5904
5901
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5905
5902
  }
5906
5903
 
5907
- var idx = DynamicImportedComponentMap.get(Ctor);
5908
-
5909
- if (isUndefined$1(idx)) {
5910
- idx = dynamicImportedComponentCounter++;
5911
- DynamicImportedComponentMap.set(Ctor, idx);
5912
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5913
- // to identify different constructors as vnodes with different keys to avoid reusing the
5914
- // element used for previous constructors.
5915
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5916
- // hoisting optimization.
5917
-
5918
-
5919
- var newData = Object.assign(Object.assign({}, data), {
5920
- key: "dc:".concat(idx, ":").concat(data.key)
5921
- });
5922
- return c(sel, Ctor, newData, children);
5904
+ return c(sel, Ctor, data, children);
5923
5905
  }
5924
5906
  /**
5925
5907
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6493,7 +6475,7 @@ var LWC = (function (exports) {
6493
6475
  }
6494
6476
 
6495
6477
  function getTemplateReactiveObserver(vm) {
6496
- return new ReactiveObserver(function () {
6478
+ return createReactiveObserver(function () {
6497
6479
  var isDirty = vm.isDirty;
6498
6480
 
6499
6481
  if (isFalse(isDirty)) {
@@ -6927,13 +6909,7 @@ var LWC = (function (exports) {
6927
6909
  }
6928
6910
 
6929
6911
  function runRenderedCallback(vm) {
6930
- var renderedCallback = vm.def.renderedCallback,
6931
- ssr = vm.renderer.ssr;
6932
-
6933
- if (isTrue(ssr)) {
6934
- return;
6935
- }
6936
-
6912
+ var renderedCallback = vm.def.renderedCallback;
6937
6913
  var rendered = Services.rendered;
6938
6914
 
6939
6915
  if (rendered) {
@@ -7165,9 +7141,7 @@ var LWC = (function (exports) {
7165
7141
  }
7166
7142
 
7167
7143
  function scheduleRehydration(vm) {
7168
- var ssr = vm.renderer.ssr;
7169
-
7170
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7144
+ if (isTrue(vm.isScheduled)) {
7171
7145
  return;
7172
7146
  }
7173
7147
 
@@ -7289,13 +7263,8 @@ var LWC = (function (exports) {
7289
7263
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7290
7264
 
7291
7265
  function createFieldDataCallback(vm, name) {
7292
- var cmpFields = vm.cmpFields;
7293
7266
  return function (value) {
7294
- if (value !== vm.cmpFields[name]) {
7295
- // storing the value in the underlying storage
7296
- cmpFields[name] = value;
7297
- componentValueMutated(vm, name);
7298
- }
7267
+ updateComponentValue(vm, name, value);
7299
7268
  };
7300
7269
  }
7301
7270
 
@@ -7312,7 +7281,7 @@ var LWC = (function (exports) {
7312
7281
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7313
7282
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7314
7283
 
7315
- var ro = new ReactiveObserver(function () {
7284
+ var ro = createReactiveObserver(function () {
7316
7285
  if (hasPendingConfig === false) {
7317
7286
  hasPendingConfig = true; // collect new config in the micro-task
7318
7287
 
@@ -7613,7 +7582,7 @@ var LWC = (function (exports) {
7613
7582
  }
7614
7583
  }
7615
7584
 
7616
- return reactiveMembrane.getReadOnlyProxy(obj);
7585
+ return getReadOnlyProxy(obj);
7617
7586
  }
7618
7587
  /*
7619
7588
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8294,7 +8263,7 @@ var LWC = (function (exports) {
8294
8263
 
8295
8264
  return ctor;
8296
8265
  }
8297
- /* version: 2.21.0 */
8266
+ /* version: 2.23.0 */
8298
8267
 
8299
8268
  /*
8300
8269
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8462,6 +8431,85 @@ var LWC = (function (exports) {
8462
8431
  */
8463
8432
 
8464
8433
 
8434
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8435
+ var createFragment;
8436
+
8437
+ if (SUPPORTS_TEMPLATE) {
8438
+ // Parse the fragment HTML string into DOM
8439
+ createFragment = function createFragment(html) {
8440
+ var template = document.createElement('template');
8441
+ template.innerHTML = html;
8442
+ return template.content.firstChild;
8443
+ };
8444
+ } else {
8445
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8446
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8447
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8448
+ // With other elements added from:
8449
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8450
+ // Using the test:
8451
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8452
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8453
+ var topLevelWrappingMap = {
8454
+ caption: ['table'],
8455
+ col: ['colgroup', 'table'],
8456
+ colgroup: ['table'],
8457
+ option: ['select'],
8458
+ tbody: ['table'],
8459
+ td: ['tr', 'tbody', 'table'],
8460
+ th: ['tr', 'tbody', 'table'],
8461
+ thead: ['table'],
8462
+ tfoot: ['table'],
8463
+ tr: ['tbody', 'table']
8464
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8465
+
8466
+ var getTagName = function getTagName(text) {
8467
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8468
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8469
+
8470
+
8471
+ createFragment = function createFragment(html) {
8472
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8473
+
8474
+ if (!isUndefined$1(wrapperTags)) {
8475
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8476
+ _step5;
8477
+
8478
+ try {
8479
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8480
+ var wrapperTag = _step5.value;
8481
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8482
+ }
8483
+ } catch (err) {
8484
+ _iterator5.e(err);
8485
+ } finally {
8486
+ _iterator5.f();
8487
+ }
8488
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8489
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8490
+
8491
+
8492
+ var doc = document.implementation.createHTMLDocument('');
8493
+ doc.body.innerHTML = html;
8494
+ var content = doc.body;
8495
+
8496
+ if (!isUndefined$1(wrapperTags)) {
8497
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8498
+ content = content.firstChild;
8499
+ }
8500
+ }
8501
+
8502
+ return content.firstChild;
8503
+ };
8504
+ }
8505
+ /*
8506
+ * Copyright (c) 2018, salesforce.com, inc.
8507
+ * All rights reserved.
8508
+ * SPDX-License-Identifier: MIT
8509
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8510
+ */
8511
+
8512
+
8465
8513
  var getCustomElement;
8466
8514
  var defineCustomElement;
8467
8515
  var HTMLElementConstructor;
@@ -8543,18 +8591,6 @@ var LWC = (function (exports) {
8543
8591
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8544
8592
  }
8545
8593
 
8546
- var hydrating = false;
8547
-
8548
- function setIsHydrating(value) {
8549
- hydrating = value;
8550
- }
8551
-
8552
- var ssr = false;
8553
-
8554
- function isHydrating() {
8555
- return hydrating;
8556
- }
8557
-
8558
8594
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8559
8595
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8560
8596
 
@@ -8562,10 +8598,6 @@ var LWC = (function (exports) {
8562
8598
  return node.cloneNode(deep);
8563
8599
  }
8564
8600
 
8565
- function createFragment(html) {
8566
- return document.createRange().createContextualFragment(html).firstChild;
8567
- }
8568
-
8569
8601
  function createElement$1(tagName, namespace) {
8570
8602
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8571
8603
  }
@@ -8591,15 +8623,11 @@ var LWC = (function (exports) {
8591
8623
  }
8592
8624
 
8593
8625
  function attachShadow(element, options) {
8594
- // `hydrating` will be true in two cases:
8626
+ // `shadowRoot` will be non-null in two cases:
8595
8627
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8596
8628
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
8597
- // root component with customeElement.define('c-app', Ctor)
8598
- //
8599
- // The second case can be treated as a failed hydration with nominal impact
8600
- // to performance. However, because <c-app> won't have a <template shadowroot>
8601
- // declarative child, `element.shadowRoot` is `null`.
8602
- if (hydrating && element.shadowRoot) {
8629
+ // root component with customElement.define('c-app', Ctor)
8630
+ if (!isNull(element.shadowRoot)) {
8603
8631
  return element.shadowRoot;
8604
8632
  }
8605
8633
 
@@ -8717,11 +8745,9 @@ var LWC = (function (exports) {
8717
8745
 
8718
8746
  var HTMLElementExported = HTMLElementConstructor;
8719
8747
  var renderer = {
8720
- ssr: ssr,
8721
8748
  isNativeShadowDefined: isNativeShadowDefined,
8722
8749
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8723
8750
  HTMLElementExported: HTMLElementExported,
8724
- isHydrating: isHydrating,
8725
8751
  insert: insert,
8726
8752
  remove: remove,
8727
8753
  cloneNode: cloneNode,
@@ -8790,8 +8816,8 @@ var LWC = (function (exports) {
8790
8816
  hydrated: true
8791
8817
  });
8792
8818
 
8793
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8794
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8819
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8820
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8795
8821
  key = _Object$entries2$_i[0],
8796
8822
  value = _Object$entries2$_i[1];
8797
8823
 
@@ -8823,13 +8849,8 @@ var LWC = (function (exports) {
8823
8849
  }
8824
8850
 
8825
8851
  try {
8826
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8827
- // and uses the same algo to create the stylesheets as in SSR.
8828
- setIsHydrating(true);
8829
8852
  var vm = createVMWithProps(element, Ctor, props);
8830
- hydrateRoot(vm); // set it back since now we finished hydration.
8831
-
8832
- setIsHydrating(false);
8853
+ hydrateRoot(vm);
8833
8854
  } catch (e) {
8834
8855
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8835
8856
  // with the client generated DOM.
@@ -8840,11 +8861,7 @@ var LWC = (function (exports) {
8840
8861
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8841
8862
 
8842
8863
  createVMWithProps(element, Ctor, props);
8843
- setIsHydrating(false);
8844
8864
  connectRootElement(element);
8845
- } finally {
8846
- // in case there's an error during recovery
8847
- setIsHydrating(false);
8848
8865
  }
8849
8866
  }
8850
8867
  /*
@@ -9123,7 +9140,7 @@ var LWC = (function (exports) {
9123
9140
  });
9124
9141
  freeze(LightningElement);
9125
9142
  seal(LightningElement.prototype);
9126
- /* version: 2.21.0 */
9143
+ /* version: 2.23.0 */
9127
9144
 
9128
9145
  exports.LightningElement = LightningElement;
9129
9146
  exports.__unstable__ProfilerControl = profilerControl;