@lwc/engine-core 8.3.0 → 8.5.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 +1 -1
- package/dist/framework/check-version-mismatch.d.ts +1 -1
- package/dist/framework/hot-swaps.d.ts +1 -1
- package/dist/framework/main.d.ts +1 -1
- package/dist/framework/stylesheet.d.ts +1 -10
- package/dist/framework/template.d.ts +1 -1
- package/dist/framework/utils.d.ts +0 -2
- package/dist/framework/vm.d.ts +1 -1
- package/dist/index.cjs.js +23 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +22 -20
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -10,7 +10,7 @@ import { AccessibleElementProperties } from '@lwc/shared';
|
|
|
10
10
|
import { ShadowSupportMode } from './vm';
|
|
11
11
|
import { Template } from './template';
|
|
12
12
|
import { HTMLElementConstructor } from './base-bridge-element';
|
|
13
|
-
import { Stylesheets } from '
|
|
13
|
+
import type { Stylesheets } from '@lwc/shared';
|
|
14
14
|
export interface LightningElementConstructor {
|
|
15
15
|
new (): LightningElement;
|
|
16
16
|
readonly prototype: LightningElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Template } from './template';
|
|
2
|
-
import { Stylesheet } from './stylesheet';
|
|
3
2
|
import { LightningElementConstructor } from './base-lightning-element';
|
|
3
|
+
import type { Stylesheet } from '@lwc/shared';
|
|
4
4
|
/**
|
|
5
5
|
* Validate a template, stylesheet, or component to make sure that its compiled version matches
|
|
6
6
|
* the version used by the LWC engine at runtime. Note that this only works in dev mode because
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VM } from './vm';
|
|
2
2
|
import { LightningElementConstructor } from './base-lightning-element';
|
|
3
3
|
import { Template } from './template';
|
|
4
|
-
import { Stylesheet } from '
|
|
4
|
+
import type { Stylesheet } from '@lwc/shared';
|
|
5
5
|
export declare function getTemplateOrSwappedTemplate(tpl: Template): Template;
|
|
6
6
|
export declare function getComponentOrSwappedComponent(Ctor: LightningElementConstructor): LightningElementConstructor;
|
|
7
7
|
export declare function getStyleOrSwappedStyle(style: Stylesheet): Stylesheet;
|
package/dist/framework/main.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export { getComponentAPIVersion } from './component';
|
|
|
18
18
|
export { shouldBeFormAssociated } from './utils';
|
|
19
19
|
export { getComponentConstructor } from './get-component-constructor';
|
|
20
20
|
export type { RendererAPI, LifecycleCallback } from './renderer';
|
|
21
|
-
export type { Stylesheets } from './stylesheet';
|
|
22
21
|
export type { Template } from './template';
|
|
23
22
|
export type { ConfigValue as WireConfigValue, ContextConsumer as WireContextConsumer, ContextProvider as WireContextProvider, ContextValue as WireContextValue, DataCallback as WireDataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './wiring';
|
|
24
23
|
export type { FormRestoreState, FormRestoreReason } from './vm';
|
|
@@ -29,3 +28,4 @@ export { default as wire } from './decorators/wire';
|
|
|
29
28
|
export { readonly } from './readonly';
|
|
30
29
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
31
30
|
export { setTrustedSignalSet } from '@lwc/shared';
|
|
31
|
+
export type { Stylesheet, Stylesheets } from '@lwc/shared';
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { VM } from './vm';
|
|
2
2
|
import { Template } from './template';
|
|
3
3
|
import { VCustomElement, VNode } from './vnodes';
|
|
4
|
-
|
|
5
|
-
* Function producing style based on a host and a shadow selector. This function is invoked by
|
|
6
|
-
* the engine with different values depending on the mode that the component is running on.
|
|
7
|
-
*/
|
|
8
|
-
export type Stylesheet = (stylesheetToken: string | undefined, useActualHostSelector: boolean, useNativeDirPseudoclass: boolean) => string;
|
|
9
|
-
/**
|
|
10
|
-
* The list of stylesheets associated with a template. Each entry is either a `Stylesheet` or
|
|
11
|
-
* an array of stylesheets that a given stylesheet depends on via CSS `@import` declarations.
|
|
12
|
-
*/
|
|
13
|
-
export type Stylesheets = Array<Stylesheet | Stylesheets>;
|
|
4
|
+
import type { Stylesheet } from '@lwc/shared';
|
|
14
5
|
export declare function updateStylesheetToken(vm: VM, template: Template, legacy: boolean): void;
|
|
15
6
|
export declare function getStylesheetsContent(vm: VM, template: Template): ReadonlyArray<string>;
|
|
16
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RenderAPI } from './api';
|
|
2
2
|
import { SlotSet, TemplateCache, VM } from './vm';
|
|
3
|
-
import { Stylesheets } from './stylesheet';
|
|
4
3
|
import { VNodes } from './vnodes';
|
|
4
|
+
import type { Stylesheets } from '@lwc/shared';
|
|
5
5
|
export interface Template {
|
|
6
6
|
(api: RenderAPI, cmp: object, slotSet: SlotSet, cache: TemplateCache): VNodes;
|
|
7
7
|
/** The list of slot names used in the template. */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Stylesheet, Stylesheets } from './stylesheet';
|
|
2
1
|
import { LightningElementConstructor } from './base-lightning-element';
|
|
3
2
|
type Callback = () => void;
|
|
4
3
|
export declare const SPACE_CHAR = 32;
|
|
@@ -11,7 +10,6 @@ export declare function cloneAndOmitKey(object: {
|
|
|
11
10
|
}, keyToOmit: string): {
|
|
12
11
|
[key: string]: any;
|
|
13
12
|
};
|
|
14
|
-
export declare function flattenStylesheets(stylesheets: Stylesheets): Stylesheet[];
|
|
15
13
|
export declare function assertNotProd(): void;
|
|
16
14
|
export declare function shouldBeFormAssociated(Ctor: LightningElementConstructor): boolean;
|
|
17
15
|
export {};
|
package/dist/framework/vm.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ComponentDef } from './def';
|
|
|
5
5
|
import { LightningElement, LightningElementConstructor, LightningElementShadowRoot } from './base-lightning-element';
|
|
6
6
|
import { ReactiveObserver } from './mutation-tracker';
|
|
7
7
|
import { VNodes, VCustomElement, VNode, VBaseElement, VStaticPartElement } from './vnodes';
|
|
8
|
-
import { Stylesheets } from '
|
|
8
|
+
import type { Stylesheets } from '@lwc/shared';
|
|
9
9
|
type ShadowRootMode = 'open' | 'closed';
|
|
10
10
|
export interface TemplateCache {
|
|
11
11
|
[key: string]: any;
|
package/dist/index.cjs.js
CHANGED
|
@@ -231,18 +231,6 @@ function cloneAndOmitKey(object, keyToOmit) {
|
|
|
231
231
|
}
|
|
232
232
|
return result;
|
|
233
233
|
}
|
|
234
|
-
function flattenStylesheets(stylesheets) {
|
|
235
|
-
const list = [];
|
|
236
|
-
for (const stylesheet of stylesheets) {
|
|
237
|
-
if (!shared.isArray(stylesheet)) {
|
|
238
|
-
list.push(stylesheet);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return list;
|
|
245
|
-
}
|
|
246
234
|
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
247
235
|
function assertNotProd() {
|
|
248
236
|
/* istanbul ignore if */
|
|
@@ -296,6 +284,16 @@ function toPrettyMemberNotation(parent, child) {
|
|
|
296
284
|
return `${shared.toString(parent)}[${JSON.stringify(child)}]`;
|
|
297
285
|
}
|
|
298
286
|
}
|
|
287
|
+
function safelyCallGetter(target, key) {
|
|
288
|
+
// Arbitrary getters can throw. We don't want to throw an error just due to dev-mode-only mutation tracking
|
|
289
|
+
// (which is only used for performance debugging) so ignore errors here.
|
|
290
|
+
try {
|
|
291
|
+
return target[key];
|
|
292
|
+
}
|
|
293
|
+
catch (_err) {
|
|
294
|
+
/* ignore */
|
|
295
|
+
}
|
|
296
|
+
}
|
|
299
297
|
/**
|
|
300
298
|
* Flush all the logs we've written so far and return the current logs.
|
|
301
299
|
*/
|
|
@@ -364,7 +362,7 @@ function trackTargetForMutationLogging(key, target) {
|
|
|
364
362
|
// Deeply traverse arrays and objects to track every object within
|
|
365
363
|
if (shared.isArray(target)) {
|
|
366
364
|
for (let i = 0; i < target.length; i++) {
|
|
367
|
-
trackTargetForMutationLogging(toPrettyMemberNotation(key, i), target
|
|
365
|
+
trackTargetForMutationLogging(toPrettyMemberNotation(key, i), safelyCallGetter(target, i));
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
368
|
else {
|
|
@@ -373,10 +371,10 @@ function trackTargetForMutationLogging(key, target) {
|
|
|
373
371
|
// https://github.com/salesforce/observable-membrane/blob/b85417f/src/base-handler.ts#L142-L143
|
|
374
372
|
// Note this code path is very hot, hence doing two separate for-loops rather than creating a new array.
|
|
375
373
|
for (const prop of shared.getOwnPropertyNames(target)) {
|
|
376
|
-
trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target
|
|
374
|
+
trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
|
|
377
375
|
}
|
|
378
376
|
for (const prop of shared.getOwnPropertySymbols(target)) {
|
|
379
|
-
trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target
|
|
377
|
+
trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
|
|
380
378
|
}
|
|
381
379
|
}
|
|
382
380
|
}
|
|
@@ -669,8 +667,9 @@ for (const [propName, attrName] of shared.entries(shared.AriaPropNameToAttrNameM
|
|
|
669
667
|
return this.getAttribute(attrName);
|
|
670
668
|
},
|
|
671
669
|
set(newValue) {
|
|
672
|
-
// TODO [#3284]:
|
|
673
|
-
//
|
|
670
|
+
// TODO [#3284]: According to the spec, IDL nullable type values
|
|
671
|
+
// (null and undefined) should remove the attribute; however, we
|
|
672
|
+
// only do so in the case of null for historical reasons.
|
|
674
673
|
// See also https://github.com/w3c/aria/issues/1858
|
|
675
674
|
if (shared.isNull(newValue)) {
|
|
676
675
|
this.removeAttribute(attrName);
|
|
@@ -3569,7 +3568,7 @@ function addActiveStylesheets(stylesheets, vm) {
|
|
|
3569
3568
|
// Ignore non-existent stylesheets
|
|
3570
3569
|
return;
|
|
3571
3570
|
}
|
|
3572
|
-
for (const stylesheet of flattenStylesheets(stylesheets)) {
|
|
3571
|
+
for (const stylesheet of shared.flattenStylesheets(stylesheets)) {
|
|
3573
3572
|
// this is necessary because we don't hold the list of styles
|
|
3574
3573
|
// in the vm, we only hold the selected (already swapped template)
|
|
3575
3574
|
// but the styles attached to the template might not be the actual
|
|
@@ -6885,7 +6884,7 @@ function computeStylesheets(vm, ctor) {
|
|
|
6885
6884
|
if (!shared.isUndefined(stylesheets)) {
|
|
6886
6885
|
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
6887
6886
|
if (valid) {
|
|
6888
|
-
return flattenStylesheets(stylesheets);
|
|
6887
|
+
return shared.flattenStylesheets(stylesheets);
|
|
6889
6888
|
}
|
|
6890
6889
|
else if (process.env.NODE_ENV !== 'production') {
|
|
6891
6890
|
logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
|
|
@@ -8008,7 +8007,10 @@ function validateClassAttr(vnode, elm, data, renderer) {
|
|
|
8008
8007
|
let nodesAreCompatible = true;
|
|
8009
8008
|
let readableVnodeClassname;
|
|
8010
8009
|
const elmClassName = getAttribute(elm, 'class');
|
|
8011
|
-
if (!shared.isUndefined(className) &&
|
|
8010
|
+
if (!shared.isUndefined(className) &&
|
|
8011
|
+
String(className) !== elmClassName &&
|
|
8012
|
+
// No mismatch if SSR `class` attribute is missing and CSR `class` is the empty string
|
|
8013
|
+
!(className === '' && shared.isNull(elmClassName))) {
|
|
8012
8014
|
// className is used when class is bound to an expr.
|
|
8013
8015
|
nodesAreCompatible = false;
|
|
8014
8016
|
// stringify for pretty-printing
|
|
@@ -8493,5 +8495,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8493
8495
|
exports.track = track;
|
|
8494
8496
|
exports.unwrap = unwrap;
|
|
8495
8497
|
exports.wire = wire;
|
|
8496
|
-
/** version: 8.
|
|
8498
|
+
/** version: 8.5.0 */
|
|
8497
8499
|
//# sourceMappingURL=index.cjs.js.map
|