@lwc/shared 8.19.0 → 8.19.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,17 @@
1
+ export declare const ContextEventName = "lightning:context-request";
2
+ export type ContextKeys = {
3
+ connectContext: symbol;
4
+ disconnectContext: symbol;
5
+ };
6
+ export type ContextProvidedCallback = (contextSignal?: object) => void;
7
+ export interface ContextBinding<C extends object> {
8
+ component: C;
9
+ provideContext<V extends object>(contextVariety: V, providedContextSignal: object): void;
10
+ consumeContext<V extends object>(contextVariety: V, contextProvidedCallback: ContextProvidedCallback): void;
11
+ }
12
+ export declare function setContextKeys(config: ContextKeys): void;
13
+ export declare function getContextKeys(): ContextKeys;
14
+ export declare function setTrustedContextSet(context: WeakSet<object>): void;
15
+ export declare function addTrustedContext(contextParticipant: object): void;
16
+ export declare function isTrustedContext(target: object): boolean;
17
+ //# sourceMappingURL=context.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -439,6 +439,39 @@ const ID_REFERENCING_ATTRIBUTES_SET = /*@__PURE__*/ new Set([
439
439
  'popovertarget',
440
440
  ]);
441
441
 
442
+ /*
443
+ * Copyright (c) 2024, salesforce.com, inc.
444
+ * All rights reserved.
445
+ * SPDX-License-Identifier: MIT
446
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
447
+ */
448
+ const ContextEventName = 'lightning:context-request';
449
+ let trustedContext;
450
+ let contextKeys;
451
+ function setContextKeys(config) {
452
+ isFalse$1(contextKeys, '`setContextKeys` cannot be called more than once');
453
+ contextKeys = config;
454
+ }
455
+ function getContextKeys() {
456
+ return contextKeys;
457
+ }
458
+ function setTrustedContextSet(context) {
459
+ isFalse$1(trustedContext, 'Trusted Context Set is already set!');
460
+ trustedContext = context;
461
+ }
462
+ function addTrustedContext(contextParticipant) {
463
+ // This should be a no-op when the trustedSignals set isn't set by runtime
464
+ trustedContext?.add(contextParticipant);
465
+ }
466
+ function isTrustedContext(target) {
467
+ if (!trustedContext) {
468
+ // The runtime didn't set a trustedContext set
469
+ // this check should only be performed for runtimes that care about filtering context participants to track
470
+ return true;
471
+ }
472
+ return trustedContext.has(target);
473
+ }
474
+
442
475
  /*
443
476
  * Copyright (c) 2023, Salesforce.com, inc.
444
477
  * All rights reserved.
@@ -738,7 +771,7 @@ function htmlEscape(str, attrMode = false) {
738
771
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
739
772
  */
740
773
  // Increment whenever the LWC template compiler changes
741
- const LWC_VERSION = "8.19.0";
774
+ const LWC_VERSION = "8.19.1";
742
775
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
743
776
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
744
777
 
@@ -960,6 +993,7 @@ exports.ArraySome = ArraySome;
960
993
  exports.ArraySort = ArraySort;
961
994
  exports.ArraySplice = ArraySplice;
962
995
  exports.ArrayUnshift = ArrayUnshift;
996
+ exports.ContextEventName = ContextEventName;
963
997
  exports.DEFAULT_SSR_MODE = DEFAULT_SSR_MODE;
964
998
  exports.DISALLOWED_PROP_SET = DISALLOWED_PROP_SET;
965
999
  exports.HIGHEST_API_VERSION = HIGHEST_API_VERSION;
@@ -997,6 +1031,7 @@ exports.StringToLowerCase = StringToLowerCase;
997
1031
  exports.StringTrim = StringTrim;
998
1032
  exports.XLINK_NAMESPACE = XLINK_NAMESPACE;
999
1033
  exports.XML_NAMESPACE = XML_NAMESPACE;
