lwc 2.32.0 → 2.32.1

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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +222 -249
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +222 -249
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +94 -145
  5. package/dist/engine-dom/iife/es5/engine-dom.js +211 -226
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +120 -183
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +222 -249
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +94 -145
  11. package/dist/engine-dom/umd/es5/engine-dom.js +211 -226
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +120 -183
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +218 -224
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +218 -224
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +85 -345
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +85 -345
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +85 -345
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +85 -345
  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 +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -4,8 +4,6 @@ var LWC = (function (exports) {
4
4
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf2(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
5
5
  function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
6
6
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
7
- function _get2() { if (typeof Reflect !== "undefined" && Reflect.get) { _get2 = Reflect.get.bind(); } else { _get2 = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get2.apply(this, arguments); }
8
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
9
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
8
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
9
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
@@ -346,9 +344,9 @@ var LWC = (function (exports) {
346
344
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
347
345
  */
348
346
  // Increment whenever the LWC template compiler changes
349
- var LWC_VERSION = "2.32.0";
347
+ var LWC_VERSION = "2.32.1";
350
348
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
351
- /** version: 2.32.0 */
349
+ /** version: 2.32.1 */
352
350
 
353
351
  /**
354
352
  * Copyright (C) 2018 salesforce.com, inc.
@@ -429,7 +427,7 @@ var LWC = (function (exports) {
429
427
  patch$1(propName);
430
428
  }
431
429
  }
432
- /** version: 2.32.0 */
430
+ /** version: 2.32.1 */
433
431
 
434
432
  /**
435
433
  * Copyright (C) 2018 salesforce.com, inc.
@@ -443,19 +441,14 @@ var LWC = (function (exports) {
443
441
  */
444
442
  var features = {
445
443
  DUMMY_TEST_FLAG: null,
446
- ENABLE_ELEMENT_PATCH: null,
447
444
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
448
- ENABLE_HTML_COLLECTIONS_PATCH: null,
449
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
450
445
  ENABLE_MIXED_SHADOW_MODE: null,
451
446
  ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
452
- ENABLE_NODE_LIST_PATCH: null,
453
- ENABLE_NODE_PATCH: null,
454
- ENABLE_REACTIVE_SETTER: null,
455
447
  ENABLE_WIRE_SYNC_EMIT: null,
456
448
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
457
449
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
458
- ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null
450
+ ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
451
+ ENABLE_FROZEN_TEMPLATE: null
459
452
  };
460
453
  if (!_globalThis.lwcRuntimeFlags) {
461
454
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -511,7 +504,7 @@ var LWC = (function (exports) {
511
504
  setFeatureFlag(name, value);
512
505
  }
513
506
  }
514
- /** version: 2.32.0 */
507
+ /** version: 2.32.1 */
515
508
 
516
509
  /*
517
510
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1099,7 +1092,7 @@ var LWC = (function (exports) {
1099
1092
  })
1100
1093
  };
1101
1094
  // Apply extra restriction related to DOM manipulation if the element is not a portal.
1102
- if (!options.isLight && !options.isPortal) {
1095
+ if (!options.isLight && options.isSynthetic && !options.isPortal) {
1103
1096
  var appendChild = elm.appendChild,
1104
1097
  insertBefore = elm.insertBefore,
1105
1098
  removeChild = elm.removeChild,
@@ -2495,56 +2488,6 @@ var LWC = (function (exports) {
2495
2488
  configurable: true
2496
2489
  };
2497
2490
  }
2498
- var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2499
- _inherits(AccessorReactiveObserver, _ReactiveObserver);
2500
- var _super3 = _createSuper(AccessorReactiveObserver);
2501
- function AccessorReactiveObserver(vm, set) {
2502
- var _this2;
2503
- _classCallCheck(this, AccessorReactiveObserver);
2504
- _this2 = _super3.call(this, function () {
2505
- if (isFalse(_this2.debouncing)) {
2506
- _this2.debouncing = true;
2507
- addCallbackToNextTick(function () {
2508
- if (isTrue(_this2.debouncing)) {
2509
- var _assertThisInitialize = _assertThisInitialized(_this2),
2510
- value = _assertThisInitialize.value;
2511
- var dirtyStateBeforeSetterCall = vm.isDirty,
2512
- component = vm.component,
2513
- _idx = vm.idx;
2514
- set.call(component, value);
2515
- // de-bouncing after the call to the original setter to prevent
2516
- // infinity loop if the setter itself is mutating things that
2517
- // were accessed during the previous invocation.
2518
- _this2.debouncing = false;
2519
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && _idx > 0) {
2520
- // immediate rehydration due to a setter driven mutation, otherwise
2521
- // the component will get rendered on the second tick, which it is not
2522
- // desirable.
2523
- rerenderVM(vm);
2524
- }
2525
- }
2526
- });
2527
- }
2528
- });
2529
- _this2.debouncing = false;
2530
- return _this2;
2531
- }
2532
- _createClass(AccessorReactiveObserver, [{
2533
- key: "reset",
2534
- value: function reset(value) {
2535
- _get2(_getPrototypeOf2(AccessorReactiveObserver.prototype), "reset", this).call(this);
2536
- this.debouncing = false;
2537
- if (arguments.length > 0) {
2538
- this.value = value;
2539
- }
2540
- }
2541
- }]);
2542
- return AccessorReactiveObserver;
2543
- }(ReactiveObserver);
2544
- function createAccessorReactiveObserver(vm, set) {
2545
- // On the server side, we don't need mutation tracking. Skipping it improves performance.
2546
- return new AccessorReactiveObserver(vm, set);
2547
- }
2548
2491
 
2549
2492
  /*
2550
2493
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2586,13 +2529,13 @@ var LWC = (function (exports) {
2586
2529
  };
2587
2530
  }
2588
2531
  function createPublicAccessorDescriptor(key, descriptor) {
2589
- var _get3 = descriptor.get,
2532
+ var _get2 = descriptor.get,
2590
2533
  _set2 = descriptor.set,
2591
2534
  enumerable = descriptor.enumerable,
2592
2535
  configurable = descriptor.configurable;
2593
- if (!isFunction$1(_get3)) {
2536
+ if (!isFunction$1(_get2)) {
2594
2537
  if (process.env.NODE_ENV !== 'production') {
2595
- assert.invariant(isFunction$1(_get3), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
2538
+ assert.invariant(isFunction$1(_get2), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
2596
2539
  }
2597
2540
  throw new Error();
2598
2541
  }
@@ -2602,10 +2545,9 @@ var LWC = (function (exports) {
2602
2545
  // Assert that the this value is an actual Component with an associated VM.
2603
2546
  getAssociatedVM(this);
2604
2547
  }
2605
- return _get3.call(this);
2548
+ return _get2.call(this);
2606
2549
  },
2607
2550
  set: function set(newValue) {
2608
- var _this3 = this;
2609
2551
  var vm = getAssociatedVM(this);
2610
2552
  if (process.env.NODE_ENV !== 'production') {
2611
2553
  var _vmBeingRendered4 = getVMBeingRendered();
@@ -2613,22 +2555,7 @@ var LWC = (function (exports) {
2613
2555
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2614
2556
  }
2615
2557
  if (_set2) {
2616
- if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2617
- var ro = vm.oar[key];
2618
- if (isUndefined$1(ro)) {
2619
- ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2620
- }
2621
- // every time we invoke this setter from outside (through this wrapper setter)
2622
- // we should reset the value and then debounce just in case there is a pending
2623
- // invocation the next tick that is not longer relevant since the value is changing
2624
- // from outside.
2625
- ro.reset(newValue);
2626
- ro.observe(function () {
2627
- _set2.call(_this3, newValue);
2628
- });
2629
- } else {
2630
- _set2.call(this, newValue);
2631
- }
2558
+ _set2.call(this, newValue);
2632
2559
  } else if (process.env.NODE_ENV !== 'production') {
2633
2560
  assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
2634
2561
  }
@@ -2967,13 +2894,6 @@ var LWC = (function (exports) {
2967
2894
  }
2968
2895
  }
2969
2896
  }
2970
-
2971
- /*
2972
- * Copyright (c) 2018, salesforce.com, inc.
2973
- * All rights reserved.
2974
- * SPDX-License-Identifier: MIT
2975
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2976
- */
2977
2897
  var signedTemplateSet = new Set();
2978
2898
  function defaultEmptyTemplate() {
2979
2899
  return [];
@@ -2991,32 +2911,6 @@ var LWC = (function (exports) {
2991
2911
  checkVersionMismatch(tpl, 'template');
2992
2912
  }
2993
2913
  signedTemplateSet.add(tpl);
2994
- // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2995
- // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2996
- // on top of stylesheetToken for anyone who is accessing the old internal API.
2997
- // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2998
- defineProperty(tpl, 'stylesheetTokens', {
2999
- enumerable: true,
3000
- configurable: true,
3001
- get: function get() {
3002
- var stylesheetToken = this.stylesheetToken;
3003
- if (isUndefined$1(stylesheetToken)) {
3004
- return stylesheetToken;
3005
- }
3006
- // Shim for the old `stylesheetTokens` property
3007
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
3008
- return {
3009
- hostAttribute: "".concat(stylesheetToken, "-host"),
3010
- shadowAttribute: stylesheetToken
3011
- };
3012
- },
3013
- set: function set(value) {
3014
- // If the value is null or some other exotic object, you would be broken anyway in the past
3015
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
3016
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
3017
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
3018
- }
3019
- });
3020
2914
  // chaining this method as a way to wrap existing
3021
2915
  // assignment of templates easily, without too much transformation
3022
2916
  return tpl;
@@ -3117,10 +3011,10 @@ var LWC = (function (exports) {
3117
3011
  if (isFunction$1(SuperClass)) {
3118
3012
  HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
3119
3013
  _inherits(HTMLBridgeElement, _SuperClass);
3120
- var _super4 = _createSuper(HTMLBridgeElement);
3014
+ var _super3 = _createSuper(HTMLBridgeElement);
3121
3015
  function HTMLBridgeElement() {
3122
3016
  _classCallCheck(this, HTMLBridgeElement);
3123
- return _super4.apply(this, arguments);
3017
+ return _super3.apply(this, arguments);
3124
3018
  }
3125
3019
  return _createClass(HTMLBridgeElement);
3126
3020
  }(SuperClass);
@@ -4518,11 +4412,13 @@ var LWC = (function (exports) {
4518
4412
  function applyElementRestrictions(elm, vnode) {
4519
4413
  var _a, _b;
4520
4414
  if (process.env.NODE_ENV !== 'production') {
4415
+ var isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
4521
4416
  var isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4522
4417
  var isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4523
4418
  patchElementWithRestrictions(elm, {
4524
4419
  isPortal: isPortal,
4525
- isLight: isLight
4420
+ isLight: isLight,
4421
+ isSynthetic: isSynthetic
4526
4422
  });
4527
4423
  }
4528
4424
  }
@@ -4926,7 +4822,7 @@ var LWC = (function (exports) {
4926
4822
  // undefined is for root components, but root components cannot accept slotted content
4927
4823
  setVMBeingRendered(slotset.owner);
4928
4824
  try {
4929
- ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
4825
+ ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
4930
4826
  } finally {
4931
4827
  setVMBeingRendered(vmBeingRenderedInception);
4932
4828
  }
@@ -5812,14 +5708,9 @@ var LWC = (function (exports) {
5812
5708
  function resetComponentStateWhenRemoved(vm) {
5813
5709
  var state = vm.state;
5814
5710
  if (state !== 2 /* VMState.disconnected */) {
5815
- var oar = vm.oar,
5816
- tro = vm.tro;
5711
+ var tro = vm.tro;
5817
5712
  // Making sure that any observing record will not trigger the rehydrated on this vm
5818
5713
  tro.reset();
5819
- // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5820
- for (var key in oar) {
5821
- oar[key].reset();
5822
- }
5823
5714
  runDisconnectedCallback(vm);
5824
5715
  // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5825
5716
  runChildNodesDisconnectedCallback(vm);
@@ -5870,7 +5761,6 @@ var LWC = (function (exports) {
5870
5761
  cmpSlots: {
5871
5762
  slotAssignments: create(null)
5872
5763
  },
5873
- oar: create(null),
5874
5764
  cmpTemplate: null,
5875
5765
  hydrated: Boolean(hydrated),
5876
5766
  renderMode: def.renderMode,
@@ -6262,17 +6152,17 @@ var LWC = (function (exports) {
6262
6152
  var WireMetaMap = new Map();
6263
6153
  var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
6264
6154
  _inherits(WireContextRegistrationEvent, _CustomEvent);
6265
- var _super5 = _createSuper(WireContextRegistrationEvent);
6155
+ var _super4 = _createSuper(WireContextRegistrationEvent);
6266
6156
  function WireContextRegistrationEvent(adapterToken, _ref4) {
6267
- var _this4;
6157
+ var _this2;
6268
6158
  var setNewContext = _ref4.setNewContext,
6269
6159
  setDisconnectedCallback = _ref4.setDisconnectedCallback;
6270
6160
  _classCallCheck(this, WireContextRegistrationEvent);
6271
- _this4 = _super5.call(this, adapterToken, {
6161
+ _this2 = _super4.call(this, adapterToken, {
6272
6162
  bubbles: true,
6273
6163
  composed: true
6274
6164
  });
6275
- defineProperties(_assertThisInitialized(_this4), {
6165
+ defineProperties(_assertThisInitialized(_this2), {
6276
6166
  setNewContext: {
6277
6167
  value: setNewContext
6278
6168
  },
@@ -6280,7 +6170,7 @@ var LWC = (function (exports) {
6280
6170
  value: setDisconnectedCallback
6281
6171
  }
6282
6172
  });
6283
- return _this4;
6173
+ return _this2;
6284
6174
  }
6285
6175
  return _createClass(WireContextRegistrationEvent);
6286
6176
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
@@ -7031,6 +6921,10 @@ var LWC = (function (exports) {
7031
6921
  var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7032
6922
  // Via https://www.npmjs.com/package/object-observer
7033
6923
  var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
6924
+ // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
6925
+ var STYLESHEET_FUNCTION_EXPANDOS = [
6926
+ // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
6927
+ '$scoped$'];
7034
6928
  function getOriginalArrayMethod(prop) {
7035
6929
  switch (prop) {
7036
6930
  case 'pop':
@@ -7054,7 +6948,7 @@ var LWC = (function (exports) {
7054
6948
  }
7055
6949
  }
7056
6950
  var mutationWarningsSilenced = false;
7057
- // Warn if the user tries to mutate tmpl.stylesheets, e.g.:
6951
+ // Warn if the user tries to mutate a stylesheets array, e.g.:
7058
6952
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7059
6953
  function warnOnArrayMutation(stylesheets) {
7060
6954
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
@@ -7080,54 +6974,145 @@ var LWC = (function (exports) {
7080
6974
  _iterator4.f();
7081
6975
  }
7082
6976
  }
7083
- // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
7084
- // just warns on mutation.
6977
+ // Warn if the user tries to mutate a stylesheet factory function, e.g.:
6978
+ // `stylesheet.$scoped$ = true`
6979
+ function warnOnStylesheetFunctionMutation(stylesheet) {
6980
+ // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
6981
+ var _iterator5 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
6982
+ _step5;
6983
+ try {
6984
+ var _loop3 = function _loop3() {
6985
+ var prop = _step5.value;
6986
+ var value = stylesheet[prop];
6987
+ defineProperty(stylesheet, prop, {
6988
+ enumerable: true,
6989
+ configurable: true,
6990
+ get: function get() {
6991
+ return value;
6992
+ },
6993
+ set: function set(newValue) {
6994
+ logError("Dynamically setting the \"".concat(prop, "\" property on a stylesheet function ") + "is deprecated and may be removed in a future version of LWC.");
6995
+ value = newValue;
6996
+ }
6997
+ });
6998
+ };
6999
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
7000
+ _loop3();
7001
+ }
7002
+ } catch (err) {
7003
+ _iterator5.e(err);
7004
+ } finally {
7005
+ _iterator5.f();
7006
+ }
7007
+ }
7008
+ // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7009
+ function warnOnStylesheetsMutation(stylesheets) {
7010
+ traverseStylesheets(stylesheets, function (subStylesheets) {
7011
+ if (isArray$1(subStylesheets)) {
7012
+ warnOnArrayMutation(subStylesheets);
7013
+ } else {
7014
+ warnOnStylesheetFunctionMutation(subStylesheets);
7015
+ }
7016
+ });
7017
+ }
7018
+ // Deeply freeze the entire array (of arrays) of stylesheet factory functions
7019
+ function deepFreeze(stylesheets) {
7020
+ traverseStylesheets(stylesheets, function (subStylesheets) {
7021
+ freeze(subStylesheets);
7022
+ });
7023
+ }
7024
+ // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7025
+ function traverseStylesheets(stylesheets, callback) {
7026
+ callback(stylesheets);
7027
+ for (var _i33 = 0; _i33 < stylesheets.length; _i33++) {
7028
+ var stylesheet = stylesheets[_i33];
7029
+ if (isArray$1(stylesheet)) {
7030
+ traverseStylesheets(stylesheet, callback);
7031
+ } else {
7032
+ callback(stylesheet);
7033
+ }
7034
+ }
7035
+ }
7085
7036
  function freezeTemplate(tmpl) {
7086
- if (process.env.NODE_ENV !== 'production') {
7037
+ if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7038
+ // Deep freeze the template
7039
+ freeze(tmpl);
7087
7040
  if (!isUndefined$1(tmpl.stylesheets)) {
7088
- warnOnArrayMutation(tmpl.stylesheets);
7089
- }
7090
- var _iterator5 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7091
- _step5;
7092
- try {
7093
- var _loop3 = function _loop3() {
7094
- var prop = _step5.value;
7095
- var value = tmpl[prop];
7096
- defineProperty(tmpl, prop, {
7097
- enumerable: true,
7098
- configurable: true,
7099
- get: function get() {
7100
- return value;
7101
- },
7102
- set: function set(newValue) {
7103
- if (!mutationWarningsSilenced) {
7104
- logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7105
- }
7106
- value = newValue;
7107
- }
7108
- });
7109
- };
7110
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
7111
- _loop3();
7112
- }
7113
- } catch (err) {
7114
- _iterator5.e(err);
7115
- } finally {
7116
- _iterator5.f();
7041
+ deepFreeze(tmpl.stylesheets);
7117
7042
  }
7118
- var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7043
+ } else {
7044
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7045
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7046
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7119
7047
  defineProperty(tmpl, 'stylesheetTokens', {
7120
7048
  enumerable: true,
7121
7049
  configurable: true,
7122
- get: originalDescriptor.get,
7050
+ get: function get() {
7051
+ var stylesheetToken = this.stylesheetToken;
7052
+ if (isUndefined$1(stylesheetToken)) {
7053
+ return stylesheetToken;
7054
+ }
7055
+ // Shim for the old `stylesheetTokens` property
7056
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7057
+ return {
7058
+ hostAttribute: "".concat(stylesheetToken, "-host"),
7059
+ shadowAttribute: stylesheetToken
7060
+ };
7061
+ },
7123
7062
  set: function set(value) {
7124
- logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7125
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7126
- mutationWarningsSilenced = true;
7127
- originalDescriptor.set.call(this, value);
7128
- mutationWarningsSilenced = false;
7063
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7064
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7065
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7066
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7129
7067
  }
7130
7068
  });
7069
+ // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7070
+ if (process.env.NODE_ENV !== 'production') {
7071
+ if (!isUndefined$1(tmpl.stylesheets)) {
7072
+ warnOnStylesheetsMutation(tmpl.stylesheets);
7073
+ }
7074
+ var _iterator6 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7075
+ _step6;
7076
+ try {
7077
+ var _loop4 = function _loop4() {
7078
+ var prop = _step6.value;
7079
+ var value = tmpl[prop];
7080
+ defineProperty(tmpl, prop, {
7081
+ enumerable: true,
7082
+ configurable: true,
7083
+ get: function get() {
7084
+ return value;
7085
+ },
7086
+ set: function set(newValue) {
7087
+ if (!mutationWarningsSilenced) {
7088
+ logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7089
+ }
7090
+ value = newValue;
7091
+ }
7092
+ });
7093
+ };
7094
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7095
+ _loop4();
7096
+ }
7097
+ } catch (err) {
7098
+ _iterator6.e(err);
7099
+ } finally {
7100
+ _iterator6.f();
7101
+ }
7102
+ var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7103
+ defineProperty(tmpl, 'stylesheetTokens', {
7104
+ enumerable: true,
7105
+ configurable: true,
7106
+ get: originalDescriptor.get,
7107
+ set: function set(value) {
7108
+ logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7109
+ // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7110
+ mutationWarningsSilenced = true;
7111
+ originalDescriptor.set.call(this, value);
7112
+ mutationWarningsSilenced = false;
7113
+ }
7114
+ });
7115
+ }
7131
7116
  }
7132
7117
  }
7133
7118
 
@@ -7153,7 +7138,7 @@ var LWC = (function (exports) {
7153
7138
  }
7154
7139
  return ctor;
7155
7140
  }
7156
- /* version: 2.32.0 */
7141
+ /* version: 2.32.1 */
7157
7142
 
7158
7143
  /*
7159
7144
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7390,10 +7375,10 @@ var LWC = (function (exports) {
7390
7375
  // which are not equipped to be initialized that way.
7391
7376
  var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
7392
7377
  _inherits(clazz, _HTMLElementAlias);
7393
- var _super6 = _createSuper(clazz);
7378
+ var _super5 = _createSuper(clazz);
7394
7379
  function clazz() {
7395
7380
  _classCallCheck(this, clazz);
7396
- return _super6.apply(this, arguments);
7381
+ return _super5.apply(this, arguments);
7397
7382
  }
7398
7383
  return _createClass(clazz);
7399
7384
  }(HTMLElementAlias);
@@ -7439,24 +7424,24 @@ var LWC = (function (exports) {
7439
7424
  // TODO [#2972]: this class should expose observedAttributes as necessary
7440
7425
  var UpgradableConstructor = /*#__PURE__*/function (_HTMLElement) {
7441
7426
  _inherits(UpgradableConstructor, _HTMLElement);
7442
- var _super7 = _createSuper(UpgradableConstructor);
7427
+ var _super6 = _createSuper(UpgradableConstructor);
7443
7428
  function UpgradableConstructor(upgradeCallback) {
7444
- var _this5;
7429
+ var _this3;
7445
7430
  _classCallCheck(this, UpgradableConstructor);
7446
- _this5 = _super7.call(this);
7431
+ _this3 = _super6.call(this);
7447
7432
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
7448
7433
  // then elementBeingUpgraded will be false
7449
7434
  if (elementBeingUpgradedByLWC) {
7450
- upgradeCallback(_assertThisInitialized(_this5));
7435
+ upgradeCallback(_assertThisInitialized(_this3));
7451
7436
  } else if (hasConnectedCallback || hasDisconnectedCallback) {
7452
7437
  // If this element has connected or disconnected callbacks, then we need to keep track of
7453
7438
  // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
7454
7439
  // If the element has no connected or disconnected callbacks, then we don't need to track this.
7455
- elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this5));
7440
+ elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this3));
7456
7441
  // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
7457
7442
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
7458
7443
  }
7459
- return _this5;
7444
+ return _this3;
7460
7445
  }
7461
7446
  return _createClass(UpgradableConstructor);
7462
7447
  }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
@@ -7565,9 +7550,9 @@ var LWC = (function (exports) {
7565
7550
  function createPivotingClass(tagName, registeredDefinition) {
7566
7551
  var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
7567
7552
  _inherits(PivotCtor, _NativeHTMLElement);
7568
- var _super8 = _createSuper(PivotCtor);
7553
+ var _super7 = _createSuper(PivotCtor);
7569
7554
  function PivotCtor(UserCtor) {
7570
- var _this6;
7555
+ var _this4;
7571
7556
  _classCallCheck(this, PivotCtor);
7572
7557
  // This constructor can only be invoked by:
7573
7558
  // a) the browser instantiating an element from parsing or via document.createElement.
@@ -7577,7 +7562,7 @@ var LWC = (function (exports) {
7577
7562
  // If the caller signals via UserCtor that this is in fact a controlled
7578
7563
  // definition, we use that one, otherwise fallback to the global
7579
7564
  // internal registry.
7580
- _this6 = _super8.call(this);
7565
+ _this4 = _super7.call(this);
7581
7566
  var userCtorIsDefined = !isUndefined$1(UserCtor);
7582
7567
  if (userCtorIsDefined) {
7583
7568
  if (!isConstructor(UserCtor)) {
@@ -7589,15 +7574,15 @@ var LWC = (function (exports) {
7589
7574
  }
7590
7575
  var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
7591
7576
  if (!isUndefined$1(definition)) {
7592
- internalUpgrade(_assertThisInitialized(_this6), registeredDefinition, definition);
7577
+ internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
7593
7578
  } else {
7594
7579
  // This is the case in which there is no global definition, and
7595
7580
  // it is not handled by LWC (otherwise it will have a valid UserCtor)
7596
7581
  // so we need to add it to the pending queue just in case it eventually
7597
7582
  // gets defined in the global registry.
7598
- pendingRegistryForElement.set(_assertThisInitialized(_this6), registeredDefinition);
7583
+ pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
7599
7584
  }
7600
- return _this6;
7585
+ return _this4;
7601
7586
  }
7602
7587
  _createClass(PivotCtor, [{
7603
7588
  key: "connectedCallback",
@@ -7835,17 +7820,17 @@ var LWC = (function (exports) {
7835
7820
  function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7836
7821
  var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7837
7822
  if (!isUndefined$1(resolvers)) {
7838
- var _iterator6 = _createForOfIteratorHelper(resolvers),
7839
- _step6;
7823
+ var _iterator7 = _createForOfIteratorHelper(resolvers),
7824
+ _step7;
7840
7825
  try {
7841
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7842
- var resolver = _step6.value;
7826
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7827
+ var resolver = _step7.value;
7843
7828
  resolver(ctor);
7844
7829
  }
7845
7830
  } catch (err) {
7846
- _iterator6.e(err);
7831
+ _iterator7.e(err);
7847
7832
  } finally {
7848
- _iterator6.f();
7833
+ _iterator7.f();
7849
7834
  }
7850
7835
  }
7851
7836
  pendingWhenDefinedCallbacks.delete(tagName);
@@ -7895,11 +7880,11 @@ var LWC = (function (exports) {
7895
7880
  var awaiting = awaitingUpgrade.get(tagName);
7896
7881
  if (!isUndefined$1(awaiting)) {
7897
7882
  awaitingUpgrade.delete(tagName);
7898
- var _iterator7 = _createForOfIteratorHelper(awaiting),
7899
- _step7;
7883
+ var _iterator8 = _createForOfIteratorHelper(awaiting),
7884
+ _step8;
7900
7885
  try {
7901
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7902
- var element = _step7.value;
7886
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7887
+ var element = _step8.value;
7903
7888
  var registeredDefinition = pendingRegistryForElement.get(element);
7904
7889
  // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7905
7890
  // is only populated when we haven't run internalUpgrade yet, and we only populate
@@ -7911,9 +7896,9 @@ var LWC = (function (exports) {
7911
7896
  }
7912
7897
  }
7913
7898
  } catch (err) {
7914
- _iterator7.e(err);
7899
+ _iterator8.e(err);
7915
7900
  } finally {
7916
- _iterator7.f();
7901
+ _iterator8.f();
7917
7902
  }
7918
7903
  }
7919
7904
  // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
@@ -8061,13 +8046,13 @@ var LWC = (function (exports) {
8061
8046
  // TODO [#2972]: this class should expose observedAttributes as necessary
8062
8047
  return /*#__PURE__*/function (_HTMLElementToExtend) {
8063
8048
  _inherits(UserConstructor, _HTMLElementToExtend);
8064
- var _super9 = _createSuper(UserConstructor);
8049
+ var _super8 = _createSuper(UserConstructor);
8065
8050
  function UserConstructor() {
8066
- var _this7;
8051
+ var _this5;
8067
8052
  _classCallCheck(this, UserConstructor);
8068
- _this7 = _super9.call(this);
8069
- upgradeCallback(_assertThisInitialized(_this7));
8070
- return _this7;
8053
+ _this5 = _super8.call(this);
8054
+ upgradeCallback(_assertThisInitialized(_this5));
8055
+ return _this5;
8071
8056
  }
8072
8057
  // Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
8073
8058
  // here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
@@ -8190,7 +8175,7 @@ var LWC = (function (exports) {
8190
8175
  function isNull(obj) {
8191
8176
  return obj === null;
8192
8177
  }
8193
- /** version: 2.32.0 */
8178
+ /** version: 2.32.1 */
8194
8179
 
8195
8180
  /*
8196
8181
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8249,17 +8234,17 @@ var LWC = (function (exports) {
8249
8234
  exports.createFragment = function (html) {
8250
8235
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8251
8236
  if (!isUndefined(wrapperTags)) {
8252
- var _iterator8 = _createForOfIteratorHelper(wrapperTags),
8253
- _step8;
8237
+ var _iterator9 = _createForOfIteratorHelper(wrapperTags),
8238
+ _step9;
8254
8239
  try {
8255
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
8256
- var wrapperTag = _step8.value;
8240
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
8241
+ var wrapperTag = _step9.value;
8257
8242
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8258
8243
  }
8259
8244
  } catch (err) {
8260
- _iterator8.e(err);
8245
+ _iterator9.e(err);
8261
8246
  } finally {
8262
- _iterator8.f();
8247
+ _iterator9.f();
8263
8248
  }
8264
8249
  }
8265
8250
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -8268,7 +8253,7 @@ var LWC = (function (exports) {
8268
8253
  doc.body.innerHTML = html;
8269
8254
  var content = doc.body;
8270
8255
  if (!isUndefined(wrapperTags)) {
8271
- for (var _i33 = 0; _i33 < wrapperTags.length; _i33++) {
8256
+ for (var _i34 = 0; _i34 < wrapperTags.length; _i34++) {
8272
8257
  content = content.firstChild;
8273
8258
  }
8274
8259
  }
@@ -8461,8 +8446,8 @@ var LWC = (function (exports) {
8461
8446
  tagName: element.tagName.toLowerCase(),
8462
8447
  hydrated: true
8463
8448
  });
8464
- for (var _i34 = 0, _Object$entries2 = Object.entries(props); _i34 < _Object$entries2.length; _i34++) {
8465
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i34], 2),
8449
+ for (var _i35 = 0, _Object$entries2 = Object.entries(props); _i35 < _Object$entries2.length; _i35++) {
8450
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i35], 2),
8466
8451
  key = _Object$entries2$_i[0],
8467
8452
  value = _Object$entries2$_i[1];
8468
8453
  element[key] = value;
@@ -8539,23 +8524,23 @@ var LWC = (function (exports) {
8539
8524
  var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
8540
8525
  return _a = /*#__PURE__*/function (_HTMLElement2) {
8541
8526
  _inherits(_a, _HTMLElement2);
8542
- var _super10 = _createSuper(_a);
8527
+ var _super9 = _createSuper(_a);
8543
8528
  function _a() {
8544
- var _this8;
8529
+ var _this6;
8545
8530
  _classCallCheck(this, _a);
8546
- _this8 = _super10.call(this);
8547
- if (_this8.isConnected) {
8531
+ _this6 = _super9.call(this);
8532
+ if (_this6.isConnected) {
8548
8533
  // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
8549
- hydrateComponent(_assertThisInitialized(_this8), Ctor, {});
8550
- hydratedCustomElements.add(_assertThisInitialized(_this8));
8534
+ hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
8535
+ hydratedCustomElements.add(_assertThisInitialized(_this6));
8551
8536
  } else {
8552
- createVM(_assertThisInitialized(_this8), Ctor, renderer, {
8537
+ createVM(_assertThisInitialized(_this6), Ctor, renderer, {
8553
8538
  mode: 'open',
8554
8539
  owner: null,
8555
- tagName: _this8.tagName
8540
+ tagName: _this6.tagName
8556
8541
  });
8557
8542
  }
8558
- return _this8;
8543
+ return _this6;
8559
8544
  }
8560
8545
  _createClass(_a, [{
8561
8546
  key: "connectedCallback",
@@ -8756,7 +8741,7 @@ var LWC = (function (exports) {
8756
8741
  });
8757
8742
  freeze(LightningElement);
8758
8743
  seal(LightningElement.prototype);
8759
- /* version: 2.32.0 */
8744
+ /* version: 2.32.1 */
8760
8745
 
8761
8746
  exports.LightningElement = LightningElement;
8762
8747
  exports.__unstable__ProfilerControl = profilerControl;