@lwc/ssr-runtime 8.19.1 → 8.20.1

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.
@@ -0,0 +1,12 @@
1
+ import { type ContextProvidedCallback, type ContextBinding as IContextBinding } from '@lwc/shared';
2
+ import { type LightningElement } from './lightning-element';
3
+ import type { Signal } from '@lwc/signals';
4
+ declare class ContextBinding<C extends LightningElement> implements IContextBinding<LightningElement> {
5
+ component: C;
6
+ constructor(component: C);
7
+ provideContext<V extends object>(contextVariety: V, providedContextSignal: Signal<unknown>): void;
8
+ consumeContext<V extends object>(contextVariety: V, contextProvidedCallback: ContextProvidedCallback): void;
9
+ }
10
+ export { ContextBinding };
11
+ export declare function connectContext(le: LightningElement): void;
12
+ //# sourceMappingURL=context.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -46,12 +46,6 @@ function registerTemplate(..._) {
46
46
  function sanitizeAttribute(..._) {
47
47
  throw new Error('sanitizeAttribute cannot be used in SSR context.');
48
48
  }
49
- function setFeatureFlag(..._) {
50
- throw new Error('setFeatureFlag cannot be used in SSR context.');
51
- }
52
- function setFeatureFlagForTest(..._) {
53
- throw new Error('setFeatureFlagForTest cannot be used in SSR context.');
54
- }
55
49
  function swapComponent(..._) {
56
50
  throw new Error('swapComponent cannot be used in SSR context.');
57
51
  }
