@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.
@@ -20,7 +20,7 @@ export { getComponentConstructor } from './get-component-constructor';
20
20
  export type { RendererAPI, LifecycleCallback } from './renderer';
21
21
  export type { Stylesheets } from './stylesheet';
22
22
  export type { Template } from './template';
23
- export type { ConfigValue as WireConfigValue, ContextConsumer as WireContextConsumer, ContextProvider as WireContextProvider, ContextValue as WireContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './wiring';
23
+ export type { ConfigValue as WireConfigValue, ContextConsumer as WireContextConsumer, ContextProvider as WireContextProvider, ContextValue as WireContextValue, DataCallback as WireDataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './wiring';
24
24
  export type { FormRestoreState, FormRestoreReason } from './vm';
25
25
  export { LightningElement } from './base-lightning-element';
26
26
  export { default as api } from './decorators/api';
@@ -6,9 +6,6 @@ export declare const EmptyObject: any;
6
6
  export declare const EmptyArray: never[];
7
7
  export declare function addCallbackToNextTick(callback: Callback): void;
8
8
  export declare function guid(): string;
9
- export declare function parseStyleText(cssText: string): {
10
- [name: string]: string;
11
- };
12
9
  export declare function cloneAndOmitKey(object: {
13
10
  [key: string]: any;
14
11
  }, keyToOmit: string): {
package/dist/index.cjs.js CHANGED
@@ -221,23 +221,6 @@ function guid() {
221
221
  }
222
222
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
223
223
  }
224
- // Borrowed from Vue template compiler.
225
- // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
226
- const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
227
- const PROPERTY_DELIMITER = /:(.+)/;
228
- function parseStyleText(cssText) {
229
- const styleMap = {};
230
- const declarations = cssText.split(DECLARATION_DELIMITER);
231
- for (const declaration of declarations) {
232
- if (declaration) {
233
- const [prop, value] = declaration.split(PROPERTY_DELIMITER);
234
- if (prop !== undefined && value !== undefined) {
235
- styleMap[prop.trim()] = value.trim();
236
- }
237
- }
238
- }
239
- return styleMap;
240
- }
241
224
  // Make a shallow copy of an object but omit the given key
242
225
  function cloneAndOmitKey(object, keyToOmit) {
243
226
  const result = {};
@@ -7658,31 +7641,41 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
7658
7641
  // Any attribute names specified in that array will not be validated, and the
7659
7642
  // LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
7660
7643
  function getValidationPredicate(elm, renderer, optOutStaticProp) {
7661
- // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself,
7662
- // which does the same thing as an explicit `static validationOptOut = ['attr1', 'attr2']`.
7644
+ // `data-lwc-host-mutated` is a special attribute added by the SSR engine itself, which automatically detects
7645
+ // host mutations during `connectedCallback`.
7663
7646
  const hostMutatedValue = renderer.getAttribute(elm, 'data-lwc-host-mutated');
7664
- if (shared.isString(hostMutatedValue)) {
7665
- const mutatedAttrValues = new Set(shared.StringSplit.call(hostMutatedValue, / /));
7666
- return (attrName) => !mutatedAttrValues.has(attrName);
7667
- }
7668
- if (shared.isUndefined(optOutStaticProp)) {
7669
- return (_attrName) => true;
7670
- }
7647
+ const detectedHostMutations = shared.isString(hostMutatedValue)
7648
+ ? new Set(shared.StringSplit.call(hostMutatedValue, / /))
7649
+ : undefined;
7671
7650
  // If validationOptOut is true, no attributes will be checked for correctness
7672
7651
  // and the runtime will assume VDOM attrs and DOM attrs are in sync.
7673
- if (shared.isTrue(optOutStaticProp)) {
7674
- return (_attrName) => false;
7675
- }
7676
- // If validationOptOut is an array of strings, attributes specified in the
7677
- // array will be "opted out". Attributes not specified in the array will still
7678
- // be validated.
7679
- if (shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString)) {
7680
- return (attrName) => !shared.ArrayIncludes.call(optOutStaticProp, attrName);
7681
- }
7682
- if (process.env.NODE_ENV !== 'production') {
7683
- logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
7684
- }
7685
- return (_attrName) => true;
7652
+ const fullOptOut = shared.isTrue(optOutStaticProp);
7653
+ // If validationOptOut is an array of strings, attributes specified in the array will be "opted out". Attributes
7654
+ // not specified in the array will still be validated.
7655
+ const isValidArray = shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString);
7656
+ const conditionalOptOut = isValidArray ? new Set(optOutStaticProp) : undefined;
7657
+ if (process.env.NODE_ENV !== 'production' &&
7658
+ !shared.isUndefined(optOutStaticProp) &&
7659
+ !shared.isTrue(optOutStaticProp) &&
7660
+ !isValidArray) {
7661
+ logWarn('`validationOptOut` must be `true` or an array of attributes that should not be validated.');
7662
+ }
7663
+ return (attrName) => {
7664
+ // Component wants to opt out of all validation
7665
+ if (fullOptOut) {
7666
+ return false;
7667
+ }
7668
+ // Mutations were automatically detected and should be ignored
7669
+ if (!shared.isUndefined(detectedHostMutations) && detectedHostMutations.has(attrName)) {
7670
+ return false;
7671
+ }
7672
+ // Component explicitly wants to opt out of certain validations, regardless of auto-detection
7673
+ if (!shared.isUndefined(conditionalOptOut) && conditionalOptOut.has(attrName)) {
7674
+ return false;
7675
+ }
7676
+ // Attribute must be validated
7677
+ return true;
7678
+ };
7686
7679
  }
7687
7680
  function hydrateText(node, vnode, renderer) {
7688
7681
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
@@ -8046,12 +8039,12 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8046
8039
  vnodeStyle = style;
8047
8040
  }
8048
8041
  else if (!shared.isUndefined(styleDecls)) {
8049
- const parsedVnodeStyle = parseStyleText(elmStyle);
8042
+ const parsedVnodeStyle = shared.parseStyleText(elmStyle);
8050
8043
  const expectedStyle = [];
8051
8044
  // styleMap is used when style is set to static value.
8052
8045
  for (let i = 0, n = styleDecls.length; i < n; i++) {
8053
8046
  const [prop, value, important] = styleDecls[i];
8054
- expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
8047
+ expectedStyle.push(`${prop}: ${value + (important ? ' !important' : '')};`);
8055
8048
  const parsedPropValue = parsedVnodeStyle[prop];
8056
8049
  if (shared.isUndefined(parsedPropValue)) {
8057
8050
  nodesAreCompatible = false;
@@ -8066,7 +8059,7 @@ function validateStyleAttr(vnode, elm, data, renderer) {
8066
8059
  if (shared.keys(parsedVnodeStyle).length > styleDecls.length) {
8067
8060
  nodesAreCompatible = false;
8068
8061
  }
8069
- vnodeStyle = shared.ArrayJoin.call(expectedStyle, ';');
8062
+ vnodeStyle = shared.ArrayJoin.call(expectedStyle, ' ');
8070
8063
  }
8071
8064
  if (!nodesAreCompatible) {
8072
8065
  if (process.env.NODE_ENV !== 'production') {
@@ -8478,5 +8471,5 @@ exports.swapTemplate = swapTemplate;
8478
8471
  exports.track = track;
8479
8472
  exports.unwrap = unwrap;
8480
8473
  exports.wire = wire;
8481
- /** version: 8.1.2 */
8474
+ /** version: 8.1.3 */
8482
8475
  //# sourceMappingURL=index.cjs.js.map