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
@@ -7,7 +7,7 @@
7
7
  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); }
8
8
  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); }
9
9
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
10
- 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; }
10
+ 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; }
11
11
  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); }
12
12
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
13
13
  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); }; }
@@ -16,15 +16,17 @@
16
16
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
17
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
18
18
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
19
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
20
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
23
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
22
24
  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."); }
23
25
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24
26
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
27
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
26
28
  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."); }
27
- 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; }
29
+ 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; } }
28
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
31
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
30
32
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -91,6 +93,7 @@
91
93
  ArrayIndexOf = _Array$prototype.indexOf,
92
94
  ArrayJoin = _Array$prototype.join,
93
95
  ArrayMap = _Array$prototype.map,
96
+ ArrayPop = _Array$prototype.pop,
94
97
  ArrayPush$1 = _Array$prototype.push,
95
98
  ArraySlice = _Array$prototype.slice,
96
99
  ArraySplice = _Array$prototype.splice,
@@ -169,6 +172,9 @@
169
172
  * The above list of 46 aria attributes is consistent with the following resources:
170
173
  * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
171
174
  * https://wicg.github.io/aom/spec/aria-reflection.html
175
+ *
176
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
177
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
172
178
  */
173
179
  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'];
174
180
  var _ref = /*@__PURE__*/function () {
@@ -329,88 +335,7 @@
329
335
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
330
336
  return propertyName;
331
337
  }
332
- /** version: 2.32.1 */
333
-
334
- /**
335
- * Copyright (C) 2018 salesforce.com, inc.
336
- */
337
-
338
- /*
339
- * Copyright (c) 2018, salesforce.com, inc.
340
- * All rights reserved.
341
- * SPDX-License-Identifier: MIT
342
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
343
- */
344
- function detect(propName) {
345
- return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
346
- }
347
-
348
- /*
349
- * Copyright (c) 2018, salesforce.com, inc.
350
- * All rights reserved.
351
- * SPDX-License-Identifier: MIT
352
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
353
- */
354
- var nodeToAriaPropertyValuesMap = new WeakMap();
355
- function getAriaPropertyMap(elm) {
356
- var map = nodeToAriaPropertyValuesMap.get(elm);
357
- if (map === undefined) {
358
- map = {};
359
- nodeToAriaPropertyValuesMap.set(elm, map);
360
- }
361
- return map;
362
- }
363
- function getNormalizedAriaPropertyValue(value) {
364
- return value == null ? null : String(value);
365
- }
366
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
367
- return {
368
- get: function get() {
369
- var map = getAriaPropertyMap(this);
370
- if (hasOwnProperty$1.call(map, propName)) {
371
- return map[propName];
372
- }
373
- // otherwise just reflect what's in the attribute
374
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
375
- },
376
- set: function set(newValue) {
377
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
378
- var map = getAriaPropertyMap(this);
379
- map[propName] = normalizedValue;
380
- // reflect into the corresponding attribute
381
- if (newValue === null) {
382
- this.removeAttribute(attrName);
383
- } else {
384
- this.setAttribute(attrName, newValue);
385
- }
386
- },
387
- configurable: true,
388
- enumerable: true
389
- };
390
- }
391
- function patch$1(propName) {
392
- // Typescript is inferring the wrong function type for this particular
393
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
394
- // @ts-ignore type-mismatch
395
- var attrName = AriaPropNameToAttrNameMap[propName];
396
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
397
- Object.defineProperty(Element.prototype, propName, descriptor);
398
- }
399
-
400
- /*
401
- * Copyright (c) 2018, salesforce.com, inc.
402
- * All rights reserved.
403
- * SPDX-License-Identifier: MIT
404
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
405
- */
406
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
407
- for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
408
- var propName = ElementPrototypeAriaPropertyNames[_i2];
409
- if (detect(propName)) {
410
- patch$1(propName);
411
- }
412
- }
413
- /** version: 2.32.1 */
338
+ /** version: 2.34.0 */
414
339
 
415
340
  /**
416
341
  * Copyright (C) 2018 salesforce.com, inc.
@@ -431,7 +356,9 @@
431
356
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
432
357
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
433
358
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
434
- ENABLE_FROZEN_TEMPLATE: null
359
+ ENABLE_FROZEN_TEMPLATE: null,
360
+ DISABLE_ARIA_REFLECTION_POLYFILL: null,
361
+ ENABLE_PROGRAMMATIC_STYLESHEETS: null
435
362
  };
436
363
  if (!_globalThis.lwcRuntimeFlags) {
437
364
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -479,6 +406,83 @@
479
406
  */
480
407
  function setFeatureFlagForTest(name, value) {
481
408
  }