@@ -70,12 +64,6 @@ function unwrap$1(..._) {
70
64
  function wire(..._) {
71
65
  throw new Error('@wire cannot be used in SSR context.');
72
66
  }
73
- function setContextKeys(..._) {
74
- throw new Error('@setContextKeys cannot be used in SSR context.');
75
- }
76
- function setTrustedContextSet(..._) {
77
- throw new Error('setTrustedContextSet cannot be used in SSR context.');
78
- }
79
67
  const renderer = {
80
68
  isSyntheticShadowDefined: false,
81
69
  insert(..._) {
@@ -263,6 +251,8 @@ assign,
263
251
  create,
264
252
  /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
265
253
  defineProperties,
254
+ /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
255
+ defineProperty,
266
256
  /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
267
257
  entries,
268
258
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
@@ -277,7 +267,7 @@ isArray: isArray$1} = Array;
277
267
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
278
268
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
279
269
  // statement, rather than this declaration.
280
- const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
270
+ const { filter: ArrayFilter, join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
281
271
  } = Array.prototype;
282
272
  /** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
283
273
  const { fromCharCode: StringFromCharCode } = String;
@@ -299,6 +289,14 @@ function isUndefined$1(obj) {
299
289
  function isNull(obj) {
300
290
  return obj === null;
301
291
  }
292
+ /**
293
+ * Determines whether the argument is a boolean.
294
+ * @param obj Value to test
295
+ * @returns `true` if the value is a boolean.
296
+ */
297
+ function isBoolean(obj) {
298
+ return typeof obj === 'boolean';
299
+ }
302
300
  /**
303
301
  * Determines whether the argument is an object or null.
304
302
  * @param obj Value to test
@@ -444,6 +442,31 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
444
442
  function isAriaAttribute(attrName) {
445
443
  return attrName in AriaAttrNameToPropNameMap;
446
444
  }
445
+ let trustedContext;
446
+ let contextKeys;
447
+ function setContextKeys(config) {
448
+ isFalse$1(contextKeys, '`setContextKeys` cannot be called more than once');
449
+ contextKeys = config;
450
+ }
451
+ function getContextKeys() {
452
+ return contextKeys;
453
+ }
454
+ function setTrustedContextSet(context) {
455
+ isFalse$1(trustedContext, 'Trusted Context Set is already set!');
456
+ trustedContext = context;
457
+ }
458
+ function addTrustedContext(contextParticipant) {
459
+ // This should be a no-op when the trustedSignals set isn't set by runtime
460
+ trustedContext?.add(contextParticipant);
461
+ }
462
+ function isTrustedContext(target) {
463
+ if (!trustedContext) {
464
+ // The runtime didn't set a trustedContext set
465
+ // this check should only be performed for runtimes that care about filtering context participants to track
466
+ return true;
467
+ }
468
+ return trustedContext.has(target);
469
+ }
447
470
  // These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
448
471
  const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
449
472
  ['accessKey', 'accesskey'],
@@ -607,6 +630,27 @@ function setHooks(hooks) {
607
630
  exports.sanitizeHtmlContent = hooks.sanitizeHtmlContent;
608
631
  }
609
632
 
633
+ /*
634
+ * Copyright (c) 2024, salesforce.com, inc.
635
+ * All rights reserved.
636
+ * SPDX-License-Identifier: MIT
637
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
638
+ */
639
+ let trustedSignals;
640
+ function setTrustedSignalSet(signals) {
641
+ isFalse$1(trustedSignals, 'Trusted Signal Set is already set!');
642
+ trustedSignals = signals;
643
+ }
644
+ function isTrustedSignal(target) {
645
+ if (!trustedSignals) {
646
+ // The runtime didn't set a trustedSignals set
647
+ // this check should only be performed for runtimes that care about filtering signals to track
648
+ // our default behavior should be to track all signals
649
+ return true;
650
+ }
651
+ return trustedSignals.has(target);
652
+ }
653
+
610
654
  /*
611
655
  * Copyright (c) 2024, Salesforce, Inc.
612
656
  * All rights reserved.
@@ -630,7 +674,143 @@ function normalizeTabIndex(value) {
630
674
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
631
675
  return shouldNormalize ? 0 : value;
632
676
  }
633
- /** version: 8.19.1 */
677
+ /** version: 8.20.1 */
678
+
679
+ /**
680
+ * Copyright (c) 2025 Salesforce, Inc.
681
+ */
682
+ /**
683
+ * Copyright (c) 2025 Salesforce, Inc.
684
+ */
685
+ /*
686
+ * Copyright (c) 2018, salesforce.com, inc.
687
+ * All rights reserved.
688
+ * SPDX-License-Identifier: MIT
689
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
690
+ */
691
+ /**
692
+ *
693
+ * @param value
694
+ * @param msg
695
+ */
696
+ /**
697
+ *
698
+ * @param value
699
+ * @param msg
700
+ */
701
+ /** version: 8.20.1 */
702
+
703
+ /*
704
+ * Copyright (c) 2023, salesforce.com, inc.
705
+ * All rights reserved.
706
+ * SPDX-License-Identifier: MIT
707
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
708
+ */
709
+ class SignalBaseClass {
710
+ constructor() {
711
+ this.subscribers = new Set();
712
+ }
713
+ subscribe(onUpdate) {
714
+ this.subscribers.add(onUpdate);
715
+ return () => {
716
+ this.subscribers.delete(onUpdate);
717
+ };
718
+ }
719
+ notify() {
720
+ for (const subscriber of this.subscribers) {
721
+ subscriber();
722
+ }
723
+ }
724
+ }
725
+ /** version: 8.20.1 */
726
+
727
+ /**
728
+ * Copyright (c) 2025 Salesforce, Inc.
729
+ */
730
+
731
+ /*
732
+ * Copyright (c) 2024, Salesforce, Inc.
733
+ * All rights reserved.
734
+ * SPDX-License-Identifier: MIT
735
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
736
+ */
737
+ // When deprecating a feature flag, ensure that it is also no longer set in the application. For
738
+ // example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
739
+ /** List of all feature flags available, with the default value `null`. */
740
+ const features = {
741
+ PLACEHOLDER_TEST_FLAG: null,
742
+ DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
743
+ ENABLE_WIRE_SYNC_EMIT: null,
744
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
745
+ ENABLE_FROZEN_TEMPLATE: null,
746
+ ENABLE_LEGACY_SCOPE_TOKENS: null,
747
+ ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
748
+ ENABLE_EXPERIMENTAL_SIGNALS: null,
749
+ DISABLE_SYNTHETIC_SHADOW: null,
750
+ DISABLE_SCOPE_TOKEN_VALIDATION: null,
751
+ LEGACY_LOCKER_ENABLED: null,
752
+ DISABLE_LEGACY_VALIDATION: null,
753
+ };
754
+ if (!globalThis.lwcRuntimeFlags) {
755
+ Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
756
+ }
757
+ /** Feature flags that have been set. */
758
+ const flags = globalThis.lwcRuntimeFlags;
759
+ /**
760
+ * Set the value at runtime of a given feature flag. This method only be invoked once per feature
761
+ * flag. It is meant to be used during the app initialization.
762
+ * @param name Name of the feature flag to set
763
+ * @param value Whether the feature flag should be enabled
764
+ * @throws Will throw if a non-boolean value is provided when running in production.
765
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
766
+ */
767
+ function setFeatureFlag(name, value) {
768
+ if (!isBoolean(value)) {
769
+ const message = `Failed to set the value "${value}" for the runtime feature flag "${name}". Runtime feature flags can only be set to a boolean value.`;
770
+ if (process.env.NODE_ENV !== 'production') {
771
+ throw new TypeError(message);
772
+ }
773
+ else {
774
+ // eslint-disable-next-line no-console
775
+ console.error(message);
776
+ return;
777
+ }
778
+ }
779
+ if (isUndefined$1(features[name])) {
780
+ // eslint-disable-next-line no-console
781
+ console.info(`Attempt to set a value on an unknown feature flag "${name}" resulted in a NOOP.`);
782
+ return;
783
+ }
784
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
785
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
786
+ // Allow the same flag to be set more than once outside of production to enable testing
787
+ flags[name] = value;
788
+ }
789
+ else {
790
+ // Disallow the same flag to be set more than once in production
791
+ const runtimeValue = flags[name];
792
+ if (!isUndefined$1(runtimeValue)) {
793
+ // eslint-disable-next-line no-console
794
+ console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
795
+ return;
796
+ }
797
+ defineProperty(flags, name, { value });
798
+ }
799
+ }
800
+ /**
801
+ * Set the value at runtime of a given feature flag. This method should only be used for testing
802
+ * purposes. It is a no-op when invoked in production mode.
803
+ * @param name Name of the feature flag to enable or disable
804
+ * @param value Whether the feature flag should be enabled
805
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
806
+ */
807
+ function setFeatureFlagForTest(name, value) {
808
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
809
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
810
+ setFeatureFlag(name, value);
811
+ }
812
+ }
813
+ /** version: 8.20.1 */
634
814
 
635
815
  /*
636
816
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1354,21 +1534,139 @@ function readonly(value) {
1354
1534
  * SPDX-License-Identifier: MIT
1355
1535
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1356
1536
  */
