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
@@ -315,7 +315,7 @@ var LWC = (function (exports) {
315
315
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
316
316
  return propertyName;
317
317
  }
318
- /** version: 2.36.0 */
318
+ /** version: 2.37.0 */
319
319
 
320
320
  /**
321
321
  * Copyright (C) 2018 salesforce.com, inc.
@@ -335,10 +335,8 @@ var LWC = (function (exports) {
335
335
  ENABLE_WIRE_SYNC_EMIT: null,
336
336
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
337
337
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
338
- ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
339
338
  ENABLE_FROZEN_TEMPLATE: null,
340
- DISABLE_ARIA_REFLECTION_POLYFILL: null,
341
- ENABLE_PROGRAMMATIC_STYLESHEETS: null
339
+ DISABLE_ARIA_REFLECTION_POLYFILL: null
342
340
  };
343
341
  if (!_globalThis.lwcRuntimeFlags) {
344
342
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
@@ -387,7 +385,7 @@ var LWC = (function (exports) {
387
385
  */
388
386
  function setFeatureFlagForTest(name, value) {
389
387
  }
390
- /** version: 2.36.0 */
388
+ /** version: 2.37.0 */
391
389
 
392
390
  /**
393
391
  * Copyright (C) 2018 salesforce.com, inc.
@@ -451,7 +449,7 @@ var LWC = (function (exports) {
451
449
  }
452
450
  }
453
451
  }
454
- /** version: 2.36.0 */
452
+ /** version: 2.37.0 */
455
453
 
456
454
  /*
457
455
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4880,13 +4878,11 @@ var LWC = (function (exports) {
4880
4878
  }
4881
4879
  // Validate and flatten any stylesheets defined as `static stylesheets`
4882
4880
  function computeStylesheets(vm, ctor) {
4883
- if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
4884
- var stylesheets = ctor.stylesheets;
4885
- if (!isUndefined$1(stylesheets)) {
4886
- var valid = validateComponentStylesheets(vm, stylesheets);
4887
- if (valid) {
4888
- return flattenStylesheets(stylesheets);
4889
- }
4881
+ var stylesheets = ctor.stylesheets;
4882
+ if (!isUndefined$1(stylesheets)) {
4883
+ var valid = validateComponentStylesheets(vm, stylesheets);
4884
+ if (valid) {
4885
+ return flattenStylesheets(stylesheets);
4890
4886
  }
4891
4887
  }
4892
4888
  return null;
@@ -5197,7 +5193,7 @@ var LWC = (function (exports) {
5197
5193
  // The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
5198
5194
  // These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
5199
5195
  // When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
5200
- // See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
5196
+ // See: https://sfdc.co/synthetic-aria
5201
5197
  //
5202
5198
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
5203
5199
  var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
@@ -6366,610 +6362,6 @@ var LWC = (function (exports) {
6366
6362
  }
6367
6363
  };
6368
6364
 
6369
- /*
6370
- * Copyright (c) 2020, salesforce.com, inc.
6371
- * All rights reserved.
6372
- * SPDX-License-Identifier: MIT
6373
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6374
- */
6375
- /**
6376
- * Create a scoped registry, i.e. a function that can create custom elements whose tag names
6377
- * do not conflict with third-party custom elements having the same tag name.
6378
- */
6379
- function createScopedRegistry() {
6380
- if (!hasCustomElements) {
6381
- // This code should never be reached, because we don't use the pivot registry if
6382
- // custom elements are unavailable.
6383
- throw new Error('Custom elements are not supported in this environment.');
6384
- }
6385
- var _window = window,
6386
- NativeHTMLElement = _window.HTMLElement;
6387
- var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
6388
- nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
6389
- nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
6390
- nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
6391
- nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
6392
- var definitionForElement = new WeakMap();
6393
- var pendingRegistryForElement = new WeakMap();
6394
- var definitionForConstructor = new WeakMap();
6395
- var registeredUserCtors = new WeakSet();
6396
- var registeredPivotCtors = new WeakSet();
6397
- var pivotCtorByTag = new Map();
6398
- var globalDefinitionsByTag = new Map();
6399
- var globalDefinitionsByClass = new Map();
6400
- var awaitingUpgrade = new Map();
6401
- var pendingWhenDefinedCallbacks = new Map();
6402
- var EMPTY_SET = new Set();
6403
- function createDefinitionRecord(constructor) {
6404
- var _a;
6405
- var _constructor$prototyp = constructor.prototype,
6406
- connectedCallback = _constructor$prototyp.connectedCallback,
6407
- disconnectedCallback = _constructor$prototyp.disconnectedCallback,
6408
- formAssociatedCallback = _constructor$prototyp.formAssociatedCallback,
6409
- formDisabledCallback = _constructor$prototyp.formDisabledCallback,
6410
- formResetCallback = _constructor$prototyp.formResetCallback,
6411
- formStateRestoreCallback = _constructor$prototyp.formStateRestoreCallback,
6412
- adoptedCallback = _constructor$prototyp.adoptedCallback,
6413
- attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
6414
- var formAssociated = Boolean(constructor.formAssociated);
6415
- var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
6416
- return {
6417
- UserCtor: constructor,
6418
- PivotCtor: undefined,
6419
- connectedCallback: connectedCallback,
6420
- disconnectedCallback: disconnectedCallback,
6421
- formAssociatedCallback: formAssociatedCallback,
6422
- formDisabledCallback: formDisabledCallback,
6423
- formResetCallback: formResetCallback,
6424
- formStateRestoreCallback: formStateRestoreCallback,
6425
- adoptedCallback: adoptedCallback,
6426
- attributeChangedCallback: attributeChangedCallback,
6427
- observedAttributes: observedAttributes,
6428
- formAssociated: formAssociated
6429
- };
6430
- }
6431
- // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
6432
- // element. Note that the `registeredDefinition` represents the constructor that was used to register during
6433
- // `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
6434
- // constructor is invoked with another constructor.
6435
- function createPivotingClass(tagName, registeredDefinition) {
6436
- var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
6437
- _inherits(PivotCtor, _NativeHTMLElement);
6438
- var _super7 = _createSuper(PivotCtor);
6439
- function PivotCtor(UserCtor) {
6440
- var _this4;
6441
- _classCallCheck(this, PivotCtor);
6442
- // This constructor can only be invoked by:
6443
- // a) the browser instantiating an element from parsing or via document.createElement.
6444
- // b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
6445
- // b) new UserClass.
6446
- // When LWC instantiates it, it will pass the upgrading definition as an argument
6447
- // If the caller signals via UserCtor that this is in fact a controlled
6448
- // definition, we use that one, otherwise fallback to the global
6449
- // internal registry.
6450
- _this4 = _super7.call(this);
6451
- var userCtorIsDefined = !isUndefined$1(UserCtor);
6452
- if (userCtorIsDefined) {
6453
- if (!isConstructor(UserCtor)) {
6454
- throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
6455
- }
6456
- if (!registeredUserCtors.has(UserCtor)) {
6457
- throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
6458
- }
6459
- }
6460
- var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
6461
- if (!isUndefined$1(definition)) {
6462
- internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
6463
- } else {
6464
- // This is the case in which there is no global definition, and
6465
- // it is not handled by LWC (otherwise it will have a valid UserCtor)
6466
- // so we need to add it to the pending queue just in case it eventually
6467
- // gets defined in the global registry.
6468
- pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
6469
- }
6470
- return _this4;
6471
- }
6472
- _createClass(PivotCtor, [{
6473
- key: "connectedCallback",
6474
- value: function connectedCallback() {
6475
- var _a;
6476
- var definition = definitionForElement.get(this);
6477
- if (!isUndefined$1(definition)) {
6478
- // Delegate out to user callback
6479
- (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6480
- } else {
6481
- // Register for upgrade when defined (only when connected, so we don't leak)
6482
- var awaiting = awaitingUpgrade.get(tagName);
6483
- if (isUndefined$1(awaiting)) {
6484
- awaitingUpgrade.set(tagName, awaiting = new Set());
6485
- }
6486
- awaiting.add(this);
6487
- }
6488
- }
6489
- }, {
6490
- key: "disconnectedCallback",
6491
- value: function disconnectedCallback() {
6492
- var _a;
6493
- var definition = definitionForElement.get(this);
6494
- if (!isUndefined$1(definition)) {
6495
- // Delegate out to user callback
6496
- (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6497
- } else {
6498
- // Un-register for upgrade when defined (so we don't leak)
6499
- var awaiting = awaitingUpgrade.get(tagName);
6500
- // At this point, awaiting should never be undefined, because connectedCallback
6501
- // must have been called before disconnectedCallback. But just to be safe, we check
6502
- if (!isUndefined$1(awaiting)) {
6503
- awaiting.delete(this);
6504
- }
6505
- }
6506
- }
6507
- }, {
6508
- key: "formAssociatedCallback",
6509
- value: function formAssociatedCallback(form) {
6510
- var _a;
6511
- var definition = definitionForElement.get(this);
6512
- (_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
6513
- }
6514
- }, {
6515
- key: "formDisabledCallback",
6516
- value: function formDisabledCallback(disabled) {
6517
- var _a;
6518
- var definition = definitionForElement.get(this);
6519
- (_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
6520
- }
6521
- }, {
6522
- key: "formResetCallback",
6523
- value: function formResetCallback() {
6524
- var _a;
6525
- var definition = definitionForElement.get(this);
6526
- (_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6527
- }
6528
- }, {
6529
- key: "formStateRestoreCallback",
6530
- value: function formStateRestoreCallback(state, mode) {
6531
- var _a;
6532
- var definition = definitionForElement.get(this);
6533
- (_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
6534
- }
6535
- }, {
6536
- key: "adoptedCallback",
6537
- value: function adoptedCallback() {
6538
- var _a;
6539
- var definition = definitionForElement.get(this);
6540
- (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6541
- }
6542
- }, {
6543
- key: "attributeChangedCallback",
6544
- value: function attributeChangedCallback(name, oldValue, newValue) {
6545
- var _a;
6546
- var definition = definitionForElement.get(this);
6547
- // if both definitions are the same, then the observedAttributes is the same,
6548
- // but if they are different, only if the runtime definition has the attribute
6549
- // marked as observed, then it should invoke attributeChangedCallback.
6550
- if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
6551
- (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
6552
- }
6553
- }
6554
- }]);
6555
- return PivotCtor;
6556
- }(NativeHTMLElement);
6557
- PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
6558
- // TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
6559
- PivotCtor.formAssociated = registeredDefinition.formAssociated;
6560
- registeredPivotCtors.add(PivotCtor);
6561
- return PivotCtor;
6562
- }
6563
- function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
6564
- var observedAttributes = pivotDefinition.observedAttributes,
6565
- attributeChangedCallback = pivotDefinition.attributeChangedCallback;
6566
- if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
6567
- // This instance does not need to observe any attributes, no need to patch
6568
- return EMPTY_SET;
6569
- }
6570
- // Natively, the attributes observed by the registered definition are going to be taken
6571
- // care of by the browser, only the difference between the two sets has to be taken
6572
- // care by the patched version.
6573
- return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
6574
- return !registeredDefinition.observedAttributes.has(x);
6575
- }));
6576
- }
6577
- function throwAsyncError(error) {
6578
- // Per native custom element behavior, errors thrown in attributeChangedCallback
6579
- // become unhandled async errors. We use setTimeout() instead of Promise.resolve()
6580
- // to make it an unhandled error rather than an unhandled rejection.
6581
- setTimeout(function () {
6582
- throw error;
6583
- });
6584
- }
6585
- // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
6586
- // Why is this necessary? Well basically, you can't change the `observedAttributes` after
6587
- // a custom element is defined. So with pivots, if two classes share the same tag name,
6588
- // and the second class observes attributes that aren't observed by the first one,
6589
- // then those attributes can never be observed by the native `observedAttributes` system.
6590
- // So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
6591
- // we only do this when absolutely necessary, though; i.e. because we've determined
6592
- // that we aren't observing the attributes we need to.
6593
- function patchAttributes(instance, registeredDefinition, pivotDefinition) {
6594
- var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
6595
- if (newObservedAttributes.size === 0) {
6596
- return;
6597
- }
6598
- var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
6599
- // Patch the instance.
6600
- // Note we use the native `getAttribute` rather than the super's `getAttribute` because
6601
- // we don't actually want it to be observable that we're calling `getAttribute` from
6602
- // `setAttribute` and `removeAttribute`.
6603
- // TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
6604
- defineProperties(instance, {
6605
- setAttribute: {
6606
- value: function setAttribute(name, value) {
6607
- if (newObservedAttributes.has(name)) {
6608
- var old = nativeGetAttribute.call(this, name);
6609
- nativeSetAttribute.call(this, name, value);
6610
- try {
6611
- attributeChangedCallback.call(this, name, old, value + '');
6612
- } catch (error) {
6613
- throwAsyncError(error);
6614
- }
6615
- } else {
6616
- nativeSetAttribute.call(this, name, value);
6617
- }
6618
- },
6619
- writable: true,
6620
- enumerable: true,
6621
- configurable: true
6622
- },
6623
- removeAttribute: {
6624
- value: function removeAttribute(name) {
6625
- if (newObservedAttributes.has(name)) {
6626
- var old = nativeGetAttribute.call(this, name);
6627
- nativeRemoveAttribute.call(this, name);
6628
- try {
6629
- attributeChangedCallback.call(this, name, old, null);
6630
- } catch (error) {
6631
- throwAsyncError(error);
6632
- }
6633
- } else {
6634
- nativeRemoveAttribute.call(this, name);
6635
- }
6636
- },
6637
- writable: true,
6638
- enumerable: true,
6639
- configurable: true
6640
- }
6641
- });
6642
- }
6643
- function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
6644
- // The below case patches observed attributes for the case where the HTML element is upgraded
6645
- // from a pre-existing one in the DOM.
6646
- var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
6647
- if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
6648
- return;
6649
- }
6650
- var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
6651
- // Approximate observedAttributes from the user class, but only for the new observed attributes
6652
- newObservedAttributes.forEach(function (name) {
6653
- if (nativeHasAttribute.call(instance, name)) {
6654
- var newValue = nativeGetAttribute.call(instance, name);
6655
- attributeChangedCallback.call(instance, name, null, newValue);
6656
- }
6657
- });
6658
- }
6659
- // User extends this HTMLElement, which returns the CE being upgraded
6660
- var upgradingInstance;
6661
- // Helper to upgrade an instance with a CE definition using "constructor call trick"
6662
- function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
6663
- setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
6664
- definitionForElement.set(instance, pivotDefinition);
6665
- // attributes patches when needed
6666
- if (pivotDefinition !== registeredDefinition) {
6667
- patchAttributes(instance, registeredDefinition, pivotDefinition);
6668
- }
6669
- // Tricking the construction path to believe that a new instance is being created,
6670
- // that way it will execute the super initialization mechanism but the HTMLElement
6671
- // constructor will reuse the instance by returning the upgradingInstance.
6672
- // This is by far the most important piece of the puzzle
6673
- upgradingInstance = instance;
6674
- // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
6675
- // The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
6676
- // Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
6677
- new pivotDefinition.UserCtor();
6678
- patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
6679
- }
6680
- function isConstructor(constructor) {
6681
- return isFunction$1(constructor) && isObject(constructor.prototype);
6682
- }
6683
- function getOrCreateDefinitionForConstructor(constructor) {
6684
- if (!isConstructor(constructor)) {
6685
- throw new TypeError('The referenced constructor is not a constructor.');
6686
- }
6687
- var definition = definitionForConstructor.get(constructor);
6688
- if (!isUndefined$1(definition)) {
6689
- return definition;
6690
- }
6691
- return createDefinitionRecord(constructor);
6692
- }
6693
- // Defer a `whenDefined()` callback until an externally-visible custom element is defined
6694
- function createPendingWhenDefinedCallback(tagName) {
6695
- return new Promise(function (resolve) {
6696
- var resolvers = pendingWhenDefinedCallbacks.get(tagName);
6697
- if (isUndefined$1(resolvers)) {
6698
- resolvers = [];
6699
- pendingWhenDefinedCallbacks.set(tagName, resolvers);
6700
- }
6701
- resolvers.push(resolve);
6702
- });
6703
- }
6704
- // Call any pending `whenDefined()` callbacks
6705
- function flushPendingWhenDefinedCallbacks(tagName, ctor) {
6706
- var resolvers = pendingWhenDefinedCallbacks.get(tagName);
6707
- if (!isUndefined$1(resolvers)) {
6708
- var _iterator11 = _createForOfIteratorHelper(resolvers),
6709
- _step11;
6710
- try {
6711
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
6712
- var resolver = _step11.value;
6713
- resolver(ctor);
6714
- }
6715
- } catch (err) {
6716
- _iterator11.e(err);
6717
- } finally {
6718
- _iterator11.f();
6719
- }
6720
- }
6721
- pendingWhenDefinedCallbacks.delete(tagName);
6722
- }
6723
- var _window2 = window,
6724
- nativeRegistry = _window2.customElements;
6725
- var nativeDefine = nativeRegistry.define,
6726
- nativeWhenDefined = nativeRegistry.whenDefined,
6727
- nativeGet = nativeRegistry.get;
6728
- // patch for the global registry define mechanism
6729
- CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
6730
- if (options && options.extends) {
6731
- // TODO [#2983]: should we support `extends`?
6732
- throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
6733
- }
6734
- if (globalDefinitionsByTag.has(tagName)) {
6735
- throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
6736
- }
6737
- if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
6738
- throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
6739
- }
6740
- var definition = getOrCreateDefinitionForConstructor(constructor);
6741
- registeredUserCtors.add(constructor);
6742
- var PivotCtor = pivotCtorByTag.get(tagName);
6743
- if (isUndefined$1(PivotCtor)) {
6744
- PivotCtor = createPivotingClass(tagName, definition);
6745
- // Register a pivoting class which will handle global registry initializations
6746
- nativeDefine.call(nativeRegistry, tagName, PivotCtor);
6747
- }
6748
- // Only cache after nativeDefine has been called, because if it throws an error
6749
- // (e.g. for an invalid tag name), then we don't want to cache anything.
6750
- definitionForConstructor.set(constructor, definition);
6751
- pivotCtorByTag.set(tagName, PivotCtor);
6752
- globalDefinitionsByTag.set(tagName, definition);
6753
- globalDefinitionsByClass.set(constructor, definition);
6754
- // For globally defined custom elements, the definition associated
6755
- // to the UserCtor has a back-pointer to PivotCtor in case the user
6756
- // new the UserCtor, so we know how to create the underlying element.
6757
- definition.PivotCtor = PivotCtor;
6758
- // Upgrade any elements created in this scope before customElements.define
6759
- // was called, which should be exhibited by the following steps:
6760
- // 1) LWC registers a tagName for an LWC component.
6761
- // 2) Element with same tagName is created with document.createElement()
6762
- // and inserted into DOM.
6763
- // 3) customElements.define() is called with tagName and non-LWC constructor.
6764
- // This requires immediate upgrade when the new global tagName is defined.
6765
- var awaiting = awaitingUpgrade.get(tagName);
6766
- if (!isUndefined$1(awaiting)) {
6767
- awaitingUpgrade.delete(tagName);
6768
- var _iterator12 = _createForOfIteratorHelper(awaiting),
6769
- _step12;
6770
- try {
6771
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
6772
- var element = _step12.value;
6773
- var registeredDefinition = pendingRegistryForElement.get(element);
6774
- // At this point, registeredDefinition should never be undefined because awaitingUpgrade
6775
- // is only populated when we haven't run internalUpgrade yet, and we only populate
6776
- // pendingRegistryForElement when internalUpgrade hasn't run yet.
6777
- // But just to be safe, we check.
6778
- if (!isUndefined$1(registeredDefinition)) {
6779
- pendingRegistryForElement.delete(element);
6780
- internalUpgrade(element, registeredDefinition, definition);
6781
- }
6782
- }
6783
- } catch (err) {
6784
- _iterator12.e(err);
6785
- } finally {
6786
- _iterator12.f();
6787
- }
6788
- }
6789
- // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
6790
- flushPendingWhenDefinedCallbacks(tagName, constructor);
6791
- };
6792
- CustomElementRegistry.prototype.get = function get(tagName) {
6793
- var NativeCtor = nativeGet.call(nativeRegistry, tagName);
6794
- if (!isUndefined$1(NativeCtor)) {
6795
- var definition = globalDefinitionsByTag.get(tagName);
6796
- if (!isUndefined$1(definition)) {
6797
- return definition.UserCtor; // defined by the patched custom elements registry
6798
- }
6799
-
6800
- if (registeredPivotCtors.has(NativeCtor)) {
6801
- return undefined; // pivot constructors should not be observable, return undefined
6802
- }
6803
-
6804
- return NativeCtor; // constructor that existed before patching
6805
- }
6806
- };
6807
-
6808
- CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
6809
- return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
6810
- var definition = globalDefinitionsByTag.get(tagName);
6811
- if (!isUndefined$1(definition)) {
6812
- return definition.UserCtor;
6813
- }
6814
- // In this case, the custom element must have been defined before the registry patches
6815
- // were applied. So return the non-pivot constructor
6816
- if (isUndefined$1(NativeCtor)) {
6817
- // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
6818
- // We can patch the correct behavior using customElements.get()
6819
- NativeCtor = nativeGet.call(nativeRegistry, tagName);
6820
- }
6821
- if (registeredPivotCtors.has(NativeCtor)) {
6822
- // Pivot constructors should not be observable. Wait to resolve the promise
6823
- // if a constructor is ever defined in userland
6824
- return createPendingWhenDefinedCallback(tagName);
6825
- }
6826
- return NativeCtor;
6827
- });
6828
- };
6829
- // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
6830
- // @ts-ignore
6831
- window.HTMLElement = function HTMLElement() {
6832
- // Upgrading case: the pivoting class constructor was run by the browser's
6833
- // native custom elements and we're in the process of running the
6834
- // "constructor-call trick" on the natively constructed instance, so just
6835
- // return that here.
6836
- // This code path is also called when LWC `new`s a PivotCtor.
6837
- var instance = upgradingInstance;
6838
- if (!isUndefined$1(instance)) {
6839
- upgradingInstance = undefined;
6840
- return instance;
6841
- }
6842
- // Construction case: we need to construct the pivoting instance and return it.
6843
- // This is possible when the user register it via global registry and instantiate
6844
- // it via `new Ctor()`.
6845
- var constructor = this.constructor;
6846
- var definition = globalDefinitionsByClass.get(constructor);
6847
- if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
6848
- // This code path is hit if someone `new`s a class that extends `HTMLElement` without
6849
- // doing `customElements.define()` first. This matches native browser behavior:
6850
- // https://stackoverflow.com/a/61883392
6851
- throw new TypeError('Illegal constructor');
6852
- }
6853
- // This constructor is ONLY invoked when it is the user instantiating
6854
- // an element via new Ctor while Ctor is a registered global constructor.
6855
- var PivotCtor = definition.PivotCtor,
6856
- UserCtor = definition.UserCtor;
6857
- return new PivotCtor(UserCtor);
6858
- };
6859
- HTMLElement.prototype = NativeHTMLElement.prototype;
6860
- /**
6861
- * Create a new PivotConstructor for the given tagName, which is capable of being constructed
6862
- * with a UserConstructor defining the behavior. Passing in the UserConstructor here
6863
- * is a hint that can be used when registering a custom element with the global custom elements
6864
- * registry for the first time, which provides certain optimizations. It also marks the UserConstructor
6865
- * as "safe" to be used when passed in to a PivotConstructor.
6866
- *
6867
- * @param tagName - element tag name
6868
- * @param UserCtor - userland custom element constructor
6869
- * @returns a new custom element constructor
6870
- */
6871
- return function createPivotConstructor(tagName, UserCtor) {
6872
- tagName = StringToLowerCase.call(tagName);
6873
- var PivotCtor = pivotCtorByTag.get(tagName);
6874
- if (isUndefined$1(PivotCtor)) {
6875
- var definition = getOrCreateDefinitionForConstructor(UserCtor);
6876
- PivotCtor = createPivotingClass(tagName, definition);
6877
- // Register a pivoting class as a global custom element
6878
- nativeDefine.call(nativeRegistry, tagName, PivotCtor);
6879
- definition.PivotCtor = PivotCtor;
6880
- // Only cache after nativeDefine has been called, because if it throws an error
6881
- // (e.g. for an invalid tag name), then we don't want to cache anything.
6882
- definitionForConstructor.set(UserCtor, definition);
6883
- pivotCtorByTag.set(tagName, PivotCtor);
6884
- }
6885
- // Register a UserConstructor as "safe" to be used within a PivotConstructor
6886
- registeredUserCtors.add(UserCtor);
6887
- return PivotCtor;
6888
- };
6889
- }
6890
-
6891
- /*
6892
- * Copyright (c) 2018, salesforce.com, inc.
6893
- * All rights reserved.
6894
- * SPDX-License-Identifier: MIT
6895
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6896
- */
6897
- var createScopedConstructor;
6898
- var CachedHTMLElement;
6899
- // We only call `createScopedRegistry()` if the browser supports custom elements and
6900
- // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
6901
- // or we're in a legacy browser.
6902
- if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6903
- if (hasCustomElements) {
6904
- // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
6905
- // It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
6906
- //
6907
- // Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
6908
- //
6909
- // 1. LWC loads
6910
- // 2. `const Ctor = class extends HTMLElement {}`
6911
- // 3. `lwc.createElement(...)` // here we lazily patch
6912
- // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
6913
- //
6914
- // To reduce the risk of this, it's safer to patch the registry eagerly.
6915
- createScopedConstructor = createScopedRegistry();
6916
- // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
6917
- // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
6918
- // because the HTMLElement prototypes are mixed up.
6919
- //
6920
- // The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
6921
- // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
6922
- // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
6923
- // Caching avoids this problem.
6924
- CachedHTMLElement = window.HTMLElement;
6925
- }
6926
- }
6927
- // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
6928
- // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
6929
- // multiple times per tag name.
6930
- var createUserConstructor = function createUserConstructor(HTMLElementToExtend, upgradeCallback, _connectedCallback, _disconnectedCallback) {
6931
- // TODO [#2972]: this class should expose observedAttributes as necessary
6932
- return /*#__PURE__*/function (_HTMLElementToExtend) {
6933
- _inherits(UserConstructor, _HTMLElementToExtend);
6934
- var _super8 = _createSuper(UserConstructor);
6935
- function UserConstructor() {
6936
- var _this5;
6937
- _classCallCheck(this, UserConstructor);
6938
- _this5 = _super8.call(this);
6939
- upgradeCallback(_assertThisInitialized(_this5));
6940
- return _this5;
6941
- }
6942
- // Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
6943
- // here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
6944
- // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
6945
- _createClass(UserConstructor, [{
6946
- key: "connectedCallback",
6947
- value: function connectedCallback() {
6948
- if (!isUndefined$1(_connectedCallback)) {
6949
- _connectedCallback(this);
6950
- }
6951
- }
6952
- }, {
6953
- key: "disconnectedCallback",
6954
- value: function disconnectedCallback() {
6955
- if (!isUndefined$1(_disconnectedCallback)) {
6956
- _disconnectedCallback(this);
6957
- }
6958
- }
6959
- }]);
6960
- return UserConstructor;
6961
- }(HTMLElementToExtend);
6962
- };
6963
- function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
6964
- if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
6965
- // This error should be impossible to hit
6966
- throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
6967
- }
6968
- var UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
6969
- var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
6970
- return new ScopedConstructor(UserConstructor);
6971
- }
6972
-
6973
6365
  /*
6974
6366
  * Copyright (c) 2018, salesforce.com, inc.
6975
6367
  * All rights reserved.
@@ -6977,26 +6369,18 @@ var LWC = (function (exports) {
6977
6369
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6978
6370
  */
