lwc 2.20.4 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +181 -127
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +181 -127
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +168 -115
  5. package/dist/engine-dom/iife/es5/engine-dom.js +226 -147
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +201 -119
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +181 -127
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +168 -115
  11. package/dist/engine-dom/umd/es5/engine-dom.js +226 -147
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +201 -119
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +89 -318
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +89 -318
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -415,9 +415,9 @@ function htmlEscape(str, attrMode = false) {
415
415
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
416
416
  */
417
417
  // Increment whenever the LWC template compiler changes
418
- const LWC_VERSION = "2.20.4";
418
+ const LWC_VERSION = "2.22.0";
419
419
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
420
- /** version: 2.20.4 */
420
+ /** version: 2.22.0 */
421
421
 
422
422
  /*
423
423
  * Copyright (c) 2020, salesforce.com, inc.
@@ -526,7 +526,7 @@ function setFeatureFlagForTest(name, value) {
526
526
  setFeatureFlag(name, value);
527
527
  }
528
528
  }
529
- /** version: 2.20.4 */
529
+ /** version: 2.22.0 */
530
530
 
531
531
  /* proxy-compat-disable */
532
532
 
@@ -554,40 +554,9 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
554
554
  }));
555
555
  });
556
556
  }
557
-
558
- /*
559
- * Copyright (c) 2018, salesforce.com, inc.
560
- * All rights reserved.
561
- * SPDX-License-Identifier: MIT
562
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
563
- */
564
- let nextTickCallbackQueue = [];
565
557
  const SPACE_CHAR = 32;
566
558
  const EmptyObject = seal(create(null));
567
559
  const EmptyArray = seal([]);
