@lwc/engine-core 8.6.0 → 8.7.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/index.cjs.js +29 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2024 Salesforce, Inc.
|
|
3
3
|
*/
|
|
4
|
-
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, assert, freeze, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice,
|
|
4
|
+
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, assert, freeze, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, isTrue, KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, sanitizeHtmlContent, StringTrim, ArraySort, ArrayFrom, htmlEscape, StringCharAt, LOWEST_API_VERSION, ArrayUnshift, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, StringSplit, parseStyleText, arrayEvery, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
|
|
5
5
|
export { setHooks, setTrustedSignalSet } from '@lwc/shared';
|
|
6
6
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
7
7
|
|
|
@@ -3197,29 +3197,29 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3197
3197
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3198
3198
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3199
3199
|
}
|
|
3200
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3200
|
+
const isScopedCss = isTrue(stylesheet[KEY__SCOPED_CSS]);
|
|
3201
|
+
const isNativeOnlyCss = isTrue(stylesheet[KEY__NATIVE_ONLY_CSS]);
|
|
3202
|
+
const { renderMode, shadowMode } = vm;
|
|
3201
3203
|
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
|
|
3202
3204
|
!isScopedCss &&
|
|
3203
|
-
|
|
3205
|
+
renderMode === 0 /* RenderMode.Light */) {
|
|
3204
3206
|
logError('Unscoped CSS is not supported in Light DOM in this environment. Please use scoped CSS ' +
|
|
3205
3207
|
'(*.scoped.css) instead of unscoped CSS (*.css). See also: https://sfdc.co/scoped-styles-light-dom');
|
|
3206
3208
|
continue;
|
|
3207
3209
|
}
|
|
3208
3210
|
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3209
3211
|
const scopeToken = isScopedCss ||
|
|
3210
|
-
(
|
|
3212
|
+
(shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode === 1 /* RenderMode.Shadow */)
|
|
3211
3213
|
? stylesheetToken
|
|
3212
3214
|
: undefined;
|
|
3213
3215
|
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3214
3216
|
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3215
|
-
const useActualHostSelector =
|
|
3216
|
-
? !isScopedCss
|
|
3217
|
-
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3217
|
+
const useActualHostSelector = renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : shadowMode === 0 /* ShadowMode.Native */;
|
|
3218
3218
|
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3219
3219
|
// we use an attribute selector on the host to simulate :dir().
|
|
3220
3220
|
let useNativeDirPseudoclass;
|
|
3221
|
-
if (
|
|
3222
|
-
useNativeDirPseudoclass =
|
|
3221
|
+
if (renderMode === 1 /* RenderMode.Shadow */) {
|
|
3222
|
+
useNativeDirPseudoclass = shadowMode === 0 /* ShadowMode.Native */;
|
|
3223
3223
|
}
|
|
3224
3224
|
else {
|
|
3225
3225
|
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
@@ -3230,7 +3230,18 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3232
3232
|
}
|
|
3233
|
-
|
|
3233
|
+
let cssContent;
|
|
3234
|
+
if (isNativeOnlyCss &&
|
|
3235
|
+
renderMode === 1 /* RenderMode.Shadow */ &&
|
|
3236
|
+
shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3237
|
+
// Native-only (i.e. disableSyntheticShadowSupport) CSS should be ignored entirely
|
|
3238
|
+
// in synthetic shadow. It's fine to use in either native shadow or light DOM, but in
|
|
3239
|
+
// synthetic shadow it wouldn't be scoped properly and so should be ignored.
|
|
3240
|
+
cssContent = '/* ignored native-only CSS */';
|
|
3241
|
+
}
|
|
3242
|
+
else {
|
|
3243
|
+
cssContent = stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass);
|
|
3244
|
+
}
|
|
3234
3245
|
if (process.env.NODE_ENV !== 'production') {
|
|
3235
3246
|
linkStylesheetToCssContentInDevMode(stylesheet, cssContent);
|
|
3236
3247
|
}
|
|
@@ -6441,7 +6452,13 @@ function evaluateTemplate(vm, html) {
|
|
|
6441
6452
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
6442
6453
|
const { styleVNodes } = context;
|
|
6443
6454
|
if (!isNull(styleVNodes)) {
|
|
6444
|
-
|
|
6455
|
+
// It's important here not to mutate the underlying `vnodes` returned from `html.call()`.
|
|
6456
|
+
// The reason for this is because, due to the static content optimization, the vnodes array
|
|
6457
|
+
// may be a static array shared across multiple component instances. E.g. this occurs in the
|
|
6458
|
+
// case of an empty `<template></template>` in a `component.html` file, due to the underlying
|
|
6459
|
+
// children being `[]` (no children). If we append the `<style>` vnode to this array, then the same
|
|
6460
|
+
// array will be reused for every component instance, i.e. whenever `tmpl()` is called.
|
|
6461
|
+
vnodes = [...styleVNodes, ...vnodes];
|
|
6445
6462
|
}
|
|
6446
6463
|
});
|
|
6447
6464
|
}, () => {
|
|
@@ -8167,10 +8184,7 @@ const TEMPLATE_PROPS = [
|
|
|
8167
8184
|
'legacyStylesheetToken',
|
|
8168
8185
|
];
|
|
8169
8186
|
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
8170
|
-
const STYLESHEET_PROPS = [
|
|
8171
|
-
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
8172
|
-
'$scoped$',
|
|
8173
|
-
];
|
|
8187
|
+
const STYLESHEET_PROPS = [KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS];
|
|
8174
8188
|
// Via https://www.npmjs.com/package/object-observer
|
|
8175
8189
|
const ARRAY_MUTATION_METHODS = [
|
|
8176
8190
|
'pop',
|
|
@@ -8415,5 +8429,5 @@ function readonly(obj) {
|
|
|
8415
8429
|
}
|
|
8416
8430
|
|
|
8417
8431
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
8418
|
-
/** version: 8.
|
|
8432
|
+
/** version: 8.7.0 */
|
|
8419
8433
|
//# sourceMappingURL=index.js.map
|