6979
6371
  /**
6980
- * We have three modes for creating custom elements:
6372
+ * We have two modes for creating custom elements:
6981
6373
  *
6982
6374
  * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
6983
6375
  * 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
6984
6376
  * via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
6985
6377
  * a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
6986
6378
  * constructor"), which allows us to have completely customized functionality for different components.
6987
- * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
6988
- * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
6989
- * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
6990
- * because it must patch the global `customElements` and `HTMLElement` objects.
6991
6379
  */
6992
6380
  var createCustomElement;
6993
6381
  if (hasCustomElements) {
6994
- if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6995
- createCustomElement = createCustomElementScoped;
6996
- } else {
6997
- // use the global registry, with an upgradable constructor for the defined custom element
6998
- createCustomElement = createCustomElementUsingUpgradableConstructor;
6999
- }
6382
+ // use the global registry, with an upgradable constructor for the defined custom element
6383
+ createCustomElement = createCustomElementUsingUpgradableConstructor;
7000
6384
  } else {
7001
6385
  // no registry available here
7002
6386
  createCustomElement = createCustomElementCompat;
@@ -7060,7 +6444,7 @@ var LWC = (function (exports) {
7060
6444
  function isNull(obj) {
7061
6445
  return obj === null;
7062
6446
  }
7063
- /** version: 2.36.0 */
6447
+ /** version: 2.37.0 */
7064
6448
 
7065
6449
  /*
7066
6450
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7119,17 +6503,17 @@ var LWC = (function (exports) {
7119
6503
  exports.createFragment = function (html) {
7120
6504
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
7121
6505
  if (!isUndefined(wrapperTags)) {
7122
- var _iterator13 = _createForOfIteratorHelper(wrapperTags),
7123
- _step13;
6506
+ var _iterator11 = _createForOfIteratorHelper(wrapperTags),
6507
+ _step11;
7124
6508
  try {
7125
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
7126
- var wrapperTag = _step13.value;
6509
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
6510
+ var wrapperTag = _step11.value;
7127
6511
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
7128
6512
  }
7129
6513
  } catch (err) {
7130
- _iterator13.e(err);
6514
+ _iterator11.e(err);
7131
6515
  } finally {
7132
- _iterator13.f();
6516
+ _iterator11.f();
7133
6517
  }
7134
6518
  }
7135
6519
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -7405,23 +6789,23 @@ var LWC = (function (exports) {
7405
6789
  var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
7406
6790
  return _a = /*#__PURE__*/function (_HTMLElement2) {
7407
6791
  _inherits(_a, _HTMLElement2);
7408
- var _super9 = _createSuper(_a);
6792
+ var _super7 = _createSuper(_a);
7409
6793
  function _a() {
7410
- var _this6;
6794
+ var _this4;
7411
6795
  _classCallCheck(this, _a);
7412
- _this6 = _super9.call(this);
7413
- if (_this6.isConnected) {
6796
+ _this4 = _super7.call(this);
6797
+ if (_this4.isConnected) {
7414
6798
  // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
7415
- hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
7416
- hydratedCustomElements.add(_assertThisInitialized(_this6));
6799
+ hydrateComponent(_assertThisInitialized(_this4), Ctor, {});
6800
+ hydratedCustomElements.add(_assertThisInitialized(_this4));
7417
6801
  } else {
7418
- createVM(_assertThisInitialized(_this6), Ctor, renderer, {
6802
+ createVM(_assertThisInitialized(_this4), Ctor, renderer, {
7419
6803
  mode: 'open',
7420
6804
  owner: null,
7421
- tagName: _this6.tagName
6805
+ tagName: _this4.tagName
7422
6806
  });
7423
6807
  }
7424
- return _this6;
6808
+ return _this4;
7425
6809
  }
7426
6810
  _createClass(_a, [{
7427
6811
  key: "connectedCallback",
@@ -7619,7 +7003,7 @@ var LWC = (function (exports) {
7619
7003
  });
7620
7004
  freeze(LightningElement);
7621
7005
  seal(LightningElement.prototype);
7622
- /* version: 2.36.0 */
7006
+ /* version: 2.37.0 */
7623
7007
 
7624
7008
  exports.LightningElement = LightningElement;
7625
7009
  exports.__unstable__ProfilerControl = profilerControl;