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
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
302
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
303
303
  */
304
304
  // Increment whenever the LWC template compiler changes
305
- const LWC_VERSION = "2.21.0";
305
+ const LWC_VERSION = "2.23.0";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.21.0 */
307
+ /** version: 2.23.0 */
308
308
 
309
309
  /*
310
310
  * Copyright (c) 2018, salesforce.com, inc.
@@ -458,7 +458,7 @@ var LWC = (function (exports) {
458
458
  setFeatureFlag(name, value);
459
459
  }
460
460
  }
461
- /** version: 2.21.0 */
461
+ /** version: 2.23.0 */
462
462
 
463
463
  /*
464
464
  * Copyright (c) 2018, salesforce.com, inc.
@@ -690,18 +690,21 @@ var LWC = (function (exports) {
690
690
  ArrayPush$1.call(this.listeners, reactiveObservers);
691
691
  }
692
692
  }
693
-
694
- /*
695
- * Copyright (c) 2018, salesforce.com, inc.
696
- * All rights reserved.
697
- * SPDX-License-Identifier: MIT
698
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
699
- */
700
693
  function componentValueMutated(vm, key) {
701
- valueMutated(vm.component, key);
694
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
695
+ {
696
+ valueMutated(vm.component, key);
697
+ }
702
698
  }
703
699
  function componentValueObserved(vm, key) {
704
- valueObserved(vm.component, key);
700
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
701
+ {
702
+ valueObserved(vm.component, key);
703
+ }
704
+ }
705
+ function createReactiveObserver(callback) {
706
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
707
+ return new ReactiveObserver(callback) ;
705
708
  }
706
709
 
707
710
  /*
@@ -1260,6 +1263,14 @@ var LWC = (function (exports) {
1260
1263
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1261
1264
  }
1262
1265
 
1266
+ function updateComponentValue(vm, key, newValue) {
1267
+ const { cmpFields } = vm;
1268
+ if (newValue !== cmpFields[key]) {
1269
+ cmpFields[key] = newValue;
1270
+ componentValueMutated(vm, key);
1271
+ }
1272
+ }
1273
+
1263
1274
  /**
1264
1275
  * Copyright (C) 2017 salesforce.com, inc.
1265
1276
  */