1357
- var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
1537
+ const contextfulRelationships = new WeakMap();
1538
+ function establishContextfulRelationship(parentLe, childLe) {
1539
+ contextfulRelationships.set(childLe, parentLe);
1540
+ }
1541
+ function getContextfulStack(le) {
1542
+ const contextfulParent = contextfulRelationships.get(le);
1543
+ if (!contextfulParent) {
1544
+ return [];
1545
+ }
1546
+ return [contextfulParent, ...getContextfulStack(contextfulParent)];
1547
+ }
1548
+ const contextProviders = new WeakMap();
1549
+ function registerContextProvider(adapter, attachedLe, consumerCallback) {
1550
+ let elementMap = contextProviders.get(adapter);
1551
+ if (!elementMap) {
1552
+ elementMap = new WeakMap();
1553
+ contextProviders.set(adapter, elementMap);
1554
+ }
1555
+ elementMap.set(attachedLe, consumerCallback);
1556
+ }
1557
+ function connectContext$1(adapter, contextConsumer, onNewValue) {
1558
+ const elementMap = contextProviders.get(adapter);
1559
+ if (!elementMap) {
1560
+ return;
1561
+ }
1562
+ const contextfulStack = getContextfulStack(contextConsumer);
1563
+ for (const ancestor of contextfulStack) {
1564
+ const onConsumerConnected = elementMap.get(ancestor);
1565
+ if (onConsumerConnected) {
1566
+ onConsumerConnected({
1567
+ provide(newContextValue) {
1568
+ onNewValue(newContextValue);
1569
+ },
1570
+ });
1571
+ return;
1572
+ }
1573
+ }
1574
+ }
1575
+ function createContextProvider(adapter) {
1576
+ return (le, options) => {
1577
+ if (!(le instanceof LightningElement)) {
1578
+ throw new Error('Unable to register context provider on provided `elm`.');
1579
+ }
1580
+ if (!le.isConnected || !options?.consumerConnectedCallback) {
1581
+ return;
1582
+ }
1583
+ const { consumerConnectedCallback } = options;
1584
+ registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1585
+ };
1586
+ }
1587
+
1588
+ /*
1589
+ * Copyright (c) 2024, salesforce.com, inc.
1590
+ * All rights reserved.
1591
+ * SPDX-License-Identifier: MIT
1592
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1593
+ */
1594
+ class ContextBinding {
1595
+ constructor(component) {
1596
+ this.component = component;
1597
+ }
1598
+ provideContext(contextVariety, providedContextSignal) {
1599
+ const contextVarieties = this.component[SYMBOL__CONTEXT_VARIETIES];
1600
+ if (contextVarieties.has(contextVariety)) {
1601
+ if (process.env.NODE_ENV !== 'production') {
1602
+ throw new Error('Multiple contexts of the same variety were provided.');
1603
+ }
1604
+ return;
1605
+ }
1606
+ contextVarieties.set(contextVariety, providedContextSignal);
1607
+ }
1608
+ consumeContext(contextVariety, contextProvidedCallback) {
1609
+ const contextfulStack = getContextfulStack(this.component);
1610
+ for (const ancestor of contextfulStack) {
1611
+ // If the ancestor has the specified context variety, consume it and stop searching
1612
+ const ancestorContextVarieties = ancestor[SYMBOL__CONTEXT_VARIETIES];
1613
+ if (ancestorContextVarieties.has(contextVariety)) {
1614
+ contextProvidedCallback(ancestorContextVarieties.get(contextVariety));
1615
+ break;
1616
+ }
1617
+ }
1618
+ }
1619
+ }
1620
+ function connectContext(le) {
1621
+ const contextKeys = getContextKeys();
1622
+ if (isUndefined$1(contextKeys)) {
1623
+ return;
1624
+ }
1625
+ const { connectContext } = contextKeys;
1626
+ const enumerableKeys = keys(le);
1627
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(le[enumerableKey]));
1628
+ if (contextfulKeys.length === 0) {
1629
+ return;
1630
+ }
1631
+ try {
1632
+ for (let i = 0; i < contextfulKeys.length; i++) {
1633
+ le[contextfulKeys[i]][connectContext](new ContextBinding(le));
1634
+ }
1635
+ }
1636
+ catch (err) {
1637
+ if (process.env.NODE_ENV !== 'production') {
1638
+ throw new Error(`Attempted to connect to trusted context but received the following error: ${err.message}`);
1639
+ }
1640
+ }
1641
+ }
1642
+
1643
+ /*
1644
+ * Copyright (c) 2024, salesforce.com, inc.
1645
+ * All rights reserved.
1646
+ * SPDX-License-Identifier: MIT
1647
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1648
+ */
1649
+ var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList, _a;
1358
1650
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
1359
1651
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
1360
1652
  const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
1653
+ const SYMBOL__CONTEXT_VARIETIES = Symbol('context-varieties');
1361
1654
  class LightningElement {
1362
1655
  constructor(propsAvailableAtConstruction) {
1363
1656
  this.isConnected = false;
1364
1657
  _LightningElement_props.set(this, void 0);
1365
1658
  _LightningElement_attrs.set(this, void 0);
1366
1659
  _LightningElement_classList.set(this, null);
1660
+ this[_a] = new Map();
1367
1661
  assign(this, propsAvailableAtConstruction);
1368
1662
  }
1369
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1663
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), _a = SYMBOL__CONTEXT_VARIETIES, SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1370
1664
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1371
1665
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1666
+ if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
1667
+ // Setup context before connected callback is executed
1668
+ connectContext(this);
1669
+ }
1372
1670
  // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1373
1671
  if (attrs.class) {
1374
1672
  this.className = attrs.class;
@@ -1580,6 +1878,15 @@ function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _
1580
1878
  }
1581
1879
  }
1582
1880
  }
