@lwrjs/everywhere 0.15.0-alpha.3 → 0.15.0-alpha.30

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 (24) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/68c12ab93bd89425da9a20c23429115e/config.js +12 -0
  2. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_15_0-alpha_30/s/919257b41a9580e75593ced3c41b76d1/@lwrjs_app-service_amd-bootstrap_module_amd.js +20 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{7_2_1/s/78ef23818e3b886f8d3d93ec49c1ee0c → 8_1_2/s/30f80947a7bf5c6581bed3149ee4c985}/lwc.js +561 -186
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/d7186d4fbbc58762dab0d51cc1f0afb8/lwr_init.js +21 -21
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_15_0-alpha_3/s/bda78c192db1d8e0b0b844aa3ee16621 → 0_15_0-alpha_30/s/ecd8405e95e0b9647de436e26ca2c4ec}/lwr_loader.js +4 -4
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/ec0fad0e38a96bb0b88c9f4553460347/lwr_preInit.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/lwr-error-shim.js +1 -1
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_15_0-alpha_3 → 0_15_0-alpha_30}/lwr-loader-shim.bundle.js +7 -7
  13. package/build/assets/amd/lwr-everywhere-debug.js +9 -9
  14. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  15. package/build/assets/amd/lwr-everywhere.js +9 -9
  16. package/build/assets/core/lwr-everywhere-debug.js +5 -5
  17. package/build/assets/core/lwr-everywhere-min.js +1 -1
  18. package/build/assets/core/lwr-everywhere.js +5 -5
  19. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  20. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  21. package/build/assets/esm/lwr-everywhere.js +1 -1
  22. package/package.json +9 -9
  23. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/64de52fb21fc0eaf243d8939e153388a/config.js +0 -12
  24. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_15_0-alpha_3/s/272183c0b6e02561b7c96a1b23473837/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
@@ -1,4 +1,4 @@
1
- LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwc/v/8_1_2', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * Copyright (c) 2024 Salesforce, Inc.
@@ -82,6 +82,8 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
82
82
  getOwnPropertyDescriptors,
83
83
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
84
84
  getOwnPropertyNames: getOwnPropertyNames$1,
85
+ /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
86
+ getOwnPropertySymbols: getOwnPropertySymbols$1,
85
87
  /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
86
88
  getPrototypeOf: getPrototypeOf$1,
87
89
  /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
@@ -95,9 +97,11 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
95
97
  /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
96
98
  setPrototypeOf
97
99
  } = Object;
98
- /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
99
100
  const {
100
- isArray: isArray$1
101
+ /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
102
+ isArray: isArray$1,
103
+ /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
104
+ from: ArrayFrom
101
105
  } = Array;
102
106
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
103
107
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
@@ -202,7 +206,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
202
206
  * @returns `true` if the value is a function.
203
207
  */
204
208
  // Replacing `Function` with a narrower type that works for all our use cases is tricky...
205
- // eslint-disable-next-line @typescript-eslint/ban-types
209
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
206
210
  function isFunction$1(obj) {
207
211
  return typeof obj === 'function';
208
212
  }
@@ -293,7 +297,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
293
297
  // These must be updated when the enum is updated.
294
298
  // It's a bit annoying to do have to do this manually, but this makes the file tree-shakeable,
295
299
  // passing the `verify-treeshakeable.js` test.
296
- const allVersions = [58 /* APIVersion.V58_244_SUMMER_23 */, 59 /* APIVersion.V59_246_WINTER_24 */, 60 /* APIVersion.V60_248_SPRING_24 */, 61 /* APIVersion.V61_250_SUMMER_24 */, 62 /* APIVersion.V62_252_WINTER_25 */];
300
+ const allVersions = [58 /* APIVersion.V58_244_SUMMER_23 */, 59 /* APIVersion.V59_246_WINTER_24 */, 60 /* APIVersion.V60_248_SPRING_24 */, 61 /* APIVersion.V61_250_SUMMER_24 */, 62 /* APIVersion.V62_252_WINTER_25 */, 63 /* APIVersion.V63_254_SPRING_25 */];
297
301
  const LOWEST_API_VERSION = allVersions[0];
298
302
  /**
299
303
  *
@@ -317,6 +321,8 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
317
321
  case 9 /* APIFeature.ENABLE_THIS_DOT_STYLE */:
318
322
  case 10 /* APIFeature.TEMPLATE_CLASS_NAME_OBJECT_BINDING */:
319
323
  return apiVersion >= 62 /* APIVersion.V62_252_WINTER_25 */;
324
+ case 11 /* APIFeature.ENABLE_COMPLEX_TEMPLATE_EXPRESSIONS */:
325
+ return apiVersion >= 63 /* APIVersion.V63_254_SPRING_25 */;
320
326
  }
321
327
  }
322
328
 
@@ -446,9 +452,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
446
452
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
447
453
  */
448
454
  // Increment whenever the LWC template compiler changes
449
- const LWC_VERSION = "7.2.1";
455
+ const LWC_VERSION = "8.1.2";
450
456
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
451
- /** version: 7.2.1 */
457
+ /** version: 8.1.2 */
452
458
 
453
459
  /**
454
460
  * Copyright (c) 2024 Salesforce, Inc.
@@ -535,7 +541,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
535
541
  setFeatureFlag(name, value);
536
542
  }
537
543
  }
538
- /** version: 7.2.1 */
544
+ /** version: 8.1.2 */
539
545
 
540
546
  /**
541
547
  * Copyright (c) 2024 Salesforce, Inc.
@@ -686,7 +692,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
686
692
  }
687
693
  alreadyLoggedMessages.add(msg);
688
694
  }
689
- // In Jest tests, reduce the warning and error verbosity by not printing the callstack
695
+ // In Vitest tests, reduce the warning and error verbosity by not printing the callstack
690
696
  if (process.env.NODE_ENV === 'test') {
691
697
  /* eslint-disable-next-line no-console */
692
698
  console[method](msg);
@@ -710,7 +716,220 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
710
716
  }
711
717
 
