@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.js CHANGED
@@ -258,44 +258,24 @@ defineProperties,
258
258
  defineProperty,
259
259
  /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
260
260
  entries,
261
- /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
262
- freeze,
263
- /** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
264
- fromEntries,
265
- /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
266
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
267
- /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
268
- getOwnPropertyDescriptors,
269
261
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
270
262
  getOwnPropertyNames: getOwnPropertyNames$1,
271
- /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
272
- getOwnPropertySymbols: getOwnPropertySymbols$1,
273
- /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
274
- getPrototypeOf: getPrototypeOf$1,
275
263
  /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
276
264
  hasOwnProperty: hasOwnProperty$1,
277
- /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
278
- isFrozen,
279
265
  /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
280
- keys,
281
- /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
282
- seal,
283
- /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
284
- setPrototypeOf, } = Object;
266
+ keys} = Object;
285
267
  const {
286
268
  /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
287
- isArray: isArray$1,
288
- /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
289
- from: ArrayFrom, } = Array;
269
+ isArray: isArray$1} = Array;
290
270
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
291
271
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
292
272
  // statement, rather than this declaration.
293
- 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!
273
+ const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
294
274
  } = Array.prototype;
295
275
  /** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
296
276
  const { fromCharCode: StringFromCharCode } = String;
297
277
  // No JSDocs here - see comment for Array.prototype
298
- const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
278
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, toLowerCase: StringToLowerCase} = String.prototype;
299
279
  /**
300
280
  * Determines whether the argument is `undefined`.
301
281
  * @param obj Value to test
@@ -456,7 +436,6 @@ const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
456
436
  'autofocus',
457
437
  'class',
458
438
  'contenteditable',
459
- 'contextmenu',
460
439
  'dir',
461
440
  'draggable',
462
441
  'enterkeyhint',
@@ -600,7 +579,15 @@ function flattenStylesheets(stylesheets) {
600
579
  }
601
580
  return list;
602
581
  }
603
- /** version: 8.8.0 */
582
+
583
+ /*
584
+ * Copyright (c) 2024, Salesforce, Inc.
585
+ * All rights reserved.
586
+ * SPDX-License-Identifier: MIT
587
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
588
+ */
589
+ const DEFAULT_SSR_MODE = 'sync';
590
+ /** version: 8.9.0 */
604
591
 
605
592
  /*
606
593
  * Copyright (c) 2024, Salesforce, Inc.
@@ -803,7 +790,11 @@ const explicitBooleanDescriptor = (attrName, defaultValue) => ({
803
790
  enumerable: true,
804
791
  get() {
805
792
  const value = this.getAttribute(attrName);
806
- return value === null ? defaultValue : value === String(defaultValue);
793
+ if (value === null)
794
+ return defaultValue;
795
+ // spellcheck=false => false, everything else => true
796
+ // draggable=true => true, everything else => false
797
+ return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
807
798
  },
808
799
  set(newValue) {
809
800
  const currentValue = this.getAttribute(attrName);
@@ -860,6 +851,23 @@ const ariaDescriptor = (attrName) => ({
860
851
  }
861
852
  },
862
853
  });
854
+ const tabIndexDescriptor = () => ({
855
+ configurable: true,
856
+ enumerable: true,
857
+ get() {
858
+ const str = this.getAttribute('tabindex');
859
+ const num = Number(str);
860
+ return isFinite(num) ? Math.trunc(num) : -1;
861
+ },
862
+ set(newValue) {
863
+ const currentValue = this.getAttribute('tabindex');
864
+ const num = Number(newValue);
865
+ const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
866
+ if (normalizedValue !== currentValue) {
867
+ this.setAttribute('tabindex', toString$1(newValue));
868
+ }
869
+ },
870
+ });
863
871
  const descriptors = {
864
872
  accessKey: stringDescriptor('accesskey'),
865
873
  dir: stringDescriptor('dir'),
@@ -868,21 +876,7 @@ const descriptors = {
868
876
  id: stringDescriptor('id'),
869
877
  lang: stringDescriptor('lang'),
870
878
  spellcheck: explicitBooleanDescriptor('spellcheck', false),
871
- tabIndex: {
872
- get() {
873
- const str = this.getAttribute('tabindex');
874
- const num = Number(str);
875
- return isFinite(num) ? Math.trunc(num) : -1;
876
- },
877
- set(newValue) {
878
- const currentValue = this.getAttribute('tabindex');
879
- const num = Number(newValue);
880
- const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
881
- if (normalizedValue !== currentValue) {
882
- this.setAttribute('tabindex', toString$1(newValue));
883
- }
884
- },
885
- },
879
+ tabIndex: tabIndexDescriptor(),
886
880
  title: stringDescriptor('title'),
887
881
  };
888
882
  // Add descriptors for ARIA attributes
@@ -1060,6 +1054,10 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1060
1054
  if (!hasClassAttribute && combinedScopeToken) {
1061
1055
  result += ` class="${combinedScopeToken}"`;
1062
1056
  }
1057
+ // For the host scope token only, we encode a special attribute for hydration
1058
+ if (hostScopeToken) {
1059
+ result += ` data-lwc-host-scope-token="${hostScopeToken}"`;
1060
+ }
1063
1061
  result += mutationTracker.renderMutatedAttrs(instance);
1064
1062
  return result;
1065
1063
  }
@@ -1079,7 +1077,7 @@ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
1079
1077
  emit('<template shadowrootmode="open"></template>');
1080
1078
  }
1081
1079
  }
1082
- async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
1080
+ async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
1083
1081
  if (typeof tagName !== 'string') {
1084
1082
  throw new Error(`tagName must be a string, found: ${tagName}`);
1085
1083
  }
@@ -1838,5 +1836,5 @@ function createContextProvider(adapter) {
1838
1836
  }
1839
1837
 
1840
1838
  export { ClassList, LightningElement, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, filterProperties, freezeTemplate, getComponentDef, getReadOnlyProxy, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, 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 };
1841
- /** version: 8.8.0 */
1839
+ /** version: 8.9.0 */
1842
1840
  //# sourceMappingURL=index.js.map