lwc 2.34.0 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +742 -493
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +742 -492
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +777 -641
  5. package/dist/engine-dom/iife/es5/engine-dom.js +882 -618
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +732 -579
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +742 -492
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +777 -641
  11. package/dist/engine-dom/umd/es5/engine-dom.js +882 -618
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +732 -579
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +635 -603
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +635 -603
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +15 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +15 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +15 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +18 -3
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +18 -3
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +15 -4
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +15 -4
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +18 -3
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +18 -3
  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
@@ -15,11 +15,6 @@
15
15
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
16
16
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
17
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
18
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
20
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
23
18
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24
19
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
20
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -28,6 +23,11 @@
28
23
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
24
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
30
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
30
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
31
31
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
32
32
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
33
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
@@ -103,6 +103,7 @@
103
103
  var _String$prototype = String.prototype,
104
104
  StringCharCodeAt = _String$prototype.charCodeAt,
105
105
  StringReplace = _String$prototype.replace,
106
+ StringSplit = _String$prototype.split,
106
107
  StringSlice = _String$prototype.slice,
107
108
  StringToLowerCase = _String$prototype.toLowerCase;
108
109
  function isUndefined$1(obj) {
@@ -195,6 +196,9 @@
195
196
  }(),
196
197
  AriaAttrNameToPropNameMap = _ref.AriaAttrNameToPropNameMap,
197
198
  AriaPropNameToAttrNameMap = _ref.AriaPropNameToAttrNameMap;
199
+ // These attributes take either an ID or a list of IDs as values.
200
+ // This includes aria-* attributes as well as the special non-ARIA "for" attribute
201
+ var ID_REFERENCING_ATTRIBUTES_SET = new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
198
202
 
199
203
  /*
200
204
  * Copyright (c) 2018, salesforce.com, inc.
@@ -248,6 +252,8 @@
248
252
  var KEY__SHADOW_TOKEN = '$shadowToken$';
249
253
  var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
250
254
  var KEY__SCOPED_CSS = '$scoped$';
255
+ var KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
256
+ var KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
251
257
  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
252
258
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
253
259
  var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
@@ -335,7 +341,7 @@
335
341
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
336
342
  return propertyName;
337
343
  }
338
- /** version: 2.34.0 */
344
+ /** version: 2.35.0 */
339
345
 
340
346
  /**
341
347
  * Copyright (C) 2018 salesforce.com, inc.
@@ -406,7 +412,7 @@
406
412
  */
407
413
  function setFeatureFlagForTest(name, value) {
408
414
  }
409
- /** version: 2.34.0 */
415
+ /** version: 2.35.0 */
410
416
 
411
417
  /**
412
418
  * Copyright (C) 2018 salesforce.com, inc.
@@ -470,7 +476,7 @@
470
476
  }
471
477
  }
472
478
  }
473
- /** version: 2.34.0 */
479
+ /** version: 2.35.0 */
474
480
 
475
481
  /*
476
482
  * Copyright (c) 2018, salesforce.com, inc.
@@ -490,99 +496,153 @@
490
496
  * SPDX-License-Identifier: MIT
491
497
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
492
498
  */
493
- var nextTickCallbackQueue = [];
494
- var SPACE_CHAR = 32;
495
- var EmptyObject = seal(create(null));
496
- var EmptyArray = seal([]);
497
- function flushCallbackQueue() {
498
- var callbacks = nextTickCallbackQueue;
499
- nextTickCallbackQueue = []; // reset to a new queue
500
- for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
501
- callbacks[_i3]();
499
+ /** Callbacks to invoke when reporting is enabled **/
500
+ var onReportingEnabledCallbacks = [];
501
+ /** The currently assigned reporting dispatcher. */
502
+ var currentDispatcher$1 = noop;
503
+ /**
504
+ * Whether reporting is enabled.
505
+ *
506
+ * Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
507
+ * but it turns out that Terser only strips out unused code if we use this explicit boolean.
508
+ */
509
+ var enabled$1 = false;
510
+ var reportingControl = {
511
+ /**
512
+ * Attach a new reporting control (aka dispatcher).
513
+ *
514
+ * @param dispatcher - reporting control
515
+ */
516
+ attachDispatcher: function attachDispatcher(dispatcher) {
517
+ enabled$1 = true;
518
+ currentDispatcher$1 = dispatcher;
519
+ var _iterator = _createForOfIteratorHelper(onReportingEnabledCallbacks),
520
+ _step;
521
+ try {
522
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
523
+ var callback = _step.value;
524
+ try {
525
+ callback();
526
+ } catch (err) {
527
+ // This should never happen. But if it does, we don't want one callback to cause another to fail
528
+ // eslint-disable-next-line no-console
529
+ console.error('Could not invoke callback', err);
530
+ }
531
+ }
532
+ } catch (err) {
533
+ _iterator.e(err);
534
+ } finally {
535
+ _iterator.f();
536
+ }
537
+ onReportingEnabledCallbacks.length = 0; // clear the array
538
+ },
539
+ /**
540
+ * Detach the current reporting control (aka dispatcher).
541
+ */
542
+ detachDispatcher: function detachDispatcher() {
543
+ enabled$1 = false;
544
+ currentDispatcher$1 = noop;
545
+ }
546
+ };
547
+ /**
548
+ * Call a callback when reporting is enabled, or immediately if reporting is already enabled.
549
+ * Will only ever be called once.
550
+ * @param callback
551
+ */
552
+ function onReportingEnabled(callback) {
553
+ if (enabled$1) {
554
+ // call immediately
555
+ callback();
556
+ } else {
557
+ // call later
558
+ onReportingEnabledCallbacks.push(callback);
502
559
  }
503
560
  }
