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); }
@@ -179,6 +181,9 @@
179
181
  * The above list of 46 aria attributes is consistent with the following resources:
180
182
  * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
181
183
  * https://wicg.github.io/aom/spec/aria-reflection.html
184
+ *
185
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
186
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
182
187
  */
183
188
  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'];
184
189
  var _ref = /*@__PURE__*/function () {
@@ -347,90 +352,9 @@
347
352
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
348
353
  */
349
354
  // Increment whenever the LWC template compiler changes
350
- var LWC_VERSION = "2.32.1";
355
+ var LWC_VERSION = "2.34.0";
351
356
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
352
- /** version: 2.32.1 */
353
-
354
- /**
355
- * Copyright (C) 2018 salesforce.com, inc.
356
- */
357
-
358
- /*
359
- * Copyright (c) 2018, salesforce.com, inc.
360
- * All rights reserved.
361
- * SPDX-License-Identifier: MIT
362
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
363
- */
364
- function detect(propName) {
365
- return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
366
- }
367
-
368
- /*
369
- * Copyright (c) 2018, salesforce.com, inc.
370
- * All rights reserved.
371
- * SPDX-License-Identifier: MIT
372
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
373
- */
374
- var nodeToAriaPropertyValuesMap = new WeakMap();
375
- function getAriaPropertyMap(elm) {
376
- var map = nodeToAriaPropertyValuesMap.get(elm);
377
- if (map === undefined) {
378
- map = {};
379
- nodeToAriaPropertyValuesMap.set(elm, map);
380
- }
381
- return map;
382
- }
383
- function getNormalizedAriaPropertyValue(value) {
384
- return value == null ? null : String(value);
385
- }
386
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
387
- return {
388
- get: function get() {
389
- var map = getAriaPropertyMap(this);
390
- if (hasOwnProperty$1.call(map, propName)) {
391
- return map[propName];
392
- }
393
- // otherwise just reflect what's in the attribute
394
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
395
- },
396
- set: function set(newValue) {
397
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
398
- var map = getAriaPropertyMap(this);
399
- map[propName] = normalizedValue;
400
- // reflect into the corresponding attribute
401
- if (newValue === null) {
402
- this.removeAttribute(attrName);
403
- } else {
404
- this.setAttribute(attrName, newValue);
405
- }
406
- },
407
- configurable: true,
408
- enumerable: true
409
- };
410
- }
411
- function patch$1(propName) {
412
- // Typescript is inferring the wrong function type for this particular
413
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
414
- // @ts-ignore type-mismatch
415
- var attrName = AriaPropNameToAttrNameMap[propName];
416
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
417
- Object.defineProperty(Element.prototype, propName, descriptor);
418
- }
419
-
420
- /*
421
- * Copyright (c) 2018, salesforce.com, inc.
422
- * All rights reserved.
423
- * SPDX-License-Identifier: MIT
424
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
425
- */
426
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
427
- for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
428
- var propName = ElementPrototypeAriaPropertyNames[_i2];
429
- if (detect(propName)) {
430
- patch$1(propName);
431
- }
432
- }
433
- /** version: 2.32.1 */
357
+ /** version: 2.34.0 */
434
358
 
