@lwc/engine-core 8.2.0 → 8.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/README.md +6 -0
- package/dist/framework/main.d.ts +1 -0
- package/dist/framework/reporting.d.ts +7 -2
- package/dist/index.cjs.js +34 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +32 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -115,3 +115,9 @@ This experimental API enables the sanitization of HTML content by external servi
|
|
|
115
115
|
### unwrap()
|
|
116
116
|
|
|
117
117
|
This experimental API enables the removal of an object's observable membrane proxy wrapper.
|
|
118
|
+
|
|
119
|
+
### setTrustedSignalSet()
|
|
120
|
+
|
|
121
|
+
This experimental API enables the addition of a signal as a trusted signal. If the [ENABLE_EXPERIMENTAL_SIGNALS](https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#lwcfeatures) feature is enabled, any signal value change will trigger a re-render.
|
|
122
|
+
|
|
123
|
+
If `setTrustedSignalSet` is called more than once, it will throw an error. If it is never called, then no trusted signal validation will be performed. The same `setTrustedSignalSet` API must be called on both `@lwc/engine-dom` and `@lwc/signals`.
|
package/dist/framework/main.d.ts
CHANGED
|
@@ -28,3 +28,4 @@ export { default as track } from './decorators/track';
|
|
|
28
28
|
export { default as wire } from './decorators/wire';
|
|
29
29
|
export { readonly } from './readonly';
|
|
30
30
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
31
|
+
export { setTrustedSignalSet } from '@lwc/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShadowMode, ShadowSupportMode } from './vm';
|
|
1
|
+
import { RenderMode, ShadowMode, ShadowSupportMode } from './vm';
|
|
2
2
|
export declare const enum ReportingEventId {
|
|
3
3
|
CrossRootAriaInSyntheticShadow = "CrossRootAriaInSyntheticShadow",
|
|
4
4
|
CompilerRuntimeVersionMismatch = "CompilerRuntimeVersionMismatch",
|
|
@@ -7,7 +7,8 @@ export declare const enum ReportingEventId {
|
|
|
7
7
|
StylesheetMutation = "StylesheetMutation",
|
|
8
8
|
ConnectedCallbackWhileDisconnected = "ConnectedCallbackWhileDisconnected",
|
|
9
9
|
ShadowModeUsage = "ShadowModeUsage",
|
|
10
|
-
ShadowSupportModeUsage = "ShadowSupportModeUsage"
|
|
10
|
+
ShadowSupportModeUsage = "ShadowSupportModeUsage",
|
|
11
|
+
RenderModeMismatch = "RenderModeMismatch"
|
|
11
12
|
}
|
|
12
13
|
export interface BasePayload {
|
|
13
14
|
tagName?: string;
|
|
@@ -32,6 +33,9 @@ export interface StylesheetMutationPayload extends BasePayload {
|
|
|
32
33
|
}
|
|
33
34
|
export interface ConnectedCallbackWhileDisconnectedPayload extends BasePayload {
|
|
34
35
|
}
|
|
36
|
+
export interface RenderModeMismatchPayload extends BasePayload {
|
|
37
|
+
mode: RenderMode;
|
|
38
|
+
}
|
|
35
39
|
export interface ShadowModeUsagePayload extends BasePayload {
|
|
36
40
|
mode: ShadowMode;
|
|
37
41
|
}
|
|
@@ -47,6 +51,7 @@ export type ReportingPayloadMapping = {
|
|
|
47
51
|
[ReportingEventId.ConnectedCallbackWhileDisconnected]: ConnectedCallbackWhileDisconnectedPayload;
|
|
48
52
|
[ReportingEventId.ShadowModeUsage]: ShadowModeUsagePayload;
|
|
49
53
|
[ReportingEventId.ShadowSupportModeUsage]: ShadowSupportModeUsagePayload;
|
|
54
|
+
[ReportingEventId.RenderModeMismatch]: RenderModeMismatchPayload;
|
|
50
55
|
};
|
|
51
56
|
export type ReportingDispatcher<T extends ReportingEventId = ReportingEventId> = (reportingEventId: T, payload: ReportingPayloadMapping[T]) => void;
|
|
52
57
|
/** Callbacks to invoke when reporting is enabled */
|
package/dist/index.cjs.js
CHANGED
|
@@ -602,6 +602,7 @@ function componentValueObserved(vm, key, target = {}) {
|
|
|
602
602
|
'value' in target &&
|
|
603
603
|
'subscribe' in target &&
|
|
604
604
|
shared.isFunction(target.subscribe) &&
|
|
605
|
+
shared.isTrustedSignal(target) &&
|
|
605
606
|
// Only subscribe if a template is being rendered by the engine
|
|
606
607
|
tro.isObserving()) {
|
|
607
608
|
// Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
|
|
@@ -6182,19 +6183,30 @@ function validateSlots(vm) {
|
|
|
6182
6183
|
shared.assert.isTrue(shared.isArray(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${shared.toString(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
6183
6184
|
}
|
|
6184
6185
|
}
|
|
6185
|
-
function
|
|
6186
|
-
|
|
6187
|
-
if (
|
|
6186
|
+
function checkHasMatchingRenderMode(template, vm) {
|
|
6187
|
+
// don't validate in prod environments where reporting is disabled
|
|
6188
|
+
if (process.env.NODE_ENV === 'production' && !isReportingEnabled()) {
|
|
6188
6189
|
return;
|
|
6189
6190
|
}
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
}
|
|
6191
|
+
// don't validate the default empty template - it is not inherently light or shadow
|
|
6192
|
+
if (template === defaultEmptyTemplate) {
|
|
6193
|
+
return;
|
|
6194
6194
|
}
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6195
|
+
// TODO [#4663]: `renderMode` mismatch between template and component causes `console.error` but no error
|
|
6196
|
+
// Note that `undefined` means shadow in this case, because shadow is the default.
|
|
6197
|
+
const vmIsLight = vm.renderMode === 0 /* RenderMode.Light */;
|
|
6198
|
+
const templateIsLight = template.renderMode === 'light';
|
|
6199
|
+
if (vmIsLight !== templateIsLight) {
|
|
6200
|
+
report("RenderModeMismatch" /* ReportingEventId.RenderModeMismatch */, {
|
|
6201
|
+
tagName: vm.tagName,
|
|
6202
|
+
mode: vm.renderMode,
|
|
6203
|
+
});
|
|
6204
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6205
|
+
const tagName = getComponentTag(vm);
|
|
6206
|
+
const message = vmIsLight
|
|
6207
|
+
? `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${tagName}.`
|
|
6208
|
+
: `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${tagName} or set it to 'lwc:render-mode="shadow"`;
|
|
6209
|
+
logError(message);
|
|
6198
6210
|
}
|
|
6199
6211
|
}
|
|
6200
6212
|
}
|
|
@@ -6409,9 +6421,7 @@ function evaluateTemplate(vm, html) {
|
|
|
6409
6421
|
if (!isTemplateRegistered(html)) {
|
|
6410
6422
|
throw new TypeError(`Invalid template returned by the render() method on ${vm.tagName}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${shared.toString(html)}.`);
|
|
6411
6423
|
}
|
|
6412
|
-
|
|
6413
|
-
validateLightDomTemplate(html, vm);
|
|
6414
|
-
}
|
|
6424
|
+
checkHasMatchingRenderMode(html, vm);
|
|
6415
6425
|
// Perf opt: do not reset the shadow root during the first rendering (there is
|
|
6416
6426
|
// nothing to reset).
|
|
6417
6427
|
if (!shared.isNull(cmpTemplate)) {
|
|
@@ -8137,13 +8147,15 @@ function haveCompatibleStaticParts(vnode, renderer) {
|
|
|
8137
8147
|
// Explicitly skip hydration validation when static parts don't contain `style` or `className`.
|
|
8138
8148
|
// This means the style/class attributes are either static or don't exist on the element and
|
|
8139
8149
|
// cannot be affected by hydration.
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
: true;
|
|
8150
|
+
// We need to do class first, style second to match the ordering of non-static-optimized nodes,
|
|
8151
|
+
// otherwise the ordering of console errors is different between the two.
|
|
8143
8152
|
const hasMatchingClass = shouldValidateAttr(data, 'className')
|
|
8144
8153
|
? validateClassAttr(vnode, elm, data, renderer)
|
|
8145
8154
|
: true;
|
|
8146
|
-
|
|
8155
|
+
const hasMatchingStyleAttr = shouldValidateAttr(data, 'style')
|
|
8156
|
+
? validateStyleAttr(vnode, elm, data, renderer)
|
|
8157
|
+
: true;
|
|
8158
|
+
if (shared.isFalse(hasMatchingAttrs && hasMatchingClass && hasMatchingStyleAttr)) {
|
|
8147
8159
|
return false;
|
|
8148
8160
|
}
|
|
8149
8161
|
}
|
|
@@ -8433,6 +8445,10 @@ function readonly(obj) {
|
|
|
8433
8445
|
return getReadOnlyProxy(obj);
|
|
8434
8446
|
}
|
|
8435
8447
|
|
|
8448
|
+
Object.defineProperty(exports, "setTrustedSignalSet", {
|
|
8449
|
+
enumerable: true,
|
|
8450
|
+
get: function () { return shared.setTrustedSignalSet; }
|
|
8451
|
+
});
|
|
8436
8452
|
Object.defineProperty(exports, "setFeatureFlag", {
|
|
8437
8453
|
enumerable: true,
|
|
8438
8454
|
get: function () { return features.setFeatureFlag; }
|
|
@@ -8477,5 +8493,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8477
8493
|
exports.track = track;
|
|
8478
8494
|
exports.unwrap = unwrap;
|
|
8479
8495
|
exports.wire = wire;
|
|
8480
|
-
/** version: 8.
|
|
8496
|
+
/** version: 8.3.0 */
|
|
8481
8497
|
//# sourceMappingURL=index.cjs.js.map
|