409
+ /** version: 2.34.0 */
410
+
411
+ /**
412
+ * Copyright (C) 2018 salesforce.com, inc.
413
+ */
414
+
415
+ /*
416
+ * Copyright (c) 2018, salesforce.com, inc.
417
+ * All rights reserved.
418
+ * SPDX-License-Identifier: MIT
419
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
420
+ */
421
+ function detect(propName, prototype) {
422
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
423
+ }
424
+
425
+ /*
426
+ * Copyright (c) 2018, salesforce.com, inc.
427
+ * All rights reserved.
428
+ * SPDX-License-Identifier: MIT
429
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
430
+ */
431
+ function createAriaPropertyPropertyDescriptor(attrName) {
432
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
433
+ // from Element.prototype, because these methods are overridden in LightningElement.
434
+ return {
435
+ get: function get() {
436
+ // reflect what's in the attribute
437
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
438
+ },
439
+ set: function set(newValue) {
440
+ // reflect into the corresponding attribute
441
+ if (isNull(newValue)) {
442
+ this.removeAttribute(attrName);
443
+ } else {
444
+ this.setAttribute(attrName, newValue);
445
+ }
446
+ },
447
+ configurable: true,
448
+ enumerable: true
449
+ };
450
+ }
451
+ function patch$1(propName, prototype) {
452
+ var attrName = AriaPropNameToAttrNameMap[propName];
453
+ var descriptor = createAriaPropertyPropertyDescriptor(attrName);
454
+ defineProperty(prototype, propName, descriptor);
455
+ }
456
+
457
+ /*
458
+ * Copyright (c) 2018, salesforce.com, inc.
459
+ * All rights reserved.
460
+ * SPDX-License-Identifier: MIT
461
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
462
+ */
463
+ function applyAriaReflection() {
464
+ var prototype = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Element.prototype;
465
+ var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
466
+ for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
467
+ var propName = ElementPrototypeAriaPropertyNames[_i2];
468
+ if (detect(propName, prototype)) {
469
+ patch$1(propName, prototype);
470
+ }
471
+ }
472
+ }
473
+ /** version: 2.34.0 */
474
+
475
+ /*
476
+ * Copyright (c) 2018, salesforce.com, inc.
477
+ * All rights reserved.
478
+ * SPDX-License-Identifier: MIT
479
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
480
+ */
481
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
482
+ // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
483
+ // i.e. to the global Element.prototype
484
+ applyAriaReflection();
485
+ }
482
486
 
