@lwc/engine-core 8.11.0 → 8.12.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 +2 -11
- package/dist/index.cjs.js +35 -63
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +36 -64
- package/dist/index.js.map +1 -1
- package/package.json +7 -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, AriaAttrNameToPropNameMap, 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,
|
|
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, AriaAttrNameToPropNameMap, 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, normalizeClass, 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
|
|
|
@@ -5929,45 +5929,7 @@ function shc(content) {
|
|
|
5929
5929
|
const sanitizedString = sanitizeHtmlContent(content);
|
|
5930
5930
|
return createSanitizedHtmlContent(sanitizedString);
|
|
5931
5931
|
}
|
|
5932
|
-
|
|
5933
|
-
* [ncls] - Normalize class name attribute.
|
|
5934
|
-
*
|
|
5935
|
-
* Transforms the provided class property value from an object/string into a string the diffing algo
|
|
5936
|
-
* can operate on.
|
|
5937
|
-
*
|
|
5938
|
-
* This implementation is borrowed from Vue:
|
|
5939
|
-
* https://github.com/vuejs/core/blob/e790e1bdd7df7be39e14780529db86e4da47a3db/packages/shared/src/normalizeProp.ts#L63-L82
|
|
5940
|
-
*/
|
|
5941
|
-
function ncls(value) {
|
|
5942
|
-
if (isUndefined$1(value) || isNull(value)) {
|
|
5943
|
-
// Returning undefined here improves initial render cost, because the old vnode's class will be considered
|
|
5944
|
-
// undefined in the `patchClassAttribute` routine, so `oldClass === newClass` will be true so we return early
|
|
5945
|
-
return undefined;
|
|
5946
|
-
}
|
|
5947
|
-
let res = '';
|
|
5948
|
-
if (isString(value)) {
|
|
5949
|
-
res = value;
|
|
5950
|
-
}
|
|
5951
|
-
else if (isArray$1(value)) {
|
|
5952
|
-
for (let i = 0; i < value.length; i++) {
|
|
5953
|
-
const normalized = ncls(value[i]);
|
|
5954
|
-
if (normalized) {
|
|
5955
|
-
res += normalized + ' ';
|
|
5956
|
-
}
|
|
5957
|
-
}
|
|
5958
|
-
}
|
|
5959
|
-
else if (isObject(value) && !isNull(value)) {
|
|
5960
|
-
// Iterate own enumerable keys of the object
|
|
5961
|
-
const keys$1 = keys(value);
|
|
5962
|
-
for (let i = 0; i < keys$1.length; i += 1) {
|
|
5963
|
-
const key = keys$1[i];
|
|
5964
|
-
if (value[key]) {
|
|
5965
|
-
res += key + ' ';
|
|
5966
|
-
}
|
|
5967
|
-
}
|
|
5968
|
-
}
|
|
5969
|
-
return StringTrim.call(res);
|
|
5970
|
-
}
|
|
5932
|
+
const ncls = normalizeClass;
|
|
5971
5933
|
const api = freeze({
|
|
5972
5934
|
s,
|
|
5973
5935
|
h,
|
|
@@ -7720,6 +7682,8 @@ if (process.env.IS_BROWSER && isGlobalAriaPolyfillLoaded()) {
|
|
|
7720
7682
|
* SPDX-License-Identifier: MIT
|
|
7721
7683
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7722
7684
|
*/
|
|
7685
|
+
// Used as a perf optimization to avoid creating and discarding sets unnecessarily.
|
|
7686
|
+
const EMPTY_SET = new Set();
|
|
7723
7687
|
// flag indicating if the hydration recovered from the DOM mismatch
|
|
7724
7688
|
let hasMismatch = false;
|
|
7725
7689
|
function hydrateRoot(vm) {
|
|
@@ -8095,6 +8059,22 @@ function validateAttrs(vnode, elm, data, renderer, shouldValidateAttr) {
|
|
|
8095
8059
|
}
|
|
8096
8060
|
return nodesAreCompatible;
|
|
8097
8061
|
}
|
|
8062
|
+
function checkClassesCompatibility(first, second) {
|
|
8063
|
+
if (first.size !== second.size) {
|
|
8064
|
+
return false;
|
|
8065
|
+
}
|
|
8066
|
+
for (const f of first) {
|
|
8067
|
+
if (!second.has(f)) {
|
|
8068
|
+
return false;
|
|
8069
|
+
}
|
|
8070
|
+
}
|
|
8071
|
+
for (const s of second) {
|
|
8072
|
+
if (!first.has(s)) {
|
|
8073
|
+
return false;
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
return true;
|
|
8077
|
+
}
|
|
8098
8078
|
function validateClassAttr(vnode, elm, data, renderer) {
|
|
8099
8079
|
const { owner } = vnode;
|
|
8100
8080
|
// classMap is never available on VStaticPartData so it can default to undefined
|
|
@@ -8104,17 +8084,19 @@ function validateClassAttr(vnode, elm, data, renderer) {
|
|
|
8104
8084
|
// ---------- Step 1: get the classes from the element and the vnode
|
|
8105
8085
|
// Use a Set because we don't care to validate mismatches for 1) different ordering in SSR vs CSR, or 2)
|
|
8106
8086
|
// duplicated class names. These don't have an effect on rendered styles.
|
|
8107
|
-
const elmClasses = new Set(ArrayFrom(elm.classList));
|
|
8087
|
+
const elmClasses = elm.classList.length ? new Set(ArrayFrom(elm.classList)) : EMPTY_SET;
|
|
8108
8088
|
let vnodeClasses;
|
|
8109
8089
|
if (!isUndefined$1(className)) {
|
|
8110
8090
|
// ignore empty spaces entirely, filter them out using `filter(..., Boolean)`
|
|
8111
|
-
|
|
8091
|
+
const classes = ArrayFilter.call(StringSplit.call(className, /\s+/), Boolean);
|
|
8092
|
+
vnodeClasses = classes.length ? new Set(classes) : EMPTY_SET;
|
|
8112
8093
|
}
|
|
8113
8094
|
else if (!isUndefined$1(classMap)) {
|
|
8114
|
-
|
|
8095
|
+
const classes = keys(classMap);
|
|
8096
|
+
vnodeClasses = classes.length ? new Set(classes) : EMPTY_SET;
|
|
8115
8097
|
}
|
|
8116
8098
|
else {
|
|
8117
|
-
vnodeClasses =
|
|
8099
|
+
vnodeClasses = EMPTY_SET;
|
|
8118
8100
|
}
|
|
8119
8101
|
// ---------- Step 2: handle the scope tokens
|
|
8120
8102
|
// we don't care about legacy for hydration. it's a new use case
|
|
@@ -8126,7 +8108,12 @@ function validateClassAttr(vnode, elm, data, renderer) {
|
|
|
8126
8108
|
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
8127
8109
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
8128
8110
|
if (!isNull(scopeToken)) {
|
|
8129
|
-
vnodeClasses
|
|
8111
|
+
if (vnodeClasses === EMPTY_SET) {
|
|
8112
|
+
vnodeClasses = new Set([scopeToken]);
|
|
8113
|
+
}
|
|
8114
|
+
else {
|
|
8115
|
+
vnodeClasses.add(scopeToken);
|
|
8116
|
+
}
|
|
8130
8117
|
}
|
|
8131
8118
|
// This tells us which `*-host` scope token was rendered to the element's class.
|
|
8132
8119
|
// For now we just ignore any mismatches involving this class.
|
|
@@ -8137,27 +8124,12 @@ function validateClassAttr(vnode, elm, data, renderer) {
|
|
|
8137
8124
|
vnodeClasses.delete(elmHostScopeToken);
|
|
8138
8125
|
}
|
|
8139
8126
|
// ---------- Step 3: check for compatibility
|
|
8140
|
-
|
|
8141
|
-
if (
|
|
8142
|
-
nodesAreCompatible = false;
|
|
8143
|
-
}
|
|
8144
|
-
else {
|
|
8145
|
-
for (const vnodeClass of vnodeClasses) {
|
|
8146
|
-
if (!elmClasses.has(vnodeClass)) {
|
|
8147
|
-
nodesAreCompatible = false;
|
|
8148
|
-
}
|
|
8149
|
-
}
|
|
8150
|
-
for (const elmClass of elmClasses) {
|
|
8151
|
-
if (!vnodeClasses.has(elmClass)) {
|
|
8152
|
-
nodesAreCompatible = false;
|
|
8153
|
-
}
|
|
8154
|
-
}
|
|
8155
|
-
}
|
|
8156
|
-
if (process.env.NODE_ENV !== 'production' && !nodesAreCompatible) {
|
|
8127
|
+
const classesAreCompatible = checkClassesCompatibility(vnodeClasses, elmClasses);
|
|
8128
|
+
if (process.env.NODE_ENV !== 'production' && !classesAreCompatible) {
|
|
8157
8129
|
const prettyPrint = (set) => JSON.stringify(ArrayJoin.call(ArraySort.call(ArrayFrom(set)), ' '));
|
|
8158
8130
|
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected ${prettyPrint(vnodeClasses)} but found ${prettyPrint(elmClasses)}`, vnode.owner);
|
|
8159
8131
|
}
|
|
8160
|
-
return
|
|
8132
|
+
return classesAreCompatible;
|
|
8161
8133
|
}
|
|
8162
8134
|
function validateStyleAttr(vnode, elm, data, renderer) {
|
|
8163
8135
|
// Note styleDecls is always undefined for VStaticPartData, casting here to default it to undefined
|
|
@@ -8546,5 +8518,5 @@ function readonly(obj) {
|
|
|
8546
8518
|
}
|
|
8547
8519
|
|
|
8548
8520
|
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 };
|
|
8549
|
-
/** version: 8.
|
|
8521
|
+
/** version: 8.12.0 */
|
|
8550
8522
|
//# sourceMappingURL=index.js.map
|