@lwc/engine-core 8.1.2 → 8.1.3

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.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, isArray as isArray$1, isFunction as isFunction$1, keys, ArrayFilter, isObject, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, 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, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, StringTrim, ArraySort, ArrayFrom, htmlEscape, StringCharAt, ArrayUnshift, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
4
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isArray as isArray$1, isFunction as isFunction$1, keys, ArrayFilter, isObject, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, toString as toString$1, isString, ArrayIndexOf, ArrayPop, isFalse, 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, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, StringTrim, ArraySort, ArrayFrom, htmlEscape, StringCharAt, ArrayUnshift, LOWEST_API_VERSION, 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 { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
6
6
 
7
7
  /*
@@ -217,23 +217,6 @@ function guid() {
217
217
  }
218
218
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
219
219
  }
220
- // Borrowed from Vue template compiler.
221
- // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
222
- const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
223
- const PROPERTY_DELIMITER = /:(.+)/;
224
- function parseStyleText(cssText) {
225
- const styleMap = {};
226
- const declarations = cssText.split(DECLARATION_DELIMITER);
227
- for (const declaration of declarations) {
228
- if (declaration) {
229
- const [prop, value] = declaration.split(PROPERTY_DELIMITER);
230
- if (prop !== undefined && value !== undefined) {
231
- styleMap[prop.trim()] = value.trim();
232
- }
233
- }
234
- }
235
- return styleMap;
236
- }
237
220
  // Make a shallow copy of an object but omit the given key
238
221
  function cloneAndOmitKey(object, keyToOmit) {
239
222
  const result = {};
@@ -7654,31 +7637,41 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
7654
7637
  // Any attribute names specified in that array will not be validated, and the
7655
7638
  // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
7656
7639
  function getValidationPredicate(elm, renderer, optOutStaticProp) {
7657
- // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself,
7658
- // which does the same thing as an explicit `static validationOptOut = ['attr1', 'attr2']`.
7640
+ // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself, which automatically detects
7641
+ // host mutations during `connectedCallback`.
7659
7642
  const hostMutatedValue = renderer.getAttribute(elm, 'data-lwc-host-mutated');
7660
- if (isString(hostMutatedValue)) {
7661
- const mutatedAttrValues = new Set(StringSplit.call(hostMutatedValue, / /));
7662
- return (attrName) => !mutatedAttrValues.has(attrName);
7663
- }
7664
- if (isUndefined$1(optOutStaticProp)) {
7665
- return (_attrName) => true;
7666
- }
7643
+ const detectedHostMutations = isString(hostMutatedValue)
7644
+ ? new Set(StringSplit.call(hostMutatedValue, / /))
7645
+ : undefined;
7667
7646
  // If validationOptOut is true, no attributes will be checked for correctness
7668
7647
  // and the runtime will assume VDOM attrs and DOM attrs are in sync.
7669
- if (isTrue(optOutStaticProp)) {
7670
- return (_attrName) => false;
7671
- }
7672
- // If validationOptOut is an array of strings, attributes specified in the
7673
- // array will be "opted out". Attributes not specified in the array will still
7674
- // be validated.
7675
- if (isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString)) {
7676
- return (attrName) => !ArrayIncludes.call(optOutStaticProp, attrName);
7677
- }
7678
- if (process.env.NODE_ENV !== 'production') {
7679
- logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
7680
- }
7681
- return (_attrName) => true;
7648
+ const fullOptOut = isTrue(optOutStaticProp);
7649
+ // If validationOptOut is an array of strings, attributes specified in the array will be "opted out". Attributes
7650
+ // not specified in the array will still be validated.
7651
+ const isValidArray = isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString);
7652
+ const conditionalOptOut = isValidArray ? new Set(optOutStaticProp) : undefined;
7653
+ if (process.env.NODE_ENV !== 'production' &&
7654
+ !isUndefined$1(optOutStaticProp) &&
7655
+ !isTrue(optOutStaticProp) &&
7656
+ !isValidArray) {
7657
+ logWarn('`validationOptOut` must be `true` or an array of attributes that should not be validated.');
7658
+ }
7659
+ return (attrName) => {
7660
+ // Component wants to opt out of all validation
7661
+ if (fullOptOut) {
7662
+ return false;
7663
+ }
7664
+ // Mutations were automatically detected and should be ignored
7665
+ if (!isUndefined$1(detectedHostMutations) && detectedHostMutations.has(attrName)) {
7666
+ return false;
7667
+ }
7668
+ // Component explicitly wants to opt out of certain validations, regardless of auto-detection
7669
+ if (!isUndefined$1(conditionalOptOut) && conditionalOptOut.has(attrName)) {
7670
+ return false;
7671
+ }
7672
+ // Attribute must be validated
7673
+ return true;
7674
+ };
7682
7675
  }
7683
7676
  function hydrateText(node, vnode, renderer) {
7684
7677
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
@@ -8047,7 +8040,7 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8047
8040
  // styleMap is used when style is set to static value.
8048
8041
  for (let i = 0, n = styleDecls.length; i < n; i++) {
8049
8042
  const [prop, value, important] = styleDecls[i];
8050
- expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
8043
+ expectedStyle.push(`${prop}: ${value + (important ? ' !important' : '')};`);
8051
8044
  const parsedPropValue = parsedVnodeStyle[prop];
8052
8045
  if (isUndefined$1(parsedPropValue)) {
8053
8046
  nodesAreCompatible = false;
@@ -8062,7 +8055,7 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8062
8055
  if (keys(parsedVnodeStyle).length > styleDecls.length) {
8063
8056
  nodesAreCompatible = false;
8064
8057
  }
8065
- vnodeStyle = ArrayJoin.call(expectedStyle, ';');
8058
+ vnodeStyle = ArrayJoin.call(expectedStyle, ' ');
8066
8059
  }
8067
8060
  if (!nodesAreCompatible) {
8068
8061
  if (process.env.NODE_ENV !== 'production') {
@@ -8431,5 +8424,5 @@ function readonly(obj) {
8431
8424
  }
8432
8425
 
8433
8426
  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, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8434
- /** version: 8.1.2 */
8427
+ /** version: 8.1.3 */
8435
8428
  //# sourceMappingURL=index.js.map