712
718
  /*
713
- * Copyright (c) 2019, salesforce.com, inc.
719
+ * Copyright (c) 2018, salesforce.com, inc.
720
+ * All rights reserved.
721
+ * SPDX-License-Identifier: MIT
722
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
723
+ */
724
+ let nextTickCallbackQueue = [];
725
+ const SPACE_CHAR = 32;
726
+ const EmptyObject = seal(create(null));
727
+ const EmptyArray = seal([]);
728
+ function flushCallbackQueue() {
729
+ if (process.env.NODE_ENV !== 'production') {
730
+ if (nextTickCallbackQueue.length === 0) {
731
+ throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);
732
+ }
733
+ }
734
+ const callbacks = nextTickCallbackQueue;
735
+ nextTickCallbackQueue = []; // reset to a new queue
736
+ for (let i = 0, len = callbacks.length; i < len; i += 1) {
737
+ callbacks[i]();
738
+ }
739
+ }
740
+ function addCallbackToNextTick(callback) {
741
+ if (process.env.NODE_ENV !== 'production') {
742
+ if (!isFunction$1(callback)) {
743
+ throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);
744
+ }
745
+ }
746
+ if (nextTickCallbackQueue.length === 0) {
747
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
748
+ Promise.resolve().then(flushCallbackQueue);
749
+ }
750
+ ArrayPush$1.call(nextTickCallbackQueue, callback);
751
+ }
752
+ function guid() {
753
+ function s4() {
754
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
755
+ }
756
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
757
+ }
758
+ // Borrowed from Vue template compiler.
759
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
760
+ const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
761
+ const PROPERTY_DELIMITER = /:(.+)/;
762
+ function parseStyleText(cssText) {
763
+ const styleMap = {};
764
+ const declarations = cssText.split(DECLARATION_DELIMITER);
765
+ for (const declaration of declarations) {
766
+ if (declaration) {
767
+ const [prop, value] = declaration.split(PROPERTY_DELIMITER);
768
+ if (prop !== undefined && value !== undefined) {
769
+ styleMap[prop.trim()] = value.trim();
770
+ }
771
+ }
772
+ }
773
+ return styleMap;
774
+ }
775
+ // Make a shallow copy of an object but omit the given key
776
+ function cloneAndOmitKey(object, keyToOmit) {
777
+ const result = {};
778
+ for (const key of keys(object)) {
779
+ if (key !== keyToOmit) {
780
+ result[key] = object[key];
781
+ }
782
+ }
783
+ return result;
784
+ }
785
+ function flattenStylesheets(stylesheets) {
786
+ const list = [];
787
+ for (const stylesheet of stylesheets) {
788
+ if (!isArray$1(stylesheet)) {
789
+ list.push(stylesheet);
790
+ } else {
791
+ list.push(...flattenStylesheets(stylesheet));
792
+ }
793
+ }
794
+ return list;
795
+ }
796
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
797
+ function assertNotProd() {
798
+ /* istanbul ignore if */
799
+ if (process.env.NODE_ENV === 'production') {
800
+ // this method should never leak to prod
801
+ throw new ReferenceError();
802
+ }
803
+ }
804
+ function shouldBeFormAssociated(Ctor) {
805
+ const ctorFormAssociated = Boolean(Ctor.formAssociated);
806
+ const apiVersion = getComponentAPIVersion(Ctor);
807
+ const apiFeatureEnabled = isAPIFeatureEnabled(7 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
808
+ if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
809
+ const tagName = getComponentRegisteredName(Ctor);
810
+ logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` + `association is not enabled because the API version is ${apiVersion}. To enable form association, ` + `update the LWC component API version to 61 or above. https://lwc.dev/guide/versioning`);
811
+ }
812
+ return ctorFormAssociated && apiFeatureEnabled;
813
+ }
814
+
815
+ /*
816
+ * Copyright (c) 2024, Salesforce, Inc.
817
+ * All rights reserved.
818
+ * SPDX-License-Identifier: MIT
819
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
820
+ */
821
+ //
822
+ // Do additional mutation tracking for DevTools performance profiling, in dev mode only.
823
+ //
824
+ const reactiveObserversToVMs = new WeakMap();
825
+ const targetsToPropertyKeys = new WeakMap();
826
+ let mutationLogs = [];
827
+ // Create a human-readable member access notation like `obj.foo` or `arr[1]`,
828
+ // handling edge cases like `obj[Symbol("bar")]` and `obj["spaces here"]`
829
+ function toPrettyMemberNotation(parent, child) {
830
+ if (isUndefined$1(parent)) {
831
+ // Bare prop, just stringify the child
832
+ return toString$1(child);
833
+ } else if (!isString(child)) {
834
+ // Symbol/number, e.g. `obj[Symbol("foo")]` or `obj[1234]`
835
+ return `${toString$1(parent)}[${toString$1(child)}]`;
836
+ } else if (/^\w+$/.test(child)) {
837
+ // Dot-notation-safe string, e.g. `obj.foo`
838
+ return `${toString$1(parent)}.${child}`;
839
+ } else {
840
+ // Bracket-notation-requiring string, e.g. `obj["prop with spaces"]`
841
+ return `${toString$1(parent)}[${JSON.stringify(child)}]`;
842
+ }
843
+ }
844
+ /**
845
+ * Flush all the logs we've written so far and return the current logs.
846
+ */
847
+ function getAndFlushMutationLogs() {
848
+ assertNotProd();
849
+ const result = mutationLogs;
850
+ mutationLogs = [];
851
+ return result;
852
+ }
853
+ /**
854
+ * Log a new mutation for this reactive observer.
855
+ * @param reactiveObserver - relevant ReactiveObserver
856
+ * @param target - target object that is being observed
857
+ * @param key - key (property) that was mutated
858
+ */
859
+ function logMutation(reactiveObserver, target, key) {
860
+ assertNotProd();
861
+ const parentKey = targetsToPropertyKeys.get(target);
862
+ const vm = reactiveObserversToVMs.get(reactiveObserver);
863
+ /* istanbul ignore if */
864
+ if (isUndefined$1(vm)) {
865
+ // VM should only be undefined in Vitest tests, where a reactive observer is not always associated with a VM
866
+ // because the unit tests just create Reactive Observers on-the-fly.
867
+ // Note we could explicitly target Vitest with `process.env.NODE_ENV === 'test'`, but then that would also
868
+ // affect our downstream consumers' Jest/Vitest tests, and we don't want to throw an error just for a logger.
869
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
870
+ throw new Error('The VM should always be defined except possibly in unit tests');
871
+ }
872
+ } else {
873
+ const prop = toPrettyMemberNotation(parentKey, key);
874
+ ArrayPush$1.call(mutationLogs, {
875
+ vm,
876
+ prop
877
+ });
878
+ }
879
+ }
880
+ /**
881
+ * Flush logs associated with a given VM.
882
+ * @param vm - given VM
883
+ */
884
+ function flushMutationLogsForVM(vm) {
885
+ assertNotProd();
886
+ mutationLogs = ArrayFilter.call(mutationLogs, log => log.vm !== vm);
887
+ }
888
+ /**
889
+ * Mark this ReactiveObserver as related to this VM. This is only needed for mutation tracking in dev mode.
890
+ * @param reactiveObserver
891
+ * @param vm
892
+ */
893
+ function associateReactiveObserverWithVM(reactiveObserver, vm) {
894
+ assertNotProd();
895
+ reactiveObserversToVMs.set(reactiveObserver, vm);
896
+ }
897
+ /**
898
+ * Deeply track all objects in a target and associate with a given key.
899
+ * @param key - key associated with the object in the component
900
+ * @param target - tracked target object
901
+ */
902
+ function trackTargetForMutationLogging(key, target) {
903
+ assertNotProd();
904
+ if (targetsToPropertyKeys.has(target)) {
905
+ // Guard against recursive objects - don't traverse forever
906
+ return;
907
+ }
908
+ if (isObject(target) && !isNull(target)) {
909
+ // only track non-primitives; others are invalid as WeakMap keys
910
+ targetsToPropertyKeys.set(target, key);
911
+ // Deeply traverse arrays and objects to track every object within
912
+ if (isArray$1(target)) {
913
+ for (let i = 0; i < target.length; i++) {
914
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, i), target[i]);
915
+ }
916
+ } else {
917
+ // Track only own property names and symbols (including non-enumerated)
918
+ // This is consistent with what observable-membrane does:
919
+ // https://github.com/salesforce/observable-membrane/blob/b85417f/src/base-handler.ts#L142-L143
920
+ // Note this code path is very hot, hence doing two separate for-loops rather than creating a new array.
921
+ for (const prop of getOwnPropertyNames$1(target)) {
922
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
923
+ }
924
+ for (const prop of getOwnPropertySymbols$1(target)) {
925
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
926
+ }
927
+ }
928
+ }
929
+ }
930
+
931
+ /*
932
+ * Copyright (c) 2024, Salesforce, Inc.
714
933
  * All rights reserved.
715
934
  * SPDX-License-Identifier: MIT
716
935
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -733,6 +952,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
733
952
  if (!isUndefined$1(reactiveObservers)) {
734
953
  for (let i = 0, len = reactiveObservers.length; i < len; i += 1) {
735
954
  const ro = reactiveObservers[i];
955
+ if (process.env.NODE_ENV !== 'production') {
956
+ logMutation(ro, target, key);
957
+ }
736
958
  ro.notify();
737
959
  }
738
960
  }
@@ -918,103 +1140,6 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
918
1140
  return new ReactiveObserver(callback);
919
1141
  }
920
1142
 
921
- /*
922
- * Copyright (c) 2018, salesforce.com, inc.
923
- * All rights reserved.
924
- * SPDX-License-Identifier: MIT
925
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
926
- */
927
- let nextTickCallbackQueue = [];
928
- const SPACE_CHAR = 32;
929
- const EmptyObject = seal(create(null));
930
- const EmptyArray = seal([]);
931
- function flushCallbackQueue() {
932
- if (process.env.NODE_ENV !== 'production') {
933
- if (nextTickCallbackQueue.length === 0) {
934
- throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);
935
- }
936
- }
937
- const callbacks = nextTickCallbackQueue;
938
- nextTickCallbackQueue = []; // reset to a new queue
939
- for (let i = 0, len = callbacks.length; i < len; i += 1) {
940
- callbacks[i]();
941
- }
942
- }
943
- function addCallbackToNextTick(callback) {
944
- if (process.env.NODE_ENV !== 'production') {
945
- if (!isFunction$1(callback)) {
946
- throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);
947
- }
948
- }
949
- if (nextTickCallbackQueue.length === 0) {
950
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
951
- Promise.resolve().then(flushCallbackQueue);
952
- }
953
- ArrayPush$1.call(nextTickCallbackQueue, callback);
954
- }
955
- function guid() {
956
- function s4() {
957
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
958
- }
959
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
960
- }
961
- // Borrowed from Vue template compiler.
962
- // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
963
- const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
964
- const PROPERTY_DELIMITER = /:(.+)/;
965
- function parseStyleText(cssText) {
966
- const styleMap = {};
967
- const declarations = cssText.split(DECLARATION_DELIMITER);
968
- for (const declaration of declarations) {
969
- if (declaration) {
970
- const [prop, value] = declaration.split(PROPERTY_DELIMITER);
971
- if (prop !== undefined && value !== undefined) {
972
- styleMap[prop.trim()] = value.trim();
973
- }
974
- }
975
- }
976
- return styleMap;
977
- }
978
- // Make a shallow copy of an object but omit the given key
979
- function cloneAndOmitKey(object, keyToOmit) {
980
- const result = {};
981
- for (const key of keys(object)) {
982
- if (key !== keyToOmit) {
983
- result[key] = object[key];
984
- }
985
- }
986
- return result;
987
- }
988
- function flattenStylesheets(stylesheets) {
989
- const list = [];
990
- for (const stylesheet of stylesheets) {
991
- if (!isArray$1(stylesheet)) {
992
- list.push(stylesheet);
993
- } else {
994
- list.push(...flattenStylesheets(stylesheet));
995
- }
996
- }
997
- return list;
998
- }
999
- // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
1000
- function assertNotProd() {
1001
- /* istanbul ignore if */
1002
- if (process.env.NODE_ENV === 'production') {
1003
- // this method should never leak to prod
1004
- throw new ReferenceError();
1005
- }
1006
- }
1007
- function shouldBeFormAssociated(Ctor) {
1008
- const ctorFormAssociated = Boolean(Ctor.formAssociated);
1009
- const apiVersion = getComponentAPIVersion(Ctor);
1010
- const apiFeatureEnabled = isAPIFeatureEnabled(7 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
1011
- if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
1012
- const tagName = getComponentRegisteredName(Ctor);
1013
- logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` + `association is not enabled because the API version is ${apiVersion}. To enable form association, ` + `update the LWC component API version to 61 or above. https://lwc.dev/guide/versioning`);
1014
- }
1015
- return ctorFormAssociated && apiFeatureEnabled;
1016
- }
1017
-
1018
1143
  /*
1019
1144
  * Copyright (c) 2020, salesforce.com, inc.
1020
1145
  * All rights reserved.
@@ -1719,7 +1844,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
1719
1844
  valueMutated(originalTarget, key);
1720
1845
  return true;
1721
1846
  }
1722
- /*LWC compiler v7.2.1*/
1847
+ /*LWC compiler v8.1.2*/
1723
1848
  }
