lwc 2.36.0 → 2.37.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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +26 -576
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +26 -576
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +18 -568
  5. package/dist/engine-dom/iife/es5/engine-dom.js +38 -654
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +30 -646
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +26 -576
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +18 -568
  11. package/dist/engine-dom/umd/es5/engine-dom.js +38 -654
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +30 -646
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +38 -24
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +38 -25
  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_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -327,9 +327,9 @@ var LWC = (function (exports) {
327
327
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
328
328
  */
329
329
  // Increment whenever the LWC template compiler changes
330
- var LWC_VERSION = "2.36.0";
330
+ var LWC_VERSION = "2.37.0";
331
331
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
332
- /** version: 2.36.0 */
332
+ /** version: 2.37.0 */
333
333
 
334
334
  /**
335
335
  * Copyright (C) 2018 salesforce.com, inc.
@@ -349,10 +349,8 @@ var LWC = (function (exports) {
349
349
  ENABLE_WIRE_SYNC_EMIT: null,
350
350
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
351
351
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
352
- ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
353
352
  ENABLE_FROZEN_TEMPLATE: null,
354
- DISABLE_ARIA_REFLECTION_POLYFILL: null,
355
- ENABLE_PROGRAMMATIC_STYLESHEETS: null
353
+ DISABLE_ARIA_REFLECTION_POLYFILL: null
356
354
  };
357
355
  if (!_globalThis.lwcRuntimeFlags) {
358
356
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -410,7 +408,7 @@ var LWC = (function (exports) {
410
408
  setFeatureFlag(name, value);
411
409
  }
412
410
  }
413
- /** version: 2.36.0 */
411
+ /** version: 2.37.0 */
414
412
 
415
413
  /**
416
414
  * Copyright (C) 2018 salesforce.com, inc.
@@ -474,7 +472,7 @@ var LWC = (function (exports) {
474
472
  }
475
473
  }
476
474
  }
477
- /** version: 2.36.0 */
475
+ /** version: 2.37.0 */
478
476
 
479
477
  /*
480
478
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6254,16 +6252,14 @@ var LWC = (function (exports) {
6254
6252
  }
6255
6253
  // Validate and flatten any stylesheets defined as `static stylesheets`
6256
6254
  function computeStylesheets(vm, ctor) {
6257
- if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6258
- warnOnStylesheetsMutation(ctor);
6259
- var stylesheets = ctor.stylesheets;
6260
- if (!isUndefined$1(stylesheets)) {
6261
- var valid = validateComponentStylesheets(vm, stylesheets);
6262
- if (valid) {
6263
- return flattenStylesheets(stylesheets);
6264
- } else if (process.env.NODE_ENV !== 'production') {
6265
- logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
6266
- }
6255
+ warnOnStylesheetsMutation(ctor);
6256
+ var stylesheets = ctor.stylesheets;
6257
+ if (!isUndefined$1(stylesheets)) {
6258
+ var valid = validateComponentStylesheets(vm, stylesheets);
6259
+ if (valid) {
6260
+ return flattenStylesheets(stylesheets);
6261
+ } else if (process.env.NODE_ENV !== 'production') {
6262
+ logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
6267
6263
  }
6268
6264
  }
6269
6265
  return null;
@@ -6627,7 +6623,7 @@ var LWC = (function (exports) {
6627
6623
  // The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
6628
6624
  // These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
6629
6625
  // When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
6630
- // See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
6626
+ // See: https://sfdc.co/synthetic-aria
6631
6627
  //
6632
6628
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6633
6629
  var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
@@ -6652,7 +6648,7 @@ var LWC = (function (exports) {
6652
6648
  });
6653
6649
  if (process.env.NODE_ENV !== 'production') {
6654
6650
  // Avoid excessively logging to the console in the case of duplicates.
6655
- logWarnOnce("Element <".concat(source.tagName.toLowerCase(), "> uses attribute \"").concat(attrName, "\" to reference element ") + "<".concat(target.tagName.toLowerCase(), ">, which is not in the same shadow root. This will break in native shadow DOM. ") + "For details, see: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates", vm);
6651
+ logWarnOnce("Element <".concat(source.tagName.toLowerCase(), "> uses attribute \"").concat(attrName, "\" to reference element ") + "<".concat(target.tagName.toLowerCase(), ">, which is not in the same shadow root. This will break in native shadow DOM. ") + "For details, see: https://sfdc.co/synthetic-aria", vm);
6656
6652
  }
6657
6653
  }
6658
6654
  function parseIdRefAttributeValue(attrValue) {
@@ -6823,7 +6819,7 @@ var LWC = (function (exports) {
6823
6819
  if (!isLightningElement(elm)) {
6824
6820
  var vm = findVM(elm);
6825
6821
  if (process.env.NODE_ENV !== 'production') {
6826
- logWarnOnce("Element <".concat(elm.tagName.toLowerCase(), "> ") + (isUndefined$1(vm) ? '' : "owned by <".concat(vm.elm.tagName.toLowerCase(), "> ")) + "uses non-standard property \"".concat(prop, "\". This will be removed in a future version of LWC. ") + "See https://lwc.dev/guide/accessibility#deprecated-aria-reflected-properties");
6822
+ logWarnOnce("Element <".concat(elm.tagName.toLowerCase(), "> ") + (isUndefined$1(vm) ? '' : "owned by <".concat(vm.elm.tagName.toLowerCase(), "> ")) + "uses non-standard property \"".concat(prop, "\". This will be removed in a future version of LWC. ") + "See https://sfdc.co/deprecated-aria");
6827
6823
  }
6828
6824
  report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6829
6825
  tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
@@ -7417,7 +7413,7 @@ var LWC = (function (exports) {
7417
7413
  }
7418
7414
  function reportViolation(type, eventId, prop) {
7419
7415
  if (process.env.NODE_ENV !== 'production') {
7420
- logWarnOnce("Mutating the \"".concat(prop, "\" property on a ").concat(type, " ") + "is deprecated and will be removed in a future version of LWC. " + "See: https://lwc.dev/guide/css#deprecated-template-mutation");
7416
+ logWarnOnce("Mutating the \"".concat(prop, "\" property on a ").concat(type, " ") + "is deprecated and will be removed in a future version of LWC. " + "See: https://sfdc.co/template-mutation");
7421
7417
  }
7422
7418
  report(eventId, {
7423
7419
  propertyName: prop
@@ -7631,7 +7627,7 @@ var LWC = (function (exports) {
7631
7627
  }
7632
7628
  return ctor;
7633
7629
  }
7634
- /* version: 2.36.0 */
7630
+ /* version: 2.37.0 */
7635
7631
 
7636
7632
  /*
7637
7633
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7975,610 +7971,6 @@ var LWC = (function (exports) {
7975
7971
  }
7976
7972
  };
7977
7973
 
7978
- /*
7979
- * Copyright (c) 2020, salesforce.com, inc.
7980
- * All rights reserved.
7981
- * SPDX-License-Identifier: MIT
7982
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7983
- */
7984
- /**
7985
- * Create a scoped registry, i.e. a function that can create custom elements whose tag names
7986
- * do not conflict with third-party custom elements having the same tag name.
7987
- */
7988
- function createScopedRegistry() {
7989
- if (!hasCustomElements) {
7990
- // This code should never be reached, because we don't use the pivot registry if
7991
- // custom elements are unavailable.
7992
- throw new Error('Custom elements are not supported in this environment.');
7993
- }
7994
- var _window = window,
7995
- NativeHTMLElement = _window.HTMLElement;
7996
- var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
7997
- nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
7998
- nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
7999
- nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
8000
- nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
8001
- var definitionForElement = new WeakMap();
8002
- var pendingRegistryForElement = new WeakMap();
8003
- var definitionForConstructor = new WeakMap();
8004
- var registeredUserCtors = new WeakSet();
8005
- var registeredPivotCtors = new WeakSet();
8006
- var pivotCtorByTag = new Map();
8007
- var globalDefinitionsByTag = new Map();
8008
- var globalDefinitionsByClass = new Map();
8009
- var awaitingUpgrade = new Map();
8010
- var pendingWhenDefinedCallbacks = new Map();
8011
- var EMPTY_SET = new Set();
8012
- function createDefinitionRecord(constructor) {
8013
- var _a;
8014
- var _constructor$prototyp = constructor.prototype,
8015
- connectedCallback = _constructor$prototyp.connectedCallback,
8016
- disconnectedCallback = _constructor$prototyp.disconnectedCallback,
8017
- formAssociatedCallback = _constructor$prototyp.formAssociatedCallback,
8018
- formDisabledCallback = _constructor$prototyp.formDisabledCallback,
8019
- formResetCallback = _constructor$prototyp.formResetCallback,
8020
- formStateRestoreCallback = _constructor$prototyp.formStateRestoreCallback,
8021
- adoptedCallback = _constructor$prototyp.adoptedCallback,
8022
- attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
8023
- var formAssociated = Boolean(constructor.formAssociated);
8024
- var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
8025
- return {
8026
- UserCtor: constructor,
8027
- PivotCtor: undefined,
8028
- connectedCallback: connectedCallback,
8029
- disconnectedCallback: disconnectedCallback,
8030
- formAssociatedCallback: formAssociatedCallback,
8031
- formDisabledCallback: formDisabledCallback,
8032
- formResetCallback: formResetCallback,
8033
- formStateRestoreCallback: formStateRestoreCallback,
8034
- adoptedCallback: adoptedCallback,
8035
- attributeChangedCallback: attributeChangedCallback,
8036
- observedAttributes: observedAttributes,
8037
- formAssociated: formAssociated
8038
- };
8039
- }
8040
- // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
8041
- // element. Note that the `registeredDefinition` represents the constructor that was used to register during
8042
- // `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
8043
- // constructor is invoked with another constructor.
8044
- function createPivotingClass(tagName, registeredDefinition) {
8045
- var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
8046
- _inherits(PivotCtor, _NativeHTMLElement);
8047
- var _super7 = _createSuper(PivotCtor);
8048
- function PivotCtor(UserCtor) {
8049
- var _this4;
8050
- _classCallCheck(this, PivotCtor);
8051
- // This constructor can only be invoked by:
8052
- // a) the browser instantiating an element from parsing or via document.createElement.
8053
- // b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
8054
- // b) new UserClass.
8055
- // When LWC instantiates it, it will pass the upgrading definition as an argument
8056
- // If the caller signals via UserCtor that this is in fact a controlled
8057
- // definition, we use that one, otherwise fallback to the global
8058
- // internal registry.
8059
- _this4 = _super7.call(this);
8060
- var userCtorIsDefined = !isUndefined$1(UserCtor);
8061
- if (userCtorIsDefined) {
8062
- if (!isConstructor(UserCtor)) {
8063
- throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
8064
- }
8065
- if (!registeredUserCtors.has(UserCtor)) {
8066
- throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
8067
- }
8068
- }
8069
- var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
8070
- if (!isUndefined$1(definition)) {
8071
- internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
8072
- } else {
8073
- // This is the case in which there is no global definition, and
8074
- // it is not handled by LWC (otherwise it will have a valid UserCtor)
8075
- // so we need to add it to the pending queue just in case it eventually
8076
- // gets defined in the global registry.
8077
- pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
8078
- }
8079
- return _this4;
8080
- }
8081
- _createClass(PivotCtor, [{
8082
- key: "connectedCallback",
8083
- value: function connectedCallback() {
8084
- var _a;
8085
- var definition = definitionForElement.get(this);
8086
- if (!isUndefined$1(definition)) {
8087
- // Delegate out to user callback
8088
- (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8089
- } else {
8090
- // Register for upgrade when defined (only when connected, so we don't leak)
8091
- var awaiting = awaitingUpgrade.get(tagName);
8092
- if (isUndefined$1(awaiting)) {
8093
- awaitingUpgrade.set(tagName, awaiting = new Set());
8094
- }
8095
- awaiting.add(this);
8096
- }
8097
- }
8098
- }, {
8099
- key: "disconnectedCallback",
8100
- value: function disconnectedCallback() {
8101
- var _a;
8102
- var definition = definitionForElement.get(this);
8103
- if (!isUndefined$1(definition)) {
8104
- // Delegate out to user callback
8105
- (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8106
- } else {
8107
- // Un-register for upgrade when defined (so we don't leak)
8108
- var awaiting = awaitingUpgrade.get(tagName);
8109
- // At this point, awaiting should never be undefined, because connectedCallback
8110
- // must have been called before disconnectedCallback. But just to be safe, we check
8111
- if (!isUndefined$1(awaiting)) {
8112
- awaiting.delete(this);
8113
- }
8114
- }
8115
- }
8116
- }, {
8117
- key: "formAssociatedCallback",
8118
- value: function formAssociatedCallback(form) {
8119
- var _a;
8120
- var definition = definitionForElement.get(this);
8121
- (_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
8122
- }
8123
- }, {
8124
- key: "formDisabledCallback",
8125
- value: function formDisabledCallback(disabled) {
8126
- var _a;
8127
- var definition = definitionForElement.get(this);
8128
- (_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
8129
- }
8130
- }, {
8131
- key: "formResetCallback",
8132
- value: function formResetCallback() {
8133
- var _a;
8134
- var definition = definitionForElement.get(this);
8135
- (_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8136
- }
8137
- }, {
8138
- key: "formStateRestoreCallback",
8139
- value: function formStateRestoreCallback(state, mode) {
8140
- var _a;
8141
- var definition = definitionForElement.get(this);
8142
- (_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
8143
- }
8144
- }, {
8145
- key: "adoptedCallback",
8146
- value: function adoptedCallback() {
8147
- var _a;
8148
- var definition = definitionForElement.get(this);
8149
- (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8150
- }
8151
- }, {
8152
- key: "attributeChangedCallback",
8153
- value: function attributeChangedCallback(name, oldValue, newValue) {
8154
- var _a;
8155
- var definition = definitionForElement.get(this);
8156
- // if both definitions are the same, then the observedAttributes is the same,
8157
- // but if they are different, only if the runtime definition has the attribute
8158
- // marked as observed, then it should invoke attributeChangedCallback.
8159
- if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
8160
- (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
8161
- }
8162
- }
8163
- }]);
8164
- return PivotCtor;
8165
- }(NativeHTMLElement);
8166
- PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
8167
- // TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
8168
- PivotCtor.formAssociated = registeredDefinition.formAssociated;
8169
- registeredPivotCtors.add(PivotCtor);
8170
- return PivotCtor;
8171
- }
8172
- function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
8173
- var observedAttributes = pivotDefinition.observedAttributes,
8174
- attributeChangedCallback = pivotDefinition.attributeChangedCallback;
8175
- if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
8176
- // This instance does not need to observe any attributes, no need to patch
8177
- return EMPTY_SET;
8178
- }
8179
- // Natively, the attributes observed by the registered definition are going to be taken
8180
- // care of by the browser, only the difference between the two sets has to be taken
8181
- // care by the patched version.
8182
- return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
8183
- return !registeredDefinition.observedAttributes.has(x);
8184
- }));
8185
- }
8186
- function throwAsyncError(error) {
8187
- // Per native custom element behavior, errors thrown in attributeChangedCallback
8188
- // become unhandled async errors. We use setTimeout() instead of Promise.resolve()
8189
- // to make it an unhandled error rather than an unhandled rejection.
8190
- setTimeout(function () {
8191
- throw error;
8192
- });
8193
- }
8194
- // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
8195
- // Why is this necessary? Well basically, you can't change the `observedAttributes` after
8196
- // a custom element is defined. So with pivots, if two classes share the same tag name,
8197
- // and the second class observes attributes that aren't observed by the first one,
8198
- // then those attributes can never be observed by the native `observedAttributes` system.
8199
- // So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
8200
- // we only do this when absolutely necessary, though; i.e. because we've determined
8201
- // that we aren't observing the attributes we need to.
8202
- function patchAttributes(instance, registeredDefinition, pivotDefinition) {
8203
- var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
8204
- if (newObservedAttributes.size === 0) {
8205
- return;
8206
- }
8207
- var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
8208
- // Patch the instance.
8209
- // Note we use the native `getAttribute` rather than the super's `getAttribute` because
8210
- // we don't actually want it to be observable that we're calling `getAttribute` from
8211
- // `setAttribute` and `removeAttribute`.
8212
- // TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
8213
- defineProperties(instance, {
8214
- setAttribute: {
8215
- value: function setAttribute(name, value) {
8216
- if (newObservedAttributes.has(name)) {
8217
- var old = nativeGetAttribute.call(this, name);
8218
- nativeSetAttribute.call(this, name, value);
8219
- try {
8220
- attributeChangedCallback.call(this, name, old, value + '');
8221
- } catch (error) {
8222
- throwAsyncError(error);
8223
- }
8224
- } else {
8225
- nativeSetAttribute.call(this, name, value);
8226
- }
8227
- },
8228
- writable: true,
8229
- enumerable: true,
8230
- configurable: true
8231
- },
8232
- removeAttribute: {
8233
- value: function removeAttribute(name) {
8234
- if (newObservedAttributes.has(name)) {
8235
- var old = nativeGetAttribute.call(this, name);
8236
- nativeRemoveAttribute.call(this, name);
8237
- try {
8238
- attributeChangedCallback.call(this, name, old, null);
8239
- } catch (error) {
8240
- throwAsyncError(error);
8241
- }
8242
- } else {
8243
- nativeRemoveAttribute.call(this, name);
8244
- }
8245
- },
8246
- writable: true,
8247
- enumerable: true,
8248
- configurable: true
8249
- }
8250
- });
8251
- }
8252
- function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
8253
- // The below case patches observed attributes for the case where the HTML element is upgraded
8254
- // from a pre-existing one in the DOM.
8255
- var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
8256
- if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
8257
- return;
8258
- }
8259
- var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
8260
- // Approximate observedAttributes from the user class, but only for the new observed attributes
8261
- newObservedAttributes.forEach(function (name) {
8262
- if (nativeHasAttribute.call(instance, name)) {
8263
- var newValue = nativeGetAttribute.call(instance, name);
8264
- attributeChangedCallback.call(instance, name, null, newValue);
8265
- }
8266
- });
8267
- }
8268
- // User extends this HTMLElement, which returns the CE being upgraded
8269
- var upgradingInstance;
8270
- // Helper to upgrade an instance with a CE definition using "constructor call trick"
8271
- function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
8272
- setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
8273
- definitionForElement.set(instance, pivotDefinition);
8274
- // attributes patches when needed
8275
- if (pivotDefinition !== registeredDefinition) {
8276
- patchAttributes(instance, registeredDefinition, pivotDefinition);
8277
- }
8278
- // Tricking the construction path to believe that a new instance is being created,
8279
- // that way it will execute the super initialization mechanism but the HTMLElement
8280
- // constructor will reuse the instance by returning the upgradingInstance.
8281
- // This is by far the most important piece of the puzzle
8282
- upgradingInstance = instance;
8283
- // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
8284
- // The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
8285
- // Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
8286
- new pivotDefinition.UserCtor();
8287
- patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
8288
- }
8289
- function isConstructor(constructor) {
8290
- return isFunction$1(constructor) && isObject(constructor.prototype);
8291
- }
8292
- function getOrCreateDefinitionForConstructor(constructor) {
8293
- if (!isConstructor(constructor)) {
8294
- throw new TypeError('The referenced constructor is not a constructor.');
8295
- }
8296
- var definition = definitionForConstructor.get(constructor);
8297
- if (!isUndefined$1(definition)) {
8298
- return definition;
8299
- }
8300
- return createDefinitionRecord(constructor);
8301
- }
8302
- // Defer a `whenDefined()` callback until an externally-visible custom element is defined
8303
- function createPendingWhenDefinedCallback(tagName) {
8304
- return new Promise(function (resolve) {
8305
- var resolvers = pendingWhenDefinedCallbacks.get(tagName);
8306
- if (isUndefined$1(resolvers)) {
8307
- resolvers = [];
8308
- pendingWhenDefinedCallbacks.set(tagName, resolvers);
8309
- }
8310
- resolvers.push(resolve);
8311
- });
8312
- }
8313
- // Call any pending `whenDefined()` callbacks
8314
- function flushPendingWhenDefinedCallbacks(tagName, ctor) {
8315
- var resolvers = pendingWhenDefinedCallbacks.get(tagName);
8316
- if (!isUndefined$1(resolvers)) {
8317
- var _iterator11 = _createForOfIteratorHelper(resolvers),
8318
- _step11;
8319
- try {
8320
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8321
- var resolver = _step11.value;
8322
- resolver(ctor);
8323
- }
8324
- } catch (err) {
8325
- _iterator11.e(err);
8326
- } finally {
8327
- _iterator11.f();
8328
- }
8329
- }
8330
- pendingWhenDefinedCallbacks.delete(tagName);
8331
- }
8332
- var _window2 = window,
8333
- nativeRegistry = _window2.customElements;
8334
- var nativeDefine = nativeRegistry.define,
8335
- nativeWhenDefined = nativeRegistry.whenDefined,
8336
- nativeGet = nativeRegistry.get;
8337
- // patch for the global registry define mechanism
8338
- CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
8339
- if (options && options.extends) {
8340
- // TODO [#2983]: should we support `extends`?
8341
- throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
8342
- }
8343
- if (globalDefinitionsByTag.has(tagName)) {
8344
- throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
8345
- }
8346
- if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
8347
- throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
8348
- }
8349
- var definition = getOrCreateDefinitionForConstructor(constructor);
8350
- registeredUserCtors.add(constructor);
8351
- var PivotCtor = pivotCtorByTag.get(tagName);
8352
- if (isUndefined$1(PivotCtor)) {
8353
- PivotCtor = createPivotingClass(tagName, definition);
8354
- // Register a pivoting class which will handle global registry initializations
8355
- nativeDefine.call(nativeRegistry, tagName, PivotCtor);
8356
- }
8357
- // Only cache after nativeDefine has been called, because if it throws an error
8358
- // (e.g. for an invalid tag name), then we don't want to cache anything.
8359
- definitionForConstructor.set(constructor, definition);
8360
- pivotCtorByTag.set(tagName, PivotCtor);
8361
- globalDefinitionsByTag.set(tagName, definition);
8362
- globalDefinitionsByClass.set(constructor, definition);
8363
- // For globally defined custom elements, the definition associated
8364
- // to the UserCtor has a back-pointer to PivotCtor in case the user
8365
- // new the UserCtor, so we know how to create the underlying element.
8366
- definition.PivotCtor = PivotCtor;
8367
- // Upgrade any elements created in this scope before customElements.define
8368
- // was called, which should be exhibited by the following steps:
8369
- // 1) LWC registers a tagName for an LWC component.
8370
- // 2) Element with same tagName is created with document.createElement()
8371
- // and inserted into DOM.
8372
- // 3) customElements.define() is called with tagName and non-LWC constructor.
8373
- // This requires immediate upgrade when the new global tagName is defined.
8374
- var awaiting = awaitingUpgrade.get(tagName);
8375
- if (!isUndefined$1(awaiting)) {
8376
- awaitingUpgrade.delete(tagName);
8377
- var _iterator12 = _createForOfIteratorHelper(awaiting),
8378
- _step12;
8379
- try {
8380
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
8381
- var element = _step12.value;
8382
- var registeredDefinition = pendingRegistryForElement.get(element);
8383
- // At this point, registeredDefinition should never be undefined because awaitingUpgrade
8384
- // is only populated when we haven't run internalUpgrade yet, and we only populate
8385
- // pendingRegistryForElement when internalUpgrade hasn't run yet.
8386
- // But just to be safe, we check.
8387
- if (!isUndefined$1(registeredDefinition)) {
8388
- pendingRegistryForElement.delete(element);
8389
- internalUpgrade(element, registeredDefinition, definition);
8390
- }
8391
- }
8392
- } catch (err) {
8393
- _iterator12.e(err);
8394
- } finally {
8395
- _iterator12.f();
8396
- }
8397
- }
8398
- // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
8399
- flushPendingWhenDefinedCallbacks(tagName, constructor);
8400
- };
8401
- CustomElementRegistry.prototype.get = function get(tagName) {
8402
- var NativeCtor = nativeGet.call(nativeRegistry, tagName);
8403
- if (!isUndefined$1(NativeCtor)) {
8404
- var definition = globalDefinitionsByTag.get(tagName);
8405
- if (!isUndefined$1(definition)) {
8406
- return definition.UserCtor; // defined by the patched custom elements registry
8407
- }
8408
-
8409
- if (registeredPivotCtors.has(NativeCtor)) {
8410
- return undefined; // pivot constructors should not be observable, return undefined
8411
- }
8412
-
8413
- return NativeCtor; // constructor that existed before patching
8414
- }
8415
- };
8416
-
8417
- CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
8418
- return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
8419
- var definition = globalDefinitionsByTag.get(tagName);
8420
- if (!isUndefined$1(definition)) {
8421
- return definition.UserCtor;
8422
- }
8423
- // In this case, the custom element must have been defined before the registry patches
8424
- // were applied. So return the non-pivot constructor
8425
- if (isUndefined$1(NativeCtor)) {
8426
- // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
8427
- // We can patch the correct behavior using customElements.get()
8428
- NativeCtor = nativeGet.call(nativeRegistry, tagName);
8429
- }
8430
- if (registeredPivotCtors.has(NativeCtor)) {
8431
- // Pivot constructors should not be observable. Wait to resolve the promise
8432
- // if a constructor is ever defined in userland
8433
- return createPendingWhenDefinedCallback(tagName);
8434
- }
8435
- return NativeCtor;
8436
- });
8437
- };
8438
- // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
8439
- // @ts-ignore
8440
- window.HTMLElement = function HTMLElement() {
8441
- // Upgrading case: the pivoting class constructor was run by the browser's
8442
- // native custom elements and we're in the process of running the
8443
- // "constructor-call trick" on the natively constructed instance, so just
8444
- // return that here.
8445
- // This code path is also called when LWC `new`s a PivotCtor.
8446
- var instance = upgradingInstance;
8447
- if (!isUndefined$1(instance)) {
8448
- upgradingInstance = undefined;
8449
- return instance;
8450
- }
8451
- // Construction case: we need to construct the pivoting instance and return it.
8452
- // This is possible when the user register it via global registry and instantiate
8453
- // it via `new Ctor()`.
8454
- var constructor = this.constructor;
8455
- var definition = globalDefinitionsByClass.get(constructor);
8456
- if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
8457
- // This code path is hit if someone `new`s a class that extends `HTMLElement` without
8458
- // doing `customElements.define()` first. This matches native browser behavior:
8459
- // https://stackoverflow.com/a/61883392
8460
- throw new TypeError('Illegal constructor');
8461
- }
8462
- // This constructor is ONLY invoked when it is the user instantiating
8463
- // an element via new Ctor while Ctor is a registered global constructor.
8464
- var PivotCtor = definition.PivotCtor,
8465
- UserCtor = definition.UserCtor;
8466
- return new PivotCtor(UserCtor);
8467
- };
8468
- HTMLElement.prototype = NativeHTMLElement.prototype;
8469
- /**
8470
- * Create a new PivotConstructor for the given tagName, which is capable of being constructed
8471
- * with a UserConstructor defining the behavior. Passing in the UserConstructor here
8472
- * is a hint that can be used when registering a custom element with the global custom elements
8473
- * registry for the first time, which provides certain optimizations. It also marks the UserConstructor
8474
- * as "safe" to be used when passed in to a PivotConstructor.
8475
- *
8476
- * @param tagName - element tag name
8477
- * @param UserCtor - userland custom element constructor
8478
- * @returns a new custom element constructor
8479
- */
8480
- return function createPivotConstructor(tagName, UserCtor) {
8481
- tagName = StringToLowerCase.call(tagName);
8482
- var PivotCtor = pivotCtorByTag.get(tagName);
8483
- if (isUndefined$1(PivotCtor)) {
8484
- var definition = getOrCreateDefinitionForConstructor(UserCtor);
8485
- PivotCtor = createPivotingClass(tagName, definition);
8486
- // Register a pivoting class as a global custom element
8487
- nativeDefine.call(nativeRegistry, tagName, PivotCtor);
8488
- definition.PivotCtor = PivotCtor;
8489
- // Only cache after nativeDefine has been called, because if it throws an error
8490
- // (e.g. for an invalid tag name), then we don't want to cache anything.
8491
- definitionForConstructor.set(UserCtor, definition);
8492
- pivotCtorByTag.set(tagName, PivotCtor);
8493
- }
8494
- // Register a UserConstructor as "safe" to be used within a PivotConstructor
8495
- registeredUserCtors.add(UserCtor);
8496
- return PivotCtor;
8497
- };
8498
- }
8499
-
8500
- /*
8501
- * Copyright (c) 2018, salesforce.com, inc.
8502
- * All rights reserved.
8503
- * SPDX-License-Identifier: MIT
8504
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8505
- */
8506
- var createScopedConstructor;
8507
- var CachedHTMLElement;
8508
- // We only call `createScopedRegistry()` if the browser supports custom elements and
8509
- // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
8510
- // or we're in a legacy browser.
8511
- if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8512
- if (hasCustomElements) {
8513
- // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
8514
- // It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
8515
- //
8516
- // Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
8517
- //
8518
- // 1. LWC loads
8519
- // 2. `const Ctor = class extends HTMLElement {}`
8520
- // 3. `lwc.createElement(...)` // here we lazily patch
8521
- // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
8522
- //
8523
- // To reduce the risk of this, it's safer to patch the registry eagerly.
8524
- createScopedConstructor = createScopedRegistry();
8525
- // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
8526
- // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
8527
- // because the HTMLElement prototypes are mixed up.
8528
- //
8529
- // The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
8530
- // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
8531
- // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
8532
- // Caching avoids this problem.
8533
- CachedHTMLElement = window.HTMLElement;
8534
- }
8535
- }
8536
- // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
8537
- // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
8538
- // multiple times per tag name.
8539
- var createUserConstructor = function createUserConstructor(HTMLElementToExtend, upgradeCallback, _connectedCallback, _disconnectedCallback) {
8540
- // TODO [#2972]: this class should expose observedAttributes as necessary
8541
- return /*#__PURE__*/function (_HTMLElementToExtend) {
8542
- _inherits(UserConstructor, _HTMLElementToExtend);
8543
- var _super8 = _createSuper(UserConstructor);
8544
- function UserConstructor() {
8545
- var _this5;
8546
- _classCallCheck(this, UserConstructor);
8547
- _this5 = _super8.call(this);
8548
- upgradeCallback(_assertThisInitialized(_this5));
8549
- return _this5;
8550
- }
8551
- // Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
8552
- // here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
8553
- // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
8554
- _createClass(UserConstructor, [{
8555
- key: "connectedCallback",
8556
- value: function connectedCallback() {
8557
- if (!isUndefined$1(_connectedCallback)) {
8558
- _connectedCallback(this);
8559
- }
8560
- }
8561
- }, {
8562
- key: "disconnectedCallback",
8563
- value: function disconnectedCallback() {
8564
- if (!isUndefined$1(_disconnectedCallback)) {
8565
- _disconnectedCallback(this);
8566
- }
8567
- }
8568
- }]);
8569
- return UserConstructor;
8570
- }(HTMLElementToExtend);
8571
- };
8572
- function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
8573
- if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
8574
- // This error should be impossible to hit
8575
- throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
8576
- }
8577
- var UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
8578
- var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
8579
- return new ScopedConstructor(UserConstructor);
8580
- }
8581
-
8582
7974
  /*
8583
7975
  * Copyright (c) 2018, salesforce.com, inc.
8584
7976
  * All rights reserved.
@@ -8586,26 +7978,18 @@ var LWC = (function (exports) {
8586
7978
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8587
7979
  */