@@ -1823,7 +1834,24 @@ var LWC = (function (exports) {
1823
1834
  * change or being removed.
1824
1835
  */
1825
1836
  function unwrap(value) {
1826
- return reactiveMembrane.unwrapProxy(value);
1837
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1838
+ return reactiveMembrane.unwrapProxy(value) ;
1839
+ }
1840
+ function getReadOnlyProxy(value) {
1841
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1842
+ // them from their parents. This applies to both the client and server.
1843
+ return reactiveMembrane.getReadOnlyProxy(value);
1844
+ }
1845
+ function getReactiveProxy(value) {
1846
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1847
+ return reactiveMembrane.getProxy(value) ;
1848
+ }
1849
+ // Making the component instance a live value when using Locker to support expandos.
1850
+ function markLockerLiveObject(obj) {
1851
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1852
+ {
1853
+ obj[lockerLivePropertyKey] = undefined;
1854
+ }
1827
1855
  }
1828
1856
 
1829
1857
  /*
@@ -1875,10 +1903,7 @@ var LWC = (function (exports) {
1875
1903
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1876
1904
  assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1877
1905
  }
1878
- if (newValue !== vm.cmpProps[propName]) {
1879
- vm.cmpProps[propName] = newValue;
1880
- componentValueMutated(vm, propName);
1881
- }
1906
+ updateComponentValue(vm, propName, newValue);
1882
1907
  return set.call(vm.elm, newValue);
1883
1908
  },
1884
1909
  };
@@ -1913,8 +1938,7 @@ var LWC = (function (exports) {
1913
1938
  vm.setHook = setHook;
1914
1939
  vm.getHook = getHook;
1915
1940
  }
1916
- // Making the component instance a live value when using Locker to support expandos.
1917
- this[lockerLivePropertyKey] = undefined;
1941
+ markLockerLiveObject(this);
1918
1942
  // Linking elm, shadow root and component with the VM.
1919
1943
  associateVM(component, vm);
1920
1944
  associateVM(elm, vm);
@@ -2174,15 +2198,51 @@ var LWC = (function (exports) {
2174
2198
  },
2175
2199
  set(newValue) {
2176
2200
  const vm = getAssociatedVM(this);
2177
- if (newValue !== vm.cmpFields[key]) {
2178
- vm.cmpFields[key] = newValue;
2179
- componentValueMutated(vm, key);
2180
- }
2201
+ updateComponentValue(vm, key, newValue);
2181
2202
  },
2182
2203
  enumerable: true,
2183
2204
  configurable: true,
2184
2205
  };
2185
2206
  }
2207
+ class AccessorReactiveObserver extends ReactiveObserver {
2208
+ constructor(vm, set) {
2209
+ super(() => {
2210
+ if (isFalse(this.debouncing)) {
2211
+ this.debouncing = true;
2212
+ addCallbackToNextTick(() => {
2213
+ if (isTrue(this.debouncing)) {
2214
+ const { value } = this;
2215
+ const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
2216
+ set.call(component, value);
2217
+ // de-bouncing after the call to the original setter to prevent
2218
+ // infinity loop if the setter itself is mutating things that
2219
+ // were accessed during the previous invocation.
2220
+ this.debouncing = false;
2221
+ if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2222
+ // immediate rehydration due to a setter driven mutation, otherwise
2223
+ // the component will get rendered on the second tick, which it is not
2224
+ // desirable.
2225
+ rerenderVM(vm);
2226
+ }
2227
+ }
2228
+ });
2229
+ }
2230
+ });
2231
+ this.debouncing = false;
2232
+ }
2233
+ reset(value) {
2234
+ super.reset();
2235
+ this.debouncing = false;
2236
+ if (arguments.length > 0) {
2237
+ this.value = value;
2238
+ }
2239
+ }
2240
+ }
2241
+ function createAccessorReactiveObserver(vm, set) {
2242
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2243
+ return new AccessorReactiveObserver(vm, set)
2244
+ ;
2245
+ }
2186
2246
 
2187
2247
  /*
2188
2248
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2231,50 +2291,6 @@ var LWC = (function (exports) {
2231
2291
  configurable: true
2232
2292
  };
2233
2293
  }
2234
- class AccessorReactiveObserver extends ReactiveObserver {
2235
- constructor(vm, set) {
2236
- super(() => {
2237
- if (isFalse(this.debouncing)) {
2238
- this.debouncing = true;
2239
- addCallbackToNextTick(() => {
2240
- if (isTrue(this.debouncing)) {
2241
- const {
2242
- value
2243
- } = this;
2244
- const {
2245
- isDirty: dirtyStateBeforeSetterCall,
2246
- component,
2247
- idx
2248
- } = vm;
2249
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2250
- // infinity loop if the setter itself is mutating things that
2251
- // were accessed during the previous invocation.
2252
-
2253
- this.debouncing = false;
2254
-
2255
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2256
- // immediate rehydration due to a setter driven mutation, otherwise
2257
- // the component will get rendered on the second tick, which it is not
2258
- // desirable.
2259
- rerenderVM(vm);
2260
- }
2261
- }
2262
- });
2263
- }
2264
- });
2265
- this.debouncing = false;
2266
- }
2267
-
2268
- reset(value) {
2269
- super.reset();
2270
- this.debouncing = false;
2271
-
2272
- if (arguments.length > 0) {
2273
- this.value = value;
2274
- }
2275
- }
2276
-
2277
- }
2278
2294
  function createPublicAccessorDescriptor(key, descriptor) {
2279
2295
  const {
2280
2296
  get,
@@ -2315,7 +2331,7 @@ var LWC = (function (exports) {
2315
2331
  let ro = vm.oar[key];
2316
2332
 
2317
2333
  if (isUndefined$1(ro)) {
2318
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2334
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
2319
2335
  } // every time we invoke this setter from outside (through this wrapper setter)
2320
2336
  // we should reset the value and then debounce just in case there is a pending
2321
2337
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2347,7 +2363,7 @@ var LWC = (function (exports) {
2347
2363
  */
2348
2364
  function track(target) {
2349
2365
  if (arguments.length === 1) {
2350
- return reactiveMembrane.getProxy(target);
2366
+ return getReactiveProxy(target);
2351
2367
  }
2352
2368
  if (process.env.NODE_ENV !== 'production') {
2353
2369
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2368,11 +2384,8 @@ var LWC = (function (exports) {
2368
2384
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2369
2385
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2370
2386
  }
2371
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2372
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2373
- vm.cmpFields[key] = reactiveOrAnyValue;
2374
- componentValueMutated(vm, key);
2375
- }
2387
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2388
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2376
2389
  },
2377
2390
  enumerable: true,
2378
2391
  configurable: true,
@@ -2411,10 +2424,7 @@ var LWC = (function (exports) {
2411
2424
  * letting the author to do the wrong thing, but it will keep our
2412
2425
  * system to be backward compatible.
2413
2426
  */
2414
- if (value !== vm.cmpFields[key]) {
2415
- vm.cmpFields[key] = value;
2416
- componentValueMutated(vm, key);
2417
- }
2427
+ updateComponentValue(vm, key, value);
2418
2428
  },
2419
2429
  enumerable: true,
2420
2430
  configurable: true,
@@ -2760,7 +2770,7 @@ var LWC = (function (exports) {
2760
2770
  fn = cachedSetterByKey[key] = function (newValue) {
2761
2771
  const vm = getAssociatedVM(this);
2762
2772
  const { setHook } = vm;
2763
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2773
+ newValue = getReadOnlyProxy(newValue);
2764
2774
  setHook(vm.component, key, newValue);
2765
2775
  };
2766
2776
  }
@@ -3503,13 +3513,13 @@ var LWC = (function (exports) {
3503
3513
  return owner;
3504
3514
  }
3505
3515
  function createStylesheet(vm, stylesheets) {
3506
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3516
+ const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
3507
3517
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3508
3518
  for (let i = 0; i < stylesheets.length; i++) {
3509
3519
  insertStylesheet(stylesheets[i]);
3510
3520
  }
3511
3521
  }
3512
- else if (ssr || vm.hydrated) {
3522
+ else if (vm.hydrated) {
3513
3523
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3514
3524
  // This works in the client, because the stylesheets are created, and cached in the VM
3515
3525
  // the first time the VM renders.
@@ -3810,7 +3820,7 @@ var LWC = (function (exports) {
3810
3820
  updateStaticChildren(c1, c2, parent, renderer);
3811
3821
  }
3812
3822
  }
3813
- function patch(n1, n2, renderer) {
3823
+ function patch(n1, n2, parent, renderer) {
3814
3824
  var _a, _b;
3815
3825
  if (n1 === n2) {
3816
3826
  return;
@@ -3839,7 +3849,7 @@ var LWC = (function (exports) {
3839
3849
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3840
3850
  break;
3841
3851
  case 3 /* VNodeType.CustomElement */:
3842
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3852
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3843
3853
  break;
3844
3854
  }
3845
3855
  }
@@ -3900,10 +3910,11 @@ var LWC = (function (exports) {
3900
3910
  const { sel, owner, data: { svg }, } = vnode;
3901
3911
  const { createElement } = renderer;
3902
3912
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3903
- const elm = createElement(sel, namespace);
3913
+ const elm = (vnode.elm = createElement(sel, namespace));
3904
3914
  linkNodeToShadow(elm, owner, renderer);
3905
- fallbackElmHook(elm, vnode, renderer);
3906
- vnode.elm = elm;
3915
+ applyStyleScoping(elm, owner, renderer);
3916
+ applyDomManual(elm, vnode);
3917
+ applyElementRestrictions(elm, vnode);
3907
3918
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3908
3919
  insertNode(elm, parent, anchor, renderer);
3909
3920
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3918,6 +3929,7 @@ var LWC = (function (exports) {
3918
3929
  const { cloneNode, isSyntheticShadowDefined } = renderer;
3919
3930
  const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3920
3931
  linkNodeToShadow(elm, owner, renderer);
3932
+ applyElementRestrictions(elm, vnode);
3921
3933
  // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3922
3934
  const { renderMode, shadowMode } = owner;
3923
3935
  if (isSyntheticShadowDefined) {
@@ -3925,10 +3937,6 @@ var LWC = (function (exports) {
3925
3937
  elm[KEY__SHADOW_STATIC] = true;
3926
3938
  }
3927
3939
  }
3928
- if (process.env.NODE_ENV !== 'production') {
3929
- const isLight = renderMode === 0 /* RenderMode.Light */;
3930
- patchElementWithRestrictions(elm, { isPortal: false, isLight });
3931
- }
3932
3940
  insertNode(elm, parent, anchor, renderer);
3933
3941
  }
3934
3942
  function mountCustomElement(vnode, parent, anchor, renderer) {
@@ -3945,9 +3953,10 @@ var LWC = (function (exports) {
3945
3953
  // the custom element from the registry is expecting an upgrade callback
3946
3954
  vm = createViewModelHook(elm, vnode, renderer);
3947
3955
  });
3948
- linkNodeToShadow(elm, owner, renderer);
3949
3956
  vnode.elm = elm;
3950
3957
  vnode.vm = vm;
3958
+ linkNodeToShadow(elm, owner, renderer);
3959
+ applyStyleScoping(elm, owner, renderer);
3951
3960
  if (vm) {
3952
3961
  allocateChildren(vnode, vm);
3953
3962
  }
@@ -3967,22 +3976,32 @@ var LWC = (function (exports) {
3967
3976
  appendVM(vm);
3968
3977
  }
3969
3978
  }
3970
- function patchCustomElement(n1, n2, renderer) {
3971
- const elm = (n2.elm = n1.elm);
3972
- const vm = (n2.vm = n1.vm);
3973
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3974
- if (!isUndefined$1(vm)) {
3975
- // in fallback mode, the allocation will always set children to
3976
- // empty and delegate the real allocation to the slot elements
3977
- allocateChildren(n2, vm);
3979
+ function patchCustomElement(n1, n2, parent, renderer) {
3980
+ if (n1.ctor !== n2.ctor) {
3981
+ // If the constructor, unmount the current component and mount a new one using the new
3982
+ // constructor.
3983
+ const anchor = renderer.nextSibling(n1.elm);
3984
+ unmount(n1, parent, renderer, true);
3985
+ mountCustomElement(n2, parent, anchor, renderer);
3978
3986
  }
3979
- // in fallback mode, the children will be always empty, so, nothing
3980
- // will happen, but in native, it does allocate the light dom
3981
- patchChildren(n1.children, n2.children, elm, renderer);
3982
- if (!isUndefined$1(vm)) {
3983
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3984
- // this is important to preserve the top to bottom synchronous rendering phase.
3985
- rerenderVM(vm);
3987
+ else {
3988
+ // Otherwise patch the existing component with new props/attrs/etc.
3989
+ const elm = (n2.elm = n1.elm);
3990
+ const vm = (n2.vm = n1.vm);
3991
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3992
+ if (!isUndefined$1(vm)) {
3993
+ // in fallback mode, the allocation will always set children to
3994
+ // empty and delegate the real allocation to the slot elements
3995
+ allocateChildren(n2, vm);
3996
+ }
3997
+ // in fallback mode, the children will be always empty, so, nothing
3998
+ // will happen, but in native, it does allocate the light dom
3999
+ patchChildren(n1.children, n2.children, elm, renderer);
4000
+ if (!isUndefined$1(vm)) {
4001
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4002
+ // this is important to preserve the top to bottom synchronous rendering phase.
4003
+ rerenderVM(vm);
4004
+ }
3986
4005
  }
3987
4006
  }
3988
4007
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
@@ -4031,22 +4050,6 @@ var LWC = (function (exports) {
4031
4050
  function isVNode(vnode) {
4032
4051
  return vnode != null;
4033
4052
  }
4034
- function observeElementChildNodes(elm) {
4035
- elm.$domManual$ = true;
4036
- }
4037
- function setElementShadowToken(elm, token) {
4038
- elm.$shadowToken$ = token;
4039
- }
4040
- // Set the scope token class for *.scoped.css styles
4041
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
4042
- const token = getScopeTokenClass(owner);
4043
- if (!isNull(token)) {
4044
- const { getClassList } = renderer;
4045
- // TODO [#2762]: this dot notation with add is probably problematic
4046
- // probably we should have a renderer api for just the add operation
4047
- getClassList(elm).add(token);
4048
- }
4049
- }
4050
4053
  function linkNodeToShadow(elm, owner, renderer) {
4051
4054
  const { renderRoot, renderMode, shadowMode } = owner;
4052
4055
  const { isSyntheticShadowDefined } = renderer;
@@ -4099,31 +4102,37 @@ var LWC = (function (exports) {
4099
4102
  patchAttributes(oldVnode, vnode, renderer);
4100
4103
  patchProps(oldVnode, vnode, renderer);
4101
4104
  }
4102
- function fallbackElmHook(elm, vnode, renderer) {
4103
- const { owner } = vnode;
4104
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4105
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4106
- const { data: { context }, } = vnode;
4107
- const { stylesheetToken } = owner.context;
4108
- if (!isUndefined$1(context) &&
4109
- !isUndefined$1(context.lwc) &&
4110
- context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
4111
- // this element will now accept any manual content inserted into it
4112
- observeElementChildNodes(elm);
4113
- }
4114
- if (!isUndefined$1(stylesheetToken)) {
4115
- // when running in synthetic shadow mode, we need to set the shadowToken value
4116
- // into each element from the template, so they can be styled accordingly.
4117
- setElementShadowToken(elm, stylesheetToken);
4118
- }
4105
+ function applyStyleScoping(elm, owner, renderer) {
4106
+ // Set the class name for `*.scoped.css` style scoping.
4107
+ const scopeToken = getScopeTokenClass(owner);
4108
+ if (!isNull(scopeToken)) {
4109
+ const { getClassList } = renderer;
4110
+ // TODO [#2762]: this dot notation with add is probably problematic
4111
+ // probably we should have a renderer api for just the add operation
4112
+ getClassList(elm).add(scopeToken);
4113
+ }
4114
+ // Set property element for synthetic shadow DOM style scoping.
4115
+ const { stylesheetToken: syntheticToken } = owner.context;
4116
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4117
+ elm.$shadowToken$ = syntheticToken;
4118
+ }
4119
+ }
4120
+ function applyDomManual(elm, vnode) {
4121
+ var _a;
4122
+ const { owner, data: { context }, } = vnode;
4123
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
4124
+ elm.$domManual$ = true;
4119
4125
  }
4126
+ }
4127
+ function applyElementRestrictions(elm, vnode) {
4128
+ var _a, _b;
4120
4129
  if (process.env.NODE_ENV !== 'production') {
4121
- const { data: { context }, } = vnode;
4122
- const isPortal = !isUndefined$1(context) &&
4123
- !isUndefined$1(context.lwc) &&
4124
- context.lwc.dom === "manual" /* LwcDomMode.Manual */;
4125
- const isLight = owner.renderMode === 0 /* RenderMode.Light */;
4126
- patchElementWithRestrictions(elm, { isPortal, isLight });
4130
+ const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4131
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4132
+ patchElementWithRestrictions(elm, {
4133
+ isPortal,
4134
+ isLight,
4135
+ });
4127
4136
  }
4128
4137
  }
4129
4138
  function allocateChildren(vnode, vm) {
@@ -4158,15 +4167,6 @@ var LWC = (function (exports) {
4158
4167
  return vm;
4159
4168
  }
4160
4169
  const { sel, mode, ctor, owner } = vnode;
4161
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4162
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4163
- const { stylesheetToken } = owner.context;
4164
- // when running in synthetic shadow mode, we need to set the shadowToken value
4165
- // into each element from the template, so they can be styled accordingly.
4166
- if (!isUndefined$1(stylesheetToken)) {
4167
- setElementShadowToken(elm, stylesheetToken);
4168
- }
4169
- }
4170
4170
  vm = createVM(elm, ctor, renderer, {
4171
4171
  mode,
4172
4172
  owner,
@@ -4271,25 +4271,25 @@ var LWC = (function (exports) {
4271
4271
  newEndVnode = newCh[--newEndIdx];
4272
4272
  }
4273
4273
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
4274
- patch(oldStartVnode, newStartVnode, renderer);
4274
+ patch(oldStartVnode, newStartVnode, parent, renderer);
4275
4275
  oldStartVnode = oldCh[++oldStartIdx];
4276
4276
  newStartVnode = newCh[++newStartIdx];
4277
4277
  }
4278
4278
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
4279
- patch(oldEndVnode, newEndVnode, renderer);
4279
+ patch(oldEndVnode, newEndVnode, parent, renderer);
4280
4280
  oldEndVnode = oldCh[--oldEndIdx];
4281
4281
  newEndVnode = newCh[--newEndIdx];
4282
4282
  }
4283
4283
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
4284
4284
  // Vnode moved right
4285
- patch(oldStartVnode, newEndVnode, renderer);
4285
+ patch(oldStartVnode, newEndVnode, parent, renderer);
4286
4286
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4287
4287
  oldStartVnode = oldCh[++oldStartIdx];
4288
4288
  newEndVnode = newCh[--newEndIdx];
4289
4289
  }
4290
4290
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
4291
4291
  // Vnode moved left
4292
- patch(oldEndVnode, newStartVnode, renderer);
4292
+ patch(oldEndVnode, newStartVnode, parent, renderer);
4293
4293
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4294
4294
  oldEndVnode = oldCh[--oldEndIdx];
4295
4295
  newStartVnode = newCh[++newStartIdx];
@@ -4312,7 +4312,7 @@ var LWC = (function (exports) {
4312
4312
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4313
4313
  }
4314
4314
  else {
4315
- patch(elmToMove, newStartVnode, renderer);
4315
+ patch(elmToMove, newStartVnode, parent, renderer);
4316
4316
  // Delete the old child, but copy the array since it is read-only.
4317
4317
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4318
4318
  // so we only care about the `oldCh` object inside this function.
@@ -4372,7 +4372,7 @@ var LWC = (function (exports) {
4372
4372
  if (isVNode(n1)) {
4373
4373
  if (isVNode(n2)) {
4374
4374
  // both vnodes are equivalent, and we just need to patch them
4375
- patch(n1, n2, renderer);
4375
+ patch(n1, n2, parent, renderer);
4376
4376
  anchor = n2.elm;
4377
4377
  }
4378
4378
  else {
@@ -4706,13 +4706,6 @@ var LWC = (function (exports) {
4706
4706
  }
4707
4707
  return url;
4708
4708
  }
4709
- /**
4710
- * Map to store an index value assigned to any dynamic component reference ingested
4711
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4712
- * component reference to avoid diffing algo mismatches.
4713
- */
4714
- const DynamicImportedComponentMap = new Map();
4715
- let dynamicImportedComponentCounter = 0;
4716
4709
  /**
4717
4710
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4718
4711
  */
@@ -4729,18 +4722,7 @@ var LWC = (function (exports) {
4729
4722
  if (!isComponentConstructor(Ctor)) {
4730
4723
  throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
4731
4724
  }
4732
- let idx = DynamicImportedComponentMap.get(Ctor);
4733
- if (isUndefined$1(idx)) {
4734
- idx = dynamicImportedComponentCounter++;
4735
- DynamicImportedComponentMap.set(Ctor, idx);
4736
- }
4737
- // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4738
- // to identify different constructors as vnodes with different keys to avoid reusing the
4739
- // element used for previous constructors.
4740
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4741
- // hoisting optimization.
4742
- const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
4743
- return c(sel, Ctor, newData, children);
4725
+ return c(sel, Ctor, data, children);
4744
4726
  }
4745
4727
  /**
4746
4728
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5216,7 +5198,7 @@ var LWC = (function (exports) {
5216
5198
  return signedTemplateMap.get(Ctor);
5217
5199
  }
5218
5200
  function getTemplateReactiveObserver(vm) {
5219
- return new ReactiveObserver(() => {
5201
+ return createReactiveObserver(() => {
5220
5202
  const { isDirty } = vm;
5221
5203
  if (isFalse(isDirty)) {
5222
5204
  markComponentAsDirty(vm);
@@ -5634,16 +5616,9 @@ var LWC = (function (exports) {
5634
5616
  const {
5635
5617
  def: {
5636
5618
  renderedCallback
5637
- },
5638
- renderer: {
5639
- ssr
5640
5619
  }
5641
5620
  } = vm;
5642
5621
 
5643
- if (isTrue(ssr)) {
5644
- return;
5645
- }
5646
-
5647
5622
  const {
5648
5623
  rendered
5649
5624
  } = Services;
@@ -5893,13 +5868,7 @@ var LWC = (function (exports) {
5893
5868
  vm.velements = EmptyArray;
5894
5869
  }
5895
5870
  function scheduleRehydration(vm) {
5896
- const {
5897
- renderer: {
5898
- ssr
5899
- }
5900
- } = vm;
5901
-
5902
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5871
+ if (isTrue(vm.isScheduled)) {
5903
5872
  return;
5904
5873
  }
5905
5874
 
@@ -6006,15 +5975,8 @@ var LWC = (function (exports) {
6006
5975
  }
6007
5976
 
6008
5977
  function createFieldDataCallback(vm, name) {
6009
- const {
6010
- cmpFields
6011
- } = vm;
6012
5978
  return value => {
6013
- if (value !== vm.cmpFields[name]) {
6014
- // storing the value in the underlying storage
6015
- cmpFields[name] = value;
6016
- componentValueMutated(vm, name);
6017
- }
5979
+ updateComponentValue(vm, name, value);
6018
5980
  };
6019
5981
  }
6020
5982
 
@@ -6031,7 +5993,7 @@ var LWC = (function (exports) {
6031
5993
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6032
5994
  let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
6033
5995
 
6034
- const ro = new ReactiveObserver(() => {
5996
+ const ro = createReactiveObserver(() => {
6035
5997
  if (hasPendingConfig === false) {
6036
5998
  hasPendingConfig = true; // collect new config in the micro-task
6037
5999
 
@@ -6327,7 +6289,7 @@ var LWC = (function (exports) {
6327
6289
  assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6328
6290
  }
6329
6291
  }
6330
- return reactiveMembrane.getReadOnlyProxy(obj);
6292
+ return getReadOnlyProxy(obj);
6331
6293
  }
6332
6294
 
6333
6295
  /*
@@ -6838,7 +6800,7 @@ var LWC = (function (exports) {
6838
6800
  }
6839
6801
  return ctor;
6840
6802
  }
6841
- /* version: 2.21.0 */
6803
+ /* version: 2.23.0 */
6842
6804
 
6843
6805
  /*
6844
6806
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6982,6 +6944,69 @@ var LWC = (function (exports) {
6982
6944
  }
6983
6945
  }
6984
6946
 
6947
+ /*
6948
+ * Copyright (c) 2018, salesforce.com, inc.
6949
+ * All rights reserved.
6950
+ * SPDX-License-Identifier: MIT
6951
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6952
+ */
6953
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6954
+ let createFragment;
6955
+ if (SUPPORTS_TEMPLATE) {
6956
+ // Parse the fragment HTML string into DOM
6957
+ createFragment = function (html) {
6958
+ const template = document.createElement('template');
6959
+ template.innerHTML = html;
6960
+ return template.content.firstChild;
6961
+ };
6962
+ }
6963
+ else {
6964
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6965
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6966
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6967
+ // With other elements added from:
6968
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6969
+ // Using the test:
6970
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6971
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6972
+ const topLevelWrappingMap = {
6973
+ caption: ['table'],
6974
+ col: ['colgroup', 'table'],
6975
+ colgroup: ['table'],
6976
+ option: ['select'],
6977
+ tbody: ['table'],
6978
+ td: ['tr', 'tbody', 'table'],
6979
+ th: ['tr', 'tbody', 'table'],
6980
+ thead: ['table'],
6981
+ tfoot: ['table'],
6982
+ tr: ['tbody', 'table'],
6983
+ };
6984
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6985
+ const getTagName = function (text) {
6986
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6987
+ };
6988
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6989
+ createFragment = function (html) {
6990
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
6991
+ if (!isUndefined$1(wrapperTags)) {
6992
+ for (const wrapperTag of wrapperTags) {
6993
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
6994
+ }
6995
+ }
6996
+ // For IE11, the document title must not be undefined, but it can be an empty string
6997
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6998
+ const doc = document.implementation.createHTMLDocument('');
6999
+ doc.body.innerHTML = html;
7000
+ let content = doc.body;
7001
+ if (!isUndefined$1(wrapperTags)) {
7002
+ for (let i = 0; i < wrapperTags.length; i++) {
7003
+ content = content.firstChild;
7004
+ }
7005
+ }
7006
+ return content.firstChild;
7007
+ };
7008
+ }
7009
+
6985
7010
  /*
6986
7011
  * Copyright (c) 2018, salesforce.com, inc.
6987
7012
  * All rights reserved.
@@ -7047,22 +7072,11 @@ var LWC = (function (exports) {
7047
7072
  };
7048
7073
  HTMLElementConstructor.prototype = HTMLElement.prototype;
7049
7074
  }
7050
- let hydrating = false;
7051
- function setIsHydrating(value) {
7052
- hydrating = value;
7053
- }
7054
- const ssr = false;
7055
- function isHydrating() {
7056
- return hydrating;
7057
- }
7058
7075
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
7059
7076
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
7060
7077
  function cloneNode(node, deep) {
7061
7078
  return node.cloneNode(deep);
7062
7079
  }
7063
- function createFragment(html) {
7064
- return document.createRange().createContextualFragment(html).firstChild;
7065
- }
7066
7080
  function createElement$1(tagName, namespace) {
7067
7081
  return isUndefined$1(namespace)
7068
7082
  ? document.createElement(tagName)
@@ -7084,15 +7098,11 @@ var LWC = (function (exports) {
7084
7098
  return node.nextSibling;
7085
7099
  }
7086
7100
  function attachShadow(element, options) {
7087
- // `hydrating` will be true in two cases:
7101
+ // `shadowRoot` will be non-null in two cases:
7088
7102
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
7089
7103
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
7090
- // root component with customeElement.define('c-app', Ctor)
7091
- //
7092
- // The second case can be treated as a failed hydration with nominal impact
7093
- // to performance. However, because <c-app> won't have a <template shadowroot>
7094
- // declarative child, `element.shadowRoot` is `null`.
7095
- if (hydrating && element.shadowRoot) {
7104
+ // root component with customElement.define('c-app', Ctor)
7105
+ if (!isNull(element.shadowRoot)) {
7096
7106
  return element.shadowRoot;
7097
7107
  }
7098
7108
  return element.attachShadow(options);
@@ -7188,11 +7198,9 @@ var LWC = (function (exports) {
7188
7198
  }
7189
7199
  const HTMLElementExported = HTMLElementConstructor;
7190
7200
  const renderer = {
7191
- ssr,
7192
7201
  isNativeShadowDefined,
7193
7202
  isSyntheticShadowDefined,
7194
7203
  HTMLElementExported,
7195
- isHydrating,
7196
7204
  insert,
7197
7205
  remove,
7198
7206
  cloneNode,
@@ -7278,13 +7286,8 @@ var LWC = (function (exports) {
7278
7286
  return;
7279
7287
  }
7280
7288
  try {
7281
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7282
- // and uses the same algo to create the stylesheets as in SSR.
7283
- setIsHydrating(true);
7284
7289
  const vm = createVMWithProps(element, Ctor, props);
7285
7290
  hydrateRoot(vm);
7286
- // set it back since now we finished hydration.
7287
- setIsHydrating(false);
7288
7291
  }
7289
7292
  catch (e) {
7290
7293
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
@@ -7295,13 +7298,8 @@ var LWC = (function (exports) {
7295
7298
  resetShadowRootAndLightDom(element, Ctor);
7296
7299
  // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
7297
7300
  createVMWithProps(element, Ctor, props);
7298
- setIsHydrating(false);
7299
7301
  connectRootElement(element);
7300
7302
  }
7301
- finally {
7302
- // in case there's an error during recovery
7303
- setIsHydrating(false);
7304
- }
7305
7303
  }
7306
7304
 
7307
7305
  /*
@@ -7526,7 +7524,7 @@ var LWC = (function (exports) {
7526
7524
  });
7527
7525
  freeze(LightningElement);
7528
7526
  seal(LightningElement.prototype);
7529
- /* version: 2.21.0 */
7527
+ /* version: 2.23.0 */
7530
7528
 
7531
7529
  exports.LightningElement = LightningElement;
7532
7530
  exports.__unstable__ProfilerControl = profilerControl;