@lwc/shared 2.34.0 → 2.35.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.
package/dist/index.cjs.js CHANGED
@@ -46,7 +46,7 @@ const { assign, create, defineProperties, defineProperty, freeze, getOwnProperty
46
46
  const { isArray } = Array;
47
47
  const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
48
48
  const { fromCharCode: StringFromCharCode } = String;
49
- const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
49
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
50
50
  function isUndefined(obj) {
51
51
  return obj === undefined;
52
52
  }
@@ -186,6 +186,19 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
186
186
  function isAriaAttribute(attrName) {
187
187
  return attrName in AriaAttrNameToPropNameMap;
188
188
  }
189
+ // These attributes take either an ID or a list of IDs as values.
190
+ // This includes aria-* attributes as well as the special non-ARIA "for" attribute
191
+ const ID_REFERENCING_ATTRIBUTES_SET = new Set([
192
+ 'aria-activedescendant',
193
+ 'aria-controls',
194
+ 'aria-describedby',
195
+ 'aria-details',
196
+ 'aria-errormessage',
197
+ 'aria-flowto',
198
+ 'aria-labelledby',
199
+ 'aria-owns',
200
+ 'for',
201
+ ]);
189
202
 
190
203
  /*
191
204
  * Copyright (c) 2018, salesforce.com, inc.
@@ -193,41 +206,11 @@ function isAriaAttribute(attrName) {
193
206
  * SPDX-License-Identifier: MIT
194
207
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
195
208
  */
196
- // Inspired from: https://mathiasbynens.be/notes/globalthis
197
- const _globalThis = /*@__PURE__*/ (function () {
198
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
199
- if (typeof globalThis === 'object') {
200
- return globalThis;
201
- }
202
- let _globalThis;
203
- try {
204
- // eslint-disable-next-line no-extend-native
205
- Object.defineProperty(Object.prototype, '__magic__', {
206
- get: function () {
207
- return this;
208
- },
209
- configurable: true,
210
- });
211
- // __magic__ is undefined in Safari 10 and IE10 and older.
212
- // @ts-ignore
213
- // eslint-disable-next-line no-undef
214
- _globalThis = __magic__;
215
- // @ts-ignore
216
- delete Object.prototype.__magic__;
217
- }
218
- catch (ex) {
219
- // In IE8, Object.defineProperty only works on DOM objects.
220
- }
221
- finally {
222
- // If the magic above fails for some reason we assume that we are in a legacy browser.
223
- // Assume `window` exists in this case.
224
- if (typeof _globalThis === 'undefined') {
225
- // @ts-ignore
226
- _globalThis = window;
227
- }
228
- }
229
- return _globalThis;
230
- })();
209
+ // See browser support for globalThis:
210
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
211
+ /* istanbul ignore next */
212
+ // @ts-ignore
213
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
231
214
 
232
215
  /*
233
216
  * Copyright (c) 2018, salesforce.com, inc.
@@ -244,6 +227,8 @@ const KEY__SHADOW_TOKEN = '$shadowToken$';
244
227
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
245
228
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
246
229
  const KEY__SCOPED_CSS = '$scoped$';
230
+ const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
231
+ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
247
232
 
248
233
  /*
249
234
  * Copyright (c) 2022, salesforce.com, inc.
@@ -494,7 +479,7 @@ const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === '
494
479
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
495
480
  */
496
481
  // Increment whenever the LWC template compiler changes
497
- const LWC_VERSION = "2.34.0";
482
+ const LWC_VERSION = "2.35.1";
498
483
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
499
484
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
500
485
 
@@ -519,7 +504,10 @@ exports.ArraySort = ArraySort;
519
504
  exports.ArraySplice = ArraySplice;
520
505
  exports.ArrayUnshift = ArrayUnshift;
521
506
  exports.HTML_NAMESPACE = HTML_NAMESPACE;
507
+ exports.ID_REFERENCING_ATTRIBUTES_SET = ID_REFERENCING_ATTRIBUTES_SET;
522
508
  exports.KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = KEY__IS_NATIVE_SHADOW_ROOT_DEFINED;
509
+ exports.KEY__NATIVE_GET_ELEMENT_BY_ID = KEY__NATIVE_GET_ELEMENT_BY_ID;
510
+ exports.KEY__NATIVE_QUERY_SELECTOR_ALL = KEY__NATIVE_QUERY_SELECTOR_ALL;
523
511
  exports.KEY__SCOPED_CSS = KEY__SCOPED_CSS;
524
512
  exports.KEY__SHADOW_RESOLVER = KEY__SHADOW_RESOLVER;
525
513
  exports.KEY__SHADOW_RESOLVER_PRIVATE = KEY__SHADOW_RESOLVER_PRIVATE;
@@ -537,6 +525,7 @@ exports.StringCharCodeAt = StringCharCodeAt;
537
525
  exports.StringFromCharCode = StringFromCharCode;
538
526
  exports.StringReplace = StringReplace;
539
527
  exports.StringSlice = StringSlice;
528
+ exports.StringSplit = StringSplit;
540
529
  exports.StringToLowerCase = StringToLowerCase;
541
530
  exports.XLINK_NAMESPACE = XLINK_NAMESPACE;
542
531
  exports.XML_NAMESPACE = XML_NAMESPACE;
@@ -577,4 +566,4 @@ exports.noop = noop;
577
566
  exports.seal = seal;
578
567
  exports.setPrototypeOf = setPrototypeOf;
579
568
  exports.toString = toString;
580
- /** version: 2.34.0 */
569
+ /** version: 2.35.1 */
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ const { assign, create, defineProperties, defineProperty, freeze, getOwnProperty
44
44
  const { isArray } = Array;
45
45
  const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
46
46
  const { fromCharCode: StringFromCharCode } = String;
47
- const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
47
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
48
48
  function isUndefined(obj) {
49
49
  return obj === undefined;
50
50
  }
@@ -184,6 +184,19 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
184
184
  function isAriaAttribute(attrName) {
185
185
  return attrName in AriaAttrNameToPropNameMap;
186
186
  }
187
+ // These attributes take either an ID or a list of IDs as values.
188
+ // This includes aria-* attributes as well as the special non-ARIA "for" attribute
189
+ const ID_REFERENCING_ATTRIBUTES_SET = new Set([
190
+ 'aria-activedescendant',
191
+ 'aria-controls',
192
+ 'aria-describedby',
193
+ 'aria-details',
194
+ 'aria-errormessage',
195
+ 'aria-flowto',
196
+ 'aria-labelledby',
197
+ 'aria-owns',
198
+ 'for',
199
+ ]);
187
200
 
188
201
  /*
189
202
  * Copyright (c) 2018, salesforce.com, inc.
@@ -191,41 +204,11 @@ function isAriaAttribute(attrName) {
191
204
  * SPDX-License-Identifier: MIT
192
205
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
193
206
  */
194
- // Inspired from: https://mathiasbynens.be/notes/globalthis
195
- const _globalThis = /*@__PURE__*/ (function () {
196
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
197
- if (typeof globalThis === 'object') {
198
- return globalThis;
199
- }
200
- let _globalThis;
201
- try {
202
- // eslint-disable-next-line no-extend-native
203
- Object.defineProperty(Object.prototype, '__magic__', {
204
- get: function () {
205
- return this;
206
- },
207
- configurable: true,
208
- });
209
- // __magic__ is undefined in Safari 10 and IE10 and older.
210
- // @ts-ignore
211
- // eslint-disable-next-line no-undef
212
- _globalThis = __magic__;
213
- // @ts-ignore
214
- delete Object.prototype.__magic__;
215
- }
216
- catch (ex) {
217
- // In IE8, Object.defineProperty only works on DOM objects.
218
- }
219
- finally {
220
- // If the magic above fails for some reason we assume that we are in a legacy browser.
221
- // Assume `window` exists in this case.
222
- if (typeof _globalThis === 'undefined') {
223
- // @ts-ignore
224
- _globalThis = window;
225
- }
226
- }
227
- return _globalThis;
228
- })();
207
+ // See browser support for globalThis:
208
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
209
+ /* istanbul ignore next */
210
+ // @ts-ignore
211
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
229
212
 
230
213
  /*
231
214
  * Copyright (c) 2018, salesforce.com, inc.
@@ -242,6 +225,8 @@ const KEY__SHADOW_TOKEN = '$shadowToken$';
242
225
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
243
226
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
244
227
  const KEY__SCOPED_CSS = '$scoped$';
228
+ const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
229
+ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
245
230
 
246
231
  /*
247
232
  * Copyright (c) 2022, salesforce.com, inc.
@@ -492,9 +477,9 @@ const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === '
492
477
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
493
478
  */
494
479
  // Increment whenever the LWC template compiler changes
495
- const LWC_VERSION = "2.34.0";
480
+ const LWC_VERSION = "2.35.1";
496
481
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
497
482
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
498
483
 
499
- export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayFill, ArrayFilter, ArrayFind, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, HTML_NAMESPACE, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, 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, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringToLowerCase, XLINK_NAMESPACE, XML_NAMESPACE, assert, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, _globalThis as globalThis, hasNativeSymbolSupport, hasOwnProperty, htmlAttributeToProperty, htmlEscape, htmlPropertyToAttribute, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, keys, noop, seal, setPrototypeOf, toString };
500
- /** version: 2.34.0 */
484
+ export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayFill, ArrayFilter, ArrayFind, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, HTML_NAMESPACE, ID_REFERENCING_ATTRIBUTES_SET, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, KEY__NATIVE_GET_ELEMENT_BY_ID, 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, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringSplit, StringToLowerCase, XLINK_NAMESPACE, XML_NAMESPACE, assert, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, _globalThis as globalThis, hasNativeSymbolSupport, hasOwnProperty, htmlAttributeToProperty, htmlEscape, htmlPropertyToAttribute, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, keys, noop, seal, setPrototypeOf, toString };
485
+ /** version: 2.35.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/shared",
3
- "version": "2.34.0",
3
+ "version": "2.35.1",
4
4
  "description": "Utilities and methods that are shared across packages",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
package/types/aria.d.ts CHANGED
@@ -16,4 +16,5 @@ export type AccessibleElementProperties = {
16
16
  };
17
17
  declare const AriaAttrNameToPropNameMap: Record<string, string>, AriaPropNameToAttrNameMap: Record<string, string>;
18
18
  export declare function isAriaAttribute(attrName: string): boolean;
19
+ export declare const ID_REFERENCING_ATTRIBUTES_SET: Set<string>;
19
20
  export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
package/types/keys.d.ts CHANGED
@@ -7,3 +7,5 @@ export declare const KEY__SHADOW_TOKEN = "$shadowToken$";
7
7
  export declare const KEY__SHADOW_TOKEN_PRIVATE = "$$ShadowTokenKey$$";
8
8
  export declare const KEY__SYNTHETIC_MODE = "$$lwc-synthetic-mode";
9
9
  export declare const KEY__SCOPED_CSS = "$scoped$";
10
+ export declare const KEY__NATIVE_GET_ELEMENT_BY_ID = "$nativeGetElementById$";
11
+ export declare const KEY__NATIVE_QUERY_SELECTOR_ALL = "$nativeQuerySelectorAll$";
@@ -44,8 +44,13 @@ declare const StringCharCodeAt: (index: number) => number, StringReplace: {
44
44
  (searchValue: {
45
45
  [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
46
46
  }, replacer: (substring: string, ...args: any[]) => string): string;
47
+ }, StringSplit: {
48
+ (separator: string | RegExp, limit?: number | undefined): string[];
49
+ (splitter: {
50
+ [Symbol.split](string: string, limit?: number | undefined): string[];
51
+ }, limit?: number | undefined): string[];
47
52
  }, StringSlice: (start?: number | undefined, end?: number | undefined) => string, StringToLowerCase: () => string;
48
- export { ArrayConcat, ArrayFilter, ArrayFind, ArrayFill, ArrayIndexOf, ArrayCopyWithin, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isArray, isFrozen, keys, seal, setPrototypeOf, StringCharCodeAt, StringReplace, StringSlice, StringToLowerCase, StringFromCharCode, };
53
+ export { ArrayConcat, ArrayFilter, ArrayFind, ArrayFill, ArrayIndexOf, ArrayCopyWithin, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isArray, isFrozen, keys, seal, setPrototypeOf, StringCharCodeAt, StringReplace, StringSlice, StringSplit, StringToLowerCase, StringFromCharCode, };
49
54
  export declare function isUndefined(obj: any): obj is undefined;
50
55
  export declare function isNull(obj: any): obj is null;
51
56
  export declare function isTrue(obj: any): obj is true;