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
@@ -368,9 +368,13 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.21.1";
371
+ var LWC_VERSION = "2.23.1";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.21.1 */
373
+ /** version: 2.23.1 */
374
+
375
+ /**
376
+ * Copyright (C) 2018 salesforce.com, inc.
377
+ */
374
378
 
375
379
  /*
376
380
  * Copyright (c) 2018, salesforce.com, inc.
@@ -380,7 +384,7 @@
380
384
  */
381
385
 
382
386
  function detect(propName) {
383
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
387
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
384
388
  }
385
389
  /*
386
390
  * Copyright (c) 2018, salesforce.com, inc.
@@ -460,6 +464,8 @@
460
464
  patch$1(propName);
461
465
  }
462
466
  }
467
+ /** version: 2.23.1 */
468
+
463
469
  /**
464
470
  * Copyright (C) 2018 salesforce.com, inc.
465
471
  */
@@ -492,7 +498,7 @@
492
498
  });
493
499
  }
494
500
 
495
- var runtimeFlags = _globalThis.lwcRuntimeFlags;
501
+ var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
496
502
  /**
497
503
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
498
504
  * flag. It is meant to be used during the app initialization.
@@ -522,10 +528,10 @@
522
528
 
523
529
  if (process.env.NODE_ENV !== 'production') {
524
530
  // Allow the same flag to be set more than once outside of production to enable testing
525
- runtimeFlags[name] = value;
531
+ lwcRuntimeFlags[name] = value;
526
532
  } else {
527
533
  // Disallow the same flag to be set more than once in production
528
- var runtimeValue = runtimeFlags[name];
534
+ var runtimeValue = lwcRuntimeFlags[name];
529
535
 
530
536
  if (!isUndefined$1(runtimeValue)) {
531
537
  // eslint-disable-next-line no-console
@@ -533,7 +539,7 @@
533
539
  return;
534
540
  }
535
541
 
536
- defineProperty(runtimeFlags, name, {
542
+ defineProperty(lwcRuntimeFlags, name, {
537
543
  value: value
538
544
  });
539
545
  }
@@ -549,7 +555,7 @@
549
555
  setFeatureFlag(name, value);
550
556
  }
551
557
  }
552
- /** version: 2.21.1 */
558
+ /** version: 2.23.1 */
553
559
 
554
560
  /*
555
561
  * Copyright (c) 2018, salesforce.com, inc.
@@ -564,7 +570,7 @@
564
570
  window.addEventListener('test-dummy-flag', function () {
565
571
  var hasFlag = false;
566
572
 
567
- if (runtimeFlags.DUMMY_TEST_FLAG) {
573
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
568
574
  hasFlag = true;
569
575
  }
570
576
 
@@ -591,7 +597,7 @@
591
597
  window.addEventListener('test-dummy-flag', function () {
592
598
  var hasFlag = false;
593
599
 
594
- if (runtimeFlags.DUMMY_TEST_FLAG) {
600
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
595
601
  hasFlag = true;
596
602
  }
597
603
 
@@ -855,20 +861,24 @@
855
861
 
856
862
  return ReactiveObserver;
857
863
  }();
858
- /*
859
- * Copyright (c) 2018, salesforce.com, inc.
860
- * All rights reserved.
861
- * SPDX-License-Identifier: MIT
862
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
863
- */
864
-
865
864
 
866
865
  function componentValueMutated(vm, key) {
867
- valueMutated(vm.component, key);
866
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
867
+ {
868
+ valueMutated(vm.component, key);
869
+ }
868
870
  }
869
871
 
870
872
  function componentValueObserved(vm, key) {
871
- valueObserved(vm.component, key);
873
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
874
+ {
875
+ valueObserved(vm.component, key);
876
+ }
877
+ }
878
+
879
+ function createReactiveObserver(callback) {
880
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
881
+ return new ReactiveObserver(callback);
872
882
  }
