@lwc/ssr-runtime 8.20.0 → 8.20.2

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'],
@@ -591,20 +614,44 @@ function normalizeClass(value) {
591
614
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
592
615
  */
593
616
  let hooksAreSet = false;
617
+ let sanitizeHtmlContentImpl = () => {
618
+ // locker-service patches this function during runtime to sanitize HTML content.
619
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
620
+ };
594
621
  /**
595
622
  * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
596
623
  * libraries to sanitize HTML content. This hook process the content passed via the template to
597
624
  * lwc:inner-html directive.
598
625
  * It is meant to be overridden via `setHooks`; it throws an error by default.
599
626
  */
600
- exports.sanitizeHtmlContent = () => {
601
- // locker-service patches this function during runtime to sanitize HTML content.
602
- throw new Error('sanitizeHtmlContent hook must be implemented.');
627
+ const sanitizeHtmlContent = (value) => {
628
+ return sanitizeHtmlContentImpl(value);
603
629
  };
604
630
  function setHooks(hooks) {
605
631
  isFalse$1(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
606
632
  hooksAreSet = true;
607
- exports.sanitizeHtmlContent = hooks.sanitizeHtmlContent;
633
+ sanitizeHtmlContentImpl = hooks.sanitizeHtmlContent;
634
+ }
635
+
636
+ /*
637
+ * Copyright (c) 2024, salesforce.com, inc.
638
+ * All rights reserved.
639
+ * SPDX-License-Identifier: MIT
640
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
641
+ */
642
+ let trustedSignals;
643
+ function setTrustedSignalSet(signals) {
644
+ isFalse$1(trustedSignals, 'Trusted Signal Set is already set!');
645
+ trustedSignals = signals;
646
+ }
647
+ function isTrustedSignal(target) {
648
+ if (!trustedSignals) {
649
+ // The runtime didn't set a trustedSignals set
650
+ // this check should only be performed for runtimes that care about filtering signals to track
651
+ // our default behavior should be to track all signals
652
+ return true;
653
+ }
654
+ return trustedSignals.has(target);
608
655
  }
609
656
 
610
657
  /*
@@ -630,7 +677,143 @@ function normalizeTabIndex(value) {
630
677
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
631
678
  return shouldNormalize ? 0 : value;
632
679
  }
633
- /** version: 8.20.0 */
680
+ /** version: 8.20.2 */
681
+
682
+ /**
683
+ * Copyright (c) 2025 Salesforce, Inc.
684
+ */
685
+ /**
686
+ * Copyright (c) 2025 Salesforce, Inc.
687
+ */
688
+ /*
689
+ * Copyright (c) 2018, salesforce.com, inc.
690
+ * All rights reserved.
691
+ * SPDX-License-Identifier: MIT
692
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
693
+ */
694
+ /**
695
+ *
696
+ * @param value
697
+ * @param msg
698
+ */
699
+ /**
700
+ *
701
+ * @param value
702
+ * @param msg
703
+ */
704
+ /** version: 8.20.2 */
705
+
706
+ /*
707
+ * Copyright (c) 2023, salesforce.com, inc.
708
+ * All rights reserved.
709
+ * SPDX-License-Identifier: MIT
710
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
711
+ */
712
+ class SignalBaseClass {
713
+ constructor() {
714
+ this.subscribers = new Set();
715
+ }
716
+ subscribe(onUpdate) {
717
+ this.subscribers.add(onUpdate);
718
+ return () => {
719
+ this.subscribers.delete(onUpdate);
720
+ };
721
+ }
722
+ notify() {
723
+ for (const subscriber of this.subscribers) {
724
+ subscriber();
725
+ }
726
+ }
727
+ }
728
+ /** version: 8.20.2 */
729
+
730
+ /**
731
+ * Copyright (c) 2025 Salesforce, Inc.
732
+ */
733
+
734
+ /*
735
+ * Copyright (c) 2024, Salesforce, Inc.
736
+ * All rights reserved.
737
+ * SPDX-License-Identifier: MIT
738
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
739
+ */
740
+ // When deprecating a feature flag, ensure that it is also no longer set in the application. For
741
+ // example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
742
+ /** List of all feature flags available, with the default value `null`. */
743
+ const features = {
744
+ PLACEHOLDER_TEST_FLAG: null,
745
+ DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
746
+ ENABLE_WIRE_SYNC_EMIT: null,
747
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
748
+ ENABLE_FROZEN_TEMPLATE: null,
749
+ ENABLE_LEGACY_SCOPE_TOKENS: null,
750
+ ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
751
+ ENABLE_EXPERIMENTAL_SIGNALS: null,
752
+ DISABLE_SYNTHETIC_SHADOW: null,
753
+ DISABLE_SCOPE_TOKEN_VALIDATION: null,
754
+ LEGACY_LOCKER_ENABLED: null,
755
+ DISABLE_LEGACY_VALIDATION: null,
756
+ };
757
+ if (!globalThis.lwcRuntimeFlags) {
758
+ Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
759
+ }
760
+ /** Feature flags that have been set. */
761
+ const flags = globalThis.lwcRuntimeFlags;
762
+ /**
763
+ * Set the value at runtime of a given feature flag. This method only be invoked once per feature
764
+ * flag. It is meant to be used during the app initialization.
765
+ * @param name Name of the feature flag to set
766
+ * @param value Whether the feature flag should be enabled
767
+ * @throws Will throw if a non-boolean value is provided when running in production.
768
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
769
+ */
770
+ function setFeatureFlag(name, value) {
771
+ if (!isBoolean(value)) {
772
+ 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.`;
773
+ if (process.env.NODE_ENV !== 'production') {
774
+ throw new TypeError(message);
775
+ }
776
+ else {
777
+ // eslint-disable-next-line no-console
778
+ console.error(message);
779
+ return;
780
+ }
781
+ }
782
+ if (isUndefined$1(features[name])) {
783
+ // eslint-disable-next-line no-console
784
+ console.info(`Attempt to set a value on an unknown feature flag "${name}" resulted in a NOOP.`);
785
+ return;
786
+ }
787
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
788
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
789
+ // Allow the same flag to be set more than once outside of production to enable testing
790
+ flags[name] = value;
791
+ }
792
+ else {
793
+ // Disallow the same flag to be set more than once in production
794
+ const runtimeValue = flags[name];
795
+ if (!isUndefined$1(runtimeValue)) {
796
+ // eslint-disable-next-line no-console
797
+ console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
798
+ return;
799
+ }
800
+ defineProperty(flags, name, { value });
801
+ }
802
+ }
803
+ /**
804
+ * Set the value at runtime of a given feature flag. This method should only be used for testing
805
+ * purposes. It is a no-op when invoked in production mode.
806
+ * @param name Name of the feature flag to enable or disable
807
+ * @param value Whether the feature flag should be enabled
808
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
809
+ */
810
+ function setFeatureFlagForTest(name, value) {
811
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
812
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
813
+ setFeatureFlag(name, value);
814
+ }
815
+ }
816
+ /** version: 8.20.2 */
634
817
 
635
818
  /*
636
819
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1354,21 +1537,139 @@ function readonly(value) {
1354
1537
  * SPDX-License-Identifier: MIT
1355
1538
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1356
1539
  */
1357
- var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
1540
+ const contextfulRelationships = new WeakMap();
1541
+ function establishContextfulRelationship(parentLe, childLe) {
1542
+ contextfulRelationships.set(childLe, parentLe);
1543
+ }
1544
+ function getContextfulStack(le) {
1545
+ const contextfulParent = contextfulRelationships.get(le);
1546
+ if (!contextfulParent) {
1547
+ return [];
1548
+ }
1549
+ return [contextfulParent, ...getContextfulStack(contextfulParent)];
1550
+ }
1551
+ const contextProviders = new WeakMap();
1552
+ function registerContextProvider(adapter, attachedLe, consumerCallback) {
1553
+ let elementMap = contextProviders.get(adapter);
1554
+ if (!elementMap) {
1555
+ elementMap = new WeakMap();
1556
+ contextProviders.set(adapter, elementMap);
1557
+ }
1558
+ elementMap.set(attachedLe, consumerCallback);
1559
+ }
1560
+ function connectContext$1(adapter, contextConsumer, onNewValue) {
1561
+ const elementMap = contextProviders.get(adapter);
1562
+ if (!elementMap) {
1563
+ return;
1564
+ }
1565
+ const contextfulStack = getContextfulStack(contextConsumer);
1566
+ for (const ancestor of contextfulStack) {
1567
+ const onConsumerConnected = elementMap.get(ancestor);
1568
+ if (onConsumerConnected) {
1569
+ onConsumerConnected({
1570
+ provide(newContextValue) {
1571
+ onNewValue(newContextValue);
1572
+ },
1573
+ });
1574
+ return;
1575
+ }
1576
+ }
1577
+ }
1578
+ function createContextProvider(adapter) {
1579
+ return (le, options) => {
1580
+ if (!(le instanceof LightningElement)) {
1581
+ throw new Error('Unable to register context provider on provided `elm`.');
1582
+ }
1583
+ if (!le.isConnected || !options?.consumerConnectedCallback) {
1584
+ return;
1585
+ }
1586
+ const { consumerConnectedCallback } = options;
1587
+ registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1588
+ };
1589
+ }
1590
+
1591
+ /*
1592
+ * Copyright (c) 2024, salesforce.com, inc.
1593
+ * All rights reserved.
1594
+ * SPDX-License-Identifier: MIT
1595
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1596
+ */
1597
+ class ContextBinding {
1598
+ constructor(component) {
1599
+ this.component = component;
1600
+ }
1601
+ provideContext(contextVariety, providedContextSignal) {
1602
+ const contextVarieties = this.component[SYMBOL__CONTEXT_VARIETIES];
1603
+ if (contextVarieties.has(contextVariety)) {
1604
+ if (process.env.NODE_ENV !== 'production') {
1605
+ throw new Error('Multiple contexts of the same variety were provided.');
1606
+ }
1607
+ return;
1608
+ }
1609
+ contextVarieties.set(contextVariety, providedContextSignal);
1610
+ }
1611
+ consumeContext(contextVariety, contextProvidedCallback) {
1612
+ const contextfulStack = getContextfulStack(this.component);
1613
+ for (const ancestor of contextfulStack) {
1614
+ // If the ancestor has the specified context variety, consume it and stop searching
1615
+ const ancestorContextVarieties = ancestor[SYMBOL__CONTEXT_VARIETIES];
1616
+ if (ancestorContextVarieties.has(contextVariety)) {
1617
+ contextProvidedCallback(ancestorContextVarieties.get(contextVariety));
1618
+ break;
1619
+ }
1620
+ }
1621
+ }
1622
+ }
1623
+ function connectContext(le) {
1624
+ const contextKeys = getContextKeys();
1625
+ if (isUndefined$1(contextKeys)) {
1626
+ return;
1627
+ }
1628
+ const { connectContext } = contextKeys;
1629
+ const enumerableKeys = keys(le);
1630
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(le[enumerableKey]));
1631
+ if (contextfulKeys.length === 0) {
1632
+ return;
1633
+ }
1634
+ try {
1635
+ for (let i = 0; i < contextfulKeys.length; i++) {
1636
+ le[contextfulKeys[i]][connectContext](new ContextBinding(le));
1637
+ }
1638
+ }
1639
+ catch (err) {
1640
+ if (process.env.NODE_ENV !== 'production') {
1641
+ throw new Error(`Attempted to connect to trusted context but received the following error: ${err.message}`);
1642
+ }
1643
+ }
1644
+ }
1645
+
1646
+ /*
1647
+ * Copyright (c) 2024, salesforce.com, inc.
1648
+ * All rights reserved.
1649
+ * SPDX-License-Identifier: MIT
1650
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1651
+ */
1652
+ var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList, _a;
1358
1653
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
1359
1654
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
1360
1655
  const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
1656
+ const SYMBOL__CONTEXT_VARIETIES = Symbol('context-varieties');
1361
1657
  class LightningElement {
1362
1658
  constructor(propsAvailableAtConstruction) {
1363
1659
  this.isConnected = false;
1364
1660
  _LightningElement_props.set(this, void 0);
1365
1661
  _LightningElement_attrs.set(this, void 0);
1366
1662
  _LightningElement_classList.set(this, null);
1663
+ this[_a] = new Map();
1367
1664
  assign(this, propsAvailableAtConstruction);
1368
1665
  }
1369
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1666
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), _a = SYMBOL__CONTEXT_VARIETIES, SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1370
1667
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1371
1668
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1669
+ if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
1670
+ // Setup context before connected callback is executed
1671
+ connectContext(this);
1672
+ }
1372
1673
  // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1373
1674
  if (attrs.class) {
1374
1675
  this.className = attrs.class;
@@ -1833,71 +2134,16 @@ function* toIteratorDirective(iterable) {
1833
2134
  }
1834
2135
  }
1835
2136
 
1836
- /*
1837
- * Copyright (c) 2024, salesforce.com, inc.
1838
- * All rights reserved.
1839
- * SPDX-License-Identifier: MIT
1840
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1841
- */
1842
- const contextfulRelationships = new WeakMap();
1843
- function establishContextfulRelationship(parentLe, childLe) {
1844
- contextfulRelationships.set(childLe, parentLe);
1845
- }
1846
- function getContextfulStack(le) {
1847
- const contextfulParent = contextfulRelationships.get(le);
1848
- if (!contextfulParent) {
1849
- return [];
1850
- }
1851
- return [contextfulParent, ...getContextfulStack(contextfulParent)];
1852
- }
1853
- const contextProviders = new WeakMap();
1854
- function registerContextProvider(adapter, attachedLe, consumerCallback) {
1855
- let elementMap = contextProviders.get(adapter);
1856
- if (!elementMap) {
1857
- elementMap = new WeakMap();
1858
- contextProviders.set(adapter, elementMap);
1859
- }
1860
- elementMap.set(attachedLe, consumerCallback);
1861
- }
1862
- function connectContext(adapter, contextConsumer, onNewValue) {
1863
- const elementMap = contextProviders.get(adapter);
1864
- if (!elementMap) {
1865
- return;
1866
- }
1867
- const contextfulStack = getContextfulStack(contextConsumer);
1868
- for (const ancestor of contextfulStack) {
1869
- const onConsumerConnected = elementMap.get(ancestor);
1870
- if (onConsumerConnected) {
1871
- onConsumerConnected({
1872
- provide(newContextValue) {
1873
- onNewValue(newContextValue);
1874
- },
1875
- });
1876
- return;
1877
- }
1878
- }
1879
- }
1880
- function createContextProvider(adapter) {
1881
- return (le, options) => {
1882
- if (!(le instanceof LightningElement)) {
1883
- throw new Error('Unable to register context provider on provided `elm`.');
1884
- }
1885
- if (!le.isConnected || !options?.consumerConnectedCallback) {
1886
- return;
1887
- }
1888
- const { consumerConnectedCallback } = options;
1889
- registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1890
- };
1891
- }
1892
-
1893
2137
  exports.ClassList = ClassList;
1894
2138
  exports.LightningElement = LightningElement;
1895
2139
  exports.SYMBOL__DEFAULT_TEMPLATE = SYMBOL__DEFAULT_TEMPLATE;
1896
2140
  exports.SYMBOL__GENERATE_MARKUP = SYMBOL__GENERATE_MARKUP;
1897
2141
  exports.SYMBOL__SET_INTERNALS = SYMBOL__SET_INTERNALS;
2142
+ exports.SignalBaseClass = SignalBaseClass;
2143
+ exports.__dangerous_do_not_use_addTrustedContext = addTrustedContext;
1898
2144
  exports.addSlottedContent = addSlottedContent;
1899
2145
  exports.api = api;
1900
- exports.connectContext = connectContext;
2146
+ exports.connectContext = connectContext$1;
1901
2147
  exports.createContextProvider = createContextProvider;
1902
2148
  exports.createElement = createElement;
1903
2149
  exports.establishContextfulRelationship = establishContextfulRelationship;
@@ -1909,6 +2155,7 @@ exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
1909
2155
  exports.hot = hot;
1910
2156
  exports.htmlEscape = htmlEscape;
1911
2157
  exports.isComponentConstructor = isComponentConstructor;
2158
+ exports.isTrustedSignal = isTrustedSignal;
1912
2159
  exports.mutationTracker = mutationTracker;
1913
2160
  exports.normalizeClass = normalizeClass;
1914
2161
  exports.normalizeTabIndex = normalizeTabIndex;
@@ -1926,12 +2173,14 @@ exports.renderStylesheets = renderStylesheets;
1926
2173
  exports.renderTextContent = renderTextContent;
1927
2174
  exports.renderer = renderer;
1928
2175
  exports.sanitizeAttribute = sanitizeAttribute;
2176
+ exports.sanitizeHtmlContent = sanitizeHtmlContent;
1929
2177
  exports.serverSideRenderComponent = serverSideRenderComponent;
1930
2178
  exports.setContextKeys = setContextKeys;
1931
2179
  exports.setFeatureFlag = setFeatureFlag;
1932
2180
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
1933
2181
  exports.setHooks = setHooks;
1934
2182
  exports.setTrustedContextSet = setTrustedContextSet;
2183
+ exports.setTrustedSignalSet = setTrustedSignalSet;
1935
2184
  exports.swapComponent = swapComponent;
1936
2185
  exports.swapStyle = swapStyle;
1937
2186
  exports.swapTemplate = swapTemplate;
@@ -1940,5 +2189,5 @@ exports.track = track;
1940
2189
  exports.unwrap = unwrap$1;
1941
2190
  exports.validateStyleTextContents = validateStyleTextContents;
1942
2191
  exports.wire = wire;
1943
- /** version: 8.20.0 */
2192
+ /** version: 8.20.2 */
1944
2193
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
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';
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'],
@@ -587,20 +610,44 @@ function normalizeClass(value) {
587
610
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
588
611
  */
589
612
  let hooksAreSet = false;
613
+ let sanitizeHtmlContentImpl = () => {
614
+ // locker-service patches this function during runtime to sanitize HTML content.
615
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
616
+ };
590
617
  /**
591
618
  * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
592
619
  * libraries to sanitize HTML content. This hook process the content passed via the template to
593
620
  * lwc:inner-html directive.
594
621
  * It is meant to be overridden via `setHooks`; it throws an error by default.
595
622
  */
596
- let sanitizeHtmlContent = () => {
597
- // locker-service patches this function during runtime to sanitize HTML content.
598
- throw new Error('sanitizeHtmlContent hook must be implemented.');
623
+ const sanitizeHtmlContent = (value) => {
624
+ return sanitizeHtmlContentImpl(value);
599
625
  };
600
626
  function setHooks(hooks) {
601
627
  isFalse$1(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
602
628
  hooksAreSet = true;
603
- sanitizeHtmlContent = hooks.sanitizeHtmlContent;
629
+ sanitizeHtmlContentImpl = hooks.sanitizeHtmlContent;
630
+ }
631
+
632
+ /*
633
+ * Copyright (c) 2024, salesforce.com, inc.
634
+ * All rights reserved.
635
+ * SPDX-License-Identifier: MIT
636
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
637
+ */
638
+ let trustedSignals;
639
+ function setTrustedSignalSet(signals) {
640
+ isFalse$1(trustedSignals, 'Trusted Signal Set is already set!');
641
+ trustedSignals = signals;
642
+ }
643
+ function isTrustedSignal(target) {
644
+ if (!trustedSignals) {
645
+ // The runtime didn't set a trustedSignals set
646
+ // this check should only be performed for runtimes that care about filtering signals to track
647
+ // our default behavior should be to track all signals
648
+ return true;
649
+ }
650
+ return trustedSignals.has(target);
604
651
  }
605
652
 
606
653
  /*
@@ -626,7 +673,143 @@ function normalizeTabIndex(value) {
626
673
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
627
674
  return shouldNormalize ? 0 : value;
628
675
  }
629
- /** version: 8.20.0 */
676
+ /** version: 8.20.2 */
677
+
678
+ /**
679
+ * Copyright (c) 2025 Salesforce, Inc.
680
+ */
681
+ /**
682
+ * Copyright (c) 2025 Salesforce, Inc.
683
+ */
684
+ /*
685
+ * Copyright (c) 2018, salesforce.com, inc.
686
+ * All rights reserved.
687
+ * SPDX-License-Identifier: MIT
688
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
689
+ */
690
+ /**
691
+ *
692
+ * @param value
693
+ * @param msg
694
+ */
695
+ /**
696
+ *
697
+ * @param value
698
+ * @param msg
699
+ */
700
+ /** version: 8.20.2 */
701
+
702
+ /*
703
+ * Copyright (c) 2023, salesforce.com, inc.
704
+ * All rights reserved.
705
+ * SPDX-License-Identifier: MIT
706
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
707
+ */
708
+ class SignalBaseClass {
709
+ constructor() {
710
+ this.subscribers = new Set();
711
+ }
712
+ subscribe(onUpdate) {
713
+ this.subscribers.add(onUpdate);
714
+ return () => {
715
+ this.subscribers.delete(onUpdate);
716
+ };
717
+ }
718
+ notify() {
719
+ for (const subscriber of this.subscribers) {
720
+ subscriber();
721
+ }
722
+ }
723
+ }
724
+ /** version: 8.20.2 */
725
+
726
+ /**
727
+ * Copyright (c) 2025 Salesforce, Inc.
728
+ */
729
+
730
+ /*
731
+ * Copyright (c) 2024, Salesforce, Inc.
732
+ * All rights reserved.
733
+ * SPDX-License-Identifier: MIT
734
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
735
+ */
736
+ // When deprecating a feature flag, ensure that it is also no longer set in the application. For
737
+ // example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
738
+ /** List of all feature flags available, with the default value `null`. */
739
+ const features = {
740
+ PLACEHOLDER_TEST_FLAG: null,
741
+ DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
742
+ ENABLE_WIRE_SYNC_EMIT: null,
743
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
744
+ ENABLE_FROZEN_TEMPLATE: null,
745
+ ENABLE_LEGACY_SCOPE_TOKENS: null,
746
+ ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
747
+ ENABLE_EXPERIMENTAL_SIGNALS: null,
748
+ DISABLE_SYNTHETIC_SHADOW: null,
749
+ DISABLE_SCOPE_TOKEN_VALIDATION: null,
750
+ LEGACY_LOCKER_ENABLED: null,
751
+ DISABLE_LEGACY_VALIDATION: null,
752
+ };
753
+ if (!globalThis.lwcRuntimeFlags) {
754
+ Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
755
+ }
756
+ /** Feature flags that have been set. */
757
+ const flags = globalThis.lwcRuntimeFlags;
758
+ /**
759
+ * Set the value at runtime of a given feature flag. This method only be invoked once per feature
760
+ * flag. It is meant to be used during the app initialization.
761
+ * @param name Name of the feature flag to set
762
+ * @param value Whether the feature flag should be enabled
763
+ * @throws Will throw if a non-boolean value is provided when running in production.
764
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
765
+ */
766
+ function setFeatureFlag(name, value) {
767
+ if (!isBoolean(value)) {
768
+ 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.`;
769
+ if (process.env.NODE_ENV !== 'production') {
770
+ throw new TypeError(message);
771
+ }
772
+ else {
773
+ // eslint-disable-next-line no-console
774
+ console.error(message);
775
+ return;
776
+ }
777
+ }
778
+ if (isUndefined$1(features[name])) {
779
+ // eslint-disable-next-line no-console
780
+ console.info(`Attempt to set a value on an unknown feature flag "${name}" resulted in a NOOP.`);
781
+ return;
782
+ }
783
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
784
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
785
+ // Allow the same flag to be set more than once outside of production to enable testing
786
+ flags[name] = value;
787
+ }
788
+ else {
789
+ // Disallow the same flag to be set more than once in production
790
+ const runtimeValue = flags[name];
791
+ if (!isUndefined$1(runtimeValue)) {
792
+ // eslint-disable-next-line no-console
793
+ console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
794
+ return;
795
+ }
796
+ defineProperty(flags, name, { value });
797
+ }
798
+ }
799
+ /**
800
+ * Set the value at runtime of a given feature flag. This method should only be used for testing
801
+ * purposes. It is a no-op when invoked in production mode.
802
+ * @param name Name of the feature flag to enable or disable
803
+ * @param value Whether the feature flag should be enabled
804
+ * @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
805
+ */
806
+ function setFeatureFlagForTest(name, value) {
807
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
808
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
809
+ setFeatureFlag(name, value);
810
+ }
811
+ }
812
+ /** version: 8.20.2 */
630
813
 
631
814
  /*
632
815
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1350,21 +1533,139 @@ function readonly(value) {
1350
1533
  * SPDX-License-Identifier: MIT
1351
1534
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1352
1535
  */
1353
- var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
1536
+ const contextfulRelationships = new WeakMap();
1537
+ function establishContextfulRelationship(parentLe, childLe) {
1538
+ contextfulRelationships.set(childLe, parentLe);
1539
+ }
1540
+ function getContextfulStack(le) {
1541
+ const contextfulParent = contextfulRelationships.get(le);
1542
+ if (!contextfulParent) {
1543
+ return [];
1544
+ }
1545
+ return [contextfulParent, ...getContextfulStack(contextfulParent)];
1546
+ }
1547
+ const contextProviders = new WeakMap();
1548
+ function registerContextProvider(adapter, attachedLe, consumerCallback) {
1549
+ let elementMap = contextProviders.get(adapter);
1550
+ if (!elementMap) {
1551
+ elementMap = new WeakMap();
1552
+ contextProviders.set(adapter, elementMap);
1553
+ }
1554
+ elementMap.set(attachedLe, consumerCallback);
1555
+ }
1556
+ function connectContext$1(adapter, contextConsumer, onNewValue) {
1557
+ const elementMap = contextProviders.get(adapter);
1558
+ if (!elementMap) {
1559
+ return;
1560
+ }
1561
+ const contextfulStack = getContextfulStack(contextConsumer);
1562
+ for (const ancestor of contextfulStack) {
1563
+ const onConsumerConnected = elementMap.get(ancestor);
1564
+ if (onConsumerConnected) {
1565
+ onConsumerConnected({
1566
+ provide(newContextValue) {
1567
+ onNewValue(newContextValue);
1568
+ },
1569
+ });
1570
+ return;
1571
+ }
1572
+ }
1573
+ }
1574
+ function createContextProvider(adapter) {
1575
+ return (le, options) => {
1576
+ if (!(le instanceof LightningElement)) {
1577
+ throw new Error('Unable to register context provider on provided `elm`.');
1578
+ }
1579
+ if (!le.isConnected || !options?.consumerConnectedCallback) {
1580
+ return;
1581
+ }
1582
+ const { consumerConnectedCallback } = options;
1583
+ registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1584
+ };
1585
+ }
1586
+
1587
+ /*
1588
+ * Copyright (c) 2024, salesforce.com, inc.
1589
+ * All rights reserved.
1590
+ * SPDX-License-Identifier: MIT
1591
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1592
+ */
1593
+ class ContextBinding {
1594
+ constructor(component) {
1595
+ this.component = component;
1596
+ }
1597
+ provideContext(contextVariety, providedContextSignal) {
1598
+ const contextVarieties = this.component[SYMBOL__CONTEXT_VARIETIES];
1599
+ if (contextVarieties.has(contextVariety)) {
1600
+ if (process.env.NODE_ENV !== 'production') {
1601
+ throw new Error('Multiple contexts of the same variety were provided.');
1602
+ }
1603
+ return;
1604
+ }
1605
+ contextVarieties.set(contextVariety, providedContextSignal);
1606
+ }
1607
+ consumeContext(contextVariety, contextProvidedCallback) {
1608
+ const contextfulStack = getContextfulStack(this.component);
1609
+ for (const ancestor of contextfulStack) {
1610
+ // If the ancestor has the specified context variety, consume it and stop searching
1611
+ const ancestorContextVarieties = ancestor[SYMBOL__CONTEXT_VARIETIES];
1612
+ if (ancestorContextVarieties.has(contextVariety)) {
1613
+ contextProvidedCallback(ancestorContextVarieties.get(contextVariety));
1614
+ break;
1615
+ }
1616
+ }
1617
+ }
1618
+ }
1619
+ function connectContext(le) {
1620
+ const contextKeys = getContextKeys();
1621
+ if (isUndefined$1(contextKeys)) {
1622
+ return;
1623
+ }
1624
+ const { connectContext } = contextKeys;
1625
+ const enumerableKeys = keys(le);
1626
+ const contextfulKeys = ArrayFilter.call(enumerableKeys, (enumerableKey) => isTrustedContext(le[enumerableKey]));
1627
+ if (contextfulKeys.length === 0) {
1628
+ return;
1629
+ }
1630
+ try {
1631
+ for (let i = 0; i < contextfulKeys.length; i++) {
1632
+ le[contextfulKeys[i]][connectContext](new ContextBinding(le));
1633
+ }
1634
+ }
1635
+ catch (err) {
1636
+ if (process.env.NODE_ENV !== 'production') {
1637
+ throw new Error(`Attempted to connect to trusted context but received the following error: ${err.message}`);
1638
+ }
1639
+ }
1640
+ }
1641
+
1642
+ /*
1643
+ * Copyright (c) 2024, salesforce.com, inc.
1644
+ * All rights reserved.
1645
+ * SPDX-License-Identifier: MIT
1646
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1647
+ */
1648
+ var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList, _a;
1354
1649
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
1355
1650
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
1356
1651
  const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
1652
+ const SYMBOL__CONTEXT_VARIETIES = Symbol('context-varieties');
1357
1653
  class LightningElement {
1358
1654
  constructor(propsAvailableAtConstruction) {
1359
1655
  this.isConnected = false;
1360
1656
  _LightningElement_props.set(this, void 0);
1361
1657
  _LightningElement_attrs.set(this, void 0);
1362
1658
  _LightningElement_classList.set(this, null);
1659
+ this[_a] = new Map();
1363
1660
  assign(this, propsAvailableAtConstruction);
1364
1661
  }
1365
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1662
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), _a = SYMBOL__CONTEXT_VARIETIES, SYMBOL__SET_INTERNALS)](props, attrs, publicProperties) {
1366
1663
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1367
1664
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1665
+ if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
1666
+ // Setup context before connected callback is executed
1667
+ connectContext(this);
1668
+ }
1368
1669
  // Class should be set explicitly to avoid it being overridden by connectedCallback classList mutation.