1724
1849
  const getterMap = new WeakMap();
1725
1850
  const setterMap = new WeakMap();
@@ -1812,7 +1937,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
1812
1937
  /* istanbul ignore next */
1813
1938
  return false;
1814
1939
  }
1815
- /*LWC compiler v7.2.1*/
1940
+ /*LWC compiler v8.1.2*/
1816
1941
  }
1817
1942
  function extract(objectOrArray) {
1818
1943
  if (isArray(objectOrArray)) {
@@ -2041,7 +2166,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
2041
2166
  } = elm;
2042
2167
  try {
2043
2168
  return await (await fetch(href)).text();
2044
- } catch (err) {
2169
+ } catch (_err) {
2045
2170
  logWarnOnce(`Ignoring cross-origin stylesheet in migrate mode: ${href}`);
2046
2171
  // ignore errors with cross-origin stylesheets - nothing we can do for those
2047
2172
  return '';
@@ -2811,6 +2936,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
2811
2936
  });
2812
2937
  }
2813
2938
  });
2939
+ if (process.env.NODE_ENV !== 'production') {
2940
+ associateReactiveObserverWithVM(ro, getAssociatedVM(component));
2941
+ }
2814
2942
  const computeConfigAndUpdate = () => {
2815
2943
  let config;
2816
2944
  ro.observe(() => config = configCallback(component));
@@ -3092,7 +3220,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
3092
3220
  * SPDX-License-Identifier: MIT
3093
3221
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3094
3222
  */
3095
- function track(target) {
3223
+ function track(target,
3224
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3225
+ context) {
3096
3226
  if (arguments.length === 1) {
3097
3227
  return getReactiveProxy(target);
3098
3228
  }
@@ -3121,6 +3251,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
3121
3251
  }
3122
3252
  }
3123
3253
  const reactiveOrAnyValue = getReactiveProxy(newValue);
3254
+ if (process.env.NODE_ENV !== 'production') {
3255
+ trackTargetForMutationLogging(key, newValue);
3256
+ }
3124
3257
  updateComponentValue(vm, key, reactiveOrAnyValue);
3125
3258
  },