873
883
  /*
874
884
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1476,6 +1486,15 @@
1476
1486
  function patchLightningElementPrototypeWithRestrictions(proto) {
1477
1487
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1478
1488
  }
1489
+
1490
+ function updateComponentValue(vm, key, newValue) {
1491
+ var cmpFields = vm.cmpFields;
1492
+
1493
+ if (newValue !== cmpFields[key]) {
1494
+ cmpFields[key] = newValue;
1495
+ componentValueMutated(vm, key);
1496
+ }
1497
+ }
1479
1498
  /**
1480
1499
  * Copyright (C) 2017 salesforce.com, inc.
1481
1500
  */
@@ -2283,8 +2302,28 @@
2283
2302
  */
2284
2303
 
2285
2304
  function unwrap(value) {
2305
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2286
2306
  return reactiveMembrane.unwrapProxy(value);
2287
2307
  }
2308
+
2309
+ function getReadOnlyProxy(value) {
2310
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2311
+ // them from their parents. This applies to both the client and server.
2312
+ return reactiveMembrane.getReadOnlyProxy(value);
2313
+ }
2314
+
2315
+ function getReactiveProxy(value) {
2316
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2317
+ return reactiveMembrane.getProxy(value);
2318
+ } // Making the component instance a live value when using Locker to support expandos.
2319
+
2320
+
2321
+ function markLockerLiveObject(obj) {
2322
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2323
+ {
2324
+ obj[lockerLivePropertyKey] = undefined;
2325
+ }
2326
+ }
2288
2327
  /*
2289
2328
  * Copyright (c) 2018, salesforce.com, inc.
2290
2329
  * All rights reserved.
@@ -2351,11 +2390,7 @@
2351
2390
  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."));
2352
2391
  }
2353
2392
 
2354
- if (newValue !== vm.cmpProps[propName]) {
2355
- vm.cmpProps[propName] = newValue;
2356
- componentValueMutated(vm, propName);
2357
- }
2358
-
2393
+ updateComponentValue(vm, propName, newValue);
2359
2394
  return _set.call(vm.elm, newValue);
2360
2395
  }
2361
2396
  };
@@ -2399,10 +2434,9 @@
2399
2434
  vm.callHook = _callHook;
2400
2435
  vm.setHook = _setHook;
2401
2436
  vm.getHook = _getHook;
2402
- } // Making the component instance a live value when using Locker to support expandos.
2403
-
2437
+ }
2404
2438
 
2405
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2439
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2406
2440
 
2407
2441
  associateVM(component, vm);
2408
2442
  associateVM(elm, vm);
@@ -2732,60 +2766,7 @@
2732
2766
  },
2733
2767
  set: function set(newValue) {
2734
2768
  var vm = getAssociatedVM(this);
2735
-
2736
- if (newValue !== vm.cmpFields[key]) {
2737
- vm.cmpFields[key] = newValue;
2738
- componentValueMutated(vm, key);
2739
- }
2740
- },
2741
- enumerable: true,
2742
- configurable: true
2743
- };
2744
- }
2745
- /*
2746
- * Copyright (c) 2018, salesforce.com, inc.
2747
- * All rights reserved.
2748
- * SPDX-License-Identifier: MIT
2749
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2750
- */
2751
-
2752
-
2753
- function api$1() {
2754
- if (process.env.NODE_ENV !== 'production') {
2755
- assert.fail("@api decorator can only be used as a decorator function.");
2756
- }
2757
-
2758
- throw new Error();
2759
- }
2760
-
2761
- function createPublicPropertyDescriptor(key) {
2762
- return {
2763
- get: function get() {
2764
- var vm = getAssociatedVM(this);
2765
-
2766
- if (isBeingConstructed(vm)) {
2767
- if (process.env.NODE_ENV !== 'production') {
2768
- 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);
2769
- }
2770
-
2771
- return;
2772
- }
2773
-
2774
- componentValueObserved(vm, key);
2775
- return vm.cmpProps[key];
2776
- },
2777
- set: function set(newValue) {
2778
- var vm = getAssociatedVM(this);
2779
-
2780
- if (process.env.NODE_ENV !== 'production') {
2781
- var _vmBeingRendered3 = getVMBeingRendered();
2782
-
2783
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2784
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2785
- }
2786
-
2787
- vm.cmpProps[key] = newValue;
2788
- componentValueMutated(vm, key);
2769
+ updateComponentValue(vm, key, newValue);
2789
2770
  },
2790
2771
  enumerable: true,
2791
2772
  configurable: true
@@ -2849,6 +2830,60 @@
2849
2830
  return AccessorReactiveObserver;
2850
2831
  }(ReactiveObserver);