1034
+ exports.addTrustedContext = addTrustedContext;
1000
1035
  exports.addTrustedSignal = addTrustedSignal;
1001
1036
  exports.arrayEvery = arrayEvery;
1002
1037
  exports.assert = assert;
@@ -1011,6 +1046,7 @@ exports.freeze = freeze;
1011
1046
  exports.fromEntries = fromEntries;
1012
1047
  exports.generateCustomElementTagName = generateCustomElementTagName;
1013
1048
  exports.getAPIVersionFromNumber = getAPIVersionFromNumber;
1049
+ exports.getContextKeys = getContextKeys;
1014
1050
  exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor;
1015
1051
  exports.getOwnPropertyDescriptors = getOwnPropertyDescriptors;
1016
1052
  exports.getOwnPropertyNames = getOwnPropertyNames;
@@ -1034,6 +1070,7 @@ exports.isNumber = isNumber;
1034
1070
  exports.isObject = isObject;
1035
1071
  exports.isString = isString;
1036
1072
  exports.isTrue = isTrue;
1073
+ exports.isTrustedContext = isTrustedContext;
1037
1074
  exports.isTrustedSignal = isTrustedSignal;
1038
1075
  exports.isUndefined = isUndefined;
1039
1076
  exports.isVoidElement = isVoidElement;
@@ -1045,9 +1082,11 @@ exports.normalizeStyleAttributeValue = normalizeStyleAttributeValue;
1045
1082
  exports.normalizeTabIndex = normalizeTabIndex;
1046
1083
  exports.parseStyleText = parseStyleText;
1047
1084
  exports.seal = seal;
1085
+ exports.setContextKeys = setContextKeys;
1048
1086
  exports.setHooks = setHooks;
1049
1087
  exports.setPrototypeOf = setPrototypeOf;
1088
+ exports.setTrustedContextSet = setTrustedContextSet;
1050
1089
  exports.setTrustedSignalSet = setTrustedSignalSet;
1051
1090
  exports.toString = toString;
1052
- /** version: 8.19.0 */
1091
+ /** version: 8.19.1 */
1053
1092
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as assert from './assert';
2
2
  export * from './api-version';
3
3
  export * from './aria';
4
+ export * from './context';
4
5
  export * from './language';
5
6
  export * from './keys';
6
7
  export * from './void-elements';
package/dist/index.js CHANGED
@@ -435,6 +435,39 @@ const ID_REFERENCING_ATTRIBUTES_SET = /*@__PURE__*/ new Set([
435
435
  'popovertarget',
436
436
  ]);
437
437
 
438
+ /*
439
+ * Copyright (c) 2024, salesforce.com, inc.
440
+ * All rights reserved.
441
+ * SPDX-License-Identifier: MIT
442
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
443
+ */
444
+ const ContextEventName = 'lightning:context-request';
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
+ }
470
+
438
471
  /*
439
472
  * Copyright (c) 2023, Salesforce.com, inc.
440
473
  * All rights reserved.
@@ -734,7 +767,7 @@ function htmlEscape(str, attrMode = false) {
734
767
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
735
768
  */
736
769
  // Increment whenever the LWC template compiler changes
737
- const LWC_VERSION = "8.19.0";
770
+ const LWC_VERSION = "8.19.1";
738
771
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
739
772
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
740
773
 
@@ -931,6 +964,6 @@ function normalizeTabIndex(value) {
931
964
  return shouldNormalize ? 0 : value;
932
965
  }
933
966
 