568
- function flushCallbackQueue() {
569
- if (process.env.NODE_ENV !== 'production') {
570
- if (nextTickCallbackQueue.length === 0) {
571
- throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);
572
- }
573
- }
574
- const callbacks = nextTickCallbackQueue;
575
- nextTickCallbackQueue = []; // reset to a new queue
576
- for (let i = 0, len = callbacks.length; i < len; i += 1) {
577
- callbacks[i]();
578
- }
579
- }
580
- function addCallbackToNextTick(callback) {
581
- if (process.env.NODE_ENV !== 'production') {
582
- if (!isFunction$1(callback)) {
583
- throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);
584
- }
585
- }
586
- if (nextTickCallbackQueue.length === 0) {
587
- Promise.resolve().then(flushCallbackQueue);
588
- }
589
- ArrayPush$1.call(nextTickCallbackQueue, callback);
590
- }
591
560
  function guid() {
592
561
  function s4() {
593
562
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -616,16 +585,6 @@ function flattenStylesheets(stylesheets) {
616
585
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
617
586
  */
618
587
  const TargetToReactiveRecordMap = new WeakMap();
619
- function getReactiveRecord(target) {
620
- let reactiveRecord = TargetToReactiveRecordMap.get(target);
621
- if (isUndefined$1(reactiveRecord)) {
622
- const newRecord = create(null);
623
- reactiveRecord = newRecord;
624
- TargetToReactiveRecordMap.set(target, newRecord);
625
- }
626
- return reactiveRecord;
627
- }
628
- let currentReactiveObserver = null;
629
588
  function valueMutated(target, key) {
630
589
  const reactiveRecord = TargetToReactiveRecordMap.get(target);
631
590
  if (!isUndefined$1(reactiveRecord)) {
@@ -640,71 +599,9 @@ function valueMutated(target, key) {
640
599
  }
641
600
  function valueObserved(target, key) {
642
601
  // We should determine if an active Observing Record is present to track mutations.
643
- if (currentReactiveObserver === null) {
602
+ {
644
603
  return;
645
604
  }
646
- const ro = currentReactiveObserver;
647
- const reactiveRecord = getReactiveRecord(target);
648
- let reactiveObservers = reactiveRecord[key];
649
- if (isUndefined$1(reactiveObservers)) {
650
- reactiveObservers = [];
651
- reactiveRecord[key] = reactiveObservers;
652
- }
653
- else if (reactiveObservers[0] === ro) {
654
- return; // perf optimization considering that most subscriptions will come from the same record
655
- }
656
- if (ArrayIndexOf.call(reactiveObservers, ro) === -1) {
657
- ro.link(reactiveObservers);
658
- }
659
- }
660
- class ReactiveObserver {
661
- constructor(callback) {
662
- this.listeners = [];
663
- this.callback = callback;
664
- }
665
- observe(job) {
666
- const inceptionReactiveRecord = currentReactiveObserver;
667
- currentReactiveObserver = this;
668
- let error;
669
- try {
670
- job();
671
- }
672
- catch (e) {
673
- error = Object(e);
674
- }
675
- finally {
676
- currentReactiveObserver = inceptionReactiveRecord;
677
- if (error !== undefined) {
678
- throw error; // eslint-disable-line no-unsafe-finally
679
- }
680
- }
681
- }
682
- /**
683
- * This method is responsible for disconnecting the Reactive Observer
684
- * from any Reactive Record that has a reference to it, to prevent future
685
- * notifications about previously recorded access.
686
- */
687
- reset() {
688
- const { listeners } = this;
689
- const len = listeners.length;
690
- if (len > 0) {
691
- for (let i = 0; i < len; i += 1) {
692
- const set = listeners[i];
693
- const pos = ArrayIndexOf.call(listeners[i], this);
694
- ArraySplice.call(set, pos, 1);
695
- }
696
- listeners.length = 0;
697
- }
698
- }
699
- // friend methods
700
- notify() {
701
- this.callback.call(undefined, this);
702
- }
703
- link(reactiveObservers) {
704
- ArrayPush$1.call(reactiveObservers, this);
705
- // we keep track of observing records where the observing record was added to so we can do some clean up later on
706
- ArrayPush$1.call(this.listeners, reactiveObservers);
707
- }
708
605
  }
709
606
 
710
607
  /*
@@ -713,11 +610,16 @@ class ReactiveObserver {
713
610
  * SPDX-License-Identifier: MIT
714
611
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
715
612
  */
716
- function componentValueMutated(vm, key) {
717
- valueMutated(vm.component, key);
718
- }
719
- function componentValueObserved(vm, key) {
720
- valueObserved(vm.component, key);
613
+ const DUMMY_REACTIVE_OBSERVER = {
614
+ observe(job) {
615
+ job();
616
+ },
617
+ reset() { },
618
+ link() { },
619
+ };
620
+ function createReactiveObserver(callback) {
621
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
622
+ return DUMMY_REACTIVE_OBSERVER;
721
623
  }
722
624
 
723
625
  /*
@@ -1836,7 +1738,17 @@ const reactiveMembrane = new ObservableMembrane({
1836
1738
  * change or being removed.
1837
1739
  */
1838
1740
  function unwrap(value) {
1839
- return reactiveMembrane.unwrapProxy(value);
1741
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1742
+ return value;
1743
+ }
1744
+ function getReadOnlyProxy(value) {
1745
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1746
+ // them from their parents. This applies to both the client and server.
1747
+ return reactiveMembrane.getReadOnlyProxy(value);
1748
+ }
1749
+ function getReactiveProxy(value) {
1750
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1751
+ return value;
1840
1752
  }
1841
1753
 
1842
1754
  /*
@@ -1876,7 +1788,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1876
1788
  }
1877
1789
  return;
1878
1790
  }
1879
- componentValueObserved(vm, propName);
1880
1791
  return get.call(vm.elm);
1881
1792
  },
1882
1793
  set(newValue) {
@@ -1890,7 +1801,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1890
1801
  }
1891
1802
  if (newValue !== vm.cmpProps[propName]) {
1892
1803
  vm.cmpProps[propName] = newValue;
1893
- componentValueMutated(vm, propName);
1894
1804
  }
1895
1805
  return set.call(vm.elm, newValue);
1896
1806
  },
@@ -1926,8 +1836,6 @@ const LightningElement = function () {
1926
1836
  vm.setHook = setHook;
1927
1837
  vm.getHook = getHook;
1928
1838
  }
1929
- // Making the component instance a live value when using Locker to support expandos.
1930
- this[lockerLivePropertyKey] = undefined;
1931
1839
  // Linking elm, shadow root and component with the VM.
1932
1840
  associateVM(component, vm);
1933
1841
  associateVM(elm, vm);
@@ -2182,14 +2090,12 @@ function createObservedFieldPropertyDescriptor(key) {
2182
2090
  return {
2183
2091
  get() {
2184
2092
  const vm = getAssociatedVM(this);
2185
- componentValueObserved(vm, key);
2186
2093
  return vm.cmpFields[key];
2187
2094
  },
2188
2095
  set(newValue) {
2189
2096
  const vm = getAssociatedVM(this);
2190
2097
  if (newValue !== vm.cmpFields[key]) {
2191
2098
  vm.cmpFields[key] = newValue;
2192
- componentValueMutated(vm, key);
2193
2099
  }
2194
2100
  },
2195
2101
  enumerable: true,
@@ -2197,6 +2103,24 @@ function createObservedFieldPropertyDescriptor(key) {
2197
2103
  };
2198
2104
  }
2199
2105
 
2106
+ /*
2107
+ * Copyright (c) 2018, salesforce.com, inc.
2108
+ * All rights reserved.
2109
+ * SPDX-License-Identifier: MIT
2110
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2111
+ */
2112
+ const DUMMY_ACCESSOR_REACTIVE_OBSERVER = {
2113
+ observe(job) {
2114
+ job();
2115
+ },
2116
+ reset() { },
2117
+ link() { },
2118
+ };
2119
+ function createAccessorReactiveObserver(vm, set) {
2120
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2121
+ return DUMMY_ACCESSOR_REACTIVE_OBSERVER;
2122
+ }
2123
+
2200
2124
  /*
2201
2125
  * Copyright (c) 2018, salesforce.com, inc.
2202
2126
  * All rights reserved.
@@ -2222,8 +2146,6 @@ function createPublicPropertyDescriptor(key) {
2222
2146
 
2223
2147
  return;
2224
2148
  }
2225
-
2226
- componentValueObserved(vm, key);
2227
2149
  return vm.cmpProps[key];
2228
2150
  },
2229
2151
 
@@ -2237,57 +2159,12 @@ function createPublicPropertyDescriptor(key) {
2237
2159
  }
2238
2160
 
2239
2161
  vm.cmpProps[key] = newValue;
2240
- componentValueMutated(vm, key);
2241
2162
  },
2242
2163
 
2243
2164
  enumerable: true,
2244
2165
  configurable: true
2245
2166
  };
2246
2167
  }
2247
- class AccessorReactiveObserver extends ReactiveObserver {
2248
- constructor(vm, set) {
2249
- super(() => {
2250
- if (isFalse(this.debouncing)) {
2251
- this.debouncing = true;
2252
- addCallbackToNextTick(() => {
2253
- if (isTrue(this.debouncing)) {
2254
- const {
2255
- value
2256
- } = this;
2257
- const {
2258
- isDirty: dirtyStateBeforeSetterCall,
2259
- component,
2260
- idx
2261
- } = vm;
2262
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2263
- // infinity loop if the setter itself is mutating things that
2264
- // were accessed during the previous invocation.
2265
-
2266
- this.debouncing = false;
2267
-
2268
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2269
- // immediate rehydration due to a setter driven mutation, otherwise
2270
- // the component will get rendered on the second tick, which it is not
2271
- // desirable.
2272
- rerenderVM(vm);
2273
- }
2274
- }
2275
- });
2276
- }
2277
- });
2278
- this.debouncing = false;
2279
- }
2280
-
2281
- reset(value) {
2282
- super.reset();
2283
- this.debouncing = false;
2284
-
2285
- if (arguments.length > 0) {
2286
- this.value = value;
2287
- }
2288
- }
2289
-
2290
- }
2291
2168
  function createPublicAccessorDescriptor(key, descriptor) {
2292
2169
  const {
2293
2170
  get,
@@ -2328,7 +2205,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2328
2205
  let ro = vm.oar[key];
2329
2206
 
2330
2207
  if (isUndefined$1(ro)) {
2331
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2208
+ ro = vm.oar[key] = createAccessorReactiveObserver();
2332
2209
  } // every time we invoke this setter from outside (through this wrapper setter)
2333
2210
  // we should reset the value and then debounce just in case there is a pending
2334
2211
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2360,7 +2237,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2360
2237
  */
2361
2238
  function track(target) {
2362
2239
  if (arguments.length === 1) {
2363
- return reactiveMembrane.getProxy(target);
2240
+ return getReactiveProxy(target);
2364
2241
  }
2365
2242
  if (process.env.NODE_ENV !== 'production') {
2366
2243
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2371,7 +2248,6 @@ function internalTrackDecorator(key) {
2371
2248
  return {
2372
2249
  get() {
2373
2250
  const vm = getAssociatedVM(this);
2374
- componentValueObserved(vm, key);
2375
2251
  return vm.cmpFields[key];
2376
2252
  },
2377
2253
  set(newValue) {
@@ -2381,10 +2257,9 @@ function internalTrackDecorator(key) {
2381
2257
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2382
2258
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2383
2259
  }
2384
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2260
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2385
2261
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2386
2262
  vm.cmpFields[key] = reactiveOrAnyValue;
2387
- componentValueMutated(vm, key);
2388
2263
  }
2389
2264
  },
2390
2265
  enumerable: true,
@@ -2413,7 +2288,6 @@ function internalWireFieldDecorator(key) {
2413
2288
  return {
2414
2289
  get() {
2415
2290
  const vm = getAssociatedVM(this);
2416
- componentValueObserved(vm, key);
2417
2291
  return vm.cmpFields[key];
2418
2292
  },
2419
2293
  set(value) {
@@ -2426,7 +2300,6 @@ function internalWireFieldDecorator(key) {
2426
2300
  */
2427
2301
  if (value !== vm.cmpFields[key]) {
2428
2302
  vm.cmpFields[key] = value;
2429
- componentValueMutated(vm, key);
2430
2303
  }
2431
2304
  },
2432
2305
  enumerable: true,
@@ -2773,7 +2646,7 @@ function createSetter(key) {
2773
2646
  fn = cachedSetterByKey[key] = function (newValue) {
2774
2647
  const vm = getAssociatedVM(this);
2775
2648
  const { setHook } = vm;
2776
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2649
+ newValue = getReadOnlyProxy(newValue);
2777
2650
  setHook(vm.component, key, newValue);
2778
2651
  };
2779
2652
  }
@@ -3792,10 +3665,11 @@ function mountElement(vnode, parent, anchor, renderer) {
3792
3665
  const { sel, owner, data: { svg }, } = vnode;
3793
3666
  const { createElement } = renderer;
3794
3667
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3795
- const elm = createElement(sel, namespace);
3668
+ const elm = (vnode.elm = createElement(sel, namespace));
3796
3669
  linkNodeToShadow(elm, owner, renderer);
3797
- fallbackElmHook(elm, vnode, renderer);
3798
- vnode.elm = elm;
3670
+ applyStyleScoping(elm, owner, renderer);
3671
+ applyDomManual(elm, vnode);
3672
+ applyElementRestrictions(elm, vnode);
3799
3673
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3800
3674
  insertNode(elm, parent, anchor, renderer);
3801
3675
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3810,6 +3684,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
3810
3684
  const { cloneNode, isSyntheticShadowDefined } = renderer;
3811
3685
  const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3812
3686
  linkNodeToShadow(elm, owner, renderer);
3687
+ applyElementRestrictions(elm, vnode);
3813
3688
  // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3814
3689
  const { renderMode, shadowMode } = owner;
3815
3690
  if (isSyntheticShadowDefined) {
@@ -3817,10 +3692,6 @@ function mountStatic(vnode, parent, anchor, renderer) {
3817
3692
  elm[KEY__SHADOW_STATIC] = true;
3818
3693
  }
3819
3694
  }
3820
- if (process.env.NODE_ENV !== 'production') {
3821
- const isLight = renderMode === 0 /* RenderMode.Light */;
3822
- patchElementWithRestrictions(elm, { isPortal: false, isLight });
3823
- }
3824
3695
  insertNode(elm, parent, anchor, renderer);
3825
3696
  }
3826
3697
  function mountCustomElement(vnode, parent, anchor, renderer) {
@@ -3837,9 +3708,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3837
3708
  // the custom element from the registry is expecting an upgrade callback
3838
3709
  vm = createViewModelHook(elm, vnode, renderer);
3839
3710
  });
3840
- linkNodeToShadow(elm, owner, renderer);
3841
3711
  vnode.elm = elm;
3842
3712
  vnode.vm = vm;
3713
+ linkNodeToShadow(elm, owner, renderer);
3714
+ applyStyleScoping(elm, owner, renderer);
3843
3715
  if (vm) {
3844
3716
  allocateChildren(vnode, vm);
3845
3717
  }
@@ -3923,22 +3795,6 @@ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, en
3923
3795
  function isVNode(vnode) {
3924
3796
  return vnode != null;
3925
3797
  }
3926
- function observeElementChildNodes(elm) {
3927
- elm.$domManual$ = true;
3928
- }
3929
- function setElementShadowToken(elm, token) {
3930
- elm.$shadowToken$ = token;
3931
- }
3932
- // Set the scope token class for *.scoped.css styles
3933
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3934
- const token = getScopeTokenClass(owner);
3935
- if (!isNull(token)) {
3936
- const { getClassList } = renderer;
3937
- // TODO [#2762]: this dot notation with add is probably problematic
3938
- // probably we should have a renderer api for just the add operation
3939
- getClassList(elm).add(token);
3940
- }
3941
- }
3942
3798
  function linkNodeToShadow(elm, owner, renderer) {
3943
3799
  const { renderRoot, renderMode, shadowMode } = owner;
3944
3800
  const { isSyntheticShadowDefined } = renderer;
@@ -3991,31 +3847,37 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3991
3847
  patchAttributes(oldVnode, vnode, renderer);
3992
3848
  patchProps(oldVnode, vnode, renderer);
3993
3849
  }
3994
- function fallbackElmHook(elm, vnode, renderer) {
3995
- const { owner } = vnode;
3996
- setScopeTokenClassIfNecessary(elm, owner, renderer);
3997
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
3998
- const { data: { context }, } = vnode;
3999
- const { stylesheetToken } = owner.context;
4000
- if (!isUndefined$1(context) &&
4001
- !isUndefined$1(context.lwc) &&
4002
- context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
4003
- // this element will now accept any manual content inserted into it
4004
- observeElementChildNodes(elm);
4005
- }
4006
- if (!isUndefined$1(stylesheetToken)) {
4007
- // when running in synthetic shadow mode, we need to set the shadowToken value
4008
- // into each element from the template, so they can be styled accordingly.
4009
- setElementShadowToken(elm, stylesheetToken);
4010
- }
3850
+ function applyStyleScoping(elm, owner, renderer) {
3851
+ // Set the class name for `*.scoped.css` style scoping.
3852
+ const scopeToken = getScopeTokenClass(owner);
3853
+ if (!isNull(scopeToken)) {
3854
+ const { getClassList } = renderer;
3855
+ // TODO [#2762]: this dot notation with add is probably problematic
3856
+ // probably we should have a renderer api for just the add operation
3857
+ getClassList(elm).add(scopeToken);
3858
+ }
3859
+ // Set property element for synthetic shadow DOM style scoping.
3860
+ const { stylesheetToken: syntheticToken } = owner.context;
3861
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
3862
+ elm.$shadowToken$ = syntheticToken;
4011
3863
  }
3864
+ }
3865
+ function applyDomManual(elm, vnode) {
3866
+ var _a;
3867
+ const { owner, data: { context }, } = vnode;
3868
+ 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 */) {
3869
+ elm.$domManual$ = true;
3870
+ }
3871
+ }
3872
+ function applyElementRestrictions(elm, vnode) {
3873
+ var _a, _b;
4012
3874
  if (process.env.NODE_ENV !== 'production') {
4013
- const { data: { context }, } = vnode;
4014
- const isPortal = !isUndefined$1(context) &&
4015
- !isUndefined$1(context.lwc) &&
4016
- context.lwc.dom === "manual" /* LwcDomMode.Manual */;
4017
- const isLight = owner.renderMode === 0 /* RenderMode.Light */;
4018
- patchElementWithRestrictions(elm, { isPortal, isLight });
3875
+ 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 */;
3876
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
3877
+ patchElementWithRestrictions(elm, {
3878
+ isPortal,
3879
+ isLight,
3880
+ });
4019
3881
  }
4020
3882
  }
4021
3883
  function allocateChildren(vnode, vm) {
@@ -4050,15 +3912,6 @@ function createViewModelHook(elm, vnode, renderer) {
4050
3912
  return vm;
4051
3913
  }
4052
3914
  const { sel, mode, ctor, owner } = vnode;
4053
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4054
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4055
- const { stylesheetToken } = owner.context;
4056
- // when running in synthetic shadow mode, we need to set the shadowToken value
4057
- // into each element from the template, so they can be styled accordingly.
4058
- if (!isUndefined$1(stylesheetToken)) {
4059
- setElementShadowToken(elm, stylesheetToken);
4060
- }
4061
- }
4062
3915
  vm = createVM(elm, ctor, renderer, {
4063
3916
  mode,
4064
3917
  owner,
@@ -5069,13 +4922,7 @@ function getComponentRegisteredTemplate(Ctor) {
5069
4922
  return signedTemplateMap.get(Ctor);
5070
4923
  }
5071
4924
  function getTemplateReactiveObserver(vm) {
5072
- return new ReactiveObserver(() => {
5073
- const { isDirty } = vm;
5074
- if (isFalse(isDirty)) {
5075
- markComponentAsDirty(vm);
5076
- scheduleRehydration(vm);
5077
- }
5078
- });
4925
+ return createReactiveObserver();
5079
4926
  }
5080
4927
  function renderComponent$1(vm) {
5081
4928
  if (process.env.NODE_ENV !== 'production') {
@@ -5312,7 +5159,7 @@ function createVM(elm, ctor, renderer, options) {
5312
5159
  renderer
5313
5160
  };
5314
5161
  vm.shadowMode = computeShadowMode(vm, renderer);
5315
- vm.tro = getTemplateReactiveObserver(vm);
5162
+ vm.tro = getTemplateReactiveObserver();
5316
5163
 
5317
5164
  if (process.env.NODE_ENV !== 'production') {
5318
5165
  vm.toString = () => {
@@ -5515,49 +5362,6 @@ function runRenderedCallback(vm) {
5515
5362
  , vm);
5516
5363
  }
5517
5364
  }
5518
- let rehydrateQueue = [];
5519
-
5520
- function flushRehydrationQueue() {
5521
- logGlobalOperationStart(8
5522
- /* OperationId.GlobalRehydrate */
5523
- );
5524
-
5525
- if (process.env.NODE_ENV !== 'production') {
5526
- assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
5527
- }
5528
-
5529
- const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);
5530
- rehydrateQueue = []; // reset to a new queue
5531
-
5532
- for (let i = 0, len = vms.length; i < len; i += 1) {
5533
- const vm = vms[i];
5534
-
5535
- try {
5536
- rehydrate(vm);
5537
- } catch (error) {
5538
- if (i + 1 < len) {
5539
- // pieces of the queue are still pending to be rehydrated, those should have priority
5540
- if (rehydrateQueue.length === 0) {
5541
- addCallbackToNextTick(flushRehydrationQueue);
5542
- }
5543
-
5544
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
5545
- } // we need to end the measure before throwing.
5546
-
5547
-
5548
- logGlobalOperationEnd(8
5549
- /* OperationId.GlobalRehydrate */
5550
- ); // re-throwing the original error will break the current tick, but since the next tick is
5551
- // already scheduled, it should continue patching the rest.
5552
-
5553
- throw error; // eslint-disable-line no-unsafe-finally
5554
- }
5555
- }
5556
-
5557
- logGlobalOperationEnd(8
5558
- /* OperationId.GlobalRehydrate */
5559
- );
5560
- }
5561
5365
 
5562
5366
  function runConnectedCallback(vm) {
5563
5367
  const {
@@ -5745,25 +5549,6 @@ function resetComponentRoot(vm) {
5745
5549
  runChildNodesDisconnectedCallback(vm);
5746
5550
  vm.velements = EmptyArray;
5747
5551
  }
5748
- function scheduleRehydration(vm) {
5749
- const {
5750
- renderer: {
5751
- ssr
5752
- }
5753
- } = vm;
5754
-
5755
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5756
- return;
5757
- }
5758
-
5759
- vm.isScheduled = true;
5760
-
5761
- if (rehydrateQueue.length === 0) {
5762
- addCallbackToNextTick(flushRehydrationQueue);
5763
- }
5764
-
5765
- ArrayPush$1.call(rehydrateQueue, vm);
5766
- }
5767
5552
 
5768
5553
  function getErrorBoundaryVM(vm) {
5769
5554
  let currentVm = vm;
@@ -5849,7 +5634,6 @@ function createFieldDataCallback(vm, name) {
5849
5634
  if (value !== vm.cmpFields[name]) {
5850
5635
  // storing the value in the underlying storage
5851
5636
  cmpFields[name] = value;
5852
- componentValueMutated(vm, name);
5853
5637
  }
5854
5638
  };
5855
5639
  }
@@ -5865,21 +5649,8 @@ function createMethodDataCallback(vm, method) {
5865
5649
  }
5866
5650
 
5867
5651
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
5868
- let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
5869
-
5870
- const ro = new ReactiveObserver(() => {
5871
- if (hasPendingConfig === false) {
5872
- hasPendingConfig = true; // collect new config in the micro-task
5873
-
5874
- Promise.resolve().then(() => {
5875
- hasPendingConfig = false; // resetting current reactive params
5876
-
5877
- ro.reset(); // dispatching a new config due to a change in the configuration
5878
5652
 
5879
- computeConfigAndUpdate();
5880
- });
5881
- }
5882
- });
5653
+ const ro = createReactiveObserver();
5883
5654
 
5884
5655
  const computeConfigAndUpdate = () => {
5885
5656
  let config;
@@ -6163,7 +5934,7 @@ function readonly(obj) {
6163
5934
  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.');
6164
5935
  }
6165
5936
  }
6166
- return reactiveMembrane.getReadOnlyProxy(obj);
5937
+ return getReadOnlyProxy(obj);
6167
5938
  }
6168
5939
 
6169
5940
  /*
@@ -6277,7 +6048,7 @@ function freezeTemplate(tmpl) {
6277
6048
  });
6278
6049
  }
6279
6050
  }
6280
- /* version: 2.20.4 */
6051
+ /* version: 2.22.0 */
6281
6052
 
6282
6053
  /*
6283
6054
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6753,6 +6524,6 @@ function renderComponent(tagName, Ctor, props = {}) {
6753
6524
  */
6754
6525
  freeze(LightningElement);
6755
6526
  seal(LightningElement.prototype);
6756
- /* version: 2.20.4 */
6527
+ /* version: 2.22.0 */
6757
6528
 
6758
6529
  export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };