lwc 2.34.0 → 2.35.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 +939 -763
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +939 -762
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +846 -684
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1115 -922
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +801 -619
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +939 -762
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +846 -684
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1115 -922
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +801 -619
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +1025 -1082
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +1025 -1082
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +21 -41
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +21 -41
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +20 -39
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +24 -38
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +23 -36
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +21 -41
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +20 -39
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +24 -38
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +23 -36
  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
@@ -51,7 +51,7 @@
51
51
  const { isArray: isArray$1 } = Array;
52
52
  const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
53
53
  const { fromCharCode: StringFromCharCode } = String;
54
- const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
54
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
55
55
  function isUndefined$1(obj) {
56
56
  return obj === undefined;
57
57
  }
@@ -185,6 +185,19 @@
185
185
  });
186
186
  return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
187
187
  })();
188
+ // These attributes take either an ID or a list of IDs as values.
189
+ // This includes aria-* attributes as well as the special non-ARIA "for" attribute
190
+ const ID_REFERENCING_ATTRIBUTES_SET = new Set([
191
+ 'aria-activedescendant',
192
+ 'aria-controls',
193
+ 'aria-describedby',
194
+ 'aria-details',
195
+ 'aria-errormessage',
196
+ 'aria-flowto',
197
+ 'aria-labelledby',
198
+ 'aria-owns',
199
+ 'for',
200
+ ]);
188
201
 
189
202
  /*
190
203
  * Copyright (c) 2018, salesforce.com, inc.
@@ -192,41 +205,11 @@
192
205
  * SPDX-License-Identifier: MIT
193
206
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
194
207
  */
195
- // Inspired from: https://mathiasbynens.be/notes/globalthis
196
- const _globalThis = /*@__PURE__*/ (function () {
197
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
198
- if (typeof globalThis === 'object') {
199
- return globalThis;
200
- }
201
- let _globalThis;
202
- try {
203
- // eslint-disable-next-line no-extend-native
204
- Object.defineProperty(Object.prototype, '__magic__', {
205
- get: function () {
206
- return this;
207
- },
208
- configurable: true,
209
- });
210
- // __magic__ is undefined in Safari 10 and IE10 and older.
211
- // @ts-ignore
212
- // eslint-disable-next-line no-undef
213
- _globalThis = __magic__;
214
- // @ts-ignore
215
- delete Object.prototype.__magic__;
216
- }
217
- catch (ex) {
218
- // In IE8, Object.defineProperty only works on DOM objects.
219
- }
220
- finally {
221
- // If the magic above fails for some reason we assume that we are in a legacy browser.
222
- // Assume `window` exists in this case.
223
- if (typeof _globalThis === 'undefined') {
224
- // @ts-ignore
225
- _globalThis = window;
226
- }
227
- }
228
- return _globalThis;
229
- })();
208
+ // See browser support for globalThis:
209
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
210
+ /* istanbul ignore next */
211
+ // @ts-ignore
212
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
230
213
 
231
214
  /*
232
215
  * Copyright (c) 2018, salesforce.com, inc.
@@ -240,6 +223,8 @@
240
223
  const KEY__SHADOW_TOKEN = '$shadowToken$';
241
224
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
242
225
  const KEY__SCOPED_CSS = '$scoped$';
226
+ const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
227
+ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
243
228
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
244
229
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
245
230
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
@@ -339,7 +324,7 @@
339
324
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
340
325
  return propertyName;
341
326
  }
342
- /** version: 2.34.0 */
327
+ /** version: 2.35.1 */
343
328
 
344
329
  /**
345
330
  * Copyright (C) 2018 salesforce.com, inc.
@@ -389,6 +374,7 @@
389
374
  console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
390
375
  return;
391
376
  }
377
+ // This may seem redundant, but `"production" === 'test-karma-lwc'` is replaced by Karma tests
392
378
  {
393
379
  // Disallow the same flag to be set more than once in production
394
380
  const runtimeValue = lwcRuntimeFlags[name];
@@ -406,7 +392,7 @@
406
392
  */
407
393
  function setFeatureFlagForTest(name, value) {
408
394
  }
409
- /** version: 2.34.0 */
395
+ /** version: 2.35.1 */
410
396
 
411
397
  /**
412
398
  * Copyright (C) 2018 salesforce.com, inc.
@@ -470,7 +456,7 @@
470
456
  }
471
457
  }
472
458
  }
473
- /** version: 2.34.0 */
459
+ /** version: 2.35.1 */
474
460
 
475
461
  /*
476
462
  * Copyright (c) 2018, salesforce.com, inc.
@@ -490,81 +476,148 @@
490
476
  * SPDX-License-Identifier: MIT
491
477
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
492
478
  */
