@lwc/shared
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -9,2 +9,6 @@ export declare const enum APIVersion { | ||
export declare const HIGHEST_API_VERSION = APIVersion.V61_250_SUMMER_24; | ||
/** | ||
* | ||
* @param version | ||
*/ | ||
export declare function getAPIVersionFromNumber(version: number | undefined): APIVersion; | ||
@@ -51,2 +55,7 @@ export declare const enum APIFeature { | ||
} | ||
/** | ||
* | ||
* @param apiVersionFeature | ||
* @param apiVersion | ||
*/ | ||
export declare function isAPIFeatureEnabled(apiVersionFeature: APIFeature, apiVersion: APIVersion): boolean; |
@@ -18,4 +18,8 @@ /** | ||
declare const AriaAttrNameToPropNameMap: Record<string, string>, AriaPropNameToAttrNameMap: Record<string, string>; | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
export declare function isAriaAttribute(attrName: string): boolean; | ||
export declare const ID_REFERENCING_ATTRIBUTES_SET: Set<string>; | ||
export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap }; |
@@ -0,4 +1,23 @@ | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
export declare function invariant(value: any, msg: string): asserts value; | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
export declare function isTrue(value: any, msg: string): asserts value; | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
export declare function isFalse(value: any, msg: string): void; | ||
/** | ||
* | ||
* @param msg | ||
*/ | ||
export declare function fail(msg: string): never; |
@@ -0,4 +1,21 @@ | ||
/** | ||
* | ||
* @param attrName | ||
* @param tagName | ||
*/ | ||
export declare function isBooleanAttribute(attrName: string, tagName: string): boolean; | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
export declare function isGlobalHtmlAttribute(attrName: string): boolean; | ||
/** | ||
* | ||
* @param propName | ||
*/ | ||
export declare function htmlPropertyToAttribute(propName: string): string; | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
export declare function kebabCaseToCamelCase(attrName: string): string; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* | ||
* @param str | ||
* @param attrMode | ||
*/ | ||
export declare function htmlEscape(str: string, attrMode?: boolean): string; |
@@ -14,2 +14,7 @@ /** | ||
*/ | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function invariant(value, msg) { | ||
@@ -20,2 +25,7 @@ if (!value) { | ||
} | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function isTrue$1(value, msg) { | ||
@@ -26,2 +36,7 @@ if (!value) { | ||
} | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function isFalse$1(value, msg) { | ||
@@ -32,2 +47,6 @@ if (value) { | ||
} | ||
/** | ||
* | ||
* @param msg | ||
*/ | ||
function fail(msg) { | ||
@@ -46,3 +65,3 @@ throw new Error(msg); | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -52,5 +71,40 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
const { assign, create, defineProperties, defineProperty, entries, freeze, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isFrozen, keys, seal, setPrototypeOf, } = Object; | ||
const { | ||
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */ | ||
assign, | ||
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */ | ||
create, | ||
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */ | ||
defineProperties, | ||
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */ | ||
defineProperty, | ||
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */ | ||
entries, | ||
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */ | ||
freeze, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */ | ||
getOwnPropertyDescriptor, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */ | ||
getOwnPropertyDescriptors, | ||
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */ | ||
getOwnPropertyNames, | ||
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */ | ||
getPrototypeOf, | ||
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */ | ||
hasOwnProperty, | ||
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */ | ||
isFrozen, | ||
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */ | ||
keys, | ||
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */ | ||
seal, | ||
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */ | ||
setPrototypeOf, } = Object; | ||
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */ | ||
const { isArray } = Array; | ||
const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, 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; | ||
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even | ||
// though it works fine for one, e.g. isArray), so comments for these are added to the export | ||
// statement, rather than this declaration. | ||
const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, 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, // Weird anomaly! | ||
} = Array.prototype; | ||
// The type of the return value of Array.prototype.every is `this is T[]`. However, once this | ||
@@ -62,22 +116,61 @@ // Array method is pulled out of the prototype, the function is now referencing `this` where | ||
// of Array.prototype methods used elsewhere in the codebase. | ||
/** | ||
* Wrapper for {@linkcode Array.prototype.every} that correctly preserves the type predicate in the | ||
* return value; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every MDN Reference}. | ||
* @param arr Array to test. | ||
* @param predicate A function to execute for each element of the array. | ||
* @returns Whether all elements in the array pass the test provided by the predicate. | ||
*/ | ||
function arrayEvery(arr, predicate) { | ||
return ArrayEvery.call(arr, predicate); | ||
} | ||
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */ | ||
const { fromCharCode: StringFromCharCode } = String; | ||
// No JSDocs here - see comment for Array.prototype | ||
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype; | ||
/** | ||
* Determines whether the argument is `undefined`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `undefined`. | ||
*/ | ||
function isUndefined(obj) { | ||
return obj === undefined; | ||
} | ||
/** | ||
* Determines whether the argument is `null`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `null`. | ||
*/ | ||
function isNull(obj) { | ||
return obj === null; | ||
} | ||
/** | ||
* Determines whether the argument is `true`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `true`. | ||
*/ | ||
function isTrue(obj) { | ||
return obj === true; | ||
} | ||
/** | ||
* Determines whether the argument is `false`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `false`. | ||
*/ | ||
function isFalse(obj) { | ||
return obj === false; | ||
} | ||
/** | ||
* Determines whether the argument is a boolean. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a boolean. | ||
*/ | ||
function isBoolean(obj) { | ||
return typeof obj === 'boolean'; | ||
} | ||
/** | ||
* Determines whether the argument is a function. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a function. | ||
*/ | ||
// Replacing `Function` with a narrower type that works for all our use cases is tricky... | ||
@@ -88,11 +181,27 @@ // eslint-disable-next-line @typescript-eslint/ban-types | ||
} | ||
/** | ||
* Determines whether the argument is an object or null. | ||
* @param obj Value to test | ||
* @returns `true` if the value is an object or null. | ||
*/ | ||
function isObject(obj) { | ||
return typeof obj === 'object'; | ||
} | ||
/** | ||
* Determines whether the argument is a string. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a string. | ||
*/ | ||
function isString(obj) { | ||
return typeof obj === 'string'; | ||
} | ||
/** | ||
* Determines whether the argument is a number. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a number. | ||
*/ | ||
function isNumber(obj) { | ||
return typeof obj === 'number'; | ||
} | ||
/** Does nothing! 🚀 */ | ||
function noop() { | ||
@@ -102,4 +211,10 @@ /* Do nothing */ | ||
const OtS = {}.toString; | ||
/** | ||
* Converts the argument to a string, safely accounting for objects with "null" prototype. | ||
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`. | ||
* @param obj Value to convert to a string. | ||
* @returns String representation of the value. | ||
*/ | ||
function toString(obj) { | ||
if (obj && obj.toString) { | ||
if (obj?.toString) { | ||
// Arrays might hold objects with "null" prototype So using | ||
@@ -109,2 +224,12 @@ // Array.prototype.toString directly will cause an error Iterate through | ||
if (isArray(obj)) { | ||
// This behavior is slightly different from Array#toString: | ||
// 1. Array#toString calls `this.join`, rather than Array#join | ||
// Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === '' | ||
// 2. Array#toString delegates to Object#toString if `this.join` is not a function | ||
// Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = '' | ||
// 3. Array#toString converts null/undefined to '' | ||
// Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined' | ||
// 4. Array#toString converts recursive references to arrays to '' | ||
// Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws | ||
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString | ||
return ArrayJoin.call(ArrayMap.call(obj, toString), ','); | ||
@@ -115,8 +240,16 @@ } | ||
else if (typeof obj === 'object') { | ||
// This catches null and returns "[object Null]". Weird, but kept for backwards compatibility. | ||
return OtS.call(obj); | ||
} | ||
else { | ||
return obj + ''; | ||
return String(obj); | ||
} | ||
} | ||
/** | ||
* Gets the property descriptor for the given object and property key. Similar to | ||
* {@linkcode Object.getOwnPropertyDescriptor}, but looks up the prototype chain. | ||
* @param o Value to get the property descriptor for | ||
* @param p Property key to get the descriptor for | ||
* @returns The property descriptor for the given object and property key. | ||
*/ | ||
function getPropertyDescriptor(o, p) { | ||
@@ -150,2 +283,6 @@ do { | ||
const allVersionsSet = /*@__PURE__@*/ new Set(allVersions); | ||
/** | ||
* | ||
* @param version | ||
*/ | ||
function getAPIVersionFromNumber(version) { | ||
@@ -173,2 +310,7 @@ if (!isNumber(version)) { | ||
} | ||
/** | ||
* | ||
* @param apiVersionFeature | ||
* @param apiVersion | ||
*/ | ||
function isAPIFeatureEnabled(apiVersionFeature, apiVersion) { | ||
@@ -273,2 +415,6 @@ switch (apiVersionFeature) { | ||
})(); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function isAriaAttribute(attrName) { | ||
@@ -353,2 +499,7 @@ return attrName in AriaAttrNameToPropNameMap; | ||
const VOID_ELEMENTS_SET = /*@__PURE__*/ new Set([...VOID_ELEMENTS, ...DEPRECATED_VOID_ELEMENTS]); | ||
/** | ||
* | ||
* @param name | ||
* @param namespace | ||
*/ | ||
function isVoidElement(name, namespace) { | ||
@@ -399,2 +550,7 @@ return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase()); | ||
]); | ||
/** | ||
* | ||
* @param attrName | ||
* @param tagName | ||
*/ | ||
function isBooleanAttribute(attrName, tagName) { | ||
@@ -436,2 +592,6 @@ const allowedTagNames = BOOLEAN_ATTRIBUTES.get(attrName); | ||
]); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function isGlobalHtmlAttribute(attrName) { | ||
@@ -463,2 +623,6 @@ return GLOBAL_ATTRIBUTE.has(attrName); | ||
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map(); | ||
/** | ||
* | ||
* @param propName | ||
*/ | ||
function htmlPropertyToAttribute(propName) { | ||
@@ -496,2 +660,6 @@ const ariaAttributeName = AriaPropNameToAttrNameMap[propName]; | ||
const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/ new Map(); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function kebabCaseToCamelCase(attrName) { | ||
@@ -519,2 +687,7 @@ let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName); | ||
}; | ||
/** | ||
* | ||
* @param str | ||
* @param attrMode | ||
*/ | ||
function htmlEscape(str, attrMode = false) { | ||
@@ -532,3 +705,3 @@ const searchValue = attrMode ? /["&]/g : /["'<>&]/g; | ||
// Increment whenever the LWC template compiler changes | ||
const LWC_VERSION = "6.2.0"; | ||
const LWC_VERSION = "6.2.1"; | ||
const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`; | ||
@@ -541,2 +714,3 @@ const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/; | ||
exports.ArrayCopyWithin = ArrayCopyWithin; | ||
exports.ArrayEvery = ArrayEvery; | ||
exports.ArrayFill = ArrayFill; | ||
@@ -629,3 +803,3 @@ exports.ArrayFilter = ArrayFilter; | ||
exports.toString = toString; | ||
/** version: 6.2.0 */ | ||
/** version: 6.2.1 */ | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -10,2 +10,7 @@ /** | ||
*/ | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function invariant(value, msg) { | ||
@@ -16,2 +21,7 @@ if (!value) { | ||
} | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function isTrue$1(value, msg) { | ||
@@ -22,2 +32,7 @@ if (!value) { | ||
} | ||
/** | ||
* | ||
* @param value | ||
* @param msg | ||
*/ | ||
function isFalse$1(value, msg) { | ||
@@ -28,2 +43,6 @@ if (value) { | ||
} | ||
/** | ||
* | ||
* @param msg | ||
*/ | ||
function fail(msg) { | ||
@@ -42,3 +61,3 @@ throw new Error(msg); | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -48,5 +67,40 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
const { assign, create, defineProperties, defineProperty, entries, freeze, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isFrozen, keys, seal, setPrototypeOf, } = Object; | ||
const { | ||
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */ | ||
assign, | ||
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */ | ||
create, | ||
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */ | ||
defineProperties, | ||
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */ | ||
defineProperty, | ||
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */ | ||
entries, | ||
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */ | ||
freeze, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */ | ||
getOwnPropertyDescriptor, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */ | ||
getOwnPropertyDescriptors, | ||
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */ | ||
getOwnPropertyNames, | ||
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */ | ||
getPrototypeOf, | ||
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */ | ||
hasOwnProperty, | ||
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */ | ||
isFrozen, | ||
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */ | ||
keys, | ||
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */ | ||
seal, | ||
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */ | ||
setPrototypeOf, } = Object; | ||
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */ | ||
const { isArray } = Array; | ||
const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, 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; | ||
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even | ||
// though it works fine for one, e.g. isArray), so comments for these are added to the export | ||
// statement, rather than this declaration. | ||
const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, 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, // Weird anomaly! | ||
} = Array.prototype; | ||
// The type of the return value of Array.prototype.every is `this is T[]`. However, once this | ||
@@ -58,22 +112,61 @@ // Array method is pulled out of the prototype, the function is now referencing `this` where | ||
// of Array.prototype methods used elsewhere in the codebase. | ||
/** | ||
* Wrapper for {@linkcode Array.prototype.every} that correctly preserves the type predicate in the | ||
* return value; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every MDN Reference}. | ||
* @param arr Array to test. | ||
* @param predicate A function to execute for each element of the array. | ||
* @returns Whether all elements in the array pass the test provided by the predicate. | ||
*/ | ||
function arrayEvery(arr, predicate) { | ||
return ArrayEvery.call(arr, predicate); | ||
} | ||
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */ | ||
const { fromCharCode: StringFromCharCode } = String; | ||
// No JSDocs here - see comment for Array.prototype | ||
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype; | ||
/** | ||
* Determines whether the argument is `undefined`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `undefined`. | ||
*/ | ||
function isUndefined(obj) { | ||
return obj === undefined; | ||
} | ||
/** | ||
* Determines whether the argument is `null`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `null`. | ||
*/ | ||
function isNull(obj) { | ||
return obj === null; | ||
} | ||
/** | ||
* Determines whether the argument is `true`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `true`. | ||
*/ | ||
function isTrue(obj) { | ||
return obj === true; | ||
} | ||
/** | ||
* Determines whether the argument is `false`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `false`. | ||
*/ | ||
function isFalse(obj) { | ||
return obj === false; | ||
} | ||
/** | ||
* Determines whether the argument is a boolean. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a boolean. | ||
*/ | ||
function isBoolean(obj) { | ||
return typeof obj === 'boolean'; | ||
} | ||
/** | ||
* Determines whether the argument is a function. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a function. | ||
*/ | ||
// Replacing `Function` with a narrower type that works for all our use cases is tricky... | ||
@@ -84,11 +177,27 @@ // eslint-disable-next-line @typescript-eslint/ban-types | ||
} | ||
/** | ||
* Determines whether the argument is an object or null. | ||
* @param obj Value to test | ||
* @returns `true` if the value is an object or null. | ||
*/ | ||
function isObject(obj) { | ||
return typeof obj === 'object'; | ||
} | ||
/** | ||
* Determines whether the argument is a string. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a string. | ||
*/ | ||
function isString(obj) { | ||
return typeof obj === 'string'; | ||
} | ||
/** | ||
* Determines whether the argument is a number. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a number. | ||
*/ | ||
function isNumber(obj) { | ||
return typeof obj === 'number'; | ||
} | ||
/** Does nothing! 🚀 */ | ||
function noop() { | ||
@@ -98,4 +207,10 @@ /* Do nothing */ | ||
const OtS = {}.toString; | ||
/** | ||
* Converts the argument to a string, safely accounting for objects with "null" prototype. | ||
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`. | ||
* @param obj Value to convert to a string. | ||
* @returns String representation of the value. | ||
*/ | ||
function toString(obj) { | ||
if (obj && obj.toString) { | ||
if (obj?.toString) { | ||
// Arrays might hold objects with "null" prototype So using | ||
@@ -105,2 +220,12 @@ // Array.prototype.toString directly will cause an error Iterate through | ||
if (isArray(obj)) { | ||
// This behavior is slightly different from Array#toString: | ||
// 1. Array#toString calls `this.join`, rather than Array#join | ||
// Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === '' | ||
// 2. Array#toString delegates to Object#toString if `this.join` is not a function | ||
// Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = '' | ||
// 3. Array#toString converts null/undefined to '' | ||
// Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined' | ||
// 4. Array#toString converts recursive references to arrays to '' | ||
// Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws | ||
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString | ||
return ArrayJoin.call(ArrayMap.call(obj, toString), ','); | ||
@@ -111,8 +236,16 @@ } | ||
else if (typeof obj === 'object') { | ||
// This catches null and returns "[object Null]". Weird, but kept for backwards compatibility. | ||
return OtS.call(obj); | ||
} | ||
else { | ||
return obj + ''; | ||
return String(obj); | ||
} | ||
} | ||
/** | ||
* Gets the property descriptor for the given object and property key. Similar to | ||
* {@linkcode Object.getOwnPropertyDescriptor}, but looks up the prototype chain. | ||
* @param o Value to get the property descriptor for | ||
* @param p Property key to get the descriptor for | ||
* @returns The property descriptor for the given object and property key. | ||
*/ | ||
function getPropertyDescriptor(o, p) { | ||
@@ -146,2 +279,6 @@ do { | ||
const allVersionsSet = /*@__PURE__@*/ new Set(allVersions); | ||
/** | ||
* | ||
* @param version | ||
*/ | ||
function getAPIVersionFromNumber(version) { | ||
@@ -169,2 +306,7 @@ if (!isNumber(version)) { | ||
} | ||
/** | ||
* | ||
* @param apiVersionFeature | ||
* @param apiVersion | ||
*/ | ||
function isAPIFeatureEnabled(apiVersionFeature, apiVersion) { | ||
@@ -269,2 +411,6 @@ switch (apiVersionFeature) { | ||
})(); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function isAriaAttribute(attrName) { | ||
@@ -349,2 +495,7 @@ return attrName in AriaAttrNameToPropNameMap; | ||
const VOID_ELEMENTS_SET = /*@__PURE__*/ new Set([...VOID_ELEMENTS, ...DEPRECATED_VOID_ELEMENTS]); | ||
/** | ||
* | ||
* @param name | ||
* @param namespace | ||
*/ | ||
function isVoidElement(name, namespace) { | ||
@@ -395,2 +546,7 @@ return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase()); | ||
]); | ||
/** | ||
* | ||
* @param attrName | ||
* @param tagName | ||
*/ | ||
function isBooleanAttribute(attrName, tagName) { | ||
@@ -432,2 +588,6 @@ const allowedTagNames = BOOLEAN_ATTRIBUTES.get(attrName); | ||
]); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function isGlobalHtmlAttribute(attrName) { | ||
@@ -459,2 +619,6 @@ return GLOBAL_ATTRIBUTE.has(attrName); | ||
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map(); | ||
/** | ||
* | ||
* @param propName | ||
*/ | ||
function htmlPropertyToAttribute(propName) { | ||
@@ -492,2 +656,6 @@ const ariaAttributeName = AriaPropNameToAttrNameMap[propName]; | ||
const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/ new Map(); | ||
/** | ||
* | ||
* @param attrName | ||
*/ | ||
function kebabCaseToCamelCase(attrName) { | ||
@@ -515,2 +683,7 @@ let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName); | ||
}; | ||
/** | ||
* | ||
* @param str | ||
* @param attrMode | ||
*/ | ||
function htmlEscape(str, attrMode = false) { | ||
@@ -528,8 +701,8 @@ const searchValue = attrMode ? /["&]/g : /["'<>&]/g; | ||
// Increment whenever the LWC template compiler changes | ||
const LWC_VERSION = "6.2.0"; | ||
const LWC_VERSION = "6.2.1"; | ||
const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`; | ||
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/; | ||
export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayFill, ArrayFilter, ArrayFind, ArrayFindIndex, ArrayIncludes, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, HIGHEST_API_VERSION, HTML_NAMESPACE, ID_REFERENCING_ATTRIBUTES_SET, KEY__LEGACY_SHADOW_TOKEN, KEY__LEGACY_SHADOW_TOKEN_PRIVATE, 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, LOWEST_API_VERSION, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringSplit, StringToLowerCase, XLINK_NAMESPACE, XML_NAMESPACE, arrayEvery, assert, assign, create, defineProperties, defineProperty, entries, forEach, freeze, getAPIVersionFromNumber, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAPIFeatureEnabled, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, kebabCaseToCamelCase, keys, noop, seal, setPrototypeOf, toString }; | ||
/** version: 6.2.0 */ | ||
export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayConcat, ArrayCopyWithin, ArrayEvery, ArrayFill, ArrayFilter, ArrayFind, ArrayFindIndex, ArrayIncludes, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, HIGHEST_API_VERSION, HTML_NAMESPACE, ID_REFERENCING_ATTRIBUTES_SET, KEY__LEGACY_SHADOW_TOKEN, KEY__LEGACY_SHADOW_TOKEN_PRIVATE, 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, LOWEST_API_VERSION, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringSplit, StringToLowerCase, XLINK_NAMESPACE, XML_NAMESPACE, arrayEvery, assert, assign, create, defineProperties, defineProperty, entries, forEach, freeze, getAPIVersionFromNumber, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAPIFeatureEnabled, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, kebabCaseToCamelCase, keys, noop, seal, setPrototypeOf, toString }; | ||
/** version: 6.2.1 */ | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,4 @@ | ||
declare const assign: { | ||
declare const | ||
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */ | ||
assign: { | ||
<T extends {}, U>(target: T, source: U): T & U; | ||
@@ -6,6 +8,14 @@ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V; | ||
(target: object, ...sources: any[]): any; | ||
}, create: { | ||
}, | ||
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */ | ||
create: { | ||
(o: object | null): any; | ||
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; | ||
}, defineProperties: <T>(o: T, properties: PropertyDescriptorMap & ThisType<any>) => T, defineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T, entries: { | ||
}, | ||
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */ | ||
defineProperties: <T>(o: T, properties: PropertyDescriptorMap & ThisType<any>) => T, | ||
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */ | ||
defineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T, | ||
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */ | ||
entries: { | ||
<T>(o: { | ||
@@ -15,3 +25,5 @@ [s: string]: T; | ||
(o: {}): [string, any][]; | ||
}, freeze: { | ||
}, | ||
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */ | ||
freeze: { | ||
<T extends Function>(f: T): T; | ||
@@ -22,8 +34,27 @@ <T_1 extends { | ||
<T_2>(o: T_2): Readonly<T_2>; | ||
}, getOwnPropertyDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined, getOwnPropertyDescriptors: <T>(o: T) => { [P in keyof T]: TypedPropertyDescriptor<T[P]>; } & { | ||
}, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */ | ||
getOwnPropertyDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined, | ||
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */ | ||
getOwnPropertyDescriptors: <T>(o: T) => { [P in keyof T]: TypedPropertyDescriptor<T[P]>; } & { | ||
[x: string]: PropertyDescriptor; | ||
}, getOwnPropertyNames: (o: any) => string[], getPrototypeOf: (o: any) => any, hasOwnProperty: (v: PropertyKey) => boolean, isFrozen: (o: any) => boolean, keys: { | ||
}, | ||
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */ | ||
getOwnPropertyNames: (o: any) => string[], | ||
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */ | ||
getPrototypeOf: (o: any) => any, | ||
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */ | ||
hasOwnProperty: (v: PropertyKey) => boolean, | ||
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */ | ||
isFrozen: (o: any) => boolean, | ||
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */ | ||
keys: { | ||
(o: object): string[]; | ||
(o: {}): string[]; | ||
}, seal: <T>(o: T) => T, setPrototypeOf: (o: any, proto: object | null) => any; | ||
}, | ||
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */ | ||
seal: <T>(o: T) => T, | ||
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */ | ||
setPrototypeOf: (o: any, proto: object | null) => any; | ||
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */ | ||
declare const isArray: (arg: any) => arg is any[]; | ||
@@ -33,3 +64,6 @@ declare const ArrayConcat: { | ||
(...items: any[]): any[]; | ||
}, ArrayCopyWithin: (target: number, start: number, end?: number | undefined) => any[], ArrayFill: (value: any, start?: number | undefined, end?: number | undefined) => any[], ArrayFilter: { | ||
}, ArrayCopyWithin: (target: number, start: number, end?: number | undefined) => any[], ArrayEvery: { | ||
<S extends any>(predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): this is S[]; | ||
(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean; | ||
}, ArrayFill: (value: any, start?: number | undefined, end?: number | undefined) => any[], ArrayFilter: { | ||
<S extends any>(predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; | ||
@@ -48,3 +82,11 @@ (predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; | ||
}, ArrayUnshift: (...items: any[]) => number, forEach: (callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any) => void; | ||
declare function arrayEvery<T>(arr: any[], predicate: (value: any, index: number, array: typeof arr) => value is T): arr is T[]; | ||
/** | ||
* Wrapper for {@linkcode Array.prototype.every} that correctly preserves the type predicate in the | ||
* return value; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every MDN Reference}. | ||
* @param arr Array to test. | ||
* @param predicate A function to execute for each element of the array. | ||
* @returns Whether all elements in the array pass the test provided by the predicate. | ||
*/ | ||
declare function arrayEvery<T>(arr: unknown[], predicate: (value: any, index: number, array: typeof arr) => value is T): arr is T[]; | ||
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */ | ||
declare const StringFromCharCode: (...codes: number[]) => string; | ||
@@ -66,14 +108,131 @@ declare const StringCharCodeAt: (index: number) => number, StringReplace: { | ||
}, StringSlice: (start?: number | undefined, end?: number | undefined) => string, StringToLowerCase: () => string; | ||
export { ArrayConcat, ArrayFilter, ArrayFind, ArrayFindIndex, ArrayFill, ArrayIncludes, ArrayIndexOf, ArrayCopyWithin, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySome, ArraySort, ArraySplice, ArrayUnshift, arrayEvery, assign, create, defineProperties, defineProperty, entries, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isArray, isFrozen, keys, seal, setPrototypeOf, StringCharCodeAt, StringReplace, StringSlice, StringSplit, StringToLowerCase, StringFromCharCode, }; | ||
export declare function isUndefined(obj: any): obj is undefined; | ||
export declare function isNull(obj: any): obj is null; | ||
export declare function isTrue(obj: any): obj is true; | ||
export declare function isFalse(obj: any): obj is false; | ||
export declare function isBoolean(obj: any): obj is boolean; | ||
export declare function isFunction(obj: any): obj is Function; | ||
export declare function isObject(obj: any): obj is object; | ||
export declare function isString(obj: any): obj is string; | ||
export declare function isNumber(obj: any): obj is number; | ||
export { | ||
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */ | ||
isArray, | ||
/** Unbound {@linkcode Array.prototype.concat}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat MDN Reference}. */ | ||
ArrayConcat, | ||
/** Unbound {@linkcode Array.prototype.copyWithin}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin MDN Reference}. */ | ||
ArrayCopyWithin, | ||
/** Unbound {@linkcode Array.prototype.every}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every MDN Reference}. */ | ||
ArrayEvery, | ||
/** Unbound {@linkcode Array.prototype.fill}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill MDN Reference}. */ | ||
ArrayFill, | ||
/** Unbound {@linkcode Array.prototype.filter}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter MDN Reference}. */ | ||
ArrayFilter, | ||
/** Unbound {@linkcode Array.prototype.find}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find MDN Reference}. */ | ||
ArrayFind, | ||
/** Unbound {@linkcode Array.prototype.findIndex}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex MDN Reference}. */ | ||
ArrayFindIndex, | ||
/** Unbound {@linkcode Array.prototype.includes}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes MDN Reference}. */ | ||
ArrayIncludes, | ||
/** Unbound {@linkcode Array.prototype.indexOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf MDN Reference}. */ | ||
ArrayIndexOf, | ||
/** Unbound {@linkcode Array.prototype.join}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join MDN Reference}. */ | ||
ArrayJoin, | ||
/** Unbound {@linkcode Array.prototype.map}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map MDN Reference}. */ | ||
ArrayMap, | ||
/** Unbound {@linkcode Array.prototype.pop}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop MDN Reference}. */ | ||
ArrayPop, | ||
/** Unbound {@linkcode Array.prototype.push}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push MDN Reference}. */ | ||
ArrayPush, | ||
/** Unbound {@linkcode Array.prototype.reduce}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce MDN Reference}. */ | ||
ArrayReduce, | ||
/** Unbound {@linkcode Array.prototype.reverse}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse MDN Reference}. */ | ||
ArrayReverse, | ||
/** Unbound {@linkcode Array.prototype.shift}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift MDN Reference}. */ | ||
ArrayShift, | ||
/** Unbound {@linkcode Array.prototype.slice}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice MDN Reference}. */ | ||
ArraySlice, | ||
/** Unbound {@linkcode Array.prototype.some}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some MDN Reference}. */ | ||
ArraySome, | ||
/** Unbound {@linkcode Array.prototype.sort}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort MDN Reference}. */ | ||
ArraySort, | ||
/** Unbound {@linkcode Array.prototype.splice}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice MDN Reference}. */ | ||
ArraySplice, | ||
/** Unbound {@linkcode Array.prototype.unshift}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift MDN Reference}. */ | ||
ArrayUnshift, | ||
/** Unbound {@linkcode Array.prototype.forEach}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach MDN Reference}. */ | ||
forEach, // Doesn't follow convention! | ||
arrayEvery, // Not actually Array#every! | ||
assign, create, defineProperties, defineProperty, entries, freeze, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isFrozen, keys, seal, setPrototypeOf, StringFromCharCode, | ||
/** Unbound {@linkcode String.prototype.charCodeAt}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt MDN Reference}. */ | ||
StringCharCodeAt, | ||
/** Unbound {@linkcode String.prototype.replace}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace MDN Reference}. */ | ||
StringReplace, | ||
/** Unbound {@linkcode String.prototype.split}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split MDN Reference}. */ | ||
StringSplit, | ||
/** Unbound {@linkcode String.prototype.slice}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice MDN Reference}. */ | ||
StringSlice, | ||
/** Unbound {@linkcode String.prototype.toLowerCase}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase MDN Reference}. */ | ||
StringToLowerCase, }; | ||
/** | ||
* Determines whether the argument is `undefined`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `undefined`. | ||
*/ | ||
export declare function isUndefined(obj: unknown): obj is undefined; | ||
/** | ||
* Determines whether the argument is `null`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `null`. | ||
*/ | ||
export declare function isNull(obj: unknown): obj is null; | ||
/** | ||
* Determines whether the argument is `true`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `true`. | ||
*/ | ||
export declare function isTrue(obj: unknown): obj is true; | ||
/** | ||
* Determines whether the argument is `false`. | ||
* @param obj Value to test | ||
* @returns `true` if the value is `false`. | ||
*/ | ||
export declare function isFalse(obj: unknown): obj is false; | ||
/** | ||
* Determines whether the argument is a boolean. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a boolean. | ||
*/ | ||
export declare function isBoolean(obj: unknown): obj is boolean; | ||
/** | ||
* Determines whether the argument is a function. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a function. | ||
*/ | ||
export declare function isFunction(obj: unknown): obj is Function; | ||
/** | ||
* Determines whether the argument is an object or null. | ||
* @param obj Value to test | ||
* @returns `true` if the value is an object or null. | ||
*/ | ||
export declare function isObject(obj: unknown): obj is object | null; | ||
/** | ||
* Determines whether the argument is a string. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a string. | ||
*/ | ||
export declare function isString(obj: unknown): obj is string; | ||
/** | ||
* Determines whether the argument is a number. | ||
* @param obj Value to test | ||
* @returns `true` if the value is a number. | ||
*/ | ||
export declare function isNumber(obj: unknown): obj is number; | ||
/** Does nothing! 🚀 */ | ||
export declare function noop(): void; | ||
export declare function toString(obj: any): string; | ||
export declare function getPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; | ||
/** | ||
* Converts the argument to a string, safely accounting for objects with "null" prototype. | ||
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`. | ||
* @param obj Value to convert to a string. | ||
* @returns String representation of the value. | ||
*/ | ||
export declare function toString(obj: unknown): string; | ||
/** | ||
* Gets the property descriptor for the given object and property key. Similar to | ||
* {@linkcode Object.getOwnPropertyDescriptor}, but looks up the prototype chain. | ||
* @param o Value to get the property descriptor for | ||
* @param p Property key to get the descriptor for | ||
* @returns The property descriptor for the given object and property key. | ||
*/ | ||
export declare function getPropertyDescriptor(o: unknown, p: PropertyKey): PropertyDescriptor | undefined; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* | ||
* @param name | ||
* @param namespace | ||
*/ | ||
export declare function isVoidElement(name: string, namespace: string): boolean; |
@@ -7,3 +7,3 @@ { | ||
"name": "@lwc/shared", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "Utilities and methods that are shared across packages", | ||
@@ -10,0 +10,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104474
1859
94