435
359
  /**
436
360
  * Copyright (C) 2018 salesforce.com, inc.
@@ -451,7 +375,9 @@
451
375
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
452
376
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
453
377
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
454
- ENABLE_FROZEN_TEMPLATE: null
378
+ ENABLE_FROZEN_TEMPLATE: null,
379
+ DISABLE_ARIA_REFLECTION_POLYFILL: null,
380
+ ENABLE_PROGRAMMATIC_STYLESHEETS: null
455
381
  };
456
382
  if (!_globalThis.lwcRuntimeFlags) {
457
383
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -507,7 +433,83 @@
507
433
  setFeatureFlag(name, value);
508
434
  }
509
435
  }
510
- /** version: 2.32.1 */
436
+ /** version: 2.34.0 */
437
+
438
+ /**
439
+ * Copyright (C) 2018 salesforce.com, inc.
440
+ */
441
+
442
+ /*
443
+ * Copyright (c) 2018, salesforce.com, inc.
444
+ * All rights reserved.
445
+ * SPDX-License-Identifier: MIT
446
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
447
+ */
448
+ function detect(propName, prototype) {
449
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
450
+ }
451
+
452
+ /*
453
+ * Copyright (c) 2018, salesforce.com, inc.
454
+ * All rights reserved.
455
+ * SPDX-License-Identifier: MIT
456
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
457
+ */
458
+ function createAriaPropertyPropertyDescriptor(attrName) {
459
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
460
+ // from Element.prototype, because these methods are overridden in LightningElement.
461
+ return {
462
+ get: function get() {
463
+ // reflect what's in the attribute
464
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
465
+ },
466
+ set: function set(newValue) {
467
+ // reflect into the corresponding attribute
468
+ if (isNull(newValue)) {
469
+ this.removeAttribute(attrName);
470
+ } else {
471
+ this.setAttribute(attrName, newValue);
472
+ }
473
+ },
474
+ configurable: true,
475
+ enumerable: true
476
+ };
477
+ }
478
+ function patch$1(propName, prototype) {
479
+ var attrName = AriaPropNameToAttrNameMap[propName];
480
+ var descriptor = createAriaPropertyPropertyDescriptor(attrName);
481
+ defineProperty(prototype, propName, descriptor);
482
+ }
483
+
484
+ /*
485
+ * Copyright (c) 2018, salesforce.com, inc.
486
+ * All rights reserved.
487
+ * SPDX-License-Identifier: MIT
488
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
489
+ */
490
+ function applyAriaReflection() {
491
+ var prototype = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Element.prototype;
492
+ var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
493
+ for (var _i2 = 0, len = ElementPrototypeAriaPropertyNames.length; _i2 < len; _i2 += 1) {
494
+ var propName = ElementPrototypeAriaPropertyNames[_i2];
495
+ if (detect(propName, prototype)) {
496
+ patch$1(propName, prototype);
497
+ }
498
+ }
499
+ }
500
+ /** version: 2.34.0 */
501
+
502
+ /*
503
+ * Copyright (c) 2018, salesforce.com, inc.
504
+ * All rights reserved.
505
+ * SPDX-License-Identifier: MIT
506
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
507
+ */
508
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
509
+ // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
510
+ // i.e. to the global Element.prototype
511
+ applyAriaReflection();
512
+ }
511
513
 
512
514
  /*
513
515
  * Copyright (c) 2018, salesforce.com, inc.
@@ -575,7 +577,7 @@
575
577
  }
576
578
  var callbacks = nextTickCallbackQueue;
577
579
  nextTickCallbackQueue = []; // reset to a new queue
578
- for (var _i3 = 0, _len = callbacks.length; _i3 < _len; _i3 += 1) {
580
+ for (var _i3 = 0, len = callbacks.length; _i3 < len; _i3 += 1) {
579
581
  callbacks[_i3]();
580
582
  }
581
583
  }
@@ -693,7 +695,7 @@
693
695
  if (!isUndefined$1(reactiveRecord)) {
694
696
  var reactiveObservers = reactiveRecord[key];
695
697
  if (!isUndefined$1(reactiveObservers)) {
696
- for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
698
+ for (var _i5 = 0, len = reactiveObservers.length; _i5 < len; _i5 += 1) {
697
699
  var ro = reactiveObservers[_i5];
698
700
  ro.notify();
699
701
  }
@@ -852,6 +854,7 @@
852
854
  if (!isUndefined$1(vm)) {
853
855
  msg = "".concat(msg, "\n").concat(getComponentStack(vm));
854
856
  }
857
+ // In Jest tests, reduce the warning and error verbosity by not printing the callstack
855
858
  if (process.env.NODE_ENV === 'test') {
856
859
  /* eslint-disable-next-line no-console */
857
860
  console[method](msg);
@@ -910,6 +913,9 @@
910
913
  // Global HTML Attributes & Properties