1369
1670
  if (attrs.class) {
1370
1671
  this.className = attrs.class;
@@ -1829,63 +2130,6 @@ function* toIteratorDirective(iterable) {
1829
2130
  }
1830
2131
  }
1831
2132
 
1832
- /*
1833
- * Copyright (c) 2024, salesforce.com, inc.
1834
- * All rights reserved.
1835
- * SPDX-License-Identifier: MIT
1836
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1837
- */
1838
- const contextfulRelationships = new WeakMap();
1839
- function establishContextfulRelationship(parentLe, childLe) {
1840
- contextfulRelationships.set(childLe, parentLe);
1841
- }
1842
- function getContextfulStack(le) {
1843
- const contextfulParent = contextfulRelationships.get(le);
1844
- if (!contextfulParent) {
1845
- return [];
1846
- }
1847
- return [contextfulParent, ...getContextfulStack(contextfulParent)];
1848
- }
1849
- const contextProviders = new WeakMap();
1850
- function registerContextProvider(adapter, attachedLe, consumerCallback) {
1851
- let elementMap = contextProviders.get(adapter);
1852
- if (!elementMap) {
1853
- elementMap = new WeakMap();
1854
- contextProviders.set(adapter, elementMap);
1855
- }
1856
- elementMap.set(attachedLe, consumerCallback);
1857
- }
1858
- function connectContext(adapter, contextConsumer, onNewValue) {
1859
- const elementMap = contextProviders.get(adapter);
1860
- if (!elementMap) {
1861
- return;
1862
- }
1863
- const contextfulStack = getContextfulStack(contextConsumer);
1864
- for (const ancestor of contextfulStack) {
1865
- const onConsumerConnected = elementMap.get(ancestor);
1866
- if (onConsumerConnected) {
1867
- onConsumerConnected({
1868
- provide(newContextValue) {
1869
- onNewValue(newContextValue);
1870
- },
1871
- });
1872
- return;
1873
- }
1874
- }
1875
- }
1876
- function createContextProvider(adapter) {
1877
- return (le, options) => {
1878
- if (!(le instanceof LightningElement)) {
1879
- throw new Error('Unable to register context provider on provided `elm`.');
1880
- }
1881
- if (!le.isConnected || !options?.consumerConnectedCallback) {
1882
- return;
1883
- }
1884
- const { consumerConnectedCallback } = options;
1885
- registerContextProvider(adapter, le, (consumer) => consumerConnectedCallback(consumer));
1886
- };
1887
- }
1888
-
1889
- export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, addSlottedContent, 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 };
1890
- /** version: 8.20.0 */
2133
+ 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 };
2134
+ /** version: 8.20.2 */
1891
2135
  //# 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/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.20.0",
7
+ "version": "8.20.2",
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.20.0",
52
- "@lwc/engine-core": "8.20.0",
51
+ "@lwc/shared": "8.20.2",
52
+ "@lwc/engine-core": "8.20.2",
53
+ "@lwc/features": "8.20.2",
54
+ "@lwc/signals": "8.20.2",
53
55
  "observable-membrane": "2.0.0"
54
56
  }
55
57
  }