1881
+ function addSlottedContent(name, fn, contentMap) {
1882
+ const contentList = contentMap[name];
1883
+ if (contentList) {
1884
+ contentList.push(fn);
1885
+ }
1886
+ else {
1887
+ contentMap[name] = [fn];
1888
+ }
1889
+ }
1583
1890
  class RenderContext {
1584
1891
  constructor(styleDedupe) {
1585
1892
  this.stylesheetToId = new WeakMap();
@@ -1824,70 +2131,16 @@ function* toIteratorDirective(iterable) {
1824
2131
  }
1825
2132
  }
1826
2133
 
1827
- /*
1828
- * Copyright (c) 2024, salesforce.com, inc.
1829
- * All rights reserved.
1830
- * SPDX-License-Identifier: MIT
1831
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1832
- */
1833
- const contextfulRelationships = new WeakMap();
1834
- function establishContextfulRelationship(parentLe, childLe) {
1835
- contextfulRelationships.set(childLe, parentLe);
1836
- }
1837
- function getContextfulStack(le) {
1838
- const contextfulParent = contextfulRelationships.get(le);
1839
- if (!contextfulParent) {
1840
- return [];
1841
- }
1842
- return [contextfulParent, ...getContextfulStack(contextfulParent)];
1843
- }
1844
- const contextProviders = new WeakMap();
1845
- function registerContextProvider(adapter, attachedLe, consumerCallback) {
1846
- let elementMap = contextProviders.get(adapter);
1847
- if (!elementMap) {
1848
- elementMap = new WeakMap();
1849
- contextProviders.set(adapter, elementMap);
1850
- }
1851
- elementMap.set(attachedLe, consumerCallback);
1852
- }
1853
- function connectContext(adapter, contextConsumer, onNewValue) {
1854
- const elementMap = contextProviders.get(adapter);
1855
- if (!elementMap) {
1856
- return;
1857
- }
1858
- const contextfulStack = getContextfulStack(contextConsumer);
1859
- for (const ancestor of contextfulStack) {
1860
- const onConsumerConnected = elementMap.get(ancestor);
1861
- if (onConsumerConnected) {
1862
- onConsumerConnected({
1863
- provide(newContextValue) {
1864
- onNewValue(newContextValue);
1865
- },
1866
- });
1867
- return;
1868
- }
1869
- }
1870
- }
1871
- function createContextProvider(adapter) {
1872
- return (le, options) => {
1873
- if (!(le instanceof LightningElement)) {
1874
- throw new Error('Unable to register context provider on provided `elm`.');
1875
- }
1876
- if (!le.isConnected || !options?.consumerConnectedCallback) {
1877
- return;
1878
- }
1879
- const { consumerConnectedCallback } = options;
1880
- registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1881
- };
1882
- }
1883
-
1884
2134
  exports.ClassList = ClassList;
1885
2135
  exports.LightningElement = LightningElement;
1886
2136
  exports.SYMBOL__DEFAULT_TEMPLATE = SYMBOL__DEFAULT_TEMPLATE;
1887
2137
  exports.SYMBOL__GENERATE_MARKUP = SYMBOL__GENERATE_MARKUP;
1888
2138
  exports.SYMBOL__SET_INTERNALS = SYMBOL__SET_INTERNALS;
2139
+ exports.SignalBaseClass = SignalBaseClass;
2140
+ exports.__dangerous_do_not_use_addTrustedContext = addTrustedContext;
2141
+ exports.addSlottedContent = addSlottedContent;
1889
2142
  exports.api = api;
1890
- exports.connectContext = connectContext;
2143
+ exports.connectContext = connectContext$1;
1891
2144
  exports.createContextProvider = createContextProvider;
1892
2145
  exports.createElement = createElement;
1893
2146
  exports.establishContextfulRelationship = establishContextfulRelationship;
@@ -1899,6 +2152,7 @@ exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
1899
2152
  exports.hot = hot;
1900
2153
  exports.htmlEscape = htmlEscape;
1901
2154
  exports.isComponentConstructor = isComponentConstructor;
2155
+ exports.isTrustedSignal = isTrustedSignal;
1902
2156
  exports.mutationTracker = mutationTracker;
1903
2157
  exports.normalizeClass = normalizeClass;
1904
2158
  exports.normalizeTabIndex = normalizeTabIndex;
@@ -1922,6 +2176,7 @@ exports.setFeatureFlag = setFeatureFlag;
1922
2176
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
1923
2177
  exports.setHooks = setHooks;
1924
2178
  exports.setTrustedContextSet = setTrustedContextSet;
2179
+ exports.setTrustedSignalSet = setTrustedSignalSet;
1925
2180
  exports.swapComponent = swapComponent;
1926
2181
  exports.swapStyle = swapStyle;
1927
2182
  exports.swapTemplate = swapTemplate;
@@ -1930,5 +2185,5 @@ exports.track = track;
1930
2185
  exports.unwrap = unwrap$1;
1931
2186
  exports.validateStyleTextContents = validateStyleTextContents;
1932
2187
  exports.wire = wire;
1933
- /** version: 8.19.1 */
2188
+ /** version: 8.20.1 */
1934
2189
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export * from './stubs';
2
- export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass, normalizeTabIndex, } from '@lwc/shared';
2
+ export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass, normalizeTabIndex, setContextKeys, setTrustedSignalSet, setTrustedContextSet, addTrustedContext as __dangerous_do_not_use_addTrustedContext, isTrustedSignal, } from '@lwc/shared';
3
+ export { SignalBaseClass } from '@lwc/signals';
4
+ export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
3
5
  export { ClassList } from './class-list';
4
6
  export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
5
7
  export { mutationTracker } from './mutation-tracker';
6
- export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupAsyncYield, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
8
+ export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupAsyncYield, renderAttrs, renderAttrsNoYield, addSlottedContent, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
7
9
  export { normalizeTextContent, renderTextContent } from './render-text-content';
8
10
  export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
9
11
  export { toIteratorDirective } from './to-iterator-directive';
