@lwc/ssr-runtime 8.12.1 → 8.12.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -457,43 +457,6 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
457
457
  function isAriaAttribute(attrName) {
458
458
  return attrName in AriaAttrNameToPropNameMap;
459
459
  }
460
- // This list is based on https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
461
- const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
462
- 'accesskey',
463
- 'autocapitalize',
464
- 'autofocus',
465
- 'class',
466
- 'contenteditable',
467
- 'dir',
468
- 'draggable',
469
- 'enterkeyhint',
470
- 'exportparts',
471
- 'hidden',
472
- 'id',
473
- 'inputmode',
474
- 'is',
475
- 'itemid',
476
- 'itemprop',
477
- 'itemref',
478
- 'itemscope',
479
- 'itemtype',
480
- 'lang',
481
- 'nonce',
482
- 'part',
483
- 'slot',
484
- 'spellcheck',
485
- 'style',
486
- 'tabindex',
487
- 'title',
488
- 'translate',
489
- ]);
490
- /**
491
- *
492
- * @param attrName
493
- */
494
- function isGlobalHtmlAttribute(attrName) {
495
- return GLOBAL_ATTRIBUTE.has(attrName);
496
- }
497
460
  // These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
498
461
  const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
499
462
  ['accessKey', 'accesskey'],
@@ -513,6 +476,21 @@ const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
513
476
  ['useMap', 'usemap'],
514
477
  ['htmlFor', 'for'],
515
478
  ]);
479
+ // Global properties that this framework currently reflects. For CSR, the native
480
+ // descriptors for these properties are added from HTMLElement.prototype to
481
+ // LightningElement.prototype. For SSR, in order to match CSR behavior, this
482
+ // list is used to determine which attributes to reflect.
483
+ const REFLECTIVE_GLOBAL_PROPERTY_SET = /*@__PURE__@*/ new Set([
484
+ 'accessKey',
485
+ 'dir',
486
+ 'draggable',
487
+ 'hidden',
488
+ 'id',
489
+ 'lang',
490
+ 'spellcheck',
491
+ 'tabIndex',
492
+ 'title',
493
+ ]);
516
494
  /**
517
495
  * Map associating previously transformed HTML property into HTML attribute.
518
496
  */
@@ -649,7 +627,7 @@ function setHooks(hooks) {
649
627
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
650
628
  */
651
629
  const DEFAULT_SSR_MODE = 'sync';
652
- /** version: 8.12.1 */
630
+ /** version: 8.12.2 */
653
631
 
654
632
  /*
655
633
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1249,7 +1227,7 @@ function filterProperties(props, publicFields, privateFields) {
1249
1227
  keys(props).forEach((propName) => {
1250
1228
  const attrName = htmlPropertyToAttribute(propName);
1251
1229
  if (publicFieldSet.has(propName) ||
1252
- ((isGlobalHtmlAttribute(attrName) || isAriaAttribute(attrName)) &&
1230
+ ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1253
1231
  !privateFieldSet.has(propName))) {
1254
1232
  propsToAssign[propName] = props[propName];
1255
1233
  }
@@ -1528,6 +1506,12 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1528
1506
  let hasClassAttribute = false;
1529
1507
  for (const attrName of getOwnPropertyNames$1(attrs)) {
1530
1508
  let attrValue = attrs[attrName];
1509
+ // Backwards compatibility with historical patchStyleAttribute() behavior:
1510
+ // https://github.com/salesforce/lwc/blob/59e2c6c/packages/%40lwc/engine-core/src/framework/modules/computed-style-attr.ts#L40
1511
+ if (attrName === 'style' && (!isString(attrValue) || attrValue === '')) {
1512
+ // If the style attribute is invalid, we don't render it.
1513
+ continue;
1514
+ }
1531
1515
  if (isNull(attrValue) || isUndefined$1(attrValue)) {
1532
1516
  attrValue = '';
1533
1517
  }
@@ -1802,5 +1786,5 @@ function createContextProvider(adapter) {
1802
1786
  }
1803
1787
 
1804
1788
  export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, filterProperties, freezeTemplate, getComponentDef, getReadOnlyProxy, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, massageTextContent, mutationTracker, normalizeClass, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1805
- /** version: 8.12.1 */
1789
+ /** version: 8.12.2 */
1806
1790
  //# sourceMappingURL=index.js.map