2851
2832
 
2833
+ function createAccessorReactiveObserver(vm, set) {
2834
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2835
+ return new AccessorReactiveObserver(vm, set);
2836
+ }
2837
+ /*
2838
+ * Copyright (c) 2018, salesforce.com, inc.
2839
+ * All rights reserved.
2840
+ * SPDX-License-Identifier: MIT
2841
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2842
+ */
2843
+
2844
+
2845
+ function api$1() {
2846
+ if (process.env.NODE_ENV !== 'production') {
2847
+ assert.fail("@api decorator can only be used as a decorator function.");
2848
+ }
2849
+
2850
+ throw new Error();
2851
+ }
2852
+
2853
+ function createPublicPropertyDescriptor(key) {
2854
+ return {
2855
+ get: function get() {
2856
+ var vm = getAssociatedVM(this);
2857
+
2858
+ if (isBeingConstructed(vm)) {
2859
+ if (process.env.NODE_ENV !== 'production') {
2860
+ 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);
2861
+ }
2862
+
2863
+ return;
2864
+ }
2865
+
2866
+ componentValueObserved(vm, key);
2867
+ return vm.cmpProps[key];
2868
+ },
2869
+ set: function set(newValue) {
2870
+ var vm = getAssociatedVM(this);
2871
+
2872
+ if (process.env.NODE_ENV !== 'production') {
2873
+ var _vmBeingRendered3 = getVMBeingRendered();
2874
+
2875
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2876
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2877
+ }
2878
+
2879
+ vm.cmpProps[key] = newValue;
2880
+ componentValueMutated(vm, key);
2881
+ },
2882
+ enumerable: true,
2883
+ configurable: true
2884
+ };
2885
+ }
2886
+
2852
2887
  function createPublicAccessorDescriptor(key, descriptor) {
2853
2888
  var _get3 = descriptor.get,
2854
2889
  _set2 = descriptor.set,
@@ -2885,11 +2920,11 @@
2885
2920
  }
2886
2921
 
2887
2922
  if (_set2) {
2888
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2923
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2889
2924
  var ro = vm.oar[key];
2890
2925
 
2891
2926
  if (isUndefined$1(ro)) {
2892
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2927
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2893
2928
  } // every time we invoke this setter from outside (through this wrapper setter)
2894
2929
  // we should reset the value and then debounce just in case there is a pending
2895
2930
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2921,7 +2956,7 @@
2921
2956
 
2922
2957
  function track(target) {
2923
2958
  if (arguments.length === 1) {
2924
- return reactiveMembrane.getProxy(target);
2959
+ return getReactiveProxy(target);
2925
2960
  }
2926
2961
 
2927
2962
  if (process.env.NODE_ENV !== 'production') {
@@ -2948,12 +2983,8 @@
2948
2983
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2949
2984
  }
2950
2985
 
2951
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2952
-
2953
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2954
- vm.cmpFields[key] = reactiveOrAnyValue;
2955
- componentValueMutated(vm, key);
2956
- }
2986
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2987
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2957
2988
  },
2958
2989
  enumerable: true,
2959
2990
  configurable: true
@@ -2997,10 +3028,7 @@
2997
3028
  * system to be backward compatible.
2998
3029
  */
2999
3030
 
3000
- if (value !== vm.cmpFields[key]) {
3001
- vm.cmpFields[key] = value;
3002
- componentValueMutated(vm, key);
3003
- }
3031
+ updateComponentValue(vm, key, value);
3004
3032
  },
3005
3033
  enumerable: true,
3006
3034
  configurable: true
