@lwc/engine-core 8.1.2 → 8.2.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/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 = {};
@@ -3933,6 +3916,12 @@ function isVStaticPartText(vnode) {
3933
3916
  return vnode.type === 0 /* VStaticPartType.Text */;
3934
3917
  }
3935
3918
 
3919
+ /*
3920
+ * Copyright (c) 2024, Salesforce, Inc.
3921
+ * All rights reserved.
3922
+ * SPDX-License-Identifier: MIT
3923
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3924
+ */
3936
3925
  const sanitizedHtmlContentSymbol = Symbol('lwc-get-sanitized-html-content');
3937
3926
  function isSanitizedHtmlContent(object) {
3938
3927
  return isObject(object) && !isNull(object) && sanitizedHtmlContentSymbol in object;
@@ -7654,31 +7643,41 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
7654
7643
  // Any attribute names specified in that array will not be validated, and the
7655
7644
  // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
7656
7645
  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']`.
7646
+ // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself, which automatically detects
7647
+ // host mutations during `connectedCallback`.
7659
7648
  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
- }
7649
+ const detectedHostMutations = isString(hostMutatedValue)
7650
+ ? new Set(StringSplit.call(hostMutatedValue, / /))
7651
+ : undefined;
7667
7652
  // If validationOptOut is true, no attributes will be checked for correctness
7668
7653
  // 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;
7654
+ const fullOptOut = isTrue(optOutStaticProp);
7655
+ // If validationOptOut is an array of strings, attributes specified in the array will be "opted out". Attributes
7656
+ // not specified in the array will still be validated.
7657
+ const isValidArray = isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString);
7658
+ const conditionalOptOut = isValidArray ? new Set(optOutStaticProp) : undefined;
7659
+ if (process.env.NODE_ENV !== 'production' &&
7660
+ !isUndefined$1(optOutStaticProp) &&
7661
+ !isTrue(optOutStaticProp) &&
7662
+ !isValidArray) {
7663
+ logWarn('`validationOptOut` must be `true` or an array of attributes that should not be validated.');
7664
+ }
7665
+ return (attrName) => {
7666
+ // Component wants to opt out of all validation
7667
+ if (fullOptOut) {
7668
+ return false;
7669
+ }
7670
+ // Mutations were automatically detected and should be ignored
7671
+ if (!isUndefined$1(detectedHostMutations) && detectedHostMutations.has(attrName)) {
7672
+ return false;
7673
+ }
7674
+ // Component explicitly wants to opt out of certain validations, regardless of auto-detection
7675
+ if (!isUndefined$1(conditionalOptOut) && conditionalOptOut.has(attrName)) {
7676
+ return false;
7677
+ }
7678
+ // Attribute must be validated
7679
+ return true;
7680
+ };
7682
7681
  }
7683
7682
  function hydrateText(node, vnode, renderer) {
7684
7683
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
@@ -8047,7 +8046,7 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8047
8046
  // styleMap is used when style is set to static value.
8048
8047
  for (let i = 0, n = styleDecls.length; i < n; i++) {
8049
8048
  const [prop, value, important] = styleDecls[i];
8050
- expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
8049
+ expectedStyle.push(`${prop}: ${value + (important ? ' !important' : '')};`);
8051
8050
  const parsedPropValue = parsedVnodeStyle[prop];
8052
8051
  if (isUndefined$1(parsedPropValue)) {
8053
8052
  nodesAreCompatible = false;
@@ -8062,7 +8061,7 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8062
8061
  if (keys(parsedVnodeStyle).length > styleDecls.length) {
8063
8062
  nodesAreCompatible = false;
8064
8063
  }
8065
- vnodeStyle = ArrayJoin.call(expectedStyle, ';');
8064
+ vnodeStyle = ArrayJoin.call(expectedStyle, ' ');
8066
8065
  }
8067
8066
  if (!nodesAreCompatible) {
8068
8067
  if (process.env.NODE_ENV !== 'production') {
@@ -8431,5 +8430,5 @@ function readonly(obj) {
8431
8430
  }
8432
8431
 
8433
8432
  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 */
8433
+ /** version: 8.2.0 */
8435
8434
  //# sourceMappingURL=index.js.map