3126
3259
  enumerable: true,
@@ -3565,7 +3698,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
3565
3698
  }
3566
3699
  function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
3567
3700
  const HTMLBridgeElement = class extends SuperClass {
3568
- /*LWC compiler v7.2.1*/
3701
+ /*LWC compiler v8.1.2*/
3569
3702
  };
3570
3703
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
3571
3704
  // and false positives in case of inheritance.
@@ -4571,6 +4704,62 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
4571
4704
  function isVStaticPartText(vnode) {
4572
4705
  return vnode.type === 0 /* VStaticPartType.Text */;
4573
4706
  }
4707
+ const sanitizedHtmlContentSymbol = Symbol('lwc-get-sanitized-html-content');
4708
+ function isSanitizedHtmlContent(object) {
4709
+ return isObject(object) && !isNull(object) && sanitizedHtmlContentSymbol in object;
4710
+ }
4711
+ function unwrapIfNecessary(object) {
4712
+ return isSanitizedHtmlContent(object) ? object[sanitizedHtmlContentSymbol] : object;
4713
+ }
4714
+ /**
4715
+ * Wrap a pre-sanitized string designated for `.innerHTML` via `lwc:inner-html`
4716
+ * as an object with a Symbol that only we have access to.
4717
+ * @param sanitizedString
4718
+ * @returns SanitizedHtmlContent
4719
+ */
4720
+ function createSanitizedHtmlContent(sanitizedString) {
4721
+ return create(null, {
4722
+ [sanitizedHtmlContentSymbol]: {
4723
+ value: sanitizedString,
4724
+ configurable: false,
4725
+ writable: false
4726
+ }
4727
+ });
4728
+ }
4729
+ /**
4730
+ * Safely call setProperty on an Element while handling any SanitizedHtmlContent objects correctly
4731
+ *
4732
+ * @param setProperty - renderer.setProperty
4733
+ * @param elm - Element
4734
+ * @param key - key to set
4735
+ * @param value - value to set
4736
+ */
4737
+ function safelySetProperty(setProperty, elm, key, value) {
4738
+ // See W-16614337
4739
+ // we support setting innerHTML to `undefined` because it's inherently safe
4740
+ if ((key === 'innerHTML' || key === 'outerHTML') && !isUndefined$1(value)) {
4741
+ if (isSanitizedHtmlContent(value)) {
4742
+ // it's a SanitizedHtmlContent object
4743
+ setProperty(elm, key, value[sanitizedHtmlContentSymbol]);
4744
+ } else {
4745
+ // not a SanitizedHtmlContent object
4746
+ if (process.env.NODE_ENV !== 'production') {
4747
+ logWarn(`Cannot set property "${key}". Instead, use lwc:inner-html or lwc:dom-manual.`);
4748
+ }
4749
+ }
4750
+ } else {
4751
+ setProperty(elm, key, value);
4752
+ }
4753
+ }
4754
+ /**
4755
+ * Given two objects (likely either a string or a SanitizedHtmlContent object), return true if their
4756
+ * string values are equivalent.
4757
+ * @param first
4758
+ * @param second
4759
+ */
4760
+ function isSanitizedHtmlContentEqual(first, second) {
4761
+ return unwrapIfNecessary(first) === unwrapIfNecessary(second);
4762
+ }
4574
4763
 
