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
@@ -419,9 +419,9 @@ function htmlEscape(str, attrMode = false) {
419
419
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
420
420
  */
421
421
  // Increment whenever the LWC template compiler changes
422
- const LWC_VERSION = "2.20.4";
422
+ const LWC_VERSION = "2.22.0";
423
423
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
424
- /** version: 2.20.4 */
424
+ /** version: 2.22.0 */
425
425
 
426
426
  /*
427
427
  * Copyright (c) 2020, salesforce.com, inc.
@@ -530,7 +530,7 @@ function setFeatureFlagForTest(name, value) {
530
530
  setFeatureFlag(name, value);
531
531
  }
532
532
  }
533
- /** version: 2.20.4 */
533
+ /** version: 2.22.0 */
534
534
 
535
535
  /* proxy-compat-disable */
536
536
 
@@ -558,40 +558,9 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
558
558
  }));
559
559
  });
560
560
  }
561
-
562
- /*
563
- * Copyright (c) 2018, salesforce.com, inc.
564
- * All rights reserved.
565
- * SPDX-License-Identifier: MIT
566
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
567
- */
568
- let nextTickCallbackQueue = [];
569
561
  const SPACE_CHAR = 32;
570
562
  const EmptyObject = seal(create(null));
571
563
  const EmptyArray = seal([]);