934
- export { AMBIGUOUS_PROP_SET, AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayEvery, ArrayFill, ArrayFilter, ArrayFind, ArrayFindIndex, ArrayFrom, ArrayIncludes, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, DEFAULT_SSR_MODE, DISALLOWED_PROP_SET, HIGHEST_API_VERSION, HTML_NAMESPACE, ID_REFERENCING_ATTRIBUTES_SET, IMPORTANT_FLAG, KEY__LEGACY_SHADOW_TOKEN, KEY__LEGACY_SHADOW_TOKEN_PRIVATE, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_ONLY_CSS, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SCOPED_CSS, KEY__SHADOW_RESOLVER, KEY__SHADOW_RESOLVER_PRIVATE, KEY__SHADOW_STATIC, KEY__SHADOW_STATIC_PRIVATE, KEY__SHADOW_TOKEN, KEY__SHADOW_TOKEN_PRIVATE, KEY__SYNTHETIC_MODE, LOWEST_API_VERSION, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, REFLECTIVE_GLOBAL_PROPERTY_SET, SPECIAL_PROPERTY_ATTRIBUTE_MAPPING, SVG_NAMESPACE, StringCharAt, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringSplit, StringToLowerCase, StringTrim, XLINK_NAMESPACE, XML_NAMESPACE, addTrustedSignal, arrayEvery, assert, assign, create, defineProperties, defineProperty, entries, flattenStylesheets, forEach, freeze, fromEntries, generateCustomElementTagName, getAPIVersionFromNumber, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getOwnPropertySymbols, getPropertyDescriptor, getPrototypeOf, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAPIFeatureEnabled, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isTrustedSignal, isUndefined, isVoidElement, kebabCaseToCamelCase, keys, noop, normalizeClass, normalizeStyleAttributeValue, normalizeTabIndex, parseStyleText, sanitizeHtmlContent, seal, setHooks, setPrototypeOf, setTrustedSignalSet, toString };
935
- /** version: 8.19.0 */
967
+ export { AMBIGUOUS_PROP_SET, AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayEvery, ArrayFill, ArrayFilter, ArrayFind, ArrayFindIndex, ArrayFrom, ArrayIncludes, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, ContextEventName, DEFAULT_SSR_MODE, DISALLOWED_PROP_SET, HIGHEST_API_VERSION, HTML_NAMESPACE, ID_REFERENCING_ATTRIBUTES_SET, IMPORTANT_FLAG, KEY__LEGACY_SHADOW_TOKEN, KEY__LEGACY_SHADOW_TOKEN_PRIVATE, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_ONLY_CSS, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SCOPED_CSS, KEY__SHADOW_RESOLVER, KEY__SHADOW_RESOLVER_PRIVATE, KEY__SHADOW_STATIC, KEY__SHADOW_STATIC_PRIVATE, KEY__SHADOW_TOKEN, KEY__SHADOW_TOKEN_PRIVATE, KEY__SYNTHETIC_MODE, LOWEST_API_VERSION, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, REFLECTIVE_GLOBAL_PROPERTY_SET, SPECIAL_PROPERTY_ATTRIBUTE_MAPPING, SVG_NAMESPACE, StringCharAt, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringSplit, StringToLowerCase, StringTrim, XLINK_NAMESPACE, XML_NAMESPACE, addTrustedContext, addTrustedSignal, arrayEvery, assert, assign, create, defineProperties, defineProperty, entries, flattenStylesheets, forEach, freeze, fromEntries, generateCustomElementTagName, getAPIVersionFromNumber, getContextKeys, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getOwnPropertySymbols, getPropertyDescriptor, getPrototypeOf, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAPIFeatureEnabled, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isTrustedContext, isTrustedSignal, isUndefined, isVoidElement, kebabCaseToCamelCase, keys, noop, normalizeClass, normalizeStyleAttributeValue, normalizeTabIndex, parseStyleText, sanitizeHtmlContent, seal, setContextKeys, setHooks, setPrototypeOf, setTrustedContextSet, setTrustedSignalSet, toString };
968
+ /** version: 8.19.1 */
936
969
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/shared",
7
- "version": "8.19.0",
7
+ "version": "8.19.1",
8
8
  "description": "Utilities and methods that are shared across packages",
9
9
  "keywords": [
10
10
  "lwc"