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