504
- function addCallbackToNextTick(callback) {
505
- if (nextTickCallbackQueue.length === 0) {
506
- Promise.resolve().then(flushCallbackQueue);
561
+ /**
562
+ * Report to the current dispatcher, if there is one.
563
+ * @param reportingEventId
564
+ * @param vm
565
+ */
566
+ function report(reportingEventId, vm) {
567
+ if (enabled$1) {
568
+ currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
507
569
  }
508
- ArrayPush$1.call(nextTickCallbackQueue, callback);
509
570
  }
510
- function guid() {
511
- function s4() {
512
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
571
+
572
+ /*
573
+ * Copyright (c) 2018, salesforce.com, inc.
574
+ * All rights reserved.
575
+ * SPDX-License-Identifier: MIT
576
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
577
+ */
578
+ function getComponentTag(vm) {
579
+ return "<".concat(StringToLowerCase.call(vm.tagName), ">");
580
+ }
581
+ // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
582
+ function getComponentStack(vm) {
583
+ var stack = [];
584
+ var prefix = '';
585
+ while (!isNull(vm.owner)) {
586
+ ArrayPush$1.call(stack, prefix + getComponentTag(vm));
587
+ vm = vm.owner;
588
+ prefix += '\t';
513
589
  }
514
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
590
+ return ArrayJoin.call(stack, '\n');
515
591
  }
516
- // Borrowed from Vue template compiler.
517
- // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
518
- var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
519
- var PROPERTY_DELIMITER = /:(.+)/;
520
- function parseStyleText(cssText) {
521
- var styleMap = {};
522
- var declarations = cssText.split(DECLARATION_DELIMITER);
523
- var _iterator = _createForOfIteratorHelper(declarations),
524
- _step;
525
- try {
526
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
527
- var declaration = _step.value;
528
- if (declaration) {
529
- var _declaration$split = declaration.split(PROPERTY_DELIMITER),
530
- _declaration$split2 = _slicedToArray(_declaration$split, 2),
531
- prop = _declaration$split2[0],
532
- value = _declaration$split2[1];
533
- if (prop !== undefined && value !== undefined) {
534
- styleMap[prop.trim()] = value.trim();
535
- }
592
+ function getErrorComponentStack(vm) {
593
+ var wcStack = [];
594
+ var currentVm = vm;
595
+ while (!isNull(currentVm)) {
596
+ ArrayPush$1.call(wcStack, getComponentTag(currentVm));
597
+ currentVm = currentVm.owner;
598
+ }
599
+ return wcStack.reverse().join('\n\t');
600
+ }
601
+
602
+ /*
603
+ * Copyright (c) 2018, salesforce.com, inc.
604
+ * All rights reserved.
605
+ * SPDX-License-Identifier: MIT
606
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
607
+ */
608
+ function addErrorComponentStack(vm, error) {
609
+ if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
610
+ var wcStack = getErrorComponentStack(vm);
611
+ defineProperty(error, 'wcStack', {
612
+ get: function get() {
613
+ return wcStack;
536
614
  }
537
- }
538
- } catch (err) {
539
- _iterator.e(err);
540
- } finally {
541
- _iterator.f();
615
+ });
542
616
  }
543
- return styleMap;
544
617
  }
545
- // Make a shallow copy of an object but omit the given key
546
- function cloneAndOmitKey(object, keyToOmit) {
547
- var result = {};
548
- for (var _i4 = 0, _Object$keys = Object.keys(object); _i4 < _Object$keys.length; _i4++) {
549
- var key = _Object$keys[_i4];
550
- if (key !== keyToOmit) {
551
- result[key] = object[key];
618
+
619
+ /*
620
+ * Copyright (c) 2018, salesforce.com, inc.
621
+ * All rights reserved.
622
+ * SPDX-License-Identifier: MIT
623
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
624
+ */
625
+ var alreadyLoggedMessages = new Set();
626
+ function log(method, message, vm, once) {
627
+ var msg = "[LWC ".concat(method, "]: ").concat(message);
628
+ if (!isUndefined$1(vm)) {
629
+ msg = "".concat(msg, "\n").concat(getComponentStack(vm));
630
+ }
631
+ if (once) {
632
+ if (alreadyLoggedMessages.has(msg)) {
633
+ return;
552
634
  }
635
+ alreadyLoggedMessages.add(msg);
553
636
  }
554
- return result;
555
- }
556
- function flattenStylesheets(stylesheets) {
557
- var list = [];
558
- var _iterator2 = _createForOfIteratorHelper(stylesheets),
559
- _step2;
560
637
  try {
561
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
562
- var stylesheet = _step2.value;
563
- if (!Array.isArray(stylesheet)) {
564
- list.push(stylesheet);
565
- } else {
566
- list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
567
- }
568
- }
569
- } catch (err) {
570
- _iterator2.e(err);
571
- } finally {
572
- _iterator2.f();
638
+ throw new Error(msg);
639
+ } catch (e) {
640
+ /* eslint-disable-next-line no-console */
641
+ console[method](e);
573
642
  }
574
- return list;
575
643
  }
576
- // Set a ref (lwc:ref) on a VM, from a template API
577
- function setRefVNode(vm, ref, vnode) {
578
- // If this method is called, then vm.refVNodes is set as the template has refs.
579
- // If not, then something went wrong and we threw an error above.
580
- var refVNodes = vm.refVNodes;
581
- // In cases of conflict (two elements with the same ref), prefer, the last one,
582
- // in depth-first traversal order.
583
- if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
584
- refVNodes[ref] = vnode;
585
- }
644
+ function logError(message, vm) {
645
+ log('error', message, vm, false);
586
646
  }
587
647
 
588
648
  /*
@@ -607,8 +667,8 @@
607
667
  if (!isUndefined$1(reactiveRecord)) {
608
668
  var reactiveObservers = reactiveRecord[key];
609
669
  if (!isUndefined$1(reactiveObservers)) {
610
- for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
611
- var ro = reactiveObservers[_i5];
670
+ for (var _i3 = 0, len = reactiveObservers.length; _i3 < len; _i3 += 1) {
671
+ var ro = reactiveObservers[_i3];
612
672
  ro.notify();
613
673
  }
614
674
  }
@@ -667,9 +727,9 @@
667
727
  var listeners = this.listeners;
668
728
  var len = listeners.length;
669
729
  if (len > 0) {
670
- for (var _i6 = 0; _i6 < len; _i6 += 1) {
671
- var set = listeners[_i6];
672
- var pos = ArrayIndexOf.call(listeners[_i6], this);
730
+ for (var _i4 = 0; _i4 < len; _i4 += 1) {
731
+ var set = listeners[_i4];
732
+ var pos = ArrayIndexOf.call(listeners[_i4], this);
673
733
  ArraySplice.call(set, pos, 1);
674
734
  }
675
735
  listeners.length = 0;
@@ -714,67 +774,99 @@
714
774
  * SPDX-License-Identifier: MIT
715
775
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
716
776
  */
717
- function getComponentTag(vm) {
718
- return "<".concat(StringToLowerCase.call(vm.tagName), ">");
777
+ var nextTickCallbackQueue = [];
778
+ var SPACE_CHAR = 32;
779
+ var EmptyObject = seal(create(null));
780
+ var EmptyArray = seal([]);
781
+ function flushCallbackQueue() {
782
+ var callbacks = nextTickCallbackQueue;
783
+ nextTickCallbackQueue = []; // reset to a new queue
784
+ for (var _i5 = 0, len = callbacks.length; _i5 < len; _i5 += 1) {
785
+ callbacks[_i5]();
786
+ }
719
787
  }
720
- // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
721
- function getComponentStack(vm) {
722
- var stack = [];
723
- var prefix = '';
724
- while (!isNull(vm.owner)) {
725
- ArrayPush$1.call(stack, prefix + getComponentTag(vm));
726
- vm = vm.owner;
727
- prefix += '\t';
788
+ function addCallbackToNextTick(callback) {
789
+ if (nextTickCallbackQueue.length === 0) {
790
+ Promise.resolve().then(flushCallbackQueue);
728
791
  }
729
- return ArrayJoin.call(stack, '\n');
792
+ ArrayPush$1.call(nextTickCallbackQueue, callback);
730
793
  }
731
- function getErrorComponentStack(vm) {
732
- var wcStack = [];
733
- var currentVm = vm;
734
- while (!isNull(currentVm)) {
735
- ArrayPush$1.call(wcStack, getComponentTag(currentVm));
736
- currentVm = currentVm.owner;
794
+ function guid() {
795
+ function s4() {
796
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
737
797
  }
738
- return wcStack.reverse().join('\n\t');
798
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
739
799
  }
740
-
741
- /*
742
- * Copyright (c) 2018, salesforce.com, inc.
743
- * All rights reserved.
744
- * SPDX-License-Identifier: MIT
745
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
746
- */
747
- function addErrorComponentStack(vm, error) {
748
- if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
749
- var wcStack = getErrorComponentStack(vm);
750
- defineProperty(error, 'wcStack', {
751
- get: function get() {
752
- return wcStack;
800
+ // Borrowed from Vue template compiler.
801
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
802
+ var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
803
+ var PROPERTY_DELIMITER = /:(.+)/;
804
+ function parseStyleText(cssText) {
805
+ var styleMap = {};
806
+ var declarations = cssText.split(DECLARATION_DELIMITER);
807
+ var _iterator2 = _createForOfIteratorHelper(declarations),
808
+ _step2;
809
+ try {
810
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
811
+ var declaration = _step2.value;
812
+ if (declaration) {
813
+ var _declaration$split = declaration.split(PROPERTY_DELIMITER),
814
+ _declaration$split2 = _slicedToArray(_declaration$split, 2),
815
+ prop = _declaration$split2[0],
816
+ value = _declaration$split2[1];
817
+ if (prop !== undefined && value !== undefined) {
818
+ styleMap[prop.trim()] = value.trim();
819
+ }
753
820
  }
754
- });
821
+ }
822
+ } catch (err) {
823
+ _iterator2.e(err);
824
+ } finally {
825
+ _iterator2.f();
755
826
  }
827
+ return styleMap;
756
828
  }
757
-
758
- /*
759
- * Copyright (c) 2018, salesforce.com, inc.
760
- * All rights reserved.
761
- * SPDX-License-Identifier: MIT
762
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
763
- */
764
- function log(method, message, vm) {
765
- var msg = "[LWC ".concat(method, "]: ").concat(message);
766
- if (!isUndefined$1(vm)) {
767
- msg = "".concat(msg, "\n").concat(getComponentStack(vm));
829
+ // Make a shallow copy of an object but omit the given key
830
+ function cloneAndOmitKey(object, keyToOmit) {
831
+ var result = {};
832
+ for (var _i6 = 0, _Object$keys = Object.keys(object); _i6 < _Object$keys.length; _i6++) {
833
+ var key = _Object$keys[_i6];
834
+ if (key !== keyToOmit) {
835
+ result[key] = object[key];
836
+ }
768
837
  }
838
+ return result;
839
+ }
840
+ function flattenStylesheets(stylesheets) {
841
+ var list = [];
842
+ var _iterator3 = _createForOfIteratorHelper(stylesheets),
843
+ _step3;
769
844
  try {
770
- throw new Error(msg);
771
- } catch (e) {
772
- /* eslint-disable-next-line no-console */
773
- console[method](e);
845
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
846
+ var stylesheet = _step3.value;
847
+ if (!Array.isArray(stylesheet)) {
848
+ list.push(stylesheet);
849
+ } else {
850
+ list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
851
+ }
852
+ }
853
+ } catch (err) {
854
+ _iterator3.e(err);
855
+ } finally {
856
+ _iterator3.f();
774
857
  }
858
+ return list;
775
859
  }
776
- function logError(message, vm) {
777
- log('error', message, vm);
860
+ // Set a ref (lwc:ref) on a VM, from a template API
861
+ function setRefVNode(vm, ref, vnode) {
862
+ // If this method is called, then vm.refVNodes is set as the template has refs.
863
+ // If not, then something went wrong and we threw an error above.
864
+ var refVNodes = vm.refVNodes;
865
+ // In cases of conflict (two elements with the same ref), prefer, the last one,
866
+ // in depth-first traversal order.
867
+ if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
868
+ refVNodes[ref] = vnode;
869
+ }
778
870
  }
779
871
 
780
872
  /*
@@ -795,116 +887,21 @@
795
887
  * Copyright (c) 2018, salesforce.com, inc.
796
888
  * All rights reserved.
797
889
  * SPDX-License-Identifier: MIT
798
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
799
- */
800
- // This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
801
- // to inject at runtime.
802
- var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
803
- var HTMLElementPrototype = HTMLElementConstructor.prototype;
804
-
805
- /*
806
- * Copyright (c) 2018, salesforce.com, inc.
807
- * All rights reserved.
808
- * SPDX-License-Identifier: MIT
809
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
810
- */
811
- // These properties get added to LWCElement.prototype publicProps automatically
812
- var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
813
- function offsetPropertyErrorMessage(name) {
814
- return "Using the `".concat(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.");
815
- }
816
- // Global HTML Attributes & Properties
817
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
818
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
819
- //
820
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
821
- // for e.g. "dropzone" should suffice.
822
- assign(create(null), {
823
- accessKey: {
824
- attribute: 'accesskey'
825
- },
826
- accessKeyLabel: {
827
- readOnly: true
828
- },
829
- className: {
830
- attribute: 'class',
831
- 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.'
832
- },
833
- contentEditable: {
834
- attribute: 'contenteditable'
835
- },
836
- dataset: {
837
- readOnly: true,
838
- 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."
839
- },
840
- dir: {
841
- attribute: 'dir'
842
- },
843
- draggable: {
844
- attribute: 'draggable'
845
- },
846
- dropzone: {
847
- attribute: 'dropzone',
848
- readOnly: true
849
- },
850
- hidden: {
851
- attribute: 'hidden'
852
- },
853
- id: {
854
- attribute: 'id'
855
- },
856
- inputMode: {
857
- attribute: 'inputmode'
858
- },
859
- lang: {
860
- attribute: 'lang'
861
- },
862
- slot: {
863
- attribute: 'slot',
864
- error: 'Using the `slot` property is an anti-pattern.'
865
- },
866
- spellcheck: {
867
- attribute: 'spellcheck'
868
- },
869
- style: {
870
- attribute: 'style'
871
- },
872
- tabIndex: {
873
- attribute: 'tabindex'
874
- },
875
- title: {
876
- attribute: 'title'
877
- },
878
- translate: {
879
- attribute: 'translate'
880
- },
881
- // additional "global attributes" that are not present in the link above.
882
- isContentEditable: {
883
- readOnly: true
884
- },
885
- offsetHeight: {
886
- readOnly: true,
887
- error: offsetPropertyErrorMessage('offsetHeight')
888
- },
889
- offsetLeft: {
890
- readOnly: true,
891
- error: offsetPropertyErrorMessage('offsetLeft')
892
- },
893
- offsetParent: {
894
- readOnly: true
895
- },
896
- offsetTop: {
897
- readOnly: true,
898
- error: offsetPropertyErrorMessage('offsetTop')
899
- },
900
- offsetWidth: {
901
- readOnly: true,
902
- error: offsetPropertyErrorMessage('offsetWidth')
903
- },
904
- role: {
905
- attribute: 'role'
906
- }
907
- });
890
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
891
+ */
892
+ // This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
893
+ // to inject at runtime.
894
+ var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
895
+ var HTMLElementPrototype = HTMLElementConstructor.prototype;
896
+
897
+ /*
898
+ * Copyright (c) 2018, salesforce.com, inc.
899
+ * All rights reserved.
900
+ * SPDX-License-Identifier: MIT
901
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
902
+ */
903
+ // These properties get added to LWCElement.prototype publicProps automatically
904
+ var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
908
905
  var controlledElement = null;
909
906
  var controlledAttributeName;
910
907
  function isAttributeLocked(elm, attrName) {
@@ -1758,17 +1755,17 @@
1758
1755
  var refs = refsCache.get(refVNodes);
1759
1756
  if (isUndefined$1(refs)) {
1760
1757
  refs = create(null);
1761
- var _iterator3 = _createForOfIteratorHelper(keys(refVNodes)),
1762
- _step3;
1758
+ var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
1759
+ _step4;
1763
1760
  try {
1764
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1765
- var key = _step3.value;
1761
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1762
+ var key = _step4.value;
1766
1763
  refs[key] = refVNodes[key].elm;
1767
1764
  }
1768
1765
  } catch (err) {
1769
- _iterator3.e(err);
1766
+ _iterator4.e(err);
1770
1767
  } finally {
1771
- _iterator3.f();
1768
+ _iterator4.f();
1772
1769
  }
1773
1770
  freeze(refs);
1774
1771
  refsCache.set(refVNodes, refs);
@@ -1888,6 +1885,262 @@
1888
1885
  };
1889
1886
  }
1890
1887
 
1888
+ /*
1889
+ * Copyright (c) 2018, salesforce.com, inc.
1890
+ * All rights reserved.
1891
+ * SPDX-License-Identifier: MIT
1892
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1893
+ */
1894
+ var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
1895
+ var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
1896
+ var WireMetaMap = new Map();
1897
+ var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
1898
+ _inherits(WireContextRegistrationEvent, _CustomEvent);
1899
+ var _super3 = _createSuper(WireContextRegistrationEvent);
1900
+ function WireContextRegistrationEvent(adapterToken, _ref3) {
1901
+ var _this2;
1902
+ var setNewContext = _ref3.setNewContext,
1903
+ setDisconnectedCallback = _ref3.setDisconnectedCallback;
1904
+ _classCallCheck(this, WireContextRegistrationEvent);
1905
+ _this2 = _super3.call(this, adapterToken, {
1906
+ bubbles: true,
1907
+ composed: true
1908
+ });
1909
+ defineProperties(_assertThisInitialized(_this2), {
1910
+ setNewContext: {
1911
+ value: setNewContext
1912
+ },
1913
+ setDisconnectedCallback: {
1914
+ value: setDisconnectedCallback
1915
+ }
1916
+ });
1917
+ return _this2;
1918
+ }
1919
+ return _createClass(WireContextRegistrationEvent);
1920
+ }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
1921
+ function createFieldDataCallback(vm, name) {
1922
+ return function (value) {
1923
+ updateComponentValue(vm, name, value);
1924
+ };
1925
+ }
1926
+ function createMethodDataCallback(vm, method) {
1927
+ return function (value) {
1928
+ // dispatching new value into the wired method
1929
+ runWithBoundaryProtection(vm, vm.owner, noop, function () {
1930
+ // job
1931
+ method.call(vm.component, value);
1932
+ }, noop);
1933
+ };
1934
+ }
1935
+ function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
1936
+ var hasPendingConfig = false;
1937
+ // creating the reactive observer for reactive params when needed
1938
+ var ro = createReactiveObserver(function () {
1939
+ if (hasPendingConfig === false) {
1940
+ hasPendingConfig = true;
1941
+ // collect new config in the micro-task
1942
+ Promise.resolve().then(function () {
1943
+ hasPendingConfig = false;
1944
+ // resetting current reactive params
1945
+ ro.reset();
1946
+ // dispatching a new config due to a change in the configuration
1947
+ computeConfigAndUpdate();
1948
+ });
1949
+ }
1950
+ });
1951
+ var computeConfigAndUpdate = function computeConfigAndUpdate() {
1952
+ var config;
1953
+ ro.observe(function () {
1954
+ return config = configCallback(component);
1955
+ });
1956
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
1957
+ // TODO: dev-mode validation of config based on the adapter.configSchema
1958
+ // @ts-ignore it is assigned in the observe() callback
1959
+ callbackWhenConfigIsReady(config);
1960
+ };
1961
+ return {
1962
+ computeConfigAndUpdate: computeConfigAndUpdate,
1963
+ ro: ro
1964
+ };
1965
+ }
1966
+ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
1967
+ var adapter = wireDef.adapter;
1968
+ var adapterContextToken = getAdapterToken(adapter);
1969
+ if (isUndefined$1(adapterContextToken)) {
1970
+ return; // no provider found, nothing to be done
1971
+ }
1972
+
1973
+ var elm = vm.elm,
1974
+ _vm$context = vm.context,
1975
+ wiredConnecting = _vm$context.wiredConnecting,
1976
+ wiredDisconnecting = _vm$context.wiredDisconnecting,
1977
+ dispatchEvent = vm.renderer.dispatchEvent;
1978
+ // waiting for the component to be connected to formally request the context via the token
1979
+ ArrayPush$1.call(wiredConnecting, function () {
1980
+ // This event is responsible for connecting the host element with another
1981
+ // element in the composed path that is providing contextual data. The provider
1982
+ // must be listening for a special dom event with the name corresponding to the value of
1983
+ // `adapterContextToken`, which will remain secret and internal to this file only to
1984
+ // guarantee that the linkage can be forged.
1985
+ var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
1986
+ setNewContext: function setNewContext(newContext) {
1987
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
1988
+ // TODO: dev-mode validation of config based on the adapter.contextSchema
1989
+ callbackWhenContextIsReady(newContext);
1990
+ },
1991
+ setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
1992
+ // adds this callback into the disconnect bucket so it gets disconnected from parent
1993
+ // the the element hosting the wire is disconnected
1994
+ ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
1995
+ }
1996
+ });
1997
+ dispatchEvent(elm, contextRegistrationEvent);
1998
+ });
1999
+ }
2000
+ function createConnector(vm, name, wireDef) {
2001
+ var method = wireDef.method,
2002
+ adapter = wireDef.adapter,
2003
+ configCallback = wireDef.configCallback,
2004
+ dynamic = wireDef.dynamic;
2005
+ var debugInfo;
2006
+ var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
2007
+ var dataCallback = function dataCallback(value) {
2008
+ fieldOrMethodCallback(value);
2009
+ };
2010
+ var context;
2011
+ var connector;
2012
+ // Workaround to pass the component element associated to this wire adapter instance.
2013
+ defineProperty(dataCallback, DeprecatedWiredElementHost, {
2014
+ value: vm.elm
2015
+ });
2016
+ defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
2017
+ value: dynamic
2018
+ });
2019
+ runWithBoundaryProtection(vm, vm, noop, function () {
2020
+ // job
2021
+ connector = new adapter(dataCallback);
2022
+ }, noop);
2023
+ var updateConnectorConfig = function updateConnectorConfig(config) {
2024
+ // every time the config is recomputed due to tracking,
2025
+ // this callback will be invoked with the new computed config
2026
+ runWithBoundaryProtection(vm, vm, noop, function () {
2027
+ // job
2028
+ if ("production" !== 'production') ;
2029
+ connector.update(config, context);
2030
+ }, noop);
2031
+ };
2032
+ // Computes the current wire config and calls the update method on the wire adapter.
2033
+ // If it has params, we will need to observe changes in the next tick.
2034
+ var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
2035
+ computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
2036
+ ro = _createConfigWatcher.ro;
2037
+ // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
2038
+ if (!isUndefined$1(adapter.contextSchema)) {
2039
+ createContextWatcher(vm, wireDef, function (newContext) {
2040
+ // every time the context is pushed into this component,
2041
+ // this callback will be invoked with the new computed context
2042
+ if (context !== newContext) {
2043
+ context = newContext;
2044
+ // Note: when new context arrives, the config will be recomputed and pushed along side the new
2045
+ // context, this is to preserve the identity characteristics, config should not have identity
2046
+ // (ever), while context can have identity
2047
+ if (vm.state === 1 /* VMState.connected */) {
2048
+ computeConfigAndUpdate();
2049
+ }
2050
+ }
2051
+ });
2052
+ }
2053
+ return {
2054
+ // @ts-ignore the boundary protection executes sync, connector is always defined
2055
+ connector: connector,
2056
+ computeConfigAndUpdate: computeConfigAndUpdate,
2057
+ resetConfigWatcher: function resetConfigWatcher() {
2058
+ return ro.reset();
2059
+ }
2060
+ };
2061
+ }
2062
+ var AdapterToTokenMap = new Map();
2063
+ function getAdapterToken(adapter) {
2064
+ return AdapterToTokenMap.get(adapter);
2065
+ }
2066
+ function setAdapterToken(adapter, token) {
2067
+ AdapterToTokenMap.set(adapter, token);
2068
+ }
2069
+ function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
2070
+ // support for callable adapters
2071
+ if (adapter.adapter) {
2072
+ adapter = adapter.adapter;
2073
+ }
2074
+ var method = descriptor.value;
2075
+ var def = {
2076
+ adapter: adapter,
2077
+ method: method,
2078
+ configCallback: configCallback,
2079
+ dynamic: dynamic
2080
+ };
2081
+ WireMetaMap.set(descriptor, def);
2082
+ }
2083
+ function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
2084
+ // support for callable adapters
2085
+ if (adapter.adapter) {
2086
+ adapter = adapter.adapter;
2087
+ }
2088
+ var def = {
2089
+ adapter: adapter,
2090
+ configCallback: configCallback,
2091
+ dynamic: dynamic
2092
+ };
2093
+ WireMetaMap.set(descriptor, def);
2094
+ }
2095
+ function installWireAdapters(vm) {
2096
+ var context = vm.context,
2097
+ wire = vm.def.wire;
2098
+ var wiredConnecting = context.wiredConnecting = [];
2099
+ var wiredDisconnecting = context.wiredDisconnecting = [];
2100
+ for (var fieldNameOrMethod in wire) {
2101
+ var descriptor = wire[fieldNameOrMethod];
2102
+ var wireDef = WireMetaMap.get(descriptor);
2103
+ if (!isUndefined$1(wireDef)) {
2104
+ (function () {
2105
+ var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
2106
+ connector = _createConnector.connector,
2107
+ computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
2108
+ resetConfigWatcher = _createConnector.resetConfigWatcher;
2109
+ var hasDynamicParams = wireDef.dynamic.length > 0;
2110
+ ArrayPush$1.call(wiredConnecting, function () {
2111
+ connector.connect();
2112
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
2113
+ if (hasDynamicParams) {
2114
+ Promise.resolve().then(computeConfigAndUpdate);
2115
+ return;
2116
+ }
2117
+ }
2118
+ computeConfigAndUpdate();
2119
+ });
2120
+ ArrayPush$1.call(wiredDisconnecting, function () {
2121
+ connector.disconnect();
2122
+ resetConfigWatcher();
2123
+ });
2124
+ })();
2125
+ }
2126
+ }
2127
+ }
2128
+ function connectWireAdapters(vm) {
2129
+ var wiredConnecting = vm.context.wiredConnecting;
2130
+ for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
2131
+ wiredConnecting[_i8]();
2132
+ }
2133
+ }
2134
+ function disconnectWireAdapters(vm) {
2135
+ var wiredDisconnecting = vm.context.wiredDisconnecting;
2136
+ runWithBoundaryProtection(vm, vm, noop, function () {
2137
+ // job
2138
+ for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
2139
+ wiredDisconnecting[_i9]();
2140
+ }
2141
+ }, noop);
2142
+ }
2143
+
1891
2144
  /*
1892
2145
  * Copyright (c) 2018, salesforce.com, inc.
1893
2146
  * All rights reserved.
@@ -2085,8 +2338,8 @@
2085
2338
  }
2086
2339
  }
2087
2340
  if (!isUndefined$1(fields)) {
2088
- for (var _i8 = 0, n = fields.length; _i8 < n; _i8++) {
2089
- var _fieldName2 = fields[_i8];
2341
+ for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
2342
+ var _fieldName2 = fields[_i10];
2090
2343
  descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
2091
2344
  // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
2092
2345
  // tracked property. This is only here for backward compatibility purposes.
@@ -2237,10 +2490,10 @@
2237
2490
  if (isFunction$1(SuperClass)) {
2238
2491
  HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
2239
2492
  _inherits(HTMLBridgeElement, _SuperClass);
2240
- var _super3 = _createSuper(HTMLBridgeElement);
2493
+ var _super4 = _createSuper(HTMLBridgeElement);
2241
2494
  function HTMLBridgeElement() {
2242
2495
  _classCallCheck(this, HTMLBridgeElement);
2243
- return _super3.apply(this, arguments);
2496
+ return _super4.apply(this, arguments);
2244
2497
  }
2245
2498
  return _createClass(HTMLBridgeElement);
2246
2499
  }(SuperClass);
@@ -2267,8 +2520,8 @@
2267
2520
  superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
2268
2521
  var descriptors = create(null);
2269
2522
  // expose getters and setters for each public props on the new Element Bridge
2270
- for (var _i9 = 0, len = props.length; _i9 < len; _i9 += 1) {
2271
- var _propName = props[_i9];
2523
+ for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
2524
+ var _propName = props[_i11];
2272
2525
  attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
2273
2526
  descriptors[_propName] = {
2274
2527
  get: createGetter(_propName),
@@ -2278,8 +2531,8 @@
2278
2531
  };
2279
2532
  }
2280
2533
  // expose public methods as props on the new Element Bridge
2281
- for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
2282
- var methodName = methods[_i10];
2534
+ for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
2535
+ var methodName = methods[_i12];
2283
2536
  descriptors[methodName] = {
2284
2537
  value: createMethodCaller(methodName),
2285
2538
  writable: true,
@@ -2597,8 +2850,8 @@
2597
2850
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
2598
2851
  var content = [];
2599
2852
  var root;
2600
- for (var _i11 = 0; _i11 < stylesheets.length; _i11++) {
2601
- var stylesheet = stylesheets[_i11];
2853
+ for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
2854
+ var stylesheet = stylesheets[_i13];
2602
2855
  if (isArray$1(stylesheet)) {
2603
2856
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
2604
2857
  } else {
@@ -2698,8 +2951,8 @@
2698
2951
  shadowMode = vm.shadowMode,
2699
2952
  insertStylesheet = vm.renderer.insertStylesheet;
2700
2953
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
2701
- for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
2702
- insertStylesheet(stylesheets[_i12]);
2954
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
2955
+ insertStylesheet(stylesheets[_i14]);
2703
2956
  }
2704
2957
  } else if (vm.hydrated) {
2705
2958
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
@@ -2712,8 +2965,8 @@
2712
2965
  var root = getNearestNativeShadowComponent(vm);
2713
2966
  // null root means a global style
2714
2967
  var target = isNull(root) ? undefined : root.shadowRoot;
2715
- for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
2716
- insertStylesheet(stylesheets[_i13], target);
2968
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
2969
+ insertStylesheet(stylesheets[_i15], target);
2717
2970
  }
2718
2971
  }
2719
2972
  return null;
@@ -3015,8 +3268,8 @@
3015
3268
  return;
3016
3269
  }
3017
3270
  var setCSSStyleProperty = renderer.setCSSStyleProperty;
3018
- for (var _i14 = 0; _i14 < styleDecls.length; _i14++) {
3019
- var _styleDecls$_i = _slicedToArray(styleDecls[_i14], 3),
3271
+ for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
3272
+ var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
3020
3273
  prop = _styleDecls$_i[0],
3021
3274
  value = _styleDecls$_i[1],
3022
3275
  important = _styleDecls$_i[2];
@@ -3439,8 +3692,8 @@
3439
3692
  // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
3440
3693
  var nodeStack = [];
3441
3694
  var fragmentFound = false;
3442
- for (var _i15 = children.length - 1; _i15 > -1; _i15 -= 1) {
3443
- var child = children[_i15];
3695
+ for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
3696
+ var child = children[_i17];
3444
3697
  ArrayPush$1.call(nodeStack, child);
3445
3698
  fragmentFound = fragmentFound || !!(child && isVFragment(child));
3446
3699
  }
@@ -3452,8 +3705,8 @@
3452
3705
  if (!isNull(currentNode) && isVFragment(currentNode)) {
3453
3706
  var fChildren = currentNode.children;
3454
3707
  // Ignore the start and end text node delimiters
3455
- for (var _i16 = fChildren.length - 2; _i16 > 0; _i16 -= 1) {
3456
- ArrayPush$1.call(nodeStack, fChildren[_i16]);
3708
+ for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
3709
+ ArrayPush$1.call(nodeStack, fChildren[_i18]);
3457
3710
  }
3458
3711
  } else {
3459
3712
  ArrayPush$1.call(flattenedChildren, currentNode);
@@ -3489,8 +3742,8 @@
3489
3742
  var oldSlotsMapping = vm.cmpSlots.slotAssignments;
3490
3743
  var cmpSlotsMapping = create(null);
3491
3744
  // Collect all slots into cmpSlotsMapping
3492
- for (var _i17 = 0, len = children.length; _i17 < len; _i17 += 1) {
3493
- var vnode = children[_i17];
3745
+ for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
3746
+ var vnode = children[_i19];
3494
3747
  if (isNull(vnode)) {
3495
3748
  continue;
3496
3749
  }
@@ -3515,8 +3768,8 @@
3515
3768
  markComponentAsDirty(vm);
3516
3769
  return;
3517
3770
  }
3518
- for (var _i18 = 0, _len2 = oldKeys.length; _i18 < _len2; _i18 += 1) {
3519
- var key = oldKeys[_i18];
3771
+ for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
3772
+ var key = oldKeys[_i20];
3520
3773
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
3521
3774
  markComponentAsDirty(vm);
3522
3775
  return;
@@ -3639,11 +3892,11 @@
3639
3892
  if (oldStartIdx > oldEndIdx) {
3640
3893
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
3641
3894
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
3642
- var _i19 = newEndIdx;
3895
+ var _i21 = newEndIdx;
3643
3896
  var n;
3644
3897
  do {
3645
- n = newCh[++_i19];
3646
- } while (!isVNode(n) && _i19 < newChEnd);
3898
+ n = newCh[++_i21];
3899
+ } while (!isVNode(n) && _i21 < newChEnd);
3647
3900
  before = isVNode(n) ? n.elm : null;
3648
3901
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
3649
3902
  } else {
@@ -3668,9 +3921,9 @@
3668
3921
  // if the old list is not empty, the new list MUST have the same
3669
3922
  // amount of nodes, that's why we call this static children
3670
3923
  var anchor = null;
3671
- for (var _i20 = c2Length - 1; _i20 >= 0; _i20 -= 1) {
3672
- var n1 = c1[_i20];
3673
- var n2 = c2[_i20];
3924
+ for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
3925
+ var n1 = c1[_i22];
3926
+ var n2 = c2[_i22];
3674
3927
  if (n2 !== n1) {
3675
3928
  if (isVNode(n1)) {
3676
3929
  if (isVNode(n2)) {
@@ -3767,8 +4020,8 @@
3767
4020
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
3768
4021
  var newChildren = [];
3769
4022
  var slotAssignments = slotset.slotAssignments[slotName];
3770
- for (var _i21 = 0; _i21 < slotAssignments.length; _i21++) {
3771
- var vnode = slotAssignments[_i21];
4023
+ for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
4024
+ var vnode = slotAssignments[_i23];
3772
4025
  if (!isNull(vnode)) {
3773
4026
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3774
4027
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -4147,23 +4400,23 @@
4147
4400
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
4148
4401
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
4149
4402
  var htmlFragment = '';
4150
- for (var _i22 = 0, n = keys.length; _i22 < n; _i22++) {
4151
- switch (keys[_i22]) {
4403
+ for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
4404
+ switch (keys[_i24]) {
4152
4405
  case 0:
4153
4406
  // styleToken in existing class attr
4154
- htmlFragment += strings[_i22] + classToken;
4407
+ htmlFragment += strings[_i24] + classToken;
4155
4408
  break;
4156
4409
  case 1:
4157
4410
  // styleToken for added class attr
4158
- htmlFragment += strings[_i22] + classAttrToken;
4411
+ htmlFragment += strings[_i24] + classAttrToken;
4159
4412
  break;
4160
4413
  case 2:
4161
4414
  // styleToken as attr
4162
- htmlFragment += strings[_i22] + attrToken;
4415
+ htmlFragment += strings[_i24] + attrToken;
4163
4416
  break;
4164
4417
  case 3:
4165
4418
  // ${1}${2}
4166
- htmlFragment += strings[_i22] + classAttrToken + attrToken;
4419
+ htmlFragment += strings[_i24] + classAttrToken + attrToken;
4167
4420
  break;
4168
4421
  }
4169
4422
  }
@@ -4253,8 +4506,8 @@
4253
4506
  }
4254
4507
  function computeHasScopedStylesInStylesheets(stylesheets) {
4255
4508
  if (hasStyles(stylesheets)) {
4256
- for (var _i23 = 0; _i23 < stylesheets.length; _i23++) {
4257
- if (isTrue(stylesheets[_i23][KEY__SCOPED_CSS])) {
4509
+ for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
4510
+ if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
4258
4511
  return true;
4259
4512
  }
4260
4513
  }
@@ -4359,8 +4612,8 @@
4359
4612
  */
4360
4613
  function registerComponent(
4361
4614
  // We typically expect a LightningElementConstructor, but technically you can call this with anything
4362
- Ctor, _ref3) {
4363
- var tmpl = _ref3.tmpl;
4615
+ Ctor, _ref4) {
4616
+ var tmpl = _ref4.tmpl;
4364
4617
  if (isFunction$1(Ctor)) {
4365
4618
  signedTemplateMap.set(Ctor, tmpl);
4366
4619
  }
@@ -4420,8 +4673,8 @@
4420
4673
  * subject to change or being removed.
4421
4674
  */
4422
4675
  function register(service) {
4423
- for (var _i24 = 0; _i24 < hooks.length; ++_i24) {
4424
- var hookName = hooks[_i24];
4676
+ for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
4677
+ var hookName = hooks[_i26];
4425
4678
  if (hookName in service) {
4426
4679
  var l = Services[hookName];
4427
4680
  if (isUndefined$1(l)) {
@@ -4435,8 +4688,8 @@
4435
4688
  var component = vm.component,
4436
4689
  def = vm.def,
4437
4690
  context = vm.context;
4438
- for (var _i25 = 0, len = cbs.length; _i25 < len; ++_i25) {
4439
- cbs[_i25].call(undefined, component, {}, def, context);
4691
+ for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
4692
+ cbs[_i27].call(undefined, component, {}, def, context);
4440
4693
  }
4441
4694
  }
4442
4695
 
@@ -4574,8 +4827,8 @@
4574
4827
  var valid = true;
4575
4828
  var validate = function validate(arrayOrStylesheet) {
4576
4829
  if (isArray$1(arrayOrStylesheet)) {
4577
- for (var _i26 = 0; _i26 < arrayOrStylesheet.length; _i26++) {
4578
- validate(arrayOrStylesheet[_i26]);
4830
+ for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
4831
+ validate(arrayOrStylesheet[_i28]);
4579
4832
  }
4580
4833
  } else if (!isFunction$1(arrayOrStylesheet)) {
4581
4834
  // function assumed to be a stylesheet factory
@@ -4710,17 +4963,17 @@
4710
4963
  return a.idx - b.idx;
4711
4964
  });
4712
4965
  rehydrateQueue = []; // reset to a new queue
4713
- for (var _i27 = 0, len = vms.length; _i27 < len; _i27 += 1) {
4714
- var vm = vms[_i27];
4966
+ for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
4967
+ var vm = vms[_i29];
4715
4968
  try {
4716
4969
  rehydrate(vm);
4717
4970
  } catch (error) {
4718
- if (_i27 + 1 < len) {
4971
+ if (_i29 + 1 < len) {
4719
4972
  // pieces of the queue are still pending to be rehydrated, those should have priority
4720
4973
  if (rehydrateQueue.length === 0) {
4721
4974
  addCallbackToNextTick(flushRehydrationQueue);
4722
4975
  }
4723
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i27 + 1));
4976
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
4724
4977
  }
4725
4978
  // we need to end the measure before throwing.
4726
4979
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -4786,8 +5039,8 @@
4786
5039
  var vCustomElementCollection = vm.velements;
4787
5040
  // Reporting disconnection for every child in inverse order since they are
4788
5041
  // inserted in reserved order.
4789
- for (var _i28 = vCustomElementCollection.length - 1; _i28 >= 0; _i28 -= 1) {
4790
- var elm = vCustomElementCollection[_i28].elm;
5042
+ for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
5043
+ var elm = vCustomElementCollection[_i30].elm;
4791
5044
  // There are two cases where the element could be undefined:
4792
5045
  // * when there is an error during the construction phase, and an error
4793
5046
  // boundary picks it, there is a possibility that the VCustomElement
@@ -4818,8 +5071,8 @@
4818
5071
  * defined on its shadow.
4819
5072
  */
4820
5073
  function recursivelyDisconnectChildren(vnodes) {
4821
- for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
4822
- var vnode = vnodes[_i29];
5074
+ for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
5075
+ var vnode = vnodes[_i31];
4823
5076
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
4824
5077
  switch (vnode.type) {
4825
5078
  case 2 /* VNodeType.Element */:
@@ -4843,8 +5096,8 @@
4843
5096
  var children = vm.children,
4844
5097
  renderRoot = vm.renderRoot,
4845
5098
  remove = vm.renderer.remove;
4846
- for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
4847
- var child = children[_i30];
5099
+ for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
5100
+ var child = children[_i32];
4848
5101
  if (!isNull(child) && !isUndefined$1(child.elm)) {
4849
5102
  remove(child.elm, renderRoot);
4850
5103
  }
@@ -4904,254 +5157,153 @@
4904
5157
  * SPDX-License-Identifier: MIT
4905
5158
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4906
5159
  */
4907
- var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
4908
- var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
4909
- var WireMetaMap = new Map();
4910
- var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
4911
- _inherits(WireContextRegistrationEvent, _CustomEvent);
4912
- var _super4 = _createSuper(WireContextRegistrationEvent);
4913
- function WireContextRegistrationEvent(adapterToken, _ref4) {
4914
- var _this2;
4915
- var setNewContext = _ref4.setNewContext,
4916
- setDisconnectedCallback = _ref4.setDisconnectedCallback;
4917
- _classCallCheck(this, WireContextRegistrationEvent);
4918
- _this2 = _super4.call(this, adapterToken, {
4919
- bubbles: true,
4920
- composed: true
4921
- });
4922
- defineProperties(_assertThisInitialized(_this2), {
4923
- setNewContext: {
4924
- value: setNewContext
4925
- },
4926
- setDisconnectedCallback: {
4927
- value: setDisconnectedCallback
4928
- }
4929
- });
4930
- return _this2;
5160
+ //
5161
+ // The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
5162
+ // These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
5163
+ // When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
5164
+ // See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
5165
+ //
5166
+ // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
5167
+ var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
5168
+ var querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
5169
+ function isSyntheticShadowRootInstance(rootNode) {
5170
+ return rootNode !== document && isTrue(rootNode.synthetic);
5171
+ }
5172
+ function reportViolation(source, target, attrName) {
5173
+ // The vm is either for the source, the target, or both. Either one or both must be using synthetic
5174
+ // shadow for a violation to be detected.
5175
+ var vm = getAssociatedVMIfPresent(source.getRootNode().host);
5176
+ if (isUndefined$1(vm)) {
5177
+ vm = getAssociatedVMIfPresent(target.getRootNode().host);
5178
+ }
5179
+ if (isUndefined$1(vm)) {
5180
+ // vm should never be undefined here, but just to be safe, bail out and don't report
5181
+ return;
4931
5182
  }
4932
- return _createClass(WireContextRegistrationEvent);
4933
- }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
4934
- function createFieldDataCallback(vm, name) {
4935
- return function (value) {
4936
- updateComponentValue(vm, name, value);
4937
- };
4938
- }
4939
- function createMethodDataCallback(vm, method) {
4940
- return function (value) {
4941
- // dispatching new value into the wired method
4942
- runWithBoundaryProtection(vm, vm.owner, noop, function () {
4943
- // job
4944
- method.call(vm.component, value);
4945
- }, noop);
4946
- };
5183
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
4947
5184
  }
4948
- function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4949
- var hasPendingConfig = false;
4950
- // creating the reactive observer for reactive params when needed
4951
- var ro = createReactiveObserver(function () {
4952
- if (hasPendingConfig === false) {
4953
- hasPendingConfig = true;
4954
- // collect new config in the micro-task
4955
- Promise.resolve().then(function () {
4956
- hasPendingConfig = false;
4957
- // resetting current reactive params
4958
- ro.reset();
4959
- // dispatching a new config due to a change in the configuration
4960
- computeConfigAndUpdate();
4961
- });
4962
- }
4963
- });
4964
- var computeConfigAndUpdate = function computeConfigAndUpdate() {
4965
- var config;
4966
- ro.observe(function () {
4967
- return config = configCallback(component);
4968
- });
4969
- // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
4970
- // TODO: dev-mode validation of config based on the adapter.configSchema
4971
- // @ts-ignore it is assigned in the observe() callback
4972
- callbackWhenConfigIsReady(config);
4973
- };
4974
- return {
4975
- computeConfigAndUpdate: computeConfigAndUpdate,
4976
- ro: ro
4977
- };
5185
+ function parseIdRefAttributeValue(attrValue) {
5186
+ // split on whitespace and skip empty strings after splitting
5187
+ return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
4978
5188
  }
4979
- function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
4980
- var adapter = wireDef.adapter;
4981
- var adapterContextToken = getAdapterToken(adapter);
4982
- if (isUndefined$1(adapterContextToken)) {
4983
- return; // no provider found, nothing to be done
5189
+ function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
5190
+ var root = elm.getRootNode();
5191
+ if (!isSyntheticShadowRootInstance(root)) {
5192
+ return;
4984
5193
  }
4985
-
4986
- var elm = vm.elm,
4987
- _vm$context = vm.context,
4988
- wiredConnecting = _vm$context.wiredConnecting,
4989
- wiredDisconnecting = _vm$context.wiredDisconnecting,
4990
- dispatchEvent = vm.renderer.dispatchEvent;
4991
- // waiting for the component to be connected to formally request the context via the token
4992
- ArrayPush$1.call(wiredConnecting, function () {
4993
- // This event is responsible for connecting the host element with another
4994
- // element in the composed path that is providing contextual data. The provider
4995
- // must be listening for a special dom event with the name corresponding to the value of
4996
- // `adapterContextToken`, which will remain secret and internal to this file only to
4997
- // guarantee that the linkage can be forged.
4998
- var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
4999
- setNewContext: function setNewContext(newContext) {
5000
- // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
5001
- // TODO: dev-mode validation of config based on the adapter.contextSchema
5002
- callbackWhenContextIsReady(newContext);
5003
- },
5004
- setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
5005
- // adds this callback into the disconnect bucket so it gets disconnected from parent
5006
- // the the element hosting the wire is disconnected
5007
- ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
5194
+ if (attrName === 'id') {
5195
+ // elm is the target, find the source
5196
+ if (!isString(attrValue) || attrValue.length === 0) {
5197
+ // if our id is null or empty, nobody can reference us
5198
+ return;
5199
+ }
5200
+ var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
5201
+ _step5;
5202
+ try {
5203
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
5204
+ var idRefAttrName = _step5.value;
5205
+ // Query all global elements with this attribute. The attribute selector syntax `~=` is for values
5206
+ // that reference multiple IDs, separated by whitespace.
5207
+ var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
5208
+ var sourceElements = querySelectorAll.call(document, query);
5209
+ for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
5210
+ var sourceElement = sourceElements[_i33];
5211
+ var sourceRoot = sourceElement.getRootNode();
5212
+ if (sourceRoot !== root) {
5213
+ reportViolation(sourceElement, elm, idRefAttrName);
5214
+ break;
5215
+ }
5216
+ }
5008
5217
  }
5009
- });
5010
- dispatchEvent(elm, contextRegistrationEvent);
5011
- });
5012
- }
5013
- function createConnector(vm, name, wireDef) {
5014
- var method = wireDef.method,
5015
- adapter = wireDef.adapter,
5016
- configCallback = wireDef.configCallback,
5017
- dynamic = wireDef.dynamic;
5018
- var debugInfo;
5019
- var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5020
- var dataCallback = function dataCallback(value) {
5021
- fieldOrMethodCallback(value);
5022
- };
5023
- var context;
5024
- var connector;
5025
- // Workaround to pass the component element associated to this wire adapter instance.
5026
- defineProperty(dataCallback, DeprecatedWiredElementHost, {
5027
- value: vm.elm
5028
- });
5029
- defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
5030
- value: dynamic
5031
- });
5032
- runWithBoundaryProtection(vm, vm, noop, function () {
5033
- // job
5034
- connector = new adapter(dataCallback);
5035
- }, noop);
5036
- var updateConnectorConfig = function updateConnectorConfig(config) {
5037
- // every time the config is recomputed due to tracking,
5038
- // this callback will be invoked with the new computed config
5039
- runWithBoundaryProtection(vm, vm, noop, function () {
5040
- // job
5041
- if ("production" !== 'production') ;
5042
- connector.update(config, context);
5043
- }, noop);
5044
- };
5045
- // Computes the current wire config and calls the update method on the wire adapter.
5046
- // If it has params, we will need to observe changes in the next tick.
5047
- var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
5048
- computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
5049
- ro = _createConfigWatcher.ro;
5050
- // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
5051
- if (!isUndefined$1(adapter.contextSchema)) {
5052
- createContextWatcher(vm, wireDef, function (newContext) {
5053
- // every time the context is pushed into this component,
5054
- // this callback will be invoked with the new computed context
5055
- if (context !== newContext) {
5056
- context = newContext;
5057
- // Note: when new context arrives, the config will be recomputed and pushed along side the new
5058
- // context, this is to preserve the identity characteristics, config should not have identity
5059
- // (ever), while context can have identity
5060
- if (vm.state === 1 /* VMState.connected */) {
5061
- computeConfigAndUpdate();
5218
+ } catch (err) {
5219
+ _iterator5.e(err);
5220
+ } finally {
5221
+ _iterator5.f();
5222
+ }
5223
+ } else {
5224
+ // elm is the source, find the target
5225
+ var ids = parseIdRefAttributeValue(attrValue);
5226
+ var _iterator6 = _createForOfIteratorHelper(ids),
5227
+ _step6;
5228
+ try {
5229
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
5230
+ var id = _step6.value;
5231
+ var target = getElementById.call(document, id);
5232
+ if (!isNull(target)) {
5233
+ var targetRoot = target.getRootNode();
5234
+ if (targetRoot !== root) {
5235
+ // target element's shadow root is not the same as ours
5236
+ reportViolation(elm, target, attrName);
5237
+ }
5062
5238
  }
5063
5239
  }
5064
- });
5065
- }
5066
- return {
5067
- // @ts-ignore the boundary protection executes sync, connector is always defined
5068
- connector: connector,
5069
- computeConfigAndUpdate: computeConfigAndUpdate,
5070
- resetConfigWatcher: function resetConfigWatcher() {
5071
- return ro.reset();
5240
+ } catch (err) {
5241
+ _iterator6.e(err);
5242
+ } finally {
5243
+ _iterator6.f();
5072
5244
  }
5073
- };
5074
- }
5075
- var AdapterToTokenMap = new Map();
5076
- function getAdapterToken(adapter) {
5077
- return AdapterToTokenMap.get(adapter);
5078
- }
5079
- function setAdapterToken(adapter, token) {
5080
- AdapterToTokenMap.set(adapter, token);
5081
- }
5082
- function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
5083
- // support for callable adapters
5084
- if (adapter.adapter) {
5085
- adapter = adapter.adapter;
5086
5245
  }
5087
- var method = descriptor.value;
5088
- var def = {
5089
- adapter: adapter,
5090
- method: method,
5091
- configCallback: configCallback,
5092
- dynamic: dynamic
5093
- };
5094
- WireMetaMap.set(descriptor, def);
5095
5246
  }
5096
- function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
5097
- // support for callable adapters
5098
- if (adapter.adapter) {
5099
- adapter = adapter.adapter;
5247
+ var enabled = false;
5248
+ // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
5249
+ // reporting is not enabled. It should also only run once
5250
+ function enableDetection() {
5251
+ if (enabled) {
5252
+ return; // don't double-apply the patches
5100
5253
  }
5101
- var def = {
5102
- adapter: adapter,
5103
- configCallback: configCallback,
5104
- dynamic: dynamic
5105
- };
5106
- WireMetaMap.set(descriptor, def);
5107
- }
5108
- function installWireAdapters(vm) {
5109
- var context = vm.context,
5110
- wire = vm.def.wire;
5111
- var wiredConnecting = context.wiredConnecting = [];
5112
- var wiredDisconnecting = context.wiredDisconnecting = [];
5113
- for (var fieldNameOrMethod in wire) {
5114
- var descriptor = wire[fieldNameOrMethod];
5115
- var wireDef = WireMetaMap.get(descriptor);
5116
- if (!isUndefined$1(wireDef)) {
5117
- (function () {
5118
- var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
5119
- connector = _createConnector.connector,
5120
- computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
5121
- resetConfigWatcher = _createConnector.resetConfigWatcher;
5122
- var hasDynamicParams = wireDef.dynamic.length > 0;
5123
- ArrayPush$1.call(wiredConnecting, function () {
5124
- connector.connect();
5125
- if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5126
- if (hasDynamicParams) {
5127
- Promise.resolve().then(computeConfigAndUpdate);
5128
- return;
5129
- }
5130
- }
5131
- computeConfigAndUpdate();
5132
- });
5133
- ArrayPush$1.call(wiredDisconnecting, function () {
5134
- connector.disconnect();
5135
- resetConfigWatcher();
5136
- });
5137
- })();
5254
+
5255
+ enabled = true;
5256
+ var _setAttribute = Element.prototype.setAttribute;
5257
+ // Detect calling `setAttribute` to set an idref or an id
5258
+ assign(Element.prototype, {
5259
+ setAttribute: function setAttribute(attrName, attrValue) {
5260
+ _setAttribute.call(this, attrName, attrValue);
5261
+ if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
5262
+ detectSyntheticCrossRootAria(this, attrName, attrValue);
5263
+ }
5264
+ }
5265
+ });
5266
+ // Detect `elm.id = 'foo'`
5267
+ var idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
5268
+ if (!isUndefined$1(idDescriptor)) {
5269
+ var _get3 = idDescriptor.get,
5270
+ _set3 = idDescriptor.set;
5271
+ // These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
5272
+ if (isFunction$1(_get3) && isFunction$1(_set3)) {
5273
+ defineProperty(Element.prototype, 'id', {
5274
+ get: function get() {
5275
+ return _get3.call(this);
5276
+ },
5277
+ set: function set(value) {
5278
+ _set3.call(this, value);
5279
+ detectSyntheticCrossRootAria(this, 'id', value);
5280
+ },
5281
+ // On the default descriptor for 'id', enumerable and configurable are true
5282
+ enumerable: true,
5283
+ configurable: true
5284
+ });
5138
5285
  }
5139
5286
  }
5140
5287
  }
5141
- function connectWireAdapters(vm) {
5142
- var wiredConnecting = vm.context.wiredConnecting;
5143
- for (var _i31 = 0, len = wiredConnecting.length; _i31 < len; _i31 += 1) {
5144
- wiredConnecting[_i31]();
5145
- }
5288
+ // Our detection logic relies on some modern browser features. We can just skip reporting the data
5289
+ // for unsupported browsers
5290
+ function supportsCssEscape() {
5291
+ return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
5146
5292
  }
5147
- function disconnectWireAdapters(vm) {
5148
- var wiredDisconnecting = vm.context.wiredDisconnecting;
5149
- runWithBoundaryProtection(vm, vm, noop, function () {
5150
- // job
5151
- for (var _i32 = 0, len = wiredDisconnecting.length; _i32 < len; _i32 += 1) {
5152
- wiredDisconnecting[_i32]();
5153
- }
5154
- }, noop);
5293
+ // If this page is not using synthetic shadow, then we don't need to install detection. Note
5294
+ // that we are assuming synthetic shadow is loaded before LWC.
5295
+ function isSyntheticShadowLoaded() {
5296
+ // We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
5297
+ // and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
5298
+ return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
5299
+ }
5300
+ // Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
5301
+ if (supportsCssEscape() && isSyntheticShadowLoaded()) {
5302
+ // Always run detection in dev mode, so we can at least print to the console
5303
+ {
5304
+ // In prod mode, only enable detection if reporting is enabled
5305
+ onReportingEnabled(enableDetection);
5306
+ }
5155
5307
  }
5156
5308
 
5157
5309
  /*
@@ -5359,8 +5511,8 @@
5359
5511
  var nextNode = node;
5360
5512
  var anchor = null;
5361
5513
  var renderer = owner.renderer;
5362
- for (var _i33 = 0; _i33 < children.length; _i33++) {
5363
- var childVnode = children[_i33];
5514
+ for (var _i34 = 0; _i34 < children.length; _i34++) {
5515
+ var childVnode = children[_i34];
5364
5516
  if (!isNull(childVnode)) {
5365
5517
  if (nextNode) {
5366
5518
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -5421,8 +5573,8 @@
5421
5573
  var nodesAreCompatible = true;
5422
5574
  // Validate attributes, though we could always recovery from those by running the update mods.
5423
5575
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
5424
- for (var _i34 = 0, _Object$entries = Object.entries(attrs); _i34 < _Object$entries.length; _i34++) {
5425
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i34], 2),
5576
+ for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
5577
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
5426
5578
  attrName = _Object$entries$_i[0],
5427
5579
  attrValue = _Object$entries$_i[1];
5428
5580
  vnode.owner;
@@ -5509,8 +5661,8 @@
5509
5661
  var parsedVnodeStyle = parseStyleText(elmStyle);
5510
5662
  var expectedStyle = [];
5511
5663
  // styleMap is used when style is set to static value.
5512
- for (var _i35 = 0, n = styleDecls.length; _i35 < n; _i35++) {
5513
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i35], 3),
5664
+ for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
5665
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
5514
5666
  prop = _styleDecls$_i2[0],
5515
5667
  value = _styleDecls$_i2[1],
5516
5668
  important = _styleDecls$_i2[2];
@@ -5584,8 +5736,8 @@
5584
5736
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
5585
5737
  function traverseStylesheets(stylesheets, callback) {
5586
5738
  callback(stylesheets);
5587
- for (var _i36 = 0; _i36 < stylesheets.length; _i36++) {
5588
- var stylesheet = stylesheets[_i36];
5739
+ for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
5740
+ var stylesheet = stylesheets[_i37];
5589
5741
  if (isArray$1(stylesheet)) {
5590
5742
  traverseStylesheets(stylesheet, callback);
5591
5743
  } else {
@@ -6246,17 +6398,17 @@
6246
6398
  function flushPendingWhenDefinedCallbacks(tagName, ctor) {
6247
6399
  var resolvers = pendingWhenDefinedCallbacks.get(tagName);
6248
6400
  if (!isUndefined$1(resolvers)) {
6249
- var _iterator7 = _createForOfIteratorHelper(resolvers),
6250
- _step7;
6401
+ var _iterator10 = _createForOfIteratorHelper(resolvers),
6402
+ _step10;
6251
6403
  try {
6252
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
6253
- var resolver = _step7.value;
6404
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
6405
+ var resolver = _step10.value;
6254
6406
  resolver(ctor);
6255
6407
  }
6256
6408
  } catch (err) {
6257
- _iterator7.e(err);
6409
+ _iterator10.e(err);
6258
6410
  } finally {
6259
- _iterator7.f();
6411
+ _iterator10.f();
6260
6412
  }
6261
6413
  }
6262
6414
  pendingWhenDefinedCallbacks.delete(tagName);
@@ -6306,11 +6458,11 @@
6306
6458
  var awaiting = awaitingUpgrade.get(tagName);
6307
6459
  if (!isUndefined$1(awaiting)) {
6308
6460
  awaitingUpgrade.delete(tagName);
6309
- var _iterator8 = _createForOfIteratorHelper(awaiting),
6310
- _step8;
6461
+ var _iterator11 = _createForOfIteratorHelper(awaiting),
6462
+ _step11;
6311
6463
  try {
6312
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
6313
- var element = _step8.value;
6464
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
6465
+ var element = _step11.value;
6314
6466
  var registeredDefinition = pendingRegistryForElement.get(element);
6315
6467
  // At this point, registeredDefinition should never be undefined because awaitingUpgrade
6316
6468
  // is only populated when we haven't run internalUpgrade yet, and we only populate
@@ -6322,9 +6474,9 @@
6322
6474
  }
6323
6475
  }
6324
6476
  } catch (err) {
6325
- _iterator8.e(err);
6477
+ _iterator11.e(err);
6326
6478
  } finally {
6327
- _iterator8.f();
6479
+ _iterator11.f();
6328
6480
  }
6329
6481
  }
6330
6482
  // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
@@ -6601,7 +6753,7 @@
6601
6753
  function isNull(obj) {
6602
6754
  return obj === null;
6603
6755
  }
6604
- /** version: 2.34.0 */
6756
+ /** version: 2.35.0 */
6605
6757
 
6606
6758
  /*
6607
6759
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6660,17 +6812,17 @@
6660
6812
  exports.createFragment = function (html) {
6661
6813
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
6662
6814
  if (!isUndefined(wrapperTags)) {
6663
- var _iterator9 = _createForOfIteratorHelper(wrapperTags),
6664
- _step9;
6815
+ var _iterator12 = _createForOfIteratorHelper(wrapperTags),
6816
+ _step12;
6665
6817
  try {
6666
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
6667
- var wrapperTag = _step9.value;
6818
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
6819
+ var wrapperTag = _step12.value;
6668
6820
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6669
6821
  }
6670
6822
  } catch (err) {
6671
- _iterator9.e(err);
6823
+ _iterator12.e(err);
6672
6824
  } finally {
6673
- _iterator9.f();
6825
+ _iterator12.f();
6674
6826
  }
6675
6827
  }
6676
6828
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -6679,7 +6831,7 @@
6679
6831
  doc.body.innerHTML = html;
6680
6832
  var content = doc.body;
6681
6833
  if (!isUndefined(wrapperTags)) {
6682
- for (var _i37 = 0; _i37 < wrapperTags.length; _i37++) {
6834
+ for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
6683
6835
  content = content.firstChild;
6684
6836
  }
6685
6837
  }
@@ -6872,8 +7024,8 @@
6872
7024
  tagName: element.tagName.toLowerCase(),
6873
7025
  hydrated: true
6874
7026
  });
6875
- for (var _i38 = 0, _Object$entries2 = Object.entries(props); _i38 < _Object$entries2.length; _i38++) {
6876
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i38], 2),
7027
+ for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
7028
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
6877
7029
  key = _Object$entries2$_i[0],
6878
7030
  value = _Object$entries2$_i[1];
6879
7031
  element[key] = value;
@@ -7160,10 +7312,11 @@
7160
7312
  });
7161
7313
  freeze(LightningElement);
7162
7314
  seal(LightningElement.prototype);
7163
- /* version: 2.34.0 */
7315
+ /* version: 2.35.0 */
7164
7316
 
7165
7317
  exports.LightningElement = LightningElement;
7166
7318
  exports.__unstable__ProfilerControl = profilerControl;
7319
+ exports.__unstable__ReportingControl = reportingControl;
7167
7320
  exports.api = api$1;
7168
7321
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
7169
7322
  exports.createContextProvider = createContextProvider;