4575
4764
  /*
4576
4765
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4611,7 +4800,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
4611
4800
  // Use kebabCaseToCamelCase directly because we don't want to set props like `ariaLabel` or `tabIndex`
4612
4801
  // on a custom element versus just using the more reliable attribute format.
4613
4802
  if (external && (propName = kebabCaseToCamelCase(key)) in elm) {
4614
- setProperty(elm, propName, cur);
4803
+ safelySetProperty(setProperty, elm, propName, cur);
4615
4804
  } else if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
4616
4805
  // Assume xml namespace
4617
4806
  setAttribute(elm, key, cur, XML_NAMESPACE);
@@ -4699,7 +4888,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
4699
4888
  logWarn(`Unknown public property "${key}" of element <${elm.tagName.toLowerCase()}>. This is either a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}", or the attribute does not exist in this browser or DOM implementation.`);
4700
4889
  }
4701
4890
  }
4702
- setProperty(elm, key, cur);
4891
+ safelySetProperty(setProperty, elm, key, cur);
4703
4892
  }
4704
4893
  }
4705
4894
  }
@@ -6133,25 +6322,33 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6133
6322
  } else {
6134
6323
  // This block is for standard slots (non-scoped slots)
6135
6324
  let clonedVNode;
6136
- if (renderMode === 0 /* RenderMode.Light */ && isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) && (isVBaseElement(vnode) || isVStatic(vnode)) &&
6137
- // We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
6138
- // disconnected/connected callback firing.
6139
- vnode.slotAssignment !== data.slotAssignment) {
6140
- // When the light DOM slot assignment (slot attribute) changes we can't use the same reference
6141
- // to the vnode because the current way the diffing algo works, it will replace the original reference
6142
- // to the host element with a new one. This means the new element will be mounted and immediately unmounted.
6143
- // Creating a copy of the vnode to preserve a reference to the previous host element.
6144
- if (isUndefined$1(vnode.elm)) {
6145
- // vnode.elm is undefined during initial render.
6146
- // We don't need to clone at this point because it doesn't need to be unmounted.
6147
- vnode.slotAssignment = data.slotAssignment;
6148
- } else {
6149
- // Clone when the vnode.elm is defined to ensure we don't lose reference to the previous element.
6150
- // This is specifically for slot forwarding.
6151
- clonedVNode = {
6152
- ...vnode,
6153
- slotAssignment: data.slotAssignment
6154
- };
6325
+ if (renderMode === 0 /* RenderMode.Light */ && isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) && (isVBaseElement(vnode) || isVStatic(vnode)) && vnode.slotAssignment !== data.slotAssignment) {
6326
+ // When the light DOM slot assignment (slot attribute) changes, we can't use the same reference
6327
+ // to the vnode because the current way the diffing algo works, it will replace the original
6328
+ // reference to the host element with a new one. This means the new element will be mounted and
6329
+ // immediately unmounted. Creating a copy of the vnode preserves a reference to the previous
6330
+ // host element.
6331
+ clonedVNode = {
6332
+ ...vnode,
6333
+ slotAssignment: data.slotAssignment
6334
+ };
6335
+ // For disconnectedCallback to work correctly in synthetic lifecycle mode, we need to link the
6336
+ // current VM's velements to the clone, so that when the VM unmounts, the clone also unmounts.
6337
+ // Note this only applies to VCustomElements, since those are the elements that we manually need
6338
+ // to call disconnectedCallback for, when running in synthetic lifecycle mode.
6339
+ //
6340
+ // You might think it would make more sense to add the clonedVNode to the same velements array
6341
+ // as the original vnode's VM (i.e. `vnode.owner.velements`) rather than the current VM (i.e.
6342
+ // `vmBeingRendered.velements`), but this actually might not trigger disconnectedCallback
6343
+ // in synthetic lifecycle mode. The reason for this is that a reactivity change may cause
6344
+ // the slottable component to unmount, but _not_ the slotter component (see issue #4446).
6345
+ //
6346
+ // If this occurs, then the slottable component (i.e .this component we are rendering right
6347
+ // now) is the one that needs to own the clone. Whereas if a reactivity change higher in the
6348
+ // tree causes the slotter to unmount, then the slottable will also unmount. So using the
6349
+ // current VM works either way.
6350
+ if (isVCustomElement(vnode)) {
6351
+ addVNodeToChildLWC(clonedVNode);
6155
6352
  }
6156
6353
  }
6157
6354
  // If the slot content is standard type, the content is static, no additional
@@ -6507,7 +6704,8 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6507
6704
  }
6508
6705
  // [s]anitize [h]tml [c]ontent
6509
6706
  function shc(content) {
6510
- return sanitizeHtmlContentHook(content);
6707
+ const sanitizedString = sanitizeHtmlContentHook(content);
6708
+ return createSanitizedHtmlContent(sanitizedString);
6511
6709
  }
6512
6710
  /**
6513
6711
  * [ncls] - Normalize class name attribute.
@@ -6571,20 +6769,48 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6571
6769
  });
6572
6770
 
6573
6771
  /*
6574
- * Copyright (c) 2018, salesforce.com, inc.
6772
+ * Copyright (c) 2024, Salesforce, Inc.
6575
6773
  * All rights reserved.
6576
6774
  * SPDX-License-Identifier: MIT
6577
6775
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6578
6776
  */
6579
6777
  const operationIdNameMapping = ['constructor', 'render', 'patch', 'connectedCallback', 'renderedCallback', 'disconnectedCallback', 'errorCallback', 'lwc-hydrate', 'lwc-rehydrate'];
6778
+ const operationTooltipMapping = [
6779
+ // constructor
6780
+ 'component constructor()',
6781
+ // render
6782
+ 'component render() and virtual DOM rendered',
6783
+ // patch
6784
+ 'component DOM rendered',
6785
+ // connectedCallback
6786
+ 'component connectedCallback()',
6787
+ // renderedCallback
6788
+ 'component renderedCallback()',
6789
+ // disconnectedCallback
6790
+ 'component disconnectedCallback()',
6791
+ // errorCallback
6792
+ 'component errorCallback()',
6793
+ // lwc-hydrate
6794
+ 'component first rendered',
6795
+ // lwc-rehydrate
6796
+ 'component re-rendered'];
6580
6797
  // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
6581
6798
  // JSDom (used in Jest) for example doesn't implement the UserTiming APIs.
6582
6799
  const isUserTimingSupported = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
6583
6800
  const start = !isUserTimingSupported ? noop : markName => {
6584
6801
  performance.mark(markName);
6585
6802
  };
