@lwc/ssr-runtime 8.13.3 → 8.15.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.
@@ -17,7 +17,7 @@ export declare class ClassList implements DOMTokenList {
17
17
  el: LightningElement;
18
18
  constructor(el: LightningElement);
19
19
  add(...newClassNames: string[]): void;
20
- contains(className: string): any;
20
+ contains(className: string): boolean;
21
21
  remove(...classNamesToRemove: string[]): void;
22
22
  replace(oldClassName: string, newClassName: string): boolean;
23
23
  toggle(classNameToToggle: string, force?: boolean): boolean;
@@ -25,9 +25,9 @@ export declare class ClassList implements DOMTokenList {
25
25
  toString(): string;
26
26
  get length(): number;
27
27
  [index: number]: never;
28
- item(_index: number): string | null;
28
+ item(index: number): string | null;
29
+ forEach(callbackFn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void;
29
30
  supports(_token: string): boolean;
30
- forEach(_callbackfn: (value: string, key: number, parent: DOMTokenList) => void, _thisArg?: any): void;
31
31
  }
32
32
  export {};
33
33
  //# sourceMappingURL=class-list.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -609,7 +609,23 @@ function setHooks(hooks) {
609
609
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
610
610
  */
611
611
  const DEFAULT_SSR_MODE = 'sync';
612
- /** version: 8.13.3 */
612
+
613
+ /*
614
+ * Copyright (c) 2025, salesforce.com, inc.
615
+ * All rights reserved.
616
+ * SPDX-License-Identifier: MIT
617
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
618
+ */
619
+ /**
620
+ * Global HTML "tabindex" attribute is specially massaged into a stringified number
621
+ * This follows the historical behavior in api.ts:
622
+ * https://github.com/salesforce/lwc/blob/f34a347/packages/%40lwc/engine-core/src/framework/api.ts#L193-L211
623
+ */
624
+ function normalizeTabIndex(value) {
625
+ const shouldNormalize = value > 0 && typeof value !== 'boolean';
626
+ return shouldNormalize ? 0 : value;
627
+ }
628
+ /** version: 8.15.0 */
613
629
 
614
630
  /*
615
631
  * Copyright (c) 2024, Salesforce, Inc.
@@ -618,25 +634,28 @@ const DEFAULT_SSR_MODE = 'sync';
618
634
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
619
635
  */
620
636
  const MULTI_SPACE = /\s+/g;
637
+ function parseClassName(className) {
638
+ return (className ?? '')
639
+ .split(MULTI_SPACE)
640
+ .map((item) => item.trim())
641
+ .filter(Boolean);
642
+ }
621
643
  class ClassList {
622
644
  constructor(el) {
623
645
  this.el = el;
624
646
  }
625
647
  add(...newClassNames) {
626
- const className = this.el.className;
627
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
648
+ const set = new Set(parseClassName(this.el.className));
628
649
  for (const newClassName of newClassNames) {
629
650
  set.add(newClassName);
630
651
  }
631
652
  this.el.className = Array.from(set).join(' ');
632
653
  }
633
654
  contains(className) {
634
- const currentClassNameStr = this.el.className;
635
- return currentClassNameStr.split(MULTI_SPACE).includes(className);
655
+ return parseClassName(this.el.className).includes(className);
636
656
  }
637
657
  remove(...classNamesToRemove) {
638
- const className = this.el.className;
639
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
658
+ const set = new Set(parseClassName(this.el.className));
640
659
  for (const newClassName of classNamesToRemove) {
641
660
  set.delete(newClassName);
642
661
  }
@@ -644,8 +663,7 @@ class ClassList {
644
663
  }
645
664
  replace(oldClassName, newClassName) {
646
665
  let classWasReplaced = false;
647
- const className = this.el.className;
648
- const listOfClasses = className.split(MULTI_SPACE).filter(Boolean);
666
+ const listOfClasses = parseClassName(this.el.className);
649
667
  listOfClasses.forEach((value, idx) => {
650
668
  if (value === oldClassName) {
651
669
  classWasReplaced = true;
@@ -656,8 +674,7 @@ class ClassList {
656
674
  return classWasReplaced;
657
675
  }
658
676
  toggle(classNameToToggle, force) {
659
- const classNameStr = this.el.className;
660
- const set = new Set(classNameStr.split(MULTI_SPACE).filter(Boolean));
677
+ const set = new Set(parseClassName(this.el.className));
661
678
  if (!set.has(classNameToToggle) && force !== false) {
662
679
  set.add(classNameToToggle);
663
680
  }
@@ -674,17 +691,18 @@ class ClassList {
674
691
  return this.el.className;
675
692
  }
676
693
  get length() {
677
- const currentClassNameStr = this.el.className ?? '';
678
- return currentClassNameStr.split(MULTI_SPACE).length;
694
+ return parseClassName(this.el.className).length;
679
695
  }
680
- item(_index) {
681
- throw new Error('Method "item" not implemented.');
696
+ item(index) {
697
+ return parseClassName(this.el.className ?? '')[index] ?? null;
682
698
  }
683
- supports(_token) {
684
- throw new Error('Method "supports" not implemented.');
699
+ forEach(callbackFn, thisArg) {
700
+ parseClassName(this.el.className).forEach((value, index) => callbackFn.call(thisArg, value, index, this));
685
701
  }
686
- forEach(_callbackfn, _thisArg) {
687
- throw new Error('Method "forEach" not implemented.');
702
+ // This method is present on DOMTokenList but throws an error in the browser when used
703
+ // in connection with Element#classList.
704
+ supports(_token) {
705
+ throw new TypeError('DOMTokenList has no supported tokens.');
688
706
  }
689
707
  }
690
708
 
@@ -1332,18 +1350,21 @@ class LightningElement {
1332
1350
  _LightningElement_classList.set(this, null);
1333
1351
  assign(this, propsAvailableAtConstruction);
1334
1352
  }
1335
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties, privateProperties) {
1353
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1336
1354
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1337
1355
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1356
+ // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1357
+ if (attrs.class) {
1358
+ this.className = attrs.class;
1359
+ }
1338
1360
  // Avoid setting the following types of properties that should not be set:
1339
1361
  // - Properties that are not public.
1340
1362
  // - Properties that are not global.
1341
- // - Properties that are global but are internally overridden.
1342
1363
  for (const propName of keys(props)) {
1343
1364
  const attrName = htmlPropertyToAttribute(propName);
1344
1365
  if (publicProperties.has(propName) ||
1345
- ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1346
- !privateProperties.has(propName))) {
1366
+ REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) ||
1367
+ isAriaAttribute(attrName)) {
1347
1368
  // For props passed from parents to children, they are intended to be read-only
1348
1369
  // to avoid a child mutating its parent's state
1349
1370
  this[propName] = getReadOnlyProxy(props[propName]);
@@ -1469,7 +1490,7 @@ class LightningElement {
1469
1490
  defineProperties(LightningElement.prototype, descriptors);
1470
1491
 
1471
1492
  /*
1472
- * Copyright (c) 2024, salesforce.com, inc.
1493
+ * Copyright (c) 2025, Salesforce, Inc.
1473
1494
  * All rights reserved.
1474
1495
  * SPDX-License-Identifier: MIT
1475
1496
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -1527,11 +1548,11 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
1527
1548
  function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
1528
1549
  emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
1529
1550
  }
1530
- function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1551
+ async function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1531
1552
  if (Cmp.renderMode !== 'light') {
1532
1553
  yield `<template shadowrootmode="open"></template>`;
1533
1554
  if (shadowSlottedContent) {
1534
- yield shadowSlottedContent(instance);
1555
+ yield* shadowSlottedContent(instance);
1535
1556
  }
1536
1557
  }
1537
1558
  }
@@ -1555,6 +1576,8 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1555
1576
  if (!generateMarkup) {
1556
1577
  // If a non-component is accidentally provided, render an empty template
1557
1578
  emit(`<${tagName}>`);
1579
+ // Using a false type assertion for the `instance` param is safe because it's only used
1580
+ // if there's slotted content, which we are not providing
1558
1581
  fallbackTmplNoYield(emit, null, null, null, Component, null);
1559
1582
  emit(`</${tagName}>`);
1560
1583
  return markup;
@@ -1811,6 +1834,7 @@ exports.htmlEscape = htmlEscape;
1811
1834
  exports.isComponentConstructor = isComponentConstructor;
1812
1835
  exports.mutationTracker = mutationTracker;
1813
1836
  exports.normalizeClass = normalizeClass;
1837
+ exports.normalizeTabIndex = normalizeTabIndex;
1814
1838
  exports.normalizeTextContent = normalizeTextContent;
1815
1839
  exports.parseFragment = parseFragment;
1816
1840
  exports.parseSVGFragment = parseSVGFragment;
@@ -1837,5 +1861,5 @@ exports.track = track;
1837
1861
  exports.unwrap = unwrap$1;
1838
1862
  exports.validateStyleTextContents = validateStyleTextContents;
1839
1863
  exports.wire = wire;
1840
- /** version: 8.13.3 */
1864
+ /** version: 8.15.0 */
1841
1865
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export * from './stubs';
2
- export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass } from '@lwc/shared';
2
+ export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass, normalizeTabIndex, } from '@lwc/shared';
3
3
  export { ClassList } from './class-list';
4
4
  export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
5
5
  export { mutationTracker } from './mutation-tracker';
6
- export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
6
+ export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupAsyncYield, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
7
7
  export { normalizeTextContent, renderTextContent } from './render-text-content';
8
8
  export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
9
9
  export { toIteratorDirective } from './to-iterator-directive';
package/dist/index.js CHANGED
@@ -605,7 +605,23 @@ function setHooks(hooks) {
605
605
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
606
606
  */
607
607
  const DEFAULT_SSR_MODE = 'sync';
608
- /** version: 8.13.3 */
608
+
609
+ /*
610
+ * Copyright (c) 2025, salesforce.com, inc.
611
+ * All rights reserved.
612
+ * SPDX-License-Identifier: MIT
613
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
614
+ */
615
+ /**
616
+ * Global HTML "tabindex" attribute is specially massaged into a stringified number
617
+ * This follows the historical behavior in api.ts:
618
+ * https://github.com/salesforce/lwc/blob/f34a347/packages/%40lwc/engine-core/src/framework/api.ts#L193-L211
619
+ */
620
+ function normalizeTabIndex(value) {
621
+ const shouldNormalize = value > 0 && typeof value !== 'boolean';
622
+ return shouldNormalize ? 0 : value;
623
+ }
624
+ /** version: 8.15.0 */
609
625
 
610
626
  /*
611
627
  * Copyright (c) 2024, Salesforce, Inc.
@@ -614,25 +630,28 @@ const DEFAULT_SSR_MODE = 'sync';
614
630
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
615
631
  */
616
632
  const MULTI_SPACE = /\s+/g;
633
+ function parseClassName(className) {
634
+ return (className ?? '')
635
+ .split(MULTI_SPACE)
636
+ .map((item) => item.trim())
637
+ .filter(Boolean);
638
+ }
617
639
  class ClassList {
618
640
  constructor(el) {
619
641
  this.el = el;
620
642
  }
621
643
  add(...newClassNames) {
622
- const className = this.el.className;
623
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
644
+ const set = new Set(parseClassName(this.el.className));
624
645
  for (const newClassName of newClassNames) {
625
646
  set.add(newClassName);
626
647
  }
627
648
  this.el.className = Array.from(set).join(' ');
628
649
  }
629
650
  contains(className) {
630
- const currentClassNameStr = this.el.className;
631
- return currentClassNameStr.split(MULTI_SPACE).includes(className);
651
+ return parseClassName(this.el.className).includes(className);
632
652
  }
633
653
  remove(...classNamesToRemove) {
634
- const className = this.el.className;
635
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
654
+ const set = new Set(parseClassName(this.el.className));
636
655
  for (const newClassName of classNamesToRemove) {
637
656
  set.delete(newClassName);
638
657
  }
@@ -640,8 +659,7 @@ class ClassList {
640
659
  }
641
660
  replace(oldClassName, newClassName) {
642
661
  let classWasReplaced = false;
643
- const className = this.el.className;
644
- const listOfClasses = className.split(MULTI_SPACE).filter(Boolean);
662
+ const listOfClasses = parseClassName(this.el.className);
645
663
  listOfClasses.forEach((value, idx) => {
646
664
  if (value === oldClassName) {
647
665
  classWasReplaced = true;
@@ -652,8 +670,7 @@ class ClassList {
652
670
  return classWasReplaced;
653
671
  }
654
672
  toggle(classNameToToggle, force) {
655
- const classNameStr = this.el.className;
656
- const set = new Set(classNameStr.split(MULTI_SPACE).filter(Boolean));
673
+ const set = new Set(parseClassName(this.el.className));
657
674
  if (!set.has(classNameToToggle) && force !== false) {
658
675
  set.add(classNameToToggle);
659
676
  }
@@ -670,17 +687,18 @@ class ClassList {
670
687
  return this.el.className;
671
688
  }
672
689
  get length() {
673
- const currentClassNameStr = this.el.className ?? '';
674
- return currentClassNameStr.split(MULTI_SPACE).length;
690
+ return parseClassName(this.el.className).length;
675
691
  }
676
- item(_index) {
677
- throw new Error('Method "item" not implemented.');
692
+ item(index) {
693
+ return parseClassName(this.el.className ?? '')[index] ?? null;
678
694
  }
679
- supports(_token) {
680
- throw new Error('Method "supports" not implemented.');
695
+ forEach(callbackFn, thisArg) {
696
+ parseClassName(this.el.className).forEach((value, index) => callbackFn.call(thisArg, value, index, this));
681
697
  }
682
- forEach(_callbackfn, _thisArg) {
683
- throw new Error('Method "forEach" not implemented.');
698
+ // This method is present on DOMTokenList but throws an error in the browser when used
699
+ // in connection with Element#classList.
700
+ supports(_token) {
701
+ throw new TypeError('DOMTokenList has no supported tokens.');
684
702
  }
685
703
  }
686
704
 
@@ -1328,18 +1346,21 @@ class LightningElement {
1328
1346
  _LightningElement_classList.set(this, null);
1329
1347
  assign(this, propsAvailableAtConstruction);
1330
1348
  }
1331
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties, privateProperties) {
1349
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1332
1350
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1333
1351
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1352
+ // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1353
+ if (attrs.class) {
1354
+ this.className = attrs.class;
1355
+ }
1334
1356
  // Avoid setting the following types of properties that should not be set:
1335
1357
  // - Properties that are not public.
1336
1358
  // - Properties that are not global.
1337
- // - Properties that are global but are internally overridden.
1338
1359
  for (const propName of keys(props)) {
1339
1360
  const attrName = htmlPropertyToAttribute(propName);
1340
1361
  if (publicProperties.has(propName) ||
1341
- ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1342
- !privateProperties.has(propName))) {
1362
+ REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) ||
1363
+ isAriaAttribute(attrName)) {
1343
1364
  // For props passed from parents to children, they are intended to be read-only
1344
1365
  // to avoid a child mutating its parent's state
1345
1366
  this[propName] = getReadOnlyProxy(props[propName]);
@@ -1465,7 +1486,7 @@ class LightningElement {
1465
1486
  defineProperties(LightningElement.prototype, descriptors);
1466
1487
 
1467
1488
  /*
1468
- * Copyright (c) 2024, salesforce.com, inc.
1489
+ * Copyright (c) 2025, Salesforce, Inc.
1469
1490
  * All rights reserved.
1470
1491
  * SPDX-License-Identifier: MIT
1471
1492
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -1523,11 +1544,11 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
1523
1544
  function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
1524
1545
  emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
1525
1546
  }
1526
- function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1547
+ async function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1527
1548
  if (Cmp.renderMode !== 'light') {
1528
1549
  yield `<template shadowrootmode="open"></template>`;
1529
1550
  if (shadowSlottedContent) {
1530
- yield shadowSlottedContent(instance);
1551
+ yield* shadowSlottedContent(instance);
1531
1552
  }
1532
1553
  }
1533
1554
  }
@@ -1551,6 +1572,8 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1551
1572
  if (!generateMarkup) {
1552
1573
  // If a non-component is accidentally provided, render an empty template
1553
1574
  emit(`<${tagName}>`);
1575
+ // Using a false type assertion for the `instance` param is safe because it's only used
1576
+ // if there's slotted content, which we are not providing
1554
1577
  fallbackTmplNoYield(emit, null, null, null, Component, null);
1555
1578
  emit(`</${tagName}>`);
1556
1579
  return markup;
@@ -1787,6 +1810,6 @@ function createContextProvider(adapter) {
1787
1810
  };
1788
1811
  }
1789
1812
 
1790
- export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, normalizeClass, normalizeTextContent, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderTextContent, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1791
- /** version: 8.13.3 */
1813
+ export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, normalizeClass, normalizeTabIndex, normalizeTextContent, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderTextContent, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1814
+ /** version: 8.15.0 */
1792
1815
  //# sourceMappingURL=index.js.map
@@ -16,6 +16,9 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
16
16
  #private;
17
17
  static renderMode?: 'light' | 'shadow';
18
18
  static stylesheets?: Stylesheets;
19
+ static delegatesFocus?: boolean;
20
+ static formAssociated?: boolean;
21
+ static shadowSupportMode?: 'any' | 'reset' | 'native';
19
22
  accessKey: string;
20
23
  dir: string;
21
24
  draggable: boolean;
@@ -28,7 +31,7 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
28
31
  isConnected: boolean;
29
32
  tagName: string;
30
33
  constructor(propsAvailableAtConstruction: PropsAvailableAtConstruction & Properties);
31
- [SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes, publicProperties: Set<string>, privateProperties: Set<string>): void;
34
+ [SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes, publicProperties: Set<string>): void;
32
35
  get className(): any;
33
36
  set className(newVal: any);
34
37
  get classList(): ClassList;
package/dist/render.d.ts CHANGED
@@ -1,17 +1,55 @@
1
1
  import { SYMBOL__GENERATE_MARKUP } from './lightning-element';
2
+ import type { CompilationMode } from '@lwc/shared';
2
3
  import type { LightningElement, LightningElementConstructor } from './lightning-element';
3
4
  import type { Attributes, Properties } from './types';
5
+ /** Parameters used by all `generateMarkup` variants that don't get transmogrified. */
6
+ type BaseGenerateMarkupParams = readonly [
7
+ tagName: string,
8
+ props: Properties | null,
9
+ attrs: Attributes | null,
10
+ parent: LightningElement | null,
11
+ scopeToken: string | null,
12
+ contextfulParent: LightningElement | null
13
+ ];
14
+ /** Text emitter used by transmogrified formats. */
15
+ type Emit = (str: string) => void;
16
+ /** Slotted content function used by `asyncYield` mode. */
17
+ type SlottedContentGenerator = (instance: LightningElement) => AsyncGenerator<string, void, unknown>;
18
+ /** Slotted content function used by `sync` and `async` modes. */
19
+ type SlottedContentEmitter = ($$emit: Emit, instance: LightningElement) => void;
20
+ /** Slotted content map used by `asyncYield` mode. */
21
+ type SlottedContentGeneratorMap = Record<number | string, SlottedContentGenerator[]>;
22
+ /** Slotted content map used by `sync` and `async` modes. */
23
+ type SlottedContentEmitterMap = Record<number | string, SlottedContentEmitter[]>;
24
+ /** `generateMarkup` parameters used by `asyncYield` mode. */
25
+ type GenerateMarkupGeneratorParams = readonly [
26
+ ...BaseGenerateMarkupParams,
27
+ shadowSlottedContent: SlottedContentGenerator | null,
28
+ lightSlottedContent: SlottedContentGeneratorMap | null,
29
+ scopedSlottedContent: SlottedContentGeneratorMap | null
30
+ ];
31
+ /** `generateMarkup` parameters used by `sync` and `async` modes. */
32
+ type GenerateMarkupEmitterParams = readonly [
33
+ emit: Emit,
34
+ ...BaseGenerateMarkupParams,
35
+ shadowSlottedContent: SlottedContentEmitter | null,
36
+ lightSlottedContent: SlottedContentEmitterMap | null,
37
+ scopedSlottedContent: SlottedContentEmitterMap | null
38
+ ];
39
+ /** Signature for `asyncYield` compilation mode. */
40
+ export type GenerateMarkupAsyncYield = (...args: GenerateMarkupGeneratorParams) => AsyncGenerator<string>;
41
+ /** Signature for `async` compilation mode. */
42
+ export type GenerateMarkupAsync = (...args: GenerateMarkupEmitterParams) => Promise<void>;
43
+ /** Signature for `sync` compilation mode. */
44
+ export type GenerateMarkupSync = (...args: GenerateMarkupEmitterParams) => void;
45
+ type GenerateMarkupVariants = GenerateMarkupAsyncYield | GenerateMarkupAsync | GenerateMarkupSync;
4
46
  export declare function renderAttrs(instance: LightningElement, attrs: Attributes, hostScopeToken: string | undefined, scopeToken: string | undefined): Generator<string, void, unknown>;
5
47
  export declare function renderAttrsNoYield(emit: (segment: string) => void, instance: LightningElement, attrs: Attributes, hostScopeToken: string | undefined, scopeToken: string | undefined): void;
6
- export declare function fallbackTmpl(shadowSlottedContent: AsyncGeneratorFunction, _lightSlottedContent: unknown, _scopedSlottedContent: unknown, Cmp: LightningElementConstructor, instance: LightningElement): Generator<"<template shadowrootmode=\"open\"></template>" | AsyncGenerator<unknown, any, any>, void, unknown>;
7
- export declare function fallbackTmplNoYield(emit: (segment: string) => void, shadowSlottedContent: AsyncGeneratorFunction | null, _lightSlottedContent: unknown, _scopedSlottedContent: unknown, Cmp: LightningElementConstructor, instance: LightningElement | null): void;
8
- export type GenerateMarkupFn = (tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => AsyncGenerator<string>;
9
- export type GenerateMarkupFnAsyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => Promise<void>;
10
- export type GenerateMarkupFnSyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => void;
11
- type GenerateMarkupFnVariants = GenerateMarkupFn | GenerateMarkupFnAsyncNoGen | GenerateMarkupFnSyncNoGen;
48
+ export declare function fallbackTmpl(shadowSlottedContent: SlottedContentGenerator | null, _lightSlottedContent: SlottedContentGeneratorMap | null, _scopedSlottedContent: SlottedContentGeneratorMap | null, Cmp: LightningElementConstructor, instance: LightningElement): AsyncGenerator<string>;
49
+ export declare function fallbackTmplNoYield(emit: Emit, shadowSlottedContent: SlottedContentEmitter | null, _lightSlottedContent: SlottedContentEmitterMap | null, _scopedSlottedContent: SlottedContentEmitterMap | null, Cmp: LightningElementConstructor, instance: LightningElement): void;
12
50
  interface ComponentWithGenerateMarkup extends LightningElementConstructor {
13
- [SYMBOL__GENERATE_MARKUP]?: GenerateMarkupFnVariants;
51
+ [SYMBOL__GENERATE_MARKUP]?: GenerateMarkupVariants;
14
52
  }
15
- export declare function serverSideRenderComponent(tagName: string, Component: ComponentWithGenerateMarkup, props?: Properties, mode?: 'asyncYield' | 'async' | 'sync'): Promise<string>;
53
+ export declare function serverSideRenderComponent(tagName: string, Component: ComponentWithGenerateMarkup, props?: Properties, mode?: CompilationMode): Promise<string>;
16
54
  export {};
17
55
  //# sourceMappingURL=render.d.ts.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/ssr-runtime",
7
- "version": "8.13.3",
7
+ "version": "8.15.0",
8
8
  "description": "Runtime complement to @lwc/ssr-compiler",
9
9
  "keywords": [
10
10
  "lwc",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@lwc/shared": "8.13.3",
52
- "@lwc/engine-core": "8.13.3",
51
+ "@lwc/shared": "8.15.0",
52
+ "@lwc/engine-core": "8.15.0",
53
53
  "observable-membrane": "2.0.0"
54
54
  }
55
55
  }