@@ -3423,7 +3451,7 @@
3423
3451
  fn = cachedSetterByKey[key] = function (newValue) {
3424
3452
  var vm = getAssociatedVM(this);
3425
3453
  var setHook = vm.setHook;
3426
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3454
+ newValue = getReadOnlyProxy(newValue);
3427
3455
  setHook(vm.component, key, newValue);
3428
3456
  };
3429
3457
  }
@@ -3657,7 +3685,7 @@
3657
3685
  throw new ReferenceError();
3658
3686
  }
3659
3687
 
3660
- if (runtimeFlags.ENABLE_HMR) {
3688
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3661
3689
  var visited = new Set();
3662
3690
 
3663
3691
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
@@ -3675,7 +3703,7 @@
3675
3703
  throw new ReferenceError();
3676
3704
  }
3677
3705
 
3678
- if (runtimeFlags.ENABLE_HMR) {
3706
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3679
3707
  var visited = new Set();
3680
3708
 
3681
3709
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
@@ -3693,7 +3721,7 @@
3693
3721
  throw new ReferenceError();
3694
3722
  }
3695
3723
 
3696
- if (runtimeFlags.ENABLE_HMR) {
3724
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3697
3725
  var visited = new Set();
3698
3726
 
3699
3727
  while (swappedStyleMap.has(style) && !visited.has(style)) {
@@ -3711,7 +3739,7 @@
3711
3739
  throw new ReferenceError();
3712
3740
  }
3713
3741
 
3714
- if (runtimeFlags.ENABLE_HMR) {
3742
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3715
3743
  // tracking active component
3716
3744
  var Ctor = vm.def.ctor;
3717
3745
  var componentVMs = activeComponents.get(Ctor);
@@ -3769,7 +3797,7 @@
3769
3797
  throw new ReferenceError();
3770
3798
  }
3771
3799
 
3772
- if (runtimeFlags.ENABLE_HMR) {
3800
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3773
3801
  // tracking inactive component
3774
3802
  var Ctor = vm.def.ctor;
3775
3803
  var list = activeComponents.get(Ctor);
@@ -3817,7 +3845,7 @@
3817
3845
  }
3818
3846
  }
3819
3847
 
3820
- if (!runtimeFlags.ENABLE_HMR) {
3848
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3821
3849
  throw new Error('HMR is not enabled');
3822
3850
  }
3823
3851
 
@@ -3834,7 +3862,7 @@
3834
3862
  }
3835
3863
  }
3836
3864
 
3837
- if (!runtimeFlags.ENABLE_HMR) {
3865
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3838
3866
  throw new Error('HMR is not enabled');
3839
3867
  }
3840
3868
 
@@ -3849,7 +3877,7 @@
3849
3877
  return rehydrateHotStyle(oldStyle);
3850
3878
  }
3851
3879
 
3852
- if (!runtimeFlags.ENABLE_HMR) {
3880
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3853
3881
  throw new Error('HMR is not enabled');
3854
3882
  }
3855
3883
 
@@ -4323,9 +4351,7 @@
4323
4351
  function createStylesheet(vm, stylesheets) {
4324
4352
  var renderMode = vm.renderMode,
4325
4353
  shadowMode = vm.shadowMode,
4326
- _vm$renderer2 = vm.renderer,
4327
- ssr = _vm$renderer2.ssr,
4328
- insertStylesheet = _vm$renderer2.insertStylesheet;
4354
+ insertStylesheet = vm.renderer.insertStylesheet;
4329
4355
 
4330
4356
  if (renderMode === 1
4331
4357
  /* RenderMode.Shadow */
@@ -4335,7 +4361,7 @@
4335
4361
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4336
4362
  insertStylesheet(stylesheets[_i12]);
4337
4363
  }
4338
- } else if (ssr || vm.hydrated) {
4364
+ } else if (vm.hydrated) {
4339
4365
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4340
4366
  // This works in the client, because the stylesheets are created, and cached in the VM
4341
4367
  // the first time the VM renders.
@@ -4721,7 +4747,7 @@
4721
4747
  }
4722
4748
  }
4723
4749
 