572
- function flushCallbackQueue() {
573
- if (process.env.NODE_ENV !== 'production') {
574
- if (nextTickCallbackQueue.length === 0) {
575
- throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);
576
- }
577
- }
578
- const callbacks = nextTickCallbackQueue;
579
- nextTickCallbackQueue = []; // reset to a new queue
580
- for (let i = 0, len = callbacks.length; i < len; i += 1) {
581
- callbacks[i]();
582
- }
583
- }
584
- function addCallbackToNextTick(callback) {
585
- if (process.env.NODE_ENV !== 'production') {
586
- if (!isFunction$1(callback)) {
587
- throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);
588
- }
589
- }
590
- if (nextTickCallbackQueue.length === 0) {
591
- Promise.resolve().then(flushCallbackQueue);
592
- }
593
- ArrayPush$1.call(nextTickCallbackQueue, callback);
594
- }
595
564
  function guid() {
596
565
  function s4() {
597
566
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -620,16 +589,6 @@ function flattenStylesheets(stylesheets) {
620
589
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
621
590
  */
622
591
  const TargetToReactiveRecordMap = new WeakMap();
623
- function getReactiveRecord(target) {
624
- let reactiveRecord = TargetToReactiveRecordMap.get(target);
625
- if (isUndefined$1(reactiveRecord)) {
626
- const newRecord = create(null);
627
- reactiveRecord = newRecord;
628
- TargetToReactiveRecordMap.set(target, newRecord);
629
- }
630
- return reactiveRecord;
631
- }
632
- let currentReactiveObserver = null;
633
592
  function valueMutated(target, key) {
634
593
  const reactiveRecord = TargetToReactiveRecordMap.get(target);
635
594
  if (!isUndefined$1(reactiveRecord)) {
@@ -644,71 +603,9 @@ function valueMutated(target, key) {
644
603
  }
645
604
  function valueObserved(target, key) {
646
605
  // We should determine if an active Observing Record is present to track mutations.
647
- if (currentReactiveObserver === null) {
606
+ {
648
607
  return;
649
608
  }
650
- const ro = currentReactiveObserver;
651
- const reactiveRecord = getReactiveRecord(target);
652
- let reactiveObservers = reactiveRecord[key];
653
- if (isUndefined$1(reactiveObservers)) {
654
- reactiveObservers = [];
655
- reactiveRecord[key] = reactiveObservers;
656
- }
657
- else if (reactiveObservers[0] === ro) {
658
- return; // perf optimization considering that most subscriptions will come from the same record
659
- }
660
- if (ArrayIndexOf.call(reactiveObservers, ro) === -1) {
661
- ro.link(reactiveObservers);
662
- }
663
- }
664
- class ReactiveObserver {
665
- constructor(callback) {
666
- this.listeners = [];
667
- this.callback = callback;
668
- }
669
- observe(job) {
670
- const inceptionReactiveRecord = currentReactiveObserver;
671
- currentReactiveObserver = this;
672
- let error;
673
- try {
674
- job();
675
- }
676
- catch (e) {
677
- error = Object(e);
678
- }
679
- finally {
680
- currentReactiveObserver = inceptionReactiveRecord;
681
- if (error !== undefined) {
682
- throw error; // eslint-disable-line no-unsafe-finally
683
- }
684
- }
685
- }
686
- /**
687
- * This method is responsible for disconnecting the Reactive Observer
688
- * from any Reactive Record that has a reference to it, to prevent future
689
- * notifications about previously recorded access.
690
- */
691
- reset() {
692
- const { listeners } = this;
693
- const len = listeners.length;
694
- if (len > 0) {
695
- for (let i = 0; i < len; i += 1) {
696
- const set = listeners[i];
697
- const pos = ArrayIndexOf.call(listeners[i], this);
698
- ArraySplice.call(set, pos, 1);
699
- }
700
- listeners.length = 0;
701
- }
702
- }
703
- // friend methods
704
- notify() {
705
- this.callback.call(undefined, this);
706
- }
707
- link(reactiveObservers) {
708
- ArrayPush$1.call(reactiveObservers, this);
709
- // we keep track of observing records where the observing record was added to so we can do some clean up later on
710
- ArrayPush$1.call(this.listeners, reactiveObservers);
711
- }
712
609
  }
713
610
 
714
611
  /*
@@ -717,11 +614,16 @@ class ReactiveObserver {
717
614
  * SPDX-License-Identifier: MIT
718
615
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
719
616
  */
720
- function componentValueMutated(vm, key) {
721
- valueMutated(vm.component, key);
722
- }
723
- function componentValueObserved(vm, key) {
724
- valueObserved(vm.component, key);
617
+ const DUMMY_REACTIVE_OBSERVER = {
618
+ observe(job) {
619
+ job();
620
+ },
621
+ reset() { },
622
+ link() { },
623
+ };
624
+ function createReactiveObserver(callback) {
625
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
626
+ return DUMMY_REACTIVE_OBSERVER;
725
627
  }
726
628
 
727
629
  /*
@@ -1840,7 +1742,17 @@ const reactiveMembrane = new ObservableMembrane({
1840
1742
  * change or being removed.
1841
1743
  */
1842
1744
  function unwrap(value) {
1843
- return reactiveMembrane.unwrapProxy(value);
1745
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1746
+ return value;
1747
+ }
1748
+ function getReadOnlyProxy(value) {
1749
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1750
+ // them from their parents. This applies to both the client and server.
1751
+ return reactiveMembrane.getReadOnlyProxy(value);
1752
+ }
1753
+ function getReactiveProxy(value) {
1754
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1755
+ return value;
1844
1756
  }
1845
1757
 
1846
1758
  /*
@@ -1880,7 +1792,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1880
1792
  }
1881
1793
  return;
1882
1794
  }
1883
- componentValueObserved(vm, propName);
1884
1795
  return get.call(vm.elm);
1885
1796
  },
1886
1797
  set(newValue) {
@@ -1894,7 +1805,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1894
1805
  }
1895
1806
  if (newValue !== vm.cmpProps[propName]) {
1896
1807
  vm.cmpProps[propName] = newValue;
1897
- componentValueMutated(vm, propName);
1898
1808
  }
1899
1809
  return set.call(vm.elm, newValue);
1900
1810
  },
@@ -1930,8 +1840,6 @@ const LightningElement = function () {
1930
1840
  vm.setHook = setHook;
1931
1841
  vm.getHook = getHook;
1932
1842
  }
1933
- // Making the component instance a live value when using Locker to support expandos.
1934
- this[lockerLivePropertyKey] = undefined;
1935
1843
  // Linking elm, shadow root and component with the VM.
1936
1844
  associateVM(component, vm);
1937
1845
  associateVM(elm, vm);
@@ -2186,14 +2094,12 @@ function createObservedFieldPropertyDescriptor(key) {
2186
2094
  return {
2187
2095
  get() {
2188
2096
  const vm = getAssociatedVM(this);
2189
- componentValueObserved(vm, key);
2190
2097
  return vm.cmpFields[key];
2191
2098
  },
2192
2099
  set(newValue) {
2193
2100
  const vm = getAssociatedVM(this);
2194
2101
  if (newValue !== vm.cmpFields[key]) {
2195
2102
  vm.cmpFields[key] = newValue;
2196
- componentValueMutated(vm, key);
2197
2103
  }
2198
2104
  },
2199
2105
  enumerable: true,
@@ -2201,6 +2107,24 @@ function createObservedFieldPropertyDescriptor(key) {
2201
2107
  };
2202
2108
  }
2203
2109
 
2110
+ /*
2111
+ * Copyright (c) 2018, salesforce.com, inc.
2112
+ * All rights reserved.
2113
+ * SPDX-License-Identifier: MIT
2114
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2115
+ */
2116
+ const DUMMY_ACCESSOR_REACTIVE_OBSERVER = {
2117
+ observe(job) {
2118
+ job();
2119
+ },
2120
+ reset() { },
2121
+ link() { },
2122
+ };
2123
+ function createAccessorReactiveObserver(vm, set) {
2124
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2125
+ return DUMMY_ACCESSOR_REACTIVE_OBSERVER;
2126
+ }
2127
+
2204
2128
  /*
2205
2129
  * Copyright (c) 2018, salesforce.com, inc.
2206
2130
  * All rights reserved.
@@ -2226,8 +2150,6 @@ function createPublicPropertyDescriptor(key) {
2226
2150
 
2227
2151
  return;
2228
2152
  }
2229
-
2230
- componentValueObserved(vm, key);
2231
2153
  return vm.cmpProps[key];
2232
2154
  },
2233
2155
 
@@ -2241,57 +2163,12 @@ function createPublicPropertyDescriptor(key) {
2241
2163
  }
2242
2164
 
2243
2165
  vm.cmpProps[key] = newValue;
2244
- componentValueMutated(vm, key);
2245
2166
  },
2246
2167
 
2247
2168
  enumerable: true,
2248
2169
  configurable: true
2249
2170
  };
2250
2171
  }
2251
- class AccessorReactiveObserver extends ReactiveObserver {
2252
- constructor(vm, set) {
2253
- super(() => {
2254
- if (isFalse(this.debouncing)) {
2255
- this.debouncing = true;
2256
- addCallbackToNextTick(() => {
2257
- if (isTrue(this.debouncing)) {
2258
- const {
2259
- value
2260
- } = this;
2261
- const {
2262
- isDirty: dirtyStateBeforeSetterCall,
2263
- component,
2264
- idx
2265
- } = vm;
2266
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2267
- // infinity loop if the setter itself is mutating things that
2268
- // were accessed during the previous invocation.
2269
-
2270
- this.debouncing = false;
2271
-
2272
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2273
- // immediate rehydration due to a setter driven mutation, otherwise
2274
- // the component will get rendered on the second tick, which it is not
2275
- // desirable.
2276
- rerenderVM(vm);
2277
- }
2278
- }
2279
- });
2280
- }
2281
- });
2282
- this.debouncing = false;
2283
- }
2284
-
2285
- reset(value) {
2286
- super.reset();
2287
- this.debouncing = false;
2288
-
2289
- if (arguments.length > 0) {
2290
- this.value = value;
2291
- }
2292
- }
2293
-
2294
- }
2295
2172
  function createPublicAccessorDescriptor(key, descriptor) {
2296
2173
  const {
2297
2174
  get,
@@ -2332,7 +2209,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2332
2209
  let ro = vm.oar[key];
2333
2210
 
2334
2211
  if (isUndefined$1(ro)) {
2335
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2212
+ ro = vm.oar[key] = createAccessorReactiveObserver();
2336
2213
  } // every time we invoke this setter from outside (through this wrapper setter)
2337
2214
  // we should reset the value and then debounce just in case there is a pending
2338
2215
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2364,7 +2241,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2364
2241
  */
2365
2242
  function track(target) {
2366
2243
  if (arguments.length === 1) {
2367
- return reactiveMembrane.getProxy(target);
2244
+ return getReactiveProxy(target);
2368
2245
  }
2369
2246
  if (process.env.NODE_ENV !== 'production') {
2370
2247
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2375,7 +2252,6 @@ function internalTrackDecorator(key) {
2375
2252
  return {
2376
2253
  get() {
2377
2254
  const vm = getAssociatedVM(this);
2378
- componentValueObserved(vm, key);
2379
2255
  return vm.cmpFields[key];
2380
2256
  },
2381
2257
  set(newValue) {
@@ -2385,10 +2261,9 @@ function internalTrackDecorator(key) {
2385
2261
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2386
2262
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2387
2263
  }
2388
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2264
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2389
2265
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2390
2266
  vm.cmpFields[key] = reactiveOrAnyValue;
2391
- componentValueMutated(vm, key);
2392
2267
  }
2393
2268
  },
2394
2269
  enumerable: true,
@@ -2417,7 +2292,6 @@ function internalWireFieldDecorator(key) {
2417
2292
  return {
2418
2293
  get() {
2419
2294
  const vm = getAssociatedVM(this);
2420
- componentValueObserved(vm, key);
2421
2295
  return vm.cmpFields[key];
2422
2296
  },
2423
2297
  set(value) {
@@ -2430,7 +2304,6 @@ function internalWireFieldDecorator(key) {
2430
2304
  */
2431
2305
  if (value !== vm.cmpFields[key]) {
2432
2306
  vm.cmpFields[key] = value;
2433
- componentValueMutated(vm, key);
2434
2307
  }
2435
2308
  },
2436
2309
  enumerable: true,
@@ -2777,7 +2650,7 @@ function createSetter(key) {
2777
2650
  fn = cachedSetterByKey[key] = function (newValue) {
2778
2651
  const vm = getAssociatedVM(this);
2779
2652
  const { setHook } = vm;
2780
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2653
+ newValue = getReadOnlyProxy(newValue);
2781
2654
  setHook(vm.component, key, newValue);
2782
2655
  };
2783
2656
  }
@@ -3796,10 +3669,11 @@ function mountElement(vnode, parent, anchor, renderer) {
3796
3669
  const { sel, owner, data: { svg }, } = vnode;
3797
3670
  const { createElement } = renderer;
3798
3671
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3799
- const elm = createElement(sel, namespace);
3672
+ const elm = (vnode.elm = createElement(sel, namespace));
3800
3673
  linkNodeToShadow(elm, owner, renderer);
3801
- fallbackElmHook(elm, vnode, renderer);
3802
- vnode.elm = elm;
3674
+ applyStyleScoping(elm, owner, renderer);
3675
+ applyDomManual(elm, vnode);
3676
+ applyElementRestrictions(elm, vnode);
3803
3677
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3804
3678
  insertNode(elm, parent, anchor, renderer);
3805
3679
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3814,6 +3688,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
3814
3688
  const { cloneNode, isSyntheticShadowDefined } = renderer;
3815
3689
  const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3816
3690
  linkNodeToShadow(elm, owner, renderer);
3691
+ applyElementRestrictions(elm, vnode);
3817
3692
  // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3818
3693
  const { renderMode, shadowMode } = owner;
3819
3694
  if (isSyntheticShadowDefined) {
@@ -3821,10 +3696,6 @@ function mountStatic(vnode, parent, anchor, renderer) {
3821
3696
  elm[KEY__SHADOW_STATIC] = true;
3822
3697
  }
3823
3698
  }
3824
- if (process.env.NODE_ENV !== 'production') {
3825
- const isLight = renderMode === 0 /* RenderMode.Light */;
3826
- patchElementWithRestrictions(elm, { isPortal: false, isLight });
3827
- }
3828
3699
  insertNode(elm, parent, anchor, renderer);
3829
3700
  }
3830
3701
  function mountCustomElement(vnode, parent, anchor, renderer) {
@@ -3841,9 +3712,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3841
3712
  // the custom element from the registry is expecting an upgrade callback
3842
3713
  vm = createViewModelHook(elm, vnode, renderer);
3843
3714
  });
3844
- linkNodeToShadow(elm, owner, renderer);
3845
3715
  vnode.elm = elm;
3846
3716
  vnode.vm = vm;
3717
+ linkNodeToShadow(elm, owner, renderer);
3718
+ applyStyleScoping(elm, owner, renderer);
3847
3719
  if (vm) {
3848
3720
  allocateChildren(vnode, vm);
3849
3721
  }
@@ -3927,22 +3799,6 @@ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, en
3927
3799
  function isVNode(vnode) {
3928
3800
  return vnode != null;
3929
3801
  }
3930
- function observeElementChildNodes(elm) {
3931
- elm.$domManual$ = true;
3932
- }
3933
- function setElementShadowToken(elm, token) {
3934
- elm.$shadowToken$ = token;
3935
- }
3936
- // Set the scope token class for *.scoped.css styles
3937
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3938
- const token = getScopeTokenClass(owner);
3939
- if (!isNull(token)) {
3940
- const { getClassList } = renderer;
3941
- // TODO [#2762]: this dot notation with add is probably problematic
3942
- // probably we should have a renderer api for just the add operation
3943
- getClassList(elm).add(token);
3944
- }
3945
- }
3946
3802
  function linkNodeToShadow(elm, owner, renderer) {
3947
3803
  const { renderRoot, renderMode, shadowMode } = owner;
3948
3804
  const { isSyntheticShadowDefined } = renderer;
@@ -3995,31 +3851,37 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3995
3851
  patchAttributes(oldVnode, vnode, renderer);
3996
3852
  patchProps(oldVnode, vnode, renderer);
3997
3853
  }
3998
- function fallbackElmHook(elm, vnode, renderer) {
3999
- const { owner } = vnode;
4000
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4001
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4002
- const { data: { context }, } = vnode;
4003
- const { stylesheetToken } = owner.context;
4004
- if (!isUndefined$1(context) &&
4005
- !isUndefined$1(context.lwc) &&
4006
- context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
4007
- // this element will now accept any manual content inserted into it
4008
- observeElementChildNodes(elm);
4009
- }
4010
- if (!isUndefined$1(stylesheetToken)) {
4011
- // when running in synthetic shadow mode, we need to set the shadowToken value
4012
- // into each element from the template, so they can be styled accordingly.
4013
- setElementShadowToken(elm, stylesheetToken);
4014
- }
3854
+ function applyStyleScoping(elm, owner, renderer) {
3855
+ // Set the class name for `*.scoped.css` style scoping.
3856
+ const scopeToken = getScopeTokenClass(owner);
3857
+ if (!isNull(scopeToken)) {
3858
+ const { getClassList } = renderer;
3859
+ // TODO [#2762]: this dot notation with add is probably problematic
3860
+ // probably we should have a renderer api for just the add operation
3861
+ getClassList(elm).add(scopeToken);
3862
+ }
3863
+ // Set property element for synthetic shadow DOM style scoping.
3864
+ const { stylesheetToken: syntheticToken } = owner.context;
3865
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
3866
+ elm.$shadowToken$ = syntheticToken;
4015
3867
  }
3868
+ }
3869
+ function applyDomManual(elm, vnode) {
3870
+ var _a;
3871
+ const { owner, data: { context }, } = vnode;
3872
+ 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 */) {
3873
+ elm.$domManual$ = true;
3874
+ }
3875
+ }
3876
+ function applyElementRestrictions(elm, vnode) {
3877
+ var _a, _b;
4016
3878
  if (process.env.NODE_ENV !== 'production') {
4017
- const { data: { context }, } = vnode;
4018
- const isPortal = !isUndefined$1(context) &&
4019
- !isUndefined$1(context.lwc) &&
4020
- context.lwc.dom === "manual" /* LwcDomMode.Manual */;
4021
- const isLight = owner.renderMode === 0 /* RenderMode.Light */;
4022
- patchElementWithRestrictions(elm, { isPortal, isLight });
3879
+ 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 */;
3880
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
3881
+ patchElementWithRestrictions(elm, {
3882
+ isPortal,
3883
+ isLight,
3884
+ });
4023
3885
  }
4024
3886
  }
4025
3887
  function allocateChildren(vnode, vm) {
@@ -4054,15 +3916,6 @@ function createViewModelHook(elm, vnode, renderer) {
4054
3916
  return vm;
4055
3917
  }
4056
3918
  const { sel, mode, ctor, owner } = vnode;
4057
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4058
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4059
- const { stylesheetToken } = owner.context;
4060
- // when running in synthetic shadow mode, we need to set the shadowToken value
4061
- // into each element from the template, so they can be styled accordingly.
4062
- if (!isUndefined$1(stylesheetToken)) {
4063
- setElementShadowToken(elm, stylesheetToken);
4064
- }
4065
- }
4066
3919
  vm = createVM(elm, ctor, renderer, {
4067
3920
  mode,
4068
3921
  owner,
@@ -5073,13 +4926,7 @@ function getComponentRegisteredTemplate(Ctor) {
5073
4926
  return signedTemplateMap.get(Ctor);
5074
4927
  }
5075
4928
  function getTemplateReactiveObserver(vm) {
5076
- return new ReactiveObserver(() => {
5077
- const { isDirty } = vm;
5078
- if (isFalse(isDirty)) {
5079
- markComponentAsDirty(vm);
5080
- scheduleRehydration(vm);
5081
- }
5082
- });
4929
+ return createReactiveObserver();
5083
4930
  }
5084
4931
  function renderComponent$1(vm) {
5085
4932
  if (process.env.NODE_ENV !== 'production') {
@@ -5316,7 +5163,7 @@ function createVM(elm, ctor, renderer, options) {
5316
5163
  renderer
5317
5164
  };
5318
5165
  vm.shadowMode = computeShadowMode(vm, renderer);
5319
- vm.tro = getTemplateReactiveObserver(vm);
5166
+ vm.tro = getTemplateReactiveObserver();
5320
5167
 
5321
5168
  if (process.env.NODE_ENV !== 'production') {
5322
5169
  vm.toString = () => {
@@ -5519,49 +5366,6 @@ function runRenderedCallback(vm) {
5519
5366
  , vm);
5520
5367
  }
5521
5368
  }
5522
- let rehydrateQueue = [];
5523
-
5524
- function flushRehydrationQueue() {
5525
- logGlobalOperationStart(8
5526
- /* OperationId.GlobalRehydrate */
5527
- );
5528
-
5529
- if (process.env.NODE_ENV !== 'production') {
5530
- 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}.`);
5531
- }
5532
-
5533
- const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);
5534
- rehydrateQueue = []; // reset to a new queue
5535
-
5536
- for (let i = 0, len = vms.length; i < len; i += 1) {
5537
- const vm = vms[i];
5538
-
5539
- try {
5540
- rehydrate(vm);
5541
- } catch (error) {
5542
- if (i + 1 < len) {
5543
- // pieces of the queue are still pending to be rehydrated, those should have priority
5544
- if (rehydrateQueue.length === 0) {
5545
- addCallbackToNextTick(flushRehydrationQueue);
5546
- }
5547
-
5548
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
5549
- } // we need to end the measure before throwing.
5550
-
5551
-
5552
- logGlobalOperationEnd(8
5553
- /* OperationId.GlobalRehydrate */
5554
- ); // re-throwing the original error will break the current tick, but since the next tick is
5555
- // already scheduled, it should continue patching the rest.
5556
-
5557
- throw error; // eslint-disable-line no-unsafe-finally
5558
- }
5559
- }
5560
-
5561
- logGlobalOperationEnd(8
5562
- /* OperationId.GlobalRehydrate */
5563
- );
5564
- }
5565
5369
 
5566
5370
  function runConnectedCallback(vm) {
5567
5371
  const {
@@ -5749,25 +5553,6 @@ function resetComponentRoot(vm) {
5749
5553
  runChildNodesDisconnectedCallback(vm);
5750
5554
  vm.velements = EmptyArray;
5751
5555
  }
5752
- function scheduleRehydration(vm) {
5753
- const {
5754
- renderer: {
5755
- ssr
5756
- }
5757
- } = vm;
5758
-
5759
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5760
- return;
5761
- }
5762
-
5763
- vm.isScheduled = true;
5764
-
5765
- if (rehydrateQueue.length === 0) {
5766
- addCallbackToNextTick(flushRehydrationQueue);
5767
- }
5768
-
5769
- ArrayPush$1.call(rehydrateQueue, vm);
5770
- }
5771
5556
 
5772
5557
  function getErrorBoundaryVM(vm) {
5773
5558
  let currentVm = vm;
@@ -5853,7 +5638,6 @@ function createFieldDataCallback(vm, name) {
5853
5638
  if (value !== vm.cmpFields[name]) {
5854
5639
  // storing the value in the underlying storage
5855
5640
  cmpFields[name] = value;
5856
- componentValueMutated(vm, name);
5857
5641
  }
5858
5642
  };
5859
5643
  }
@@ -5869,21 +5653,8 @@ function createMethodDataCallback(vm, method) {
5869
5653
  }
5870
5654
 
5871
5655
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
5872
- let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
5873
-
5874
- const ro = new ReactiveObserver(() => {
5875
- if (hasPendingConfig === false) {
5876
- hasPendingConfig = true; // collect new config in the micro-task
5877
-
5878
- Promise.resolve().then(() => {
5879
- hasPendingConfig = false; // resetting current reactive params
5880
-
5881
- ro.reset(); // dispatching a new config due to a change in the configuration
5882
5656
 
5883
- computeConfigAndUpdate();
5884
- });
5885
- }
5886
- });
5657
+ const ro = createReactiveObserver();
5887
5658
 
5888
5659
  const computeConfigAndUpdate = () => {
5889
5660
  let config;
@@ -6167,7 +5938,7 @@ function readonly(obj) {
6167
5938
  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.');
6168
5939
  }
6169
5940
  }
6170
- return reactiveMembrane.getReadOnlyProxy(obj);
5941
+ return getReadOnlyProxy(obj);
6171
5942
  }
6172
5943
 
6173
5944
  /*
@@ -6281,7 +6052,7 @@ function freezeTemplate(tmpl) {
6281
6052
  });
6282
6053
  }
6283
6054
  }
6284
- /* version: 2.20.4 */
6055
+ /* version: 2.22.0 */
6285
6056
 
6286
6057
  /*
6287
6058
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6757,7 +6528,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6757
6528
  */
6758
6529
  freeze(LightningElement);
6759
6530
  seal(LightningElement.prototype);
6760
- /* version: 2.20.4 */
6531
+ /* version: 2.22.0 */
6761
6532
 
6762
6533
  exports.LightningElement = LightningElement;
6763
6534
  exports.api = api$1;