@lwc/engine-core 7.1.2 → 7.2.1
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/stylesheet.d.ts +2 -2
- package/dist/index.cjs.js +20 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -12,7 +12,7 @@ export type Stylesheet = (stylesheetToken: string | undefined, useActualHostSele
|
|
|
12
12
|
*/
|
|
13
13
|
export type Stylesheets = Array<Stylesheet | Stylesheets>;
|
|
14
14
|
export declare function updateStylesheetToken(vm: VM, template: Template, legacy: boolean): void;
|
|
15
|
-
export declare function getStylesheetsContent(vm: VM, template: Template): string
|
|
15
|
+
export declare function getStylesheetsContent(vm: VM, template: Template): ReadonlyArray<string>;
|
|
16
16
|
/**
|
|
17
17
|
* If the component that is currently being rendered uses scoped styles,
|
|
18
18
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
@@ -29,5 +29,5 @@ export declare function getScopeTokenClass(owner: VM, legacy: boolean): string |
|
|
|
29
29
|
* @param vnode
|
|
30
30
|
*/
|
|
31
31
|
export declare function getStylesheetTokenHost(vnode: VCustomElement): string | null;
|
|
32
|
-
export declare function createStylesheet(vm: VM, stylesheets: string
|
|
32
|
+
export declare function createStylesheet(vm: VM, stylesheets: ReadonlyArray<string>): VNode[] | null;
|
|
33
33
|
export declare function unrenderStylesheet(stylesheet: Stylesheet): void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -3133,15 +3133,22 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3133
3133
|
function getStylesheetsContent(vm, template) {
|
|
3134
3134
|
const { stylesheets, stylesheetToken } = template;
|
|
3135
3135
|
const { stylesheets: vmStylesheets } = vm;
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3136
|
+
const hasTemplateStyles = hasStyles(stylesheets);
|
|
3137
|
+
const hasVmStyles = hasStyles(vmStylesheets);
|
|
3138
|
+
if (hasTemplateStyles) {
|
|
3139
|
+
const content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3140
|
+
if (hasVmStyles) {
|
|
3141
|
+
// Slow path – merge the template styles and vm styles
|
|
3142
|
+
shared.ArrayPush.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
3143
|
+
}
|
|
3144
|
+
return content;
|
|
3139
3145
|
}
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3146
|
+
if (hasVmStyles) {
|
|
3147
|
+
// No template styles, so return vm styles directly
|
|
3148
|
+
return evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm);
|
|
3143
3149
|
}
|
|
3144
|
-
return
|
|
3150
|
+
// Fastest path - no styles, so return an empty array
|
|
3151
|
+
return EmptyArray;
|
|
3145
3152
|
}
|
|
3146
3153
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3147
3154
|
// perf testing has not shown it to be a huge improvement yet:
|
|
@@ -5345,14 +5352,14 @@ function i(iterable, factory) {
|
|
|
5345
5352
|
// TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
|
|
5346
5353
|
sc(list);
|
|
5347
5354
|
const vmBeingRendered = getVMBeingRendered();
|
|
5348
|
-
if (shared.isUndefined(iterable) || iterable
|
|
5355
|
+
if (shared.isUndefined(iterable) || shared.isNull(iterable)) {
|
|
5349
5356
|
if (process.env.NODE_ENV !== 'production') {
|
|
5350
|
-
logError(`Invalid template iteration for value
|
|
5357
|
+
logError(`Invalid template iteration for value \`${shared.toString(iterable)}\` in ${vmBeingRendered}. It must be an array-like object.`, vmBeingRendered);
|
|
5351
5358
|
}
|
|
5352
5359
|
return list;
|
|
5353
5360
|
}
|
|
5354
5361
|
if (process.env.NODE_ENV !== 'production') {
|
|
5355
|
-
shared.assert.isFalse(shared.isUndefined(iterable[SymbolIterator]), `Invalid template iteration for value \`${shared.toString(iterable)}\` in ${vmBeingRendered}. It must be an array-like object
|
|
5362
|
+
shared.assert.isFalse(shared.isUndefined(iterable[SymbolIterator]), `Invalid template iteration for value \`${shared.toString(iterable)}\` in ${vmBeingRendered}. It must be an array-like object.`);
|
|
5356
5363
|
}
|
|
5357
5364
|
const iterator = iterable[SymbolIterator]();
|
|
5358
5365
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5489,9 +5496,6 @@ function k(compilerKey, obj) {
|
|
|
5489
5496
|
function gid(id) {
|
|
5490
5497
|
const vmBeingRendered = getVMBeingRendered();
|
|
5491
5498
|
if (shared.isUndefined(id) || id === '') {
|
|
5492
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5493
|
-
logError(`Invalid id value "${id}". The id attribute must contain a non-empty string.`, vmBeingRendered);
|
|
5494
|
-
}
|
|
5495
5499
|
return id;
|
|
5496
5500
|
}
|
|
5497
5501
|
// We remove attributes when they are assigned a value of null
|
|
@@ -5508,11 +5512,6 @@ function gid(id) {
|
|
|
5508
5512
|
function fid(url) {
|
|
5509
5513
|
const vmBeingRendered = getVMBeingRendered();
|
|
5510
5514
|
if (shared.isUndefined(url) || url === '') {
|
|
5511
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5512
|
-
if (shared.isUndefined(url)) {
|
|
5513
|
-
logError(`Undefined url value for "href" or "xlink:href" attribute. Expected a non-empty string.`, vmBeingRendered);
|
|
5514
|
-
}
|
|
5515
|
-
}
|
|
5516
5515
|
return url;
|
|
5517
5516
|
}
|
|
5518
5517
|
// We remove attributes when they are assigned a value of null
|
|
@@ -6552,6 +6551,8 @@ function computeShadowMode(def, owner, renderer, hydrated) {
|
|
|
6552
6551
|
// on, but components running in actual native shadow mode
|
|
6553
6552
|
(process.env.NODE_ENV === 'test-karma-lwc' &&
|
|
6554
6553
|
process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST) ||
|
|
6554
|
+
// If synthetic shadow is explicitly disabled, use pure-native
|
|
6555
|
+
lwcRuntimeFlags.DISABLE_SYNTHETIC_SHADOW ||
|
|
6555
6556
|
// hydration only supports native shadow
|
|
6556
6557
|
shared.isTrue(hydrated)) {
|
|
6557
6558
|
return 0 /* ShadowMode.Native */;
|
|
@@ -8091,5 +8092,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8091
8092
|
exports.track = track;
|
|
8092
8093
|
exports.unwrap = unwrap;
|
|
8093
8094
|
exports.wire = wire;
|
|
8094
|
-
/** version: 7.1
|
|
8095
|
+
/** version: 7.2.1 */
|
|
8095
8096
|
//# sourceMappingURL=index.cjs.js.map
|