4724
- function patch(n1, n2, renderer) {
4750
+ function patch(n1, n2, parent, renderer) {
4725
4751
  var _a, _b;
4726
4752
 
4727
4753
  if (n1 === n2) {
@@ -4770,7 +4796,7 @@
4770
4796
  case 3
4771
4797
  /* VNodeType.CustomElement */
4772
4798
  :
4773
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4799
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4774
4800
  break;
4775
4801
  }
4776
4802
  }
@@ -4942,25 +4968,34 @@
4942
4968
  }
4943
4969
  }
4944
4970
 
4945
- function patchCustomElement(n1, n2, renderer) {
4946
- var elm = n2.elm = n1.elm;
4947
- var vm = n2.vm = n1.vm;
4948
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4971
+ function patchCustomElement(n1, n2, parent, renderer) {
4972
+ if (n1.ctor !== n2.ctor) {
4973
+ // If the constructor, unmount the current component and mount a new one using the new
4974
+ // constructor.
4975
+ var anchor = renderer.nextSibling(n1.elm);
4976
+ unmount(n1, parent, renderer, true);
4977
+ mountCustomElement(n2, parent, anchor, renderer);
4978
+ } else {
4979
+ // Otherwise patch the existing component with new props/attrs/etc.
4980
+ var elm = n2.elm = n1.elm;
4981
+ var vm = n2.vm = n1.vm;
4982
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4949
4983
 
4950
- if (!isUndefined$1(vm)) {
4951
- // in fallback mode, the allocation will always set children to
4952
- // empty and delegate the real allocation to the slot elements
4953
- allocateChildren(n2, vm);
4954
- } // in fallback mode, the children will be always empty, so, nothing
4955
- // will happen, but in native, it does allocate the light dom
4984
+ if (!isUndefined$1(vm)) {
4985
+ // in fallback mode, the allocation will always set children to
4986
+ // empty and delegate the real allocation to the slot elements
4987
+ allocateChildren(n2, vm);
4988
+ } // in fallback mode, the children will be always empty, so, nothing
4989
+ // will happen, but in native, it does allocate the light dom
4956
4990
 
4957
4991
 
4958
- patchChildren(n1.children, n2.children, elm, renderer);
4992
+ patchChildren(n1.children, n2.children, elm, renderer);
4959
4993
 
4960
- if (!isUndefined$1(vm)) {
4961
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4962
- // this is important to preserve the top to bottom synchronous rendering phase.
4963
- rerenderVM(vm);
4994
+ if (!isUndefined$1(vm)) {
4995
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4996
+ // this is important to preserve the top to bottom synchronous rendering phase.
4997
+ rerenderVM(vm);
4998
+ }
4964
4999
  }
4965
5000
  }
4966
5001
 
@@ -5329,22 +5364,22 @@
5329
5364
  } else if (!isVNode(newEndVnode)) {
5330
5365
  newEndVnode = newCh[--newEndIdx];
5331
5366
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5332
- patch(oldStartVnode, newStartVnode, renderer);
5367
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5333
5368
  oldStartVnode = oldCh[++oldStartIdx];
5334
5369
  newStartVnode = newCh[++newStartIdx];
5335
5370
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5336
- patch(oldEndVnode, newEndVnode, renderer);
5371
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5337
5372
  oldEndVnode = oldCh[--oldEndIdx];
5338
5373
  newEndVnode = newCh[--newEndIdx];
5339
5374
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5340
5375
  // Vnode moved right
5341
- patch(oldStartVnode, newEndVnode, renderer);
5376
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5342
5377
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5343
5378
  oldStartVnode = oldCh[++oldStartIdx];
5344
5379
  newEndVnode = newCh[--newEndIdx];
5345
5380
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5346
5381
  // Vnode moved left
5347
- patch(oldEndVnode, newStartVnode, renderer);
5382
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5348
5383
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5349
5384
  oldEndVnode = oldCh[--oldEndIdx];
5350
5385
  newStartVnode = newCh[++newStartIdx];
@@ -5367,7 +5402,7 @@
5367
5402
  // New element
5368
5403
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5369
5404
  } else {
5370
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5405
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5371
5406
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5372
5407
  // so we only care about the `oldCh` object inside this function.
5373
5408
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5437,7 +5472,7 @@
5437
5472
  if (isVNode(n1)) {
5438
5473
  if (isVNode(n2)) {
5439
5474
  // both vnodes are equivalent, and we just need to patch them
5440
- patch(n1, n2, renderer);
5475
+ patch(n1, n2, parent, renderer);
5441
5476
  anchor = n2.elm;
5442
5477
  } else {
5443
5478
  // removing the old vnode since the new one is null
@@ -5852,19 +5887,11 @@
5852
5887
 
5853
5888
  return url;
5854
5889
  }
5855
- /**
5856
- * Map to store an index value assigned to any dynamic component reference ingested
5857
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5858
- * component reference to avoid diffing algo mismatches.
5859
- */
5860
-
5861
-
5862
- var DynamicImportedComponentMap = new Map();
5863
- var dynamicImportedComponentCounter = 0;
5864
5890
  /**
5865
5891
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5866
5892
  */
5867
5893
 
5894
+
5868
5895
  function dc(sel, Ctor, data) {
5869
5896
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5870
5897
 
@@ -5883,22 +5910,7 @@
5883
5910
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5884
5911
  }
5885
5912
 
5886
- var idx = DynamicImportedComponentMap.get(Ctor);
5887
-
5888
- if (isUndefined$1(idx)) {
5889
- idx = dynamicImportedComponentCounter++;
5890
- DynamicImportedComponentMap.set(Ctor, idx);
5891
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5892
- // to identify different constructors as vnodes with different keys to avoid reusing the
5893
- // element used for previous constructors.
5894
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5895
- // hoisting optimization.
5896
-
5897
-
5898
- var newData = Object.assign(Object.assign({}, data), {
5899
- key: "dc:".concat(idx, ":").concat(data.key)
5900
- });
5901
- return c(sel, Ctor, newData, children);
5913
+ return c(sel, Ctor, data, children);
5902
5914
  }
5903
5915
  /**
5904
5916
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6472,7 +6484,7 @@
6472
6484
  }
6473
6485
 
6474
6486
  function getTemplateReactiveObserver(vm) {
6475
- return new ReactiveObserver(function () {
6487
+ return createReactiveObserver(function () {
6476
6488
  var isDirty = vm.isDirty;
6477
6489
 
6478
6490
  if (isFalse(isDirty)) {
@@ -6745,7 +6757,7 @@
6745
6757
  return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
6746
6758
  };
6747
6759
 
6748
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6760
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6749
6761
  vm.shadowMode = 0
6750
6762
  /* ShadowMode.Native */
6751
6763
  ;
@@ -6780,7 +6792,7 @@
6780
6792
  } else if (isNativeShadowDefined) {
6781
6793
  // Not combined with above condition because @lwc/features only supports identifiers in
6782
6794
  // the if-condition.
6783
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6795
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6784
6796
  if (def.shadowSupportMode === "any"
6785
6797
  /* ShadowSupportMode.Any */
6786
6798
  ) {
@@ -6906,13 +6918,7 @@
6906
6918
  }
6907
6919
 
6908
6920
  function runRenderedCallback(vm) {
6909
- var renderedCallback = vm.def.renderedCallback,
6910
- ssr = vm.renderer.ssr;
6911
-
6912
- if (isTrue(ssr)) {
6913
- return;
6914
- }
6915
-
6921
+ var renderedCallback = vm.def.renderedCallback;
6916
6922
  var rendered = Services.rendered;
6917
6923
 
6918
6924
  if (rendered) {
@@ -7144,9 +7150,7 @@
7144
7150
  }
7145
7151
 
7146
7152
  function scheduleRehydration(vm) {
7147
- var ssr = vm.renderer.ssr;
7148
-
7149
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7153
+ if (isTrue(vm.isScheduled)) {
7150
7154
  return;
7151
7155
  }
7152
7156
 
@@ -7268,13 +7272,8 @@
7268
7272
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7269
7273
 
7270
7274
  function createFieldDataCallback(vm, name) {
7271
- var cmpFields = vm.cmpFields;
7272
7275
  return function (value) {
7273
- if (value !== vm.cmpFields[name]) {
7274
- // storing the value in the underlying storage
7275
- cmpFields[name] = value;
7276
- componentValueMutated(vm, name);
7277
- }
7276
+ updateComponentValue(vm, name, value);
7278
7277
  };
7279
7278
  }
7280
7279
 
@@ -7291,7 +7290,7 @@
7291
7290
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7292
7291
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7293
7292
 
7294
- var ro = new ReactiveObserver(function () {
7293
+ var ro = createReactiveObserver(function () {
7295
7294
  if (hasPendingConfig === false) {
7296
7295
  hasPendingConfig = true; // collect new config in the micro-task
7297
7296
 
@@ -7487,7 +7486,7 @@
7487
7486
  ArrayPush$1.call(wiredConnecting, function () {
7488
7487
  connector.connect();
7489
7488
 
7490
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7489
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7491
7490
  if (hasDynamicParams) {
7492
7491
  Promise.resolve().then(computeConfigAndUpdate);
7493
7492
  return;
@@ -7592,7 +7591,7 @@
7592
7591
  }
7593
7592
  }
7594
7593
 
7595
- return reactiveMembrane.getReadOnlyProxy(obj);
7594
+ return getReadOnlyProxy(obj);
7596
7595
  }
7597
7596
  /*
7598
7597
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8273,7 +8272,7 @@
8273
8272
 
8274
8273
  return ctor;
8275
8274
  }
8276
- /* version: 2.21.1 */
8275
+ /* version: 2.23.1 */
8277
8276
 
8278
8277
  /*
8279
8278
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8441,6 +8440,85 @@
8441
8440
  */
8442
8441
 
8443
8442
 
8443
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8444
+ var createFragment;
8445
+
8446
+ if (SUPPORTS_TEMPLATE) {
8447
+ // Parse the fragment HTML string into DOM
8448
+ createFragment = function createFragment(html) {
8449
+ var template = document.createElement('template');
8450
+ template.innerHTML = html;
8451
+ return template.content.firstChild;
8452
+ };
8453
+ } else {
8454
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8455
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8456
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8457
+ // With other elements added from:
8458
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8459
+ // Using the test:
8460
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8461
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8462
+ var topLevelWrappingMap = {
8463
+ caption: ['table'],
8464
+ col: ['colgroup', 'table'],
8465
+ colgroup: ['table'],
8466
+ option: ['select'],
8467
+ tbody: ['table'],
8468
+ td: ['tr', 'tbody', 'table'],
8469
+ th: ['tr', 'tbody', 'table'],
8470
+ thead: ['table'],
8471
+ tfoot: ['table'],
8472
+ tr: ['tbody', 'table']
8473
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8474
+
8475
+ var getTagName = function getTagName(text) {
8476
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8477
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8478
+
8479
+
8480
+ createFragment = function createFragment(html) {
8481
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8482
+
8483
+ if (!isUndefined$1(wrapperTags)) {
8484
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8485
+ _step5;
8486
+
8487
+ try {
8488
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8489
+ var wrapperTag = _step5.value;
8490
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8491
+ }
8492
+ } catch (err) {
8493
+ _iterator5.e(err);
8494
+ } finally {
8495
+ _iterator5.f();
8496
+ }
8497
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8498
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8499
+
8500
+
8501
+ var doc = document.implementation.createHTMLDocument('');
8502
+ doc.body.innerHTML = html;
8503
+ var content = doc.body;
8504
+
8505
+ if (!isUndefined$1(wrapperTags)) {
8506
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8507
+ content = content.firstChild;
8508
+ }
8509
+ }
8510
+
8511
+ return content.firstChild;
8512
+ };
8513
+ }
8514
+ /*
8515
+ * Copyright (c) 2018, salesforce.com, inc.
8516
+ * All rights reserved.
8517
+ * SPDX-License-Identifier: MIT
8518
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8519
+ */
8520
+
8521
+
8444
8522
  var getCustomElement;
8445
8523
  var defineCustomElement;
8446
8524
  var HTMLElementConstructor;
@@ -8522,18 +8600,6 @@
8522
8600
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8523
8601
  }
8524
8602
 
8525
- var hydrating = false;
8526
-
8527
- function setIsHydrating(value) {
8528
- hydrating = value;
8529
- }
8530
-
8531
- var ssr = false;
8532
-
8533
- function isHydrating() {
8534
- return hydrating;
8535
- }
8536
-
8537
8603
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8538
8604
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8539
8605
 
@@ -8541,10 +8607,6 @@
8541
8607
  return node.cloneNode(deep);
8542
8608
  }
8543
8609
 
8544
- function createFragment(html) {
8545
- return document.createRange().createContextualFragment(html).firstChild;
8546
- }
8547
-
8548
8610
  function createElement$1(tagName, namespace) {
8549
8611
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8550
8612
  }
@@ -8570,15 +8632,11 @@
8570
8632
  }
8571
8633
 
8572
8634
  function attachShadow(element, options) {
8573
- // `hydrating` will be true in two cases:
8635
+ // `shadowRoot` will be non-null in two cases:
8574
8636
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8575
8637
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
8576
- // root component with customeElement.define('c-app', Ctor)
8577
- //
8578
- // The second case can be treated as a failed hydration with nominal impact
8579
- // to performance. However, because <c-app> won't have a <template shadowroot>
8580
- // declarative child, `element.shadowRoot` is `null`.
8581
- if (hydrating && element.shadowRoot) {
8638
+ // root component with customElement.define('c-app', Ctor)
8639
+ if (!isNull(element.shadowRoot)) {
8582
8640
  return element.shadowRoot;
8583
8641
  }
8584
8642
 
@@ -8696,11 +8754,9 @@
8696
8754
 
8697
8755
  var HTMLElementExported = HTMLElementConstructor;
8698
8756
  var renderer = {
8699
- ssr: ssr,
8700
8757
  isNativeShadowDefined: isNativeShadowDefined,
8701
8758
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8702
8759
  HTMLElementExported: HTMLElementExported,
8703
- isHydrating: isHydrating,
8704
8760
  insert: insert,
8705
8761
  remove: remove,
8706
8762
  cloneNode: cloneNode,
@@ -8769,8 +8825,8 @@
8769
8825
  hydrated: true
8770
8826
  });
8771
8827
 
8772
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8773
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8828
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8829
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8774
8830
  key = _Object$entries2$_i[0],
8775
8831
  value = _Object$entries2$_i[1];
8776
8832
 
@@ -8802,13 +8858,8 @@
8802
8858
  }
8803
8859
 
8804
8860
  try {
8805
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8806
- // and uses the same algo to create the stylesheets as in SSR.
8807
- setIsHydrating(true);
8808
8861
  var vm = createVMWithProps(element, Ctor, props);
8809
- hydrateRoot(vm); // set it back since now we finished hydration.
8810
-
8811
- setIsHydrating(false);
8862
+ hydrateRoot(vm);
8812
8863
  } catch (e) {
8813
8864
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8814
8865
  // with the client generated DOM.
@@ -8819,11 +8870,7 @@
8819
8870
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8820
8871
 
8821
8872
  createVMWithProps(element, Ctor, props);
8822
- setIsHydrating(false);
8823
8873
  connectRootElement(element);
8824
- } finally {
8825
- // in case there's an error during recovery
8826
- setIsHydrating(false);
8827
8874
  }
8828
8875
  }
8829
8876
  /*
@@ -9102,7 +9149,7 @@
9102
9149
  });
9103
9150
  freeze(LightningElement);
9104
9151
  seal(LightningElement.prototype);
9105
- /* version: 2.21.1 */
9152
+ /* version: 2.23.1 */
9106
9153
 
9107
9154
  exports.LightningElement = LightningElement;
9108
9155
  exports.__unstable__ProfilerControl = profilerControl;