911
914
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
912
915
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
916
+ //
917
+ // If you update this list, check for test files that recapitulate the same list. Searching the codebase
918
+ // for e.g. "dropzone" should suffice.
913
919
  var globalHTMLProperties = assign(create(null), {
914
920
  accessKey: {
915
921
  attribute: 'accesskey'
@@ -2466,6 +2472,17 @@
2466
2472
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
2467
2473
  }
2468
2474
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
2475
+ function applyAriaReflectionToLightningElement() {
2476
+ // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
2477
+ // apply it to LightningElement.prototype.
2478
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
2479
+ applyAriaReflection(LightningElement.prototype);
2480
+ }
2481
+ // The reason for this odd if/else branching is limitations in @lwc/features:
2482
+ // https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
2483
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2484
+ applyAriaReflectionToLightningElement();
2485
+ }
2469
2486
  defineProperty(LightningElement, 'CustomElementConstructor', {
2470
2487
  get: function get() {
2471
2488
  // If required, a runtime-specific implementation must be defined.
@@ -3055,7 +3072,7 @@
3055
3072
  };
3056
3073
  }
3057
3074
  // expose public methods as props on the new Element Bridge
3058
- for (var _i10 = 0, _len3 = methods.length; _i10 < _len3; _i10 += 1) {
3075
+ for (var _i10 = 0, _len = methods.length; _i10 < _len; _i10 += 1) {
3059
3076
  var methodName = methods[_i10];
3060
3077
  descriptors[methodName] = {
3061
3078
  value: createMethodCaller(methodName),
@@ -3081,6 +3098,20 @@
3081
3098
  return HTMLBridgeElement;
3082
3099
  }
3083
3100
  var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3101
+ {
3102
+ // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
3103
+ // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
3104
+ // ARIA props outside the LightningElement
3105
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
3106
+ // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
3107
+ // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
3108
+ // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
3109
+ //
3110
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
3111
+ // accessors inside the HTMLBridgeElementFactory.
3112
+ applyAriaReflection(BaseBridgeElement.prototype);
3113
+ }
3114
+ }
3084
3115
  freeze(BaseBridgeElement);
3085
3116
  seal(BaseBridgeElement.prototype);
3086
3117
 
@@ -3542,6 +3573,7 @@
3542
3573
  setAttribute = _vm$renderer.setAttribute;
3543
3574
  var newStylesheets = template.stylesheets,
3544
3575
  newStylesheetToken = template.stylesheetToken;
3576
+ var newVmStylesheets = vm.stylesheets;
3545
3577
  var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3546
3578
  var hasScopedStyles = context.hasScopedStyles;
3547
3579
  var newToken;
@@ -3561,7 +3593,9 @@
3561
3593
  }
3562
3594
  // Apply the new template styling token to the host element, if the new template has any
3563
3595
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3564
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3596
+ var hasNewStylesheets = hasStyles(newStylesheets);
3597
+ var hasNewVmStylesheets = hasStyles(newVmStylesheets);
3598
+ if (hasNewStylesheets || hasNewVmStylesheets) {
3565
3599
  newToken = newStylesheetToken;
3566
3600
  }
3567
3601
  // Set the new styling token on the host element
@@ -3631,10 +3665,15 @@
3631
3665
  function getStylesheetsContent(vm, template) {
3632
3666
  var stylesheets = template.stylesheets,
3633
3667
  stylesheetToken = template.stylesheetToken;
3668
+ var vmStylesheets = vm.stylesheets;
3634
3669
  var content = [];
3635
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3670
+ if (hasStyles(stylesheets)) {
3636
3671
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3637
3672
  }
3673
+ // VM (component) stylesheets apply after template stylesheets
3674
+ if (hasStyles(vmStylesheets)) {
3675
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
3676
+ }
3638
3677
  return content;
3639
3678
  }
3640
3679
  // It might be worth caching this to avoid doing the lookup repeatedly, but
@@ -3669,8 +3708,9 @@
3669
3708
  function getStylesheetTokenHost(vnode) {
3670
3709
  var _getComponentInternal = getComponentInternalDef(vnode.ctor),
3671
3710
  template = _getComponentInternal.template;
3711
+ var vm = vnode.vm;
3672
3712
  var stylesheetToken = template.stylesheetToken;
3673
- return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
3713
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
3674
3714
  }
3675
3715
  function getNearestNativeShadowComponent(vm) {
3676
3716
  var owner = getNearestShadowComponent(vm);
@@ -4259,6 +4299,26 @@
4259
4299
  // in fallback mode, the allocation will always set children to
4260
4300
  // empty and delegate the real allocation to the slot elements
4261
4301
  allocateChildren(n2, vm);
4302
+ // Solves an edge case with slotted VFragments in native shadow mode.
4303
+ //
4304
+ // During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
4305
+ // to avoid interfering with native slot behavior. When this happens, if any of the fragments
4306
+ // were not stable, the children must go through the dynamic diffing algo.
4307
+ //
4308
+ // If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
4309
+ // the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
4310
+ // nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
4311
+ // mark the new children dynamic.
4312
+ //
4313
+ // Example:
4314
+ // n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
4315
+ // n2.children: [div, null, div] => [div, null, div] // marked ???
4316
+ var shadowMode = vm.shadowMode,
4317
+ renderMode = vm.renderMode;
4318
+ if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
4319
+ // No-op if children has already been marked dynamic by 'allocateChildren()'.
4320
+ markAsDynamicChildren(n2.children);
4321
+ }
4262
4322
  }
4263
4323
  // in fallback mode, the children will be always empty, so, nothing
4264
4324
  // will happen, but in native, it does allocate the light dom
@@ -4437,7 +4497,6 @@
4437
4497
  //
4438
4498
  // In case #2, we will always get a fresh VCustomElement.
4439
4499
  var children = vnode.aChildren || vnode.children;
4440
- vm.aChildren = children;
4441
4500
  var renderMode = vm.renderMode,
4442
4501
  shadowMode = vm.shadowMode;
4443
4502
  if (process.env.NODE_ENV !== 'production') {
@@ -4450,15 +4509,61 @@
4450
4509
  logError("Invalid usage of 'lwc:slot-data' on ".concat(getComponentTag(vm), " tag. Scoped slot content can only be passed to a light dom child."));
4451
4510
  }
4452
4511
  }
