lwc 2.32.0 → 2.33.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 (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +898 -802
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +898 -802
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +683 -608
  5. package/dist/engine-dom/iife/es5/engine-dom.js +324 -313
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +234 -270
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +898 -802
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +683 -608
  11. package/dist/engine-dom/umd/es5/engine-dom.js +324 -313
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +234 -270
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +871 -696
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +871 -696
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +89 -347
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +89 -347
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +89 -347
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +89 -347
  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 +5 -3
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +5 -3
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +5 -3
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +5 -3
  41. package/package.json +7 -7
@@ -4,9 +4,7 @@ var LWC = (function (exports) {
4
4
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf2(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
5
5
  function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
6
6
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
7
- function _get2() { if (typeof Reflect !== "undefined" && Reflect.get) { _get2 = Reflect.get.bind(); } else { _get2 = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get2.apply(this, arguments); }
8
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
9
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
8
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
9
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -15,15 +13,17 @@ var LWC = (function (exports) {
15
13
  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; } }
16
14
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
17
15
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
- 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, descriptor.key, descriptor); } }
16
+ 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); } }
19
17
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
+ 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); }
20
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
21
  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."); }
22
22
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
23
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
24
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
25
  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."); }
26
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
26
+ 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; } }
27
27
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
28
  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; } } }; }
29
29
  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); }
