@contember/utilities
Advanced tools
Comparing version 1.2.0-alpha.3 to 1.2.0-alpha.4
@@ -0,3 +1,4 @@ | ||
import { assertNever } from "../../assert-types/assertNever.js"; | ||
function flatClassNameList(className) { | ||
if (className == null) { | ||
if (!className) { | ||
return []; | ||
@@ -7,5 +8,5 @@ } else if (typeof className === "string") { | ||
} else if (Array.isArray(className)) { | ||
return className.map(flatClassNameList).flat(1); | ||
return className.flatMap(flatClassNameList); | ||
} else { | ||
throw new Error(`Unexpected className: ${JSON.stringify(className)}`); | ||
assertNever(); | ||
} | ||
@@ -12,0 +13,0 @@ } |
import { AssertionError } from "./assert-types/AssertionError.js"; | ||
import { isBoolean, isDefined, isFalse, isHTMLElement, isNonEmptyString, isNonEmptyTrimmedEndString, isNonEmptyTrimmedStartString, isNonEmptyTrimmedString, isNonNegativeNumber, isNotNull, isNotNullish, isNull, isNumber, isNumericString, isObject, isOneOfFactory, isPlainObject, isString, isTrue, isUndefined } from "./assert-types/Predicates.js"; | ||
import { assert } from "./assert-types/assert.js"; | ||
import { classNameForFactory } from "./class-name/classNameFor.js"; | ||
import { assertNever } from "./assert-types/assertNever.js"; | ||
import { GlobalClassNamePrefixContext } from "./class-name/GlobalClassNamePrefixContext.js"; | ||
import { listClassName } from "./class-name/listClassName.js"; | ||
import { stateClassName } from "./class-name/stateClassName.js"; | ||
import { useClassName } from "./class-name/useClassName.js"; | ||
import { useClassNameFactory } from "./class-name/useClassNameFactory.js"; | ||
import { px } from "./css-utilities/px.js"; | ||
import { dataAttribute } from "./dom/dataAttribute.js"; | ||
import { getMatchingParentElement } from "./dom/getMatchingParentElement.js"; | ||
@@ -19,5 +23,7 @@ import { getSizeFromResizeObserverEntryFactory } from "./dom/getSizeFromResizeObserverEntry.js"; | ||
AssertionError, | ||
GlobalClassNamePrefixContext, | ||
assert, | ||
assertNever, | ||
capitalize, | ||
classNameForFactory, | ||
dataAttribute, | ||
getMatchingParentElement, | ||
@@ -53,4 +59,6 @@ getSizeFromResizeObserverEntryFactory, | ||
svgSizeProps, | ||
trimString | ||
trimString, | ||
useClassName, | ||
useClassNameFactory | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,4 @@ | ||
import { assertNever } from "../../assert-types/assertNever.js"; | ||
function flatClassNameList(className) { | ||
if (className == null) { | ||
if (!className) { | ||
return []; | ||
@@ -7,5 +8,5 @@ } else if (typeof className === "string") { | ||
} else if (Array.isArray(className)) { | ||
return className.map(flatClassNameList).flat(1); | ||
return className.flatMap(flatClassNameList); | ||
} else { | ||
throw new Error(`Unexpected className: ${JSON.stringify(className)}`); | ||
assertNever(); | ||
} | ||
@@ -12,0 +13,0 @@ } |
import { AssertionError } from "./assert-types/AssertionError.js"; | ||
import { isBoolean, isDefined, isFalse, isHTMLElement, isNonEmptyString, isNonEmptyTrimmedEndString, isNonEmptyTrimmedStartString, isNonEmptyTrimmedString, isNonNegativeNumber, isNotNull, isNotNullish, isNull, isNumber, isNumericString, isObject, isOneOfFactory, isPlainObject, isString, isTrue, isUndefined } from "./assert-types/Predicates.js"; | ||
import { assert } from "./assert-types/assert.js"; | ||
import { classNameForFactory } from "./class-name/classNameFor.js"; | ||
import { assertNever } from "./assert-types/assertNever.js"; | ||
import { GlobalClassNamePrefixContext } from "./class-name/GlobalClassNamePrefixContext.js"; | ||
import { listClassName } from "./class-name/listClassName.js"; | ||
import { stateClassName } from "./class-name/stateClassName.js"; | ||
import { useClassName } from "./class-name/useClassName.js"; | ||
import { useClassNameFactory } from "./class-name/useClassNameFactory.js"; | ||
import { px } from "./css-utilities/px.js"; | ||
import { dataAttribute } from "./dom/dataAttribute.js"; | ||
import { getMatchingParentElement } from "./dom/getMatchingParentElement.js"; | ||
@@ -19,5 +23,7 @@ import { getSizeFromResizeObserverEntryFactory } from "./dom/getSizeFromResizeObserverEntry.js"; | ||
AssertionError, | ||
GlobalClassNamePrefixContext, | ||
assert, | ||
assertNever, | ||
capitalize, | ||
classNameForFactory, | ||
dataAttribute, | ||
getMatchingParentElement, | ||
@@ -53,4 +59,6 @@ getSizeFromResizeObserverEntryFactory, | ||
svgSizeProps, | ||
trimString | ||
trimString, | ||
useClassName, | ||
useClassNameFactory | ||
}; | ||
//# sourceMappingURL=index.js.map |
export * from './AssertionError'; | ||
export * from './Predicates'; | ||
export * from './assert'; | ||
export * from './assertNever'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,5 +1,7 @@ | ||
export * from './GlobalClassNamePrefixContext'; | ||
export * from './Types'; | ||
export * from './classNameFor'; | ||
export * from './listClassName'; | ||
export * from './stateClassName'; | ||
export * from './useClassName'; | ||
export * from './useClassNameFactory'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,1 +1,2 @@ | ||
export * from './dataAttribute'; | ||
export * from './getMatchingParentElement'; | ||
@@ -2,0 +3,0 @@ export * from './getSizeFromResizeObserverEntry'; |
{ | ||
"name": "@contember/utilities", | ||
"license": "Apache-2.0", | ||
"version": "1.2.0-alpha.3", | ||
"version": "1.2.0-alpha.4", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "sideEffects": false, |
export * from './AssertionError' | ||
export * from './Predicates' | ||
export * from './assert' | ||
export * from './assertNever' |
@@ -0,4 +1,6 @@ | ||
export * from './GlobalClassNamePrefixContext' | ||
export * from './Types' | ||
export * from './classNameFor' | ||
export * from './listClassName' | ||
export * from './stateClassName' | ||
export * from './useClassName' | ||
export * from './useClassNameFactory' |
@@ -0,5 +1,6 @@ | ||
import { assertNever } from '../../assert-types' | ||
import { NestedClassName } from '../Types' | ||
export function flatClassNameList(className: NestedClassName): string[] { | ||
if (className == null) { | ||
if (!className) { | ||
return [] | ||
@@ -9,6 +10,10 @@ } else if (typeof className === 'string') { | ||
} else if (Array.isArray(className)) { | ||
return className.map(flatClassNameList).flat(1) | ||
return className.flatMap(flatClassNameList) | ||
} else { | ||
throw new Error(`Unexpected className: ${JSON.stringify(className)}`) | ||
if (import.meta.env.DEV) { | ||
console.error(`Unexpected className: ${JSON.stringify(className)}`) | ||
} | ||
assertNever(className) | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
export * from './dataAttribute' | ||
export * from './getMatchingParentElement' | ||
@@ -2,0 +3,0 @@ export * from './getSizeFromResizeObserverEntry' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
132344
203
1509