4512
+ // If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
4513
+ // children VFragments to avoid them interfering with default slot behavior.
4514
+ var allocatedChildren = flattenFragmentsInChildren(children);
4515
+ vnode.children = allocatedChildren;
4516
+ vm.aChildren = allocatedChildren;
4453
4517
  if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4454
4518
  // slow path
4455
- allocateInSlot(vm, children, vnode.owner);
4519
+ allocateInSlot(vm, allocatedChildren, vnode.owner);
4456
4520
  // save the allocated children in case this vnode is reused.
4457
- vnode.aChildren = children;
4521
+ vnode.aChildren = allocatedChildren;
4458
4522
  // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4459
4523
  vnode.children = EmptyArray;
4460
4524
  }
4461
4525
  }
4526
+ /**
4527
+ * Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
4528
+ * marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
4529
+ * and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
4530
+ *
4531
+ * With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
4532
+ *
4533
+ * This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
4534
+ */
4535
+ function flattenFragmentsInChildren(children) {
4536
+ var flattenedChildren = [];
4537
+ // Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
4538
+ // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
4539
+ var nodeStack = [];
4540
+ var fragmentFound = false;
4541
+ for (var _i15 = children.length - 1; _i15 > -1; _i15 -= 1) {
4542
+ var child = children[_i15];
4543
+ ArrayPush$1.call(nodeStack, child);
4544
+ fragmentFound = fragmentFound || !!(child && isVFragment(child));
4545
+ }
4546
+ if (!fragmentFound) {
4547
+ return children;
4548
+ }
4549
+ var currentNode;
4550
+ while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
4551
+ if (!isNull(currentNode) && isVFragment(currentNode)) {
4552
+ var fChildren = currentNode.children;
4553
+ // Ignore the start and end text node delimiters
4554
+ for (var _i16 = fChildren.length - 2; _i16 > 0; _i16 -= 1) {
4555
+ ArrayPush$1.call(nodeStack, fChildren[_i16]);
4556
+ }
4557
+ } else {
4558
+ ArrayPush$1.call(flattenedChildren, currentNode);
4559
+ }
4560
+ }
4561
+ // We always mark the children as dynamic because nothing generates stable VFragments yet.
4562
+ // If/when stable VFragments are generated by the compiler, this code should be updated to
4563
+ // not mark dynamic if all flattened VFragments were stable.
4564
+ markAsDynamicChildren(flattenedChildren);
4565
+ return flattenedChildren;
4566
+ }
4462
4567
  function createViewModelHook(elm, vnode, renderer) {
4463
4568
  var vm = getAssociatedVMIfPresent(elm);
4464
4569
  // There is a possibility that a custom element is registered under tagName, in which case, the
@@ -4481,22 +4586,16 @@
4481
4586
  }
4482
4587
  return vm;
4483
4588
  }