@@ -178,6 +178,9 @@ var LWC = (function (exports) {
178
178
  * The above list of 46 aria attributes is consistent with the following resources:
179
179
  * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
180
180
  * https://wicg.github.io/aom/spec/aria-reflection.html
181
+ *
182
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
183
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
181
184
  */
182
185
  var AriaPropertyNames = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];
183
186
  var _ref = /*@__PURE__*/function () {
@@ -346,90 +349,9 @@ var LWC = (function (exports) {
346
349
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
347
350
  */
348
351
  // Increment whenever the LWC template compiler changes
349
- var LWC_VERSION = "2.32.0";
352
+ var LWC_VERSION = "2.33.0";
350
353
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
351
- /** version: 2.32.0 */
352
-
353
- /**
354
- * Copyright (C) 2018 salesforce.com, inc.
355
- */
356
-
357
- /*
358
- * Copyright (c) 2018, salesforce.com, inc.
359
- * All rights reserved.
360
- * SPDX-License-Identifier: MIT
361
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
362
- */
363
- function detect(propName) {
364
- return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
365
- }
366
-
367
- /*
368
- * Copyright (c) 2018, salesforce.com, inc.
369
- * All rights reserved.
370
- * SPDX-License-Identifier: MIT
371
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
372
- */
373
- var nodeToAriaPropertyValuesMap = new WeakMap();
374
- function getAriaPropertyMap(elm) {
375
- var map = nodeToAriaPropertyValuesMap.get(elm);
376
- if (map === undefined) {
377
- map = {};
378
- nodeToAriaPropertyValuesMap.set(elm, map);
379
- }
380
- return map;
381
- }
382
- function getNormalizedAriaPropertyValue(value) {
383
- return value == null ? null : String(value);
384
- }
385
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
386
- return {
387
- get: function get() {
388
- var map = getAriaPropertyMap(this);
389
- if (hasOwnProperty$1.call(map, propName)) {
390
- return map[propName];
391
- }
392
- // otherwise just reflect what's in the attribute
393
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
394
- },
395
- set: function set(newValue) {
396
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
397
- var map = getAriaPropertyMap(this);
398
- map[propName] = normalizedValue;
399
- // reflect into the corresponding attribute
400
- if (newValue === null) {
401
- this.removeAttribute(attrName);
402
- } else {
403
- this.setAttribute(attrName, newValue);
404
- }
405
- },
406
- configurable: true,
407
- enumerable: true
408
- };
409
- }
410
- function patch$1(propName) {
411
- // Typescript is inferring the wrong function type for this particular
412
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
413
- // @ts-ignore type-mismatch
414
- var attrName = AriaPropNameToAttrNameMap[propName];
415
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
416
- Object.defineProperty(Element.prototype, propName, descriptor);
417
- }
418
-
419
- /*
420
- * Copyright (c) 2018, salesforce.com, inc.
421
- * All rights reserved.
422
- * SPDX-License-Identifier: MIT
423
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
424
- */
425
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
426
- for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
427
- var propName = ElementPrototypeAriaPropertyNames[_i2];
428
- if (detect(propName)) {
429
- patch$1(propName);
430
- }
431
- }
432
- /** version: 2.32.0 */
354
+ /** version: 2.33.0 */
433
355
 
434
356
  /**
435
357
  * Copyright (C) 2018 salesforce.com, inc.
@@ -443,19 +365,15 @@ var LWC = (function (exports) {
443
365
  */
444
366
  var features = {
445
367
  DUMMY_TEST_FLAG: null,
446
- ENABLE_ELEMENT_PATCH: null,
447
368
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
448
- ENABLE_HTML_COLLECTIONS_PATCH: null,
449
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
450
369
  ENABLE_MIXED_SHADOW_MODE: null,
451
370
  ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
452
- ENABLE_NODE_LIST_PATCH: null,
453
- ENABLE_NODE_PATCH: null,
454
- ENABLE_REACTIVE_SETTER: null,
455
371
  ENABLE_WIRE_SYNC_EMIT: null,
456
372
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
457
373
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
458
- ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null
374
+ ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
375
+ ENABLE_FROZEN_TEMPLATE: null,
376
+ DISABLE_ARIA_REFLECTION_POLYFILL: null
459
377
  };
460
378
  if (!_globalThis.lwcRuntimeFlags) {
461
379
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -511,7 +429,83 @@ var LWC = (function (exports) {
511
429
  setFeatureFlag(name, value);
512
430
  }
513
431
  }
514
- /** version: 2.32.0 */
432
+ /** version: 2.33.0 */
433
+
434
+ /**
435
+ * Copyright (C) 2018 salesforce.com, inc.
436
+ */
437
+
438
+ /*
439
+ * Copyright (c) 2018, salesforce.com, inc.
440
+ * All rights reserved.
441
+ * SPDX-License-Identifier: MIT
442
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
443
+ */
444
+ function detect(propName, prototype) {
445
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
446
+ }
447
+
448
+ /*
449
+ * Copyright (c) 2018, salesforce.com, inc.
450
+ * All rights reserved.
451
+ * SPDX-License-Identifier: MIT
452
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
453
+ */
454
+ function createAriaPropertyPropertyDescriptor(attrName) {
455
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
456
+ // from Element.prototype, because these methods are overridden in LightningElement.
457
+ return {
458
+ get: function get() {
459
+ // reflect what's in the attribute
460
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
461
+ },
462
+ set: function set(newValue) {
463
+ // reflect into the corresponding attribute
464
+ if (isNull(newValue)) {
465
+ this.removeAttribute(attrName);
466
+ } else {
467
+ this.setAttribute(attrName, newValue);
468
+ }
469
+ },
470
+ configurable: true,
471
+ enumerable: true
472
+ };
473
+ }
474
+ function patch$1(propName, prototype) {
475
+ var attrName = AriaPropNameToAttrNameMap[propName];
476
+ var descriptor = createAriaPropertyPropertyDescriptor(attrName);
477
+ defineProperty(prototype, propName, descriptor);
478
+ }
479
+
480
+ /*
481
+ * Copyright (c) 2018, salesforce.com, inc.
482
+ * All rights reserved.
483
+ * SPDX-License-Identifier: MIT
484
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
485
+ */
486
+ function applyAriaReflection() {
487
+ var prototype = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Element.prototype;
488
+ var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
489
+ for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
490
+ var propName = ElementPrototypeAriaPropertyNames[_i2];
491
+ if (detect(propName, prototype)) {
492
+ patch$1(propName, prototype);
493
+ }
494
+ }
495
+ }
496
+ /** version: 2.33.0 */
497
+
498
+ /*
499
+ * Copyright (c) 2018, salesforce.com, inc.
500
+ * All rights reserved.
501
+ * SPDX-License-Identifier: MIT
502
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
503
+ */
504
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
505
+ // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
506
+ // i.e. to the global Element.prototype
507
+ applyAriaReflection();
508
+ }
515
509
 
516
510
  /*
517
511
  * Copyright (c) 2018, salesforce.com, inc.
@@ -579,7 +573,7 @@ var LWC = (function (exports) {
579
573
  }
580
574
  var callbacks = nextTickCallbackQueue;
581
575
  nextTickCallbackQueue = []; // reset to a new queue
582
- for (var _i3 = 0, _len = callbacks.length; _i3 < _len; _i3 += 1) {
576
+ for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
583
577
  callbacks[_i3]();
584
578
  }
585
579
  }
@@ -697,7 +691,7 @@ var LWC = (function (exports) {
697
691
  if (!isUndefined$1(reactiveRecord)) {
698
692
  var reactiveObservers = reactiveRecord[key];
699
693
  if (!isUndefined$1(reactiveObservers)) {
700
- for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
694
+ for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
701
695
  var ro = reactiveObservers[_i5];
702
696
  ro.notify();
703
697
  }
@@ -1099,7 +1093,7 @@ var LWC = (function (exports) {
1099
1093
  })
1100
1094
  };
1101
1095
  // Apply extra restriction related to DOM manipulation if the element is not a portal.
1102
- if (!options.isLight && !options.isPortal) {
1096
+ if (!options.isLight && options.isSynthetic && !options.isPortal) {
1103
1097
  var appendChild = elm.appendChild,
1104
1098
  insertBefore = elm.insertBefore,
1105
1099
  removeChild = elm.removeChild,
@@ -2470,6 +2464,17 @@ var LWC = (function (exports) {
2470
2464
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
2471
2465
  }
2472
2466
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
2467
+ function applyAriaReflectionToLightningElement() {
2468
+ // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
2469
+ // apply it to LightningElement.prototype.
2470
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
2471
+ applyAriaReflection(LightningElement.prototype);
2472
+ }
2473
+ // The reason for this odd if/else branching is limitations in @lwc/features:
2474
+ // https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
2475
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2476
+ applyAriaReflectionToLightningElement();
2477
+ }
2473
2478
  defineProperty(LightningElement, 'CustomElementConstructor', {
2474
2479
  get: function get() {
2475
2480
  // If required, a runtime-specific implementation must be defined.
@@ -2495,56 +2500,6 @@ var LWC = (function (exports) {
2495
2500
  configurable: true
2496
2501
  };
2497
2502
  }
2498
- var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2499
- _inherits(AccessorReactiveObserver, _ReactiveObserver);
2500
- var _super3 = _createSuper(AccessorReactiveObserver);
2501
- function AccessorReactiveObserver(vm, set) {
2502
- var _this2;
2503
- _classCallCheck(this, AccessorReactiveObserver);
2504
- _this2 = _super3.call(this, function () {
2505
- if (isFalse(_this2.debouncing)) {
2506
- _this2.debouncing = true;
2507
- addCallbackToNextTick(function () {
2508
- if (isTrue(_this2.debouncing)) {
2509
- var _assertThisInitialize = _assertThisInitialized(_this2),
2510
- value = _assertThisInitialize.value;
2511
- var dirtyStateBeforeSetterCall = vm.isDirty,
2512
- component = vm.component,
2513
- _idx = vm.idx;
2514
- set.call(component, value);
2515
- // de-bouncing after the call to the original setter to prevent
2516
- // infinity loop if the setter itself is mutating things that
2517
- // were accessed during the previous invocation.
2518
- _this2.debouncing = false;
2519
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && _idx > 0) {
2520
- // immediate rehydration due to a setter driven mutation, otherwise
2521
- // the component will get rendered on the second tick, which it is not
2522
- // desirable.
2523
- rerenderVM(vm);
2524
- }
2525
- }
2526
- });
2527
- }
2528
- });
2529
- _this2.debouncing = false;
2530
- return _this2;
2531
- }
2532
- _createClass(AccessorReactiveObserver, [{
2533
- key: "reset",
2534
- value: function reset(value) {
2535
- _get2(_getPrototypeOf2(AccessorReactiveObserver.prototype), "reset", this).call(this);
2536
- this.debouncing = false;
2537
- if (arguments.length > 0) {
2538
- this.value = value;
2539
- }
2540
- }
2541
- }]);
2542
- return AccessorReactiveObserver;
2543
- }(ReactiveObserver);
2544
- function createAccessorReactiveObserver(vm, set) {
2545
- // On the server side, we don't need mutation tracking. Skipping it improves performance.
2546
- return new AccessorReactiveObserver(vm, set);
2547
- }
2548
2503
 
2549
2504
  /*
2550
2505
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2586,13 +2541,13 @@ var LWC = (function (exports) {
2586
2541
  };
2587
2542
  }
2588
2543
  function createPublicAccessorDescriptor(key, descriptor) {
2589
- var _get3 = descriptor.get,
2544
+ var _get2 = descriptor.get,
2590
2545
  _set2 = descriptor.set,
2591
2546
  enumerable = descriptor.enumerable,
2592
2547
  configurable = descriptor.configurable;
2593
- if (!isFunction$1(_get3)) {
2548
+ if (!isFunction$1(_get2)) {
2594
2549
  if (process.env.NODE_ENV !== 'production') {
2595
- assert.invariant(isFunction$1(_get3), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
2550
+ assert.invariant(isFunction$1(_get2), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
2596
2551
  }
2597
2552
  throw new Error();
2598
2553
  }
@@ -2602,10 +2557,9 @@ var LWC = (function (exports) {
2602
2557
  // Assert that the this value is an actual Component with an associated VM.
2603
2558
  getAssociatedVM(this);
2604
2559
  }
2605
- return _get3.call(this);
2560
+ return _get2.call(this);
2606
2561
  },
2607
2562
  set: function set(newValue) {
2608
- var _this3 = this;
2609
2563
  var vm = getAssociatedVM(this);
2610
2564
  if (process.env.NODE_ENV !== 'production') {
2611
2565
  var _vmBeingRendered4 = getVMBeingRendered();
@@ -2613,22 +2567,7 @@ var LWC = (function (exports) {
2613
2567
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2614
2568
  }
2615
2569
  if (_set2) {
2616
- if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2617
- var ro = vm.oar[key];
2618
- if (isUndefined$1(ro)) {
2619
- ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2620
- }
2621
- // every time we invoke this setter from outside (through this wrapper setter)
2622
- // we should reset the value and then debounce just in case there is a pending
2623
- // invocation the next tick that is not longer relevant since the value is changing
2624
- // from outside.
2625
- ro.reset(newValue);
2626
- ro.observe(function () {
2627
- _set2.call(_this3, newValue);
2628
- });
2629
- } else {
2630
- _set2.call(this, newValue);
2631
- }
2570
+ _set2.call(this, newValue);
2632
2571
  } else if (process.env.NODE_ENV !== 'production') {
2633
2572
  assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
2634
2573
  }
@@ -2967,13 +2906,6 @@ var LWC = (function (exports) {
2967
2906
  }
2968
2907
  }
2969
2908
  }
2970
-
2971
- /*
2972
- * Copyright (c) 2018, salesforce.com, inc.
2973
- * All rights reserved.
2974
- * SPDX-License-Identifier: MIT
2975
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2976
- */
2977
2909
  var signedTemplateSet = new Set();
2978
2910
  function defaultEmptyTemplate() {
2979
2911
  return [];
@@ -2991,32 +2923,6 @@ var LWC = (function (exports) {
2991
2923
  checkVersionMismatch(tpl, 'template');
2992
2924
  }
2993
2925
  signedTemplateSet.add(tpl);
2994
- // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2995
- // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2996
- // on top of stylesheetToken for anyone who is accessing the old internal API.
2997
- // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2998
- defineProperty(tpl, 'stylesheetTokens', {
2999
- enumerable: true,
3000
- configurable: true,
3001
- get: function get() {
3002
- var stylesheetToken = this.stylesheetToken;
3003
- if (isUndefined$1(stylesheetToken)) {
3004
- return stylesheetToken;
3005
- }
3006
- // Shim for the old `stylesheetTokens` property
3007
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
3008
- return {
3009
- hostAttribute: "".concat(stylesheetToken, "-host"),
3010
- shadowAttribute: stylesheetToken
3011
- };
3012
- },
3013
- set: function set(value) {
3014
- // If the value is null or some other exotic object, you would be broken anyway in the past
3015
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
3016
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
3017
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
3018
- }
3019
- });
3020
2926
  // chaining this method as a way to wrap existing
3021
2927
  // assignment of templates easily, without too much transformation
3022
2928
  return tpl;
@@ -3117,10 +3023,10 @@ var LWC = (function (exports) {
3117
3023
  if (isFunction$1(SuperClass)) {
3118
3024
  HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
3119
3025
  _inherits(HTMLBridgeElement, _SuperClass);
3120
- var _super4 = _createSuper(HTMLBridgeElement);
3026
+ var _super3 = _createSuper(HTMLBridgeElement);
3121
3027
  function HTMLBridgeElement() {
3122
3028
  _classCallCheck(this, HTMLBridgeElement);
3123
- return _super4.apply(this, arguments);
3029
+ return _super3.apply(this, arguments);
3124
3030
  }
3125
3031
  return _createClass(HTMLBridgeElement);
3126
3032
  }(SuperClass);
@@ -3158,7 +3064,7 @@ var LWC = (function (exports) {
3158
3064
  };
3159
3065
  }
3160
3066
  // expose public methods as props on the new Element Bridge
3161
- for (var _i10 = 0, _len3 = methods.length; _i10 < _len3; _i10 += 1) {
3067
+ for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
3162
3068
  var methodName = methods[_i10];
3163
3069
  descriptors[methodName] = {
3164
3070
  value: createMethodCaller(methodName),
@@ -3184,6 +3090,20 @@ var LWC = (function (exports) {
3184
3090
  return HTMLBridgeElement;
3185
3091
  }
3186
3092
  var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3093
+ {
3094
+ // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
3095
+ // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
3096
+ // ARIA props outside the LightningElement
3097
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
3098
+ // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
3099
+ // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
3100
+ // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
3101
+ //
3102
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
3103
+ // accessors inside the HTMLBridgeElementFactory.
3104
+ applyAriaReflection(BaseBridgeElement.prototype);
3105
+ }
3106
+ }
3187
3107
  freeze(BaseBridgeElement);
3188
3108
  seal(BaseBridgeElement.prototype);
3189
3109
 
@@ -4518,11 +4438,13 @@ var LWC = (function (exports) {
4518
4438
  function applyElementRestrictions(elm, vnode) {
4519
4439
  var _a, _b;
4520
4440
  if (process.env.NODE_ENV !== 'production') {
4441
+ var isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
4521
4442
  var isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4522
4443
  var isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4523
4444
  patchElementWithRestrictions(elm, {
4524
4445
  isPortal: isPortal,
4525
- isLight: isLight
4446
+ isLight: isLight,
4447
+ isSynthetic: isSynthetic
4526
4448
  });
4527
4449
  }
4528
4450
  }
@@ -4926,7 +4848,7 @@ var LWC = (function (exports) {
4926
4848
  // undefined is for root components, but root components cannot accept slotted content
4927
4849
  setVMBeingRendered(slotset.owner);
4928
4850
  try {
4929
- ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
4851
+ ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
4930
4852
  } finally {
4931
4853
  setVMBeingRendered(vmBeingRenderedInception);
4932
4854
  }
@@ -5401,7 +5323,7 @@ var LWC = (function (exports) {
5401
5323
  }
5402
5324
  function buildParseFragmentFn(createFragmentFn) {
5403
5325
  return function (strings) {
5404
- for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
5326
+ for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
5405
5327
  keys[_key3 - 1] = arguments[_key3];
5406
5328
  }
5407
5329
  var cache = create(null);
@@ -5812,14 +5734,9 @@ var LWC = (function (exports) {
5812
5734
  function resetComponentStateWhenRemoved(vm) {
5813
5735
  var state = vm.state;
5814
5736
  if (state !== 2 /* VMState.disconnected */) {
5815
- var oar = vm.oar,
5816
- tro = vm.tro;
5737
+ var tro = vm.tro;
5817
5738
  // Making sure that any observing record will not trigger the rehydrated on this vm
5818
5739
  tro.reset();
5819
- // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5820
- for (var key in oar) {
5821
- oar[key].reset();
5822
- }
5823
5740
  runDisconnectedCallback(vm);
5824
5741
  // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5825
5742
  runChildNodesDisconnectedCallback(vm);
@@ -5870,7 +5787,6 @@ var LWC = (function (exports) {
5870
5787
  cmpSlots: {
5871
5788
  slotAssignments: create(null)
5872
5789
  },
5873
- oar: create(null),
5874
5790
  cmpTemplate: null,
5875
5791
  hydrated: Boolean(hydrated),
5876
5792
  renderMode: def.renderMode,
@@ -6262,17 +6178,17 @@ var LWC = (function (exports) {
6262
6178
  var WireMetaMap = new Map();
6263
6179
  var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
6264
6180
  _inherits(WireContextRegistrationEvent, _CustomEvent);
6265
- var _super5 = _createSuper(WireContextRegistrationEvent);
6181
+ var _super4 = _createSuper(WireContextRegistrationEvent);
6266
6182
  function WireContextRegistrationEvent(adapterToken, _ref4) {
6267
- var _this4;
6183
+ var _this2;
6268
6184
  var setNewContext = _ref4.setNewContext,
6269
6185
  setDisconnectedCallback = _ref4.setDisconnectedCallback;
6270
6186
  _classCallCheck(this, WireContextRegistrationEvent);
6271
- _this4 = _super5.call(this, adapterToken, {
6187
+ _this2 = _super4.call(this, adapterToken, {
6272
6188
  bubbles: true,
6273
6189
  composed: true
6274
6190
  });
6275
- defineProperties(_assertThisInitialized(_this4), {
6191
+ defineProperties(_assertThisInitialized(_this2), {
6276
6192
  setNewContext: {
6277
6193
  value: setNewContext
6278
6194
  },
@@ -6280,7 +6196,7 @@ var LWC = (function (exports) {
6280
6196
  value: setDisconnectedCallback
6281
6197
  }
6282
6198
  });
6283
- return _this4;
6199
+ return _this2;
6284
6200
  }
6285
6201
  return _createClass(WireContextRegistrationEvent);
6286
6202
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
@@ -7031,6 +6947,10 @@ var LWC = (function (exports) {
7031
6947
  var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7032
6948
  // Via https://www.npmjs.com/package/object-observer
7033
6949
  var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
6950
+ // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
6951
+ var STYLESHEET_FUNCTION_EXPANDOS = [
6952
+ // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
6953
+ '$scoped$'];
7034
6954
  function getOriginalArrayMethod(prop) {
7035
6955
  switch (prop) {
7036
6956
  case 'pop':
@@ -7054,7 +6974,7 @@ var LWC = (function (exports) {
7054
6974
  }
7055
6975
  }
7056
6976
  var mutationWarningsSilenced = false;
7057
- // Warn if the user tries to mutate tmpl.stylesheets, e.g.:
6977
+ // Warn if the user tries to mutate a stylesheets array, e.g.:
7058
6978
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7059
6979
  function warnOnArrayMutation(stylesheets) {
7060
6980
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
@@ -7080,54 +7000,145 @@ var LWC = (function (exports) {
7080
7000
  _iterator4.f();
7081
7001
  }
7082
7002
  }
7083
- // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
7084
- // just warns on mutation.
7003
+ // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7004
+ // `stylesheet.$scoped$ = true`
7005
+ function warnOnStylesheetFunctionMutation(stylesheet) {
7006
+ // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7007
+ var _iterator5 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
7008
+ _step5;
7009
+ try {
7010
+ var _loop3 = function _loop3() {
7011
+ var prop = _step5.value;
7012
+ var value = stylesheet[prop];
7013
+ defineProperty(stylesheet, prop, {
7014
+ enumerable: true,
7015
+ configurable: true,
7016
+ get: function get() {
7017
+ return value;
7018
+ },
7019
+ set: function set(newValue) {
7020
+ logError("Dynamically setting the \"".concat(prop, "\" property on a stylesheet function ") + "is deprecated and may be removed in a future version of LWC.");
7021
+ value = newValue;
7022
+ }
7023
+ });
7024
+ };
7025
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
7026
+ _loop3();
7027
+ }
7028
+ } catch (err) {
7029
+ _iterator5.e(err);
7030
+ } finally {
7031
+ _iterator5.f();
7032
+ }
7033
+ }
7034
+ // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7035
+ function warnOnStylesheetsMutation(stylesheets) {
7036
+ traverseStylesheets(stylesheets, function (subStylesheets) {
7037
+ if (isArray$1(subStylesheets)) {
7038
+ warnOnArrayMutation(subStylesheets);
7039
+ } else {
7040
+ warnOnStylesheetFunctionMutation(subStylesheets);
7041
+ }
7042
+ });
7043
+ }
7044
+ // Deeply freeze the entire array (of arrays) of stylesheet factory functions
7045
+ function deepFreeze(stylesheets) {
7046
+ traverseStylesheets(stylesheets, function (subStylesheets) {
7047
+ freeze(subStylesheets);
7048
+ });
7049
+ }
7050
+ // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7051
+ function traverseStylesheets(stylesheets, callback) {
7052
+ callback(stylesheets);
7053
+ for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
7054
+ var stylesheet = stylesheets[_i33];
7055
+ if (isArray$1(stylesheet)) {
7056
+ traverseStylesheets(stylesheet, callback);
7057
+ } else {
7058
+ callback(stylesheet);
7059
+ }
7060
+ }
7061
+ }
7085
7062
  function freezeTemplate(tmpl) {
7086
- if (process.env.NODE_ENV !== 'production') {
7063
+ if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7064
+ // Deep freeze the template
7065
+ freeze(tmpl);
7087
7066
  if (!isUndefined$1(tmpl.stylesheets)) {
7088
- warnOnArrayMutation(tmpl.stylesheets);
7089
- }
7090
- var _iterator5 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7091
- _step5;
7092
- try {
7093
- var _loop3 = function _loop3() {
7094
- var prop = _step5.value;
7095
- var value = tmpl[prop];
7096
- defineProperty(tmpl, prop, {
7097
- enumerable: true,
7098
- configurable: true,
7099
- get: function get() {
7100
- return value;
7101
- },
7102
- set: function set(newValue) {
7103
- if (!mutationWarningsSilenced) {
7104
- logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7105
- }
7106
- value = newValue;
7107
- }
7108
- });
7109
- };
7110
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
7111
- _loop3();
7112
- }
7113
- } catch (err) {
7114
- _iterator5.e(err);
7115
- } finally {
7116
- _iterator5.f();
7067
+ deepFreeze(tmpl.stylesheets);
7117
7068
  }
7118
- var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7069
+ } else {
7070
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7071
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7072
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7119
7073
  defineProperty(tmpl, 'stylesheetTokens', {
7120
7074
  enumerable: true,
7121
7075
  configurable: true,
7122
- get: originalDescriptor.get,
7076
+ get: function get() {
7077
+ var stylesheetToken = this.stylesheetToken;
7078
+ if (isUndefined$1(stylesheetToken)) {
7079
+ return stylesheetToken;
7080
+ }
7081
+ // Shim for the old `stylesheetTokens` property
7082
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7083
+ return {
7084
+ hostAttribute: "".concat(stylesheetToken, "-host"),
7085
+ shadowAttribute: stylesheetToken
7086
+ };
7087
+ },
7123
7088
  set: function set(value) {
7124
- logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7125
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7126
- mutationWarningsSilenced = true;
7127
- originalDescriptor.set.call(this, value);
7128
- mutationWarningsSilenced = false;
7089
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7090
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7091
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7092
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7129
7093
  }
7130
7094
  });
7095
+ // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7096
+ if (process.env.NODE_ENV !== 'production') {
7097
+ if (!isUndefined$1(tmpl.stylesheets)) {
7098
+ warnOnStylesheetsMutation(tmpl.stylesheets);
7099
+ }
7100
+ var _iterator6 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7101
+ _step6;
7102
+ try {
7103
+ var _loop4 = function _loop4() {
7104
+ var prop = _step6.value;
7105
+ var value = tmpl[prop];
7106
+ defineProperty(tmpl, prop, {
7107
+ enumerable: true,
7108
+ configurable: true,
7109
+ get: function get() {
7110
+ return value;
7111
+ },
7112
+ set: function set(newValue) {
7113
+ if (!mutationWarningsSilenced) {
7114
+ logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7115
+ }
7116
+ value = newValue;
7117
+ }
7118
+ });
7119
+ };
7120
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7121
+ _loop4();
7122
+ }
7123
+ } catch (err) {
7124
+ _iterator6.e(err);
7125
+ } finally {
7126
+ _iterator6.f();
7127
+ }
7128
+ var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7129
+ defineProperty(tmpl, 'stylesheetTokens', {
7130
+ enumerable: true,
7131
+ configurable: true,
7132
+ get: originalDescriptor.get,
7133
+ set: function set(value) {
7134
+ logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7135
+ // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7136
+ mutationWarningsSilenced = true;
7137
+ originalDescriptor.set.call(this, value);
7138
+ mutationWarningsSilenced = false;
7139
+ }
7140
+ });
7141
+ }
7131
7142
  }
7132
7143
  }
7133
7144
 
@@ -7153,7 +7164,7 @@ var LWC = (function (exports) {
7153
7164
  }
7154
7165
  return ctor;
7155
7166
  }
7156
- /* version: 2.32.0 */
7167
+ /* version: 2.33.0 */
7157
7168
 
7158
7169
  /*
7159
7170
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7390,10 +7401,10 @@ var LWC = (function (exports) {
7390
7401
  // which are not equipped to be initialized that way.
7391
7402
  var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
7392
7403
  _inherits(clazz, _HTMLElementAlias);
7393
- var _super6 = _createSuper(clazz);
7404
+ var _super5 = _createSuper(clazz);
7394
7405
  function clazz() {
7395
7406
  _classCallCheck(this, clazz);
7396
- return _super6.apply(this, arguments);
7407
+ return _super5.apply(this, arguments);
7397
7408
  }
7398
7409
  return _createClass(clazz);
7399
7410
  }(HTMLElementAlias);
@@ -7439,24 +7450,24 @@ var LWC = (function (exports) {
7439
7450
  // TODO [#2972]: this class should expose observedAttributes as necessary
7440
7451
  var UpgradableConstructor = /*#__PURE__*/function (_HTMLElement) {
7441
7452
  _inherits(UpgradableConstructor, _HTMLElement);
7442
- var _super7 = _createSuper(UpgradableConstructor);
7453
+ var _super6 = _createSuper(UpgradableConstructor);
7443
7454
  function UpgradableConstructor(upgradeCallback) {
7444
- var _this5;
7455
+ var _this3;
7445
7456
  _classCallCheck(this, UpgradableConstructor);
7446
- _this5 = _super7.call(this);
7457
+ _this3 = _super6.call(this);
7447
7458
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
7448
7459
  // then elementBeingUpgraded will be false
7449
7460
  if (elementBeingUpgradedByLWC) {
7450
- upgradeCallback(_assertThisInitialized(_this5));
7461
+ upgradeCallback(_assertThisInitialized(_this3));
7451
7462
  } else if (hasConnectedCallback || hasDisconnectedCallback) {
7452
7463
  // If this element has connected or disconnected callbacks, then we need to keep track of
7453
7464
  // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
7454
7465
  // If the element has no connected or disconnected callbacks, then we don't need to track this.
7455
- elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this5));
7466
+ elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this3));
7456
7467
  // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
7457
7468
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
7458
7469
  }
7459
- return _this5;
7470
+ return _this3;
7460
7471
  }
7461
7472
  return _createClass(UpgradableConstructor);
7462
7473
  }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
@@ -7565,9 +7576,9 @@ var LWC = (function (exports) {
7565
7576
  function createPivotingClass(tagName, registeredDefinition) {
7566
7577
  var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
7567
7578
  _inherits(PivotCtor, _NativeHTMLElement);
7568
- var _super8 = _createSuper(PivotCtor);
7579
+ var _super7 = _createSuper(PivotCtor);
7569
7580
  function PivotCtor(UserCtor) {
7570
- var _this6;
7581
+ var _this4;
7571
7582
  _classCallCheck(this, PivotCtor);
7572
7583
  // This constructor can only be invoked by:
7573
7584
  // a) the browser instantiating an element from parsing or via document.createElement.
@@ -7577,7 +7588,7 @@ var LWC = (function (exports) {
7577
7588
  // If the caller signals via UserCtor that this is in fact a controlled
7578
7589
  // definition, we use that one, otherwise fallback to the global
7579
7590
  // internal registry.
7580
- _this6 = _super8.call(this);
7591
+ _this4 = _super7.call(this);
7581
7592
  var userCtorIsDefined = !isUndefined$1(UserCtor);
7582
7593
  if (userCtorIsDefined) {
7583
7594
  if (!isConstructor(UserCtor)) {
@@ -7589,15 +7600,15 @@ var LWC = (function (exports) {
7589
7600
  }
7590
7601
  var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
7591
7602
  if (!isUndefined$1(definition)) {
7592
- internalUpgrade(_assertThisInitialized(_this6), registeredDefinition, definition);
7603
+ internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
7593
7604
  } else {
7594
7605
  // This is the case in which there is no global definition, and
7595
7606
  // it is not handled by LWC (otherwise it will have a valid UserCtor)
7596
7607
  // so we need to add it to the pending queue just in case it eventually
7597
7608
  // gets defined in the global registry.
7598
- pendingRegistryForElement.set(_assertThisInitialized(_this6), registeredDefinition);
7609
+ pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
7599
7610
  }
7600
- return _this6;
7611
+ return _this4;
7601
7612
  }
7602
7613
  _createClass(PivotCtor, [{
7603
7614
  key: "connectedCallback",
@@ -7835,17 +7846,17 @@ var LWC = (function (exports) {
7835
7846
  function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7836
7847
  var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7837
7848
  if (!isUndefined$1(resolvers)) {
7838
- var _iterator6 = _createForOfIteratorHelper(resolvers),
7839
- _step6;
7849
+ var _iterator7 = _createForOfIteratorHelper(resolvers),
7850
+ _step7;
7840
7851
  try {
7841
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7842
- var resolver = _step6.value;
7852
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7853
+ var resolver = _step7.value;
7843
7854
  resolver(ctor);
7844
7855
  }
7845
7856
  } catch (err) {
7846
- _iterator6.e(err);
7857
+ _iterator7.e(err);
7847
7858
  } finally {
7848
- _iterator6.f();
7859
+ _iterator7.f();
7849
7860
  }
7850
7861
  }
7851
7862
  pendingWhenDefinedCallbacks.delete(tagName);
@@ -7895,11 +7906,11 @@ var LWC = (function (exports) {
7895
7906
  var awaiting = awaitingUpgrade.get(tagName);
7896
7907
  if (!isUndefined$1(awaiting)) {
7897
7908
  awaitingUpgrade.delete(tagName);
7898
- var _iterator7 = _createForOfIteratorHelper(awaiting),
7899
- _step7;
7909
+ var _iterator8 = _createForOfIteratorHelper(awaiting),
7910
+ _step8;
7900
7911
  try {
7901
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7902
- var element = _step7.value;
7912
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7913
+ var element = _step8.value;
7903
7914
  var registeredDefinition = pendingRegistryForElement.get(element);
7904
7915
  // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7905
7916
  // is only populated when we haven't run internalUpgrade yet, and we only populate
@@ -7911,9 +7922,9 @@ var LWC = (function (exports) {
7911
7922
  }
7912
7923
  }
7913
7924
  } catch (err) {
7914
- _iterator7.e(err);
7925
+ _iterator8.e(err);
7915
7926
  } finally {
7916
- _iterator7.f();
7927
+ _iterator8.f();
7917
7928
  }
7918
7929
  }
7919
7930
  // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
@@ -8061,13 +8072,13 @@ var LWC = (function (exports) {
8061
8072
  // TODO [#2972]: this class should expose observedAttributes as necessary
8062
8073
  return /*#__PURE__*/function (_HTMLElementToExtend) {
8063
8074
  _inherits(UserConstructor, _HTMLElementToExtend);
8064
- var _super9 = _createSuper(UserConstructor);
8075
+ var _super8 = _createSuper(UserConstructor);
8065
8076
  function UserConstructor() {
8066
- var _this7;
8077
+ var _this5;
8067
8078
  _classCallCheck(this, UserConstructor);
8068
- _this7 = _super9.call(this);
8069
- upgradeCallback(_assertThisInitialized(_this7));
8070
- return _this7;
8079
+ _this5 = _super8.call(this);
8080
+ upgradeCallback(_assertThisInitialized(_this5));
8081
+ return _this5;
8071
8082
  }
8072
8083
  // Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
8073
8084
  // here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
@@ -8190,7 +8201,7 @@ var LWC = (function (exports) {
8190
8201
  function isNull(obj) {
8191
8202
  return obj === null;
8192
8203
  }
8193
- /** version: 2.32.0 */
8204
+ /** version: 2.33.0 */
8194
8205
 
8195
8206
  /*
8196
8207
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8249,17 +8260,17 @@ var LWC = (function (exports) {
8249
8260
  exports.createFragment = function (html) {
8250
8261
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8251
8262
  if (!isUndefined(wrapperTags)) {
8252
- var _iterator8 = _createForOfIteratorHelper(wrapperTags),
8253
- _step8;
8263
+ var _iterator9 = _createForOfIteratorHelper(wrapperTags),
8264
+ _step9;
8254
8265
  try {
8255
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
8256
- var wrapperTag = _step8.value;
8266
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
8267
+ var wrapperTag = _step9.value;
8257
8268
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8258
8269
  }
8259
8270
  } catch (err) {
8260
- _iterator8.e(err);
8271
+ _iterator9.e(err);
8261
8272
  } finally {
8262
- _iterator8.f();
8273
+ _iterator9.f();
8263
8274
  }
8264
8275
  }
8265
8276
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -8268,7 +8279,7 @@ var LWC = (function (exports) {
8268
8279
  doc.body.innerHTML = html;
8269
8280
  var content = doc.body;
8270
8281
  if (!isUndefined(wrapperTags)) {
8271
- for (var _i33 = 0; _i33 < wrapperTags.length; _i33++) {
8282
+ for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
8272
8283
  content = content.firstChild;
8273
8284
  }
8274
8285
  }
@@ -8461,8 +8472,8 @@ var LWC = (function (exports) {
8461
8472
  tagName: element.tagName.toLowerCase(),
8462
8473
  hydrated: true
8463
8474
  });
8464
- for (var _i34 = 0, _Object$entries2 = Object.entries(props); _i34 < _Object$entries2.length; _i34++) {
8465
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i34], 2),
8475
+ for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
8476
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
8466
8477
  key = _Object$entries2$_i[0],
8467
8478
  value = _Object$entries2$_i[1];
8468
8479
  element[key] = value;
@@ -8539,23 +8550,23 @@ var LWC = (function (exports) {
8539
8550
  var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
8540
8551
  return _a = /*#__PURE__*/function (_HTMLElement2) {
8541
8552
  _inherits(_a, _HTMLElement2);
8542
- var _super10 = _createSuper(_a);
8553
+ var _super9 = _createSuper(_a);
8543
8554
  function _a() {
8544
- var _this8;
8555
+ var _this6;
8545
8556
  _classCallCheck(this, _a);
8546
- _this8 = _super10.call(this);
8547
- if (_this8.isConnected) {
8557
+ _this6 = _super9.call(this);
8558
+ if (_this6.isConnected) {
8548
8559
  // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
8549
- hydrateComponent(_assertThisInitialized(_this8), Ctor, {});
8550
- hydratedCustomElements.add(_assertThisInitialized(_this8));
8560
+ hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
8561
+ hydratedCustomElements.add(_assertThisInitialized(_this6));
8551
8562
  } else {
8552
- createVM(_assertThisInitialized(_this8), Ctor, renderer, {
8563
+ createVM(_assertThisInitialized(_this6), Ctor, renderer, {
8553
8564
  mode: 'open',
8554
8565
  owner: null,
8555
- tagName: _this8.tagName
8566
+ tagName: _this6.tagName
8556
8567
  });
8557
8568
  }
8558
- return _this8;
8569
+ return _this6;
8559
8570
  }
8560
8571
  _createClass(_a, [{
8561
8572
  key: "connectedCallback",
@@ -8756,7 +8767,7 @@ var LWC = (function (exports) {
8756
8767
  });
8757
8768
  freeze(LightningElement);
8758
8769
  seal(LightningElement.prototype);
8759
- /* version: 2.32.0 */
8770
+ /* version: 2.33.0 */
8760
8771
 
8761
8772
  exports.LightningElement = LightningElement;
8762
8773
  exports.__unstable__ProfilerControl = profilerControl;