@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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './stubs';
2
2
  export { htmlEscape, setHooks, sanitizeHtmlContent } from '@lwc/shared';
3
3
  export { ClassList } from './class-list';
4
- export { LightningElement, LightningElementConstructor, SYMBOL__SET_INTERNALS, SYMBOL__GENERATE_MARKUP, } from './lightning-element';
4
+ export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
5
5
  export { mutationTracker } from './mutation-tracker';
6
6
  export { filterProperties } from './reflection';
7
7
  export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
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.10.0-alpha.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
@@ -899,6 +893,7 @@ for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
899
893
  var _LightningElement_attrs, _LightningElement_classList;
900
894
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
901
895
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
896
+ const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
902
897
  class LightningElement {
903
898
  constructor(propsAvailableAtConstruction) {
904
899
  this.isConnected = false;
@@ -1060,6 +1055,10 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1060
1055
  if (!hasClassAttribute && combinedScopeToken) {
1061
1056
  result += ` class="${combinedScopeToken}"`;
1062
1057
  }
1058
+ // For the host scope token only, we encode a special attribute for hydration
1059
+ if (hostScopeToken) {
1060
+ result += ` data-lwc-host-scope-token="${hostScopeToken}"`;
1061
+ }
1063
1062
  result += mutationTracker.renderMutatedAttrs(instance);
1064
1063
  return result;
1065
1064
  }
@@ -1079,7 +1078,7 @@ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
1079
1078
  emit('<template shadowrootmode="open"></template>');
1080
1079
  }
1081
1080
  }
1082
- async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
1081
+ async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
1083
1082
  if (typeof tagName !== 'string') {
1084
1083
  throw new Error(`tagName must be a string, found: ${tagName}`);
1085
1084
  }
@@ -1837,6 +1836,6 @@ function createContextProvider(adapter) {
1837
1836
  };
1838
1837
  }
1839
1838
 
1840
- 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
+ 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, 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 };
1840
+ /** version: 8.10.0-alpha.0 */
1842
1841
  //# sourceMappingURL=index.js.map