8588
7980
  /**
8589
- * We have three modes for creating custom elements:
7981
+ * We have two modes for creating custom elements:
8590
7982
  *
8591
7983
  * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
8592
7984
  * 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
8593
7985
  * via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
8594
7986
  * a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
8595
7987
  * constructor"), which allows us to have completely customized functionality for different components.
8596
- * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
8597
- * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
8598
- * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
8599
- * because it must patch the global `customElements` and `HTMLElement` objects.
8600
7988
  */
8601
7989
  var createCustomElement;
8602
7990
  if (hasCustomElements) {
8603
- if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8604
- createCustomElement = createCustomElementScoped;
8605
- } else {
8606
- // use the global registry, with an upgradable constructor for the defined custom element
8607
- createCustomElement = createCustomElementUsingUpgradableConstructor;
8608
- }
7991
+ // use the global registry, with an upgradable constructor for the defined custom element
7992
+ createCustomElement = createCustomElementUsingUpgradableConstructor;
8609
7993
  } else {
8610
7994
  // no registry available here
8611
7995
  createCustomElement = createCustomElementCompat;
@@ -8669,7 +8053,7 @@ var LWC = (function (exports) {
8669
8053
  function isNull(obj) {
8670
8054
  return obj === null;
8671
8055
  }
8672
- /** version: 2.36.0 */
8056
+ /** version: 2.37.0 */
8673
8057
 
8674
8058
  /*
8675
8059
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8728,17 +8112,17 @@ var LWC = (function (exports) {
8728
8112
  exports.createFragment = function (html) {
8729
8113
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8730
8114
  if (!isUndefined(wrapperTags)) {
8731
- var _iterator13 = _createForOfIteratorHelper(wrapperTags),
8732
- _step13;
8115
+ var _iterator11 = _createForOfIteratorHelper(wrapperTags),
8116
+ _step11;
8733
8117
  try {
8734
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
8735
- var wrapperTag = _step13.value;
8118
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8119
+ var wrapperTag = _step11.value;
8736
8120
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8737
8121
  }
8738
8122
  } catch (err) {
8739
- _iterator13.e(err);
8123
+ _iterator11.e(err);
8740
8124
  } finally {
8741
- _iterator13.f();
8125
+ _iterator11.f();
8742
8126
  }
8743
8127
  }
8744
8128
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -9018,23 +8402,23 @@ var LWC = (function (exports) {
9018
8402
  var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
9019
8403
  return _a = /*#__PURE__*/function (_HTMLElement2) {
9020
8404
  _inherits(_a, _HTMLElement2);
9021
- var _super9 = _createSuper(_a);
8405
+ var _super7 = _createSuper(_a);
9022
8406
  function _a() {
9023
- var _this6;
8407
+ var _this4;
9024
8408
  _classCallCheck(this, _a);
9025
- _this6 = _super9.call(this);
9026
- if (_this6.isConnected) {
8409
+ _this4 = _super7.call(this);
8410
+ if (_this4.isConnected) {
9027
8411
  // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
9028
- hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
9029
- hydratedCustomElements.add(_assertThisInitialized(_this6));
8412
+ hydrateComponent(_assertThisInitialized(_this4), Ctor, {});
8413
+ hydratedCustomElements.add(_assertThisInitialized(_this4));
9030
8414
  } else {
9031
- createVM(_assertThisInitialized(_this6), Ctor, renderer, {
8415
+ createVM(_assertThisInitialized(_this4), Ctor, renderer, {
9032
8416
  mode: 'open',
9033
8417
  owner: null,
9034
- tagName: _this6.tagName
8418
+ tagName: _this4.tagName
9035
8419
  });
9036
8420
  }
9037
- return _this6;
8421
+ return _this4;
9038
8422
  }
9039
8423
  _createClass(_a, [{
9040
8424
  key: "connectedCallback",
@@ -9235,7 +8619,7 @@ var LWC = (function (exports) {
9235
8619
  });
9236
8620
  freeze(LightningElement);
9237
8621
  seal(LightningElement.prototype);
9238
- /* version: 2.36.0 */
8622
+ /* version: 2.37.0 */
9239
8623
 
9240
8624
  exports.LightningElement = LightningElement;
9241
8625
  exports.__unstable__ProfilerControl = profilerControl;