package/dist/index.js CHANGED
@@ -42,12 +42,6 @@ function registerTemplate(..._) {
42
42
  function sanitizeAttribute(..._) {
43
43
  throw new Error('sanitizeAttribute cannot be used in SSR context.');
44
44
  }
45
- function setFeatureFlag(..._) {
46
- throw new Error('setFeatureFlag cannot be used in SSR context.');
47
- }
48
- function setFeatureFlagForTest(..._) {
49
- throw new Error('setFeatureFlagForTest cannot be used in SSR context.');
50
- }
51
45
  function swapComponent(..._) {
52
46
  throw new Error('swapComponent cannot be used in SSR context.');
53
47
  }
@@ -66,12 +60,6 @@ function unwrap$1(..._) {
66
60
  function wire(..._) {
67
61
  throw new Error('@wire cannot be used in SSR context.');
68
62
  }
69
- function setContextKeys(..._) {
70
- throw new Error('@setContextKeys cannot be used in SSR context.');
71
- }
72
- function setTrustedContextSet(..._) {
73
- throw new Error('setTrustedContextSet cannot be used in SSR context.');
74
- }
75
63
  const renderer = {
76
64
  isSyntheticShadowDefined: false,
77
65
  insert(..._) {
@@ -259,6 +247,8 @@ assign,
259
247
  create,
260
248
  /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
261
249
  defineProperties,
250
+ /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
251
+ defineProperty,
262
252
  /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
263
253
  entries,
264
254
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
@@ -273,7 +263,7 @@ isArray: isArray$1} = Array;
273
263
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
274
264
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
275
265
  // statement, rather than this declaration.
276
- const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
266
+ const { filter: ArrayFilter, join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
277
267
  } = Array.prototype;
278
268
  /** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
279
269
  const { fromCharCode: StringFromCharCode } = String;
@@ -295,6 +285,14 @@ function isUndefined$1(obj) {
295
285
  function isNull(obj) {
296
286
  return obj === null;
297
287
  }
288
+ /**
289
+ * Determines whether the argument is a boolean.
290
+ * @param obj Value to test
291
+ * @returns `true` if the value is a boolean.
292
+ */
293
+ function isBoolean(obj) {
294
+ return typeof obj === 'boolean';
295
+ }
298
296
  /**
299
297
  * Determines whether the argument is an object or null.
300
298
  * @param obj Value to test
@@ -440,6 +438,31 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
440
438
  function isAriaAttribute(attrName) {
441
439
  return attrName in AriaAttrNameToPropNameMap;
442
440
  }
441
+ let trustedContext;
442
+ let contextKeys;
443
+ function setContextKeys(config) {
444
+ isFalse$1(contextKeys, '`setContextKeys` cannot be called more than once');
445
+ contextKeys = config;
446
+ }
447
+ function getContextKeys() {
448
+ return contextKeys;
449
+ }
450
+ function setTrustedContextSet(context) {
451
+ isFalse$1(trustedContext, 'Trusted Context Set is already set!');
452
+ trustedContext = context;
453
+ }
454
+ function addTrustedContext(contextParticipant) {
455
+ // This should be a no-op when the trustedSignals set isn't set by runtime
456
+ trustedContext?.add(contextParticipant);
457
+ }
458
+ function isTrustedContext(target) {
459
+ if (!trustedContext) {
460
+ // The runtime didn't set a trustedContext set
461
+ // this check should only be performed for runtimes that care about filtering context participants to track
462
+ return true;
463
+ }
464
+ return trustedContext.has(target);
465
+ }
443
466
  // These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
444
467
  const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
445
468
  ['accessKey', 'accesskey'],
@@ -603,6 +626,27 @@ function setHooks(hooks) {
603
626
  sanitizeHtmlContent = hooks.sanitizeHtmlContent;
604
627
  }
605
628
 
629
+ /*
630
+ * Copyright (c) 2024, salesforce.com, inc.
631
+ * All rights reserved.
632
+ * SPDX-License-Identifier: MIT
633
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
634
+ */
635
+ let trustedSignals;
636
+ function setTrustedSignalSet(signals) {
637
+ isFalse$1(trustedSignals, 'Trusted Signal Set is already set!');
638
+ trustedSignals = signals;
639
+ }
640
+ function isTrustedSignal(target) {
641
+ if (!trustedSignals) {
642
+ // The runtime didn't set a trustedSignals set
643
+ // this check should only be performed for runtimes that care about filtering signals to track
644
+ // our default behavior should be to track all signals
645
+ return true;
646
+ }
647
+ return trustedSignals.has(target);
648
+ }
649
+
606
650
  /*
607
651
  * Copyright (c) 2024, Salesforce, Inc.
608
652
  * All rights reserved.
@@ -626,7 +670,143 @@ function normalizeTabIndex(value) {
626
670
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
627
671
  return shouldNormalize ? 0 : value;
628
672
  }
629
- /** version: 8.19.1 */
673
+ /** version: 8.20.1 */
674
+
675
+ /**
676
+ * Copyright (c) 2025 Salesforce, Inc.
677
+ */
678
+ /**
679
+ * Copyright (c) 2025 Salesforce, Inc.
680
+ */
681
+ /*
682
+ * Copyright (c) 2018, salesforce.com, inc.
683
+ * All rights reserved.
684
+ * SPDX-License-Identifier: MIT
685
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
686
+ */
687
+ /**
688
+ *
689
+ * @param value
690
+ * @param msg
691
+ */
692
+ /**
693
+ *
694
+ * @param value
695
+ * @param msg
696
+ */
697
+ /** version: 8.20.1 */
698
+
699
+ /*
700
+ * Copyright (c) 2023, salesforce.com, inc.
701
+ * All rights reserved.
702
+ * SPDX-License-Identifier: MIT
703
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
704
+ */
705
+ class SignalBaseClass {
706
+ constructor() {
707
+ this.subscribers = new Set();
708
+ }
709
+ subscribe(onUpdate) {
710
+ this.subscribers.add(onUpdate);
711
+ return () => {
712
+ this.subscribers.delete(onUpdate);
713
+ };
714
+ }
715
+ notify() {
716
+ for (const subscriber of this.subscribers) {
717
+ subscriber();
718
+ }
719
+ }
720
+ }
721
+ /** version: 8.20.1 */
722
+
723
+ /**
724
+ * Copyright (c) 2025 Salesforce, Inc.
725
+ */
726
+
727
+ /*
728
+ * Copyright (c) 2024, Salesforce, Inc.
729
+ * All rights reserved.
730
+ * SPDX-License-Identifier: MIT
731
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
732
+ */
733
+ // When deprecating a feature flag, ensure that it is also no longer set in the application. For
734
+ // example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
735
+ /** List of all feature flags available, with the default value `null`. */
736
+ const features = {
737
+ PLACEHOLDER_TEST_FLAG: null,
738
+ DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
739
+ ENABLE_WIRE_SYNC_EMIT: null,
740
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
741
+ ENABLE_FROZEN_TEMPLATE: null,
742
+ ENABLE_LEGACY_SCOPE_TOKENS: null,
743
+ ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
744
+ ENABLE_EXPERIMENTAL_SIGNALS: null,
745
+ DISABLE_SYNTHETIC_SHADOW: null,
746
+ DISABLE_SCOPE_TOKEN_VALIDATION: null,
747
+ LEGACY_LOCKER_ENABLED: null,
748
+ DISABLE_LEGACY_VALIDATION: null,
749
+ };
750
+ if (!globalThis.lwcRuntimeFlags) {
751
+ Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
752
+ }
753
+ /** Feature flags that have been set. */
754
+ const flags = globalThis.lwcRuntimeFlags;
755
+ /**
756
+ * Set the value at runtime of a given feature flag. This method only be invoked once per feature
757
+ * flag. It is meant to be used during the app initialization.
758
+ * @param name Name of the feature flag to set
759
+ * @param value Whether the feature flag should be enabled
760
+ * @throws Will throw if a non-boolean value is provided when running in production.
761
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
762
+ */
763
+ function setFeatureFlag(name, value) {
764
+ if (!isBoolean(value)) {
765
+ const message = `Failed to set the value "${value}" for the runtime feature flag "${name}". Runtime feature flags can only be set to a boolean value.`;
766
+ if (process.env.NODE_ENV !== 'production') {
767
+ throw new TypeError(message);
768
+ }
769
+ else {
770
+ // eslint-disable-next-line no-console
771
+ console.error(message);
772
+ return;
773
+ }
774
+ }
775
+ if (isUndefined$1(features[name])) {
776
+ // eslint-disable-next-line no-console
777
+ console.info(`Attempt to set a value on an unknown feature flag "${name}" resulted in a NOOP.`);
778
+ return;
779
+ }
780
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
781
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
782
+ // Allow the same flag to be set more than once outside of production to enable testing
783
+ flags[name] = value;
784
+ }
785
+ else {
786
+ // Disallow the same flag to be set more than once in production
787
+ const runtimeValue = flags[name];
788
+ if (!isUndefined$1(runtimeValue)) {
789
+ // eslint-disable-next-line no-console
790
+ console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
791
+ return;
792
+ }
793
+ defineProperty(flags, name, { value });
794
+ }
795
+ }
796
+ /**
797
+ * Set the value at runtime of a given feature flag. This method should only be used for testing
798
+ * purposes. It is a no-op when invoked in production mode.
799
+ * @param name Name of the feature flag to enable or disable
800
+ * @param value Whether the feature flag should be enabled
801
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
802
+ */
803
+ function setFeatureFlagForTest(name, value) {
804
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
805
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
806
+ setFeatureFlag(name, value);
807
+ }
808
+ }
809
+ /** version: 8.20.1 */
630
810
 
631
811
  /*
632
812
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1350,21 +1530,139 @@ function readonly(value) {
1350
1530
  * SPDX-License-Identifier: MIT
1351
1531
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1352
1532
  */
1353
- var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
1533
+ const contextfulRelationships = new WeakMap();
1534
+ function establishContextfulRelationship(parentLe, childLe) {
1535
+ contextfulRelationships.set(childLe, parentLe);
1536
+ }
1537
+ function getContextfulStack(le) {
1538
+ const contextfulParent = contextfulRelationships.get(le);
1539
+ if (!contextfulParent) {
1540
+ return [];
1541
+ }
1542
+ return [contextfulParent, ...getContextfulStack(contextfulParent)];
1543
+ }
1544
+ const contextProviders = new WeakMap();
1545
+ function registerContextProvider(adapter, attachedLe, consumerCallback) {
1546
+ let elementMap = contextProviders.get(adapter);
1547
+ if (!elementMap) {
1548
+ elementMap = new WeakMap();
1549
+ contextProviders.set(adapter, elementMap);
1550
+ }
1551
+ elementMap.set(attachedLe, consumerCallback);
1552
+ }
1553
+ function connectContext$1(adapter, contextConsumer, onNewValue) {
1554
+ const elementMap = contextProviders.get(adapter);
1555
+ if (!elementMap) {
1556
+ return;
1557
+ }
1558
+ const contextfulStack = getContextfulStack(contextConsumer);
1559
+ for (const ancestor of contextfulStack) {
1560
+ const onConsumerConnected = elementMap.get(ancestor);
1561
+ if (onConsumerConnected) {
1562
+ onConsumerConnected({
1563
+ provide(newContextValue) {
1564
+ onNewValue(newContextValue);
1565
+ },
1566
+ });
1567
+ return;
1568
+ }
1569
+ }
1570
+ }
1571
+ function createContextProvider(adapter) {
1572
+ return (le, options) => {
1573
+ if (!(le instanceof LightningElement)) {
1574
+ throw new Error('Unable to register context provider on provided `elm`.');
1575
+ }
1576
+ if (!le.isConnected || !options?.consumerConnectedCallback) {
1577
+ return;
1578
+ }
1579
+ const { consumerConnectedCallback } = options;
1580
+ registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1581
+ };
1582
+ }
1583
+
1584
+ /*
1585
+ * Copyright (c) 2024, salesforce.com, inc.
1586
+ * All rights reserved.
1587
+ * SPDX-License-Identifier: MIT
1588
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1589
+ */
1590
+ class ContextBinding {
1591
+ constructor(component) {
1592
+ this.component = component;
1593
+ }
1594
+ provideContext(contextVariety, providedContextSignal) {
1595
+ const contextVarieties = this.component[SYMBOL__CONTEXT_VARIETIES];
1596
+ if (contextVarieties.has(contextVariety)) {
1597
+ if (process.env.NODE_ENV !== 'production') {
1598
+ throw new Error('Multiple contexts of the same variety were provided.');
1599
+ }
1600
+ return;
1601
+ }
1602
+ contextVarieties.set(contextVariety, providedContextSignal);
1603
+ }
1604
+ consumeContext(contextVariety, contextProvidedCallback) {
1605
+ const contextfulStack = getContextfulStack(this.component);
1606
+ for (const ancestor of contextfulStack) {
1607
+ // If the ancestor has the specified context variety, consume it and stop searching
1608
+ const ancestorContextVarieties = ancestor[SYMBOL__CONTEXT_VARIETIES];
1609
+ if (ancestorContextVarieties.has(contextVariety)) {
1610
+ contextProvidedCallback(ancestorContextVarieties.get(contextVariety));
1611
+ break;
1612
+ }
1613
+ }
1614
+ }
1615
+ }
1616
+ function connectContext(le) {
1617
+ const contextKeys = getContextKeys();
1618
+ if (isUndefined$1(contextKeys)) {
1619
+ return;
1620
+ }
1621
+ const { connectContext } = contextKeys;
1622
+ const enumerableKeys = keys(le);
1623
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(le[enumerableKey]));
1624
+ if (contextfulKeys.length === 0) {
1625
+ return;
1626
+ }
1627
+ try {
1628
+ for (let i = 0; i < contextfulKeys.length; i++) {
1629
+ le[contextfulKeys[i]][connectContext](new ContextBinding(le));
1630
+ }
1631
+ }
1632
+ catch (err) {
1633
+ if (process.env.NODE_ENV !== 'production') {
1634
+ throw new Error(`Attempted to connect to trusted context but received the following error: ${err.message}`);
1635
+ }
1636
+ }
1637
+ }
1638
+
1639
+ /*
1640
+ * Copyright (c) 2024, salesforce.com, inc.
1641
+ * All rights reserved.
1642
+ * SPDX-License-Identifier: MIT
1643
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1644
+ */
1645
+ var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList, _a;
1354
1646
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
1355
1647
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
1356
1648
  const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