6586
- const end = !isUserTimingSupported ? noop : (measureName, markName) => {
6587
- performance.measure(measureName, markName);
6803
+ const end = !isUserTimingSupported ? noop : (measureName, markName, devtools) => {
6804
+ performance.measure(measureName, {
6805
+ start: markName,
6806
+ detail: {
6807
+ devtools: {
6808
+ dataType: 'track-entry',
6809
+ track: '⚡️ Lightning Web Components',
6810
+ ...devtools
6811
+ }
6812
+ }
6813
+ });
6588
6814
  // Clear the created marks and measure to avoid filling the performance entries buffer.
6589
6815
  // Note: Even if the entries get deleted, existing PerformanceObservers preserve a copy of those entries.
6590
6816
  performance.clearMarks(markName);
@@ -6601,6 +6827,85 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6601
6827
  // the right measures for components that are recursive.
6602
6828
  return `${getMeasureName(opId, vm)} - ${vm.idx}`;
6603
6829
  }
6830
+ function getProperties(vm) {
6831
+ return [['Tag Name', vm.tagName], ['Component ID', String(vm.idx)], ['Render Mode', vm.renderMode === 0 /* RenderMode.Light */ ? 'light DOM' : 'shadow DOM'], ['Shadow Mode', vm.shadowMode === 0 /* ShadowMode.Native */ ? 'native' : 'synthetic']];
6832
+ }
6833
+ function getColor(opId) {
6834
+ // As of Sept 2024: primary (dark blue), secondary (light blue), tertiary (green)
6835
+ switch (opId) {
6836
+ // GlobalHydrate and Constructor tend to occur at the top level
6837
+ case 7 /* OperationId.GlobalHydrate */:
6838
+ case 0 /* OperationId.Constructor */:
6839
+ return 'primary';
6840
+ // GlobalRehydrate also occurs at the top level, but we want to use tertiary (green) because it's easier to
6841
+ // distinguish from primary, and at a glance you should be able to easily tell re-renders from first renders.
6842
+ case 8 /* OperationId.GlobalRehydrate */:
6843
+ return 'tertiary';
6844
+ // Everything else (patch/render/callbacks)
6845
+ default:
6846
+ return 'secondary';
6847
+ }
6848
+ }
6849
+ // Create a list of tag names to the properties that were mutated, to help answer the question of
6850
+ // "why did this component re-render?"
6851
+ function getMutationProperties(mutationLogs) {
6852
+ // `mutationLogs` should never have length 0, but bail out if it does for whatever reason
6853
+ if (isUndefined$1(mutationLogs)) {
6854
+ return EmptyArray;
6855
+ }
6856
+ if (!mutationLogs.length) {
6857
+ // Currently this only occurs for experimental signals, because those mutations are not triggered by accessors
6858
+ // TODO [#4546]: support signals in mutation logging
6859
+ return EmptyArray;
6860
+ }
6861
+ // Keep track of unique IDs per tag name so we can just report a raw count at the end, e.g.
6862
+ // `<x-foo> (x2)` to indicate that two instances of `<x-foo>` were rendered.
6863
+ const tagNamesToIdsAndProps = new Map();
6864
+ for (const {
6865
+ vm: {
6866
+ tagName,
6867
+ idx
6868
+ },
6869
+ prop
6870
+ } of mutationLogs) {
6871
+ let idsAndProps = tagNamesToIdsAndProps.get(tagName);
6872
+ if (isUndefined$1(idsAndProps)) {
6873
+ idsAndProps = {
6874
+ ids: new Set(),
6875
+ keys: new Set()
6876
+ };
6877
+ tagNamesToIdsAndProps.set(tagName, idsAndProps);
6878
+ }
6879
+ idsAndProps.ids.add(idx);
6880
+ idsAndProps.keys.add(prop);
6881
+ }
6882
+ // Sort by tag name
6883
+ const entries = ArraySort.call([...tagNamesToIdsAndProps], (a, b) => a[0].localeCompare(b[0]));
6884
+ const tagNames = ArrayMap.call(entries, item => item[0]);
6885
+ // Show e.g. `<x-foo>` for one instance, or `<x-foo> (x2)` for two instances. (\u00D7 is multiplication symbol)
6886
+ const tagNamesToDisplayTagNames = new Map();
6887
+ for (const tagName of tagNames) {
6888
+ const {
6889
+ ids
6890
+ } = tagNamesToIdsAndProps.get(tagName);
6891
+ const displayTagName = `<${tagName}>${ids.size > 1 ? ` (\u00D7${ids.size})` : ''}`;
6892
+ tagNamesToDisplayTagNames.set(tagName, displayTagName);
6893
+ }
6894
+ // Summary row
6895
+ const usePlural = tagNames.length > 1 || tagNamesToIdsAndProps.get(tagNames[0]).ids.size > 1;
6896
+ const result = [[`Component${usePlural ? 's' : ''}`, ArrayJoin.call(ArrayMap.call(tagNames, _ => tagNamesToDisplayTagNames.get(_)), ', ')]];
6897
+ // Detail rows
6898
+ for (const [prettyTagName, {
6899
+ keys
6900
+ }] of entries) {
6901
+ const displayTagName = tagNamesToDisplayTagNames.get(prettyTagName);
6902
+ ArrayPush$1.call(result, [displayTagName, ArrayJoin.call(ArraySort.call([...keys]), ', ')]);
6903
+ }
6904
+ return result;
6905
+ }
6906
+ function getTooltipText(measureName, opId) {
6907
+ return `${measureName} - ${operationTooltipMapping[opId]}`;
6908
+ }
6604
6909
  /** Indicates if operations should be logged via the User Timing API. */
6605
6910
  const isMeasureEnabled = process.env.NODE_ENV !== 'production';
6606
6911
  /** Indicates if operations should be logged by the profiler. */
@@ -6638,33 +6943,94 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6638
6943
  if (isMeasureEnabled) {
6639
6944
  const markName = getMarkName(opId, vm);
6640
6945
  const measureName = getMeasureName(opId, vm);
6641
- end(measureName, markName);
6946
+ end(measureName, markName, {
6947
+ color: getColor(opId),
6948
+ tooltipText: getTooltipText(measureName, opId),
6949
+ properties: getProperties(vm)
6950
+ });
6642
6951
  }
6643
6952
  if (isProfilerEnabled) {
6644
6953
  currentDispatcher(opId, 1 /* Phase.Stop */, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6645
6954
  }
6646
6955
  }
6647
- function logGlobalOperationStart(opId, vm) {
6956
+ function logGlobalOperationStart(opId) {
6648
6957
  if (isMeasureEnabled) {
6649
- const opName = getOperationName(opId);
6650
- const markName = isUndefined$1(vm) ? opName : getMarkName(opId, vm);
6958
+ const markName = getOperationName(opId);
6651
6959
  start(markName);
6652
6960
  }
6653
6961
  if (isProfilerEnabled) {
6654
- currentDispatcher(opId, 0 /* Phase.Start */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
6962
+ currentDispatcher(opId, 0 /* Phase.Start */);
6655
6963
  }
6656
6964
  }
6657
- function logGlobalOperationEnd(opId, vm) {
6965
+ function logGlobalOperationStartWithVM(opId, vm) {
6966
+ if (isMeasureEnabled) {
6967
+ const markName = getMarkName(opId, vm);
6968
+ start(markName);
6969
+ }
6970
+ if (isProfilerEnabled) {
6971
+ currentDispatcher(opId, 0 /* Phase.Start */, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6972
+ }
6973
+ }
6974
+ function logGlobalOperationEnd(opId, mutationLogs) {
6658
6975
  if (isMeasureEnabled) {
6659
6976
  const opName = getOperationName(opId);
6660
- const markName = isUndefined$1(vm) ? opName : getMarkName(opId, vm);
6661
- end(opName, markName);
6977
+ const markName = opName;
6978
+ end(opName, markName, {
6979
+ color: getColor(opId),
6980
+ tooltipText: getTooltipText(opName, opId),
6981
+ properties: getMutationProperties(mutationLogs)
6982
+ });
6662
6983
  }
6663
6984
  if (isProfilerEnabled) {
6664
- currentDispatcher(opId, 1 /* Phase.Stop */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
6985
+ currentDispatcher(opId, 1 /* Phase.Stop */);
6986
+ }
6987
+ }
6988
+ function logGlobalOperationEndWithVM(opId, vm) {
6989
+ if (isMeasureEnabled) {
6990
+ const opName = getOperationName(opId);
6991
+ const markName = getMarkName(opId, vm);
6992
+ end(opName, markName, {
6993
+ color: getColor(opId),
6994
+ tooltipText: getTooltipText(opName, opId),
6995
+ properties: getProperties(vm)
6996
+ });
6997
+ }
6998
+ if (isProfilerEnabled) {
6999
+ currentDispatcher(opId, 1 /* Phase.Stop */, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6665
7000
  }
6666
7001
  }
6667
7002
 
7003
+ /*
7004
+ * Copyright (c) 2024, Salesforce, Inc.
7005
+ * All rights reserved.
7006
+ * SPDX-License-Identifier: MIT
7007
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7008
+ */
7009
+ // HAS_SCOPED_STYLE | SHADOW_MODE_SYNTHETIC = 3
7010
+ const MAX_CACHE_KEY = 3;
7011
+ // Mapping of cacheKeys to `string[]` (assumed to come from a tagged template literal) to an Element.
7012
+ // Note that every unique tagged template literal will have a unique `string[]`. So by using `string[]`
7013
+ // as the WeakMap key, we effectively associate each Element with a unique tagged template literal.
7014
+ // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
7015
+ // Also note that this array only needs to be large enough to account for the maximum possible cache key
7016
+ const fragmentCache = ArrayFrom({
7017
+ length: MAX_CACHE_KEY + 1
7018
+ }, () => new WeakMap());
7019
+ // Only used in LWC's Karma tests
7020
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
7021
+ window.__lwcResetFragmentCache = () => {
7022
+ for (let i = 0; i < fragmentCache.length; i++) {
7023
+ fragmentCache[i] = new WeakMap();
7024
+ }
7025
+ };
7026
+ }
7027
+ function getFromFragmentCache(cacheKey, strings) {
7028
+ return fragmentCache[cacheKey].get(strings);
7029
+ }
7030
+ function setInFragmentCache(cacheKey, strings, element) {
7031
+ fragmentCache[cacheKey].set(strings, element);
7032
+ }
7033
+
6668
7034
  /*
6669
7035
  * Copyright (c) 2024, Salesforce, Inc.
6670
7036
  * All rights reserved.
@@ -6679,6 +7045,12 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6679
7045
  function setVMBeingRendered(vm) {
6680
7046
  vmBeingRendered = vm;
6681
7047
  }
7048
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
7049
+ // See W-16614556
7050
+ // TODO [#2826]: freeze the template object
7051
+ function isValidScopeToken(token) {
7052
+ return isString(token) && VALID_SCOPE_TOKEN_REGEX.test(token);
7053
+ }
6682
7054
  function validateSlots(vm) {
6683
7055
  assertNotProd(); // this method should never leak to prod
6684
7056
  const {
@@ -6725,28 +7097,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6725
7097
  return browserExpressionSerializer;
6726
7098
  }
6727
7099
  }
6728
- // This should be a no-op outside of LWC's Karma tests, where it's not needed
6729
- let registerFragmentCache = noop;
6730
- // Only used in LWC's Karma tests
6731
- if (process.env.NODE_ENV === 'test-karma-lwc') {
6732
- // Keep track of fragmentCaches, so we can clear them in LWC's Karma tests
6733
- const fragmentCaches = [];
6734
- registerFragmentCache = fragmentCache => {
6735
- fragmentCaches.push(fragmentCache);
6736
- };
6737
- window.__lwcResetFragmentCaches = () => {
6738
- for (const fragmentCache of fragmentCaches) {
6739
- for (const key of keys(fragmentCache)) {
6740
- delete fragmentCache[key];
6741
- }
6742
- }
6743
- };
6744
- }
6745
7100
  function buildParseFragmentFn(createFragmentFn) {
6746
- return (strings, ...keys) => {
6747
- const cache = create(null);
6748
- registerFragmentCache(cache);
6749
- return function (parts) {
7101
+ return function parseFragment(strings, ...keys) {
7102
+ return function applyFragmentParts(parts) {
6750
7103
  const {
6751
7104
  context: {
6752
7105
  hasScopedStyles,
@@ -6761,19 +7114,23 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6761
7114
  const hasLegacyToken = lwcRuntimeFlags.ENABLE_LEGACY_SCOPE_TOKENS && !isUndefined$1(legacyStylesheetToken);
6762
7115
  let cacheKey = 0;
6763
7116
  if (hasStyleToken && hasScopedStyles) {
6764
- cacheKey |= 1 /* FragmentCache.HAS_SCOPED_STYLE */;
7117
+ cacheKey |= 1 /* FragmentCacheKey.HAS_SCOPED_STYLE */;
6765
7118
  }
6766
7119
  if (hasStyleToken && isSyntheticShadow) {
6767
- cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
7120
+ cacheKey |= 2 /* FragmentCacheKey.SHADOW_MODE_SYNTHETIC */;
6768
7121
  }
6769
7122
  // Cache is only here to prevent calling innerHTML multiple times which doesn't happen on the server.
6770
7123
  {
6771
7124
  // Disable this on the server to prevent cache poisoning when expressions are used.
6772
- const cached = cache[cacheKey];
7125
+ const cached = getFromFragmentCache(cacheKey, strings);
6773
7126
  if (!isUndefined$1(cached)) {
6774
7127
  return cached;
6775
7128
  }
6776
7129
  }
7130
+ // See W-16614556
7131
+ if (hasStyleToken && !isValidScopeToken(stylesheetToken) || hasLegacyToken && !isValidScopeToken(legacyStylesheetToken)) {
7132
+ throw new Error('stylesheet token must be a valid string');
7133
+ }
6777
7134
  // If legacy stylesheet tokens are required, then add them to the rendered string
6778
7135
  const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
6779
7136
  const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
@@ -6813,8 +7170,12 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
6813
7170
  }
6814
7171
  }
6815
7172
  htmlFragment += strings[strings.length - 1];
6816
- cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
6817
- return cache[cacheKey];
7173
+ const element = createFragmentFn(htmlFragment, renderer);
7174
+ // Cache is only here to prevent calling innerHTML multiple times which doesn't happen on the server.
7175
+ {
7176
+ setInFragmentCache(cacheKey, strings, element);
7177
+ }
7178
+ return element;
6818
7179
  };
6819
7180
  };
6820
7181
  }
