stream-hooks
Version:
<div align="center"> <a aria-label="NPM version" href="https://twitter.com/dimitrikennedy"> <img alt="stream-hooks" src="https://img.shields.io/twitter/follow/dimitrikennedy?style=social&labelColor=000000"> </a> <a aria-label="GH Issues" href="h
1 lines • 131 kB
Source Map (JSON)
{"version":3,"sources":["../../../../node_modules/clsx/dist/clsx.mjs","../../../../node_modules/tailwind-merge/src/lib/class-group-utils.ts","../../../../node_modules/tailwind-merge/src/lib/lru-cache.ts","../../../../node_modules/tailwind-merge/src/lib/parse-class-name.ts","../../../../node_modules/tailwind-merge/src/lib/config-utils.ts","../../../../node_modules/tailwind-merge/src/lib/merge-classlist.ts","../../../../node_modules/tailwind-merge/src/lib/tw-join.ts","../../../../node_modules/tailwind-merge/src/lib/create-tailwind-merge.ts","../../../../node_modules/tailwind-merge/src/lib/from-theme.ts","../../../../node_modules/tailwind-merge/src/lib/validators.ts","../../../../node_modules/tailwind-merge/src/lib/default-config.ts","../../../../node_modules/tailwind-merge/src/lib/merge-configs.ts","../../../../node_modules/tailwind-merge/src/lib/extend-tailwind-merge.ts","../../../../node_modules/tailwind-merge/src/lib/tw-merge.ts","../../src/lib/utils.ts"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import {\n ClassGroup,\n ClassValidator,\n Config,\n GenericClassGroupIds,\n GenericConfig,\n GenericThemeGroupIds,\n ThemeGetter,\n ThemeObject,\n} from './types'\n\nexport interface ClassPartObject {\n nextPart: Map<string, ClassPartObject>\n validators: ClassValidatorObject[]\n classGroupId?: GenericClassGroupIds\n}\n\ninterface ClassValidatorObject {\n classGroupId: GenericClassGroupIds\n validator: ClassValidator\n}\n\nconst CLASS_PART_SEPARATOR = '-'\n\nexport const createClassGroupUtils = (config: GenericConfig) => {\n const classMap = createClassMap(config)\n const { conflictingClassGroups, conflictingClassGroupModifiers } = config\n\n const getClassGroupId = (className: string) => {\n const classParts = className.split(CLASS_PART_SEPARATOR)\n\n // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.\n if (classParts[0] === '' && classParts.length !== 1) {\n classParts.shift()\n }\n\n return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className)\n }\n\n const getConflictingClassGroupIds = (\n classGroupId: GenericClassGroupIds,\n hasPostfixModifier: boolean,\n ) => {\n const conflicts = conflictingClassGroups[classGroupId] || []\n\n if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {\n return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]!]\n }\n\n return conflicts\n }\n\n return {\n getClassGroupId,\n getConflictingClassGroupIds,\n }\n}\n\nconst getGroupRecursive = (\n classParts: string[],\n classPartObject: ClassPartObject,\n): GenericClassGroupIds | undefined => {\n if (classParts.length === 0) {\n return classPartObject.classGroupId\n }\n\n const currentClassPart = classParts[0]!\n const nextClassPartObject = classPartObject.nextPart.get(currentClassPart)\n const classGroupFromNextClassPart = nextClassPartObject\n ? getGroupRecursive(classParts.slice(1), nextClassPartObject)\n : undefined\n\n if (classGroupFromNextClassPart) {\n return classGroupFromNextClassPart\n }\n\n if (classPartObject.validators.length === 0) {\n return undefined\n }\n\n const classRest = classParts.join(CLASS_PART_SEPARATOR)\n\n return classPartObject.validators.find(({ validator }) => validator(classRest))?.classGroupId\n}\n\nconst arbitraryPropertyRegex = /^\\[(.+)\\]$/\n\nconst getGroupIdForArbitraryProperty = (className: string) => {\n if (arbitraryPropertyRegex.test(className)) {\n const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]\n const property = arbitraryPropertyClassName?.substring(\n 0,\n arbitraryPropertyClassName.indexOf(':'),\n )\n\n if (property) {\n // I use two dots here because one dot is used as prefix for class groups in plugins\n return 'arbitrary..' + property\n }\n }\n}\n\n/**\n * Exported for testing only\n */\nexport const createClassMap = (config: Config<GenericClassGroupIds, GenericThemeGroupIds>) => {\n const { theme, prefix } = config\n const classMap: ClassPartObject = {\n nextPart: new Map<string, ClassPartObject>(),\n validators: [],\n }\n\n const prefixedClassGroupEntries = getPrefixedClassGroupEntries(\n Object.entries(config.classGroups),\n prefix,\n )\n\n prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {\n processClassesRecursively(classGroup, classMap, classGroupId, theme)\n })\n\n return classMap\n}\n\nconst processClassesRecursively = (\n classGroup: ClassGroup<GenericThemeGroupIds>,\n classPartObject: ClassPartObject,\n classGroupId: GenericClassGroupIds,\n theme: ThemeObject<GenericThemeGroupIds>,\n) => {\n classGroup.forEach((classDefinition) => {\n if (typeof classDefinition === 'string') {\n const classPartObjectToEdit =\n classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition)\n classPartObjectToEdit.classGroupId = classGroupId\n return\n }\n\n if (typeof classDefinition === 'function') {\n if (isThemeGetter(classDefinition)) {\n processClassesRecursively(\n classDefinition(theme),\n classPartObject,\n classGroupId,\n theme,\n )\n return\n }\n\n classPartObject.validators.push({\n validator: classDefinition,\n classGroupId,\n })\n\n return\n }\n\n Object.entries(classDefinition).forEach(([key, classGroup]) => {\n processClassesRecursively(\n classGroup,\n getPart(classPartObject, key),\n classGroupId,\n theme,\n )\n })\n })\n}\n\nconst getPart = (classPartObject: ClassPartObject, path: string) => {\n let currentClassPartObject = classPartObject\n\n path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {\n if (!currentClassPartObject.nextPart.has(pathPart)) {\n currentClassPartObject.nextPart.set(pathPart, {\n nextPart: new Map(),\n validators: [],\n })\n }\n\n currentClassPartObject = currentClassPartObject.nextPart.get(pathPart)!\n })\n\n return currentClassPartObject\n}\n\nconst isThemeGetter = (func: ClassValidator | ThemeGetter): func is ThemeGetter =>\n (func as ThemeGetter).isThemeGetter\n\nconst getPrefixedClassGroupEntries = (\n classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup<GenericThemeGroupIds>]>,\n prefix: string | undefined,\n): Array<[classGroupId: string, classGroup: ClassGroup<GenericThemeGroupIds>]> => {\n if (!prefix) {\n return classGroupEntries\n }\n\n return classGroupEntries.map(([classGroupId, classGroup]) => {\n const prefixedClassGroup = classGroup.map((classDefinition) => {\n if (typeof classDefinition === 'string') {\n return prefix + classDefinition\n }\n\n if (typeof classDefinition === 'object') {\n return Object.fromEntries(\n Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]),\n )\n }\n\n return classDefinition\n })\n\n return [classGroupId, prefixedClassGroup]\n })\n}\n","// Export is needed because TypeScript complains about an error otherwise:\n// Error: …/tailwind-merge/src/config-utils.ts(8,17): semantic error TS4058: Return type of exported function has or is using name 'LruCache' from external module \"…/tailwind-merge/src/lru-cache\" but cannot be named.\nexport interface LruCache<Key, Value> {\n get(key: Key): Value | undefined\n set(key: Key, value: Value): void\n}\n\n// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance\nexport const createLruCache = <Key, Value>(maxCacheSize: number): LruCache<Key, Value> => {\n if (maxCacheSize < 1) {\n return {\n get: () => undefined,\n set: () => {},\n }\n }\n\n let cacheSize = 0\n let cache = new Map<Key, Value>()\n let previousCache = new Map<Key, Value>()\n\n const update = (key: Key, value: Value) => {\n cache.set(key, value)\n cacheSize++\n\n if (cacheSize > maxCacheSize) {\n cacheSize = 0\n previousCache = cache\n cache = new Map()\n }\n }\n\n return {\n get(key) {\n let value = cache.get(key)\n\n if (value !== undefined) {\n return value\n }\n if ((value = previousCache.get(key)) !== undefined) {\n update(key, value)\n return value\n }\n },\n set(key, value) {\n if (cache.has(key)) {\n cache.set(key, value)\n } else {\n update(key, value)\n }\n },\n }\n}\n","import { GenericConfig } from './types'\n\nexport const IMPORTANT_MODIFIER = '!'\n\nexport const createParseClassName = (config: GenericConfig) => {\n const { separator, experimentalParseClassName } = config\n const isSeparatorSingleCharacter = separator.length === 1\n const firstSeparatorCharacter = separator[0]\n const separatorLength = separator.length\n\n // parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js\n const parseClassName = (className: string) => {\n const modifiers = []\n\n let bracketDepth = 0\n let modifierStart = 0\n let postfixModifierPosition: number | undefined\n\n for (let index = 0; index < className.length; index++) {\n let currentCharacter = className[index]\n\n if (bracketDepth === 0) {\n if (\n currentCharacter === firstSeparatorCharacter &&\n (isSeparatorSingleCharacter ||\n className.slice(index, index + separatorLength) === separator)\n ) {\n modifiers.push(className.slice(modifierStart, index))\n modifierStart = index + separatorLength\n continue\n }\n\n if (currentCharacter === '/') {\n postfixModifierPosition = index\n continue\n }\n }\n\n if (currentCharacter === '[') {\n bracketDepth++\n } else if (currentCharacter === ']') {\n bracketDepth--\n }\n }\n\n const baseClassNameWithImportantModifier =\n modifiers.length === 0 ? className : className.substring(modifierStart)\n const hasImportantModifier =\n baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)\n const baseClassName = hasImportantModifier\n ? baseClassNameWithImportantModifier.substring(1)\n : baseClassNameWithImportantModifier\n\n const maybePostfixModifierPosition =\n postfixModifierPosition && postfixModifierPosition > modifierStart\n ? postfixModifierPosition - modifierStart\n : undefined\n\n return {\n modifiers,\n hasImportantModifier,\n baseClassName,\n maybePostfixModifierPosition,\n }\n }\n\n if (experimentalParseClassName) {\n return (className: string) => experimentalParseClassName({ className, parseClassName })\n }\n\n return parseClassName\n}\n\n/**\n * Sorts modifiers according to following schema:\n * - Predefined modifiers are sorted alphabetically\n * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it\n */\nexport const sortModifiers = (modifiers: string[]) => {\n if (modifiers.length <= 1) {\n return modifiers\n }\n\n const sortedModifiers: string[] = []\n let unsortedModifiers: string[] = []\n\n modifiers.forEach((modifier) => {\n const isArbitraryVariant = modifier[0] === '['\n\n if (isArbitraryVariant) {\n sortedModifiers.push(...unsortedModifiers.sort(), modifier)\n unsortedModifiers = []\n } else {\n unsortedModifiers.push(modifier)\n }\n })\n\n sortedModifiers.push(...unsortedModifiers.sort())\n\n return sortedModifiers\n}\n","import { createClassGroupUtils } from './class-group-utils'\nimport { createLruCache } from './lru-cache'\nimport { createParseClassName } from './parse-class-name'\nimport { GenericConfig } from './types'\n\nexport type ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport const createConfigUtils = (config: GenericConfig) => ({\n cache: createLruCache<string, string>(config.cacheSize),\n parseClassName: createParseClassName(config),\n ...createClassGroupUtils(config),\n})\n","import { ConfigUtils } from './config-utils'\nimport { IMPORTANT_MODIFIER, sortModifiers } from './parse-class-name'\n\nconst SPLIT_CLASSES_REGEX = /\\s+/\n\nexport const mergeClassList = (classList: string, configUtils: ConfigUtils) => {\n const { parseClassName, getClassGroupId, getConflictingClassGroupIds } = configUtils\n\n /**\n * Set of classGroupIds in following format:\n * `{importantModifier}{variantModifiers}{classGroupId}`\n * @example 'float'\n * @example 'hover:focus:bg-color'\n * @example 'md:!pr'\n */\n const classGroupsInConflict: string[] = []\n const classNames = classList.trim().split(SPLIT_CLASSES_REGEX)\n\n let result = ''\n\n for (let index = classNames.length - 1; index >= 0; index -= 1) {\n const originalClassName = classNames[index]!\n\n const { modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } =\n parseClassName(originalClassName)\n\n let hasPostfixModifier = Boolean(maybePostfixModifierPosition)\n let classGroupId = getClassGroupId(\n hasPostfixModifier\n ? baseClassName.substring(0, maybePostfixModifierPosition)\n : baseClassName,\n )\n\n if (!classGroupId) {\n if (!hasPostfixModifier) {\n // Not a Tailwind class\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n continue\n }\n\n classGroupId = getClassGroupId(baseClassName)\n\n if (!classGroupId) {\n // Not a Tailwind class\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n continue\n }\n\n hasPostfixModifier = false\n }\n\n const variantModifier = sortModifiers(modifiers).join(':')\n\n const modifierId = hasImportantModifier\n ? variantModifier + IMPORTANT_MODIFIER\n : variantModifier\n\n const classId = modifierId + classGroupId\n\n if (classGroupsInConflict.includes(classId)) {\n // Tailwind class omitted due to conflict\n continue\n }\n\n classGroupsInConflict.push(classId)\n\n const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier)\n for (let i = 0; i < conflictGroups.length; ++i) {\n const group = conflictGroups[i]!\n classGroupsInConflict.push(modifierId + group)\n }\n\n // Tailwind class not in conflict\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n }\n\n return result\n}\n","/**\n * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.\n *\n * Specifically:\n * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js\n * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts\n *\n * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n */\n\nexport type ClassNameValue = ClassNameArray | string | null | undefined | 0 | 0n | false\ntype ClassNameArray = ClassNameValue[]\n\nexport function twJoin(...classLists: ClassNameValue[]): string\nexport function twJoin() {\n let index = 0\n let argument: ClassNameValue\n let resolvedValue: string\n let string = ''\n\n while (index < arguments.length) {\n if ((argument = arguments[index++])) {\n if ((resolvedValue = toValue(argument))) {\n string && (string += ' ')\n string += resolvedValue\n }\n }\n }\n return string\n}\n\nconst toValue = (mix: ClassNameArray | string) => {\n if (typeof mix === 'string') {\n return mix\n }\n\n let resolvedValue: string\n let string = ''\n\n for (let k = 0; k < mix.length; k++) {\n if (mix[k]) {\n if ((resolvedValue = toValue(mix[k] as ClassNameArray | string))) {\n string && (string += ' ')\n string += resolvedValue\n }\n }\n }\n\n return string\n}\n","import { createConfigUtils } from './config-utils'\nimport { mergeClassList } from './merge-classlist'\nimport { ClassNameValue, twJoin } from './tw-join'\nimport { GenericConfig } from './types'\n\ntype CreateConfigFirst = () => GenericConfig\ntype CreateConfigSubsequent = (config: GenericConfig) => GenericConfig\ntype TailwindMerge = (...classLists: ClassNameValue[]) => string\ntype ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createTailwindMerge(\n createConfigFirst: CreateConfigFirst,\n ...createConfigRest: CreateConfigSubsequent[]\n): TailwindMerge {\n let configUtils: ConfigUtils\n let cacheGet: ConfigUtils['cache']['get']\n let cacheSet: ConfigUtils['cache']['set']\n let functionToCall = initTailwindMerge\n\n function initTailwindMerge(classList: string) {\n const config = createConfigRest.reduce(\n (previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig),\n createConfigFirst() as GenericConfig,\n )\n\n configUtils = createConfigUtils(config)\n cacheGet = configUtils.cache.get\n cacheSet = configUtils.cache.set\n functionToCall = tailwindMerge\n\n return tailwindMerge(classList)\n }\n\n function tailwindMerge(classList: string) {\n const cachedResult = cacheGet(classList)\n\n if (cachedResult) {\n return cachedResult\n }\n\n const result = mergeClassList(classList, configUtils)\n cacheSet(classList, result)\n\n return result\n }\n\n return function callTailwindMerge() {\n return functionToCall(twJoin.apply(null, arguments as any))\n }\n}\n","import { DefaultThemeGroupIds, NoInfer, ThemeGetter, ThemeObject } from './types'\n\nexport const fromTheme = <\n AdditionalThemeGroupIds extends string = never,\n DefaultThemeGroupIdsInner extends string = DefaultThemeGroupIds,\n>(key: NoInfer<DefaultThemeGroupIdsInner | AdditionalThemeGroupIds>): ThemeGetter => {\n const themeGetter = (theme: ThemeObject<DefaultThemeGroupIdsInner | AdditionalThemeGroupIds>) =>\n theme[key] || []\n\n themeGetter.isThemeGetter = true as const\n\n return themeGetter\n}\n","const arbitraryValueRegex = /^\\[(?:([a-z-]+):)?(.+)\\]$/i\nconst fractionRegex = /^\\d+\\/\\d+$/\nconst stringLengths = new Set(['px', 'full', 'screen'])\nconst tshirtUnitRegex = /^(\\d+(\\.\\d+)?)?(xs|sm|md|lg|xl)$/\nconst lengthUnitRegex =\n /\\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\\b(calc|min|max|clamp)\\(.+\\)|^0$/\nconst colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\\(.+\\)$/\n// Shadow always begins with x and y offset separated by underscore optionally prepended by inset\nconst shadowRegex = /^(inset_)?-?((\\d+)?\\.?(\\d+)[a-z]+|0)_-?((\\d+)?\\.?(\\d+)[a-z]+|0)/\nconst imageRegex =\n /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\\(.+\\)$/\n\nexport const isLength = (value: string) =>\n isNumber(value) || stringLengths.has(value) || fractionRegex.test(value)\n\nexport const isArbitraryLength = (value: string) =>\n getIsArbitraryValue(value, 'length', isLengthOnly)\n\nexport const isNumber = (value: string) => Boolean(value) && !Number.isNaN(Number(value))\n\nexport const isArbitraryNumber = (value: string) => getIsArbitraryValue(value, 'number', isNumber)\n\nexport const isInteger = (value: string) => Boolean(value) && Number.isInteger(Number(value))\n\nexport const isPercent = (value: string) => value.endsWith('%') && isNumber(value.slice(0, -1))\n\nexport const isArbitraryValue = (value: string) => arbitraryValueRegex.test(value)\n\nexport const isTshirtSize = (value: string) => tshirtUnitRegex.test(value)\n\nconst sizeLabels = new Set(['length', 'size', 'percentage'])\n\nexport const isArbitrarySize = (value: string) => getIsArbitraryValue(value, sizeLabels, isNever)\n\nexport const isArbitraryPosition = (value: string) =>\n getIsArbitraryValue(value, 'position', isNever)\n\nconst imageLabels = new Set(['image', 'url'])\n\nexport const isArbitraryImage = (value: string) => getIsArbitraryValue(value, imageLabels, isImage)\n\nexport const isArbitraryShadow = (value: string) => getIsArbitraryValue(value, '', isShadow)\n\nexport const isAny = () => true\n\nconst getIsArbitraryValue = (\n value: string,\n label: string | Set<string>,\n testValue: (value: string) => boolean,\n) => {\n const result = arbitraryValueRegex.exec(value)\n\n if (result) {\n if (result[1]) {\n return typeof label === 'string' ? result[1] === label : label.has(result[1])\n }\n\n return testValue(result[2]!)\n }\n\n return false\n}\n\nconst isLengthOnly = (value: string) =>\n // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.\n // For example, `hsl(0 0% 0%)` would be classified as a length without this check.\n // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.\n lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)\n\nconst isNever = () => false\n\nconst isShadow = (value: string) => shadowRegex.test(value)\n\nconst isImage = (value: string) => imageRegex.test(value)\n","import { fromTheme } from './from-theme'\nimport { Config, DefaultClassGroupIds, DefaultThemeGroupIds } from './types'\nimport {\n isAny,\n isArbitraryImage,\n isArbitraryLength,\n isArbitraryNumber,\n isArbitraryPosition,\n isArbitraryShadow,\n isArbitrarySize,\n isArbitraryValue,\n isInteger,\n isLength,\n isNumber,\n isPercent,\n isTshirtSize,\n} from './validators'\n\nexport const getDefaultConfig = () => {\n const colors = fromTheme('colors')\n const spacing = fromTheme('spacing')\n const blur = fromTheme('blur')\n const brightness = fromTheme('brightness')\n const borderColor = fromTheme('borderColor')\n const borderRadius = fromTheme('borderRadius')\n const borderSpacing = fromTheme('borderSpacing')\n const borderWidth = fromTheme('borderWidth')\n const contrast = fromTheme('contrast')\n const grayscale = fromTheme('grayscale')\n const hueRotate = fromTheme('hueRotate')\n const invert = fromTheme('invert')\n const gap = fromTheme('gap')\n const gradientColorStops = fromTheme('gradientColorStops')\n const gradientColorStopPositions = fromTheme('gradientColorStopPositions')\n const inset = fromTheme('inset')\n const margin = fromTheme('margin')\n const opacity = fromTheme('opacity')\n const padding = fromTheme('padding')\n const saturate = fromTheme('saturate')\n const scale = fromTheme('scale')\n const sepia = fromTheme('sepia')\n const skew = fromTheme('skew')\n const space = fromTheme('space')\n const translate = fromTheme('translate')\n\n const getOverscroll = () => ['auto', 'contain', 'none'] as const\n const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll'] as const\n const getSpacingWithAutoAndArbitrary = () => ['auto', isArbitraryValue, spacing] as const\n const getSpacingWithArbitrary = () => [isArbitraryValue, spacing] as const\n const getLengthWithEmptyAndArbitrary = () => ['', isLength, isArbitraryLength] as const\n const getNumberWithAutoAndArbitrary = () => ['auto', isNumber, isArbitraryValue] as const\n const getPositions = () =>\n [\n 'bottom',\n 'center',\n 'left',\n 'left-bottom',\n 'left-top',\n 'right',\n 'right-bottom',\n 'right-top',\n 'top',\n ] as const\n const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none'] as const\n const getBlendModes = () =>\n [\n 'normal',\n 'multiply',\n 'screen',\n 'overlay',\n 'darken',\n 'lighten',\n 'color-dodge',\n 'color-burn',\n 'hard-light',\n 'soft-light',\n 'difference',\n 'exclusion',\n 'hue',\n 'saturation',\n 'color',\n 'luminosity',\n ] as const\n const getAlign = () =>\n ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'] as const\n const getZeroAndEmpty = () => ['', '0', isArbitraryValue] as const\n const getBreaks = () =>\n ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'] as const\n const getNumberAndArbitrary = () => [isNumber, isArbitraryValue]\n\n return {\n cacheSize: 500,\n separator: ':',\n theme: {\n colors: [isAny],\n spacing: [isLength, isArbitraryLength],\n blur: ['none', '', isTshirtSize, isArbitraryValue],\n brightness: getNumberAndArbitrary(),\n borderColor: [colors],\n borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue],\n borderSpacing: getSpacingWithArbitrary(),\n borderWidth: getLengthWithEmptyAndArbitrary(),\n contrast: getNumberAndArbitrary(),\n grayscale: getZeroAndEmpty(),\n hueRotate: getNumberAndArbitrary(),\n invert: getZeroAndEmpty(),\n gap: getSpacingWithArbitrary(),\n gradientColorStops: [colors],\n gradientColorStopPositions: [isPercent, isArbitraryLength],\n inset: getSpacingWithAutoAndArbitrary(),\n margin: getSpacingWithAutoAndArbitrary(),\n opacity: getNumberAndArbitrary(),\n padding: getSpacingWithArbitrary(),\n saturate: getNumberAndArbitrary(),\n scale: getNumberAndArbitrary(),\n sepia: getZeroAndEmpty(),\n skew: getNumberAndArbitrary(),\n space: getSpacingWithArbitrary(),\n translate: getSpacingWithArbitrary(),\n },\n classGroups: {\n // Layout\n /**\n * Aspect Ratio\n * @see https://tailwindcss.com/docs/aspect-ratio\n */\n aspect: [{ aspect: ['auto', 'square', 'video', isArbitraryValue] }],\n /**\n * Container\n * @see https://tailwindcss.com/docs/container\n */\n container: ['container'],\n /**\n * Columns\n * @see https://tailwindcss.com/docs/columns\n */\n columns: [{ columns: [isTshirtSize] }],\n /**\n * Break After\n * @see https://tailwindcss.com/docs/break-after\n */\n 'break-after': [{ 'break-after': getBreaks() }],\n /**\n * Break Before\n * @see https://tailwindcss.com/docs/break-before\n */\n 'break-before': [{ 'break-before': getBreaks() }],\n /**\n * Break Inside\n * @see https://tailwindcss.com/docs/break-inside\n */\n 'break-inside': [{ 'break-inside': ['auto', 'avoid', 'avoid-page', 'avoid-column'] }],\n /**\n * Box Decoration Break\n * @see https://tailwindcss.com/docs/box-decoration-break\n */\n 'box-decoration': [{ 'box-decoration': ['slice', 'clone'] }],\n /**\n * Box Sizing\n * @see https://tailwindcss.com/docs/box-sizing\n */\n box: [{ box: ['border', 'content'] }],\n /**\n * Display\n * @see https://tailwindcss.com/docs/display\n */\n display: [\n 'block',\n 'inline-block',\n 'inline',\n 'flex',\n 'inline-flex',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'flow-root',\n 'grid',\n 'inline-grid',\n 'contents',\n 'list-item',\n 'hidden',\n ],\n /**\n * Floats\n * @see https://tailwindcss.com/docs/float\n */\n float: [{ float: ['right', 'left', 'none', 'start', 'end'] }],\n /**\n * Clear\n * @see https://tailwindcss.com/docs/clear\n */\n clear: [{ clear: ['left', 'right', 'both', 'none', 'start', 'end'] }],\n /**\n * Isolation\n * @see https://tailwindcss.com/docs/isolation\n */\n isolation: ['isolate', 'isolation-auto'],\n /**\n * Object Fit\n * @see https://tailwindcss.com/docs/object-fit\n */\n 'object-fit': [{ object: ['contain', 'cover', 'fill', 'none', 'scale-down'] }],\n /**\n * Object Position\n * @see https://tailwindcss.com/docs/object-position\n */\n 'object-position': [{ object: [...getPositions(), isArbitraryValue] }],\n /**\n * Overflow\n * @see https://tailwindcss.com/docs/overflow\n */\n overflow: [{ overflow: getOverflow() }],\n /**\n * Overflow X\n * @see https://tailwindcss.com/docs/overflow\n */\n 'overflow-x': [{ 'overflow-x': getOverflow() }],\n /**\n * Overflow Y\n * @see https://tailwindcss.com/docs/overflow\n */\n 'overflow-y': [{ 'overflow-y': getOverflow() }],\n /**\n * Overscroll Behavior\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n overscroll: [{ overscroll: getOverscroll() }],\n /**\n * Overscroll Behavior X\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n 'overscroll-x': [{ 'overscroll-x': getOverscroll() }],\n /**\n * Overscroll Behavior Y\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n 'overscroll-y': [{ 'overscroll-y': getOverscroll() }],\n /**\n * Position\n * @see https://tailwindcss.com/docs/position\n */\n position: ['static', 'fixed', 'absolute', 'relative', 'sticky'],\n /**\n * Top / Right / Bottom / Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n inset: [{ inset: [inset] }],\n /**\n * Right / Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n 'inset-x': [{ 'inset-x': [inset] }],\n /**\n * Top / Bottom\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n 'inset-y': [{ 'inset-y': [inset] }],\n /**\n * Start\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n start: [{ start: [inset] }],\n /**\n * End\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n end: [{ end: [inset] }],\n /**\n * Top\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n top: [{ top: [inset] }],\n /**\n * Right\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n right: [{ right: [inset] }],\n /**\n * Bottom\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n bottom: [{ bottom: [inset] }],\n /**\n * Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n left: [{ left: [inset] }],\n /**\n * Visibility\n * @see https://tailwindcss.com/docs/visibility\n */\n visibility: ['visible', 'invisible', 'collapse'],\n /**\n * Z-Index\n * @see https://tailwindcss.com/docs/z-index\n */\n z: [{ z: ['auto', isInteger, isArbitraryValue] }],\n // Flexbox and Grid\n /**\n * Flex Basis\n * @see https://tailwindcss.com/docs/flex-basis\n */\n basis: [{ basis: getSpacingWithAutoAndArbitrary() }],\n /**\n * Flex Direction\n * @see https://tailwindcss.com/docs/flex-direction\n */\n 'flex-direction': [{ flex: ['row', 'row-reverse', 'col', 'col-reverse'] }],\n /**\n * Flex Wrap\n * @see https://tailwindcss.com/docs/flex-wrap\n */\n 'flex-wrap': [{ flex: ['wrap', 'wrap-reverse', 'nowrap'] }],\n /**\n * Flex\n * @see https://tailwindcss.com/docs/flex\n */\n flex: [{ flex: ['1', 'auto', 'initial', 'none', isArbitraryValue] }],\n /**\n * Flex Grow\n * @see https://tailwindcss.com/docs/flex-grow\n */\n grow: [{ grow: getZeroAndEmpty() }],\n /**\n * Flex Shrink\n * @see https://tailwindcss.com/docs/flex-shrink\n */\n shrink: [{ shrink: getZeroAndEmpty() }],\n /**\n * Order\n * @see https://tailwindcss.com/docs/order\n */\n order: [{ order: ['first', 'last', 'none', isInteger, isArbitraryValue] }],\n /**\n * Grid Template Columns\n * @see https://tailwindcss.com/docs/grid-template-columns\n */\n 'grid-cols': [{ 'grid-cols': [isAny] }],\n /**\n * Grid Column Start / End\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-start-end': [\n {\n col: [\n 'auto',\n { span: ['full', isInteger, isArbitraryValue] },\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Grid Column Start\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-start': [{ 'col-start': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Column End\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-end': [{ 'col-end': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Template Rows\n * @see https://tailwindcss.com/docs/grid-template-rows\n */\n 'grid-rows': [{ 'grid-rows': [isAny] }],\n /**\n * Grid Row Start / End\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-start-end': [\n { row: ['auto', { span: [isInteger, isArbitraryValue] }, isArbitraryValue] },\n ],\n /**\n * Grid Row Start\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-start': [{ 'row-start': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Row End\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-end': [{ 'row-end': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Auto Flow\n * @see https://tailwindcss.com/docs/grid-auto-flow\n */\n 'grid-flow': [{ 'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense'] }],\n /**\n * Grid Auto Columns\n * @see https://tailwindcss.com/docs/grid-auto-columns\n */\n 'auto-cols': [{ 'auto-cols': ['auto', 'min', 'max', 'fr', isArbitraryValue] }],\n /**\n * Grid Auto Rows\n * @see https://tailwindcss.com/docs/grid-auto-rows\n */\n 'auto-rows': [{ 'auto-rows': ['auto', 'min', 'max', 'fr', isArbitraryValue] }],\n /**\n * Gap\n * @see https://tailwindcss.com/docs/gap\n */\n gap: [{ gap: [gap] }],\n /**\n * Gap X\n * @see https://tailwindcss.com/docs/gap\n */\n 'gap-x': [{ 'gap-x': [gap] }],\n /**\n * Gap Y\n * @see https://tailwindcss.com/docs/gap\n */\n 'gap-y': [{ 'gap-y': [gap] }],\n /**\n * Justify Content\n * @see https://tailwindcss.com/docs/justify-content\n */\n 'justify-content': [{ justify: ['normal', ...getAlign()] }],\n /**\n * Justify Items\n * @see https://tailwindcss.com/docs/justify-items\n */\n 'justify-items': [{ 'justify-items': ['start', 'end', 'center', 'stretch'] }],\n /**\n * Justify Self\n * @see https://tailwindcss.com/docs/justify-self\n */\n 'justify-self': [{ 'justify-self': ['auto', 'start', 'end', 'center', 'stretch'] }],\n /**\n * Align Content\n * @see https://tailwindcss.com/docs/align-content\n */\n 'align-content': [{ content: ['normal', ...getAlign(), 'baseline'] }],\n /**\n * Align Items\n * @see https://tailwindcss.com/docs/align-items\n */\n 'align-items': [{ items: ['start', 'end', 'center', 'baseline', 'stretch'] }],\n /**\n * Align Self\n * @see https://tailwindcss.com/docs/align-self\n */\n 'align-self': [{ self: ['auto', 'start', 'end', 'center', 'stretch', 'baseline'] }],\n /**\n * Place Content\n * @see https://tailwindcss.com/docs/place-content\n */\n 'place-content': [{ 'place-content': [...getAlign(), 'baseline'] }],\n /**\n * Place Items\n * @see https://tailwindcss.com/docs/place-items\n */\n 'place-items': [{ 'place-items': ['start', 'end', 'center', 'baseline', 'stretch'] }],\n /**\n * Place Self\n * @see https://tailwindcss.com/docs/place-self\n */\n 'place-self': [{ 'place-self': ['auto', 'start', 'end', 'center', 'stretch'] }],\n // Spacing\n /**\n * Padding\n * @see https://tailwindcss.com/docs/padding\n */\n p: [{ p: [padding] }],\n /**\n * Padding X\n * @see https://tailwindcss.com/docs/padding\n */\n px: [{ px: [padding] }],\n /**\n * Padding Y\n * @see https://tailwindcss.com/docs/padding\n */\n py: [{ py: [padding] }],\n /**\n * Padding Start\n * @see https://tailwindcss.com/docs/padding\n */\n ps: [{ ps: [padding] }],\n /**\n * Padding End\n * @see https://tailwindcss.com/docs/padding\n */\n pe: [{ pe: [padding] }],\n /**\n * Padding Top\n * @see https://tailwindcss.com/docs/padding\n */\n pt: [{ pt: [padding] }],\n /**\n * Padding Right\n * @see https://tailwindcss.com/docs/padding\n */\n pr: [{ pr: [padding] }],\n /**\n * Padding Bottom\n * @see https://tailwindcss.com/docs/padding\n */\n pb: [{ pb: [padding] }],\n /**\n * Padding Left\n * @see https://tailwindcss.com/docs/padding\n */\n pl: [{ pl: [padding] }],\n /**\n * Margin\n * @see https://tailwindcss.com/docs/margin\n */\n m: [{ m: [margin] }],\n /**\n * Margin X\n * @see https://tailwindcss.com/docs/margin\n */\n mx: [{ mx: [margin] }],\n /**\n * Margin Y\n * @see https://tailwindcss.com/docs/margin\n */\n my: [{ my: [margin] }],\n /**\n * Margin Start\n * @see https://tailwindcss.com/docs/margin\n */\n ms: [{ ms: [margin] }],\n /**\n * Margin End\n * @see https://tailwindcss.com/docs/margin\n */\n me: [{ me: [margin] }],\n /**\n * Margin Top\n * @see https://tailwindcss.com/docs/margin\n */\n mt: [{ mt: [margin] }],\n /**\n * Margin Right\n * @see https://tailwindcss.com/docs/margin\n */\n mr: [{ mr: [margin] }],\n /**\n * Margin Bottom\n * @see https://tailwindcss.com/docs/margin\n */\n mb: [{ mb: [margin] }],\n /**\n * Margin Left\n * @see https://tailwindcss.com/docs/margin\n */\n ml: [{ ml: [margin] }],\n /**\n * Space Between X\n * @see https://tailwindcss.com/docs/space\n */\n 'space-x': [{ 'space-x': [space] }],\n /**\n * Space Between X Reverse\n * @see https://tailwindcss.com/docs/space\n */\n 'space-x-reverse': ['space-x-reverse'],\n /**\n * Space Between Y\n * @see https://tailwindcss.com/docs/space\n */\n 'space-y': [{ 'space-y': [space] }],\n /**\n * Space Between Y Reverse\n * @see https://tailwindcss.com/docs/space\n */\n 'space-y-reverse': ['space-y-reverse'],\n // Sizing\n /**\n * Width\n * @see https://tailwindcss.com/docs/width\n */\n w: [\n {\n w: [\n 'auto',\n 'min',\n 'max',\n 'fit',\n 'svw',\n 'lvw',\n 'dvw',\n isArbitraryValue,\n spacing,\n ],\n },\n ],\n /**\n * Min-Width\n * @see https://tailwindcss.com/docs/min-width\n */\n 'min-w': [{ 'min-w': [isArbitraryValue, spacing, 'min', 'max', 'fit'] }],\n /**\n * Max-Width\n * @see https://tailwindcss.com/docs/max-width\n */\n 'max-w': [\n {\n 'max-w': [\n isArbitraryValue,\n spacing,\n 'none',\n 'full',\n 'min',\n 'max',\n 'fit',\n 'prose',\n { screen: [isTshirtSize] },\n isTshirtSize,\n ],\n },\n ],\n /**\n * Height\n * @see https://tailwindcss.com/docs/height\n */\n h: [\n {\n h: [\n isArbitraryValue,\n spacing,\n 'auto',\n 'min',\n 'max',\n 'fit',\n 'svh',\n 'lvh',\n 'dvh',\n ],\n },\n ],\n /**\n * Min-Height\n * @see https://tailwindcss.com/docs/min-height\n */\n 'min-h': [\n { 'min-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] },\n ],\n /**\n * Max-Height\n * @see https://tailwindcss.com/docs/max-height\n */\n 'max-h': [\n { 'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] },\n ],\n /**\n * Size\n * @see https://tailwindcss.com/docs/size\n */\n size: [{ size: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit'] }],\n // Typography\n /**\n * Font Size\n * @see https://tailwindcss.com/docs/font-size\n */\n 'font-size': [{ text: ['base', isTshirtSize, isArbitraryLength] }],\n /**\n * Font Smoothing\n * @see https://tailwindcss.com/docs/font-smoothing\n */\n 'font-smoothing': ['antialiased', 'subpixel-antialiased'],\n /**\n * Font Style\n * @see https://tailwindcss.com/docs/font-style\n */\n 'font-style': ['italic', 'not-italic'],\n /**\n * Font Weight\n * @see https://tailwindcss.com/docs/font-weight\n */\n 'font-weight': [\n {\n font: [\n 'thin',\n 'extralight',\n 'light',\n 'normal',\n 'medium',\n 'semibold',\n 'bold',\n 'extrabold',\n 'black',\n isArbitraryNumber,\n ],\n },\n ],\n /**\n * Font Family\n * @see https://tailwindcss.com/docs/font-family\n */\n 'font-family': [{ font: [isAny] }],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-normal': ['normal-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-ordinal': ['ordinal'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-slashed-zero': ['slashed-zero'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-figure': ['lining-nums', 'oldstyle-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-spacing': ['proportional-nums', 'tabular-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-fraction': ['diagonal-fractions', 'stacked-fractions'],\n /**\n * Letter Spacing\n * @see https://tailwindcss.com/docs/letter-spacing\n