493
- let nextTickCallbackQueue = [];
494
- const SPACE_CHAR = 32;
495
- const EmptyObject = seal(create(null));
496
- const EmptyArray = seal([]);
497
- function flushCallbackQueue() {
498
- const callbacks = nextTickCallbackQueue;
499
- nextTickCallbackQueue = []; // reset to a new queue
500
- for (let i = 0, len = callbacks.length; i < len; i += 1) {
501
- callbacks[i]();
479
+ /** Callbacks to invoke when reporting is enabled **/
480
+ const onReportingEnabledCallbacks = [];
481
+ /** The currently assigned reporting dispatcher. */
482
+ let currentDispatcher$1 = noop;
483
+ /**
484
+ * Whether reporting is enabled.
485
+ *
486
+ * Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
487
+ * but it turns out that Terser only strips out unused code if we use this explicit boolean.
488
+ */
489
+ let enabled$1 = false;
490
+ const reportingControl = {
491
+ /**
492
+ * Attach a new reporting control (aka dispatcher).
493
+ *
494
+ * @param dispatcher - reporting control
495
+ */
496
+ attachDispatcher(dispatcher) {
497
+ enabled$1 = true;
498
+ currentDispatcher$1 = dispatcher;
499
+ for (const callback of onReportingEnabledCallbacks) {
500
+ try {
501
+ callback();
502
+ }
503
+ catch (err) {
504
+ // This should never happen. But if it does, we don't want one callback to cause another to fail
505
+ // eslint-disable-next-line no-console
506
+ console.error('Could not invoke callback', err);
507
+ }
508
+ }
509
+ onReportingEnabledCallbacks.length = 0; // clear the array
510
+ },
511
+ /**
512
+ * Detach the current reporting control (aka dispatcher).
513
+ */
514
+ detachDispatcher() {
515
+ enabled$1 = false;
516
+ currentDispatcher$1 = noop;
517
+ },
518
+ };
519
+ /**
520
+ * Call a callback when reporting is enabled, or immediately if reporting is already enabled.
521
+ * Will only ever be called once.
522
+ * @param callback
523
+ */
524
+ function onReportingEnabled(callback) {
525
+ if (enabled$1) {
526
+ // call immediately
527
+ callback();
528
+ }
529
+ else {
530
+ // call later
531
+ onReportingEnabledCallbacks.push(callback);
502
532
  }
503
533
  }
504
- function addCallbackToNextTick(callback) {
505
- if (nextTickCallbackQueue.length === 0) {
506
- Promise.resolve().then(flushCallbackQueue);
534
+ /**
535
+ * Report to the current dispatcher, if there is one.
536
+ * @param reportingEventId
537
+ * @param vm
538
+ */
539
+ function report(reportingEventId, vm) {
540
+ if (enabled$1) {
541
+ currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
507
542
  }
508
- ArrayPush$1.call(nextTickCallbackQueue, callback);
509
543
  }
510
- function guid() {
511
- function s4() {
512
- return Math.floor((1 + Math.random()) * 0x10000)
513
- .toString(16)
514
- .substring(1);
544
+
545
+ /*
546
+ * Copyright (c) 2018, salesforce.com, inc.
547
+ * All rights reserved.
548
+ * SPDX-License-Identifier: MIT
549
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
550
+ */
551
+ function getComponentTag(vm) {
552
+ return `<${StringToLowerCase.call(vm.tagName)}>`;
553
+ }
554
+ // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
555
+ function getComponentStack(vm) {
556
+ const stack = [];
557
+ let prefix = '';
558
+ while (!isNull(vm.owner)) {
559
+ ArrayPush$1.call(stack, prefix + getComponentTag(vm));
560
+ vm = vm.owner;
561
+ prefix += '\t';
515
562
  }
516
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
563
+ return ArrayJoin.call(stack, '\n');
517
564
  }
518
- // Borrowed from Vue template compiler.
519
- // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
520
- const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
521
- const PROPERTY_DELIMITER = /:(.+)/;
522
- function parseStyleText(cssText) {
523
- const styleMap = {};
524
- const declarations = cssText.split(DECLARATION_DELIMITER);
525
- for (const declaration of declarations) {
526
- if (declaration) {
527
- const [prop, value] = declaration.split(PROPERTY_DELIMITER);
528
- if (prop !== undefined && value !== undefined) {
529
- styleMap[prop.trim()] = value.trim();
530
- }
531
- }
565
+ function getErrorComponentStack(vm) {
566
+ const wcStack = [];
567
+ let currentVm = vm;
568
+ while (!isNull(currentVm)) {
569
+ ArrayPush$1.call(wcStack, getComponentTag(currentVm));
570
+ currentVm = currentVm.owner;
532
571
  }
533
- return styleMap;
572
+ return wcStack.reverse().join('\n\t');
534
573
  }
535
- // Make a shallow copy of an object but omit the given key
536
- function cloneAndOmitKey(object, keyToOmit) {
537
- const result = {};
538
- for (const key of Object.keys(object)) {
539
- if (key !== keyToOmit) {
540
- result[key] = object[key];
541
- }
574
+
575
+ /*
576
+ * Copyright (c) 2018, salesforce.com, inc.
577
+ * All rights reserved.
578
+ * SPDX-License-Identifier: MIT
579
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
580
+ */
581
+ function addErrorComponentStack(vm, error) {
582
+ if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
583
+ const wcStack = getErrorComponentStack(vm);
584
+ defineProperty(error, 'wcStack', {
585
+ get() {
586
+ return wcStack;
587
+ },
588
+ });
542
589
  }
543
- return result;
544
590
  }
545
- function flattenStylesheets(stylesheets) {
546
- const list = [];
547
- for (const stylesheet of stylesheets) {
548
- if (!Array.isArray(stylesheet)) {
549
- list.push(stylesheet);
550
- }
551
- else {
552
- list.push(...flattenStylesheets(stylesheet));
591
+
592
+ /*
593
+ * Copyright (c) 2018, salesforce.com, inc.
594
+ * All rights reserved.
595
+ * SPDX-License-Identifier: MIT
596
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
597
+ */
598
+ const alreadyLoggedMessages = new Set();
599
+ function log(method, message, vm, once) {
600
+ let msg = `[LWC ${method}]: ${message}`;
601
+ if (!isUndefined$1(vm)) {
602
+ msg = `${msg}\n${getComponentStack(vm)}`;
603
+ }
604
+ if (once) {
605
+ if (alreadyLoggedMessages.has(msg)) {
606
+ return;
553
607
  }
608
+ alreadyLoggedMessages.add(msg);
554
609
  }
555
- return list;
556
- }
557
- // Set a ref (lwc:ref) on a VM, from a template API
558
- function setRefVNode(vm, ref, vnode) {
559
- // If this method is called, then vm.refVNodes is set as the template has refs.
560
- // If not, then something went wrong and we threw an error above.
561
- const refVNodes = vm.refVNodes;
562
- // In cases of conflict (two elements with the same ref), prefer, the last one,
563
- // in depth-first traversal order.
564
- if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
565
- refVNodes[ref] = vnode;
610
+ try {
611
+ throw new Error(msg);
612
+ }
613
+ catch (e) {
614
+ /* eslint-disable-next-line no-console */
615
+ console[method](e);
566
616
  }
567
617
  }
618
+ function logError(message, vm) {
619
+ log('error', message, vm, false);
620
+ }
568
621
 
569
622
  /*
570
623
  * Copyright (c) 2019, salesforce.com, inc.
@@ -686,72 +739,92 @@
686
739
  * SPDX-License-Identifier: MIT
687
740
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
688
741
  */
689
- function getComponentTag(vm) {
690
- return `<${StringToLowerCase.call(vm.tagName)}>`;
742
+ let nextTickCallbackQueue = [];
743
+ const SPACE_CHAR = 32;
744
+ const EmptyObject = seal(create(null));
745
+ const EmptyArray = seal([]);
746
+ function flushCallbackQueue() {
747
+ const callbacks = nextTickCallbackQueue;
748
+ nextTickCallbackQueue = []; // reset to a new queue
749
+ for (let i = 0, len = callbacks.length; i < len; i += 1) {
750
+ callbacks[i]();
751
+ }
691
752
  }
692
- // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
693
- function getComponentStack(vm) {
694
- const stack = [];
695
- let prefix = '';
696
- while (!isNull(vm.owner)) {
697
- ArrayPush$1.call(stack, prefix + getComponentTag(vm));
698
- vm = vm.owner;
699
- prefix += '\t';
753
+ function addCallbackToNextTick(callback) {
754
+ if (nextTickCallbackQueue.length === 0) {
755
+ Promise.resolve().then(flushCallbackQueue);
700
756
  }
701
- return ArrayJoin.call(stack, '\n');
757
+ ArrayPush$1.call(nextTickCallbackQueue, callback);
702
758
  }
703
- function getErrorComponentStack(vm) {
704
- const wcStack = [];
705
- let currentVm = vm;
706
- while (!isNull(currentVm)) {
707
- ArrayPush$1.call(wcStack, getComponentTag(currentVm));
708
- currentVm = currentVm.owner;
759
+ function guid() {
760
+ function s4() {
761
+ return Math.floor((1 + Math.random()) * 0x10000)
762
+ .toString(16)
763
+ .substring(1);
764
+ }
765
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
766
+ }
767
+ // Borrowed from Vue template compiler.
768
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
769
+ const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
770
+ const PROPERTY_DELIMITER = /:(.+)/;
771
+ function parseStyleText(cssText) {
772
+ const styleMap = {};
773
+ const declarations = cssText.split(DECLARATION_DELIMITER);
774
+ for (const declaration of declarations) {
775
+ if (declaration) {
776
+ const [prop, value] = declaration.split(PROPERTY_DELIMITER);
777
+ if (prop !== undefined && value !== undefined) {
778
+ styleMap[prop.trim()] = value.trim();
779
+ }
780
+ }
781
+ }
782
+ return styleMap;
783
+ }
784
+ // Make a shallow copy of an object but omit the given key
785
+ function cloneAndOmitKey(object, keyToOmit) {
786
+ const result = {};
787
+ for (const key of Object.keys(object)) {
788
+ if (key !== keyToOmit) {
789
+ result[key] = object[key];
790
+ }
791
+ }
792
+ return result;
793
+ }
794
+ function flattenStylesheets(stylesheets) {
795
+ const list = [];
796
+ for (const stylesheet of stylesheets) {
797
+ if (!Array.isArray(stylesheet)) {
798
+ list.push(stylesheet);
799
+ }
800
+ else {
801
+ list.push(...flattenStylesheets(stylesheet));
802
+ }
803
+ }
804
+ return list;
805
+ }
806
+ // Set a ref (lwc:ref) on a VM, from a template API
807
+ function setRefVNode(vm, ref, vnode) {
808
+ // If this method is called, then vm.refVNodes is set as the template has refs.
809
+ // If not, then something went wrong and we threw an error above.
810
+ const refVNodes = vm.refVNodes;
811
+ // In cases of conflict (two elements with the same ref), prefer, the last one,
812
+ // in depth-first traversal order.
813
+ if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
814
+ refVNodes[ref] = vnode;
815
+ }
816
+ }
817
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
818
+ function assertNotProd() {
819
+ /* istanbul ignore if */
820
+ {
821
+ // this method should never leak to prod
822
+ throw new ReferenceError();
709
823
  }
710
- return wcStack.reverse().join('\n\t');
711
824
  }
712
825
 
713
826
  /*
714
- * Copyright (c) 2018, salesforce.com, inc.
715
- * All rights reserved.
716
- * SPDX-License-Identifier: MIT
717
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
718
- */
719
- function addErrorComponentStack(vm, error) {
720
- if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
721
- const wcStack = getErrorComponentStack(vm);
722
- defineProperty(error, 'wcStack', {
723
- get() {
724
- return wcStack;
725
- },
726
- });
727
- }
728
- }
729
-
730
- /*
731
- * Copyright (c) 2018, salesforce.com, inc.
732
- * All rights reserved.
733
- * SPDX-License-Identifier: MIT
734
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
735
- */
736
- function log(method, message, vm) {
737
- let msg = `[LWC ${method}]: ${message}`;
738
- if (!isUndefined$1(vm)) {
739
- msg = `${msg}\n${getComponentStack(vm)}`;
740
- }
741
- try {
742
- throw new Error(msg);
743
- }
744
- catch (e) {
745
- /* eslint-disable-next-line no-console */
746
- console[method](e);
747
- }
748
- }
749
- function logError(message, vm) {
750
- log('error', message, vm);
751
- }
752
-
753
- /*
754
- * Copyright (c) 2020, salesforce.com, inc.
827
+ * Copyright (c) 2020, salesforce.com, inc.
755
828
  * All rights reserved.
756
829
  * SPDX-License-Identifier: MIT
757
830
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -793,101 +866,6 @@
793
866
  'tabIndex',
794
867
  'title',
795
868
  ];
796
- function offsetPropertyErrorMessage(name) {
797
- return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
798
- }
799
- // Global HTML Attributes & Properties
800
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
801
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
802
- //
803
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
804
- // for e.g. "dropzone" should suffice.
805
- assign(create(null), {
806
- accessKey: {
807
- attribute: 'accesskey',
808
- },
809
- accessKeyLabel: {
810
- readOnly: true,
811
- },
812
- className: {
813
- attribute: 'class',
814
- error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.',
815
- },
816
- contentEditable: {
817
- attribute: 'contenteditable',
818
- },
819
- dataset: {
820
- readOnly: true,
821
- error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.",
822
- },
823
- dir: {
824
- attribute: 'dir',
825
- },
826
- draggable: {
827
- attribute: 'draggable',
828
- },
829
- dropzone: {
830
- attribute: 'dropzone',
831
- readOnly: true,
832
- },
833
- hidden: {
834
- attribute: 'hidden',
835
- },
836
- id: {
837
- attribute: 'id',
838
- },
839
- inputMode: {
840
- attribute: 'inputmode',
841
- },
842
- lang: {
843
- attribute: 'lang',
844
- },
845
- slot: {
846
- attribute: 'slot',
847
- error: 'Using the `slot` property is an anti-pattern.',
848
- },
849
- spellcheck: {
850
- attribute: 'spellcheck',
851
- },
852
- style: {
853
- attribute: 'style',
854
- },
855
- tabIndex: {
856
- attribute: 'tabindex',
857
- },
858
- title: {
859
- attribute: 'title',
860
- },
861
- translate: {
862
- attribute: 'translate',
863
- },
864
- // additional "global attributes" that are not present in the link above.
865
- isContentEditable: {
866
- readOnly: true,
867
- },
868
- offsetHeight: {
869
- readOnly: true,
870
- error: offsetPropertyErrorMessage('offsetHeight'),
871
- },
872
- offsetLeft: {
873
- readOnly: true,
874
- error: offsetPropertyErrorMessage('offsetLeft'),
875
- },
876
- offsetParent: {
877
- readOnly: true,
878
- },
879
- offsetTop: {
880
- readOnly: true,
881
- error: offsetPropertyErrorMessage('offsetTop'),
882
- },
883
- offsetWidth: {
884
- readOnly: true,
885
- error: offsetPropertyErrorMessage('offsetWidth'),
886
- },
887
- role: {
888
- attribute: 'role',
889
- },
890
- });
891
869
  let controlledElement = null;
892
870
  let controlledAttributeName;
893
871
  function isAttributeLocked(elm, attrName) {
@@ -1434,7 +1412,6 @@
1434
1412
  }
1435
1413
  };
1436
1414
  }
1437
- const EMPTY_REFS = freeze(create(null));
1438
1415
  const refsCache = new WeakMap();
1439
1416
  /**
1440
1417
  * This class is the base class for any LWC element.
@@ -1672,22 +1649,15 @@
1672
1649
  }
1673
1650
  const {
1674
1651
  refVNodes,
1675
- hasRefVNodes,
1676
1652
  cmpTemplate
1677
1653
  } = vm;
1678
1654
  // For backwards compatibility with component written before template refs
1679
1655
  // were introduced, we return undefined if the template has no refs defined
1680
1656
  // anywhere. This fixes components that may want to add an expando called `refs`
1681
1657
  // and are checking if it exists with `if (this.refs)` before adding it.
1682
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
1683
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
1684
- if (!hasRefVNodes) {
1685
- return;
1686
- }
1687
- // For templates that are using `lwc:ref`, if there are no refs currently available
1688
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
1658
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
1689
1659
  if (isNull(refVNodes)) {
1690
- return EMPTY_REFS;
1660
+ return;
1691
1661
  }
1692
1662
  // The refNodes can be cached based on the refVNodes, since the refVNodes
1693
1663
  // are recreated from scratch every time the template is rendered.
@@ -1821,107 +1791,371 @@
1821
1791
  * SPDX-License-Identifier: MIT
1822
1792
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1823
1793
  */
1824
- function api$1() {
1825
- throw new Error();
1794
+ const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
1795
+ const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
1796
+ const WireMetaMap = new Map();
1797
+ class WireContextRegistrationEvent extends CustomEvent {
1798
+ constructor(adapterToken, {
1799
+ setNewContext,
1800
+ setDisconnectedCallback
1801
+ }) {
1802
+ super(adapterToken, {
1803
+ bubbles: true,
1804
+ composed: true
1805
+ });
1806
+ defineProperties(this, {
1807
+ setNewContext: {
1808
+ value: setNewContext
1809
+ },
1810
+ setDisconnectedCallback: {
1811
+ value: setDisconnectedCallback
1812
+ }
1813
+ });
1814
+ }
1826
1815
  }
1827
- function createPublicPropertyDescriptor(key) {
1828
- return {
1829
- get() {
1830
- const vm = getAssociatedVM(this);
1831
- if (isBeingConstructed(vm)) {
1832
- return;
1833
- }
1834
- componentValueObserved(vm, key);
1835
- return vm.cmpProps[key];
1836
- },
1837
- set(newValue) {
1838
- const vm = getAssociatedVM(this);
1839
- vm.cmpProps[key] = newValue;
1840
- componentValueMutated(vm, key);
1841
- },
1842
- enumerable: true,
1843
- configurable: true,
1844
- };
1816
+ function createFieldDataCallback(vm, name) {
1817
+ return value => {
1818
+ updateComponentValue(vm, name, value);
1819
+ };
1845
1820
  }
1846
- function createPublicAccessorDescriptor(key, descriptor) {
1847
- const { get, set, enumerable, configurable } = descriptor;
1848
- if (!isFunction$1(get)) {
1849
- throw new Error();
1850
- }
1851
- return {
1852
- get() {
1853
- return get.call(this);
1854
- },
1855
- set(newValue) {
1856
- getAssociatedVM(this);
1857
- if (set) {
1858
- set.call(this, newValue);
1859
- }
1860
- },
1861
- enumerable,
1862
- configurable,
1863
- };
1821
+ function createMethodDataCallback(vm, method) {
1822
+ return value => {
1823
+ // dispatching new value into the wired method
1824
+ runWithBoundaryProtection(vm, vm.owner, noop, () => {
1825
+ // job
1826
+ method.call(vm.component, value);
1827
+ }, noop);
1828
+ };
1864
1829
  }
1865
-
1866
- /*
1867
- * Copyright (c) 2018, salesforce.com, inc.
1868
- * All rights reserved.
1869
- * SPDX-License-Identifier: MIT
1870
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1871
- */
1872
- function track(target) {
1873
- if (arguments.length === 1) {
1874
- return getReactiveProxy(target);
1830
+ function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
1831
+ let hasPendingConfig = false;
1832
+ // creating the reactive observer for reactive params when needed
1833
+ const ro = createReactiveObserver(() => {
1834
+ if (hasPendingConfig === false) {
1835
+ hasPendingConfig = true;
1836
+ // collect new config in the micro-task
1837
+ Promise.resolve().then(() => {
1838
+ hasPendingConfig = false;
1839
+ // resetting current reactive params
1840
+ ro.reset();
1841
+ // dispatching a new config due to a change in the configuration
1842
+ computeConfigAndUpdate();
1843
+ });
1875
1844
  }
1876
- throw new Error();
1877
- }
1878
- function internalTrackDecorator(key) {
1879
- return {
1880
- get() {
1881
- const vm = getAssociatedVM(this);
1882
- componentValueObserved(vm, key);
1883
- return vm.cmpFields[key];
1884
- },
1885
- set(newValue) {
1886
- const vm = getAssociatedVM(this);
1887
- const reactiveOrAnyValue = getReactiveProxy(newValue);
1888
- updateComponentValue(vm, key, reactiveOrAnyValue);
1889
- },
1890
- enumerable: true,
1891
- configurable: true,
1892
- };
1845
+ });
1846
+ const computeConfigAndUpdate = () => {
1847
+ let config;
1848
+ ro.observe(() => config = configCallback(component));
1849
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
1850
+ // TODO: dev-mode validation of config based on the adapter.configSchema
1851
+ // @ts-ignore it is assigned in the observe() callback
1852
+ callbackWhenConfigIsReady(config);
1853
+ };
1854
+ return {
1855
+ computeConfigAndUpdate,
1856
+ ro
1857
+ };
1893
1858
  }
1859
+ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
1860
+ const {
1861
+ adapter
1862
+ } = wireDef;
1863
+ const adapterContextToken = getAdapterToken(adapter);
1864
+ if (isUndefined$1(adapterContextToken)) {
1865
+ return; // no provider found, nothing to be done
1866
+ }
1894
1867
 
1895
- /*
1896
- * Copyright (c) 2018, salesforce.com, inc.
1897
- * All rights reserved.
1898
- * SPDX-License-Identifier: MIT
1899
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1900
- */
1901
- /**
1902
- * @wire decorator to wire fields and methods to a wire adapter in
1903
- * LWC Components. This function implements the internals of this
1904
- * decorator.
1905
- */
1906
- function wire(_adapter, _config) {
1907
- throw new Error();
1868
+ const {
1869
+ elm,
1870
+ context: {
1871
+ wiredConnecting,
1872
+ wiredDisconnecting
1873
+ },
1874
+ renderer: {
1875
+ dispatchEvent
1876
+ }
1877
+ } = vm;
1878
+ // waiting for the component to be connected to formally request the context via the token
1879
+ ArrayPush$1.call(wiredConnecting, () => {
1880
+ // This event is responsible for connecting the host element with another
1881
+ // element in the composed path that is providing contextual data. The provider
1882
+ // must be listening for a special dom event with the name corresponding to the value of
1883
+ // `adapterContextToken`, which will remain secret and internal to this file only to
1884
+ // guarantee that the linkage can be forged.
1885
+ const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
1886
+ setNewContext(newContext) {
1887
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
1888
+ // TODO: dev-mode validation of config based on the adapter.contextSchema
1889
+ callbackWhenContextIsReady(newContext);
1890
+ },
1891
+ setDisconnectedCallback(disconnectCallback) {
1892
+ // adds this callback into the disconnect bucket so it gets disconnected from parent
1893
+ // the the element hosting the wire is disconnected
1894
+ ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
1895
+ }
1896
+ });
1897
+ dispatchEvent(elm, contextRegistrationEvent);
1898
+ });
1908
1899
  }
1909
- function internalWireFieldDecorator(key) {
1910
- return {
1911
- get() {
1912
- const vm = getAssociatedVM(this);
1913
- componentValueObserved(vm, key);
1914
- return vm.cmpFields[key];
1915
- },
1916
- set(value) {
1917
- const vm = getAssociatedVM(this);
1918
- /**
1919
- * Reactivity for wired fields is provided in wiring.
1920
- * We intentionally add reactivity here since this is just
1921
- * letting the author to do the wrong thing, but it will keep our
1922
- * system to be backward compatible.
1923
- */
1924
- updateComponentValue(vm, key, value);
1900
+ function createConnector(vm, name, wireDef) {
1901
+ const {
1902
+ method,
1903
+ adapter,
1904
+ configCallback,
1905
+ dynamic
1906
+ } = wireDef;
1907
+ let debugInfo;
1908
+ const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
1909
+ const dataCallback = value => {
1910
+ fieldOrMethodCallback(value);
1911
+ };
1912
+ let context;
1913
+ let connector;
1914
+ // Workaround to pass the component element associated to this wire adapter instance.
1915
+ defineProperty(dataCallback, DeprecatedWiredElementHost, {
1916
+ value: vm.elm
1917
+ });
1918
+ defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
1919
+ value: dynamic
1920
+ });
1921
+ runWithBoundaryProtection(vm, vm, noop, () => {
1922
+ // job
1923
+ connector = new adapter(dataCallback);
1924
+ }, noop);
1925
+ const updateConnectorConfig = config => {
1926
+ // every time the config is recomputed due to tracking,
1927
+ // this callback will be invoked with the new computed config
1928
+ runWithBoundaryProtection(vm, vm, noop, () => {
1929
+ // job
1930
+ if ("production" !== 'production') ;
1931
+ connector.update(config, context);
1932
+ }, noop);
1933
+ };
1934
+ // Computes the current wire config and calls the update method on the wire adapter.
1935
+ // If it has params, we will need to observe changes in the next tick.
1936
+ const {
1937
+ computeConfigAndUpdate,
1938
+ ro
1939
+ } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
1940
+ // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
1941
+ if (!isUndefined$1(adapter.contextSchema)) {
1942
+ createContextWatcher(vm, wireDef, newContext => {
1943
+ // every time the context is pushed into this component,
1944
+ // this callback will be invoked with the new computed context
1945
+ if (context !== newContext) {
1946
+ context = newContext;
1947
+ // Note: when new context arrives, the config will be recomputed and pushed along side the new
1948
+ // context, this is to preserve the identity characteristics, config should not have identity
1949
+ // (ever), while context can have identity
1950
+ if (vm.state === 1 /* VMState.connected */) {
1951
+ computeConfigAndUpdate();
1952
+ }
1953
+ }
1954
+ });
1955
+ }
1956
+ return {
1957
+ // @ts-ignore the boundary protection executes sync, connector is always defined
1958
+ connector,
1959
+ computeConfigAndUpdate,
1960
+ resetConfigWatcher: () => ro.reset()
1961
+ };
1962
+ }
1963
+ const AdapterToTokenMap = new Map();
1964
+ function getAdapterToken(adapter) {
1965
+ return AdapterToTokenMap.get(adapter);
1966
+ }
1967
+ function setAdapterToken(adapter, token) {
1968
+ AdapterToTokenMap.set(adapter, token);
1969
+ }
1970
+ function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
1971
+ // support for callable adapters
1972
+ if (adapter.adapter) {
1973
+ adapter = adapter.adapter;
1974
+ }
1975
+ const method = descriptor.value;
1976
+ const def = {
1977
+ adapter,
1978
+ method,
1979
+ configCallback,
1980
+ dynamic
1981
+ };
1982
+ WireMetaMap.set(descriptor, def);
1983
+ }
1984
+ function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
1985
+ // support for callable adapters
1986
+ if (adapter.adapter) {
1987
+ adapter = adapter.adapter;
1988
+ }
1989
+ const def = {
1990
+ adapter,
1991
+ configCallback,
1992
+ dynamic
1993
+ };
1994
+ WireMetaMap.set(descriptor, def);
1995
+ }
1996
+ function installWireAdapters(vm) {
1997
+ const {
1998
+ context,
1999
+ def: {
2000
+ wire
2001
+ }
2002
+ } = vm;
2003
+ const wiredConnecting = context.wiredConnecting = [];
2004
+ const wiredDisconnecting = context.wiredDisconnecting = [];
2005
+ for (const fieldNameOrMethod in wire) {
2006
+ const descriptor = wire[fieldNameOrMethod];
2007
+ const wireDef = WireMetaMap.get(descriptor);
2008
+ if (!isUndefined$1(wireDef)) {
2009
+ const {
2010
+ connector,
2011
+ computeConfigAndUpdate,
2012
+ resetConfigWatcher
2013
+ } = createConnector(vm, fieldNameOrMethod, wireDef);
2014
+ const hasDynamicParams = wireDef.dynamic.length > 0;
2015
+ ArrayPush$1.call(wiredConnecting, () => {
2016
+ connector.connect();
2017
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
2018
+ if (hasDynamicParams) {
2019
+ Promise.resolve().then(computeConfigAndUpdate);
2020
+ return;
2021
+ }
2022
+ }
2023
+ computeConfigAndUpdate();
2024
+ });
2025
+ ArrayPush$1.call(wiredDisconnecting, () => {
2026
+ connector.disconnect();
2027
+ resetConfigWatcher();
2028
+ });
2029
+ }
2030
+ }
2031
+ }
2032
+ function connectWireAdapters(vm) {
2033
+ const {
2034
+ wiredConnecting
2035
+ } = vm.context;
2036
+ for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
2037
+ wiredConnecting[i]();
2038
+ }
2039
+ }
2040
+ function disconnectWireAdapters(vm) {
2041
+ const {
2042
+ wiredDisconnecting
2043
+ } = vm.context;
2044
+ runWithBoundaryProtection(vm, vm, noop, () => {
2045
+ // job
2046
+ for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
2047
+ wiredDisconnecting[i]();
2048
+ }
2049
+ }, noop);
2050
+ }
2051
+
2052
+ /*
2053
+ * Copyright (c) 2018, salesforce.com, inc.
2054
+ * All rights reserved.
2055
+ * SPDX-License-Identifier: MIT
2056
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2057
+ */
2058
+ function api$1() {
2059
+ throw new Error();
2060
+ }
2061
+ function createPublicPropertyDescriptor(key) {
2062
+ return {
2063
+ get() {
2064
+ const vm = getAssociatedVM(this);
2065
+ if (isBeingConstructed(vm)) {
2066
+ return;
2067
+ }
2068
+ componentValueObserved(vm, key);
2069
+ return vm.cmpProps[key];
2070
+ },
2071
+ set(newValue) {
2072
+ const vm = getAssociatedVM(this);
2073
+ vm.cmpProps[key] = newValue;
2074
+ componentValueMutated(vm, key);
2075
+ },
2076
+ enumerable: true,
2077
+ configurable: true,
2078
+ };
2079
+ }
2080
+ function createPublicAccessorDescriptor(key, descriptor) {
2081
+ const { get, set, enumerable, configurable } = descriptor;
2082
+ if (!isFunction$1(get)) {
2083
+ throw new Error();
2084
+ }
2085
+ return {
2086
+ get() {
2087
+ return get.call(this);
2088
+ },
2089
+ set(newValue) {
2090
+ getAssociatedVM(this);
2091
+ if (set) {
2092
+ set.call(this, newValue);
2093
+ }
2094
+ },
2095
+ enumerable,
2096
+ configurable,
2097
+ };
2098
+ }
2099
+
2100
+ /*
2101
+ * Copyright (c) 2018, salesforce.com, inc.
2102
+ * All rights reserved.
2103
+ * SPDX-License-Identifier: MIT
2104
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2105
+ */
2106
+ function track(target) {
2107
+ if (arguments.length === 1) {
2108
+ return getReactiveProxy(target);
2109
+ }
2110
+ throw new Error();
2111
+ }
2112
+ function internalTrackDecorator(key) {
2113
+ return {
2114
+ get() {
2115
+ const vm = getAssociatedVM(this);
2116
+ componentValueObserved(vm, key);
2117
+ return vm.cmpFields[key];
2118
+ },
2119
+ set(newValue) {
2120
+ const vm = getAssociatedVM(this);
2121
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2122
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2123
+ },
2124
+ enumerable: true,
2125
+ configurable: true,
2126
+ };
2127
+ }
2128
+
2129
+ /*
2130
+ * Copyright (c) 2018, salesforce.com, inc.
2131
+ * All rights reserved.
2132
+ * SPDX-License-Identifier: MIT
2133
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2134
+ */
2135
+ /**
2136
+ * @wire decorator to wire fields and methods to a wire adapter in
2137
+ * LWC Components. This function implements the internals of this
2138
+ * decorator.
2139
+ */
2140
+ function wire(_adapter, _config) {
2141
+ throw new Error();
2142
+ }
2143
+ function internalWireFieldDecorator(key) {
2144
+ return {
2145
+ get() {
2146
+ const vm = getAssociatedVM(this);
2147
+ componentValueObserved(vm, key);
2148
+ return vm.cmpFields[key];
2149
+ },
2150
+ set(value) {
2151
+ const vm = getAssociatedVM(this);
2152
+ /**
2153
+ * Reactivity for wired fields is provided in wiring.
2154
+ * We intentionally add reactivity here since this is just
2155
+ * letting the author to do the wrong thing, but it will keep our
2156
+ * system to be backward compatible.
2157
+ */
2158
+ updateComponentValue(vm, key, value);
1925
2159
  },
1926
2160
  enumerable: true,
1927
2161
  configurable: true,
@@ -2240,10 +2474,60 @@
2240
2474
  }
2241
2475
  freeze(BaseBridgeElement);
2242
2476
  seal(BaseBridgeElement.prototype);
2477
+ const swappedStyleMap = new WeakMap();
2478
+ const activeTemplates = new WeakMap();
2479
+ const activeComponents = new WeakMap();
2480
+ const activeStyles = new WeakMap();
2481
+ function getStyleOrSwappedStyle(style) {
2482
+ assertNotProd(); // this method should never leak to prod
2483
+ const visited = new Set();
2484
+ while (swappedStyleMap.has(style) && !visited.has(style)) {
2485
+ visited.add(style);
2486
+ style = swappedStyleMap.get(style);
2487
+ }
2488
+ return style;
2489
+ }
2243
2490
  function setActiveVM(vm) {
2244
- {
2245
- // this method should never leak to prod
2246
- throw new ReferenceError();
2491
+ assertNotProd(); // this method should never leak to prod
2492
+ // tracking active component
2493
+ const Ctor = vm.def.ctor;
2494
+ let componentVMs = activeComponents.get(Ctor);
2495
+ if (isUndefined$1(componentVMs)) {
2496
+ componentVMs = new Set();
2497
+ activeComponents.set(Ctor, componentVMs);
2498
+ }
2499
+ // this will allow us to keep track of the hot components
2500
+ componentVMs.add(vm);
2501
+ // tracking active template
2502
+ const tpl = vm.cmpTemplate;
2503
+ if (tpl) {
2504
+ let templateVMs = activeTemplates.get(tpl);
2505
+ if (isUndefined$1(templateVMs)) {
2506
+ templateVMs = new Set();
2507
+ activeTemplates.set(tpl, templateVMs);
2508
+ }
2509
+ // this will allow us to keep track of the templates that are
2510
+ // being used by a hot component
2511
+ templateVMs.add(vm);
2512
+ // tracking active styles associated to template
2513
+ const stylesheets = tpl.stylesheets;
2514
+ if (!isUndefined$1(stylesheets)) {
2515
+ flattenStylesheets(stylesheets).forEach((stylesheet) => {
2516
+ // this is necessary because we don't hold the list of styles
2517
+ // in the vm, we only hold the selected (already swapped template)
2518
+ // but the styles attached to the template might not be the actual
2519
+ // active ones, but the swapped versions of those.
2520
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
2521
+ let stylesheetVMs = activeStyles.get(stylesheet);
2522
+ if (isUndefined$1(stylesheetVMs)) {
2523
+ stylesheetVMs = new Set();
2524
+ activeStyles.set(stylesheet, stylesheetVMs);
2525
+ }
2526
+ // this will allow us to keep track of the stylesheet that are
2527
+ // being used by a hot component
2528
+ stylesheetVMs.add(vm);
2529
+ });
2530
+ }
2247
2531
  }
2248
2532
  }
2249
2533
  function swapTemplate(oldTpl, newTpl) {
@@ -4075,9 +4359,17 @@
4075
4359
  vmBeingRendered = vm;
4076
4360
  }
4077
4361
  function validateSlots(vm, html) {
4078
- {
4079
- // this method should never leak to prod
4080
- throw new ReferenceError();
4362
+ assertNotProd(); // this method should never leak to prod
4363
+ const { cmpSlots } = vm;
4364
+ const { slots = EmptyArray } = html;
4365
+ for (const slotName in cmpSlots.slotAssignments) {
4366
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4367
+ assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
4368
+ if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
4369
+ // TODO [#1297]: this should never really happen because the compiler should always validate
4370
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4371
+ logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
4372
+ }
4081
4373
  }
4082
4374
  }
4083
4375
  function validateLightDomTemplate(template, vm) {
@@ -4187,9 +4479,7 @@
4187
4479
  }
4188
4480
  if ("production" !== 'production') ;
4189
4481
  // reset the refs; they will be set during the tmpl() instantiation
4190
- const hasRefVNodes = Boolean(html.hasRefs);
4191
- vm.hasRefVNodes = hasRefVNodes;
4192
- vm.refVNodes = hasRefVNodes ? create(null) : null;
4482
+ vm.refVNodes = html.hasRefs ? create(null) : null;
4193
4483
  // right before producing the vnodes, we clear up all internal references
4194
4484
  // to custom elements from the template.
4195
4485
  vm.velements = [];
@@ -4346,7 +4636,7 @@
4346
4636
  const cmpEventListenerMap = new WeakMap();
4347
4637
  function getWrappedComponentsListener(vm, listener) {
4348
4638
  if (!isFunction$1(listener)) {
4349
- throw new TypeError(); // avoiding problems with non-valid listeners
4639
+ throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
4350
4640
  }
4351
4641
  let wrappedListener = cmpEventListenerMap.get(listener);
4352
4642
  if (isUndefined$1(wrappedListener)) {
@@ -4479,7 +4769,6 @@
4479
4769
  mode,
4480
4770
  owner,
4481
4771
  refVNodes: null,
4482
- hasRefVNodes: false,
4483
4772
  children: EmptyArray,
4484
4773
  aChildren: EmptyArray,
4485
4774
  velements: EmptyArray,
@@ -4815,338 +5104,210 @@
4815
5104
  break;
4816
5105
  }
4817
5106
  }
4818
- }
4819
- }
4820
- }
4821
- // This is a super optimized mechanism to remove the content of the root node (shadow root
4822
- // for shadow DOM components and the root element itself for light DOM) without having to go
4823
- // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
4824
- // children VNodes might not be representing the current state of the DOM.
4825
- function resetComponentRoot(vm) {
4826
- const {
4827
- children,
4828
- renderRoot,
4829
- renderer: {
4830
- remove
4831
- }
4832
- } = vm;
4833
- for (let i = 0, len = children.length; i < len; i++) {
4834
- const child = children[i];
4835
- if (!isNull(child) && !isUndefined$1(child.elm)) {
4836
- remove(child.elm, renderRoot);
4837
- }
4838
- }
4839
- vm.children = EmptyArray;
4840
- runChildNodesDisconnectedCallback(vm);
4841
- vm.velements = EmptyArray;
4842
- }
4843
- function scheduleRehydration(vm) {
4844
- if (isTrue(vm.isScheduled)) {
4845
- return;
4846
- }
4847
- vm.isScheduled = true;
4848
- if (rehydrateQueue.length === 0) {
4849
- addCallbackToNextTick(flushRehydrationQueue);
4850
- }
4851
- ArrayPush$1.call(rehydrateQueue, vm);
4852
- }
4853
- function getErrorBoundaryVM(vm) {
4854
- let currentVm = vm;
4855
- while (!isNull(currentVm)) {
4856
- if (!isUndefined$1(currentVm.def.errorCallback)) {
4857
- return currentVm;
4858
- }
4859
- currentVm = currentVm.owner;
4860
- }
4861
- }
4862
- function runWithBoundaryProtection(vm, owner, pre, job, post) {
4863
- let error;
4864
- pre();
4865
- try {
4866
- job();
4867
- } catch (e) {
4868
- error = Object(e);
4869
- } finally {
4870
- post();
4871
- if (!isUndefined$1(error)) {
4872
- addErrorComponentStack(vm, error);
4873
- const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
4874
- if (isUndefined$1(errorBoundaryVm)) {
4875
- throw error; // eslint-disable-line no-unsafe-finally
4876
- }
4877
-
4878
- resetComponentRoot(vm); // remove offenders
4879
- logOperationStart(6 /* OperationId.ErrorCallback */, vm);
4880
- // error boundaries must have an ErrorCallback
4881
- const errorCallback = errorBoundaryVm.def.errorCallback;
4882
- invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
4883
- logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
4884
- }
4885
- }
4886
- }
4887
-
4888
- /*
4889
- * Copyright (c) 2018, salesforce.com, inc.
4890
- * All rights reserved.
4891
- * SPDX-License-Identifier: MIT
4892
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4893
- */
4894
- const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
4895
- const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
4896
- const WireMetaMap = new Map();
4897
- class WireContextRegistrationEvent extends CustomEvent {
4898
- constructor(adapterToken, {
4899
- setNewContext,
4900
- setDisconnectedCallback
4901
- }) {
4902
- super(adapterToken, {
4903
- bubbles: true,
4904
- composed: true
4905
- });
4906
- defineProperties(this, {
4907
- setNewContext: {
4908
- value: setNewContext
4909
- },
4910
- setDisconnectedCallback: {
4911
- value: setDisconnectedCallback
4912
- }
4913
- });
4914
- }
4915
- }
4916
- function createFieldDataCallback(vm, name) {
4917
- return value => {
4918
- updateComponentValue(vm, name, value);
4919
- };
4920
- }
4921
- function createMethodDataCallback(vm, method) {
4922
- return value => {
4923
- // dispatching new value into the wired method
4924
- runWithBoundaryProtection(vm, vm.owner, noop, () => {
4925
- // job
4926
- method.call(vm.component, value);
4927
- }, noop);
4928
- };
4929
- }
4930
- function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4931
- let hasPendingConfig = false;
4932
- // creating the reactive observer for reactive params when needed
4933
- const ro = createReactiveObserver(() => {
4934
- if (hasPendingConfig === false) {
4935
- hasPendingConfig = true;
4936
- // collect new config in the micro-task
4937
- Promise.resolve().then(() => {
4938
- hasPendingConfig = false;
4939
- // resetting current reactive params
4940
- ro.reset();
4941
- // dispatching a new config due to a change in the configuration
4942
- computeConfigAndUpdate();
4943
- });
4944
- }
4945
- });
4946
- const computeConfigAndUpdate = () => {
4947
- let config;
4948
- ro.observe(() => config = configCallback(component));
4949
- // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
4950
- // TODO: dev-mode validation of config based on the adapter.configSchema
4951
- // @ts-ignore it is assigned in the observe() callback
4952
- callbackWhenConfigIsReady(config);
4953
- };
4954
- return {
4955
- computeConfigAndUpdate,
4956
- ro
4957
- };
4958
- }
4959
- function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
4960
- const {
4961
- adapter
4962
- } = wireDef;
4963
- const adapterContextToken = getAdapterToken(adapter);
4964
- if (isUndefined$1(adapterContextToken)) {
4965
- return; // no provider found, nothing to be done
5107
+ }
4966
5108
  }
4967
-
5109
+ }
5110
+ // This is a super optimized mechanism to remove the content of the root node (shadow root
5111
+ // for shadow DOM components and the root element itself for light DOM) without having to go
5112
+ // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
5113
+ // children VNodes might not be representing the current state of the DOM.
5114
+ function resetComponentRoot(vm) {
4968
5115
  const {
4969
- elm,
4970
- context: {
4971
- wiredConnecting,
4972
- wiredDisconnecting
4973
- },
5116
+ children,
5117
+ renderRoot,
4974
5118
  renderer: {
4975
- dispatchEvent
5119
+ remove
4976
5120
  }
4977
5121
  } = vm;
4978
- // waiting for the component to be connected to formally request the context via the token
4979
- ArrayPush$1.call(wiredConnecting, () => {
4980
- // This event is responsible for connecting the host element with another
4981
- // element in the composed path that is providing contextual data. The provider
4982
- // must be listening for a special dom event with the name corresponding to the value of
4983
- // `adapterContextToken`, which will remain secret and internal to this file only to
4984
- // guarantee that the linkage can be forged.
4985
- const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
4986
- setNewContext(newContext) {
4987
- // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
4988
- // TODO: dev-mode validation of config based on the adapter.contextSchema
4989
- callbackWhenContextIsReady(newContext);
4990
- },
4991
- setDisconnectedCallback(disconnectCallback) {
4992
- // adds this callback into the disconnect bucket so it gets disconnected from parent
4993
- // the the element hosting the wire is disconnected
4994
- ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
4995
- }
4996
- });
4997
- dispatchEvent(elm, contextRegistrationEvent);
4998
- });
4999
- }
5000
- function createConnector(vm, name, wireDef) {
5001
- const {
5002
- method,
5003
- adapter,
5004
- configCallback,
5005
- dynamic
5006
- } = wireDef;
5007
- let debugInfo;
5008
- const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5009
- const dataCallback = value => {
5010
- fieldOrMethodCallback(value);
5011
- };
5012
- let context;
5013
- let connector;
5014
- // Workaround to pass the component element associated to this wire adapter instance.
5015
- defineProperty(dataCallback, DeprecatedWiredElementHost, {
5016
- value: vm.elm
5017
- });
5018
- defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
5019
- value: dynamic
5020
- });
5021
- runWithBoundaryProtection(vm, vm, noop, () => {
5022
- // job
5023
- connector = new adapter(dataCallback);
5024
- }, noop);
5025
- const updateConnectorConfig = config => {
5026
- // every time the config is recomputed due to tracking,
5027
- // this callback will be invoked with the new computed config
5028
- runWithBoundaryProtection(vm, vm, noop, () => {
5029
- // job
5030
- if ("production" !== 'production') ;
5031
- connector.update(config, context);
5032
- }, noop);
5033
- };
5034
- // Computes the current wire config and calls the update method on the wire adapter.
5035
- // If it has params, we will need to observe changes in the next tick.
5036
- const {
5037
- computeConfigAndUpdate,
5038
- ro
5039
- } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
5040
- // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
5041
- if (!isUndefined$1(adapter.contextSchema)) {
5042
- createContextWatcher(vm, wireDef, newContext => {
5043
- // every time the context is pushed into this component,
5044
- // this callback will be invoked with the new computed context
5045
- if (context !== newContext) {
5046
- context = newContext;
5047
- // Note: when new context arrives, the config will be recomputed and pushed along side the new
5048
- // context, this is to preserve the identity characteristics, config should not have identity
5049
- // (ever), while context can have identity
5050
- if (vm.state === 1 /* VMState.connected */) {
5051
- computeConfigAndUpdate();
5052
- }
5053
- }
5054
- });
5122
+ for (let i = 0, len = children.length; i < len; i++) {
5123
+ const child = children[i];
5124
+ if (!isNull(child) && !isUndefined$1(child.elm)) {
5125
+ remove(child.elm, renderRoot);
5126
+ }
5055
5127
  }
5056
- return {
5057
- // @ts-ignore the boundary protection executes sync, connector is always defined
5058
- connector,
5059
- computeConfigAndUpdate,
5060
- resetConfigWatcher: () => ro.reset()
5061
- };
5062
- }
5063
- const AdapterToTokenMap = new Map();
5064
- function getAdapterToken(adapter) {
5065
- return AdapterToTokenMap.get(adapter);
5128
+ vm.children = EmptyArray;
5129
+ runChildNodesDisconnectedCallback(vm);
5130
+ vm.velements = EmptyArray;
5066
5131
  }
5067
- function setAdapterToken(adapter, token) {
5068
- AdapterToTokenMap.set(adapter, token);
5132
+ function scheduleRehydration(vm) {
5133
+ if (isTrue(vm.isScheduled)) {
5134
+ return;
5135
+ }
5136
+ vm.isScheduled = true;
5137
+ if (rehydrateQueue.length === 0) {
5138
+ addCallbackToNextTick(flushRehydrationQueue);
5139
+ }
5140
+ ArrayPush$1.call(rehydrateQueue, vm);
5069
5141
  }
5070
- function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
5071
- // support for callable adapters
5072
- if (adapter.adapter) {
5073
- adapter = adapter.adapter;
5142
+ function getErrorBoundaryVM(vm) {
5143
+ let currentVm = vm;
5144
+ while (!isNull(currentVm)) {
5145
+ if (!isUndefined$1(currentVm.def.errorCallback)) {
5146
+ return currentVm;
5147
+ }
5148
+ currentVm = currentVm.owner;
5074
5149
  }
5075
- const method = descriptor.value;
5076
- const def = {
5077
- adapter,
5078
- method,
5079
- configCallback,
5080
- dynamic
5081
- };
5082
- WireMetaMap.set(descriptor, def);
5083
5150
  }
5084
- function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
5085
- // support for callable adapters
5086
- if (adapter.adapter) {
5087
- adapter = adapter.adapter;
5151
+ function runWithBoundaryProtection(vm, owner, pre, job, post) {
5152
+ let error;
5153
+ pre();
5154
+ try {
5155
+ job();
5156
+ } catch (e) {
5157
+ error = Object(e);
5158
+ } finally {
5159
+ post();
5160
+ if (!isUndefined$1(error)) {
5161
+ addErrorComponentStack(vm, error);
5162
+ const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
5163
+ if (isUndefined$1(errorBoundaryVm)) {
5164
+ throw error; // eslint-disable-line no-unsafe-finally
5165
+ }
5166
+
5167
+ resetComponentRoot(vm); // remove offenders
5168
+ logOperationStart(6 /* OperationId.ErrorCallback */, vm);
5169
+ // error boundaries must have an ErrorCallback
5170
+ const errorCallback = errorBoundaryVm.def.errorCallback;
5171
+ invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
5172
+ logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
5173
+ }
5088
5174
  }
5089
- const def = {
5090
- adapter,
5091
- configCallback,
5092
- dynamic
5093
- };
5094
- WireMetaMap.set(descriptor, def);
5095
5175
  }
5096
- function installWireAdapters(vm) {
5097
- const {
5098
- context,
5099
- def: {
5100
- wire
5176
+
5177
+ /*
5178
+ * Copyright (c) 2018, salesforce.com, inc.
5179
+ * All rights reserved.
5180
+ * SPDX-License-Identifier: MIT
5181
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5182
+ */
5183
+ //
5184
+ // The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
5185
+ // These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
5186
+ // When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
5187
+ // See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
5188
+ //
5189
+ // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
5190
+ const getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
5191
+ const querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
5192
+ function isSyntheticShadowRootInstance(rootNode) {
5193
+ return rootNode !== document && isTrue(rootNode.synthetic);
5194
+ }
5195
+ function reportViolation(source, target, attrName) {
5196
+ // The vm is either for the source, the target, or both. Either one or both must be using synthetic
5197
+ // shadow for a violation to be detected.
5198
+ let vm = getAssociatedVMIfPresent(source.getRootNode().host);
5199
+ if (isUndefined$1(vm)) {
5200
+ vm = getAssociatedVMIfPresent(target.getRootNode().host);
5201
+ }
5202
+ if (isUndefined$1(vm)) {
5203
+ // vm should never be undefined here, but just to be safe, bail out and don't report
5204
+ return;
5101
5205
  }
5102
- } = vm;
5103
- const wiredConnecting = context.wiredConnecting = [];
5104
- const wiredDisconnecting = context.wiredDisconnecting = [];
5105
- for (const fieldNameOrMethod in wire) {
5106
- const descriptor = wire[fieldNameOrMethod];
5107
- const wireDef = WireMetaMap.get(descriptor);
5108
- if (!isUndefined$1(wireDef)) {
5109
- const {
5110
- connector,
5111
- computeConfigAndUpdate,
5112
- resetConfigWatcher
5113
- } = createConnector(vm, fieldNameOrMethod, wireDef);
5114
- const hasDynamicParams = wireDef.dynamic.length > 0;
5115
- ArrayPush$1.call(wiredConnecting, () => {
5116
- connector.connect();
5117
- if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5118
- if (hasDynamicParams) {
5119
- Promise.resolve().then(computeConfigAndUpdate);
5206
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
5207
+ }
5208
+ function parseIdRefAttributeValue(attrValue) {
5209
+ // split on whitespace and skip empty strings after splitting
5210
+ return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
5211
+ }
5212
+ function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
5213
+ const root = elm.getRootNode();
5214
+ if (!isSyntheticShadowRootInstance(root)) {
5215
+ return;
5216
+ }
5217
+ if (attrName === 'id') {
5218
+ // elm is the target, find the source
5219
+ if (!isString(attrValue) || attrValue.length === 0) {
5220
+ // if our id is null or empty, nobody can reference us
5120
5221
  return;
5121
- }
5122
5222
  }
5123
- computeConfigAndUpdate();
5124
- });
5125
- ArrayPush$1.call(wiredDisconnecting, () => {
5126
- connector.disconnect();
5127
- resetConfigWatcher();
5128
- });
5223
+ for (const idRefAttrName of ID_REFERENCING_ATTRIBUTES_SET) {
5224
+ // Query all global elements with this attribute. The attribute selector syntax `~=` is for values
5225
+ // that reference multiple IDs, separated by whitespace.
5226
+ const query = `[${idRefAttrName}~="${CSS.escape(attrValue)}"]`;
5227
+ const sourceElements = querySelectorAll.call(document, query);
5228
+ for (let i = 0; i < sourceElements.length; i++) {
5229
+ const sourceElement = sourceElements[i];
5230
+ const sourceRoot = sourceElement.getRootNode();
5231
+ if (sourceRoot !== root) {
5232
+ reportViolation(sourceElement, elm);
5233
+ break;
5234
+ }
5235
+ }
5236
+ }
5237
+ }
5238
+ else {
5239
+ // elm is the source, find the target
5240
+ const ids = parseIdRefAttributeValue(attrValue);
5241
+ for (const id of ids) {
5242
+ const target = getElementById.call(document, id);
5243
+ if (!isNull(target)) {
5244
+ const targetRoot = target.getRootNode();
5245
+ if (targetRoot !== root) {
5246
+ // target element's shadow root is not the same as ours
5247
+ reportViolation(elm, target);
5248
+ }
5249
+ }
5250
+ }
5129
5251
  }
5130
- }
5131
5252
  }
5132
- function connectWireAdapters(vm) {
5133
- const {
5134
- wiredConnecting
5135
- } = vm.context;
5136
- for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
5137
- wiredConnecting[i]();
5138
- }
5253
+ let enabled = false;
5254
+ // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
5255
+ // reporting is not enabled. It should also only run once
5256
+ function enableDetection() {
5257
+ if (enabled) {
5258
+ return; // don't double-apply the patches
5259
+ }
5260
+ enabled = true;
5261
+ const { setAttribute } = Element.prototype;
5262
+ // Detect calling `setAttribute` to set an idref or an id
5263
+ assign(Element.prototype, {
5264
+ setAttribute(attrName, attrValue) {
5265
+ setAttribute.call(this, attrName, attrValue);
5266
+ if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
5267
+ detectSyntheticCrossRootAria(this, attrName, attrValue);
5268
+ }
5269
+ },
5270
+ });
5271
+ // Detect `elm.id = 'foo'`
5272
+ const idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
5273
+ if (!isUndefined$1(idDescriptor)) {
5274
+ const { get, set } = idDescriptor;
5275
+ // These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
5276
+ if (isFunction$1(get) && isFunction$1(set)) {
5277
+ defineProperty(Element.prototype, 'id', {
5278
+ get() {
5279
+ return get.call(this);
5280
+ },
5281
+ set(value) {
5282
+ set.call(this, value);
5283
+ detectSyntheticCrossRootAria(this, 'id', value);
5284
+ },
5285
+ // On the default descriptor for 'id', enumerable and configurable are true
5286
+ enumerable: true,
5287
+ configurable: true,
5288
+ });
5289
+ }
5290
+ }
5139
5291
  }
5140
- function disconnectWireAdapters(vm) {
5141
- const {
5142
- wiredDisconnecting
5143
- } = vm.context;
5144
- runWithBoundaryProtection(vm, vm, noop, () => {
5145
- // job
5146
- for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
5147
- wiredDisconnecting[i]();
5292
+ // Our detection logic relies on some modern browser features. We can just skip reporting the data
5293
+ // for unsupported browsers
5294
+ function supportsCssEscape() {
5295
+ return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
5296
+ }
5297
+ // If this page is not using synthetic shadow, then we don't need to install detection. Note
5298
+ // that we are assuming synthetic shadow is loaded before LWC.
5299
+ function isSyntheticShadowLoaded() {
5300
+ // We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
5301
+ // and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
5302
+ return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
5303
+ }
5304
+ // Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
5305
+ if (supportsCssEscape() && isSyntheticShadowLoaded()) {
5306
+ // Always run detection in dev mode, so we can at least print to the console
5307
+ {
5308
+ // In prod mode, only enable detection if reporting is enabled
5309
+ onReportingEnabled(enableDetection);
5148
5310
  }
5149
- }, noop);
5150
5311
  }
5151
5312
 
5152
5313
  /*
@@ -6514,7 +6675,7 @@
6514
6675
  function isNull(obj) {
6515
6676
  return obj === null;
6516
6677
  }
6517
- /** version: 2.34.0 */
6678
+ /** version: 2.35.1 */
6518
6679
 
6519
6680
  /*
6520
6681
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7067,10 +7228,11 @@
7067
7228
  });
7068
7229
  freeze(LightningElement);
7069
7230
  seal(LightningElement.prototype);
7070
- /* version: 2.34.0 */
7231
+ /* version: 2.35.1 */
7071
7232
 
7072
7233
  exports.LightningElement = LightningElement;
7073
7234
  exports.__unstable__ProfilerControl = profilerControl;
7235
+ exports.__unstable__ReportingControl = reportingControl;
7074
7236
  exports.api = api$1;
7075
7237
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
7076
7238
  exports.createContextProvider = createContextProvider;