483
487
  /*
484
488
  * Copyright (c) 2018, salesforce.com, inc.
@@ -493,7 +497,7 @@
493
497
  function flushCallbackQueue() {
494
498
  var callbacks = nextTickCallbackQueue;
495
499
  nextTickCallbackQueue = []; // reset to a new queue
496
- for (var _i3 = 0, _len = callbacks.length; _i3 < _len; _i3 += 1) {
500
+ for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
497
501
  callbacks[_i3]();
498
502
  }
499
503
  }
@@ -549,6 +553,26 @@
549
553
  }
550
554
  return result;
551
555
  }
556
+ function flattenStylesheets(stylesheets) {
557
+ var list = [];
558
+ var _iterator2 = _createForOfIteratorHelper(stylesheets),
559
+ _step2;
560
+ try {
561
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
562
+ var stylesheet = _step2.value;
563
+ if (!Array.isArray(stylesheet)) {
564
+ list.push(stylesheet);
565
+ } else {
566
+ list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
567
+ }
568
+ }
569
+ } catch (err) {
570
+ _iterator2.e(err);
571
+ } finally {
572
+ _iterator2.f();
573
+ }
574
+ return list;
575
+ }
552
576
  // Set a ref (lwc:ref) on a VM, from a template API
553
577
  function setRefVNode(vm, ref, vnode) {
554
578
  // If this method is called, then vm.refVNodes is set as the template has refs.
@@ -583,7 +607,7 @@
583
607
  if (!isUndefined$1(reactiveRecord)) {
584
608
  var reactiveObservers = reactiveRecord[key];
585
609
  if (!isUndefined$1(reactiveObservers)) {
586
- for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
610
+ for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
587
611
  var ro = reactiveObservers[_i5];
588
612
  ro.notify();
589
613
  }
@@ -792,6 +816,9 @@
792
816
  // Global HTML Attributes & Properties
793
817
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
794
818
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
819
+ //
820
+ // If you update this list, check for test files that recapitulate the same list. Searching the codebase
821
+ // for e.g. "dropzone" should suffice.
795
822
  assign(create(null), {
796
823
  accessKey: {
797
824
  attribute: 'accesskey'
@@ -1827,6 +1854,17 @@
1827
1854
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
1828
1855
  }
1829
1856
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
1857
+ function applyAriaReflectionToLightningElement() {
1858
+ // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
1859
+ // apply it to LightningElement.prototype.
1860
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
1861
+ applyAriaReflection(LightningElement.prototype);
1862
+ }
1863
+ // The reason for this odd if/else branching is limitations in @lwc/features:
1864
+ // https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
1865
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
1866
+ applyAriaReflectionToLightningElement();
1867
+ }
1830
1868
  defineProperty(LightningElement, 'CustomElementConstructor', {
1831
1869
  get: function get() {
1832
1870
  // If required, a runtime-specific implementation must be defined.
@@ -2240,7 +2278,7 @@
2240
2278
  };
2241
2279
  }
2242
2280
  // expose public methods as props on the new Element Bridge
2243
- for (var _i10 = 0, _len3 = methods.length; _i10 < _len3; _i10 += 1) {
2281
+ for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
2244
2282
  var methodName = methods[_i10];
2245
2283
  descriptors[methodName] = {
2246
2284
  value: createMethodCaller(methodName),
@@ -2266,6 +2304,20 @@
2266
2304
  return HTMLBridgeElement;
2267
2305
  }
2268
2306
  var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2307
+ {
2308
+ // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
2309
+ // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
2310
+ // ARIA props outside the LightningElement
2311
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2312
+ // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
2313
+ // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
2314
+ // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
2315
+ //
2316
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
2317
+ // accessors inside the HTMLBridgeElementFactory.
2318
+ applyAriaReflection(BaseBridgeElement.prototype);
2319
+ }
2320
+ }
2269
2321
  freeze(BaseBridgeElement);
2270
2322
  seal(BaseBridgeElement.prototype);
2271
2323
  function setActiveVM(vm) {
@@ -2501,6 +2553,7 @@
2501
2553
  setAttribute = _vm$renderer.setAttribute;
2502
2554
  var newStylesheets = template.stylesheets,
2503
2555
  newStylesheetToken = template.stylesheetToken;
2556
+ var newVmStylesheets = vm.stylesheets;
2504
2557
  var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
2505
2558
  var hasScopedStyles = context.hasScopedStyles;
2506
2559
  var newToken;
@@ -2520,7 +2573,9 @@
2520
2573
  }
2521
2574
  // Apply the new template styling token to the host element, if the new template has any
2522
2575
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
2523
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
2576
+ var hasNewStylesheets = hasStyles(newStylesheets);
2577
+ var hasNewVmStylesheets = hasStyles(newVmStylesheets);
2578
+ if (hasNewStylesheets || hasNewVmStylesheets) {
2524
2579
  newToken = newStylesheetToken;
2525
2580
  }
2526
2581
  // Set the new styling token on the host element
@@ -2582,10 +2637,15 @@
2582
2637
  function getStylesheetsContent(vm, template) {
2583
2638
  var stylesheets = template.stylesheets,
2584
2639
  stylesheetToken = template.stylesheetToken;
2640
+ var vmStylesheets = vm.stylesheets;
2585
2641
  var content = [];
2586
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
2642
+ if (hasStyles(stylesheets)) {
2587
2643
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
2588
2644
  }
2645
+ // VM (component) stylesheets apply after template stylesheets
2646
+ if (hasStyles(vmStylesheets)) {
2647
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
2648
+ }
2589
2649
  return content;
2590
2650
  }
2591
2651
  // It might be worth caching this to avoid doing the lookup repeatedly, but
@@ -2620,8 +2680,9 @@
2620
2680
  function getStylesheetTokenHost(vnode) {
2621
2681
  var _getComponentInternal = getComponentInternalDef(vnode.ctor),
2622
2682
  template = _getComponentInternal.template;
2683
+ var vm = vnode.vm;
2623
2684
  var stylesheetToken = template.stylesheetToken;
2624
- return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
2685
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
2625
2686
  }
2626
2687
  function getNearestNativeShadowComponent(vm) {
2627
2688
  var owner = getNearestShadowComponent(vm);
@@ -3180,6 +3241,26 @@
3180
3241
  // in fallback mode, the allocation will always set children to
3181
3242
  // empty and delegate the real allocation to the slot elements
3182
3243
  allocateChildren(n2, vm);
3244
+ // Solves an edge case with slotted VFragments in native shadow mode.
3245
+ //
3246
+ // During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
3247
+ // to avoid interfering with native slot behavior. When this happens, if any of the fragments
3248
+ // were not stable, the children must go through the dynamic diffing algo.
3249
+ //
3250
+ // If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
3251
+ // the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
3252
+ // nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
3253
+ // mark the new children dynamic.
3254
+ //
3255
+ // Example:
3256
+ // n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
3257
+ // n2.children: [div, null, div] => [div, null, div] // marked ???
3258
+ var shadowMode = vm.shadowMode,
3259
+ renderMode = vm.renderMode;
3260
+ if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
3261
+ // No-op if children has already been marked dynamic by 'allocateChildren()'.
3262
+ markAsDynamicChildren(n2.children);
3263
+ }
3183
3264
  }
3184
3265
  // in fallback mode, the children will be always empty, so, nothing
3185
3266
  // will happen, but in native, it does allocate the light dom
@@ -3327,18 +3408,63 @@
3327
3408
  //
3328
3409
  // In case #2, we will always get a fresh VCustomElement.
3329
3410
  var children = vnode.aChildren || vnode.children;
3330
- vm.aChildren = children;
3331
3411
  var renderMode = vm.renderMode,
3332
3412
  shadowMode = vm.shadowMode;
3413
+ // If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
3414
+ // children VFragments to avoid them interfering with default slot behavior.
3415
+ var allocatedChildren = flattenFragmentsInChildren(children);
3416
+ vnode.children = allocatedChildren;
3417
+ vm.aChildren = allocatedChildren;
3333
3418
  if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3334
3419
  // slow path
3335
- allocateInSlot(vm, children, vnode.owner);
3420
+ allocateInSlot(vm, allocatedChildren, vnode.owner);
3336
3421
  // save the allocated children in case this vnode is reused.
3337
- vnode.aChildren = children;
3422
+ vnode.aChildren = allocatedChildren;
3338
3423
  // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
3339
3424
  vnode.children = EmptyArray;
3340
3425
  }
3341
3426
  }
3427
+ /**
3428
+ * Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
3429
+ * marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
3430
+ * and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
3431
+ *
3432
+ * With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
3433
+ *
3434
+ * This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
3435
+ */
3436
+ function flattenFragmentsInChildren(children) {
3437
+ var flattenedChildren = [];
3438
+ // Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
3439
+ // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
3440
+ var nodeStack = [];
3441
+ var fragmentFound = false;
3442
+ for (var _i15 = children.length - 1; _i15 > -1; _i15 -= 1) {
3443
+ var child = children[_i15];
3444
+ ArrayPush$1.call(nodeStack, child);
3445
+ fragmentFound = fragmentFound || !!(child && isVFragment(child));
3446
+ }
3447
+ if (!fragmentFound) {
3448
+ return children;
3449
+ }
3450
+ var currentNode;
3451
+ while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
3452
+ if (!isNull(currentNode) && isVFragment(currentNode)) {
3453
+ var fChildren = currentNode.children;
3454
+ // Ignore the start and end text node delimiters
3455
+ for (var _i16 = fChildren.length - 2; _i16 > 0; _i16 -= 1) {
3456
+ ArrayPush$1.call(nodeStack, fChildren[_i16]);
3457
+ }
3458
+ } else {
3459
+ ArrayPush$1.call(flattenedChildren, currentNode);
3460
+ }
3461
+ }
3462
+ // We always mark the children as dynamic because nothing generates stable VFragments yet.
3463
+ // If/when stable VFragments are generated by the compiler, this code should be updated to
3464
+ // not mark dynamic if all flattened VFragments were stable.
3465
+ markAsDynamicChildren(flattenedChildren);
3466
+ return flattenedChildren;
3467
+ }
3342
3468
  function createViewModelHook(elm, vnode, renderer) {
3343
3469
  var vm = getAssociatedVMIfPresent(elm);
3344
3470
  // There is a possibility that a custom element is registered under tagName, in which case, the
@@ -3358,22 +3484,16 @@
3358
3484
  });
