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