lwc 2.21.1 → 2.23.1

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 +222 -199
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +222 -199
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +211 -188
  5. package/dist/engine-dom/iife/es5/engine-dom.js +263 -216
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +239 -192
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +222 -199
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +211 -188
  11. package/dist/engine-dom/umd/es5/engine-dom.js +263 -216
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +239 -192
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +116 -403
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +116 -403
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +30 -27
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -27
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -26
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +32 -31
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -30
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +30 -27
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -26
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +32 -31
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -30
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -365,9 +365,13 @@ var LWC = (function (exports) {
365
365
  // Increment whenever the LWC template compiler changes
366
366
 
367
367
 
368
- var LWC_VERSION = "2.21.1";
368
+ var LWC_VERSION = "2.23.1";
369
369
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.21.1 */
370
+ /** version: 2.23.1 */
371
+
372
+ /**
373
+ * Copyright (C) 2018 salesforce.com, inc.
374
+ */
371
375
 
372
376
  /*
373
377
  * Copyright (c) 2018, salesforce.com, inc.
@@ -377,7 +381,7 @@ var LWC = (function (exports) {
377
381
  */
378
382
 
379
383
  function detect(propName) {
380
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
384
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
381
385
  }
382
386
  /*
383
387
  * Copyright (c) 2018, salesforce.com, inc.
@@ -457,6 +461,8 @@ var LWC = (function (exports) {
457
461
  patch$1(propName);
458
462
  }
459
463
  }
464
+ /** version: 2.23.1 */
465
+
460
466
  /**
461
467
  * Copyright (C) 2018 salesforce.com, inc.
462
468
  */
@@ -489,7 +495,7 @@ var LWC = (function (exports) {
489
495
  });
490
496
  }
491
497
 
492
- var runtimeFlags = _globalThis.lwcRuntimeFlags;
498
+ var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
493
499
  /**
494
500
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
495
501
  * flag. It is meant to be used during the app initialization.
@@ -519,10 +525,10 @@ var LWC = (function (exports) {
519
525
 
520
526
  if (process.env.NODE_ENV !== 'production') {
521
527
  // Allow the same flag to be set more than once outside of production to enable testing
522
- runtimeFlags[name] = value;
528
+ lwcRuntimeFlags[name] = value;
523
529
  } else {
524
530
  // Disallow the same flag to be set more than once in production
525
- var runtimeValue = runtimeFlags[name];
531
+ var runtimeValue = lwcRuntimeFlags[name];
526
532
 
527
533
  if (!isUndefined$1(runtimeValue)) {
528
534
  // eslint-disable-next-line no-console
@@ -530,7 +536,7 @@ var LWC = (function (exports) {
530
536
  return;
531
537
  }
532
538
 
533
- defineProperty(runtimeFlags, name, {
539
+ defineProperty(lwcRuntimeFlags, name, {
534
540
  value: value
535
541
  });
536
542
  }
@@ -546,7 +552,7 @@ var LWC = (function (exports) {
546
552
  setFeatureFlag(name, value);
547
553
  }
548
554
  }
549
- /** version: 2.21.1 */
555
+ /** version: 2.23.1 */
550
556
 
551
557
  /*
552
558
  * Copyright (c) 2018, salesforce.com, inc.
@@ -561,7 +567,7 @@ var LWC = (function (exports) {
561
567
  window.addEventListener('test-dummy-flag', function () {
562
568
  var hasFlag = false;
563
569
 
564
- if (runtimeFlags.DUMMY_TEST_FLAG) {
570
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
565
571
  hasFlag = true;
566
572
  }
567
573
 
@@ -588,7 +594,7 @@ var LWC = (function (exports) {
588
594
  window.addEventListener('test-dummy-flag', function () {
589
595
  var hasFlag = false;
590
596
 
591
- if (runtimeFlags.DUMMY_TEST_FLAG) {
597
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
592
598
  hasFlag = true;
593
599
  }
594
600
 
@@ -852,20 +858,24 @@ var LWC = (function (exports) {
852
858
 
853
859
  return ReactiveObserver;
854
860
  }();
855
- /*
856
- * Copyright (c) 2018, salesforce.com, inc.
857
- * All rights reserved.
858
- * SPDX-License-Identifier: MIT
859
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
860
- */
861
-
862
861
 
863
862
  function componentValueMutated(vm, key) {
864
- valueMutated(vm.component, key);
863
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
864
+ {
865
+ valueMutated(vm.component, key);
866
+ }
865
867
  }
866
868
 
867
869
  function componentValueObserved(vm, key) {
868
- valueObserved(vm.component, key);
870
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
871
+ {
872
+ valueObserved(vm.component, key);
873
+ }
874
+ }
875
+
876
+ function createReactiveObserver(callback) {
877
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
878
+ return new ReactiveObserver(callback);
869
879
  }
870
880
  /*
871
881
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1473,6 +1483,15 @@ var LWC = (function (exports) {
1473
1483
  function patchLightningElementPrototypeWithRestrictions(proto) {
1474
1484
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1475
1485
  }
1486
+
1487
+ function updateComponentValue(vm, key, newValue) {
1488
+ var cmpFields = vm.cmpFields;
1489
+
1490
+ if (newValue !== cmpFields[key]) {
1491
+ cmpFields[key] = newValue;
1492
+ componentValueMutated(vm, key);
1493
+ }
1494
+ }
1476
1495
  /**
1477
1496
  * Copyright (C) 2017 salesforce.com, inc.
1478
1497
  */
@@ -2280,8 +2299,28 @@ var LWC = (function (exports) {
2280
2299
  */
2281
2300
 
2282
2301
  function unwrap(value) {
2302
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2283
2303
  return reactiveMembrane.unwrapProxy(value);
2284
2304
  }
2305
+
2306
+ function getReadOnlyProxy(value) {
2307
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2308
+ // them from their parents. This applies to both the client and server.
2309
+ return reactiveMembrane.getReadOnlyProxy(value);
2310
+ }
2311
+
2312
+ function getReactiveProxy(value) {
2313
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2314
+ return reactiveMembrane.getProxy(value);
2315
+ } // Making the component instance a live value when using Locker to support expandos.
2316
+
2317
+
2318
+ function markLockerLiveObject(obj) {
2319
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2320
+ {
2321
+ obj[lockerLivePropertyKey] = undefined;
2322
+ }
2323
+ }
2285
2324
  /*
2286
2325
  * Copyright (c) 2018, salesforce.com, inc.
2287
2326
  * All rights reserved.
@@ -2348,11 +2387,7 @@ var LWC = (function (exports) {
2348
2387
  assert.invariant(!isObject(newValue) || isNull(newValue), "Invalid value \"".concat(newValue, "\" for \"").concat(propName, "\" of ").concat(vm, ". Value cannot be an object, must be a primitive value."));
2349
2388
  }
2350
2389
 
2351
- if (newValue !== vm.cmpProps[propName]) {
2352
- vm.cmpProps[propName] = newValue;
2353
- componentValueMutated(vm, propName);
2354
- }
2355
-
2390
+ updateComponentValue(vm, propName, newValue);
2356
2391
  return _set.call(vm.elm, newValue);
2357
2392
  }
2358
2393
  };
@@ -2396,10 +2431,9 @@ var LWC = (function (exports) {
2396
2431
  vm.callHook = _callHook;
2397
2432
  vm.setHook = _setHook;
2398
2433
  vm.getHook = _getHook;
2399
- } // Making the component instance a live value when using Locker to support expandos.
2400
-
2434
+ }
2401
2435
 
2402
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2436
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2403
2437
 
2404
2438
  associateVM(component, vm);
2405
2439
  associateVM(elm, vm);
@@ -2729,60 +2763,7 @@ var LWC = (function (exports) {
2729
2763
  },
2730
2764
  set: function set(newValue) {
2731
2765
  var vm = getAssociatedVM(this);
2732
-
2733
- if (newValue !== vm.cmpFields[key]) {
2734
- vm.cmpFields[key] = newValue;
2735
- componentValueMutated(vm, key);
2736
- }
2737
- },
2738
- enumerable: true,
2739
- configurable: true
2740
- };
2741
- }
2742
- /*
2743
- * Copyright (c) 2018, salesforce.com, inc.
2744
- * All rights reserved.
2745
- * SPDX-License-Identifier: MIT
2746
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2747
- */
2748
-
2749
-
2750
- function api$1() {
2751
- if (process.env.NODE_ENV !== 'production') {
2752
- assert.fail("@api decorator can only be used as a decorator function.");
2753
- }
2754
-
2755
- throw new Error();
2756
- }
2757
-
2758
- function createPublicPropertyDescriptor(key) {
2759
- return {
2760
- get: function get() {
2761
- var vm = getAssociatedVM(this);
2762
-
2763
- if (isBeingConstructed(vm)) {
2764
- if (process.env.NODE_ENV !== 'production') {
2765
- logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2766
- }
2767
-
2768
- return;
2769
- }
2770
-
2771
- componentValueObserved(vm, key);
2772
- return vm.cmpProps[key];
2773
- },
2774
- set: function set(newValue) {
2775
- var vm = getAssociatedVM(this);
2776
-
2777
- if (process.env.NODE_ENV !== 'production') {
2778
- var _vmBeingRendered3 = getVMBeingRendered();
2779
-
2780
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2781
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2782
- }
2783
-
2784
- vm.cmpProps[key] = newValue;
2785
- componentValueMutated(vm, key);
2766
+ updateComponentValue(vm, key, newValue);
2786
2767
  },
2787
2768
  enumerable: true,
2788
2769
  configurable: true
@@ -2846,6 +2827,60 @@ var LWC = (function (exports) {
2846
2827
  return AccessorReactiveObserver;
2847
2828
  }(ReactiveObserver);
2848
2829
 
2830
+ function createAccessorReactiveObserver(vm, set) {
2831
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2832
+ return new AccessorReactiveObserver(vm, set);
2833
+ }
2834
+ /*
2835
+ * Copyright (c) 2018, salesforce.com, inc.
2836
+ * All rights reserved.
2837
+ * SPDX-License-Identifier: MIT
2838
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2839
+ */
2840
+
2841
+
2842
+ function api$1() {
2843
+ if (process.env.NODE_ENV !== 'production') {
2844
+ assert.fail("@api decorator can only be used as a decorator function.");
2845
+ }
2846
+
2847
+ throw new Error();
2848
+ }
2849
+
2850
+ function createPublicPropertyDescriptor(key) {
2851
+ return {
2852
+ get: function get() {
2853
+ var vm = getAssociatedVM(this);
2854
+
2855
+ if (isBeingConstructed(vm)) {
2856
+ if (process.env.NODE_ENV !== 'production') {
2857
+ logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2858
+ }
2859
+
2860
+ return;
2861
+ }
2862
+
2863
+ componentValueObserved(vm, key);
2864
+ return vm.cmpProps[key];
2865
+ },
2866
+ set: function set(newValue) {
2867
+ var vm = getAssociatedVM(this);
2868
+
2869
+ if (process.env.NODE_ENV !== 'production') {
2870
+ var _vmBeingRendered3 = getVMBeingRendered();
2871
+
2872
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2873
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2874
+ }
2875
+
2876
+ vm.cmpProps[key] = newValue;
2877
+ componentValueMutated(vm, key);
2878
+ },
2879
+ enumerable: true,
2880
+ configurable: true
2881
+ };
2882
+ }
2883
+
2849
2884
  function createPublicAccessorDescriptor(key, descriptor) {
2850
2885
  var _get3 = descriptor.get,
2851
2886
  _set2 = descriptor.set,
@@ -2882,11 +2917,11 @@ var LWC = (function (exports) {
2882
2917
  }
2883
2918
 
2884
2919
  if (_set2) {
2885
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2920
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2886
2921
  var ro = vm.oar[key];
2887
2922
 
2888
2923
  if (isUndefined$1(ro)) {
2889
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2924
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2890
2925
  } // every time we invoke this setter from outside (through this wrapper setter)
2891
2926
  // we should reset the value and then debounce just in case there is a pending
2892
2927
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2918,7 +2953,7 @@ var LWC = (function (exports) {
2918
2953
 
2919
2954
  function track(target) {
2920
2955
  if (arguments.length === 1) {
2921
- return reactiveMembrane.getProxy(target);
2956
+ return getReactiveProxy(target);
2922
2957
  }
2923
2958
 
2924
2959
  if (process.env.NODE_ENV !== 'production') {
@@ -2945,12 +2980,8 @@ var LWC = (function (exports) {
2945
2980
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2946
2981
  }
2947
2982
 
2948
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2949
-
2950
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2951
- vm.cmpFields[key] = reactiveOrAnyValue;
2952
- componentValueMutated(vm, key);
2953
- }
2983
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2984
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2954
2985
  },
2955
2986
  enumerable: true,
2956
2987
  configurable: true
@@ -2994,10 +3025,7 @@ var LWC = (function (exports) {
2994
3025
  * system to be backward compatible.
2995
3026
  */
2996
3027
 
2997
- if (value !== vm.cmpFields[key]) {
2998
- vm.cmpFields[key] = value;
2999
- componentValueMutated(vm, key);
3000
- }
3028
+ updateComponentValue(vm, key, value);
3001
3029
  },
3002
3030
  enumerable: true,
3003
3031
  configurable: true
@@ -3420,7 +3448,7 @@ var LWC = (function (exports) {
3420
3448
  fn = cachedSetterByKey[key] = function (newValue) {
3421
3449
  var vm = getAssociatedVM(this);
3422
3450
  var setHook = vm.setHook;
3423
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3451
+ newValue = getReadOnlyProxy(newValue);
3424
3452
  setHook(vm.component, key, newValue);
3425
3453
  };
3426
3454
  }
@@ -3654,7 +3682,7 @@ var LWC = (function (exports) {
3654
3682
  throw new ReferenceError();
3655
3683
  }
3656
3684
 
3657
- if (runtimeFlags.ENABLE_HMR) {
3685
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3658
3686
  var visited = new Set();
3659
3687
 
3660
3688
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
@@ -3672,7 +3700,7 @@ var LWC = (function (exports) {
3672
3700
  throw new ReferenceError();
3673
3701
  }
3674
3702
 
3675
- if (runtimeFlags.ENABLE_HMR) {
3703
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3676
3704
  var visited = new Set();
3677
3705
 
3678
3706
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
@@ -3690,7 +3718,7 @@ var LWC = (function (exports) {
3690
3718
  throw new ReferenceError();
3691
3719
  }
3692
3720
 
3693
- if (runtimeFlags.ENABLE_HMR) {
3721
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3694
3722
  var visited = new Set();
3695
3723
 
3696
3724
  while (swappedStyleMap.has(style) && !visited.has(style)) {
@@ -3708,7 +3736,7 @@ var LWC = (function (exports) {
3708
3736
  throw new ReferenceError();
3709
3737
  }
3710
3738
 
3711
- if (runtimeFlags.ENABLE_HMR) {
3739
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3712
3740
  // tracking active component
3713
3741
  var Ctor = vm.def.ctor;
3714
3742
  var componentVMs = activeComponents.get(Ctor);
@@ -3766,7 +3794,7 @@ var LWC = (function (exports) {
3766
3794
  throw new ReferenceError();
3767
3795
  }
3768
3796
 
3769
- if (runtimeFlags.ENABLE_HMR) {
3797
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3770
3798
  // tracking inactive component
3771
3799
  var Ctor = vm.def.ctor;
3772
3800
  var list = activeComponents.get(Ctor);
@@ -3814,7 +3842,7 @@ var LWC = (function (exports) {
3814
3842
  }
3815
3843
  }
3816
3844
 
3817
- if (!runtimeFlags.ENABLE_HMR) {
3845
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3818
3846
  throw new Error('HMR is not enabled');
3819
3847
  }
3820
3848
 
@@ -3831,7 +3859,7 @@ var LWC = (function (exports) {
3831
3859
  }
3832
3860
  }
3833
3861
 
3834
- if (!runtimeFlags.ENABLE_HMR) {
3862
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3835
3863
  throw new Error('HMR is not enabled');
3836
3864
  }
3837
3865
 
@@ -3846,7 +3874,7 @@ var LWC = (function (exports) {
3846
3874
  return rehydrateHotStyle(oldStyle);
3847
3875
  }
3848
3876
 
3849
- if (!runtimeFlags.ENABLE_HMR) {
3877
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3850
3878
  throw new Error('HMR is not enabled');
3851
3879
  }
3852
3880
 
@@ -4320,9 +4348,7 @@ var LWC = (function (exports) {
4320
4348
  function createStylesheet(vm, stylesheets) {
4321
4349
  var renderMode = vm.renderMode,
4322
4350
  shadowMode = vm.shadowMode,
4323
- _vm$renderer2 = vm.renderer,
4324
- ssr = _vm$renderer2.ssr,
4325
- insertStylesheet = _vm$renderer2.insertStylesheet;
4351
+ insertStylesheet = vm.renderer.insertStylesheet;
4326
4352
 
4327
4353
  if (renderMode === 1
4328
4354
  /* RenderMode.Shadow */
@@ -4332,7 +4358,7 @@ var LWC = (function (exports) {
4332
4358
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4333
4359
  insertStylesheet(stylesheets[_i12]);
4334
4360
  }
4335
- } else if (ssr || vm.hydrated) {
4361
+ } else if (vm.hydrated) {
4336
4362
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4337
4363
  // This works in the client, because the stylesheets are created, and cached in the VM
4338
4364
  // the first time the VM renders.
@@ -4718,7 +4744,7 @@ var LWC = (function (exports) {
4718
4744
  }
4719
4745
  }
4720
4746
 
4721
- function patch(n1, n2, renderer) {
4747
+ function patch(n1, n2, parent, renderer) {
4722
4748
  var _a, _b;
4723
4749
 
4724
4750
  if (n1 === n2) {
@@ -4767,7 +4793,7 @@ var LWC = (function (exports) {
4767
4793
  case 3
4768
4794
  /* VNodeType.CustomElement */
4769
4795
  :
4770
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4796
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4771
4797
  break;
4772
4798
  }
4773
4799
  }
@@ -4939,25 +4965,34 @@ var LWC = (function (exports) {
4939
4965
  }
4940
4966
  }
4941
4967
 
4942
- function patchCustomElement(n1, n2, renderer) {
4943
- var elm = n2.elm = n1.elm;
4944
- var vm = n2.vm = n1.vm;
4945
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4968
+ function patchCustomElement(n1, n2, parent, renderer) {
4969
+ if (n1.ctor !== n2.ctor) {
4970
+ // If the constructor, unmount the current component and mount a new one using the new
4971
+ // constructor.
4972
+ var anchor = renderer.nextSibling(n1.elm);
4973
+ unmount(n1, parent, renderer, true);
4974
+ mountCustomElement(n2, parent, anchor, renderer);
4975
+ } else {
4976
+ // Otherwise patch the existing component with new props/attrs/etc.
4977
+ var elm = n2.elm = n1.elm;
4978
+ var vm = n2.vm = n1.vm;
4979
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4946
4980
 
4947
- if (!isUndefined$1(vm)) {
4948
- // in fallback mode, the allocation will always set children to
4949
- // empty and delegate the real allocation to the slot elements
4950
- allocateChildren(n2, vm);
4951
- } // in fallback mode, the children will be always empty, so, nothing
4952
- // will happen, but in native, it does allocate the light dom
4981
+ if (!isUndefined$1(vm)) {
4982
+ // in fallback mode, the allocation will always set children to
4983
+ // empty and delegate the real allocation to the slot elements
4984
+ allocateChildren(n2, vm);
4985
+ } // in fallback mode, the children will be always empty, so, nothing
4986
+ // will happen, but in native, it does allocate the light dom
4953
4987
 
4954
4988
 
4955
- patchChildren(n1.children, n2.children, elm, renderer);
4989
+ patchChildren(n1.children, n2.children, elm, renderer);
4956
4990
 
4957
- if (!isUndefined$1(vm)) {
4958
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4959
- // this is important to preserve the top to bottom synchronous rendering phase.
4960
- rerenderVM(vm);
4991
+ if (!isUndefined$1(vm)) {
4992
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4993
+ // this is important to preserve the top to bottom synchronous rendering phase.
4994
+ rerenderVM(vm);
4995
+ }
4961
4996
  }
4962
4997
  }
4963
4998
 
@@ -5326,22 +5361,22 @@ var LWC = (function (exports) {
5326
5361
  } else if (!isVNode(newEndVnode)) {
5327
5362
  newEndVnode = newCh[--newEndIdx];
5328
5363
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5329
- patch(oldStartVnode, newStartVnode, renderer);
5364
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5330
5365
  oldStartVnode = oldCh[++oldStartIdx];
5331
5366
  newStartVnode = newCh[++newStartIdx];
5332
5367
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5333
- patch(oldEndVnode, newEndVnode, renderer);
5368
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5334
5369
  oldEndVnode = oldCh[--oldEndIdx];
5335
5370
  newEndVnode = newCh[--newEndIdx];
5336
5371
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5337
5372
  // Vnode moved right
5338
- patch(oldStartVnode, newEndVnode, renderer);
5373
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5339
5374
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5340
5375
  oldStartVnode = oldCh[++oldStartIdx];
5341
5376
  newEndVnode = newCh[--newEndIdx];
5342
5377
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5343
5378
  // Vnode moved left
5344
- patch(oldEndVnode, newStartVnode, renderer);
5379
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5345
5380
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5346
5381
  oldEndVnode = oldCh[--oldEndIdx];
5347
5382
  newStartVnode = newCh[++newStartIdx];
@@ -5364,7 +5399,7 @@ var LWC = (function (exports) {
5364
5399
  // New element
5365
5400
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5366
5401
  } else {
5367
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5402
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5368
5403
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5369
5404
  // so we only care about the `oldCh` object inside this function.
5370
5405
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5434,7 +5469,7 @@ var LWC = (function (exports) {
5434
5469
  if (isVNode(n1)) {
5435
5470
  if (isVNode(n2)) {
5436
5471
  // both vnodes are equivalent, and we just need to patch them
5437
- patch(n1, n2, renderer);
5472
+ patch(n1, n2, parent, renderer);
5438
5473
  anchor = n2.elm;
5439
5474
  } else {
5440
5475
  // removing the old vnode since the new one is null
@@ -5849,19 +5884,11 @@ var LWC = (function (exports) {
5849
5884
 
5850
5885
  return url;
5851
5886
  }
5852
- /**
5853
- * Map to store an index value assigned to any dynamic component reference ingested
5854
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5855
- * component reference to avoid diffing algo mismatches.
5856
- */
5857
-
5858
-
5859
- var DynamicImportedComponentMap = new Map();
5860
- var dynamicImportedComponentCounter = 0;
5861
5887
  /**
5862
5888
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5863
5889
  */
5864
5890
 
5891
+
5865
5892
  function dc(sel, Ctor, data) {
5866
5893
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5867
5894
 
@@ -5880,22 +5907,7 @@ var LWC = (function (exports) {
5880
5907
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5881
5908
  }
5882
5909
 
5883
- var idx = DynamicImportedComponentMap.get(Ctor);
5884
-
5885
- if (isUndefined$1(idx)) {
5886
- idx = dynamicImportedComponentCounter++;
5887
- DynamicImportedComponentMap.set(Ctor, idx);
5888
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5889
- // to identify different constructors as vnodes with different keys to avoid reusing the
5890
- // element used for previous constructors.
5891
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5892
- // hoisting optimization.
5893
-
5894
-
5895
- var newData = Object.assign(Object.assign({}, data), {
5896
- key: "dc:".concat(idx, ":").concat(data.key)
5897
- });
5898
- return c(sel, Ctor, newData, children);
5910
+ return c(sel, Ctor, data, children);
5899
5911
  }
5900
5912
  /**
5901
5913
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6469,7 +6481,7 @@ var LWC = (function (exports) {
6469
6481
  }
6470
6482
 
6471
6483
  function getTemplateReactiveObserver(vm) {
6472
- return new ReactiveObserver(function () {
6484
+ return createReactiveObserver(function () {
6473
6485
  var isDirty = vm.isDirty;
6474
6486
 
6475
6487
  if (isFalse(isDirty)) {
@@ -6742,7 +6754,7 @@ var LWC = (function (exports) {
6742
6754
  return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
6743
6755
  };
6744
6756
 
6745
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6757
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6746
6758
  vm.shadowMode = 0
6747
6759
  /* ShadowMode.Native */
6748
6760
  ;
@@ -6777,7 +6789,7 @@ var LWC = (function (exports) {
6777
6789
  } else if (isNativeShadowDefined) {
6778
6790
  // Not combined with above condition because @lwc/features only supports identifiers in
6779
6791
  // the if-condition.
6780
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6792
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6781
6793
  if (def.shadowSupportMode === "any"
6782
6794
  /* ShadowSupportMode.Any */
6783
6795
  ) {
@@ -6903,13 +6915,7 @@ var LWC = (function (exports) {
6903
6915
  }
6904
6916
 
6905
6917
  function runRenderedCallback(vm) {
6906
- var renderedCallback = vm.def.renderedCallback,
6907
- ssr = vm.renderer.ssr;
6908
-
6909
- if (isTrue(ssr)) {
6910
- return;
6911
- }
6912
-
6918
+ var renderedCallback = vm.def.renderedCallback;
6913
6919
  var rendered = Services.rendered;
6914
6920
 
6915
6921
  if (rendered) {
@@ -7141,9 +7147,7 @@ var LWC = (function (exports) {
7141
7147
  }
7142
7148
 
7143
7149
  function scheduleRehydration(vm) {
7144
- var ssr = vm.renderer.ssr;
7145
-
7146
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7150
+ if (isTrue(vm.isScheduled)) {
7147
7151
  return;
7148
7152
  }
7149
7153
 
@@ -7265,13 +7269,8 @@ var LWC = (function (exports) {
7265
7269
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7266
7270
 
7267
7271
  function createFieldDataCallback(vm, name) {
7268
- var cmpFields = vm.cmpFields;
7269
7272
  return function (value) {
7270
- if (value !== vm.cmpFields[name]) {
7271
- // storing the value in the underlying storage
7272
- cmpFields[name] = value;
7273
- componentValueMutated(vm, name);
7274
- }
7273
+ updateComponentValue(vm, name, value);
7275
7274
  };
7276
7275
  }
7277
7276
 
@@ -7288,7 +7287,7 @@ var LWC = (function (exports) {
7288
7287
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7289
7288
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7290
7289
 
7291
- var ro = new ReactiveObserver(function () {
7290
+ var ro = createReactiveObserver(function () {
7292
7291
  if (hasPendingConfig === false) {
7293
7292
  hasPendingConfig = true; // collect new config in the micro-task
7294
7293
 
@@ -7484,7 +7483,7 @@ var LWC = (function (exports) {
7484
7483
  ArrayPush$1.call(wiredConnecting, function () {
7485
7484
  connector.connect();
7486
7485
 
7487
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7486
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7488
7487
  if (hasDynamicParams) {
7489
7488
  Promise.resolve().then(computeConfigAndUpdate);
7490
7489
  return;
@@ -7589,7 +7588,7 @@ var LWC = (function (exports) {
7589
7588
  }
7590
7589
  }
7591
7590
 
7592
- return reactiveMembrane.getReadOnlyProxy(obj);
7591
+ return getReadOnlyProxy(obj);
7593
7592
  }
7594
7593
  /*
7595
7594
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8270,7 +8269,7 @@ var LWC = (function (exports) {
8270
8269
 
8271
8270
  return ctor;
8272
8271
  }
8273
- /* version: 2.21.1 */
8272
+ /* version: 2.23.1 */
8274
8273
 
8275
8274
  /*
8276
8275
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8438,6 +8437,85 @@ var LWC = (function (exports) {
8438
8437
  */
8439
8438
 
8440
8439
 
8440
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8441
+ var createFragment;
8442
+
8443
+ if (SUPPORTS_TEMPLATE) {
8444
+ // Parse the fragment HTML string into DOM
8445
+ createFragment = function createFragment(html) {
8446
+ var template = document.createElement('template');
8447
+ template.innerHTML = html;
8448
+ return template.content.firstChild;
8449
+ };
8450
+ } else {
8451
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8452
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8453
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8454
+ // With other elements added from:
8455
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8456
+ // Using the test:
8457
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8458
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8459
+ var topLevelWrappingMap = {
8460
+ caption: ['table'],
8461
+ col: ['colgroup', 'table'],
8462
+ colgroup: ['table'],
8463
+ option: ['select'],
8464
+ tbody: ['table'],
8465
+ td: ['tr', 'tbody', 'table'],
8466
+ th: ['tr', 'tbody', 'table'],
8467
+ thead: ['table'],
8468
+ tfoot: ['table'],
8469
+ tr: ['tbody', 'table']
8470
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8471
+
8472
+ var getTagName = function getTagName(text) {
8473
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8474
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8475
+
8476
+
8477
+ createFragment = function createFragment(html) {
8478
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8479
+
8480
+ if (!isUndefined$1(wrapperTags)) {
8481
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8482
+ _step5;
8483
+
8484
+ try {
8485
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8486
+ var wrapperTag = _step5.value;
8487
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8488
+ }
8489
+ } catch (err) {
8490
+ _iterator5.e(err);
8491
+ } finally {
8492
+ _iterator5.f();
8493
+ }
8494
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8495
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8496
+
8497
+
8498
+ var doc = document.implementation.createHTMLDocument('');
8499
+ doc.body.innerHTML = html;
8500
+ var content = doc.body;
8501
+
8502
+ if (!isUndefined$1(wrapperTags)) {
8503
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8504
+ content = content.firstChild;
8505
+ }
8506
+ }
8507
+
8508
+ return content.firstChild;
8509
+ };
8510
+ }
8511
+ /*
8512
+ * Copyright (c) 2018, salesforce.com, inc.
8513
+ * All rights reserved.
8514
+ * SPDX-License-Identifier: MIT
8515
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8516
+ */
8517
+
8518
+
8441
8519
  var getCustomElement;
8442
8520
  var defineCustomElement;
8443
8521
  var HTMLElementConstructor;
@@ -8519,18 +8597,6 @@ var LWC = (function (exports) {
8519
8597
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8520
8598
  }
8521
8599
 
8522
- var hydrating = false;
8523
-
8524
- function setIsHydrating(value) {
8525
- hydrating = value;
8526
- }
8527
-
8528
- var ssr = false;
8529
-
8530
- function isHydrating() {
8531
- return hydrating;
8532
- }
8533
-
8534
8600
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8535
8601
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8536
8602
 
@@ -8538,10 +8604,6 @@ var LWC = (function (exports) {
8538
8604
  return node.cloneNode(deep);
8539
8605
  }
8540
8606
 
8541
- function createFragment(html) {
8542
- return document.createRange().createContextualFragment(html).firstChild;
8543
- }
8544
-
8545
8607
  function createElement$1(tagName, namespace) {
8546
8608
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8547
8609
  }
@@ -8567,15 +8629,11 @@ var LWC = (function (exports) {
8567
8629
  }
8568
8630
 
8569
8631
  function attachShadow(element, options) {
8570
- // `hydrating` will be true in two cases:
8632
+ // `shadowRoot` will be non-null in two cases:
8571
8633
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8572
8634
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
8573
- // root component with customeElement.define('c-app', Ctor)
8574
- //
8575
- // The second case can be treated as a failed hydration with nominal impact
8576
- // to performance. However, because <c-app> won't have a <template shadowroot>
8577
- // declarative child, `element.shadowRoot` is `null`.
8578
- if (hydrating && element.shadowRoot) {
8635
+ // root component with customElement.define('c-app', Ctor)
8636
+ if (!isNull(element.shadowRoot)) {
8579
8637
  return element.shadowRoot;
8580
8638
  }
8581
8639
 
@@ -8693,11 +8751,9 @@ var LWC = (function (exports) {
8693
8751
 
8694
8752
  var HTMLElementExported = HTMLElementConstructor;
8695
8753
  var renderer = {
8696
- ssr: ssr,
8697
8754
  isNativeShadowDefined: isNativeShadowDefined,
8698
8755
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8699
8756
  HTMLElementExported: HTMLElementExported,
8700
- isHydrating: isHydrating,
8701
8757
  insert: insert,
8702
8758
  remove: remove,
8703
8759
  cloneNode: cloneNode,
@@ -8766,8 +8822,8 @@ var LWC = (function (exports) {
8766
8822
  hydrated: true
8767
8823
  });
8768
8824
 
8769
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8770
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8825
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8826
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8771
8827
  key = _Object$entries2$_i[0],
8772
8828
  value = _Object$entries2$_i[1];
8773
8829
 
@@ -8799,13 +8855,8 @@ var LWC = (function (exports) {
8799
8855
  }
8800
8856
 
8801
8857
  try {
8802
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8803
- // and uses the same algo to create the stylesheets as in SSR.
8804
- setIsHydrating(true);
8805
8858
  var vm = createVMWithProps(element, Ctor, props);
8806
- hydrateRoot(vm); // set it back since now we finished hydration.
8807
-
8808
- setIsHydrating(false);
8859
+ hydrateRoot(vm);
8809
8860
  } catch (e) {
8810
8861
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8811
8862
  // with the client generated DOM.
@@ -8816,11 +8867,7 @@ var LWC = (function (exports) {
8816
8867
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8817
8868
 
8818
8869
  createVMWithProps(element, Ctor, props);
8819
- setIsHydrating(false);
8820
8870
  connectRootElement(element);
8821
- } finally {
8822
- // in case there's an error during recovery
8823
- setIsHydrating(false);
8824
8871
  }
8825
8872
  }
8826
8873
  /*
@@ -9099,7 +9146,7 @@ var LWC = (function (exports) {
9099
9146
  });
9100
9147
  freeze(LightningElement);
9101
9148
  seal(LightningElement.prototype);
9102
- /* version: 2.21.1 */
9149
+ /* version: 2.23.1 */
9103
9150
 
9104
9151
  exports.LightningElement = LightningElement;
9105
9152
  exports.__unstable__ProfilerControl = profilerControl;