lwc 2.32.1 → 2.34.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 +842 -595
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +842 -595
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +758 -501
  5. package/dist/engine-dom/iife/es5/engine-dom.js +316 -177
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +329 -173
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +842 -595
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +758 -501
  11. package/dist/engine-dom/umd/es5/engine-dom.js +316 -177
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +329 -173
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +807 -507
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +807 -507
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +7 -5
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -5
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +7 -5
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -5
  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,7 +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 _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; }
8
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); }
9
9
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
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); }; }
@@ -13,15 +13,17 @@ var LWC = (function (exports) {
13
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; } }
14
14
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
15
15
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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, 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); } }
17
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); }
18
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
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."); }
20
22
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
23
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
24
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
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."); }
24
- 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; } }
25
27
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
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; } } }; }
27
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); }
@@ -176,6 +178,9 @@ var LWC = (function (exports) {
176
178
  * The above list of 46 aria attributes is consistent with the following resources:
177
179
  * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
178
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.
179
184
  */
180
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'];
181
186
  var _ref = /*@__PURE__*/function () {
@@ -344,90 +349,9 @@ var LWC = (function (exports) {
344
349
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
345
350
  */
346
351
  // Increment whenever the LWC template compiler changes
347
- var LWC_VERSION = "2.32.1";
352
+ var LWC_VERSION = "2.34.0";
348
353
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
349
- /** version: 2.32.1 */
350
-
351
- /**
352
- * Copyright (C) 2018 salesforce.com, inc.
353
- */
354
-
355
- /*
356
- * Copyright (c) 2018, salesforce.com, inc.
357
- * All rights reserved.
358
- * SPDX-License-Identifier: MIT
359
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
360
- */
361
- function detect(propName) {
362
- return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
363
- }
364
-
365
- /*
366
- * Copyright (c) 2018, salesforce.com, inc.
367
- * All rights reserved.
368
- * SPDX-License-Identifier: MIT
369
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
370
- */
371
- var nodeToAriaPropertyValuesMap = new WeakMap();
372
- function getAriaPropertyMap(elm) {
373
- var map = nodeToAriaPropertyValuesMap.get(elm);
374
- if (map === undefined) {
375
- map = {};
376
- nodeToAriaPropertyValuesMap.set(elm, map);
377
- }
378
- return map;
379
- }
380
- function getNormalizedAriaPropertyValue(value) {
381
- return value == null ? null : String(value);
382
- }
383
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
384
- return {
385
- get: function get() {
386
- var map = getAriaPropertyMap(this);
387
- if (hasOwnProperty$1.call(map, propName)) {
388
- return map[propName];
389
- }
390
- // otherwise just reflect what's in the attribute
391
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
392
- },
393
- set: function set(newValue) {
394
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
395
- var map = getAriaPropertyMap(this);
396
- map[propName] = normalizedValue;
397
- // reflect into the corresponding attribute
398
- if (newValue === null) {
399
- this.removeAttribute(attrName);
400
- } else {
401
- this.setAttribute(attrName, newValue);
402
- }
403
- },
404
- configurable: true,
405
- enumerable: true
406
- };
407
- }
408
- function patch$1(propName) {
409
- // Typescript is inferring the wrong function type for this particular
410
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
411
- // @ts-ignore type-mismatch
412
- var attrName = AriaPropNameToAttrNameMap[propName];
413
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
414
- Object.defineProperty(Element.prototype, propName, descriptor);
415
- }
416
-
417
- /*
418
- * Copyright (c) 2018, salesforce.com, inc.
419
- * All rights reserved.
420
- * SPDX-License-Identifier: MIT
421
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
422
- */
423
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
424
- for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
425
- var propName = ElementPrototypeAriaPropertyNames[_i2];
426
- if (detect(propName)) {
427
- patch$1(propName);
428
- }
429
- }
430
- /** version: 2.32.1 */
354
+ /** version: 2.34.0 */
431
355
 
432
356
  /**
433
357
  * Copyright (C) 2018 salesforce.com, inc.
@@ -448,7 +372,9 @@ var LWC = (function (exports) {
448
372
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
449
373
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
450
374
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
451
- ENABLE_FROZEN_TEMPLATE: null
375
+ ENABLE_FROZEN_TEMPLATE: null,
376
+ DISABLE_ARIA_REFLECTION_POLYFILL: null,
377
+ ENABLE_PROGRAMMATIC_STYLESHEETS: null
452
378
  };
453
379
  if (!_globalThis.lwcRuntimeFlags) {
454
380
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -504,7 +430,83 @@ var LWC = (function (exports) {
504
430
  setFeatureFlag(name, value);
505
431
  }
506
432
  }
507
- /** version: 2.32.1 */
433
+ /** version: 2.34.0 */
434
+
435
+ /**
436
+ * Copyright (C) 2018 salesforce.com, inc.
437
+ */
438
+
439
+ /*
440
+ * Copyright (c) 2018, salesforce.com, inc.
441
+ * All rights reserved.
442
+ * SPDX-License-Identifier: MIT
443
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
444
+ */
445
+ function detect(propName, prototype) {
446
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
447
+ }
448
+
449
+ /*
450
+ * Copyright (c) 2018, salesforce.com, inc.
451
+ * All rights reserved.
452
+ * SPDX-License-Identifier: MIT
453
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
454
+ */
455
+ function createAriaPropertyPropertyDescriptor(attrName) {
456
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
457
+ // from Element.prototype, because these methods are overridden in LightningElement.
458
+ return {
459
+ get: function get() {
460
+ // reflect what's in the attribute
461
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
462
+ },
463
+ set: function set(newValue) {
464
+ // reflect into the corresponding attribute
465
+ if (isNull(newValue)) {
466
+ this.removeAttribute(attrName);
467
+ } else {
468
+ this.setAttribute(attrName, newValue);
469
+ }
470
+ },
471
+ configurable: true,
472
+ enumerable: true
473
+ };
474
+ }
475
+ function patch$1(propName, prototype) {
476
+ var attrName = AriaPropNameToAttrNameMap[propName];
477
+ var descriptor = createAriaPropertyPropertyDescriptor(attrName);
478
+ defineProperty(prototype, propName, descriptor);
479
+ }
480
+
481
+ /*
482
+ * Copyright (c) 2018, salesforce.com, inc.
483
+ * All rights reserved.
484
+ * SPDX-License-Identifier: MIT
485
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
486
+ */
487
+ function applyAriaReflection() {
488
+ var prototype = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Element.prototype;
489
+ var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
490
+ for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
491
+ var propName = ElementPrototypeAriaPropertyNames[_i2];
492
+ if (detect(propName, prototype)) {
493
+ patch$1(propName, prototype);
494
+ }
495
+ }
496
+ }
497
+ /** version: 2.34.0 */
498
+
499
+ /*
500
+ * Copyright (c) 2018, salesforce.com, inc.
501
+ * All rights reserved.
502
+ * SPDX-License-Identifier: MIT
503
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
504
+ */
505
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
506
+ // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
507
+ // i.e. to the global Element.prototype
508
+ applyAriaReflection();
509
+ }
508
510
 
509
511
  /*
510
512
  * Copyright (c) 2018, salesforce.com, inc.
@@ -572,7 +574,7 @@ var LWC = (function (exports) {
572
574
  }
573
575
  var callbacks = nextTickCallbackQueue;
574
576
  nextTickCallbackQueue = []; // reset to a new queue
575
- for (var _i3 = 0, _len = callbacks.length; _i3 < _len; _i3 += 1) {
577
+ for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
576
578
  callbacks[_i3]();
577
579
  }
578
580
  }
@@ -690,7 +692,7 @@ var LWC = (function (exports) {
690
692
  if (!isUndefined$1(reactiveRecord)) {
691
693
  var reactiveObservers = reactiveRecord[key];
692
694
  if (!isUndefined$1(reactiveObservers)) {
693
- for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
695
+ for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
694
696
  var ro = reactiveObservers[_i5];
695
697
  ro.notify();
696
698
  }
@@ -849,6 +851,7 @@ var LWC = (function (exports) {
849
851
  if (!isUndefined$1(vm)) {
850
852
  msg = "".concat(msg, "\n").concat(getComponentStack(vm));
851
853
  }
854
+ // In Jest tests, reduce the warning and error verbosity by not printing the callstack
852
855
  if (process.env.NODE_ENV === 'test') {
853
856
  /* eslint-disable-next-line no-console */
854
857
  console[method](msg);
@@ -907,6 +910,9 @@ var LWC = (function (exports) {
907
910
  // Global HTML Attributes & Properties
908
911
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
909
912
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
913
+ //
914
+ // If you update this list, check for test files that recapitulate the same list. Searching the codebase
915
+ // for e.g. "dropzone" should suffice.
910
916
  var globalHTMLProperties = assign(create(null), {
911
917
  accessKey: {
912
918
  attribute: 'accesskey'
@@ -2463,6 +2469,17 @@ var LWC = (function (exports) {
2463
2469
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
2464
2470
  }
2465
2471
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
2472
+ function applyAriaReflectionToLightningElement() {
2473
+ // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
2474
+ // apply it to LightningElement.prototype.
2475
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
2476
+ applyAriaReflection(LightningElement.prototype);
2477
+ }
2478
+ // The reason for this odd if/else branching is limitations in @lwc/features:
2479
+ // https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
2480
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2481
+ applyAriaReflectionToLightningElement();
2482
+ }
2466
2483
  defineProperty(LightningElement, 'CustomElementConstructor', {
2467
2484
  get: function get() {
2468
2485
  // If required, a runtime-specific implementation must be defined.
@@ -3052,7 +3069,7 @@ var LWC = (function (exports) {
3052
3069
  };
3053
3070
  }
3054
3071
  // expose public methods as props on the new Element Bridge
3055
- for (var _i10 = 0, _len3 = methods.length; _i10 < _len3; _i10 += 1) {
3072
+ for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
3056
3073
  var methodName = methods[_i10];
3057
3074
  descriptors[methodName] = {
3058
3075
  value: createMethodCaller(methodName),
@@ -3078,6 +3095,20 @@ var LWC = (function (exports) {
3078
3095
  return HTMLBridgeElement;
3079
3096
  }
3080
3097
  var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3098
+ {
3099
+ // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
3100
+ // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
3101
+ // ARIA props outside the LightningElement
3102
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
3103
+ // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
3104
+ // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
3105
+ // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
3106
+ //
3107
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
3108
+ // accessors inside the HTMLBridgeElementFactory.
3109
+ applyAriaReflection(BaseBridgeElement.prototype);
3110
+ }
3111
+ }
3081
3112
  freeze(BaseBridgeElement);
3082
3113
  seal(BaseBridgeElement.prototype);
3083
3114
 
@@ -3539,6 +3570,7 @@ var LWC = (function (exports) {
3539
3570
  setAttribute = _vm$renderer.setAttribute;
3540
3571
  var newStylesheets = template.stylesheets,
3541
3572
  newStylesheetToken = template.stylesheetToken;
3573
+ var newVmStylesheets = vm.stylesheets;
3542
3574
  var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3543
3575
  var hasScopedStyles = context.hasScopedStyles;
3544
3576
  var newToken;
@@ -3558,7 +3590,9 @@ var LWC = (function (exports) {
3558
3590
  }
3559
3591
  // Apply the new template styling token to the host element, if the new template has any
3560
3592
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3561
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3593
+ var hasNewStylesheets = hasStyles(newStylesheets);
3594
+ var hasNewVmStylesheets = hasStyles(newVmStylesheets);
3595
+ if (hasNewStylesheets || hasNewVmStylesheets) {
3562
3596
  newToken = newStylesheetToken;
3563
3597
  }
3564
3598
  // Set the new styling token on the host element
@@ -3628,10 +3662,15 @@ var LWC = (function (exports) {
3628
3662
  function getStylesheetsContent(vm, template) {
3629
3663
  var stylesheets = template.stylesheets,
3630
3664
  stylesheetToken = template.stylesheetToken;
3665
+ var vmStylesheets = vm.stylesheets;
3631
3666
  var content = [];
3632
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3667
+ if (hasStyles(stylesheets)) {
3633
3668
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3634
3669
  }
3670
+ // VM (component) stylesheets apply after template stylesheets
3671
+ if (hasStyles(vmStylesheets)) {
3672
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
3673
+ }
3635
3674
  return content;
3636
3675
  }
3637
3676
  // It might be worth caching this to avoid doing the lookup repeatedly, but
@@ -3666,8 +3705,9 @@ var LWC = (function (exports) {
3666
3705
  function getStylesheetTokenHost(vnode) {
3667
3706
  var _getComponentInternal = getComponentInternalDef(vnode.ctor),
3668
3707
  template = _getComponentInternal.template;
3708
+ var vm = vnode.vm;
3669
3709
  var stylesheetToken = template.stylesheetToken;
3670
- return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
3710
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
3671
3711
  }
3672
3712
  function getNearestNativeShadowComponent(vm) {
3673
3713
  var owner = getNearestShadowComponent(vm);
@@ -4256,6 +4296,26 @@ var LWC = (function (exports) {
4256
4296
  // in fallback mode, the allocation will always set children to
4257
4297
  // empty and delegate the real allocation to the slot elements
4258
4298
  allocateChildren(n2, vm);
4299
+ // Solves an edge case with slotted VFragments in native shadow mode.
4300
+ //
4301
+ // During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
4302
+ // to avoid interfering with native slot behavior. When this happens, if any of the fragments
4303
+ // were not stable, the children must go through the dynamic diffing algo.
4304
+ //
4305
+ // If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
4306
+ // the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
4307
+ // nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
4308
+ // mark the new children dynamic.
4309
+ //
4310
+ // Example:
4311
+ // n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
4312
+ // n2.children: [div, null, div] => [div, null, div] // marked ???
4313
+ var shadowMode = vm.shadowMode,
4314
+ renderMode = vm.renderMode;
4315
+ if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
4316
+ // No-op if children has already been marked dynamic by 'allocateChildren()'.
4317
+ markAsDynamicChildren(n2.children);
4318
+ }
4259
4319
  }
4260
4320
  // in fallback mode, the children will be always empty, so, nothing
4261
4321
  // will happen, but in native, it does allocate the light dom
@@ -4434,7 +4494,6 @@ var LWC = (function (exports) {
4434
4494
  //
4435
4495
  // In case #2, we will always get a fresh VCustomElement.
4436
4496
  var children = vnode.aChildren || vnode.children;
4437
- vm.aChildren = children;
4438
4497
  var renderMode = vm.renderMode,
4439
4498
  shadowMode = vm.shadowMode;
4440
4499
  if (process.env.NODE_ENV !== 'production') {
@@ -4447,15 +4506,61 @@ var LWC = (function (exports) {
4447
4506
  logError("Invalid usage of 'lwc:slot-data' on ".concat(getComponentTag(vm), " tag. Scoped slot content can only be passed to a light dom child."));
4448
4507
  }
4449
4508
  }
4509
+ // If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
4510
+ // children VFragments to avoid them interfering with default slot behavior.
4511
+ var allocatedChildren = flattenFragmentsInChildren(children);
4512
+ vnode.children = allocatedChildren;
4513
+ vm.aChildren = allocatedChildren;
4450
4514
  if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4451
4515
  // slow path
4452
- allocateInSlot(vm, children, vnode.owner);
4516
+ allocateInSlot(vm, allocatedChildren, vnode.owner);
4453
4517
  // save the allocated children in case this vnode is reused.
4454
- vnode.aChildren = children;
4518
+ vnode.aChildren = allocatedChildren;
4455
4519
  // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4456
4520
  vnode.children = EmptyArray;
4457
4521
  }
4458
4522
  }
4523
+ /**
4524
+ * Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
4525
+ * marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
4526
+ * and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
4527
+ *
4528
+ * With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
4529
+ *
4530
+ * This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
4531
+ */
4532
+ function flattenFragmentsInChildren(children) {
4533
+ var flattenedChildren = [];
4534
+ // Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
4535
+ // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
4536
+ var nodeStack = [];
4537
+ var fragmentFound = false;
4538
+ for (var _i15 = children.length - 1; _i15 > -1; _i15 -= 1) {
4539
+ var child = children[_i15];
4540
+ ArrayPush$1.call(nodeStack, child);
4541
+ fragmentFound = fragmentFound || !!(child && isVFragment(child));
4542
+ }
4543
+ if (!fragmentFound) {
4544
+ return children;
4545
+ }
4546
+ var currentNode;
4547
+ while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
4548
+ if (!isNull(currentNode) && isVFragment(currentNode)) {
4549
+ var fChildren = currentNode.children;
4550
+ // Ignore the start and end text node delimiters
4551
+ for (var _i16 = fChildren.length - 2; _i16 > 0; _i16 -= 1) {
4552
+ ArrayPush$1.call(nodeStack, fChildren[_i16]);
4553
+ }
4554
+ } else {
4555
+ ArrayPush$1.call(flattenedChildren, currentNode);
4556
+ }
4557
+ }
4558
+ // We always mark the children as dynamic because nothing generates stable VFragments yet.
4559
+ // If/when stable VFragments are generated by the compiler, this code should be updated to
4560
+ // not mark dynamic if all flattened VFragments were stable.
4561
+ markAsDynamicChildren(flattenedChildren);
4562
+ return flattenedChildren;
4563
+ }
4459
4564
  function createViewModelHook(elm, vnode, renderer) {
4460
4565
  var vm = getAssociatedVMIfPresent(elm);
4461
4566
  // There is a possibility that a custom element is registered under tagName, in which case, the
@@ -4478,22 +4583,16 @@ var LWC = (function (exports) {
4478
4583
  }
4479
4584
  return vm;
4480
4585
  }
4481
- /**
4482
- * Collects all slots into a SlotSet, traversing through VFragment Nodes
4483
- */
4484
- function collectSlots(vm, children, cmpSlotsMapping) {
4586
+ function allocateInSlot(vm, children, owner) {
4485
4587
  var _a, _b;
4486
- for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
4487
- var vnode = children[_i15];
4588
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4589
+ var cmpSlotsMapping = create(null);
4590
+ // Collect all slots into cmpSlotsMapping
4591
+ for (var _i17 = 0, len = children.length; _i17 < len; _i17 += 1) {
4592
+ var vnode = children[_i17];
4488
4593
  if (isNull(vnode)) {
4489
4594
  continue;
4490
4595
  }
4491
- // Dive further iff the content is wrapped in a VFragment
4492
- if (isVFragment(vnode)) {
4493
- // Remove the text delimiter nodes to avoid overriding default slot content
4494
- collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4495
- continue;
4496
- }
4497
4596
  var slotName = '';
4498
4597
  if (isVBaseElement(vnode)) {
4499
4598
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
@@ -4503,11 +4602,6 @@ var LWC = (function (exports) {
4503
4602
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4504
4603
  ArrayPush$1.call(vnodes, vnode);
4505
4604
  }
4506
- }
4507
- function allocateInSlot(vm, children, owner) {
4508
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4509
- var cmpSlotsMapping = create(null);
4510
- collectSlots(vm, children, cmpSlotsMapping);
4511
4605
  vm.cmpSlots = {
4512
4606
  owner: owner,
4513
4607
  slotAssignments: cmpSlotsMapping
@@ -4520,16 +4614,16 @@ var LWC = (function (exports) {
4520
4614
  markComponentAsDirty(vm);
4521
4615
  return;
4522
4616
  }
4523
- for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
4524
- var key = oldKeys[_i16];
4617
+ for (var _i18 = 0, _len2 = oldKeys.length; _i18 < _len2; _i18 += 1) {
4618
+ var key = oldKeys[_i18];
4525
4619
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4526
4620
  markComponentAsDirty(vm);
4527
4621
  return;
4528
4622
  }
4529
4623
  var oldVNodes = oldSlotsMapping[key];
4530
- var vnodes = cmpSlotsMapping[key];
4624
+ var _vnodes = cmpSlotsMapping[key];
4531
4625
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4532
- if (oldVNodes[j] !== vnodes[j]) {
4626
+ if (oldVNodes[j] !== _vnodes[j]) {
4533
4627
  markComponentAsDirty(vm);
4534
4628
  return;
4535
4629
  }
@@ -4538,14 +4632,14 @@ var LWC = (function (exports) {
4538
4632
  }
4539
4633
  }
4540
4634
  // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4541
- var FromIteration = new WeakMap();
4542
- // dynamic children means it was generated by an iteration
4543
- // in a template, and will require a more complex diffing algo.
4635
+ var DynamicChildren = new WeakMap();
4636
+ // dynamic children means it was either generated by an iteration in a template
4637
+ // or part of an unstable fragment, and will require a more complex diffing algo.
4544
4638
  function markAsDynamicChildren(children) {
4545
- FromIteration.set(children, 1);
4639
+ DynamicChildren.set(children, 1);
4546
4640
  }
4547
4641
  function hasDynamicChildren(children) {
4548
- return FromIteration.has(children);
4642
+ return DynamicChildren.has(children);
4549
4643
  }
4550
4644
  function createKeyToOldIdx(children, beginIdx, endIdx) {
4551
4645
  var map = {};
@@ -4644,11 +4738,11 @@ var LWC = (function (exports) {
4644
4738
  if (oldStartIdx > oldEndIdx) {
4645
4739
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4646
4740
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4647
- var _i17 = newEndIdx;
4741
+ var _i19 = newEndIdx;
4648
4742
  var n;
4649
4743
  do {
4650
- n = newCh[++_i17];
4651
- } while (!isVNode(n) && _i17 < newChEnd);
4744
+ n = newCh[++_i19];
4745
+ } while (!isVNode(n) && _i19 < newChEnd);
4652
4746
  before = isVNode(n) ? n.elm : null;
4653
4747
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4654
4748
  } else {
@@ -4673,9 +4767,9 @@ var LWC = (function (exports) {
4673
4767
  // if the old list is not empty, the new list MUST have the same
4674
4768
  // amount of nodes, that's why we call this static children
4675
4769
  var anchor = null;
4676
- for (var _i18 = c2Length - 1; _i18 >= 0; _i18 -= 1) {
4677
- var n1 = c1[_i18];
4678
- var n2 = c2[_i18];
4770
+ for (var _i20 = c2Length - 1; _i20 >= 0; _i20 -= 1) {
4771
+ var n1 = c1[_i20];
4772
+ var n2 = c2[_i20];
4679
4773
  if (n2 !== n1) {
4680
4774
  if (isVNode(n1)) {
4681
4775
  if (isVNode(n2)) {
@@ -4800,8 +4894,8 @@ var LWC = (function (exports) {
4800
4894
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
4801
4895
  var newChildren = [];
4802
4896
  var slotAssignments = slotset.slotAssignments[slotName];
4803
- for (var _i19 = 0; _i19 < slotAssignments.length; _i19++) {
4804
- var vnode = slotAssignments[_i19];
4897
+ for (var _i21 = 0; _i21 < slotAssignments.length; _i21++) {
4898
+ var vnode = slotAssignments[_i21];
4805
4899
  if (!isNull(vnode)) {
4806
4900
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4807
4901
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -5297,7 +5391,7 @@ var LWC = (function (exports) {
5297
5391
  }
5298
5392
  function buildParseFragmentFn(createFragmentFn) {
5299
5393
  return function (strings) {
5300
- for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
5394
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5301
5395
  keys[_key3 - 1] = arguments[_key3];
5302
5396
  }
5303
5397
  var cache = create(null);
@@ -5326,23 +5420,23 @@ var LWC = (function (exports) {
5326
5420
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
5327
5421
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
5328
5422
  var htmlFragment = '';
5329
- for (var _i20 = 0, n = keys.length; _i20 < n; _i20++) {
5330
- switch (keys[_i20]) {
5423
+ for (var _i22 = 0, n = keys.length; _i22 < n; _i22++) {
5424
+ switch (keys[_i22]) {
5331
5425
  case 0:
5332
5426
  // styleToken in existing class attr
5333
- htmlFragment += strings[_i20] + classToken;
5427
+ htmlFragment += strings[_i22] + classToken;
5334
5428
  break;
5335
5429
  case 1:
5336
5430
  // styleToken for added class attr
5337
- htmlFragment += strings[_i20] + classAttrToken;
5431
+ htmlFragment += strings[_i22] + classAttrToken;
5338
5432
  break;
5339
5433
  case 2:
5340
5434
  // styleToken as attr
5341
- htmlFragment += strings[_i20] + attrToken;
5435
+ htmlFragment += strings[_i22] + attrToken;
5342
5436
  break;
5343
5437
  case 3:
5344
5438
  // ${1}${2}
5345
- htmlFragment += strings[_i20] + classAttrToken + attrToken;
5439
+ htmlFragment += strings[_i22] + classAttrToken + attrToken;
5346
5440
  break;
5347
5441
  }
5348
5442
  }
@@ -5407,7 +5501,7 @@ var LWC = (function (exports) {
5407
5501
  // Create a brand new template cache for the swapped templated.
5408
5502
  context.tplCache = create(null);
5409
5503
  // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
5410
- context.hasScopedStyles = computeHasScopedStyles(html);
5504
+ context.hasScopedStyles = computeHasScopedStyles(html, vm);
5411
5505
  // Update the scoping token on the host element.
5412
5506
  updateStylesheetToken(vm, html);
5413
5507
  // Evaluate, create stylesheet and cache the produced VNode for future
@@ -5447,17 +5541,24 @@ var LWC = (function (exports) {
5447
5541
  }
5448
5542
  return vnodes;
5449
5543
  }
5450
- function computeHasScopedStyles(template) {
5451
- var stylesheets = template.stylesheets;
5452
- if (!isUndefined$1(stylesheets)) {
5453
- for (var _i21 = 0; _i21 < stylesheets.length; _i21++) {
5454
- if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
5544
+ function computeHasScopedStylesInStylesheets(stylesheets) {
5545
+ if (hasStyles(stylesheets)) {
5546
+ for (var _i23 = 0; _i23 < stylesheets.length; _i23++) {
5547
+ if (isTrue(stylesheets[_i23][KEY__SCOPED_CSS])) {
5455
5548
  return true;
5456
5549
  }
5457
5550
  }
5458
5551
  }
5459
5552
  return false;
5460
5553
  }
5554
+ function computeHasScopedStyles(template, vm) {
5555
+ var stylesheets = template.stylesheets;
5556
+ var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
5557
+ return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
5558
+ }
5559
+ function hasStyles(stylesheets) {
5560
+ return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
5561
+ }
5461
5562
 
5462
5563
  /*
5463
5564
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5639,8 +5740,8 @@ var LWC = (function (exports) {
5639
5740
  if (process.env.NODE_ENV !== 'production') {
5640
5741
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
5641
5742
  }
5642
- for (var _i22 = 0; _i22 < hooks.length; ++_i22) {
5643
- var hookName = hooks[_i22];
5743
+ for (var _i24 = 0; _i24 < hooks.length; ++_i24) {
5744
+ var hookName = hooks[_i24];
5644
5745
  if (hookName in service) {
5645
5746
  var l = Services[hookName];
5646
5747
  if (isUndefined$1(l)) {
@@ -5657,8 +5758,8 @@ var LWC = (function (exports) {
5657
5758
  var component = vm.component,
5658
5759
  def = vm.def,
5659
5760
  context = vm.context;
5660
- for (var _i23 = 0, len = cbs.length; _i23 < len; ++_i23) {
5661
- cbs[_i23].call(undefined, component, {}, def, context);
5761
+ for (var _i25 = 0, len = cbs.length; _i25 < len; ++_i25) {
5762
+ cbs[_i25].call(undefined, component, {}, def, context);
5662
5763
  }
5663
5764
  }
5664
5765
 
@@ -5777,6 +5878,7 @@ var LWC = (function (exports) {
5777
5878
  // Properties set right after VM creation.
5778
5879
  tro: null,
5779
5880
  shadowMode: null,
5881
+ stylesheets: null,
5780
5882
  // Properties set by the LightningElement constructor.
5781
5883
  component: null,
5782
5884
  shadowRoot: null,
@@ -5789,6 +5891,7 @@ var LWC = (function (exports) {
5789
5891
  if (process.env.NODE_ENV !== 'production') {
5790
5892
  vm.debugInfo = create(null);
5791
5893
  }
5894
+ vm.stylesheets = computeStylesheets(vm, def.ctor);
5792
5895
  vm.shadowMode = computeShadowMode(vm, renderer);
5793
5896
  vm.tro = getTemplateReactiveObserver(vm);
5794
5897
  if (process.env.NODE_ENV !== 'production') {
@@ -5807,6 +5910,40 @@ var LWC = (function (exports) {
5807
5910
  }
5808
5911
  return vm;
5809
5912
  }
5913
+ function validateComponentStylesheets(vm, stylesheets) {
5914
+ var valid = true;
5915
+ var validate = function validate(arrayOrStylesheet) {
5916
+ if (isArray$1(arrayOrStylesheet)) {
5917
+ for (var _i26 = 0; _i26 < arrayOrStylesheet.length; _i26++) {
5918
+ validate(arrayOrStylesheet[_i26]);
5919
+ }
5920
+ } else if (!isFunction$1(arrayOrStylesheet)) {
5921
+ // function assumed to be a stylesheet factory
5922
+ valid = false;
5923
+ }
5924
+ };
5925
+ if (!isArray$1(stylesheets)) {
5926
+ valid = false;
5927
+ } else {
5928
+ validate(stylesheets);
5929
+ }
5930
+ return valid;
5931
+ }
5932
+ // Validate and flatten any stylesheets defined as `static stylesheets`
5933
+ function computeStylesheets(vm, ctor) {
5934
+ if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
5935
+ var stylesheets = ctor.stylesheets;
5936
+ if (!isUndefined$1(stylesheets)) {
5937
+ var valid = validateComponentStylesheets(vm, stylesheets);
5938
+ if (valid) {
5939
+ return flattenStylesheets(stylesheets);
5940
+ } else if (process.env.NODE_ENV !== 'production') {
5941
+ logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
5942
+ }
5943
+ }
5944
+ }
5945
+ return null;
5946
+ }
5810
5947
  function computeShadowMode(vm, renderer) {
5811
5948
  var def = vm.def;
5812
5949
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -5931,17 +6068,17 @@ var LWC = (function (exports) {
5931
6068
  return a.idx - b.idx;
5932
6069
  });
5933
6070
  rehydrateQueue = []; // reset to a new queue
5934
- for (var _i24 = 0, len = vms.length; _i24 < len; _i24 += 1) {
5935
- var vm = vms[_i24];
6071
+ for (var _i27 = 0, len = vms.length; _i27 < len; _i27 += 1) {
6072
+ var vm = vms[_i27];
5936
6073
  try {
5937
6074
  rehydrate(vm);
5938
6075
  } catch (error) {
5939
- if (_i24 + 1 < len) {
6076
+ if (_i27 + 1 < len) {
5940
6077
  // pieces of the queue are still pending to be rehydrated, those should have priority
5941
6078
  if (rehydrateQueue.length === 0) {
5942
6079
  addCallbackToNextTick(flushRehydrationQueue);
5943
6080
  }
5944
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i24 + 1));
6081
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i27 + 1));
5945
6082
  }
5946
6083
  // we need to end the measure before throwing.
5947
6084
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -6010,8 +6147,8 @@ var LWC = (function (exports) {
6010
6147
  var vCustomElementCollection = vm.velements;
6011
6148
  // Reporting disconnection for every child in inverse order since they are
6012
6149
  // inserted in reserved order.
6013
- for (var _i25 = vCustomElementCollection.length - 1; _i25 >= 0; _i25 -= 1) {
6014
- var elm = vCustomElementCollection[_i25].elm;
6150
+ for (var _i28 = vCustomElementCollection.length - 1; _i28 >= 0; _i28 -= 1) {
6151
+ var elm = vCustomElementCollection[_i28].elm;
6015
6152
  // There are two cases where the element could be undefined:
6016
6153
  // * when there is an error during the construction phase, and an error
6017
6154
  // boundary picks it, there is a possibility that the VCustomElement
@@ -6042,8 +6179,8 @@ var LWC = (function (exports) {
6042
6179
  * defined on its shadow.
6043
6180
  */
6044
6181
  function recursivelyDisconnectChildren(vnodes) {
6045
- for (var _i26 = 0, len = vnodes.length; _i26 < len; _i26 += 1) {
6046
- var vnode = vnodes[_i26];
6182
+ for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
6183
+ var vnode = vnodes[_i29];
6047
6184
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6048
6185
  switch (vnode.type) {
6049
6186
  case 2 /* VNodeType.Element */:
@@ -6067,8 +6204,8 @@ var LWC = (function (exports) {
6067
6204
  var children = vm.children,
6068
6205
  renderRoot = vm.renderRoot,
6069
6206
  remove = vm.renderer.remove;
6070
- for (var _i27 = 0, len = children.length; _i27 < len; _i27++) {
6071
- var child = children[_i27];
6207
+ for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
6208
+ var child = children[_i30];
6072
6209
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6073
6210
  remove(child.elm, renderRoot);
6074
6211
  }
@@ -6406,16 +6543,16 @@ var LWC = (function (exports) {
6406
6543
  }
6407
6544
  function connectWireAdapters(vm) {
6408
6545
  var wiredConnecting = vm.context.wiredConnecting;
6409
- for (var _i28 = 0, len = wiredConnecting.length; _i28 < len; _i28 += 1) {
6410
- wiredConnecting[_i28]();
6546
+ for (var _i31 = 0, len = wiredConnecting.length; _i31 < len; _i31 += 1) {
6547
+ wiredConnecting[_i31]();
6411
6548
  }
6412
6549
  }
6413
6550
  function disconnectWireAdapters(vm) {
6414
6551
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6415
6552
  runWithBoundaryProtection(vm, vm, noop, function () {
6416
6553
  // job
6417
- for (var _i29 = 0, len = wiredDisconnecting.length; _i29 < len; _i29 += 1) {
6418
- wiredDisconnecting[_i29]();
6554
+ for (var _i32 = 0, len = wiredDisconnecting.length; _i32 < len; _i32 += 1) {
6555
+ wiredDisconnecting[_i32]();
6419
6556
  }
6420
6557
  }, noop);
6421
6558
  }
@@ -6654,8 +6791,8 @@ var LWC = (function (exports) {
6654
6791
  var nextNode = node;
6655
6792
  var anchor = null;
6656
6793
  var renderer = owner.renderer;
6657
- for (var _i30 = 0; _i30 < children.length; _i30++) {
6658
- var childVnode = children[_i30];
6794
+ for (var _i33 = 0; _i33 < children.length; _i33++) {
6795
+ var childVnode = children[_i33];
6659
6796
  if (!isNull(childVnode)) {
6660
6797
  if (nextNode) {
6661
6798
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -6733,8 +6870,8 @@ var LWC = (function (exports) {
6733
6870
  var nodesAreCompatible = true;
6734
6871
  // Validate attributes, though we could always recovery from those by running the update mods.
6735
6872
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6736
- for (var _i31 = 0, _Object$entries = Object.entries(attrs); _i31 < _Object$entries.length; _i31++) {
6737
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i31], 2),
6873
+ for (var _i34 = 0, _Object$entries = Object.entries(attrs); _i34 < _Object$entries.length; _i34++) {
6874
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i34], 2),
6738
6875
  attrName = _Object$entries$_i[0],
6739
6876
  attrValue = _Object$entries$_i[1];
6740
6877
  var owner = vnode.owner;
@@ -6835,8 +6972,8 @@ var LWC = (function (exports) {
6835
6972
  var parsedVnodeStyle = parseStyleText(elmStyle);
6836
6973
  var expectedStyle = [];
6837
6974
  // styleMap is used when style is set to static value.
6838
- for (var _i32 = 0, n = styleDecls.length; _i32 < n; _i32++) {
6839
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i32], 3),
6975
+ for (var _i35 = 0, n = styleDecls.length; _i35 < n; _i35++) {
6976
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i35], 3),
6840
6977
  prop = _styleDecls$_i2[0],
6841
6978
  value = _styleDecls$_i2[1],
6842
6979
  important = _styleDecls$_i2[2];
@@ -7024,8 +7161,8 @@ var LWC = (function (exports) {
7024
7161
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7025
7162
  function traverseStylesheets(stylesheets, callback) {
7026
7163
  callback(stylesheets);
7027
- for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
7028
- var stylesheet = stylesheets[_i33];
7164
+ for (var _i36 = 0; _i36 < stylesheets.length; _i36++) {
7165
+ var stylesheet = stylesheets[_i36];
7029
7166
  if (isArray$1(stylesheet)) {
7030
7167
  traverseStylesheets(stylesheet, callback);
7031
7168
  } else {
@@ -7138,7 +7275,7 @@ var LWC = (function (exports) {
7138
7275
  }
7139
7276
  return ctor;
7140
7277
  }
7141
- /* version: 2.32.1 */
7278
+ /* version: 2.34.0 */
7142
7279
 
7143
7280
  /*
7144
7281
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7241,7 +7378,9 @@ var LWC = (function (exports) {
7241
7378
  //
7242
7379
  // Test utilities
7243
7380
  //
7244
- if (process.env.NODE_ENV === 'development') {
7381
+ // Only used in LWC's Karma tests
7382
+ // @ts-ignore
7383
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7245
7384
  // @ts-ignore
7246
7385
  window.__lwcResetGlobalStylesheets = function () {
7247
7386
  stylesheetCache.clear();
@@ -8175,7 +8314,7 @@ var LWC = (function (exports) {
8175
8314
  function isNull(obj) {
8176
8315
  return obj === null;
8177
8316
  }
8178
- /** version: 2.32.1 */
8317
+ /** version: 2.34.0 */
8179
8318
 
8180
8319
  /*
8181
8320
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8253,7 +8392,7 @@ var LWC = (function (exports) {
8253
8392
  doc.body.innerHTML = html;
8254
8393
  var content = doc.body;
8255
8394
  if (!isUndefined(wrapperTags)) {
8256
- for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
8395
+ for (var _i37 = 0; _i37 < wrapperTags.length; _i37++) {
8257
8396
  content = content.firstChild;
8258
8397
  }
8259
8398
  }
@@ -8446,8 +8585,8 @@ var LWC = (function (exports) {
8446
8585
  tagName: element.tagName.toLowerCase(),
8447
8586
  hydrated: true
8448
8587
  });
8449
- for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
8450
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
8588
+ for (var _i38 = 0, _Object$entries2 = Object.entries(props); _i38 < _Object$entries2.length; _i38++) {
8589
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i38], 2),
8451
8590
  key = _Object$entries2$_i[0],
8452
8591
  value = _Object$entries2$_i[1];
8453
8592
  element[key] = value;
@@ -8741,7 +8880,7 @@ var LWC = (function (exports) {
8741
8880
  });
8742
8881
  freeze(LightningElement);
8743
8882
  seal(LightningElement.prototype);
8744
- /* version: 2.32.1 */
8883
+ /* version: 2.34.0 */
8745
8884
 
8746
8885
  exports.LightningElement = LightningElement;
8747
8886
  exports.__unstable__ProfilerControl = profilerControl;