@@ -7087,7 +7448,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7087
7448
  return apiVersion;
7088
7449
  }
7089
7450
  function getTemplateReactiveObserver(vm) {
7090
- return createReactiveObserver(() => {
7451
+ const reactiveObserver = createReactiveObserver(() => {
7091
7452
  const {
7092
7453
  isDirty
7093
7454
  } = vm;
@@ -7096,6 +7457,10 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7096
7457
  scheduleRehydration(vm);
7097
7458
  }
7098
7459
  });
7460
+ if (process.env.NODE_ENV !== 'production') {
7461
+ associateReactiveObserverWithVM(reactiveObserver, vm);
7462
+ }
7463
+ return reactiveObserver;
7099
7464
  }
7100
7465
  function resetTemplateObserverAndUnsubscribe(vm) {
7101
7466
  const {
@@ -7173,7 +7538,12 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7173
7538
  }
7174
7539
  function connectRootElement(elm) {
7175
7540
  const vm = getAssociatedVM(elm);
7176
- logGlobalOperationStart(7 /* OperationId.GlobalHydrate */, vm);
7541
+ if (process.env.NODE_ENV !== 'production') {
7542
+ // Flush any logs for this VM so that the initial properties from the constructor don't "count"
7543
+ // in subsequent re-renders (lwc-rehydrate). Right now we're at the first render (lwc-hydrate).
7544
+ flushMutationLogsForVM(vm);
7545
+ }
7546
+ logGlobalOperationStartWithVM(7 /* OperationId.GlobalHydrate */, vm);
7177
7547
  // Usually means moving the element from one place to another, which is observable via
7178
7548
  // life-cycle hooks.
7179
7549
  if (vm.state === 1 /* VMState.connected */) {
@@ -7181,7 +7551,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7181
7551
  }
7182
7552
  runConnectedCallback(vm);
7183
7553
  rehydrate(vm);
7184
- logGlobalOperationEnd(7 /* OperationId.GlobalHydrate */, vm);
7554
+ logGlobalOperationEndWithVM(7 /* OperationId.GlobalHydrate */, vm);
7185
7555
  }
7186
7556
  function disconnectRootElement(elm) {
7187
7557
  const vm = getAssociatedVM(elm);
@@ -7502,6 +7872,9 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7502
7872
  }
7503
7873
  let rehydrateQueue = [];
7504
7874
  function flushRehydrationQueue() {
7875
+ // Gather the logs before rehydration starts so they can be reported at the end of rehydration.
7876
+ // Note that we also clear all existing logs at this point so that subsequent re-renders start from a clean slate.
7877
+ const mutationLogs = process.env.NODE_ENV === 'production' ? undefined : getAndFlushMutationLogs();
7505
7878
  logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
7506
7879
  if (process.env.NODE_ENV !== 'production') {
7507
7880
  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}.`);
@@ -7521,13 +7894,13 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
7521
7894
  ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
7522
7895
  }
7523
7896
  // we need to end the measure before throwing.
7524
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
7897
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7525
7898
  // re-throwing the original error will break the current tick, but since the next tick is
7526
7899
  // already scheduled, it should continue patching the rest.
7527
7900
  throw error;
7528
7901
  }
7529
7902
  }
7530
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
7903
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7531
7904
  }
7532
7905
  function runConnectedCallback(vm) {
7533
7906
  const {
@@ -8196,6 +8569,8 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
8196
8569
  const {
8197
8570
  setProperty
8198
8571
  } = renderer;
8572
+ // We only set the `nodeValue` property here (on a comment), so we don't need
8573
+ // to sanitize the content as HTML using `safelySetProperty`
8199
8574
  setProperty(node, NODE_VALUE_PROP, vnode.text ?? null);
8200
8575
  vnode.elm = node;
8201
8576
  return node;
@@ -8255,7 +8630,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
8255
8630
  getProperty
8256
8631
  } = renderer;
8257
8632
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
8258
- if (getProperty(elm, 'innerHTML') === props.innerHTML) {
8633
+ if (isSanitizedHtmlContentEqual(getProperty(elm, 'innerHTML'), props.innerHTML)) {
8259
8634
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
8260
8635
  vnode.data = {
8261
8636
  ...vnode.data,
@@ -8718,7 +9093,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
8718
9093
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8719
9094
  */
8720
9095
  // See @lwc/engine-core/src/framework/template.ts
8721
- const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
9096
+ const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode', 'legacyStylesheetToken'];
8722
9097
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
8723
9098
  const STYLESHEET_PROPS = [
8724
9099
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
@@ -8953,7 +9328,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
8953
9328
  }
8954
9329
  return getReadOnlyProxy(obj);
8955
9330
  }
8956
- /** version: 7.2.1 */
9331
+ /** version: 8.1.2 */
8957
9332
 
8958
9333
  /*
8959
9334
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9247,7 +9622,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
9247
9622
  formStateRestoreCallback(state, reason) {
9248
9623
  runFormStateRestoreCallback(this, state, reason);
9249
9624
  }
9250
- /*LWC compiler v7.2.1*/
9625
+ /*LWC compiler v8.1.2*/
9251
9626
  };
9252
9627
  BaseHTMLElement = HTMLElement; // cache to track if it changes
9253
9628
  }
@@ -9262,7 +9637,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
9262
9637
  // Using a BaseUpgradableConstructor superclass here is a perf optimization to avoid
9263
9638
  // re-defining the same logic (connectedCallback, disconnectedCallback, etc.) over and over.
9264
9639
  class UpgradableConstructor extends BaseUpgradableConstructor {
9265
- /*LWC compiler v7.2.1*/
9640
+ /*LWC compiler v8.1.2*/
9266
9641
  }
9267
9642
  if (isFormAssociated) {
9268
9643
  // Perf optimization - the vast majority of components have formAssociated=false,
@@ -9385,7 +9760,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
9385
9760
  function isNull(obj) {
9386
9761
  return obj === null;
9387
9762
  }
9388
- /** version: 7.2.1 */
9763
+ /** version: 8.1.2 */
9389
9764
 
9390
9765
  /*
9391
9766
  * Copyright (c) 2023, salesforce.com, inc.
@@ -9405,7 +9780,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
9405
9780
  this.setNewContext = setNewContext;
9406
9781
  this.setDisconnectedCallback = setDisconnectedCallback;
9407
9782
  }
9408
- /*LWC compiler v7.2.1*/
9783
+ /*LWC compiler v8.1.2*/
9409
9784
  }
9410
9785
  function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
9411
9786
  dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
@@ -9828,7 +10203,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
9828
10203
  formStateRestoreCallback(state, reason) {
9829
10204
  runFormStateRestoreCallback(this, state, reason);
9830
10205
  }
9831
- /*LWC compiler v7.2.1*/
10206
+ /*LWC compiler v8.1.2*/
9832
10207
  }, _a.observedAttributes = observedAttributes,
9833
10208
  // Note CustomElementConstructor is not upgraded by LWC and inherits directly from HTMLElement which means it calls the native
9834
10209
  // attachInternals API.
@@ -10074,7 +10449,7 @@ LWR.define('lwc/v/7_2_1', ['exports'], (function (exports) { 'use strict';
10074
10449
  });
10075
10450
  });
10076
10451
  }
10077
- /** version: 7.2.1 */
10452
+ /** version: 8.1.2 */
10078
10453
 
10079
10454
  exports.LightningElement = LightningElement;
10080
10455
  exports.__unstable__ProfilerControl = profilerControl;