1649
+ const SYMBOL__CONTEXT_VARIETIES = Symbol('context-varieties');
1357
1650
  class LightningElement {
1358
1651
  constructor(propsAvailableAtConstruction) {
1359
1652
  this.isConnected = false;
1360
1653
  _LightningElement_props.set(this, void 0);
1361
1654
  _LightningElement_attrs.set(this, void 0);
1362
1655
  _LightningElement_classList.set(this, null);
1656
+ this[_a] = new Map();
1363
1657
  assign(this, propsAvailableAtConstruction);
1364
1658
  }
1365
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1659
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), _a = SYMBOL__CONTEXT_VARIETIES, SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1366
1660
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1367
1661
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1662
+ if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
1663
+ // Setup context before connected callback is executed
1664
+ connectContext(this);
1665
+ }
1368
1666
  // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1369
1667
  if (attrs.class) {
1370
1668
  this.className = attrs.class;
@@ -1576,6 +1874,15 @@ function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _
1576
1874
  }
1577
1875
  }
1578
1876
  }
1877
+ function addSlottedContent(name, fn, contentMap) {
1878
+ const contentList = contentMap[name];
1879
+ if (contentList) {
1880
+ contentList.push(fn);
1881
+ }
1882
+ else {
1883
+ contentMap[name] = [fn];
1884
+ }
1885
+ }
1579
1886
  class RenderContext {
1580
1887
  constructor(styleDedupe) {
1581
1888
  this.stylesheetToId = new WeakMap();
@@ -1820,63 +2127,6 @@ function* toIteratorDirective(iterable) {
1820
2127
  }
1821
2128
  }
1822
2129
 
1823
- /*
1824
- * Copyright (c) 2024, salesforce.com, inc.
1825
- * All rights reserved.
1826
- * SPDX-License-Identifier: MIT
1827
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1828
- */
1829
- const contextfulRelationships = new WeakMap();
1830
- function establishContextfulRelationship(parentLe, childLe) {
1831
- contextfulRelationships.set(childLe, parentLe);
1832
- }
1833
- function getContextfulStack(le) {
1834
- const contextfulParent = contextfulRelationships.get(le);
1835
- if (!contextfulParent) {
1836
- return [];
1837
- }
1838
- return [contextfulParent, ...getContextfulStack(contextfulParent)];
1839
- }
1840
- const contextProviders = new WeakMap();
1841
- function registerContextProvider(adapter, attachedLe, consumerCallback) {
1842
- let elementMap = contextProviders.get(adapter);
1843
- if (!elementMap) {
1844
- elementMap = new WeakMap();
1845
- contextProviders.set(adapter, elementMap);
1846
- }
1847
- elementMap.set(attachedLe, consumerCallback);
1848
- }
1849
- function connectContext(adapter, contextConsumer, onNewValue) {
1850
- const elementMap = contextProviders.get(adapter);
1851
- if (!elementMap) {
1852
- return;
1853
- }
1854
- const contextfulStack = getContextfulStack(contextConsumer);
1855
- for (const ancestor of contextfulStack) {
1856
- const onConsumerConnected = elementMap.get(ancestor);
1857
- if (onConsumerConnected) {
1858
- onConsumerConnected({
1859
- provide(newContextValue) {
1860
- onNewValue(newContextValue);
1861
- },
1862
- });
1863
- return;
1864
- }
1865
- }
1866
- }
1867
- function createContextProvider(adapter) {
1868
- return (le, options) => {
1869
- if (!(le instanceof LightningElement)) {
1870
- throw new Error('Unable to register context provider on provided `elm`.');
1871
- }
1872
- if (!le.isConnected || !options?.consumerConnectedCallback) {
1873
- return;
1874
- }
1875
- const { consumerConnectedCallback } = options;
1876
- registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1877
- };
1878
- }
1879
-
1880
- 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, setContextKeys, setFeatureFlag, setFeatureFlagForTest, setHooks, setTrustedContextSet, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1881
- /** version: 8.19.1 */
2130
+ export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, SignalBaseClass, addTrustedContext as __dangerous_do_not_use_addTrustedContext, addSlottedContent, api, connectContext$1 as connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, isTrustedSignal, mutationTracker, normalizeClass, normalizeTabIndex, normalizeTextContent, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderTextContent, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setContextKeys, setFeatureFlag, setFeatureFlagForTest, setHooks, setTrustedContextSet, setTrustedSignalSet, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
2131
+ /** version: 8.20.1 */
1882
2132
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,12 @@
1
1
  import { ClassList } from './class-list';
2
2
  import type { Attributes, Properties } from './types';
3
3
  import type { Stylesheets } from '@lwc/shared';
4
+ import type { Signal } from '@lwc/signals';
4
5
  type EventListenerOrEventListenerObject = unknown;
5
6
  type AddEventListenerOptions = unknown;
6
7
  type EventListenerOptions = unknown;
7
8
  type ShadowRoot = unknown;
9
+ type ContextVarieties = Map<unknown, Signal<unknown>>;
8
10
  export type LightningElementConstructor = typeof LightningElement;
9
11
  interface PropsAvailableAtConstruction {
10
12
  tagName: string;
@@ -12,6 +14,7 @@ interface PropsAvailableAtConstruction {
12
14
  export declare const SYMBOL__SET_INTERNALS: unique symbol;
13
15
  export declare const SYMBOL__GENERATE_MARKUP: unique symbol;
14
16
  export declare const SYMBOL__DEFAULT_TEMPLATE: unique symbol;
17
+ export declare const SYMBOL__CONTEXT_VARIETIES: unique symbol;
15
18
  export declare class LightningElement implements PropsAvailableAtConstruction {
16
19
  #private;
17
20
  static renderMode?: 'light' | 'shadow';
@@ -30,6 +33,7 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
30
33
  title: string;
31
34
  isConnected: boolean;
32
35
  tagName: string;
36
+ [SYMBOL__CONTEXT_VARIETIES]: ContextVarieties;
33
37
  constructor(propsAvailableAtConstruction: PropsAvailableAtConstruction & Properties);
34
38
  [SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes, publicProperties: Set<string>): void;
35
39
  get className(): any;
package/dist/render.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare function renderAttrs(instance: LightningElement, attrs: Attribute
48
48
  export declare function renderAttrsNoYield(emit: (segment: string) => void, instance: LightningElement, attrs: Attributes, hostScopeToken: string | undefined, scopeToken: string | undefined): void;
49
49
  export declare function fallbackTmpl(shadowSlottedContent: SlottedContentGenerator | null, _lightSlottedContent: SlottedContentGeneratorMap | null, _scopedSlottedContent: SlottedContentGeneratorMap | null, Cmp: LightningElementConstructor, instance: LightningElement): AsyncGenerator<string>;
50
50
  export declare function fallbackTmplNoYield(emit: Emit, shadowSlottedContent: SlottedContentEmitter | null, _lightSlottedContent: SlottedContentEmitterMap | null, _scopedSlottedContent: SlottedContentEmitterMap | null, Cmp: LightningElementConstructor, instance: LightningElement): void;
51
+ export declare function addSlottedContent(name: string, fn: unknown, contentMap: Record<string, unknown[]>): void;
51
52
  interface ComponentWithGenerateMarkup extends LightningElementConstructor {
52
53
  [SYMBOL__GENERATE_MARKUP]?: GenerateMarkupVariants;
53
54
  }
package/dist/stubs.d.ts CHANGED
@@ -9,16 +9,12 @@ export declare function registerComponent(..._: unknown[]): never;
9
9
  export declare function registerDecorators(..._: unknown[]): never;
10
10
  export declare function registerTemplate(..._: unknown[]): never;
11
11
  export declare function sanitizeAttribute(..._: unknown[]): never;
12
- export declare function setFeatureFlag(..._: unknown[]): never;
13
- export declare function setFeatureFlagForTest(..._: unknown[]): never;
14
12
  export declare function swapComponent(..._: unknown[]): never;
15
13
  export declare function swapStyle(..._: unknown[]): never;
16
14
  export declare function swapTemplate(..._: unknown[]): never;
17
15
  export declare function track(..._: unknown[]): never;
18
16
  export declare function unwrap(..._: unknown[]): never;
19
17
  export declare function wire(..._: unknown[]): never;
20
- export declare function setContextKeys(..._: unknown[]): never;
21
- export declare function setTrustedContextSet(..._: unknown[]): never;
22
18
  export declare const renderer: {
23
19
  isSyntheticShadowDefined: boolean;
24
20
  insert(..._: unknown[]): never;
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.19.1",
7
+ "version": "8.20.1",
8
8
  "description": "Runtime complement to @lwc/ssr-compiler",
9
9
  "keywords": [
10
10
  "lwc",
@@ -48,8 +48,10 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@lwc/shared": "8.19.1",
52
- "@lwc/engine-core": "8.19.1",
51
+ "@lwc/shared": "8.20.1",
52
+ "@lwc/engine-core": "8.20.1",
53
+ "@lwc/features": "8.20.1",
54
+ "@lwc/signals": "8.20.1",
53
55
  "observable-membrane": "2.0.0"
54
56
  }
55
57
  }