@lwc/ssr-runtime 8.8.0 → 8.10.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { LightningElement } from './lightning-element';
1
+ import type { LightningElement } from './lightning-element';
2
2
  interface DOMTokenList {
3
3
  readonly length: number;
4
4
  value: string;
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.10.0-alpha.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
@@ -903,6 +897,7 @@ for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
903
897
  var _LightningElement_attrs, _LightningElement_classList;
904
898
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
905
899
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
900
+ const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
906
901
  class LightningElement {
907
902
  constructor(propsAvailableAtConstruction) {
908
903
  this.isConnected = false;
@@ -1064,6 +1059,10 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1064
1059
  if (!hasClassAttribute && combinedScopeToken) {
1065
1060
  result += ` class="${combinedScopeToken}"`;
1066
1061
  }
1062
+ // For the host scope token only, we encode a special attribute for hydration
1063
+ if (hostScopeToken) {
1064
+ result += ` data-lwc-host-scope-token="${hostScopeToken}"`;
1065
+ }
1067
1066
  result += mutationTracker.renderMutatedAttrs(instance);
1068
1067
  return result;
1069
1068
  }
@@ -1083,7 +1082,7 @@ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
1083
1082
  emit('<template shadowrootmode="open"></template>');
1084
1083
  }
1085
1084
  }
1086
- async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
1085
+ async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
1087
1086
  if (typeof tagName !== 'string') {
1088
1087
  throw new Error(`tagName must be a string, found: ${tagName}`);
1089
1088
  }
@@ -1843,6 +1842,7 @@ function createContextProvider(adapter) {
1843
1842
 
1844
1843
  exports.ClassList = ClassList;
1845
1844
  exports.LightningElement = LightningElement;
1845
+ exports.SYMBOL__DEFAULT_TEMPLATE = SYMBOL__DEFAULT_TEMPLATE;
1846
1846
  exports.SYMBOL__GENERATE_MARKUP = SYMBOL__GENERATE_MARKUP;
1847
1847
  exports.SYMBOL__SET_INTERNALS = SYMBOL__SET_INTERNALS;
1848
1848
  exports.api = api;
@@ -1885,5 +1885,5 @@ exports.track = track;
1885
1885
  exports.unwrap = unwrap$1;
1886
1886
  exports.validateStyleTextContents = validateStyleTextContents;
1887
1887
  exports.wire = wire;
1888
- /** version: 8.8.0 */
1888
+ /** version: 8.10.0-alpha.0 */
1889
1889
  //# sourceMappingURL=index.cjs.js.map