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