@lwc/engine-core 6.2.1 → 6.3.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/framework/base-lightning-element.d.ts +3 -2
- package/dist/index.cjs.js +31 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +31 -18
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -23,13 +23,14 @@ export interface LightningElementConstructor {
|
|
|
23
23
|
}
|
|
24
24
|
type HTMLElementTheGoodParts = {
|
|
25
25
|
toString: () => string;
|
|
26
|
-
} & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title'>;
|
|
26
|
+
} & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'shadowRoot' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title'>;
|
|
27
27
|
type RefNodes = {
|
|
28
28
|
[name: string]: Element;
|
|
29
29
|
};
|
|
30
30
|
export interface LightningElement extends HTMLElementTheGoodParts, AccessibleElementProperties {
|
|
31
|
+
constructor: LightningElementConstructor;
|
|
31
32
|
template: ShadowRoot | null;
|
|
32
|
-
refs: RefNodes;
|
|
33
|
+
refs: RefNodes | undefined;
|
|
33
34
|
render(): Template;
|
|
34
35
|
connectedCallback?(): void;
|
|
35
36
|
disconnectedCallback?(): void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -132,7 +132,7 @@ function addErrorComponentStack(vm, error) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/*
|
|
135
|
-
* Copyright (c)
|
|
135
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
136
136
|
* All rights reserved.
|
|
137
137
|
* SPDX-License-Identifier: MIT
|
|
138
138
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -140,7 +140,6 @@ function addErrorComponentStack(vm, error) {
|
|
|
140
140
|
const alreadyLoggedMessages = new Set();
|
|
141
141
|
// Only used in LWC's Karma tests
|
|
142
142
|
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
143
|
-
// @ts-ignore
|
|
144
143
|
window.__lwcResetAlreadyLoggedMessages = () => {
|
|
145
144
|
alreadyLoggedMessages.clear();
|
|
146
145
|
};
|
|
@@ -798,7 +797,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
798
797
|
logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
|
|
799
798
|
}
|
|
800
799
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
801
|
-
// @ts-
|
|
800
|
+
// @ts-expect-error type-mismatch
|
|
802
801
|
return originalAddEventListener.apply(this, arguments);
|
|
803
802
|
},
|
|
804
803
|
}),
|
|
@@ -847,7 +846,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
847
846
|
logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
|
|
848
847
|
}
|
|
849
848
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
850
|
-
// @ts-
|
|
849
|
+
// @ts-expect-error type-mismatch
|
|
851
850
|
return originalAddEventListener.apply(this, arguments);
|
|
852
851
|
},
|
|
853
852
|
}),
|
|
@@ -1599,7 +1598,7 @@ const refsCache = new WeakMap();
|
|
|
1599
1598
|
* This class is the base class for any LWC element.
|
|
1600
1599
|
* Some elements directly extends this class, others implement it via inheritance.
|
|
1601
1600
|
*/
|
|
1602
|
-
// @ts-
|
|
1601
|
+
// @ts-expect-error When exported, it will conform, but we need to build it first!
|
|
1603
1602
|
const LightningElement = function () {
|
|
1604
1603
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1605
1604
|
if (shared.isNull(vmBeingConstructed)) {
|
|
@@ -1741,7 +1740,7 @@ function createElementInternalsProxy(elementInternals, isFormAssociated) {
|
|
|
1741
1740
|
});
|
|
1742
1741
|
return elementInternalsProxy;
|
|
1743
1742
|
}
|
|
1744
|
-
//
|
|
1743
|
+
// Type assertion because we need to build the prototype before it satisfies the interface.
|
|
1745
1744
|
LightningElement.prototype = {
|
|
1746
1745
|
constructor: LightningElement,
|
|
1747
1746
|
dispatchEvent(event) {
|
|
@@ -1943,6 +1942,9 @@ LightningElement.prototype = {
|
|
|
1943
1942
|
if (process.env.NODE_ENV !== 'production') {
|
|
1944
1943
|
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
1945
1944
|
}
|
|
1945
|
+
// getChildNodes returns a NodeList, which has `item(index: number): Node | null`.
|
|
1946
|
+
// NodeListOf<T> extends NodeList, but claims to not return null. That seems inaccurate,
|
|
1947
|
+
// but these are built-in types, so ultimately not our problem.
|
|
1946
1948
|
return renderer.getChildNodes(vm.elm);
|
|
1947
1949
|
},
|
|
1948
1950
|
get firstChild() {
|
|
@@ -2182,7 +2184,7 @@ function createConfigWatcher(component, configCallback, callbackWhenConfigIsRead
|
|
|
2182
2184
|
ro.observe(() => (config = configCallback(component)));
|
|
2183
2185
|
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2184
2186
|
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
2185
|
-
// @ts-
|
|
2187
|
+
// @ts-expect-error it is assigned in the observe() callback
|
|
2186
2188
|
callbackWhenConfigIsReady(config);
|
|
2187
2189
|
};
|
|
2188
2190
|
return {
|
|
@@ -2258,7 +2260,7 @@ function createConnector(vm, name, wireDef) {
|
|
|
2258
2260
|
});
|
|
2259
2261
|
}
|
|
2260
2262
|
return {
|
|
2261
|
-
// @ts-
|
|
2263
|
+
// @ts-expect-error the boundary protection executes sync, connector is always defined
|
|
2262
2264
|
connector,
|
|
2263
2265
|
computeConfigAndUpdate,
|
|
2264
2266
|
resetConfigWatcher: () => ro.reset(),
|
|
@@ -2737,7 +2739,6 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2737
2739
|
let warned = false;
|
|
2738
2740
|
// Only used in LWC's Karma tests
|
|
2739
2741
|
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
2740
|
-
// @ts-ignore
|
|
2741
2742
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2742
2743
|
warned = false;
|
|
2743
2744
|
};
|
|
@@ -2855,7 +2856,7 @@ function createAttributeChangedCallback(attributeToPropMap, superAttributeChange
|
|
|
2855
2856
|
if (!shared.isUndefined(superAttributeChangedCallback)) {
|
|
2856
2857
|
// delegate unknown attributes to the super.
|
|
2857
2858
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
2858
|
-
// @ts-
|
|
2859
|
+
// @ts-expect-error type-mismatch
|
|
2859
2860
|
superAttributeChangedCallback.apply(this, arguments);
|
|
2860
2861
|
}
|
|
2861
2862
|
return;
|
|
@@ -5608,9 +5609,27 @@ function validateLightDomTemplate(template, vm) {
|
|
|
5608
5609
|
}
|
|
5609
5610
|
}
|
|
5610
5611
|
}
|
|
5612
|
+
// This should be a no-op outside of LWC's Karma tests, where it's not needed
|
|
5613
|
+
let registerFragmentCache = shared.noop;
|
|
5614
|
+
// Only used in LWC's Karma tests
|
|
5615
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
5616
|
+
// Keep track of fragmentCaches, so we can clear them in LWC's Karma tests
|
|
5617
|
+
const fragmentCaches = [];
|
|
5618
|
+
registerFragmentCache = (fragmentCache) => {
|
|
5619
|
+
fragmentCaches.push(fragmentCache);
|
|
5620
|
+
};
|
|
5621
|
+
window.__lwcResetFragmentCaches = () => {
|
|
5622
|
+
for (const fragmentCache of fragmentCaches) {
|
|
5623
|
+
for (const key of shared.keys(fragmentCache)) {
|
|
5624
|
+
delete fragmentCache[key];
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
};
|
|
5628
|
+
}
|
|
5611
5629
|
function buildParseFragmentFn(createFragmentFn) {
|
|
5612
5630
|
return (strings, ...keys) => {
|
|
5613
5631
|
const cache = shared.create(null);
|
|
5632
|
+
registerFragmentCache(cache);
|
|
5614
5633
|
return function () {
|
|
5615
5634
|
const { context: { hasScopedStyles, stylesheetToken, legacyStylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
5616
5635
|
const hasStyleToken = !shared.isUndefined(stylesheetToken);
|
|
@@ -5623,11 +5642,6 @@ function buildParseFragmentFn(createFragmentFn) {
|
|
|
5623
5642
|
if (hasStyleToken && isSyntheticShadow) {
|
|
5624
5643
|
cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
|
|
5625
5644
|
}
|
|
5626
|
-
if (hasLegacyToken) {
|
|
5627
|
-
// This isn't strictly required for prod, but it's required for our karma tests
|
|
5628
|
-
// since the lwcRuntimeFlag may change over time
|
|
5629
|
-
cacheKey |= 4 /* FragmentCache.HAS_LEGACY_SCOPE_TOKEN */;
|
|
5630
|
-
}
|
|
5631
5645
|
if (!shared.isUndefined(cache[cacheKey])) {
|
|
5632
5646
|
return cache[cacheKey];
|
|
5633
5647
|
}
|
|
@@ -6817,7 +6831,6 @@ function enableDetection() {
|
|
|
6817
6831
|
throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
|
|
6818
6832
|
}
|
|
6819
6833
|
}
|
|
6820
|
-
// @ts-ignore
|
|
6821
6834
|
const { get, set } = descriptor;
|
|
6822
6835
|
// It's important for this defineProperty call to happen _after_ ARIA accessors are applied to the
|
|
6823
6836
|
// BaseBridgeElement and LightningElement prototypes. Otherwise, we will log/report for access of non-standard
|
|
@@ -7428,7 +7441,7 @@ function warnOnArrayMutation(stylesheets) {
|
|
|
7428
7441
|
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
7429
7442
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
7430
7443
|
reportTemplateViolation('stylesheets');
|
|
7431
|
-
// @ts-
|
|
7444
|
+
// @ts-expect-error can't properly determine the right `this`
|
|
7432
7445
|
return originalArrayMethod.apply(this, arguments);
|
|
7433
7446
|
};
|
|
7434
7447
|
}
|
|
@@ -7656,5 +7669,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7656
7669
|
exports.track = track;
|
|
7657
7670
|
exports.unwrap = unwrap;
|
|
7658
7671
|
exports.wire = wire;
|
|
7659
|
-
/** version: 6.
|
|
7672
|
+
/** version: 6.3.0 */
|
|
7660
7673
|
//# sourceMappingURL=index.cjs.js.map
|