3359
3485
  return vm;
3360
3486
  }
3361
- /**
3362
- * Collects all slots into a SlotSet, traversing through VFragment Nodes
3363
- */
3364
- function collectSlots(vm, children, cmpSlotsMapping) {
3487
+ function allocateInSlot(vm, children, owner) {
3365
3488
  var _a, _b;
3366
- for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
3367
- var vnode = children[_i15];
3489
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
3490
+ var cmpSlotsMapping = create(null);
3491
+ // Collect all slots into cmpSlotsMapping
3492
+ for (var _i17 = 0, len = children.length; _i17 < len; _i17 += 1) {
3493
+ var vnode = children[_i17];
3368
3494
  if (isNull(vnode)) {
3369
3495
  continue;
3370
3496
  }
3371
- // Dive further iff the content is wrapped in a VFragment
3372
- if (isVFragment(vnode)) {
3373
- // Remove the text delimiter nodes to avoid overriding default slot content
3374
- collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
3375
- continue;
3376
- }
3377
3497
  var slotName = '';
3378
3498
  if (isVBaseElement(vnode)) {
3379
3499
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
@@ -3383,11 +3503,6 @@
3383
3503
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
3384
3504
  ArrayPush$1.call(vnodes, vnode);
3385
3505
  }
3386
- }
3387
- function allocateInSlot(vm, children, owner) {
3388
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
3389
- var cmpSlotsMapping = create(null);
3390
- collectSlots(vm, children, cmpSlotsMapping);
3391
3506
  vm.cmpSlots = {
3392
3507
  owner: owner,
3393
3508
  slotAssignments: cmpSlotsMapping
@@ -3400,16 +3515,16 @@
3400
3515
  markComponentAsDirty(vm);
3401
3516
  return;
3402
3517
  }
3403
- for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
3404
- var key = oldKeys[_i16];
3518
+ for (var _i18 = 0, _len2 = oldKeys.length; _i18 < _len2; _i18 += 1) {
3519
+ var key = oldKeys[_i18];
3405
3520
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
3406
3521
  markComponentAsDirty(vm);
3407
3522
  return;
3408
3523
  }
3409
3524
  var oldVNodes = oldSlotsMapping[key];
3410
- var vnodes = cmpSlotsMapping[key];
3525
+ var _vnodes = cmpSlotsMapping[key];
3411
3526
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
3412
- if (oldVNodes[j] !== vnodes[j]) {
3527
+ if (oldVNodes[j] !== _vnodes[j]) {
3413
3528
  markComponentAsDirty(vm);
3414
3529
  return;
3415
3530
  }
@@ -3418,14 +3533,14 @@
3418
3533
  }
3419
3534
  }
3420
3535
  // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
3421
- var FromIteration = new WeakMap();
3422
- // dynamic children means it was generated by an iteration
3423
- // in a template, and will require a more complex diffing algo.
3536
+ var DynamicChildren = new WeakMap();
3537
+ // dynamic children means it was either generated by an iteration in a template
3538
+ // or part of an unstable fragment, and will require a more complex diffing algo.
3424
3539
  function markAsDynamicChildren(children) {
3425
- FromIteration.set(children, 1);
3540
+ DynamicChildren.set(children, 1);
3426
3541
  }
3427
3542
  function hasDynamicChildren(children) {
3428
- return FromIteration.has(children);
3543
+ return DynamicChildren.has(children);
3429
3544
  }
3430
3545
  function createKeyToOldIdx(children, beginIdx, endIdx) {
3431
3546
  var map = {};
@@ -3524,11 +3639,11 @@
3524
3639
  if (oldStartIdx > oldEndIdx) {
3525
3640
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
3526
3641
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
3527
- var _i17 = newEndIdx;
3642
+ var _i19 = newEndIdx;
3528
3643
  var n;
3529
3644
  do {
3530
- n = newCh[++_i17];
3531
- } while (!isVNode(n) && _i17 < newChEnd);
3645
+ n = newCh[++_i19];
3646
+ } while (!isVNode(n) && _i19 < newChEnd);
3532
3647
  before = isVNode(n) ? n.elm : null;
3533
3648
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
3534
3649
  } else {
@@ -3553,9 +3668,9 @@
3553
3668
  // if the old list is not empty, the new list MUST have the same
3554
3669
  // amount of nodes, that's why we call this static children
3555
3670
  var anchor = null;
3556
- for (var _i18 = c2Length - 1; _i18 >= 0; _i18 -= 1) {
3557
- var n1 = c1[_i18];
3558
- var n2 = c2[_i18];
3671
+ for (var _i20 = c2Length - 1; _i20 >= 0; _i20 -= 1) {
3672
+ var n1 = c1[_i20];
3673
+ var n2 = c2[_i20];
3559
3674
  if (n2 !== n1) {
3560
3675
  if (isVNode(n1)) {
3561
3676
  if (isVNode(n2)) {
@@ -3652,8 +3767,8 @@
3652
3767
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
3653
3768
  var newChildren = [];
3654
3769
  var slotAssignments = slotset.slotAssignments[slotName];
3655
- for (var _i19 = 0; _i19 < slotAssignments.length; _i19++) {
3656
- var vnode = slotAssignments[_i19];
3770
+ for (var _i21 = 0; _i21 < slotAssignments.length; _i21++) {
3771
+ var vnode = slotAssignments[_i21];
3657
3772
  if (!isNull(vnode)) {
3658
3773
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3659
3774
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -4003,7 +4118,7 @@
4003
4118
  }
4004
4119
  function buildParseFragmentFn(createFragmentFn) {
4005
4120
  return function (strings) {
4006
- for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
4121
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4007
4122
  keys[_key3 - 1] = arguments[_key3];
4008
4123
  }
4009
4124
  var cache = create(null);
@@ -4032,23 +4147,23 @@
4032
4147
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
4033
4148
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
4034
4149
  var htmlFragment = '';
4035
- for (var _i20 = 0, n = keys.length; _i20 < n; _i20++) {
4036
- switch (keys[_i20]) {
4150
+ for (var _i22 = 0, n = keys.length; _i22 < n; _i22++) {
4151
+ switch (keys[_i22]) {
4037
4152
  case 0:
4038
4153
  // styleToken in existing class attr
4039
- htmlFragment += strings[_i20] + classToken;
4154
+ htmlFragment += strings[_i22] + classToken;
4040
4155
  break;
4041
4156
  case 1:
4042
4157
  // styleToken for added class attr
4043
- htmlFragment += strings[_i20] + classAttrToken;
4158
+ htmlFragment += strings[_i22] + classAttrToken;
4044
4159
  break;
4045
4160
  case 2:
4046
4161
  // styleToken as attr
4047
- htmlFragment += strings[_i20] + attrToken;
4162
+ htmlFragment += strings[_i22] + attrToken;
4048
4163
  break;
4049
4164
  case 3:
4050
4165
  // ${1}${2}
4051
- htmlFragment += strings[_i20] + classAttrToken + attrToken;
4166
+ htmlFragment += strings[_i22] + classAttrToken + attrToken;
4052
4167
  break;
4053
4168
  }
4054
4169
  }
@@ -4104,7 +4219,7 @@
4104
4219
  // Create a brand new template cache for the swapped templated.
4105
4220
  context.tplCache = create(null);
4106
4221
  // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
4107
- context.hasScopedStyles = computeHasScopedStyles(html);
4222
+ context.hasScopedStyles = computeHasScopedStyles(html, vm);
4108
4223
  // Update the scoping token on the host element.
4109
4224
  updateStylesheetToken(vm, html);
4110
4225
  // Evaluate, create stylesheet and cache the produced VNode for future
@@ -4136,17 +4251,24 @@
4136
4251
  });
4137
4252
  return vnodes;
4138
4253
  }
4139
- function computeHasScopedStyles(template) {
4140
- var stylesheets = template.stylesheets;
4141
- if (!isUndefined$1(stylesheets)) {
4142
- for (var _i21 = 0; _i21 < stylesheets.length; _i21++) {
4143
- if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
4254
+ function computeHasScopedStylesInStylesheets(stylesheets) {
4255
+ if (hasStyles(stylesheets)) {
4256
+ for (var _i23 = 0; _i23 < stylesheets.length; _i23++) {
4257
+ if (isTrue(stylesheets[_i23][KEY__SCOPED_CSS])) {
4144
4258
  return true;
4145
4259
  }
4146
4260
  }
4147
4261
  }
4148
4262
  return false;
4149
4263
  }
4264
+ function computeHasScopedStyles(template, vm) {
4265
+ var stylesheets = template.stylesheets;
4266
+ var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
4267
+ return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
4268
+ }
4269
+ function hasStyles(stylesheets) {
4270
+ return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
4271
+ }
4150
4272
  var vmBeingConstructed = null;
4151
4273
  function isBeingConstructed(vm) {
4152
4274
  return vmBeingConstructed === vm;
@@ -4298,8 +4420,8 @@
4298
4420
  * subject to change or being removed.
4299
4421
  */
4300
4422
  function register(service) {
4301
- for (var _i22 = 0; _i22 < hooks.length; ++_i22) {
4302
- var hookName = hooks[_i22];
4423
+ for (var _i24 = 0; _i24 < hooks.length; ++_i24) {
4424
+ var hookName = hooks[_i24];
4303
4425
  if (hookName in service) {
4304
4426
  var l = Services[hookName];
4305
4427
  if (isUndefined$1(l)) {
@@ -4313,8 +4435,8 @@
4313
4435
  var component = vm.component,
4314
4436
  def = vm.def,
4315
4437
  context = vm.context;
4316
- for (var _i23 = 0, len = cbs.length; _i23 < len; ++_i23) {
4317
- cbs[_i23].call(undefined, component, {}, def, context);
4438
+ for (var _i25 = 0, len = cbs.length; _i25 < len; ++_i25) {
4439
+ cbs[_i25].call(undefined, component, {}, def, context);
4318
4440
  }
4319
4441
  }
4320
4442
 
@@ -4427,6 +4549,7 @@
4427
4549
  // Properties set right after VM creation.
4428
4550
  tro: null,
4429
4551
  shadowMode: null,
4552
+ stylesheets: null,
4430
4553
  // Properties set by the LightningElement constructor.
4431
4554
  component: null,
4432
4555
  shadowRoot: null,
@@ -4436,6 +4559,7 @@
4436
4559
  getHook: getHook,
4437
4560
  renderer: renderer
4438
4561
  };
4562
+ vm.stylesheets = computeStylesheets(vm, def.ctor);
4439
4563
  vm.shadowMode = computeShadowMode(vm, renderer);
4440
4564
  vm.tro = getTemplateReactiveObserver(vm);
4441
4565
  // Create component instance associated to the vm and the element.
@@ -4446,6 +4570,38 @@
4446
4570
  }
4447
4571
  return vm;
4448
4572
  }
4573
+ function validateComponentStylesheets(vm, stylesheets) {
4574
+ var valid = true;
4575
+ var validate = function validate(arrayOrStylesheet) {
4576
+ if (isArray$1(arrayOrStylesheet)) {
4577
+ for (var _i26 = 0; _i26 < arrayOrStylesheet.length; _i26++) {
4578
+ validate(arrayOrStylesheet[_i26]);
4579
+ }
4580
+ } else if (!isFunction$1(arrayOrStylesheet)) {
4581
+ // function assumed to be a stylesheet factory
4582
+ valid = false;
4583
+ }
4584
+ };
4585
+ if (!isArray$1(stylesheets)) {
4586
+ valid = false;
4587
+ } else {
4588
+ validate(stylesheets);
4589
+ }
4590
+ return valid;
4591
+ }
4592
+ // Validate and flatten any stylesheets defined as `static stylesheets`
4593
+ function computeStylesheets(vm, ctor) {
4594
+ if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
4595
+ var stylesheets = ctor.stylesheets;
4596
+ if (!isUndefined$1(stylesheets)) {
4597
+ var valid = validateComponentStylesheets(vm, stylesheets);
4598
+ if (valid) {
4599
+ return flattenStylesheets(stylesheets);
4600
+ }
4601
+ }
4602
+ }
4603
+ return null;
4604
+ }
4449
4605
  function computeShadowMode(vm, renderer) {
4450
4606
  var def = vm.def;
4451
4607
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -4554,17 +4710,17 @@
4554
4710
  return a.idx - b.idx;
4555
4711
  });
4556
4712
  rehydrateQueue = []; // reset to a new queue
4557
- for (var _i24 = 0, len = vms.length; _i24 < len; _i24 += 1) {
4558
- var vm = vms[_i24];
4713
+ for (var _i27 = 0, len = vms.length; _i27 < len; _i27 += 1) {
4714
+ var vm = vms[_i27];
4559
4715
  try {
4560
4716
  rehydrate(vm);
4561
4717
  } catch (error) {
4562
- if (_i24 + 1 < len) {
4718
+ if (_i27 + 1 < len) {
4563
4719
  // pieces of the queue are still pending to be rehydrated, those should have priority
4564
4720
  if (rehydrateQueue.length === 0) {
4565
4721
  addCallbackToNextTick(flushRehydrationQueue);
4566
4722
  }
4567
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i24 + 1));
4723
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i27 + 1));
4568
4724
  }
4569
4725
  // we need to end the measure before throwing.
4570
4726
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -4630,8 +4786,8 @@
4630
4786
  var vCustomElementCollection = vm.velements;
4631
4787
  // Reporting disconnection for every child in inverse order since they are
4632
4788
  // inserted in reserved order.
4633
- for (var _i25 = vCustomElementCollection.length - 1; _i25 >= 0; _i25 -= 1) {
4634
- var elm = vCustomElementCollection[_i25].elm;
4789
+ for (var _i28 = vCustomElementCollection.length - 1; _i28 >= 0; _i28 -= 1) {
4790
+ var elm = vCustomElementCollection[_i28].elm;
4635
4791
  // There are two cases where the element could be undefined:
4636
4792
  // * when there is an error during the construction phase, and an error
4637
4793
  // boundary picks it, there is a possibility that the VCustomElement
@@ -4662,8 +4818,8 @@
4662
4818
  * defined on its shadow.
4663
4819
  */
4664
4820
  function recursivelyDisconnectChildren(vnodes) {
4665
- for (var _i26 = 0, len = vnodes.length; _i26 < len; _i26 += 1) {
4666
- var vnode = vnodes[_i26];
4821
+ for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
4822
+ var vnode = vnodes[_i29];
4667
4823
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
4668
4824
  switch (vnode.type) {
4669
4825
  case 2 /* VNodeType.Element */:
@@ -4687,8 +4843,8 @@
4687
4843
  var children = vm.children,
4688
4844
  renderRoot = vm.renderRoot,
4689
4845
  remove = vm.renderer.remove;
4690
- for (var _i27 = 0, len = children.length; _i27 < len; _i27++) {
4691
- var child = children[_i27];
4846
+ for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
4847
+ var child = children[_i30];
4692
4848
  if (!isNull(child) && !isUndefined$1(child.elm)) {
4693
4849
  remove(child.elm, renderRoot);
4694
4850
  }
@@ -4984,16 +5140,16 @@
4984
5140
  }
4985
5141
  function connectWireAdapters(vm) {
4986
5142
  var wiredConnecting = vm.context.wiredConnecting;
4987
- for (var _i28 = 0, len = wiredConnecting.length; _i28 < len; _i28 += 1) {
4988
- wiredConnecting[_i28]();
5143
+ for (var _i31 = 0, len = wiredConnecting.length; _i31 < len; _i31 += 1) {
5144
+ wiredConnecting[_i31]();
4989
5145
  }
4990
5146
  }
4991
5147
  function disconnectWireAdapters(vm) {
4992
5148
  var wiredDisconnecting = vm.context.wiredDisconnecting;
4993
5149
  runWithBoundaryProtection(vm, vm, noop, function () {
4994
5150
  // job
4995
- for (var _i29 = 0, len = wiredDisconnecting.length; _i29 < len; _i29 += 1) {
4996
- wiredDisconnecting[_i29]();
5151
+ for (var _i32 = 0, len = wiredDisconnecting.length; _i32 < len; _i32 += 1) {
5152
+ wiredDisconnecting[_i32]();
4997
5153
  }
4998
5154
  }, noop);
4999
5155
  }
@@ -5203,8 +5359,8 @@
5203
5359
  var nextNode = node;
5204
5360
  var anchor = null;
5205
5361
  var renderer = owner.renderer;
5206
- for (var _i30 = 0; _i30 < children.length; _i30++) {
5207
- var childVnode = children[_i30];
5362
+ for (var _i33 = 0; _i33 < children.length; _i33++) {
5363
+ var childVnode = children[_i33];
5208
5364
  if (!isNull(childVnode)) {
5209
5365
  if (nextNode) {
5210
5366
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -5265,8 +5421,8 @@
5265
5421
  var nodesAreCompatible = true;
5266
5422
  // Validate attributes, though we could always recovery from those by running the update mods.
5267
5423
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
5268
- for (var _i31 = 0, _Object$entries = Object.entries(attrs); _i31 < _Object$entries.length; _i31++) {
5269
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i31], 2),
5424
+ for (var _i34 = 0, _Object$entries = Object.entries(attrs); _i34 < _Object$entries.length; _i34++) {
5425
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i34], 2),
5270
5426
  attrName = _Object$entries$_i[0],
5271
5427
  attrValue = _Object$entries$_i[1];
5272
5428
  vnode.owner;
@@ -5353,8 +5509,8 @@
5353
5509
  var parsedVnodeStyle = parseStyleText(elmStyle);
5354
5510
  var expectedStyle = [];
5355
5511
  // styleMap is used when style is set to static value.
5356
- for (var _i32 = 0, n = styleDecls.length; _i32 < n; _i32++) {
5357
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i32], 3),
5512
+ for (var _i35 = 0, n = styleDecls.length; _i35 < n; _i35++) {
5513
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i35], 3),
5358
5514
  prop = _styleDecls$_i2[0],
5359
5515
  value = _styleDecls$_i2[1],
5360
5516
  important = _styleDecls$_i2[2];
@@ -5428,8 +5584,8 @@
5428
5584
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
5429
5585
  function traverseStylesheets(stylesheets, callback) {
5430
5586
  callback(stylesheets);
5431
- for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
5432
- var stylesheet = stylesheets[_i33];
5587
+ for (var _i36 = 0; _i36 < stylesheets.length; _i36++) {
5588
+ var stylesheet = stylesheets[_i36];
5433
5589
  if (isArray$1(stylesheet)) {
5434
5590
  traverseStylesheets(stylesheet, callback);
5435
5591
  } else {
@@ -6445,7 +6601,7 @@
6445
6601
  function isNull(obj) {
6446
6602
  return obj === null;
6447
6603
  }
6448
- /** version: 2.32.1 */
6604
+ /** version: 2.34.0 */
6449
6605
 
6450
6606
  /*
6451
6607
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6523,7 +6679,7 @@
6523
6679
  doc.body.innerHTML = html;
6524
6680
  var content = doc.body;
6525
6681
  if (!isUndefined(wrapperTags)) {
6526
- for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
6682
+ for (var _i37 = 0; _i37 < wrapperTags.length; _i37++) {
6527
6683
  content = content.firstChild;
6528
6684
  }
6529
6685
  }
@@ -6716,8 +6872,8 @@
6716
6872
  tagName: element.tagName.toLowerCase(),
6717
6873
  hydrated: true
6718
6874
  });
6719
- for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
6720
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
6875
+ for (var _i38 = 0, _Object$entries2 = Object.entries(props); _i38 < _Object$entries2.length; _i38++) {
6876
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i38], 2),
6721
6877
  key = _Object$entries2$_i[0],
6722
6878
  value = _Object$entries2$_i[1];
6723
6879
  element[key] = value;
@@ -7004,7 +7160,7 @@
7004
7160
  });
7005
7161
  freeze(LightningElement);
7006
7162
  seal(LightningElement.prototype);
7007
- /* version: 2.32.1 */
7163
+ /* version: 2.34.0 */
7008
7164
 
7009
7165
  exports.LightningElement = LightningElement;
7010
7166
  exports.__unstable__ProfilerControl = profilerControl;