@lwc/engine-core 8.5.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/framework/api.d.ts +0 -6
- package/dist/framework/main.d.ts +1 -1
- package/dist/index.cjs.js +35 -48
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +34 -50
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/framework/overridable-hooks.d.ts +0 -6
package/dist/framework/api.d.ts
CHANGED
|
@@ -40,12 +40,6 @@ declare function ddc(sel: string, Ctor: LightningElementConstructor | null | und
|
|
|
40
40
|
* @param children
|
|
41
41
|
*/
|
|
42
42
|
declare function dc(Ctor: LightningElementConstructor | null | undefined, data: VElementData, children?: VNodes): VCustomElement | null;
|
|
43
|
-
export type SanitizeHtmlContentHook = (content: unknown) => string;
|
|
44
|
-
/**
|
|
45
|
-
* Sets the sanitizeHtmlContentHook.
|
|
46
|
-
* @param newHookImpl
|
|
47
|
-
*/
|
|
48
|
-
export declare function setSanitizeHtmlContentHook(newHookImpl: SanitizeHtmlContentHook): void;
|
|
49
43
|
declare function shc(content: unknown): SanitizedHtmlContent;
|
|
50
44
|
/**
|
|
51
45
|
* [ncls] - Normalize class name attribute.
|
package/dist/framework/main.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { getComponentDef, isComponentConstructor } from './def';
|
|
|
12
12
|
export { profilerControl as __unstable__ProfilerControl } from './profiler';
|
|
13
13
|
export { reportingControl as __unstable__ReportingControl } from './reporting';
|
|
14
14
|
export { swapTemplate, swapComponent, swapStyle } from './hot-swaps';
|
|
15
|
-
export { setHooks } from '
|
|
15
|
+
export { setHooks } from '@lwc/shared';
|
|
16
16
|
export { freezeTemplate } from './freeze-template';
|
|
17
17
|
export { getComponentAPIVersion } from './component';
|
|
18
18
|
export { shouldBeFormAssociated } from './utils';
|
package/dist/index.cjs.js
CHANGED
|
@@ -3200,29 +3200,29 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3200
3200
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3201
3201
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3202
3202
|
}
|
|
3203
|
-
const isScopedCss = stylesheet[shared.KEY__SCOPED_CSS];
|
|
3203
|
+
const isScopedCss = shared.isTrue(stylesheet[shared.KEY__SCOPED_CSS]);
|
|
3204
|
+
const isNativeOnlyCss = shared.isTrue(stylesheet[shared.KEY__NATIVE_ONLY_CSS]);
|
|
3205
|
+
const { renderMode, shadowMode } = vm;
|
|
3204
3206
|
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
|
|
3205
3207
|
!isScopedCss &&
|
|
3206
|
-
|
|
3208
|
+
renderMode === 0 /* RenderMode.Light */) {
|
|
3207
3209
|
logError('Unscoped CSS is not supported in Light DOM in this environment. Please use scoped CSS ' +
|
|
3208
3210
|
'(*.scoped.css) instead of unscoped CSS (*.css). See also: https://sfdc.co/scoped-styles-light-dom');
|
|
3209
3211
|
continue;
|
|
3210
3212
|
}
|
|
3211
3213
|
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3212
3214
|
const scopeToken = isScopedCss ||
|
|
3213
|
-
(
|
|
3215
|
+
(shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode === 1 /* RenderMode.Shadow */)
|
|
3214
3216
|
? stylesheetToken
|
|
3215
3217
|
: undefined;
|
|
3216
3218
|
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3217
3219
|
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3218
|
-
const useActualHostSelector =
|
|
3219
|
-
? !isScopedCss
|
|
3220
|
-
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3220
|
+
const useActualHostSelector = renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : shadowMode === 0 /* ShadowMode.Native */;
|
|
3221
3221
|
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3222
3222
|
// we use an attribute selector on the host to simulate :dir().
|
|
3223
3223
|
let useNativeDirPseudoclass;
|
|
3224
|
-
if (
|
|
3225
|
-
useNativeDirPseudoclass =
|
|
3224
|
+
if (renderMode === 1 /* RenderMode.Shadow */) {
|
|
3225
|
+
useNativeDirPseudoclass = shadowMode === 0 /* ShadowMode.Native */;
|
|
3226
3226
|
}
|
|
3227
3227
|
else {
|
|
3228
3228
|
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
@@ -3233,7 +3233,18 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3233
3233
|
}
|
|
3234
3234
|
useNativeDirPseudoclass = shared.isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3235
3235
|
}
|
|
3236
|
-
|
|
3236
|
+
let cssContent;
|
|
3237
|
+
if (isNativeOnlyCss &&
|
|
3238
|
+
renderMode === 1 /* RenderMode.Shadow */ &&
|
|
3239
|
+
shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3240
|
+
// Native-only (i.e. disableSyntheticShadowSupport) CSS should be ignored entirely
|
|
3241
|
+
// in synthetic shadow. It's fine to use in either native shadow or light DOM, but in
|
|
3242
|
+
// synthetic shadow it wouldn't be scoped properly and so should be ignored.
|
|
3243
|
+
cssContent = '/* ignored native-only CSS */';
|
|
3244
|
+
}
|
|
3245
|
+
else {
|
|
3246
|
+
cssContent = stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass);
|
|
3247
|
+
}
|
|
3237
3248
|
if (process.env.NODE_ENV !== 'production') {
|
|
3238
3249
|
linkStylesheetToCssContentInDevMode(stylesheet, cssContent);
|
|
3239
3250
|
}
|
|
@@ -5784,26 +5795,9 @@ function sc(vnodes) {
|
|
|
5784
5795
|
markAsDynamicChildren(vnodes);
|
|
5785
5796
|
return vnodes;
|
|
5786
5797
|
}
|
|
5787
|
-
/**
|
|
5788
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5789
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5790
|
-
* lwc:inner-html directive.
|
|
5791
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5792
|
-
*/
|
|
5793
|
-
let sanitizeHtmlContentHook = () => {
|
|
5794
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5795
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5796
|
-
};
|
|
5797
|
-
/**
|
|
5798
|
-
* Sets the sanitizeHtmlContentHook.
|
|
5799
|
-
* @param newHookImpl
|
|
5800
|
-
*/
|
|
5801
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5802
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
5803
|
-
}
|
|
5804
5798
|
// [s]anitize [h]tml [c]ontent
|
|
5805
5799
|
function shc(content) {
|
|
5806
|
-
const sanitizedString =
|
|
5800
|
+
const sanitizedString = shared.sanitizeHtmlContent(content);
|
|
5807
5801
|
return createSanitizedHtmlContent(sanitizedString);
|
|
5808
5802
|
}
|
|
5809
5803
|
/**
|
|
@@ -6461,7 +6455,13 @@ function evaluateTemplate(vm, html) {
|
|
|
6461
6455
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
6462
6456
|
const { styleVNodes } = context;
|
|
6463
6457
|
if (!shared.isNull(styleVNodes)) {
|
|
6464
|
-
|
|
6458
|
+
// It's important here not to mutate the underlying `vnodes` returned from `html.call()`.
|
|
6459
|
+
// The reason for this is because, due to the static content optimization, the vnodes array
|
|
6460
|
+
// may be a static array shared across multiple component instances. E.g. this occurs in the
|
|
6461
|
+
// case of an empty `<template></template>` in a `component.html` file, due to the underlying
|
|
6462
|
+
// children being `[]` (no children). If we append the `<style>` vnode to this array, then the same
|
|
6463
|
+
// array will be reused for every component instance, i.e. whenever `tmpl()` is called.
|
|
6464
|
+
vnodes = [...styleVNodes, ...vnodes];
|
|
6465
6465
|
}
|
|
6466
6466
|
});
|
|
6467
6467
|
}, () => {
|
|
@@ -7857,7 +7857,7 @@ expectAddlSiblings) {
|
|
|
7857
7857
|
}
|
|
7858
7858
|
}
|
|
7859
7859
|
mount(childVnode, parentNode, renderer, nextNode);
|
|
7860
|
-
nextNode = renderer.nextSibling(childVnode.elm);
|
|
7860
|
+
nextNode = renderer.nextSibling(childVnode.type === 5 /* VNodeType.Fragment */ ? childVnode.trailing : childVnode.elm);
|
|
7861
7861
|
}
|
|
7862
7862
|
}
|
|
7863
7863
|
}
|
|
@@ -8172,19 +8172,6 @@ function haveCompatibleStaticParts(vnode, renderer) {
|
|
|
8172
8172
|
return true;
|
|
8173
8173
|
}
|
|
8174
8174
|
|
|
8175
|
-
/*
|
|
8176
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8177
|
-
* All rights reserved.
|
|
8178
|
-
* SPDX-License-Identifier: MIT
|
|
8179
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8180
|
-
*/
|
|
8181
|
-
let hooksAreSet = false;
|
|
8182
|
-
function setHooks(hooks) {
|
|
8183
|
-
shared.assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
8184
|
-
hooksAreSet = true;
|
|
8185
|
-
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
8186
|
-
}
|
|
8187
|
-
|
|
8188
8175
|
/*
|
|
8189
8176
|
* Copyright (c) 2024, Salesforce, Inc.
|
|
8190
8177
|
* All rights reserved.
|
|
@@ -8200,10 +8187,7 @@ const TEMPLATE_PROPS = [
|
|
|
8200
8187
|
'legacyStylesheetToken',
|
|
8201
8188
|
];
|
|
8202
8189
|
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
8203
|
-
const STYLESHEET_PROPS = [
|
|
8204
|
-
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
8205
|
-
'$scoped$',
|
|
8206
|
-
];
|
|
8190
|
+
const STYLESHEET_PROPS = [shared.KEY__SCOPED_CSS, shared.KEY__NATIVE_ONLY_CSS];
|
|
8207
8191
|
// Via https://www.npmjs.com/package/object-observer
|
|
8208
8192
|
const ARRAY_MUTATION_METHODS = [
|
|
8209
8193
|
'pop',
|
|
@@ -8447,6 +8431,10 @@ function readonly(obj) {
|
|
|
8447
8431
|
return getReadOnlyProxy(obj);
|
|
8448
8432
|
}
|
|
8449
8433
|
|
|
8434
|
+
Object.defineProperty(exports, "setHooks", {
|
|
8435
|
+
enumerable: true,
|
|
8436
|
+
get: function () { return shared.setHooks; }
|
|
8437
|
+
});
|
|
8450
8438
|
Object.defineProperty(exports, "setTrustedSignalSet", {
|
|
8451
8439
|
enumerable: true,
|
|
8452
8440
|
get: function () { return shared.setTrustedSignalSet; }
|
|
@@ -8487,7 +8475,6 @@ exports.runFormDisabledCallback = runFormDisabledCallback;
|
|
|
8487
8475
|
exports.runFormResetCallback = runFormResetCallback;
|
|
8488
8476
|
exports.runFormStateRestoreCallback = runFormStateRestoreCallback;
|
|
8489
8477
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
8490
|
-
exports.setHooks = setHooks;
|
|
8491
8478
|
exports.shouldBeFormAssociated = shouldBeFormAssociated;
|
|
8492
8479
|
exports.swapComponent = swapComponent;
|
|
8493
8480
|
exports.swapStyle = swapStyle;
|
|
@@ -8495,5 +8482,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8495
8482
|
exports.track = track;
|
|
8496
8483
|
exports.unwrap = unwrap;
|
|
8497
8484
|
exports.wire = wire;
|
|
8498
|
-
/** version: 8.
|
|
8485
|
+
/** version: 8.7.0 */
|
|
8499
8486
|
//# sourceMappingURL=index.cjs.js.map
|