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); }
@@ -88,6 +90,7 @@ var LWC = (function (exports) {
88
90
  ArrayIndexOf = _Array$prototype.indexOf,
89
91
  ArrayJoin = _Array$prototype.join,
90
92
  ArrayMap = _Array$prototype.map,
93
+ ArrayPop = _Array$prototype.pop,
91
94
  ArrayPush$1 = _Array$prototype.push,
92
95
  ArraySlice = _Array$prototype.slice,
93
96
  ArraySplice = _Array$prototype.splice,
@@ -166,6 +169,9 @@ var LWC = (function (exports) {
166
169
  * The above list of 46 aria attributes is consistent with the following resources:
167
170
  * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
168
171
  * https://wicg.github.io/aom/spec/aria-reflection.html
172
+ *
173
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
174
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
169
175
  */
170
176
  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'];
171
177
  var _ref = /*@__PURE__*/function () {
@@ -326,88 +332,7 @@ var LWC = (function (exports) {
326
332
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
327
333
  return propertyName;
328
334
  }
329
- /** version: 2.32.1 */
330
-
331
- /**
332
- * Copyright (C) 2018 salesforce.com, inc.
333
- */
334
-
335
- /*
336
- * Copyright (c) 2018, salesforce.com, inc.
337
- * All rights reserved.
338
- * SPDX-License-Identifier: MIT
339
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
340
- */
341
- function detect(propName) {
342
- return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
343
- }
344
-
345
- /*
346
- * Copyright (c) 2018, salesforce.com, inc.
347
- * All rights reserved.
348
- * SPDX-License-Identifier: MIT
349
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
350
- */
351
- var nodeToAriaPropertyValuesMap = new WeakMap();
352
- function getAriaPropertyMap(elm) {
353
- var map = nodeToAriaPropertyValuesMap.get(elm);
354
- if (map === undefined) {
355
- map = {};
356
- nodeToAriaPropertyValuesMap.set(elm, map);
357
- }
358
- return map;
359
- }
360
- function getNormalizedAriaPropertyValue(value) {
361
- return value == null ? null : String(value);
362
- }
363
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
364
- return {
365
- get: function get() {
366
- var map = getAriaPropertyMap(this);
367
- if (hasOwnProperty$1.call(map, propName)) {
368
- return map[propName];
369
- }
370
- // otherwise just reflect what's in the attribute
371
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
372
- },
373
- set: function set(newValue) {
374
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
375
- var map = getAriaPropertyMap(this);
376
- map[propName] = normalizedValue;
377
- // reflect into the corresponding attribute
378
- if (newValue === null) {
379
- this.removeAttribute(attrName);
380
- } else {
381
- this.setAttribute(attrName, newValue);
382
- }
383
- },
384
- configurable: true,
385
- enumerable: true
386
- };
387
- }
388
- function patch$1(propName) {
389
- // Typescript is inferring the wrong function type for this particular
390
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
391
- // @ts-ignore type-mismatch
392
- var attrName = AriaPropNameToAttrNameMap[propName];
393
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
394
- Object.defineProperty(Element.prototype, propName, descriptor);
395
- }
396
-
397
- /*
398
- * Copyright (c) 2018, salesforce.com, inc.
399
- * All rights reserved.
400
- * SPDX-License-Identifier: MIT
401
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
402
- */
403
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
404
- for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
405
- var propName = ElementPrototypeAriaPropertyNames[_i2];
406
- if (detect(propName)) {
407
- patch$1(propName);
408
- }
409
- }
410
- /** version: 2.32.1 */
335
+ /** version: 2.34.0 */
411
336
 
412
337
  /**
413
338
  * Copyright (C) 2018 salesforce.com, inc.
@@ -428,7 +353,9 @@ var LWC = (function (exports) {
428
353
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
429
354
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
430
355
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
431
- ENABLE_FROZEN_TEMPLATE: null
356
+ ENABLE_FROZEN_TEMPLATE: null,
357
+ DISABLE_ARIA_REFLECTION_POLYFILL: null,
358
+ ENABLE_PROGRAMMATIC_STYLESHEETS: null
432
359
  };
433
360
  if (!_globalThis.lwcRuntimeFlags) {
434
361
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -476,6 +403,83 @@ var LWC = (function (exports) {
476
403
  */
477
404
  function setFeatureFlagForTest(name, value) {
478
405
  }
406
+ /** version: 2.34.0 */
407
+
408
+ /**
409
+ * Copyright (C) 2018 salesforce.com, inc.
410
+ */
411
+
412
+ /*
413
+ * Copyright (c) 2018, salesforce.com, inc.
414
+ * All rights reserved.
415
+ * SPDX-License-Identifier: MIT
416
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
417
+ */
418
+ function detect(propName, prototype) {
419
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
420
+ }
421
+
422
+ /*
423
+ * Copyright (c) 2018, salesforce.com, inc.
424
+ * All rights reserved.
425
+ * SPDX-License-Identifier: MIT
426
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
427
+ */
428
+ function createAriaPropertyPropertyDescriptor(attrName) {
429
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
430
+ // from Element.prototype, because these methods are overridden in LightningElement.
431
+ return {
432
+ get: function get() {
433
+ // reflect what's in the attribute
434
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
435
+ },
436
+ set: function set(newValue) {
437
+ // reflect into the corresponding attribute
438
+ if (isNull(newValue)) {
439
+ this.removeAttribute(attrName);
440
+ } else {
441
+ this.setAttribute(attrName, newValue);
442
+ }
443
+ },
444
+ configurable: true,
445
+ enumerable: true
446
+ };
447
+ }
448
+ function patch$1(propName, prototype) {
449
+ var attrName = AriaPropNameToAttrNameMap[propName];
450
+ var descriptor = createAriaPropertyPropertyDescriptor(attrName);
451
+ defineProperty(prototype, propName, descriptor);
452
+ }
453
+
454
+ /*
455
+ * Copyright (c) 2018, salesforce.com, inc.
456
+ * All rights reserved.
457
+ * SPDX-License-Identifier: MIT
458
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
459
+ */
460
+ function applyAriaReflection() {
461
+ var prototype = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Element.prototype;
462
+ var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
463
+ for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
464
+ var propName = ElementPrototypeAriaPropertyNames[_i2];
465
+ if (detect(propName, prototype)) {
466
+ patch$1(propName, prototype);
467
+ }
468
+ }
469
+ }
470
+ /** version: 2.34.0 */
471
+
472
+ /*
473
+ * Copyright (c) 2018, salesforce.com, inc.
474
+ * All rights reserved.
475
+ * SPDX-License-Identifier: MIT
476
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
477
+ */
478
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
479
+ // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
480
+ // i.e. to the global Element.prototype
481
+ applyAriaReflection();
482
+ }
479
483
 
480
484
  /*
481
485
  * Copyright (c) 2018, salesforce.com, inc.
@@ -490,7 +494,7 @@ var LWC = (function (exports) {
490
494
  function flushCallbackQueue() {
491
495
  var callbacks = nextTickCallbackQueue;
492
496
  nextTickCallbackQueue = []; // reset to a new queue
493
- for (var _i3 = 0, _len = callbacks.length; _i3 < _len; _i3 += 1) {
497
+ for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
494
498
  callbacks[_i3]();
495
499
  }
496
500
  }
@@ -546,6 +550,26 @@ var LWC = (function (exports) {
546
550
  }
547
551
  return result;
548
552
  }
553
+ function flattenStylesheets(stylesheets) {
554
+ var list = [];
555
+ var _iterator2 = _createForOfIteratorHelper(stylesheets),
556
+ _step2;
557
+ try {
558
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
559
+ var stylesheet = _step2.value;
560
+ if (!Array.isArray(stylesheet)) {
561
+ list.push(stylesheet);
562
+ } else {
563
+ list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
564
+ }
565
+ }
566
+ } catch (err) {
567
+ _iterator2.e(err);
568
+ } finally {
569
+ _iterator2.f();
570
+ }
571
+ return list;
572
+ }
549
573
  // Set a ref (lwc:ref) on a VM, from a template API
550
574
  function setRefVNode(vm, ref, vnode) {
551
575
  // If this method is called, then vm.refVNodes is set as the template has refs.
@@ -580,7 +604,7 @@ var LWC = (function (exports) {
580
604
  if (!isUndefined$1(reactiveRecord)) {
581
605
  var reactiveObservers = reactiveRecord[key];
582
606
  if (!isUndefined$1(reactiveObservers)) {
583
- for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
607
+ for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
584
608
  var ro = reactiveObservers[_i5];
585
609
  ro.notify();
586
610
  }
@@ -789,6 +813,9 @@ var LWC = (function (exports) {
789
813
  // Global HTML Attributes & Properties
790
814
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
791
815
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
816
+ //
817
+ // If you update this list, check for test files that recapitulate the same list. Searching the codebase
818
+ // for e.g. "dropzone" should suffice.
792
819
  assign(create(null), {
793
820
  accessKey: {
794
821
  attribute: 'accesskey'
@@ -1824,6 +1851,17 @@ var LWC = (function (exports) {
1824
1851
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
1825
1852
  }
1826
1853
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
1854
+ function applyAriaReflectionToLightningElement() {
1855
+ // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
1856
+ // apply it to LightningElement.prototype.
1857
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
1858
+ applyAriaReflection(LightningElement.prototype);
1859
+ }
1860
+ // The reason for this odd if/else branching is limitations in @lwc/features:
1861
+ // https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
1862
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
1863
+ applyAriaReflectionToLightningElement();
1864
+ }
1827
1865
  defineProperty(LightningElement, 'CustomElementConstructor', {
1828
1866
  get: function get() {
1829
1867
  // If required, a runtime-specific implementation must be defined.
@@ -2237,7 +2275,7 @@ var LWC = (function (exports) {
2237
2275
  };
2238
2276
  }
2239
2277
  // expose public methods as props on the new Element Bridge
2240
- for (var _i10 = 0, _len3 = methods.length; _i10 < _len3; _i10 += 1) {
2278
+ for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
2241
2279
  var methodName = methods[_i10];
2242
2280
  descriptors[methodName] = {
2243
2281
  value: createMethodCaller(methodName),
@@ -2263,6 +2301,20 @@ var LWC = (function (exports) {
2263
2301
  return HTMLBridgeElement;
2264
2302
  }
2265
2303
  var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2304
+ {
2305
+ // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
2306
+ // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
2307
+ // ARIA props outside the LightningElement
2308
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2309
+ // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
2310
+ // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
2311
+ // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
2312
+ //
2313
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
2314
+ // accessors inside the HTMLBridgeElementFactory.
2315
+ applyAriaReflection(BaseBridgeElement.prototype);
2316
+ }
2317
+ }
2266
2318
  freeze(BaseBridgeElement);
2267
2319
  seal(BaseBridgeElement.prototype);
2268
2320
  function setActiveVM(vm) {
@@ -2498,6 +2550,7 @@ var LWC = (function (exports) {
2498
2550
  setAttribute = _vm$renderer.setAttribute;
2499
2551
  var newStylesheets = template.stylesheets,
2500
2552
  newStylesheetToken = template.stylesheetToken;
2553
+ var newVmStylesheets = vm.stylesheets;
2501
2554
  var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
2502
2555
  var hasScopedStyles = context.hasScopedStyles;
2503
2556
  var newToken;
@@ -2517,7 +2570,9 @@ var LWC = (function (exports) {
2517
2570
  }
2518
2571
  // Apply the new template styling token to the host element, if the new template has any
2519
2572
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
2520
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
2573
+ var hasNewStylesheets = hasStyles(newStylesheets);
2574
+ var hasNewVmStylesheets = hasStyles(newVmStylesheets);
2575
+ if (hasNewStylesheets || hasNewVmStylesheets) {
2521
2576
  newToken = newStylesheetToken;
2522
2577
  }
2523
2578
  // Set the new styling token on the host element
@@ -2579,10 +2634,15 @@ var LWC = (function (exports) {
2579
2634
  function getStylesheetsContent(vm, template) {
2580
2635
  var stylesheets = template.stylesheets,
2581
2636
  stylesheetToken = template.stylesheetToken;
2637
+ var vmStylesheets = vm.stylesheets;
2582
2638
  var content = [];
2583
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
2639
+ if (hasStyles(stylesheets)) {
2584
2640
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
2585
2641
  }
2642
+ // VM (component) stylesheets apply after template stylesheets
2643
+ if (hasStyles(vmStylesheets)) {
2644
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
2645
+ }
2586
2646
  return content;
2587
2647
  }
2588
2648
  // It might be worth caching this to avoid doing the lookup repeatedly, but
@@ -2617,8 +2677,9 @@ var LWC = (function (exports) {
2617
2677
  function getStylesheetTokenHost(vnode) {
2618
2678
  var _getComponentInternal = getComponentInternalDef(vnode.ctor),
2619
2679
  template = _getComponentInternal.template;
2680
+ var vm = vnode.vm;
2620
2681
  var stylesheetToken = template.stylesheetToken;
2621
- return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
2682
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
2622
2683
  }
2623
2684
  function getNearestNativeShadowComponent(vm) {
2624
2685
  var owner = getNearestShadowComponent(vm);
@@ -3177,6 +3238,26 @@ var LWC = (function (exports) {
3177
3238
  // in fallback mode, the allocation will always set children to
3178
3239
  // empty and delegate the real allocation to the slot elements
3179
3240
  allocateChildren(n2, vm);
3241
+ // Solves an edge case with slotted VFragments in native shadow mode.
3242
+ //
3243
+ // During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
3244
+ // to avoid interfering with native slot behavior. When this happens, if any of the fragments
3245
+ // were not stable, the children must go through the dynamic diffing algo.
3246
+ //
3247
+ // If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
3248
+ // the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
3249
+ // nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
3250
+ // mark the new children dynamic.
3251
+ //
3252
+ // Example:
3253
+ // n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
3254
+ // n2.children: [div, null, div] => [div, null, div] // marked ???
3255
+ var shadowMode = vm.shadowMode,
3256
+ renderMode = vm.renderMode;
3257
+ if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
3258
+ // No-op if children has already been marked dynamic by 'allocateChildren()'.
3259
+ markAsDynamicChildren(n2.children);
3260
+ }
3180
3261
  }
3181
3262
  // in fallback mode, the children will be always empty, so, nothing
3182
3263
  // will happen, but in native, it does allocate the light dom
@@ -3324,18 +3405,63 @@ var LWC = (function (exports) {
3324
3405
  //
3325
3406
  // In case #2, we will always get a fresh VCustomElement.
3326
3407
  var children = vnode.aChildren || vnode.children;
3327
- vm.aChildren = children;
3328
3408
  var renderMode = vm.renderMode,
3329
3409
  shadowMode = vm.shadowMode;
3410
+ // If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
3411
+ // children VFragments to avoid them interfering with default slot behavior.
3412
+ var allocatedChildren = flattenFragmentsInChildren(children);
3413
+ vnode.children = allocatedChildren;
3414
+ vm.aChildren = allocatedChildren;
3330
3415
  if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3331
3416
  // slow path
3332
- allocateInSlot(vm, children, vnode.owner);
3417
+ allocateInSlot(vm, allocatedChildren, vnode.owner);
3333
3418
  // save the allocated children in case this vnode is reused.
3334
- vnode.aChildren = children;
3419
+ vnode.aChildren = allocatedChildren;
3335
3420
  // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
3336
3421
  vnode.children = EmptyArray;
3337
3422
  }
3338
3423
  }
3424
+ /**
3425
+ * Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
3426
+ * marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
3427
+ * and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
3428
+ *
3429
+ * With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
3430
+ *
3431
+ * This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
3432
+ */
3433
+ function flattenFragmentsInChildren(children) {
3434
+ var flattenedChildren = [];
3435
+ // Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
3436
+ // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
3437
+ var nodeStack = [];
3438
+ var fragmentFound = false;
3439
+ for (var _i15 = children.length - 1; _i15 > -1; _i15 -= 1) {
3440
+ var child = children[_i15];
3441
+ ArrayPush$1.call(nodeStack, child);
3442
+ fragmentFound = fragmentFound || !!(child && isVFragment(child));
3443
+ }
3444
+ if (!fragmentFound) {
3445
+ return children;
3446
+ }
3447
+ var currentNode;
3448
+ while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
3449
+ if (!isNull(currentNode) && isVFragment(currentNode)) {
3450
+ var fChildren = currentNode.children;
3451
+ // Ignore the start and end text node delimiters
3452
+ for (var _i16 = fChildren.length - 2; _i16 > 0; _i16 -= 1) {
3453
+ ArrayPush$1.call(nodeStack, fChildren[_i16]);
3454
+ }
3455
+ } else {
3456
+ ArrayPush$1.call(flattenedChildren, currentNode);
3457
+ }
3458
+ }
3459
+ // We always mark the children as dynamic because nothing generates stable VFragments yet.
3460
+ // If/when stable VFragments are generated by the compiler, this code should be updated to
3461
+ // not mark dynamic if all flattened VFragments were stable.
3462
+ markAsDynamicChildren(flattenedChildren);
3463
+ return flattenedChildren;
3464
+ }
3339
3465
  function createViewModelHook(elm, vnode, renderer) {
3340
3466
  var vm = getAssociatedVMIfPresent(elm);
3341
3467
  // There is a possibility that a custom element is registered under tagName, in which case, the
@@ -3355,22 +3481,16 @@ var LWC = (function (exports) {
3355
3481
  });
3356
3482
  return vm;
3357
3483
  }
3358
- /**
3359
- * Collects all slots into a SlotSet, traversing through VFragment Nodes
3360
- */
3361
- function collectSlots(vm, children, cmpSlotsMapping) {
3484
+ function allocateInSlot(vm, children, owner) {
3362
3485
  var _a, _b;
3363
- for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
3364
- var vnode = children[_i15];
3486
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
3487
+ var cmpSlotsMapping = create(null);
3488
+ // Collect all slots into cmpSlotsMapping
3489
+ for (var _i17 = 0, len = children.length; _i17 < len; _i17 += 1) {
3490
+ var vnode = children[_i17];
3365
3491
  if (isNull(vnode)) {
3366
3492
  continue;
3367
3493
  }
3368
- // Dive further iff the content is wrapped in a VFragment
3369
- if (isVFragment(vnode)) {
3370
- // Remove the text delimiter nodes to avoid overriding default slot content
3371
- collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
3372
- continue;
3373
- }
3374
3494
  var slotName = '';
3375
3495
  if (isVBaseElement(vnode)) {
3376
3496
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
@@ -3380,11 +3500,6 @@ var LWC = (function (exports) {
3380
3500
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
3381
3501
  ArrayPush$1.call(vnodes, vnode);
3382
3502
  }
3383
- }
3384
- function allocateInSlot(vm, children, owner) {
3385
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
3386
- var cmpSlotsMapping = create(null);
3387
- collectSlots(vm, children, cmpSlotsMapping);
3388
3503
  vm.cmpSlots = {
3389
3504
  owner: owner,
3390
3505
  slotAssignments: cmpSlotsMapping
@@ -3397,16 +3512,16 @@ var LWC = (function (exports) {
3397
3512
  markComponentAsDirty(vm);
3398
3513
  return;
3399
3514
  }
3400
- for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
3401
- var key = oldKeys[_i16];
3515
+ for (var _i18 = 0, _len2 = oldKeys.length; _i18 < _len2; _i18 += 1) {
3516
+ var key = oldKeys[_i18];
3402
3517
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
3403
3518
  markComponentAsDirty(vm);
3404
3519
  return;
3405
3520
  }
3406
3521
  var oldVNodes = oldSlotsMapping[key];
3407
- var vnodes = cmpSlotsMapping[key];
3522
+ var _vnodes = cmpSlotsMapping[key];
3408
3523
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
3409
- if (oldVNodes[j] !== vnodes[j]) {
3524
+ if (oldVNodes[j] !== _vnodes[j]) {
3410
3525
  markComponentAsDirty(vm);
3411
3526
  return;
3412
3527
  }
@@ -3415,14 +3530,14 @@ var LWC = (function (exports) {
3415
3530
  }
3416
3531
  }
3417
3532
  // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
3418
- var FromIteration = new WeakMap();
3419
- // dynamic children means it was generated by an iteration
3420
- // in a template, and will require a more complex diffing algo.
3533
+ var DynamicChildren = new WeakMap();
3534
+ // dynamic children means it was either generated by an iteration in a template
3535
+ // or part of an unstable fragment, and will require a more complex diffing algo.
3421
3536
  function markAsDynamicChildren(children) {
3422
- FromIteration.set(children, 1);
3537
+ DynamicChildren.set(children, 1);
3423
3538
  }
3424
3539
  function hasDynamicChildren(children) {
3425
- return FromIteration.has(children);
3540
+ return DynamicChildren.has(children);
3426
3541
  }
3427
3542
  function createKeyToOldIdx(children, beginIdx, endIdx) {
3428
3543
  var map = {};
@@ -3521,11 +3636,11 @@ var LWC = (function (exports) {
3521
3636
  if (oldStartIdx > oldEndIdx) {
3522
3637
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
3523
3638
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
3524
- var _i17 = newEndIdx;
3639
+ var _i19 = newEndIdx;
3525
3640
  var n;
3526
3641
  do {
3527
- n = newCh[++_i17];
3528
- } while (!isVNode(n) && _i17 < newChEnd);
3642
+ n = newCh[++_i19];
3643
+ } while (!isVNode(n) && _i19 < newChEnd);
3529
3644
  before = isVNode(n) ? n.elm : null;
3530
3645
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
3531
3646
  } else {
@@ -3550,9 +3665,9 @@ var LWC = (function (exports) {
3550
3665
  // if the old list is not empty, the new list MUST have the same
3551
3666
  // amount of nodes, that's why we call this static children
3552
3667
  var anchor = null;
3553
- for (var _i18 = c2Length - 1; _i18 >= 0; _i18 -= 1) {
3554
- var n1 = c1[_i18];
3555
- var n2 = c2[_i18];
3668
+ for (var _i20 = c2Length - 1; _i20 >= 0; _i20 -= 1) {
3669
+ var n1 = c1[_i20];
3670
+ var n2 = c2[_i20];
3556
3671
  if (n2 !== n1) {
3557
3672
  if (isVNode(n1)) {
3558
3673
  if (isVNode(n2)) {
@@ -3649,8 +3764,8 @@ var LWC = (function (exports) {
3649
3764
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
3650
3765
  var newChildren = [];
3651
3766
  var slotAssignments = slotset.slotAssignments[slotName];
3652
- for (var _i19 = 0; _i19 < slotAssignments.length; _i19++) {
3653
- var vnode = slotAssignments[_i19];
3767
+ for (var _i21 = 0; _i21 < slotAssignments.length; _i21++) {
3768
+ var vnode = slotAssignments[_i21];
3654
3769
  if (!isNull(vnode)) {
3655
3770
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3656
3771
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -4000,7 +4115,7 @@ var LWC = (function (exports) {
4000
4115
  }
4001
4116
  function buildParseFragmentFn(createFragmentFn) {
4002
4117
  return function (strings) {
4003
- for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
4118
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4004
4119
  keys[_key3 - 1] = arguments[_key3];
4005
4120
  }
4006
4121
  var cache = create(null);
@@ -4029,23 +4144,23 @@ var LWC = (function (exports) {
4029
4144
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
4030
4145
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
4031
4146
  var htmlFragment = '';
4032
- for (var _i20 = 0, n = keys.length; _i20 < n; _i20++) {
4033
- switch (keys[_i20]) {
4147
+ for (var _i22 = 0, n = keys.length; _i22 < n; _i22++) {
4148
+ switch (keys[_i22]) {
4034
4149
  case 0:
4035
4150
  // styleToken in existing class attr
4036
- htmlFragment += strings[_i20] + classToken;
4151
+ htmlFragment += strings[_i22] + classToken;
4037
4152
  break;
4038
4153
  case 1:
4039
4154
  // styleToken for added class attr
4040
- htmlFragment += strings[_i20] + classAttrToken;
4155
+ htmlFragment += strings[_i22] + classAttrToken;
4041
4156
  break;
4042
4157
  case 2:
4043
4158
  // styleToken as attr
4044
- htmlFragment += strings[_i20] + attrToken;
4159
+ htmlFragment += strings[_i22] + attrToken;
4045
4160
  break;
4046
4161
  case 3:
4047
4162
  // ${1}${2}
4048
- htmlFragment += strings[_i20] + classAttrToken + attrToken;
4163
+ htmlFragment += strings[_i22] + classAttrToken + attrToken;
4049
4164
  break;
4050
4165
  }
4051
4166
  }
@@ -4101,7 +4216,7 @@ var LWC = (function (exports) {
4101
4216
  // Create a brand new template cache for the swapped templated.
4102
4217
  context.tplCache = create(null);
4103
4218
  // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
4104
- context.hasScopedStyles = computeHasScopedStyles(html);
4219
+ context.hasScopedStyles = computeHasScopedStyles(html, vm);
4105
4220
  // Update the scoping token on the host element.
4106
4221
  updateStylesheetToken(vm, html);
4107
4222
  // Evaluate, create stylesheet and cache the produced VNode for future
@@ -4133,17 +4248,24 @@ var LWC = (function (exports) {
4133
4248
  });
4134
4249
  return vnodes;
4135
4250
  }
4136
- function computeHasScopedStyles(template) {
4137
- var stylesheets = template.stylesheets;
4138
- if (!isUndefined$1(stylesheets)) {
4139
- for (var _i21 = 0; _i21 < stylesheets.length; _i21++) {
4140
- if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
4251
+ function computeHasScopedStylesInStylesheets(stylesheets) {
4252
+ if (hasStyles(stylesheets)) {
4253
+ for (var _i23 = 0; _i23 < stylesheets.length; _i23++) {
4254
+ if (isTrue(stylesheets[_i23][KEY__SCOPED_CSS])) {
4141
4255
  return true;
4142
4256
  }
4143
4257
  }
4144
4258
  }
4145
4259
  return false;
4146
4260
  }
4261
+ function computeHasScopedStyles(template, vm) {
4262
+ var stylesheets = template.stylesheets;
4263
+ var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
4264
+ return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
4265
+ }
4266
+ function hasStyles(stylesheets) {
4267
+ return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
4268
+ }
4147
4269
  var vmBeingConstructed = null;
4148
4270
  function isBeingConstructed(vm) {
4149
4271
  return vmBeingConstructed === vm;
@@ -4295,8 +4417,8 @@ var LWC = (function (exports) {
4295
4417
  * subject to change or being removed.
4296
4418
  */
4297
4419
  function register(service) {
4298
- for (var _i22 = 0; _i22 < hooks.length; ++_i22) {
4299
- var hookName = hooks[_i22];
4420
+ for (var _i24 = 0; _i24 < hooks.length; ++_i24) {
4421
+ var hookName = hooks[_i24];
4300
4422
  if (hookName in service) {
4301
4423
  var l = Services[hookName];
4302
4424
  if (isUndefined$1(l)) {
@@ -4310,8 +4432,8 @@ var LWC = (function (exports) {
4310
4432
  var component = vm.component,
4311
4433
  def = vm.def,
4312
4434
  context = vm.context;
4313
- for (var _i23 = 0, len = cbs.length; _i23 < len; ++_i23) {
4314
- cbs[_i23].call(undefined, component, {}, def, context);
4435
+ for (var _i25 = 0, len = cbs.length; _i25 < len; ++_i25) {
4436
+ cbs[_i25].call(undefined, component, {}, def, context);
4315
4437
  }
4316
4438
  }
4317
4439
 
@@ -4424,6 +4546,7 @@ var LWC = (function (exports) {
4424
4546
  // Properties set right after VM creation.
4425
4547
  tro: null,
4426
4548
  shadowMode: null,
4549
+ stylesheets: null,
4427
4550
  // Properties set by the LightningElement constructor.
4428
4551
  component: null,
4429
4552
  shadowRoot: null,
@@ -4433,6 +4556,7 @@ var LWC = (function (exports) {
4433
4556
  getHook: getHook,
4434
4557
  renderer: renderer
4435
4558
  };
4559
+ vm.stylesheets = computeStylesheets(vm, def.ctor);
4436
4560
  vm.shadowMode = computeShadowMode(vm, renderer);
4437
4561
  vm.tro = getTemplateReactiveObserver(vm);
4438
4562
  // Create component instance associated to the vm and the element.
@@ -4443,6 +4567,38 @@ var LWC = (function (exports) {
4443
4567
  }
4444
4568
  return vm;
4445
4569
  }
4570
+ function validateComponentStylesheets(vm, stylesheets) {
4571
+ var valid = true;
4572
+ var validate = function validate(arrayOrStylesheet) {
4573
+ if (isArray$1(arrayOrStylesheet)) {
4574
+ for (var _i26 = 0; _i26 < arrayOrStylesheet.length; _i26++) {
4575
+ validate(arrayOrStylesheet[_i26]);
4576
+ }
4577
+ } else if (!isFunction$1(arrayOrStylesheet)) {
4578
+ // function assumed to be a stylesheet factory
4579
+ valid = false;
4580
+ }
4581
+ };
4582
+ if (!isArray$1(stylesheets)) {
4583
+ valid = false;
4584
+ } else {
4585
+ validate(stylesheets);
4586
+ }
4587
+ return valid;
4588
+ }
4589
+ // Validate and flatten any stylesheets defined as `static stylesheets`
4590
+ function computeStylesheets(vm, ctor) {
4591
+ if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
4592
+ var stylesheets = ctor.stylesheets;
4593
+ if (!isUndefined$1(stylesheets)) {
4594
+ var valid = validateComponentStylesheets(vm, stylesheets);
4595
+ if (valid) {
4596
+ return flattenStylesheets(stylesheets);
4597
+ }
4598
+ }
4599
+ }
4600
+ return null;
4601
+ }
4446
4602
  function computeShadowMode(vm, renderer) {
4447
4603
  var def = vm.def;
4448
4604
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -4551,17 +4707,17 @@ var LWC = (function (exports) {
4551
4707
  return a.idx - b.idx;
4552
4708
  });
4553
4709
  rehydrateQueue = []; // reset to a new queue
4554
- for (var _i24 = 0, len = vms.length; _i24 < len; _i24 += 1) {
4555
- var vm = vms[_i24];
4710
+ for (var _i27 = 0, len = vms.length; _i27 < len; _i27 += 1) {
4711
+ var vm = vms[_i27];
4556
4712
  try {
4557
4713
  rehydrate(vm);
4558
4714
  } catch (error) {
4559
- if (_i24 + 1 < len) {
4715
+ if (_i27 + 1 < len) {
4560
4716
  // pieces of the queue are still pending to be rehydrated, those should have priority
4561
4717
  if (rehydrateQueue.length === 0) {
4562
4718
  addCallbackToNextTick(flushRehydrationQueue);
4563
4719
  }
4564
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i24 + 1));
4720
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i27 + 1));
4565
4721
  }
4566
4722
  // we need to end the measure before throwing.
4567
4723
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -4627,8 +4783,8 @@ var LWC = (function (exports) {
4627
4783
  var vCustomElementCollection = vm.velements;
4628
4784
  // Reporting disconnection for every child in inverse order since they are
4629
4785
  // inserted in reserved order.
4630
- for (var _i25 = vCustomElementCollection.length - 1; _i25 >= 0; _i25 -= 1) {
4631
- var elm = vCustomElementCollection[_i25].elm;
4786
+ for (var _i28 = vCustomElementCollection.length - 1; _i28 >= 0; _i28 -= 1) {
4787
+ var elm = vCustomElementCollection[_i28].elm;
4632
4788
  // There are two cases where the element could be undefined:
4633
4789
  // * when there is an error during the construction phase, and an error
4634
4790
  // boundary picks it, there is a possibility that the VCustomElement
@@ -4659,8 +4815,8 @@ var LWC = (function (exports) {
4659
4815
  * defined on its shadow.
4660
4816
  */
4661
4817
  function recursivelyDisconnectChildren(vnodes) {
4662
- for (var _i26 = 0, len = vnodes.length; _i26 < len; _i26 += 1) {
4663
- var vnode = vnodes[_i26];
4818
+ for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
4819
+ var vnode = vnodes[_i29];
4664
4820
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
4665
4821
  switch (vnode.type) {
4666
4822
  case 2 /* VNodeType.Element */:
@@ -4684,8 +4840,8 @@ var LWC = (function (exports) {
4684
4840
  var children = vm.children,
4685
4841
  renderRoot = vm.renderRoot,
4686
4842
  remove = vm.renderer.remove;
4687
- for (var _i27 = 0, len = children.length; _i27 < len; _i27++) {
4688
- var child = children[_i27];
4843
+ for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
4844
+ var child = children[_i30];
4689
4845
  if (!isNull(child) && !isUndefined$1(child.elm)) {
4690
4846
  remove(child.elm, renderRoot);
4691
4847
  }
@@ -4981,16 +5137,16 @@ var LWC = (function (exports) {
4981
5137
  }
4982
5138
  function connectWireAdapters(vm) {
4983
5139
  var wiredConnecting = vm.context.wiredConnecting;
4984
- for (var _i28 = 0, len = wiredConnecting.length; _i28 < len; _i28 += 1) {
4985
- wiredConnecting[_i28]();
5140
+ for (var _i31 = 0, len = wiredConnecting.length; _i31 < len; _i31 += 1) {
5141
+ wiredConnecting[_i31]();
4986
5142
  }
4987
5143
  }
4988
5144
  function disconnectWireAdapters(vm) {
4989
5145
  var wiredDisconnecting = vm.context.wiredDisconnecting;
4990
5146
  runWithBoundaryProtection(vm, vm, noop, function () {
4991
5147
  // job
4992
- for (var _i29 = 0, len = wiredDisconnecting.length; _i29 < len; _i29 += 1) {
4993
- wiredDisconnecting[_i29]();
5148
+ for (var _i32 = 0, len = wiredDisconnecting.length; _i32 < len; _i32 += 1) {
5149
+ wiredDisconnecting[_i32]();
4994
5150
  }
4995
5151
  }, noop);
4996
5152
  }
@@ -5200,8 +5356,8 @@ var LWC = (function (exports) {
5200
5356
  var nextNode = node;
5201
5357
  var anchor = null;
5202
5358
  var renderer = owner.renderer;
5203
- for (var _i30 = 0; _i30 < children.length; _i30++) {
5204
- var childVnode = children[_i30];
5359
+ for (var _i33 = 0; _i33 < children.length; _i33++) {
5360
+ var childVnode = children[_i33];
5205
5361
  if (!isNull(childVnode)) {
5206
5362
  if (nextNode) {
5207
5363
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -5262,8 +5418,8 @@ var LWC = (function (exports) {
5262
5418
  var nodesAreCompatible = true;
5263
5419
  // Validate attributes, though we could always recovery from those by running the update mods.
5264
5420
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
5265
- for (var _i31 = 0, _Object$entries = Object.entries(attrs); _i31 < _Object$entries.length; _i31++) {
5266
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i31], 2),
5421
+ for (var _i34 = 0, _Object$entries = Object.entries(attrs); _i34 < _Object$entries.length; _i34++) {
5422
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i34], 2),
5267
5423
  attrName = _Object$entries$_i[0],
5268
5424
  attrValue = _Object$entries$_i[1];
5269
5425
  vnode.owner;
@@ -5350,8 +5506,8 @@ var LWC = (function (exports) {
5350
5506
  var parsedVnodeStyle = parseStyleText(elmStyle);
5351
5507
  var expectedStyle = [];
5352
5508
  // styleMap is used when style is set to static value.
5353
- for (var _i32 = 0, n = styleDecls.length; _i32 < n; _i32++) {
5354
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i32], 3),
5509
+ for (var _i35 = 0, n = styleDecls.length; _i35 < n; _i35++) {
5510
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i35], 3),
5355
5511
  prop = _styleDecls$_i2[0],
5356
5512
  value = _styleDecls$_i2[1],
5357
5513
  important = _styleDecls$_i2[2];
@@ -5425,8 +5581,8 @@ var LWC = (function (exports) {
5425
5581
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
5426
5582
  function traverseStylesheets(stylesheets, callback) {
5427
5583
  callback(stylesheets);
5428
- for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
5429
- var stylesheet = stylesheets[_i33];
5584
+ for (var _i36 = 0; _i36 < stylesheets.length; _i36++) {
5585
+ var stylesheet = stylesheets[_i36];
5430
5586
  if (isArray$1(stylesheet)) {
5431
5587
  traverseStylesheets(stylesheet, callback);
5432
5588
  } else {
@@ -6442,7 +6598,7 @@ var LWC = (function (exports) {
6442
6598
  function isNull(obj) {
6443
6599
  return obj === null;
6444
6600
  }
6445
- /** version: 2.32.1 */
6601
+ /** version: 2.34.0 */
6446
6602
 
6447
6603
  /*
6448
6604
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6520,7 +6676,7 @@ var LWC = (function (exports) {
6520
6676
  doc.body.innerHTML = html;
6521
6677
  var content = doc.body;
6522
6678
  if (!isUndefined(wrapperTags)) {
6523
- for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
6679
+ for (var _i37 = 0; _i37 < wrapperTags.length; _i37++) {
6524
6680
  content = content.firstChild;
6525
6681
  }
6526
6682
  }
@@ -6713,8 +6869,8 @@ var LWC = (function (exports) {
6713
6869
  tagName: element.tagName.toLowerCase(),
6714
6870
  hydrated: true
6715
6871
  });
6716
- for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
6717
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
6872
+ for (var _i38 = 0, _Object$entries2 = Object.entries(props); _i38 < _Object$entries2.length; _i38++) {
6873
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i38], 2),
6718
6874
  key = _Object$entries2$_i[0],
6719
6875
  value = _Object$entries2$_i[1];
6720
6876
  element[key] = value;
@@ -7001,7 +7157,7 @@ var LWC = (function (exports) {
7001
7157
  });
7002
7158
  freeze(LightningElement);
7003
7159
  seal(LightningElement.prototype);
7004
- /* version: 2.32.1 */
7160
+ /* version: 2.34.0 */
7005
7161
 
7006
7162
  exports.LightningElement = LightningElement;
7007
7163
  exports.__unstable__ProfilerControl = profilerControl;