4484
- /**
4485
- * Collects all slots into a SlotSet, traversing through VFragment Nodes
4486
- */
4487
- function collectSlots(vm, children, cmpSlotsMapping) {
4589
+ function allocateInSlot(vm, children, owner) {
4488
4590
  var _a, _b;
4489
- for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
4490
- var vnode = children[_i15];
4591
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4592
+ var cmpSlotsMapping = create(null);
4593
+ // Collect all slots into cmpSlotsMapping
4594
+ for (var _i17 = 0, len = children.length; _i17 < len; _i17 += 1) {
4595
+ var vnode = children[_i17];
4491
4596
  if (isNull(vnode)) {
4492
4597
  continue;
4493
4598
  }
4494
- // Dive further iff the content is wrapped in a VFragment
4495
- if (isVFragment(vnode)) {
4496
- // Remove the text delimiter nodes to avoid overriding default slot content
4497
- collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4498
- continue;
4499
- }
4500
4599
  var slotName = '';
4501
4600
  if (isVBaseElement(vnode)) {
4502
4601
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
@@ -4506,11 +4605,6 @@
4506
4605
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4507
4606
  ArrayPush$1.call(vnodes, vnode);
4508
4607
  }
4509
- }
4510
- function allocateInSlot(vm, children, owner) {
4511
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4512
- var cmpSlotsMapping = create(null);
4513
- collectSlots(vm, children, cmpSlotsMapping);
4514
4608
  vm.cmpSlots = {
4515
4609
  owner: owner,
4516
4610
  slotAssignments: cmpSlotsMapping
@@ -4523,16 +4617,16 @@
4523
4617
  markComponentAsDirty(vm);
4524
4618
  return;
4525
4619
  }
4526
- for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
4527
- var key = oldKeys[_i16];
4620
+ for (var _i18 = 0, _len2 = oldKeys.length; _i18 < _len2; _i18 += 1) {
4621
+ var key = oldKeys[_i18];
4528
4622
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4529
4623
  markComponentAsDirty(vm);
4530
4624
  return;
4531
4625
  }
4532
4626
  var oldVNodes = oldSlotsMapping[key];
4533
- var vnodes = cmpSlotsMapping[key];
4627
+ var _vnodes = cmpSlotsMapping[key];
4534
4628
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4535
- if (oldVNodes[j] !== vnodes[j]) {
4629
+ if (oldVNodes[j] !== _vnodes[j]) {
4536
4630
  markComponentAsDirty(vm);
4537
4631
  return;
4538
4632
  }
@@ -4541,14 +4635,14 @@
4541
4635
  }
4542
4636
  }
4543
4637
  // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4544
- var FromIteration = new WeakMap();
4545
- // dynamic children means it was generated by an iteration
4546
- // in a template, and will require a more complex diffing algo.
4638
+ var DynamicChildren = new WeakMap();
4639
+ // dynamic children means it was either generated by an iteration in a template
4640
+ // or part of an unstable fragment, and will require a more complex diffing algo.
4547
4641
  function markAsDynamicChildren(children) {
4548
- FromIteration.set(children, 1);
4642
+ DynamicChildren.set(children, 1);
4549
4643
  }
4550
4644
  function hasDynamicChildren(children) {
4551
- return FromIteration.has(children);
4645
+ return DynamicChildren.has(children);
4552
4646
  }
4553
4647
  function createKeyToOldIdx(children, beginIdx, endIdx) {
4554
4648
  var map = {};
@@ -4647,11 +4741,11 @@
4647
4741
  if (oldStartIdx > oldEndIdx) {
4648
4742
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4649
4743
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4650
- var _i17 = newEndIdx;
4744
+ var _i19 = newEndIdx;
4651
4745
  var n;
4652
4746
  do {
4653
- n = newCh[++_i17];
4654
- } while (!isVNode(n) && _i17 < newChEnd);
4747
+ n = newCh[++_i19];
4748
+ } while (!isVNode(n) && _i19 < newChEnd);
4655
4749
  before = isVNode(n) ? n.elm : null;
4656
4750
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4657
4751
  } else {
@@ -4676,9 +4770,9 @@
4676
4770
  // if the old list is not empty, the new list MUST have the same
4677
4771
  // amount of nodes, that's why we call this static children
4678
4772
  var anchor = null;
4679
- for (var _i18 = c2Length - 1; _i18 >= 0; _i18 -= 1) {
4680
- var n1 = c1[_i18];
4681
- var n2 = c2[_i18];
4773
+ for (var _i20 = c2Length - 1; _i20 >= 0; _i20 -= 1) {
4774
+ var n1 = c1[_i20];
4775
+ var n2 = c2[_i20];
4682
4776
  if (n2 !== n1) {
4683
4777
  if (isVNode(n1)) {
4684
4778
  if (isVNode(n2)) {
@@ -4803,8 +4897,8 @@
4803
4897
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
4804
4898
  var newChildren = [];
4805
4899
  var slotAssignments = slotset.slotAssignments[slotName];
4806
- for (var _i19 = 0; _i19 < slotAssignments.length; _i19++) {
4807
- var vnode = slotAssignments[_i19];
4900
+ for (var _i21 = 0; _i21 < slotAssignments.length; _i21++) {
4901
+ var vnode = slotAssignments[_i21];
4808
4902
  if (!isNull(vnode)) {
4809
4903
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4810
4904
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -5300,7 +5394,7 @@
5300
5394
  }
5301
5395
  function buildParseFragmentFn(createFragmentFn) {
5302
5396
  return function (strings) {
5303
- for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
5397
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5304
5398
  keys[_key3 - 1] = arguments[_key3];
5305
5399
  }
5306
5400
  var cache = create(null);
@@ -5329,23 +5423,23 @@
5329
5423
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
5330
5424
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
5331
5425
  var htmlFragment = '';
5332
- for (var _i20 = 0, n = keys.length; _i20 < n; _i20++) {
5333
- switch (keys[_i20]) {
5426
+ for (var _i22 = 0, n = keys.length; _i22 < n; _i22++) {
5427
+ switch (keys[_i22]) {
5334
5428
  case 0:
5335
5429
  // styleToken in existing class attr
5336
- htmlFragment += strings[_i20] + classToken;
5430
+ htmlFragment += strings[_i22] + classToken;
5337
5431
  break;
5338
5432
  case 1:
5339
5433
  // styleToken for added class attr
5340
- htmlFragment += strings[_i20] + classAttrToken;
5434
+ htmlFragment += strings[_i22] + classAttrToken;
5341
5435
  break;
5342
5436
  case 2:
5343
5437
  // styleToken as attr
5344
- htmlFragment += strings[_i20] + attrToken;
5438
+ htmlFragment += strings[_i22] + attrToken;
5345
5439
  break;
5346
5440
  case 3:
5347
5441
  // ${1}${2}
5348
- htmlFragment += strings[_i20] + classAttrToken + attrToken;
5442
+ htmlFragment += strings[_i22] + classAttrToken + attrToken;
5349
5443
  break;
5350
5444
  }
5351
5445
  }
@@ -5410,7 +5504,7 @@
5410
5504
  // Create a brand new template cache for the swapped templated.
5411
5505
  context.tplCache = create(null);
5412
5506
  // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
5413
- context.hasScopedStyles = computeHasScopedStyles(html);
5507
+ context.hasScopedStyles = computeHasScopedStyles(html, vm);
5414
5508
  // Update the scoping token on the host element.
5415
5509
  updateStylesheetToken(vm, html);
5416
5510
  // Evaluate, create stylesheet and cache the produced VNode for future
@@ -5450,17 +5544,24 @@
5450
5544
  }
5451
5545
  return vnodes;
5452
5546
  }
5453
- function computeHasScopedStyles(template) {
5454
- var stylesheets = template.stylesheets;
5455
- if (!isUndefined$1(stylesheets)) {
5456
- for (var _i21 = 0; _i21 < stylesheets.length; _i21++) {
5457
- if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
5547
+ function computeHasScopedStylesInStylesheets(stylesheets) {
5548
+ if (hasStyles(stylesheets)) {
5549
+ for (var _i23 = 0; _i23 < stylesheets.length; _i23++) {
5550
+ if (isTrue(stylesheets[_i23][KEY__SCOPED_CSS])) {
5458
5551
  return true;
5459
5552
  }
5460
5553
  }
5461
5554
  }
5462
5555
  return false;
5463
5556
  }
5557
+ function computeHasScopedStyles(template, vm) {
5558
+ var stylesheets = template.stylesheets;
5559
+ var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
5560
+ return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
5561
+ }
5562
+ function hasStyles(stylesheets) {
5563
+ return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
5564
+ }
5464
5565
 
5465
5566
  /*
5466
5567
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5642,8 +5743,8 @@
5642
5743
  if (process.env.NODE_ENV !== 'production') {
5643
5744
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
5644
5745
  }
5645
- for (var _i22 = 0; _i22 < hooks.length; ++_i22) {
5646
- var hookName = hooks[_i22];
5746
+ for (var _i24 = 0; _i24 < hooks.length; ++_i24) {
5747
+ var hookName = hooks[_i24];
5647
5748
  if (hookName in service) {
5648
5749
  var l = Services[hookName];
5649
5750
  if (isUndefined$1(l)) {
@@ -5660,8 +5761,8 @@
5660
5761
  var component = vm.component,
5661
5762
  def = vm.def,
5662
5763
  context = vm.context;
5663
- for (var _i23 = 0, len = cbs.length; _i23 < len; ++_i23) {
5664
- cbs[_i23].call(undefined, component, {}, def, context);
5764
+ for (var _i25 = 0, len = cbs.length; _i25 < len; ++_i25) {
5765
+ cbs[_i25].call(undefined, component, {}, def, context);
5665
5766
  }
5666
5767
  }
5667
5768
 
@@ -5780,6 +5881,7 @@
5780
5881
  // Properties set right after VM creation.
5781
5882
  tro: null,
5782
5883
  shadowMode: null,
5884
+ stylesheets: null,
5783
5885
  // Properties set by the LightningElement constructor.
5784
5886
  component: null,
5785
5887
  shadowRoot: null,
@@ -5792,6 +5894,7 @@
5792
5894
  if (process.env.NODE_ENV !== 'production') {
5793
5895
  vm.debugInfo = create(null);
5794
5896
  }
5897
+ vm.stylesheets = computeStylesheets(vm, def.ctor);
5795
5898
  vm.shadowMode = computeShadowMode(vm, renderer);
5796
5899
  vm.tro = getTemplateReactiveObserver(vm);
5797
5900
  if (process.env.NODE_ENV !== 'production') {
@@ -5810,6 +5913,40 @@
5810
5913
  }
5811
5914
  return vm;
5812
5915
  }
5916
+ function validateComponentStylesheets(vm, stylesheets) {
5917
+ var valid = true;
5918
+ var validate = function validate(arrayOrStylesheet) {
5919
+ if (isArray$1(arrayOrStylesheet)) {
5920
+ for (var _i26 = 0; _i26 < arrayOrStylesheet.length; _i26++) {
5921
+ validate(arrayOrStylesheet[_i26]);
5922
+ }
5923
+ } else if (!isFunction$1(arrayOrStylesheet)) {
5924
+ // function assumed to be a stylesheet factory
5925
+ valid = false;
5926
+ }
5927
+ };
5928
+ if (!isArray$1(stylesheets)) {
5929
+ valid = false;
5930
+ } else {
5931
+ validate(stylesheets);
5932
+ }
5933
+ return valid;
5934
+ }
5935
+ // Validate and flatten any stylesheets defined as `static stylesheets`
5936
+ function computeStylesheets(vm, ctor) {
5937
+ if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
5938
+ var stylesheets = ctor.stylesheets;
5939
+ if (!isUndefined$1(stylesheets)) {
5940
+ var valid = validateComponentStylesheets(vm, stylesheets);
5941
+ if (valid) {
5942
+ return flattenStylesheets(stylesheets);
5943
+ } else if (process.env.NODE_ENV !== 'production') {
5944
+ logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
5945
+ }
5946
+ }
5947
+ }
5948
+ return null;
5949
+ }
5813
5950
  function computeShadowMode(vm, renderer) {
5814
5951
  var def = vm.def;
5815
5952
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -5934,17 +6071,17 @@
5934
6071
  return a.idx - b.idx;
5935
6072
  });
5936
6073
  rehydrateQueue = []; // reset to a new queue
5937
- for (var _i24 = 0, len = vms.length; _i24 < len; _i24 += 1) {
5938
- var vm = vms[_i24];
6074
+ for (var _i27 = 0, len = vms.length; _i27 < len; _i27 += 1) {
6075
+ var vm = vms[_i27];
5939
6076
  try {
5940
6077
  rehydrate(vm);
5941
6078
  } catch (error) {
5942
- if (_i24 + 1 < len) {
6079
+ if (_i27 + 1 < len) {
5943
6080
  // pieces of the queue are still pending to be rehydrated, those should have priority
5944
6081
  if (rehydrateQueue.length === 0) {
5945
6082
  addCallbackToNextTick(flushRehydrationQueue);
5946
6083
  }
5947
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i24 + 1));
6084
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i27 + 1));
5948
6085
  }
5949
6086
  // we need to end the measure before throwing.
5950
6087
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -6013,8 +6150,8 @@
6013
6150
  var vCustomElementCollection = vm.velements;
6014
6151
  // Reporting disconnection for every child in inverse order since they are
6015
6152
  // inserted in reserved order.
6016
- for (var _i25 = vCustomElementCollection.length - 1; _i25 >= 0; _i25 -= 1) {
6017
- var elm = vCustomElementCollection[_i25].elm;
6153
+ for (var _i28 = vCustomElementCollection.length - 1; _i28 >= 0; _i28 -= 1) {
6154
+ var elm = vCustomElementCollection[_i28].elm;
6018
6155
  // There are two cases where the element could be undefined:
6019
6156
  // * when there is an error during the construction phase, and an error
6020
6157
  // boundary picks it, there is a possibility that the VCustomElement
@@ -6045,8 +6182,8 @@
6045
6182
  * defined on its shadow.
6046
6183
  */
6047
6184
  function recursivelyDisconnectChildren(vnodes) {
6048
- for (var _i26 = 0, len = vnodes.length; _i26 < len; _i26 += 1) {
6049
- var vnode = vnodes[_i26];
6185
+ for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
6186
+ var vnode = vnodes[_i29];
6050
6187
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6051
6188
  switch (vnode.type) {
6052
6189
  case 2 /* VNodeType.Element */:
@@ -6070,8 +6207,8 @@
6070
6207
  var children = vm.children,
6071
6208
  renderRoot = vm.renderRoot,
6072
6209
  remove = vm.renderer.remove;
6073
- for (var _i27 = 0, len = children.length; _i27 < len; _i27++) {
6074
- var child = children[_i27];
6210
+ for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
6211
+ var child = children[_i30];
6075
6212
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6076
6213
  remove(child.elm, renderRoot);
6077
6214
  }
@@ -6409,16 +6546,16 @@
6409
6546
  }
6410
6547
  function connectWireAdapters(vm) {
6411
6548
  var wiredConnecting = vm.context.wiredConnecting;
6412
- for (var _i28 = 0, len = wiredConnecting.length; _i28 < len; _i28 += 1) {
6413
- wiredConnecting[_i28]();
6549
+ for (var _i31 = 0, len = wiredConnecting.length; _i31 < len; _i31 += 1) {
6550
+ wiredConnecting[_i31]();
6414
6551
  }
6415
6552
  }
6416
6553
  function disconnectWireAdapters(vm) {
6417
6554
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6418
6555
  runWithBoundaryProtection(vm, vm, noop, function () {
6419
6556
  // job
6420
- for (var _i29 = 0, len = wiredDisconnecting.length; _i29 < len; _i29 += 1) {
6421
- wiredDisconnecting[_i29]();
6557
+ for (var _i32 = 0, len = wiredDisconnecting.length; _i32 < len; _i32 += 1) {
6558
+ wiredDisconnecting[_i32]();
6422
6559
  }
6423
6560
  }, noop);
6424
6561
  }
@@ -6657,8 +6794,8 @@
6657
6794
  var nextNode = node;
6658
6795
  var anchor = null;
6659
6796
  var renderer = owner.renderer;
6660
- for (var _i30 = 0; _i30 < children.length; _i30++) {
6661
- var childVnode = children[_i30];
6797
+ for (var _i33 = 0; _i33 < children.length; _i33++) {
6798
+ var childVnode = children[_i33];
6662
6799
  if (!isNull(childVnode)) {
6663
6800
  if (nextNode) {
6664
6801
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -6736,8 +6873,8 @@
6736
6873
  var nodesAreCompatible = true;
6737
6874
  // Validate attributes, though we could always recovery from those by running the update mods.
6738
6875
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6739
- for (var _i31 = 0, _Object$entries = Object.entries(attrs); _i31 < _Object$entries.length; _i31++) {
6740
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i31], 2),
6876
+ for (var _i34 = 0, _Object$entries = Object.entries(attrs); _i34 < _Object$entries.length; _i34++) {
6877
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i34], 2),
6741
6878
  attrName = _Object$entries$_i[0],
6742
6879
  attrValue = _Object$entries$_i[1];
6743
6880
  var owner = vnode.owner;
@@ -6838,8 +6975,8 @@
6838
6975
  var parsedVnodeStyle = parseStyleText(elmStyle);
6839
6976
  var expectedStyle = [];
6840
6977
  // styleMap is used when style is set to static value.
6841
- for (var _i32 = 0, n = styleDecls.length; _i32 < n; _i32++) {
6842
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i32], 3),
6978
+ for (var _i35 = 0, n = styleDecls.length; _i35 < n; _i35++) {
6979
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i35], 3),
6843
6980
  prop = _styleDecls$_i2[0],
6844
6981
  value = _styleDecls$_i2[1],
6845
6982
  important = _styleDecls$_i2[2];
@@ -7027,8 +7164,8 @@
7027
7164
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7028
7165
  function traverseStylesheets(stylesheets, callback) {
7029
7166
  callback(stylesheets);
7030
- for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
7031
- var stylesheet = stylesheets[_i33];
7167
+ for (var _i36 = 0; _i36 < stylesheets.length; _i36++) {
7168
+ var stylesheet = stylesheets[_i36];
7032
7169
  if (isArray$1(stylesheet)) {
7033
7170
  traverseStylesheets(stylesheet, callback);
7034
7171
  } else {
@@ -7141,7 +7278,7 @@
7141
7278
  }
7142
7279
  return ctor;
7143
7280
  }
7144
- /* version: 2.32.1 */
7281
+ /* version: 2.34.0 */
7145
7282
 
7146
7283
  /*
7147
7284
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7244,7 +7381,9 @@
7244
7381
  //
7245
7382
  // Test utilities
7246
7383
  //
7247
- if (process.env.NODE_ENV === 'development') {
7384
+ // Only used in LWC's Karma tests
7385
+ // @ts-ignore
7386
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7248
7387
  // @ts-ignore
7249
7388
  window.__lwcResetGlobalStylesheets = function () {
7250
7389
  stylesheetCache.clear();
@@ -8178,7 +8317,7 @@
8178
8317
  function isNull(obj) {
8179
8318
  return obj === null;
8180
8319
  }
8181
- /** version: 2.32.1 */
8320
+ /** version: 2.34.0 */
8182
8321
 
8183
8322
  /*
8184
8323
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8256,7 +8395,7 @@
8256
8395
  doc.body.innerHTML = html;
8257
8396
  var content = doc.body;
8258
8397
  if (!isUndefined(wrapperTags)) {
8259
- for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
8398
+ for (var _i37 = 0; _i37 < wrapperTags.length; _i37++) {
8260
8399
  content = content.firstChild;
8261
8400
  }
8262
8401
  }
@@ -8449,8 +8588,8 @@
8449
8588
  tagName: element.tagName.toLowerCase(),
8450
8589
  hydrated: true
8451
8590
  });
8452
- for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
8453
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
8591
+ for (var _i38 = 0, _Object$entries2 = Object.entries(props); _i38 < _Object$entries2.length; _i38++) {
8592
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i38], 2),
8454
8593
  key = _Object$entries2$_i[0],
8455
8594
  value = _Object$entries2$_i[1];
8456
8595
  element[key] = value;
@@ -8744,7 +8883,7 @@
8744
8883
  });
8745
8884
  freeze(LightningElement);
8746
8885
  seal(LightningElement.prototype);
8747
- /* version: 2.32.1 */
8886
+ /* version: 2.34.0 */
8748
8887
 
8749
8888
  exports.LightningElement = LightningElement;
8750
8889
  exports.__unstable__ProfilerControl = profilerControl;