@lwc/ssr-runtime 8.8.0 → 8.9.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.cjs.js CHANGED
@@ -262,44 +262,24 @@ defineProperties,
262
262
  defineProperty,
263
263
  /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
264
264
  entries,
265
- /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
266
- freeze,
267
- /** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
268
- fromEntries,
269
- /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
270
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
271
- /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
272
- getOwnPropertyDescriptors,
273
265
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
274
266
  getOwnPropertyNames: getOwnPropertyNames$1,
275
- /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
276
- getOwnPropertySymbols: getOwnPropertySymbols$1,
277
- /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
278
- getPrototypeOf: getPrototypeOf$1,
279
267
  /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
280
268
  hasOwnProperty: hasOwnProperty$1,
281
- /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
282
- isFrozen,
283
269
  /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
284
- keys,
285
- /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
286
- seal,
287
- /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
288
- setPrototypeOf, } = Object;
270
+ keys} = Object;
289
271
  const {
290
272
  /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
291
- isArray: isArray$1,
292
- /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
293
- from: ArrayFrom, } = Array;
273
+ isArray: isArray$1} = Array;
294
274
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
295
275
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
296
276
  // statement, rather than this declaration.
297
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, // Weird anomaly!
277
+ const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
298
278
  } = Array.prototype;
299
279
  /** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
300
280
  const { fromCharCode: StringFromCharCode } = String;
301
281
  // No JSDocs here - see comment for Array.prototype
302
- const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
282
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, toLowerCase: StringToLowerCase} = String.prototype;
303
283
  /**
304
284
  * Determines whether the argument is `undefined`.
305
285
  * @param obj Value to test
@@ -460,7 +440,6 @@ const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
460
440
  'autofocus',
461
441
  'class',
462
442
  'contenteditable',
463
- 'contextmenu',
464
443
  'dir',
465
444
  'draggable',
466
445
  'enterkeyhint',
@@ -604,7 +583,15 @@ function flattenStylesheets(stylesheets) {
604
583
  }
605
584
  return list;
606
585
  }
607
- /** version: 8.8.0 */
586
+
587
+ /*
588
+ * Copyright (c) 2024, Salesforce, Inc.
589
+ * All rights reserved.
590
+ * SPDX-License-Identifier: MIT
591
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
592
+ */
593
+ const DEFAULT_SSR_MODE = 'sync';
594
+ /** version: 8.9.0 */
608
595
 
609
596
  /*
610
597
  * Copyright (c) 2024, Salesforce, Inc.
@@ -807,7 +794,11 @@ const explicitBooleanDescriptor = (attrName, defaultValue) => ({
807
794
  enumerable: true,
808
795
  get() {
809
796
  const value = this.getAttribute(attrName);
810
- return value === null ? defaultValue : value === String(defaultValue);
797
+ if (value === null)
798
+ return defaultValue;
799
+ // spellcheck=false => false, everything else => true
800
+ // draggable=true => true, everything else => false
801
+ return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
811
802
  },
812
803
  set(newValue) {
813
804
  const currentValue = this.getAttribute(attrName);
@@ -864,6 +855,23 @@ const ariaDescriptor = (attrName) => ({
864
855
  }
865
856
  },
866
857
  });
858
+ const tabIndexDescriptor = () => ({
859
+ configurable: true,
860
+ enumerable: true,
861
+ get() {
862
+ const str = this.getAttribute('tabindex');
863
+ const num = Number(str);
864
+ return isFinite(num) ? Math.trunc(num) : -1;
865
+ },
866
+ set(newValue) {
867
+ const currentValue = this.getAttribute('tabindex');
868
+ const num = Number(newValue);
869
+ const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
870
+ if (normalizedValue !== currentValue) {
871
+ this.setAttribute('tabindex', toString$1(newValue));
872
+ }
873
+ },
874
+ });
867
875
  const descriptors = {
868
876
  accessKey: stringDescriptor('accesskey'),
869
877
  dir: stringDescriptor('dir'),
@@ -872,21 +880,7 @@ const descriptors = {
872
880
  id: stringDescriptor('id'),
873
881
  lang: stringDescriptor('lang'),
874
882
  spellcheck: explicitBooleanDescriptor('spellcheck', false),
875
- tabIndex: {
876
- get() {
877
- const str = this.getAttribute('tabindex');
878
- const num = Number(str);
879
- return isFinite(num) ? Math.trunc(num) : -1;
880
- },
881
- set(newValue) {
882
- const currentValue = this.getAttribute('tabindex');
883
- const num = Number(newValue);
884
- const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
885
- if (normalizedValue !== currentValue) {
886
- this.setAttribute('tabindex', toString$1(newValue));
887
- }
888
- },
889
- },
883
+ tabIndex: tabIndexDescriptor(),
890
884
  title: stringDescriptor('title'),
891
885
  };
892
886
  // Add descriptors for ARIA attributes
@@ -1064,6 +1058,10 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1064
1058
  if (!hasClassAttribute && combinedScopeToken) {
1065
1059
  result += ` class="${combinedScopeToken}"`;
1066
1060
  }
1061
+ // For the host scope token only, we encode a special attribute for hydration
1062
+ if (hostScopeToken) {
1063
+ result += ` data-lwc-host-scope-token="${hostScopeToken}"`;
1064
+ }
1067
1065
  result += mutationTracker.renderMutatedAttrs(instance);
1068
1066
  return result;
1069
1067
  }
@@ -1083,7 +1081,7 @@ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
1083
1081
  emit('<template shadowrootmode="open"></template>');
1084
1082
  }
1085
1083
  }
1086
- async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
1084
+ async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
1087
1085
  if (typeof tagName !== 'string') {
1088
1086
  throw new Error(`tagName must be a string, found: ${tagName}`);
1089
1087
  }
@@ -1885,5 +1883,5 @@ exports.track = track;
1885
1883
  exports.unwrap = unwrap$1;
1886
1884
  exports.validateStyleTextContents = validateStyleTextContents;
1887
1885
  exports.wire = wire;
1888
- /** version: 8.8.0 */
1886
+ /** version: 8.9.0 */
1889
1887
  //# sourceMappingURL=index.cjs.js.map