@lwc/engine-core 2.42.0 → 2.44.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.
@@ -1,5 +1,5 @@
1
1
  /* proxy-compat-disable */
2
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, assert, freeze, KEY__SYNTHETIC_MODE, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, htmlAttributeToProperty, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, globalThis as globalThis$1, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, htmlEscape, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift } from '@lwc/shared';
2
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, assert, freeze, KEY__SYNTHETIC_MODE, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, htmlAttributeToProperty, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, globalThis as globalThis$1, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift } from '@lwc/shared';
3
3
  import { applyAriaReflection } from '@lwc/aria-reflection';
4
4
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
5
5
 
@@ -444,101 +444,6 @@ const defaultDefHTMLPropertyNames = [
444
444
  'tabIndex',
445
445
  'title',
446
446
  ];
447
- function offsetPropertyErrorMessage(name) {
448
- return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
449
- }
450
- // Global HTML Attributes & Properties
451
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
452
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
453
- //
454
- // If you update this list, check for test files that recapitulate the same list. Searching the codebase
455
- // for e.g. "dropzone" should suffice.
456
- const globalHTMLProperties = {
457
- accessKey: {
458
- attribute: 'accesskey',
459
- },
460
- accessKeyLabel: {
461
- readOnly: true,
462
- },
463
- className: {
464
- attribute: 'class',
465
- error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.',
466
- },
467
- contentEditable: {
468
- attribute: 'contenteditable',
469
- },
470
- dataset: {
471
- readOnly: true,
472
- error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.",
473
- },
474
- dir: {
475
- attribute: 'dir',
476
- },
477
- draggable: {
478
- attribute: 'draggable',
479
- },
480
- dropzone: {
481
- attribute: 'dropzone',
482
- readOnly: true,
483
- },
484
- hidden: {
485
- attribute: 'hidden',
486
- },
487
- id: {
488
- attribute: 'id',
489
- },
490
- inputMode: {
491
- attribute: 'inputmode',
492
- },
493
- lang: {
494
- attribute: 'lang',
495
- },
496
- slot: {
497
- attribute: 'slot',
498
- error: 'Using the `slot` property is an anti-pattern.',
499
- },
500
- spellcheck: {
501
- attribute: 'spellcheck',
502
- },
503
- style: {
504
- attribute: 'style',
505
- },
506
- tabIndex: {
507
- attribute: 'tabindex',
508
- },
509
- title: {
510
- attribute: 'title',
511
- },
512
- translate: {
513
- attribute: 'translate',
514
- },
515
- // additional "global attributes" that are not present in the link above.
516
- isContentEditable: {
517
- readOnly: true,
518
- },
519
- offsetHeight: {
520
- readOnly: true,
521
- error: offsetPropertyErrorMessage('offsetHeight'),
522
- },
523
- offsetLeft: {
524
- readOnly: true,
525
- error: offsetPropertyErrorMessage('offsetLeft'),
526
- },
527
- offsetParent: {
528
- readOnly: true,
529
- },
530
- offsetTop: {
531
- readOnly: true,
532
- error: offsetPropertyErrorMessage('offsetTop'),
533
- },
534
- offsetWidth: {
535
- readOnly: true,
536
- error: offsetPropertyErrorMessage('offsetWidth'),
537
- },
538
- role: {
539
- attribute: 'role',
540
- },
541
- };
542
447
  let controlledElement = null;
543
448
  let controlledAttributeName;
544
449
  function isAttributeLocked(elm, attrName) {
@@ -723,8 +628,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
723
628
  }),
724
629
  addEventListener: generateDataDescriptor({
725
630
  value(type, listener, options) {
726
- // TODO [#420]: this is triggered when the component author attempts to add a listener
727
- // programmatically into its Component's shadow root
631
+ // TODO [#1824]: Potentially relax this restriction
728
632
  if (!isUndefined$1(options)) {
729
633
  logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
730
634
  }
@@ -770,8 +674,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
770
674
  }),
771
675
  addEventListener: generateDataDescriptor({
772
676
  value(type, listener, options) {
773
- // TODO [#420]: this is triggered when the component author attempts to add a listener
774
- // programmatically into a lighting element node
677
+ // TODO [#1824]: Potentially relax this restriction
775
678
  if (!isUndefined$1(options)) {
776
679
  logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
777
680
  }
@@ -799,7 +702,7 @@ function getComponentRestrictionsDescriptors() {
799
702
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
800
703
  assertNotProd(); // this method should never leak to prod
801
704
  const originalDispatchEvent = proto.dispatchEvent;
802
- const descriptors = {
705
+ return {
803
706
  dispatchEvent: generateDataDescriptor({
804
707
  value(event) {
805
708
  const vm = getAssociatedVM(this);
@@ -817,32 +720,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
817
720
  },
818
721
  }),
819
722
  };
820
- forEach.call(getOwnPropertyNames$1(globalHTMLProperties), (propName) => {
821
- if (propName in proto) {
822
- return; // no need to redefine something that we are already exposing
823
- }
824
- descriptors[propName] = generateAccessorDescriptor({
825
- get() {
826
- const { error, attribute } = globalHTMLProperties[propName];
827
- const msg = [];
828
- msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
829
- if (error) {
830
- msg.push(error);
831
- }
832
- else if (attribute) {
833
- msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
834
- }
835
- logError(msg.join('\n'), getAssociatedVM(this));
836
- },
837
- set() {
838
- const { readOnly } = globalHTMLProperties[propName];
839
- if (readOnly) {
840
- logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
841
- }
842
- },
843
- });
844
- });
845
- return descriptors;
846
723
  }
847
724
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
848
725
  // that all components will work fine in IE11 and other browsers without shadow dom support.
@@ -2193,12 +2070,7 @@ function createPublicPropertyDescriptor(key) {
2193
2070
  }
2194
2071
  function createPublicAccessorDescriptor(key, descriptor) {
2195
2072
  const { get, set, enumerable, configurable } = descriptor;
2196
- if (!isFunction$1(get)) {
2197
- if (process.env.NODE_ENV !== 'production') {
2198
- assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2199
- }
2200
- throw new Error();
2201
- }
2073
+ assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
2202
2074
  return {
2203
2075
  get() {
2204
2076
  if (process.env.NODE_ENV !== 'production') {
@@ -2320,64 +2192,64 @@ function getClassDescriptorType(descriptor) {
2320
2192
  }
2321
2193
  }
2322
2194
  function validateObservedField(Ctor, fieldName, descriptor) {
2195
+ assertNotProd(); // this method should never leak to prod
2323
2196
  if (!isUndefined$1(descriptor)) {
2324
2197
  const type = getClassDescriptorType(descriptor);
2325
2198
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2326
- // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2327
- // This branch is only here for backward compatibility reasons.
2328
- if (type === "accessor" /* DescriptorType.Accessor */) {
2329
- logError(message);
2330
- }
2331
- else {
2332
- assert.fail(message);
2333
- }
2199
+ // TODO [#3408]: this should throw, not log
2200
+ logError(message);
2334
2201
  }
2335
2202
  }
2336
2203
  function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2204
+ assertNotProd(); // this method should never leak to prod
2337
2205
  if (!isUndefined$1(descriptor)) {
2338
2206
  const type = getClassDescriptorType(descriptor);
2339
- assert.fail(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2207
+ // TODO [#3408]: this should throw, not log
2208
+ logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2340
2209
  }
2341
2210
  }
2342
2211
  function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2212
+ assertNotProd(); // this method should never leak to prod
2343
2213
  if (!isUndefined$1(descriptor)) {
2344
2214
  const type = getClassDescriptorType(descriptor);
2345
- assert.fail(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2215
+ // TODO [#3408]: this should throw, not log
2216
+ logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2346
2217
  }
2347
2218
  }
2348
2219
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2220
+ assertNotProd(); // this method should never leak to prod
2349
2221
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2350
- assert.fail(`Invalid @wire ${methodName} method.`);
2222
+ // TODO [#3441]: This line of code does not seem possible to reach.
2223
+ logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2351
2224
  }
2352
2225
  }
2353
2226
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2227
+ assertNotProd(); // this method should never leak to prod
2354
2228
  if (!isUndefined$1(descriptor)) {
2355
2229
  const type = getClassDescriptorType(descriptor);
2356
2230
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2357
- // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
2358
- // This branch is only here for backward compatibility reasons.
2359
- if (type === "accessor" /* DescriptorType.Accessor */) {
2360
- logError(message);
2361
- }
2362
- else {
2363
- assert.fail(message);
2364
- }
2231
+ // TODO [#3408]: this should throw, not log
2232
+ logError(message);
2365
2233
  }
2366
2234
  }
2367
2235
  function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2368
- if (isUndefined$1(descriptor)) {
2369
- assert.fail(`Invalid @api get ${fieldName} accessor.`);
2370
- }
2371
- else if (isFunction$1(descriptor.set)) {
2372
- assert.isTrue(isFunction$1(descriptor.get), `Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2236
+ assertNotProd(); // this method should never leak to prod
2237
+ if (isFunction$1(descriptor.set)) {
2238
+ if (!isFunction$1(descriptor.get)) {
2239
+ // TODO [#3441]: This line of code does not seem possible to reach.
2240
+ logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2241
+ }
2373
2242
  }
2374
2243
  else if (!isFunction$1(descriptor.get)) {
2375
- assert.fail(`Missing @api get ${fieldName} accessor.`);
2244
+ // TODO [#3441]: This line of code does not seem possible to reach.
2245
+ logError(`Missing @api get ${fieldName} accessor.`);
2376
2246
  }
2377
2247
  }
2378
2248
  function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
2249
+ assertNotProd(); // this method should never leak to prod
2379
2250
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2380
- assert.fail(`Invalid @api ${methodName} method.`);
2251
+ // TODO [#3441]: This line of code does not seem possible to reach.
2252
+ logError(`Invalid @api ${methodName} method.`);
2381
2253
  }
2382
2254
  }
2383
2255
  /**
@@ -2400,13 +2272,14 @@ function registerDecorators(Ctor, meta) {
2400
2272
  apiFieldsConfig[fieldName] = propConfig.config;
2401
2273
  descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2402
2274
  if (propConfig.config > 0) {
2275
+ if (isUndefined$1(descriptor)) {
2276
+ // TODO [#3441]: This line of code does not seem possible to reach.
2277
+ throw new Error();
2278
+ }
2403
2279
  // accessor declaration
2404
2280
  if (process.env.NODE_ENV !== 'production') {
2405
2281
  validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
2406
2282
  }
2407
- if (isUndefined$1(descriptor)) {
2408
- throw new Error();
2409
- }
2410
2283
  descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2411
2284
  }
2412
2285
  else {
@@ -2446,7 +2319,10 @@ function registerDecorators(Ctor, meta) {
2446
2319
  descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2447
2320
  if (method === 1) {
2448
2321
  if (process.env.NODE_ENV !== 'production') {
2449
- assert.isTrue(adapter, `@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2322
+ if (!adapter) {
2323
+ // TODO [#3408]: this should throw, not log
2324
+ logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2325
+ }
2450
2326
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2451
2327
  }
2452
2328
  if (isUndefined$1(descriptor)) {
@@ -2457,7 +2333,10 @@ function registerDecorators(Ctor, meta) {
2457
2333
  }
2458
2334
  else {
2459
2335
  if (process.env.NODE_ENV !== 'production') {
2460
- assert.isTrue(adapter, `@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2336
+ if (!adapter) {
2337
+ // TODO [#3408]: this should throw, not log
2338
+ logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2339
+ }
2461
2340
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
2462
2341
  }
2463
2342
  descriptor = internalWireFieldDecorator(fieldOrMethodName);
@@ -3263,6 +3142,15 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3263
3142
  // the stylesheet, while internally, we have a replacement for it.
3264
3143
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3265
3144
  }
3145
+ // Check that this stylesheet was generated by our compiler
3146
+ if (!isStylesheetRegistered(stylesheet)) {
3147
+ if (process.env.NODE_ENV !== 'production') {
3148
+ logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
3149
+ }
3150
+ report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
3151
+ tagName: vm.tagName.toLowerCase(),
3152
+ });
3153
+ }
3266
3154
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3267
3155
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
3268
3156
  !isScopedCss &&
@@ -3383,6 +3271,18 @@ function createStylesheet(vm, stylesheets) {
3383
3271
  }
3384
3272
  return null;
3385
3273
  }
3274
+ const signedStylesheetSet = new Set();
3275
+ /**
3276
+ * INTERNAL: This function can only be invoked by compiled code. The compiler
3277
+ * will prevent this function from being imported by userland code.
3278
+ */
3279
+ function registerStylesheet(stylesheet) {
3280
+ signedStylesheetSet.add(stylesheet);
3281
+ return stylesheet;
3282
+ }
3283
+ function isStylesheetRegistered(stylesheet) {
3284
+ return signedStylesheetSet.has(stylesheet);
3285
+ }
3386
3286
 
3387
3287
  /*
3388
3288
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5092,18 +4992,12 @@ function getVMBeingRendered() {
5092
4992
  function setVMBeingRendered(vm) {
5093
4993
  vmBeingRendered = vm;
5094
4994
  }
5095
- function validateSlots(vm, html) {
4995
+ function validateSlots(vm) {
5096
4996
  assertNotProd(); // this method should never leak to prod
5097
4997
  const { cmpSlots } = vm;
5098
- const { slots = EmptyArray } = html;
5099
4998
  for (const slotName in cmpSlots.slotAssignments) {
5100
4999
  // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
5101
5000
  assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
5102
- if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
5103
- // TODO [#1297]: this should never really happen because the compiler should always validate
5104
- // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
5105
- logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
5106
- }
5107
5001
  }
5108
5002
  }
5109
5003
  function validateLightDomTemplate(template, vm) {
@@ -5222,7 +5116,7 @@ function evaluateTemplate(vm, html) {
5222
5116
  }
5223
5117
  if (process.env.NODE_ENV !== 'production') {
5224
5118
  // validating slots in every rendering since the allocated content might change over time
5225
- validateSlots(vm, html);
5119
+ validateSlots(vm);
5226
5120
  // add the VM to the list of host VMs that can be re-rendered if html is swapped
5227
5121
  setActiveVM(vm);
5228
5122
  }
@@ -6208,7 +6102,7 @@ function checkAndReportViolation(elm, prop, isSetter, setValue) {
6208
6102
  const vm = findVM(elm);
6209
6103
  if (process.env.NODE_ENV !== 'production') {
6210
6104
  logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` +
6211
- (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) +
6105
+ (isUndefined$1(vm) ? '' : `owned by <${vm.tagName.toLowerCase()}> `) +
6212
6106
  `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` +
6213
6107
  `See https://sfdc.co/deprecated-aria`);
6214
6108
  }
@@ -6325,8 +6219,6 @@ function hydrateNode(node, vnode, renderer) {
6325
6219
  return renderer.nextSibling(hydratedNode);
6326
6220
  }
6327
6221
  const NODE_VALUE_PROP = 'nodeValue';
6328
- const PARENT_NODE_PROP = 'parentNode';
6329
- const TAG_NAME_PROP = 'tagName';
6330
6222
  function textNodeContentsAreEqual(node, vnode, renderer) {
6331
6223
  const { getProperty } = renderer;
6332
6224
  const nodeValue = getProperty(node, NODE_VALUE_PROP);
@@ -6338,22 +6230,6 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
6338
6230
  if (nodeValue === '\u200D' && vnode.text === '') {
6339
6231
  return true;
6340
6232
  }
6341
- // Special case for text nodes inside `<style>` tags – these are escaped when rendered server-size,
6342
- // but not when generated by the engine client-side.
6343
- const parentNode = getProperty(node, PARENT_NODE_PROP);
6344
- // Should never be null, but just to be safe, we check.
6345
- /* istanbul ignore else */
6346
- if (!isNull(parentNode)) {
6347
- const tagName = getProperty(parentNode, TAG_NAME_PROP);
6348
- // If the tagName is STYLE, then the following condition should always be true.
6349
- // The LWC compiler blocks using `<style>`s inside of templates, so it should be impossible
6350
- // for component authors to render different `<style>` text content on the client and server.
6351
- // But just to be safe, we check.
6352
- /* istanbul ignore next */
6353
- if (tagName === 'STYLE' && htmlEscape(vnode.text) === nodeValue) {
6354
- return true;
6355
- }
6356
- }
6357
6233
  return false;
6358
6234
  }
6359
6235
  function hydrateText(node, vnode, renderer) {
@@ -6577,7 +6453,7 @@ function validateAttrs(vnode, elm, renderer) {
6577
6453
  function validateClassAttr(vnode, elm, renderer) {
6578
6454
  const { data, owner } = vnode;
6579
6455
  let { className, classMap } = data;
6580
- const { getProperty, getClassList } = renderer;
6456
+ const { getProperty, getClassList, getAttribute } = renderer;
6581
6457
  const scopedToken = getScopeTokenClass(owner);
6582
6458
  const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
6583
6459
  // Classnames for scoped CSS are added directly to the DOM during rendering,
@@ -6607,11 +6483,12 @@ function validateClassAttr(vnode, elm, renderer) {
6607
6483
  }
6608
6484
  let nodesAreCompatible = true;
6609
6485
  let readableVnodeClassname;
6610
- const elmClassName = getProperty(elm, 'className');
6486
+ const elmClassName = getAttribute(elm, 'class');
6611
6487
  if (!isUndefined$1(className) && String(className) !== elmClassName) {
6612
6488
  // className is used when class is bound to an expr.
6613
6489
  nodesAreCompatible = false;
6614
- readableVnodeClassname = className;
6490
+ // stringify for pretty-printing
6491
+ readableVnodeClassname = JSON.stringify(className);
6615
6492
  }
6616
6493
  else if (!isUndefined$1(classMap)) {
6617
6494
  // classMap is used when class is set to static value.
@@ -6624,19 +6501,20 @@ function validateClassAttr(vnode, elm, renderer) {
6624
6501
  nodesAreCompatible = false;
6625
6502
  }
6626
6503
  }
6627
- readableVnodeClassname = computedClassName.trim();
6504
+ // stringify for pretty-printing
6505
+ readableVnodeClassname = JSON.stringify(computedClassName.trim());
6628
6506
  if (classList.length > keys(classMap).length) {
6629
6507
  nodesAreCompatible = false;
6630
6508
  }
6631
6509
  }
6632
- else if (isUndefined$1(className) && elmClassName !== '') {
6510
+ else if (isUndefined$1(className) && !isNull(elmClassName)) {
6633
6511
  // SSR contains a className but client-side VDOM does not
6634
6512
  nodesAreCompatible = false;
6635
- readableVnodeClassname = '';
6513
+ readableVnodeClassname = '""';
6636
6514
  }
6637
6515
  if (!nodesAreCompatible) {
6638
6516
  if (process.env.NODE_ENV !== 'production') {
6639
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${readableVnodeClassname}" but found "${elmClassName}"`, vnode.owner);
6517
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected ${readableVnodeClassname} but found ${JSON.stringify(elmClassName)}`, vnode.owner);
6640
6518
  }
6641
6519
  }
6642
6520
  return nodesAreCompatible;
@@ -6977,12 +6855,12 @@ function readonly(obj) {
6977
6855
  if (process.env.NODE_ENV !== 'production') {
6978
6856
  // TODO [#1292]: Remove the readonly decorator
6979
6857
  if (arguments.length !== 1) {
6980
- assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6858
+ logError('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6981
6859
  }
6982
6860
  }
6983
6861
  return getReadOnlyProxy(obj);
6984
6862
  }
6985
6863
 
6986
- export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6987
- /* version: 2.42.0 */
6864
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerStylesheet, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6865
+ /* version: 2.44.0 */
6988
6866
  //# sourceMappingURL=engine-core.js.map