tailwind-merge
Advanced tools
Comparing version 1.0.0 to 1.1.0
2451
dist/index.js
@@ -1,2449 +0,8 @@ | ||
import HLRU from 'hashlru'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
'use strict' | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./tailwind-merge.cjs.production.min.js') | ||
} else { | ||
module.exports = require('./tailwind-merge.cjs.development.js') | ||
} | ||
function getLruCache(cacheSize) { | ||
if (cacheSize >= 1) { | ||
return HLRU(cacheSize); | ||
} | ||
return { | ||
get: () => undefined, | ||
set: () => {} | ||
}; | ||
} | ||
const CLASS_PART_SEPARATOR = '-'; | ||
function createClassUtils(config) { | ||
const classMap = createClassMap(config); | ||
function getClassGroupId(className) { | ||
const classParts = className.split(CLASS_PART_SEPARATOR); // 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. | ||
if (classParts[0] === '' && classParts.length !== 1) { | ||
classParts.shift(); | ||
} | ||
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className); | ||
} | ||
function getConflictingClassGroupIds(classGroupId) { | ||
return config.conflictingClassGroups[classGroupId] || []; | ||
} | ||
return { | ||
getClassGroupId, | ||
getConflictingClassGroupIds | ||
}; | ||
} | ||
function getGroupRecursive(classParts, classPartObject) { | ||
var _classPartObject$vali; | ||
if (classParts.length === 0) { | ||
return classPartObject.classGroupId; | ||
} | ||
const currentClassPart = classParts[0]; | ||
const nextClassPartObject = classPartObject.nextPart[currentClassPart]; | ||
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined; | ||
if (classGroupFromNextClassPart) { | ||
return classGroupFromNextClassPart; | ||
} | ||
if (classPartObject.validators.length === 0) { | ||
return undefined; | ||
} | ||
const classRest = classParts.join(CLASS_PART_SEPARATOR); | ||
return (_classPartObject$vali = classPartObject.validators.find(({ | ||
validator | ||
}) => validator(classRest))) == null ? void 0 : _classPartObject$vali.classGroupId; | ||
} | ||
const arbitraryPropertyRegex = /^\[(.+)\]$/; | ||
function getGroupIdForArbitraryProperty(className) { | ||
if (arbitraryPropertyRegex.test(className)) { | ||
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1]; | ||
const property = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(':')); | ||
if (property) { | ||
// I use two dots here because one dot is used as prefix for class groups in plugins | ||
return 'arbitrary..' + property; | ||
} | ||
} | ||
} | ||
/** | ||
* Exported for testing only | ||
*/ | ||
function createClassMap(config) { | ||
const { | ||
theme | ||
} = config; | ||
const classMap = { | ||
nextPart: {}, | ||
validators: [] | ||
}; | ||
Object.entries(config.classGroups).forEach(([classGroupId, classGroup]) => { | ||
processClassesRecursively(classGroup, classMap, classGroupId, theme); | ||
}); | ||
return classMap; | ||
} | ||
function processClassesRecursively(classGroup, classPartObject, classGroupId, theme) { | ||
classGroup.forEach(classDefinition => { | ||
if (typeof classDefinition === 'string') { | ||
const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition); | ||
classPartObjectToEdit.classGroupId = classGroupId; | ||
return; | ||
} | ||
if (typeof classDefinition === 'function') { | ||
if (isThemeGetter(classDefinition)) { | ||
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme); | ||
return; | ||
} | ||
classPartObject.validators.push({ | ||
validator: classDefinition, | ||
classGroupId | ||
}); | ||
return; | ||
} | ||
Object.entries(classDefinition).forEach(([key, classGroup]) => { | ||
processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme); | ||
}); | ||
}); | ||
} | ||
function getPart(classPartObject, path) { | ||
let currentClassPartObject = classPartObject; | ||
path.split(CLASS_PART_SEPARATOR).forEach(pathPart => { | ||
if (currentClassPartObject.nextPart[pathPart] === undefined) { | ||
currentClassPartObject.nextPart[pathPart] = { | ||
nextPart: {}, | ||
validators: [] | ||
}; | ||
} | ||
currentClassPartObject = currentClassPartObject.nextPart[pathPart]; | ||
}); | ||
return currentClassPartObject; | ||
} | ||
function isThemeGetter(func) { | ||
return func.isThemeGetter; | ||
} | ||
function createConfigUtils(config) { | ||
return _extends({ | ||
cache: getLruCache(config.cacheSize) | ||
}, createClassUtils(config)); | ||
} | ||
const SPLIT_CLASSES_REGEX = /\s+/; | ||
const IMPORTANT_MODIFIER = '!'; // Regex is needed so we don't match against colons in labels for arbitrary values like `text-[color:var(--mystery-var)]` | ||
// I'd prefer to use a negative lookbehind for all supported labels, but lookbheinds don't have good browser support yet. More info: https://caniuse.com/js-regexp-lookbehind | ||
const PREFIX_SEPARATOR_REGEX = /:(?![^[]*\])/; | ||
const PREFIX_SEPARATOR = ':'; | ||
function mergeClassList(classList, configUtils) { | ||
const { | ||
getClassGroupId, | ||
getConflictingClassGroupIds | ||
} = configUtils; | ||
/** | ||
* Set of classGroupIds in following format: | ||
* `{importantModifier}{variantPrefixes}{classGroupId}` | ||
* @example 'float' | ||
* @example 'hover:focus:bg-color' | ||
* @example '!md:pr' | ||
*/ | ||
const classGroupsInConflict = new Set(); | ||
return classList.trim().split(SPLIT_CLASSES_REGEX).map(originalClassName => { | ||
const prefixes = originalClassName.split(PREFIX_SEPARATOR_REGEX); | ||
const classNameWithImportantModifier = prefixes.pop(); | ||
const hasImportantModifier = classNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER); | ||
const className = hasImportantModifier ? classNameWithImportantModifier.substring(1) : classNameWithImportantModifier; | ||
const classGroupId = getClassGroupId(className); | ||
if (!classGroupId) { | ||
return { | ||
isTailwindClass: false, | ||
originalClassName | ||
}; | ||
} | ||
const variantPrefix = prefixes.length === 0 ? '' : prefixes.sort().concat('').join(PREFIX_SEPARATOR); | ||
const fullPrefix = hasImportantModifier ? IMPORTANT_MODIFIER + variantPrefix : variantPrefix; | ||
return { | ||
isTailwindClass: true, | ||
prefix: fullPrefix, | ||
classGroupId, | ||
originalClassName | ||
}; | ||
}).reverse() // Last class in conflict wins, so we need to filter conflicting classes in reverse order. | ||
.filter(parsed => { | ||
if (!parsed.isTailwindClass) { | ||
return true; | ||
} | ||
const { | ||
prefix, | ||
classGroupId | ||
} = parsed; | ||
const classId = `${prefix}:${classGroupId}`; | ||
if (classGroupsInConflict.has(classId)) { | ||
return false; | ||
} | ||
classGroupsInConflict.add(classId); | ||
getConflictingClassGroupIds(classGroupId).forEach(group => classGroupsInConflict.add(`${prefix}:${group}`)); | ||
return true; | ||
}).reverse().map(parsed => parsed.originalClassName).join(' '); | ||
} | ||
function createTailwindMerge(...createConfig) { | ||
let configUtils; | ||
let cacheGet; | ||
let cacheSet; | ||
let functionToCall = initTailwindMerge; | ||
function initTailwindMerge(classList) { | ||
const [firstCreateConfig, ...restCreateConfig] = createConfig; | ||
const config = restCreateConfig.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), firstCreateConfig()); | ||
configUtils = createConfigUtils(config); | ||
cacheGet = configUtils.cache.get; | ||
cacheSet = configUtils.cache.set; | ||
functionToCall = tailwindMerge; | ||
return tailwindMerge(classList); | ||
} | ||
function tailwindMerge(classList) { | ||
const cachedResult = cacheGet(classList); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
const result = mergeClassList(classList, configUtils); | ||
cacheSet(classList, result); | ||
return result; | ||
} | ||
return function callTailwindMerge() { | ||
let classList = ''; | ||
let temp; // Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js | ||
for (let index = 0; index < arguments.length; index += 1) { | ||
if (temp = arguments[index]) { | ||
classList && (classList += ' '); | ||
classList += temp; | ||
} | ||
} | ||
return functionToCall(classList); | ||
}; | ||
} | ||
function fromTheme(key) { | ||
const themeGetter = theme => theme[key] || []; | ||
themeGetter.isThemeGetter = true; | ||
return themeGetter; | ||
} | ||
const arbitraryValueRegex = /^\[(.+)\]$/; | ||
const fractionRegex = /^\d+\/\d+$/; | ||
const stringLengths = new Set(['px', 'full', 'screen']); | ||
const tshirtUnitRegex = /^(\d+)?(xs|sm|md|lg|xl)$/; | ||
const lengthUnitRegex = /\d+(%|px|em|rem|vh|vw|pt|pc|in|cm|mm|cap|ch|ex|lh|rlh|vi|vb|vmin|vmax)/; | ||
function isLength(classPart) { | ||
return !Number.isNaN(Number(classPart)) || stringLengths.has(classPart) || fractionRegex.test(classPart) || isArbitraryLength(classPart); | ||
} | ||
function isArbitraryLength(classPart) { | ||
var _arbitraryValueRegex$; | ||
const arbitraryValue = (_arbitraryValueRegex$ = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$[1]; | ||
if (arbitraryValue) { | ||
return arbitraryValue.startsWith('length:') || lengthUnitRegex.test(arbitraryValue); | ||
} | ||
return false; | ||
} | ||
function isArbitrarySize(classPart) { | ||
var _arbitraryValueRegex$2; | ||
const arbitraryValue = (_arbitraryValueRegex$2 = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$2[1]; | ||
return arbitraryValue ? arbitraryValue.startsWith('size:') : false; | ||
} | ||
function isArbitraryPosition(classPart) { | ||
var _arbitraryValueRegex$3; | ||
const arbitraryValue = (_arbitraryValueRegex$3 = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$3[1]; | ||
return arbitraryValue ? arbitraryValue.startsWith('position:') : false; | ||
} | ||
function isArbitraryUrl(classPart) { | ||
var _arbitraryValueRegex$4; | ||
const arbitraryValue = (_arbitraryValueRegex$4 = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$4[1]; | ||
return arbitraryValue ? arbitraryValue.startsWith('url(') || arbitraryValue.startsWith('url:') : false; | ||
} | ||
function isArbitraryWeight(classPart) { | ||
var _arbitraryValueRegex$5; | ||
const arbitraryValue = (_arbitraryValueRegex$5 = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$5[1]; | ||
return arbitraryValue ? !Number.isNaN(Number(arbitraryValue)) || arbitraryValue.startsWith('weight:') : false; | ||
} | ||
function isInteger(classPart) { | ||
var _arbitraryValueRegex$6; | ||
const arbitraryValue = (_arbitraryValueRegex$6 = arbitraryValueRegex.exec(classPart)) == null ? void 0 : _arbitraryValueRegex$6[1]; | ||
if (arbitraryValue) { | ||
return Number.isInteger(Number(arbitraryValue)); | ||
} | ||
return Number.isInteger(Number(classPart)); | ||
} | ||
function isArbitraryValue(classPart) { | ||
return arbitraryValueRegex.test(classPart); | ||
} | ||
function isAny() { | ||
return true; | ||
} | ||
function isTshirtSize(classPart) { | ||
return tshirtUnitRegex.test(classPart); | ||
} | ||
var validators = { | ||
__proto__: null, | ||
isLength: isLength, | ||
isArbitraryLength: isArbitraryLength, | ||
isArbitrarySize: isArbitrarySize, | ||
isArbitraryPosition: isArbitraryPosition, | ||
isArbitraryUrl: isArbitraryUrl, | ||
isArbitraryWeight: isArbitraryWeight, | ||
isInteger: isInteger, | ||
isArbitraryValue: isArbitraryValue, | ||
isAny: isAny, | ||
isTshirtSize: isTshirtSize | ||
}; | ||
function getDefaultConfig() { | ||
const colors = fromTheme('colors'); | ||
const spacing = fromTheme('spacing'); | ||
const blur = fromTheme('blur'); | ||
const brightness = fromTheme('brightness'); | ||
const borderColor = fromTheme('borderColor'); | ||
const borderRadius = fromTheme('borderRadius'); | ||
const borderWidth = fromTheme('borderWidth'); | ||
const contrast = fromTheme('contrast'); | ||
const grayscale = fromTheme('grayscale'); | ||
const hueRotate = fromTheme('hueRotate'); | ||
const invert = fromTheme('invert'); | ||
const gap = fromTheme('gap'); | ||
const gradientColorStops = fromTheme('gradientColorStops'); | ||
const inset = fromTheme('inset'); | ||
const margin = fromTheme('margin'); | ||
const opacity = fromTheme('opacity'); | ||
const padding = fromTheme('padding'); | ||
const saturate = fromTheme('saturate'); | ||
const scale = fromTheme('scale'); | ||
const sepia = fromTheme('sepia'); | ||
const skew = fromTheme('skew'); | ||
const space = fromTheme('space'); | ||
const translate = fromTheme('translate'); | ||
const getOverscroll = () => ['auto', 'contain', 'none']; | ||
const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll']; | ||
const getSpacingWithAuto = () => ['auto', spacing]; | ||
const getLengthWithEmpty = () => ['', isLength]; | ||
const getIntegerWithAuto = () => ['auto', isInteger]; | ||
const getPositions = () => ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top']; | ||
const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none']; | ||
const getBlendModes = () => [{ | ||
blend: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'] | ||
}]; | ||
const getAlign = () => ['start', 'end', 'center', 'between', 'around', 'evenly']; | ||
const getZeroAndEmpty = () => ['', '0']; | ||
const getBreaks = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column']; | ||
return { | ||
cacheSize: 500, | ||
theme: { | ||
colors: [isAny], | ||
spacing: [isLength], | ||
blur: ['none', '', isTshirtSize, isArbitraryLength], | ||
brightness: [isInteger], | ||
borderColor: [colors], | ||
borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryLength], | ||
borderWidth: getLengthWithEmpty(), | ||
contrast: [isInteger], | ||
grayscale: getZeroAndEmpty(), | ||
hueRotate: [isInteger], | ||
invert: getZeroAndEmpty(), | ||
gap: [spacing], | ||
gradientColorStops: [colors], | ||
inset: getSpacingWithAuto(), | ||
margin: getSpacingWithAuto(), | ||
opacity: [isInteger], | ||
padding: [spacing], | ||
saturate: [isInteger], | ||
scale: [isInteger], | ||
sepia: getZeroAndEmpty(), | ||
skew: [isInteger], | ||
space: [spacing], | ||
translate: [spacing] | ||
}, | ||
classGroups: { | ||
// Layout | ||
/** | ||
* Aspect Ratio | ||
* @see https://tailwindcss.com/docs/aspect-ratio | ||
*/ | ||
aspect: [{ | ||
aspect: ['auto', 'square', 'video', isArbitraryValue] | ||
}], | ||
/** | ||
* Container | ||
* @see https://tailwindcss.com/docs/container | ||
*/ | ||
container: ['container'], | ||
/** | ||
* Columns | ||
* @see https://tailwindcss.com/docs/columns | ||
*/ | ||
columns: [{ | ||
columns: [isTshirtSize] | ||
}], | ||
/** | ||
* Break After | ||
* @see https://tailwindcss.com/docs/break-after | ||
*/ | ||
'break-after': [{ | ||
'break-after': getBreaks() | ||
}], | ||
/** | ||
* Break Before | ||
* @see https://tailwindcss.com/docs/break-before | ||
*/ | ||
'break-before': [{ | ||
'break-before': getBreaks() | ||
}], | ||
/** | ||
* Break Inside | ||
* @see https://tailwindcss.com/docs/break-inside | ||
*/ | ||
'break-inside': [{ | ||
'break-before': ['auto', 'avoid', 'avoid-page', 'avoid-column'] | ||
}], | ||
/** | ||
* Box Decoration Break | ||
* @see https://tailwindcss.com/docs/box-decoration-break | ||
*/ | ||
'box-decoration': [{ | ||
'box-decoration': ['slice', 'clone'] | ||
}], | ||
/** | ||
* Box Sizing | ||
* @see https://tailwindcss.com/docs/box-sizing | ||
*/ | ||
box: [{ | ||
box: ['border', 'content'] | ||
}], | ||
/** | ||
* Display | ||
* @see https://tailwindcss.com/docs/display | ||
*/ | ||
display: ['block', 'inline-block', 'inline', 'flex', 'inline-flex', 'table', 'inline-table', 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row-group', 'table-row', 'flow-root', 'grid', 'inline-grid', 'contents', 'list-item', 'hidden'], | ||
/** | ||
* Floats | ||
* @see https://tailwindcss.com/docs/float | ||
*/ | ||
float: [{ | ||
float: ['right', 'left', 'none'] | ||
}], | ||
/** | ||
* Clear | ||
* @see https://tailwindcss.com/docs/clear | ||
*/ | ||
clear: [{ | ||
clear: ['left', 'right', 'both', 'none'] | ||
}], | ||
/** | ||
* Isolation | ||
* @see https://tailwindcss.com/docs/isolation | ||
*/ | ||
isolation: ['isolate', 'isolation-auto'], | ||
/** | ||
* Object Fit | ||
* @see https://tailwindcss.com/docs/object-fit | ||
*/ | ||
'object-fit': [{ | ||
object: ['contain', 'cover', 'fill', 'none', 'scale-down'] | ||
}], | ||
/** | ||
* Object Position | ||
* @see https://tailwindcss.com/docs/object-position | ||
*/ | ||
'object-position': [{ | ||
object: getPositions() | ||
}], | ||
/** | ||
* Overflow | ||
* @see https://tailwindcss.com/docs/overflow | ||
*/ | ||
overflow: [{ | ||
overflow: getOverflow() | ||
}], | ||
/** | ||
* Overflow X | ||
* @see https://tailwindcss.com/docs/overflow | ||
*/ | ||
'overflow-x': [{ | ||
'overflow-x': getOverflow() | ||
}], | ||
/** | ||
* Overflow Y | ||
* @see https://tailwindcss.com/docs/overflow | ||
*/ | ||
'overflow-y': [{ | ||
'overflow-y': getOverflow() | ||
}], | ||
/** | ||
* Overscroll Behavior | ||
* @see https://tailwindcss.com/docs/overscroll-behavior | ||
*/ | ||
overscroll: [{ | ||
overscroll: getOverscroll() | ||
}], | ||
/** | ||
* Overscroll Behavior X | ||
* @see https://tailwindcss.com/docs/overscroll-behavior | ||
*/ | ||
'overscroll-x': [{ | ||
'overscroll-x': getOverscroll() | ||
}], | ||
/** | ||
* Overscroll Behavior Y | ||
* @see https://tailwindcss.com/docs/overscroll-behavior | ||
*/ | ||
'overscroll-y': [{ | ||
'overscroll-y': getOverscroll() | ||
}], | ||
/** | ||
* Position | ||
* @see https://tailwindcss.com/docs/position | ||
*/ | ||
position: ['static', 'fixed', 'absolute', 'relative', 'sticky'], | ||
/** | ||
* Top / Right / Bottom / Left | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
inset: [{ | ||
inset: [inset] | ||
}], | ||
/** | ||
* Right / Left | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
'inset-x': [{ | ||
'inset-x': [inset] | ||
}], | ||
/** | ||
* Top / Bottom | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
'inset-y': [{ | ||
'inset-y': [inset] | ||
}], | ||
/** | ||
* Top | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
top: [{ | ||
top: [inset] | ||
}], | ||
/** | ||
* Right | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
right: [{ | ||
right: [inset] | ||
}], | ||
/** | ||
* Bottom | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
bottom: [{ | ||
bottom: [inset] | ||
}], | ||
/** | ||
* Left | ||
* @see https://tailwindcss.com/docs/top-right-bottom-left | ||
*/ | ||
left: [{ | ||
left: [inset] | ||
}], | ||
/** | ||
* Visibility | ||
* @see https://tailwindcss.com/docs/visibility | ||
*/ | ||
visibility: ['visible', 'invisible'], | ||
/** | ||
* Z-Index | ||
* @see https://tailwindcss.com/docs/z-index | ||
*/ | ||
z: [{ | ||
z: [isLength] | ||
}], | ||
// Flexbox and Grid | ||
/** | ||
* Flex Basis | ||
* @see https://tailwindcss.com/docs/flex-basis | ||
*/ | ||
basis: [{ | ||
basis: [spacing] | ||
}], | ||
/** | ||
* Flex Direction | ||
* @see https://tailwindcss.com/docs/flex-direction | ||
*/ | ||
'flex-direction': [{ | ||
flex: ['row', 'row-reverse', 'col', 'col-reverse'] | ||
}], | ||
/** | ||
* Flex Wrap | ||
* @see https://tailwindcss.com/docs/flex-wrap | ||
*/ | ||
'flex-wrap': [{ | ||
flex: ['wrap', 'wrap-reverse', 'nowrap'] | ||
}], | ||
/** | ||
* Flex | ||
* @see https://tailwindcss.com/docs/flex | ||
*/ | ||
flex: [{ | ||
flex: ['1', 'auto', 'initial', 'none', isArbitraryValue] | ||
}], | ||
/** | ||
* Flex Grow | ||
* @see https://tailwindcss.com/docs/flex-grow | ||
*/ | ||
grow: [{ | ||
grow: getZeroAndEmpty() | ||
}], | ||
/** | ||
* Flex Shrink | ||
* @see https://tailwindcss.com/docs/flex-shrink | ||
*/ | ||
shrink: [{ | ||
shrink: getZeroAndEmpty() | ||
}], | ||
/** | ||
* Order | ||
* @see https://tailwindcss.com/docs/order | ||
*/ | ||
order: [{ | ||
order: ['first', 'last', 'none', isInteger] | ||
}], | ||
/** | ||
* Grid Template Columns | ||
* @see https://tailwindcss.com/docs/grid-template-columns | ||
*/ | ||
'grid-cols': [{ | ||
'grid-cols': [isAny] | ||
}], | ||
/** | ||
* Grid Column Start / End | ||
* @see https://tailwindcss.com/docs/grid-column | ||
*/ | ||
'col-start-end': [{ | ||
col: ['auto', { | ||
span: [isInteger] | ||
}] | ||
}], | ||
/** | ||
* Grid Column Start | ||
* @see https://tailwindcss.com/docs/grid-column | ||
*/ | ||
'col-start': [{ | ||
'col-start': getIntegerWithAuto() | ||
}], | ||
/** | ||
* Grid Column End | ||
* @see https://tailwindcss.com/docs/grid-column | ||
*/ | ||
'col-end': [{ | ||
'col-end': getIntegerWithAuto() | ||
}], | ||
/** | ||
* Grid Template Rows | ||
* @see https://tailwindcss.com/docs/grid-template-rows | ||
*/ | ||
'grid-rows': [{ | ||
'grid-rows': [isAny] | ||
}], | ||
/** | ||
* Grid Row Start / End | ||
* @see https://tailwindcss.com/docs/grid-row | ||
*/ | ||
'row-start-end': [{ | ||
row: ['auto', { | ||
span: [isInteger] | ||
}] | ||
}], | ||
/** | ||
* Grid Row Start | ||
* @see https://tailwindcss.com/docs/grid-row | ||
*/ | ||
'row-start': [{ | ||
'row-start': getIntegerWithAuto() | ||
}], | ||
/** | ||
* Grid Row End | ||
* @see https://tailwindcss.com/docs/grid-row | ||
*/ | ||
'row-end': [{ | ||
'row-end': getIntegerWithAuto() | ||
}], | ||
/** | ||
* Grid Auto Flow | ||
* @see https://tailwindcss.com/docs/grid-auto-flow | ||
*/ | ||
'grid-flow': [{ | ||
'grid-flow': ['row', 'col', 'row-dense', 'col-dense'] | ||
}], | ||
/** | ||
* Grid Auto Columns | ||
* @see https://tailwindcss.com/docs/grid-auto-columns | ||
*/ | ||
'auto-cols': [{ | ||
'auto-cols': ['auto', 'min', 'max', 'fr', isArbitraryValue] | ||
}], | ||
/** | ||
* Grid Auto Rows | ||
* @see https://tailwindcss.com/docs/grid-auto-rows | ||
*/ | ||
'auto-rows': [{ | ||
'auto-rows': ['auto', 'min', 'max', 'fr', isArbitraryValue] | ||
}], | ||
/** | ||
* Gap | ||
* @see https://tailwindcss.com/docs/gap | ||
*/ | ||
gap: [{ | ||
gap: [gap] | ||
}], | ||
/** | ||
* Gap X | ||
* @see https://tailwindcss.com/docs/gap | ||
*/ | ||
'gap-x': [{ | ||
'gap-x': [gap] | ||
}], | ||
/** | ||
* Gap Y | ||
* @see https://tailwindcss.com/docs/gap | ||
*/ | ||
'gap-y': [{ | ||
'gap-y': [gap] | ||
}], | ||
/** | ||
* Justify Content | ||
* @see https://tailwindcss.com/docs/justify-content | ||
*/ | ||
'justify-content': [{ | ||
justify: getAlign() | ||
}], | ||
/** | ||
* Justify Items | ||
* @see https://tailwindcss.com/docs/justify-items | ||
*/ | ||
'justify-items': [{ | ||
'justify-items': ['start', 'end', 'center', 'stretch'] | ||
}], | ||
/** | ||
* Justify Self | ||
* @see https://tailwindcss.com/docs/justify-self | ||
*/ | ||
'justify-self': [{ | ||
'justify-self': ['auto', 'start', 'end', 'center', 'stretch'] | ||
}], | ||
/** | ||
* Align Content | ||
* @see https://tailwindcss.com/docs/align-content | ||
*/ | ||
'align-content': [{ | ||
content: getAlign() | ||
}], | ||
/** | ||
* Align Items | ||
* @see https://tailwindcss.com/docs/align-items | ||
*/ | ||
'align-items': [{ | ||
items: ['start', 'end', 'center', 'baseline', 'stretch'] | ||
}], | ||
/** | ||
* Align Self | ||
* @see https://tailwindcss.com/docs/align-self | ||
*/ | ||
'align-self': [{ | ||
self: ['auto', 'start', 'end', 'center', 'stretch', 'baseline'] | ||
}], | ||
/** | ||
* Place Content | ||
* @see https://tailwindcss.com/docs/place-content | ||
*/ | ||
'place-content': [{ | ||
'place-content': [...getAlign(), 'stretch'] | ||
}], | ||
/** | ||
* Place Items | ||
* @see https://tailwindcss.com/docs/place-items | ||
*/ | ||
'place-items': [{ | ||
'place-items': ['start', 'end', 'center', 'stretch'] | ||
}], | ||
/** | ||
* Place Self | ||
* @see https://tailwindcss.com/docs/place-self | ||
*/ | ||
'place-self': [{ | ||
'place-self': ['auto', 'start', 'end', 'center', 'stretch'] | ||
}], | ||
// Spacing | ||
/** | ||
* Padding | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
p: [{ | ||
p: [padding] | ||
}], | ||
/** | ||
* Padding X | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
px: [{ | ||
px: [padding] | ||
}], | ||
/** | ||
* Padding Y | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
py: [{ | ||
py: [padding] | ||
}], | ||
/** | ||
* Padding Top | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
pt: [{ | ||
pt: [padding] | ||
}], | ||
/** | ||
* Padding Right | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
pr: [{ | ||
pr: [padding] | ||
}], | ||
/** | ||
* Padding Bottom | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
pb: [{ | ||
pb: [padding] | ||
}], | ||
/** | ||
* Padding Left | ||
* @see https://tailwindcss.com/docs/padding | ||
*/ | ||
pl: [{ | ||
pl: [padding] | ||
}], | ||
/** | ||
* Margin | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
m: [{ | ||
m: [margin] | ||
}], | ||
/** | ||
* Margin X | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
mx: [{ | ||
mx: [margin] | ||
}], | ||
/** | ||
* Margin Y | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
my: [{ | ||
my: [margin] | ||
}], | ||
/** | ||
* Margin Top | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
mt: [{ | ||
mt: [margin] | ||
}], | ||
/** | ||
* Margin Right | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
mr: [{ | ||
mr: [margin] | ||
}], | ||
/** | ||
* Margin Bottom | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
mb: [{ | ||
mb: [margin] | ||
}], | ||
/** | ||
* Margin Left | ||
* @see https://tailwindcss.com/docs/margin | ||
*/ | ||
ml: [{ | ||
ml: [margin] | ||
}], | ||
/** | ||
* Space Between X | ||
* @see https://tailwindcss.com/docs/space | ||
*/ | ||
'space-x': [{ | ||
'space-x': [space] | ||
}], | ||
/** | ||
* Space Between X Reverse | ||
* @see https://tailwindcss.com/docs/space | ||
*/ | ||
'space-x-reverse': ['space-x-reverse'], | ||
/** | ||
* Space Between Y | ||
* @see https://tailwindcss.com/docs/space | ||
*/ | ||
'space-y': [{ | ||
'space-y': [space] | ||
}], | ||
/** | ||
* Space Between Y Reverse | ||
* @see https://tailwindcss.com/docs/space | ||
*/ | ||
'space-y-reverse': ['space-y-reverse'], | ||
// Sizing | ||
/** | ||
* Width | ||
* @see https://tailwindcss.com/docs/width | ||
*/ | ||
w: [{ | ||
w: ['auto', 'min', 'max', spacing] | ||
}], | ||
/** | ||
* Min-Width | ||
* @see https://tailwindcss.com/docs/min-width | ||
*/ | ||
'min-w': [{ | ||
'min-w': ['min', 'max', 'fit', isLength] | ||
}], | ||
/** | ||
* Max-Width | ||
* @see https://tailwindcss.com/docs/max-width | ||
*/ | ||
'max-w': [{ | ||
'max-w': ['0', 'none', 'full', 'min', 'max', 'fit', 'prose', { | ||
screen: [isTshirtSize] | ||
}, isTshirtSize, isArbitraryLength] | ||
}], | ||
/** | ||
* Height | ||
* @see https://tailwindcss.com/docs/height | ||
*/ | ||
h: [{ | ||
h: getSpacingWithAuto() | ||
}], | ||
/** | ||
* Min-Height | ||
* @see https://tailwindcss.com/docs/min-height | ||
*/ | ||
'min-h': [{ | ||
'min-h': ['min', 'max', 'fit', isLength] | ||
}], | ||
/** | ||
* Max-Height | ||
* @see https://tailwindcss.com/docs/max-height | ||
*/ | ||
'max-h': [{ | ||
'max-h': [spacing, 'min', 'max', 'fit'] | ||
}], | ||
// Typography | ||
/** | ||
* Font Size | ||
* @see https://tailwindcss.com/docs/font-size | ||
*/ | ||
'font-size': [{ | ||
text: ['base', isTshirtSize, isArbitraryLength] | ||
}], | ||
/** | ||
* Font Smoothing | ||
* @see https://tailwindcss.com/docs/font-smoothing | ||
*/ | ||
'font-smoothing': ['antialiased', 'subpixel-antialiased'], | ||
/** | ||
* Font Style | ||
* @see https://tailwindcss.com/docs/font-style | ||
*/ | ||
'font-style': ['italic', 'not-italic'], | ||
/** | ||
* Font Weight | ||
* @see https://tailwindcss.com/docs/font-weight | ||
*/ | ||
'font-weight': [{ | ||
font: ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black', isArbitraryWeight] | ||
}], | ||
/** | ||
* Font Family | ||
* @see https://tailwindcss.com/docs/font-family | ||
*/ | ||
'font-family': [{ | ||
font: [isAny] | ||
}], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-normal': ['normal-nums'], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-ordinal': ['ordinal'], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-slashed-zero': ['slashed-zero'], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-figure': ['lining-nums', 'oldstyle-nums'], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-spacing': ['proportional-nums', 'tabular-nums'], | ||
/** | ||
* Font Variant Numeric | ||
* @see https://tailwindcss.com/docs/font-variant-numeric | ||
*/ | ||
'fvn-fraction': ['diagonal-fractions', 'stacked-fractons'], | ||
/** | ||
* Letter Spacing | ||
* @see https://tailwindcss.com/docs/letter-spacing | ||
*/ | ||
tracking: [{ | ||
tracking: ['tighter', 'tight', 'normal', 'wide', 'wider', 'widest', isArbitraryLength] | ||
}], | ||
/** | ||
* Line Height | ||
* @see https://tailwindcss.com/docs/line-height | ||
*/ | ||
leading: [{ | ||
leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose', isLength] | ||
}], | ||
/** | ||
* List Style Type | ||
* @see https://tailwindcss.com/docs/list-style-type | ||
*/ | ||
'list-style-type': [{ | ||
list: ['none', 'disc', 'decimal', isArbitraryValue] | ||
}], | ||
/** | ||
* List Style Position | ||
* @see https://tailwindcss.com/docs/list-style-position | ||
*/ | ||
'list-style-position': [{ | ||
list: ['inside', 'outside'] | ||
}], | ||
/** | ||
* Placeholder Color | ||
* @see https://tailwindcss.com/docs/placeholder-color | ||
*/ | ||
'placeholder-color': [{ | ||
placeholder: [colors] | ||
}], | ||
/** | ||
* Placeholder Opacity | ||
* @see https://tailwindcss.com/docs/placeholder-opacity | ||
*/ | ||
'placeholder-opacity': [{ | ||
'placeholder-opacity': [opacity] | ||
}], | ||
/** | ||
* Text Alignment | ||
* @see https://tailwindcss.com/docs/text-align | ||
*/ | ||
'text-alignment': [{ | ||
text: ['left', 'center', 'right', 'justify'] | ||
}], | ||
/** | ||
* Text Color | ||
* @see https://tailwindcss.com/docs/text-color | ||
*/ | ||
'text-color': [{ | ||
text: [colors] | ||
}], | ||
/** | ||
* Text Opacity | ||
* @see https://tailwindcss.com/docs/text-opacity | ||
*/ | ||
'text-opacity': [{ | ||
'text-opacity': [opacity] | ||
}], | ||
/** | ||
* Text Decoration | ||
* @see https://tailwindcss.com/docs/text-decoration | ||
*/ | ||
'text-decoration': ['underline', 'line-through', 'no-underline'], | ||
/** | ||
* Text Decoration Style | ||
* @see https://tailwindcss.com/docs/text-decoration-style | ||
*/ | ||
'text-decoration-style': [{ | ||
decoration: [...getLineStyles(), 'wavy'] | ||
}], | ||
/** | ||
* Text Decoration Thickness | ||
* @see https://tailwindcss.com/docs/text-decoration-thickness | ||
*/ | ||
'text-decoration-thickness': [{ | ||
decoration: ['auto', 'from-font', isLength] | ||
}], | ||
/** | ||
* Text Decoration Color | ||
* @see https://tailwindcss.com/docs/text-decoration-color | ||
*/ | ||
'text-decoration-color': [{ | ||
decoration: [colors] | ||
}], | ||
/** | ||
* Text Transform | ||
* @see https://tailwindcss.com/docs/text-transform | ||
*/ | ||
'text-transform': ['uppercase', 'lowercase', 'capitalize', 'normal-case'], | ||
/** | ||
* Scroll Behavior | ||
* @see https://github.com/tailwindlabs/tailwindcss.com/issues/1016 | ||
*/ | ||
'scroll-behavior': [{ | ||
scroll: ['smooth', 'auto'] | ||
}], | ||
/** | ||
* Text Overflow | ||
* @see https://tailwindcss.com/docs/text-overflow | ||
*/ | ||
'text-overflow': ['truncate', 'text-ellipsis', 'text-clip'], | ||
/** | ||
* Text Indent | ||
* @see https://tailwindcss.com/docs/text-indent | ||
*/ | ||
indent: [{ | ||
indent: [spacing] | ||
}], | ||
/** | ||
* Vertical Alignment | ||
* @see https://tailwindcss.com/docs/vertical-align | ||
*/ | ||
'vertical-align': [{ | ||
align: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super', isArbitraryLength] | ||
}], | ||
/** | ||
* Whitespace | ||
* @see https://tailwindcss.com/docs/whitespace | ||
*/ | ||
whitespace: [{ | ||
whitespace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap'] | ||
}], | ||
/** | ||
* Word Break | ||
* @see https://tailwindcss.com/docs/word-break | ||
*/ | ||
break: [{ | ||
break: ['normal', 'words', 'all'] | ||
}], | ||
// Backgrounds | ||
/** | ||
* Background Attachment | ||
* @see https://tailwindcss.com/docs/background-attachment | ||
*/ | ||
'bg-attachment': [{ | ||
bg: ['fixed', 'local', 'scroll'] | ||
}], | ||
/** | ||
* Background Clip | ||
* @see https://tailwindcss.com/docs/background-clip | ||
*/ | ||
'bg-clip': [{ | ||
'bg-clip': ['border', 'padding', 'content', 'text'] | ||
}], | ||
/** | ||
* Background Opacity | ||
* @see https://tailwindcss.com/docs/background-opacity | ||
*/ | ||
'bg-opacity': [{ | ||
'bg-opacity': [opacity] | ||
}], | ||
/** | ||
* Background Origin | ||
* @see https://tailwindcss.com/docs/background-origin | ||
*/ | ||
'bg-origin': [{ | ||
'bg-origin': ['border', 'padding', 'content'] | ||
}], | ||
/** | ||
* Background Position | ||
* @see https://tailwindcss.com/docs/background-position | ||
*/ | ||
'bg-position': [{ | ||
bg: [...getPositions(), isArbitraryPosition] | ||
}], | ||
/** | ||
* Background Repeat | ||
* @see https://tailwindcss.com/docs/background-repeat | ||
*/ | ||
'bg-repeeat': [{ | ||
bg: ['no-repeat', { | ||
repeat: ['', 'x', 'y', 'round', 'space'] | ||
}] | ||
}], | ||
/** | ||
* Background Size | ||
* @see https://tailwindcss.com/docs/background-size | ||
*/ | ||
'bg-size': [{ | ||
bg: ['auto', 'cover', 'contain', isArbitrarySize] | ||
}], | ||
/** | ||
* Background Image | ||
* @see https://tailwindcss.com/docs/background-image | ||
*/ | ||
'bg-image': [{ | ||
bg: ['none', { | ||
'gradient-to': ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl'] | ||
}, isArbitraryUrl] | ||
}], | ||
/** | ||
* Background Blend Mode | ||
* @see https://tailwindcss.com/docs/background-blend-mode | ||
*/ | ||
'bg-blend': [{ | ||
bg: getBlendModes() | ||
}], | ||
/** | ||
* Background Color | ||
* @see https://tailwindcss.com/docs/background-color | ||
*/ | ||
'bg-color': [{ | ||
bg: [colors] | ||
}], | ||
/** | ||
* Gradient Color Stops From | ||
* @see https://tailwindcss.com/docs/gradient-color-stops | ||
*/ | ||
'gradient-from': [{ | ||
from: [gradientColorStops] | ||
}], | ||
/** | ||
* Gradient Color Stops Via | ||
* @see https://tailwindcss.com/docs/gradient-color-stops | ||
*/ | ||
'gradient-via': [{ | ||
via: [gradientColorStops] | ||
}], | ||
/** | ||
* Gradient Color Stops To | ||
* @see https://tailwindcss.com/docs/gradient-color-stops | ||
*/ | ||
'gradient-to': [{ | ||
to: [gradientColorStops] | ||
}], | ||
// Borders | ||
/** | ||
* Border Radius | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
rounded: [{ | ||
rounded: [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Top | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-t': [{ | ||
'rounded-t': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Right | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-r': [{ | ||
'rounded-r': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Bottom | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-b': [{ | ||
'rounded-b': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Left | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-l': [{ | ||
'rounded-l': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Top Left | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-tl': [{ | ||
'rounded-tl': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Top Right | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-tr': [{ | ||
'rounded-tr': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Bottom Right | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-br': [{ | ||
'rounded-br': [borderRadius] | ||
}], | ||
/** | ||
* Border Radius Bottom Left | ||
* @see https://tailwindcss.com/docs/border-radius | ||
*/ | ||
'rounded-bl': [{ | ||
'rounded-bl': [borderRadius] | ||
}], | ||
/** | ||
* Border Width | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w': [{ | ||
border: [borderWidth] | ||
}], | ||
/** | ||
* Border Width X | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-x': [{ | ||
'border-x': [borderWidth] | ||
}], | ||
/** | ||
* Border Width Y | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-y': [{ | ||
'border-y': [borderWidth] | ||
}], | ||
/** | ||
* Border Width Top | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-t': [{ | ||
'border-t': [borderWidth] | ||
}], | ||
/** | ||
* Border Width Right | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-r': [{ | ||
'border-r': [borderWidth] | ||
}], | ||
/** | ||
* Border Width Bottom | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-b': [{ | ||
'border-b': [borderWidth] | ||
}], | ||
/** | ||
* Border Width Left | ||
* @see https://tailwindcss.com/docs/border-width | ||
*/ | ||
'border-w-l': [{ | ||
'border-l': [borderWidth] | ||
}], | ||
/** | ||
* Border Opacity | ||
* @see https://tailwindcss.com/docs/border-opacity | ||
*/ | ||
'border-opacity': [{ | ||
'border-opacity': [opacity] | ||
}], | ||
/** | ||
* Border Style | ||
* @see https://tailwindcss.com/docs/border-style | ||
*/ | ||
'border-style': [{ | ||
border: [...getLineStyles(), 'hidden'] | ||
}], | ||
/** | ||
* Divide Width X | ||
* @see https://tailwindcss.com/docs/divide-width | ||
*/ | ||
'divide-x': [{ | ||
'divide-x': [borderWidth] | ||
}], | ||
/** | ||
* Divide Width X Reverse | ||
* @see https://tailwindcss.com/docs/divide-width | ||
*/ | ||
'divide-x-reverse': ['divide-x-reverse'], | ||
/** | ||
* Divide Width Y | ||
* @see https://tailwindcss.com/docs/divide-width | ||
*/ | ||
'divide-y': [{ | ||
'divide-y': [borderWidth] | ||
}], | ||
/** | ||
* Divide Width Y Reverse | ||
* @see https://tailwindcss.com/docs/divide-width | ||
*/ | ||
'divide-y-reverse': ['divide-y-reverse'], | ||
/** | ||
* Divide Opacity | ||
* @see https://tailwindcss.com/docs/divide-opacity | ||
*/ | ||
'divide-opacity': [{ | ||
'divide-opacity': [opacity] | ||
}], | ||
/** | ||
* Divide Style | ||
* @see https://tailwindcss.com/docs/divide-style | ||
*/ | ||
'divide-style': [{ | ||
divide: getLineStyles() | ||
}], | ||
/** | ||
* Border Color | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color': [{ | ||
border: [borderColor] | ||
}], | ||
/** | ||
* Border Color X | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-x': [{ | ||
'border-x': [borderColor] | ||
}], | ||
/** | ||
* Border Color Y | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-y': [{ | ||
'border-y': [borderColor] | ||
}], | ||
/** | ||
* Border Color Top | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-t': [{ | ||
'border-t': [borderColor] | ||
}], | ||
/** | ||
* Border Color Right | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-r': [{ | ||
'border-r': [borderColor] | ||
}], | ||
/** | ||
* Border Color Bottom | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-b': [{ | ||
'border-b': [borderColor] | ||
}], | ||
/** | ||
* Border Color Left | ||
* @see https://tailwindcss.com/docs/border-color | ||
*/ | ||
'border-color-l': [{ | ||
'border-l': [borderColor] | ||
}], | ||
/** | ||
* Divide Color | ||
* @see https://tailwindcss.com/docs/divide-color | ||
*/ | ||
'divide-color': [{ | ||
divide: [borderColor] | ||
}], | ||
/** | ||
* Ring Width | ||
* @see https://tailwindcss.com/docs/ring-width | ||
*/ | ||
'ring-w': [{ | ||
ring: getLengthWithEmpty() | ||
}], | ||
/** | ||
* Ring Width Inset | ||
* @see https://tailwindcss.com/docs/ring-width | ||
*/ | ||
'ring-w-inset': ['ring-inset'], | ||
/** | ||
* Ring Color | ||
* @see https://tailwindcss.com/docs/ring-color | ||
*/ | ||
'ring-color': [{ | ||
ring: [colors] | ||
}], | ||
/** | ||
* Ring Opacity | ||
* @see https://tailwindcss.com/docs/ring-opacity | ||
*/ | ||
'ring-opacity': [{ | ||
'ring-opacity': [opacity] | ||
}], | ||
/** | ||
* Ring Offset Width | ||
* @see https://tailwindcss.com/docs/ring-offset-width | ||
*/ | ||
'ring-offset-w': [{ | ||
'ring-offset': [isLength] | ||
}], | ||
/** | ||
* Ring Offset Color | ||
* @see https://tailwindcss.com/docs/ring-offset-color | ||
*/ | ||
'ring-offset-color': [{ | ||
'ring-offset': [colors] | ||
}], | ||
// Effects | ||
/** | ||
* Box Shadow | ||
* @see https://tailwindcss.com/docs/box-shadow | ||
*/ | ||
shadow: [{ | ||
shadow: ['', 'inner', 'none', isTshirtSize] | ||
}], | ||
/** | ||
* Box Shadow Color | ||
* @see https://tailwindcss.com/docs/box-shadow-color | ||
*/ | ||
'shadow-color': [{ | ||
shadow: [isAny] | ||
}], | ||
/** | ||
* Opacity | ||
* @see https://tailwindcss.com/docs/opacity | ||
*/ | ||
opacity: [{ | ||
opacity: [opacity] | ||
}], | ||
/** | ||
* Mix Beldn Mode | ||
* @see https://tailwindcss.com/docs/mix-blend-mode | ||
*/ | ||
'mix-blend': [{ | ||
'mix-blend': getBlendModes() | ||
}], | ||
// Filters | ||
/** | ||
* Filter | ||
* @see https://tailwindcss.com/docs/filter | ||
*/ | ||
filter: [{ | ||
filter: ['', 'none'] | ||
}], | ||
/** | ||
* Blur | ||
* @see https://tailwindcss.com/docs/blur | ||
*/ | ||
blur: [{ | ||
blur: [blur] | ||
}], | ||
/** | ||
* Brightness | ||
* @see https://tailwindcss.com/docs/brightness | ||
*/ | ||
brightness: [{ | ||
brightness: [brightness] | ||
}], | ||
/** | ||
* Contrast | ||
* @see https://tailwindcss.com/docs/contrast | ||
*/ | ||
contrast: [{ | ||
contrast: [contrast] | ||
}], | ||
/** | ||
* Drop Shadow | ||
* @see https://tailwindcss.com/docs/drop-shadow | ||
*/ | ||
'drop-shadow': [{ | ||
'drop-shadow': ['', 'none', isTshirtSize] | ||
}], | ||
/** | ||
* Grayscale | ||
* @see https://tailwindcss.com/docs/grayscale | ||
*/ | ||
grayscale: [{ | ||
grayscale: [grayscale] | ||
}], | ||
/** | ||
* Hue Rotate | ||
* @see https://tailwindcss.com/docs/hue-rotate | ||
*/ | ||
'hue-rotate': [{ | ||
'hue-rotate': [hueRotate] | ||
}], | ||
/** | ||
* Invert | ||
* @see https://tailwindcss.com/docs/invert | ||
*/ | ||
invert: [{ | ||
invert: [invert] | ||
}], | ||
/** | ||
* Saturate | ||
* @see https://tailwindcss.com/docs/saturate | ||
*/ | ||
saturate: [{ | ||
saturate: [saturate] | ||
}], | ||
/** | ||
* Sepia | ||
* @see https://tailwindcss.com/docs/sepia | ||
*/ | ||
sepia: [{ | ||
sepia: [sepia] | ||
}], | ||
/** | ||
* Backdrop Filter | ||
* @see https://tailwindcss.com/docs/backdrop-filter | ||
*/ | ||
'backdrop-filter': [{ | ||
'backdrop-filter': ['', 'none'] | ||
}], | ||
/** | ||
* Backdrop Blur | ||
* @see https://tailwindcss.com/docs/backdrop-blur | ||
*/ | ||
'backdrop-blur': [{ | ||
'backdrop-blur': [blur] | ||
}], | ||
/** | ||
* Backdrop Brightness | ||
* @see https://tailwindcss.com/docs/backdrop-brightness | ||
*/ | ||
'backdrop-brightness': [{ | ||
'backdrop-brightness': [brightness] | ||
}], | ||
/** | ||
* Backdrop Contrast | ||
* @see https://tailwindcss.com/docs/backdrop-contrast | ||
*/ | ||
'backdrop-contrast': [{ | ||
'backdrop-contrast': [contrast] | ||
}], | ||
/** | ||
* Backdrop Grayscale | ||
* @see https://tailwindcss.com/docs/backdrop-grayscale | ||
*/ | ||
'backdrop-grayscale': [{ | ||
'backdrop-grayscale': [grayscale] | ||
}], | ||
/** | ||
* Backdrop Hue Rotate | ||
* @see https://tailwindcss.com/docs/backdrop-hue-rotate | ||
*/ | ||
'backdrop-hue-rotate': [{ | ||
'backdrop-hue-rotate': [hueRotate] | ||
}], | ||
/** | ||
* Backdrop Invert | ||
* @see https://tailwindcss.com/docs/backdrop-invert | ||
*/ | ||
'backdrop-invert': [{ | ||
'backdrop-invert': [invert] | ||
}], | ||
/** | ||
* Backdrop Opacity | ||
* @see https://tailwindcss.com/docs/backdrop-opacity | ||
*/ | ||
'backdrop-opacity': [{ | ||
'backdrop-opacity': [opacity] | ||
}], | ||
/** | ||
* Backdrop Saturate | ||
* @see https://tailwindcss.com/docs/backdrop-saturate | ||
*/ | ||
'backdrop-saturate': [{ | ||
'backdrop-saturate': [saturate] | ||
}], | ||
/** | ||
* Backdrop Sepia | ||
* @see https://tailwindcss.com/docs/backdrop-sepia | ||
*/ | ||
'backdrop-sepia': [{ | ||
'backdrop-sepia': [sepia] | ||
}], | ||
// Tables | ||
/** | ||
* Border Collapse | ||
* @see https://tailwindcss.com/docs/border-collapse | ||
*/ | ||
'border-collapse': [{ | ||
border: ['collapse', 'separate'] | ||
}], | ||
/** | ||
* Table Layout | ||
* @see https://tailwindcss.com/docs/table-layout | ||
*/ | ||
'table-layout': [{ | ||
table: ['auto', 'fixed'] | ||
}], | ||
// Transitions and Animation | ||
/** | ||
* Tranisition Property | ||
* @see https://tailwindcss.com/docs/transition-property | ||
*/ | ||
transition: [{ | ||
transition: ['none', 'all', '', 'colors', 'opacity', 'shadow', 'transform', isArbitraryValue] | ||
}], | ||
/** | ||
* Transition Duration | ||
* @see https://tailwindcss.com/docs/transition-duration | ||
*/ | ||
duration: [{ | ||
duration: [isInteger] | ||
}], | ||
/** | ||
* Transition Timing Function | ||
* @see https://tailwindcss.com/docs/transition-timing-function | ||
*/ | ||
ease: [{ | ||
ease: ['linear', 'in', 'out', 'in-out', isArbitraryValue] | ||
}], | ||
/** | ||
* Transition Delay | ||
* @see https://tailwindcss.com/docs/transition-delay | ||
*/ | ||
delay: [{ | ||
delay: [isInteger] | ||
}], | ||
/** | ||
* Animation | ||
* @see https://tailwindcss.com/docs/animation | ||
*/ | ||
animate: [{ | ||
animate: ['none', 'spin', 'ping', 'pulse', 'bounce', isArbitraryValue] | ||
}], | ||
// Transforms | ||
/** | ||
* Transform | ||
* @see https://tailwindcss.com/docs/transform | ||
*/ | ||
transform: [{ | ||
transform: ['', 'gpu', 'none'] | ||
}], | ||
/** | ||
* Transform Origin | ||
* @see https://tailwindcss.com/docs/transform-origin | ||
*/ | ||
'transform-origin': [{ | ||
origin: ['center', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'left', 'top-left'] | ||
}], | ||
/** | ||
* Scale | ||
* @see https://tailwindcss.com/docs/scale | ||
*/ | ||
scale: [{ | ||
scale: [scale] | ||
}], | ||
/** | ||
* Scale X | ||
* @see https://tailwindcss.com/docs/scale | ||
*/ | ||
'scale-x': [{ | ||
'scale-x': [scale] | ||
}], | ||
/** | ||
* Scale Y | ||
* @see https://tailwindcss.com/docs/scale | ||
*/ | ||
'scale-y': [{ | ||
'scale-y': [scale] | ||
}], | ||
/** | ||
* Rotate | ||
* @see https://tailwindcss.com/docs/rotate | ||
*/ | ||
rotate: [{ | ||
rotate: [isInteger] | ||
}], | ||
/** | ||
* Translate X | ||
* @see https://tailwindcss.com/docs/translate | ||
*/ | ||
'translate-x': [{ | ||
'translate-x': [translate] | ||
}], | ||
/** | ||
* Translate Y | ||
* @see https://tailwindcss.com/docs/translate | ||
*/ | ||
'translate-y': [{ | ||
'translate-y': [translate] | ||
}], | ||
/** | ||
* Skew X | ||
* @see https://tailwindcss.com/docs/skew | ||
*/ | ||
'skew-x': [{ | ||
'skew-x': [skew] | ||
}], | ||
/** | ||
* Skew Y | ||
* @see https://tailwindcss.com/docs/skew | ||
*/ | ||
'skew-y': [{ | ||
'skew-y': [skew] | ||
}], | ||
// Interactivity | ||
/** | ||
* Accent Color | ||
* @see https://tailwindcss.com/docs/accent-color | ||
*/ | ||
accent: [{ | ||
accent: ['auto', colors] | ||
}], | ||
/** | ||
* Appearance | ||
* @see https://tailwindcss.com/docs/appearance | ||
*/ | ||
appearance: ['appearance-none'], | ||
/** | ||
* Cursor | ||
* @see https://tailwindcss.com/docs/cursor | ||
*/ | ||
cursor: [{ | ||
cursor: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'help', 'not-allowed', 'none', 'context-menu', 'progress', 'cell', 'crosshair', 'vertical-text', 'alias', 'copy', 'no-drop', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', isArbitraryValue] | ||
}], | ||
/** | ||
* Outline Width | ||
* @see https://tailwindcss.com/docs/outline-width | ||
*/ | ||
'outline-w': [{ | ||
outline: [isLength] | ||
}], | ||
/** | ||
* Outline Style | ||
* @see https://tailwindcss.com/docs/outline-style | ||
*/ | ||
'outline-style': [{ | ||
outline: ['', ...getLineStyles(), 'hidden'] | ||
}], | ||
/** | ||
* Outline Offset | ||
* @see https://tailwindcss.com/docs/outline-offset | ||
*/ | ||
'outline-offset': [{ | ||
'outline-offset': [isLength] | ||
}], | ||
/** | ||
* Outline Color | ||
* @see https://tailwindcss.com/docs/outline-color | ||
*/ | ||
'outline-color': [{ | ||
outline: [colors] | ||
}], | ||
/** | ||
* Pointer Events | ||
* @see https://tailwindcss.com/docs/pointer-events | ||
*/ | ||
'pointer-events': [{ | ||
'pointer-events': ['none', 'auto'] | ||
}], | ||
/** | ||
* Resize | ||
* @see https://tailwindcss.com/docs/resize | ||
*/ | ||
resize: [{ | ||
resize: ['none', 'y', 'x', ''] | ||
}], | ||
/** | ||
* Scroll Margin | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-m': [{ | ||
'scroll-m': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin X | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-mx': [{ | ||
'scroll-mx': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin Y | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-my': [{ | ||
'scroll-my': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin Top | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-mt': [{ | ||
'scroll-mt': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin Right | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-mr': [{ | ||
'scroll-mr': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin Bottom | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-mb': [{ | ||
'scroll-mb': [spacing] | ||
}], | ||
/** | ||
* Scroll Margin Left | ||
* @see https://tailwindcss.com/docs/scroll-margin | ||
*/ | ||
'scroll-ml': [{ | ||
'scroll-ml': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-p': [{ | ||
'scroll-p': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding X | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-px': [{ | ||
'scroll-px': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding Y | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-py': [{ | ||
'scroll-py': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding Top | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-pt': [{ | ||
'scroll-pt': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding Right | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-pr': [{ | ||
'scroll-pr': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding Bottom | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-pb': [{ | ||
'scroll-pb': [spacing] | ||
}], | ||
/** | ||
* Scroll Padding Left | ||
* @see https://tailwindcss.com/docs/scroll-padding | ||
*/ | ||
'scroll-pl': [{ | ||
'scroll-pl': [spacing] | ||
}], | ||
/** | ||
* Scroll Snap Align | ||
* @see https://tailwindcss.com/docs/scroll-snap-align | ||
*/ | ||
'snap-align': [{ | ||
snap: ['start', 'end', 'center', 'align-none'] | ||
}], | ||
/** | ||
* Scroll Snap Stop | ||
* @see https://tailwindcss.com/docs/scroll-snap-stop | ||
*/ | ||
'snap-stop': [{ | ||
snap: ['normal', 'always'] | ||
}], | ||
/** | ||
* Scroll Snap Type | ||
* @see https://tailwindcss.com/docs/scroll-snap-type | ||
*/ | ||
'snap-type': [{ | ||
snap: ['none', 'x', 'y', 'both'] | ||
}], | ||
/** | ||
* Scroll Snap Type Strictness | ||
* @see https://tailwindcss.com/docs/scroll-snap-type | ||
*/ | ||
'snap-strictness': [{ | ||
snap: ['mandatory', 'proximity'] | ||
}], | ||
/** | ||
* Touch Action | ||
* @see https://tailwindcss.com/docs/touch-action | ||
*/ | ||
touch: [{ | ||
touch: ['auto', 'none', 'pinch-zoom', 'manipulation', { | ||
pan: ['x', 'left', 'right', 'y', 'up', 'down'] | ||
}] | ||
}], | ||
/** | ||
* User Select | ||
* @see https://tailwindcss.com/docs/user-select | ||
*/ | ||
select: [{ | ||
select: ['none', 'text', 'all', 'auto'] | ||
}], | ||
/** | ||
* Will Change | ||
* @see https://tailwindcss.com/docs/will-change | ||
*/ | ||
'will-change': [{ | ||
'will-change': ['auto', 'scroll', 'contents', 'transform', isArbitraryValue] | ||
}], | ||
// SVG | ||
/** | ||
* Fill | ||
* @see https://tailwindcss.com/docs/fill | ||
*/ | ||
fill: [{ | ||
fill: [colors] | ||
}], | ||
/** | ||
* Stroke | ||
* @see https://tailwindcss.com/docs/stroke | ||
*/ | ||
stroke: [{ | ||
stroke: [colors] | ||
}], | ||
/** | ||
* Stroke Width | ||
* @see https://tailwindcss.com/docs/stroke-width | ||
*/ | ||
'stroke-w': [{ | ||
stroke: [isLength] | ||
}], | ||
// Accessibility | ||
/** | ||
* Screen Readers | ||
* @see https://tailwindcss.com/docs/screen-readers | ||
*/ | ||
sr: ['sr-only', 'not-sr-only'], | ||
// Just-in-Time Mode | ||
/** | ||
* Content | ||
* @see https://tailwindcss.com/docs/just-in-time-mode#content-utilities | ||
*/ | ||
content: [{ | ||
content: [isArbitraryValue] | ||
}], | ||
/** | ||
* Caret Color | ||
* @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities | ||
*/ | ||
'caret-color': [{ | ||
caret: [colors] | ||
}] | ||
}, | ||
conflictingClassGroups: { | ||
overflow: ['overflow-x', 'overflow-y'], | ||
overscroll: ['overscroll-x', 'overscroll-y'], | ||
inset: ['inset-x', 'inset-y', 'top', 'right', 'bottom', 'left'], | ||
'inset-x': ['right', 'left'], | ||
'inset-y': ['top', 'bottom'], | ||
flex: ['basis', 'grow', 'shrink'], | ||
'col-start-end': ['col-start', 'col-end'], | ||
'row-start-end': ['row-start', 'row-end'], | ||
gap: ['gap-x', 'gap-y'], | ||
p: ['px', 'py', 'pt', 'pr', 'pb', 'pl'], | ||
px: ['pr', 'pl'], | ||
py: ['pt', 'pb'], | ||
m: ['mx', 'my', 'mt', 'mr', 'mb', 'ml'], | ||
mx: ['mr', 'ml'], | ||
my: ['mt', 'mb'], | ||
'font-size': ['leading'], | ||
'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'], | ||
'fvn-ordinal': ['fvn-normal'], | ||
'fvn-slashed-zero': ['fvn-normal'], | ||
'fvn-figure': ['fvn-normal'], | ||
'fvn-spacing': ['fvn-normal'], | ||
'fvn-fraction': ['fvn-normal'], | ||
rounded: ['rounded-t', 'rounded-r', 'rounded-b', 'rounded-l', 'rounded-tl', 'rounded-tr', 'rounded-br', 'rounded-bl'], | ||
'rounded-t': ['rounded-tl', 'rounded-tr'], | ||
'rounded-r': ['rounded-tr', 'rounded-br'], | ||
'rounded-b': ['rounded-br', 'rounded-bl'], | ||
'rounded-l': ['rounded-tl', 'rounded-bl'], | ||
'border-w': ['border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'], | ||
'border-w-x': ['border-w-r', 'border-w-l'], | ||
'border-w-y': ['border-w-t', 'border-w-b'], | ||
'border-color': ['border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'], | ||
'border-color-x': ['border-color-r', 'border-color-l'], | ||
'border-color-y': ['border-color-t', 'border-color-b'], | ||
'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'], | ||
'scroll-mx': ['scroll-mr', 'scroll-ml'], | ||
'scroll-my': ['scroll-mt', 'scroll-mb'], | ||
'scroll-p': ['scroll-px', 'scroll-py', 'scroll-pt', 'scroll-pr', 'scroll-pb', 'scroll-pl'], | ||
'scroll-px': ['scroll-pr', 'scroll-pl'], | ||
'scroll-py': ['scroll-pt', 'scroll-pb'] | ||
} | ||
}; | ||
} | ||
const twMerge = createTailwindMerge(getDefaultConfig); | ||
/** | ||
* @param baseConfig Config where other config will be merged into. This object will be mutated. | ||
* @param configExtension Partial config to merge into the `baseConfig`. | ||
*/ | ||
function mergeConfigs(baseConfig, configExtension) { | ||
for (const key in configExtension) { | ||
mergePropertyRecursively(baseConfig, key, configExtension[key]); | ||
} | ||
return baseConfig; | ||
} | ||
const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
const overrideTypes = new Set(['string', 'number', 'boolean']); | ||
function mergePropertyRecursively(baseObject, mergeKey, mergeValue) { | ||
if (!hasOwnProperty.call(baseObject, mergeKey) || overrideTypes.has(typeof mergeValue) || mergeValue === null) { | ||
baseObject[mergeKey] = mergeValue; | ||
return; | ||
} | ||
if (Array.isArray(mergeValue) && Array.isArray(baseObject[mergeKey])) { | ||
baseObject[mergeKey] = baseObject[mergeKey].concat(mergeValue); | ||
return; | ||
} | ||
if (typeof mergeValue === 'object' && typeof baseObject[mergeKey] === 'object') { | ||
if (baseObject[mergeKey] === null) { | ||
baseObject[mergeKey] = mergeValue; | ||
return; | ||
} | ||
for (const nextKey in mergeValue) { | ||
mergePropertyRecursively(baseObject[mergeKey], nextKey, mergeValue[nextKey]); | ||
} | ||
} | ||
} | ||
function extendTailwindMerge(configExtension, ...createConfig) { | ||
return typeof configExtension === 'function' ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig); | ||
} | ||
export { createTailwindMerge, extendTailwindMerge, fromTheme, getDefaultConfig, mergeConfigs, twMerge, validators }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "tailwind-merge", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Merge Tailwind CSS classes without style conflicts", | ||
@@ -25,11 +25,10 @@ "keywords": [ | ||
], | ||
"type": "module", | ||
"source": "src/index.ts", | ||
"exports": { | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"module": "dist/index.module.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"main": "dist/index.js", | ||
"types": "./dist/types/index.d.ts", | ||
@@ -42,7 +41,6 @@ "repository": { | ||
"scripts": { | ||
"build": "rm -rf dist/* && microbundle --strict --no-compress --format modern,esm,cjs", | ||
"build:min": "rm -rf dist/* && microbundle --strict --format modern", | ||
"test": "jest", | ||
"type-check": "tsc --build", | ||
"build": "dts build", | ||
"test": "dts test", | ||
"lint": "eslint --max-warnings 0 '**'", | ||
"size": "size-limit", | ||
"preversion": "git checkout main && git pull", | ||
@@ -56,17 +54,26 @@ "version": "zx scripts/update-readme.js", | ||
"devDependencies": { | ||
"@size-limit/preset-small-lib": "^7.0.3", | ||
"@types/jest": "^27.0.3", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"eslint": "^8.3.0", | ||
"@typescript-eslint/eslint-plugin": "^5.6.0", | ||
"@typescript-eslint/parser": "^5.6.0", | ||
"dts-cli": "^0.20.0", | ||
"eslint": "^8.4.1", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-jest": "^25.3.0", | ||
"fp-ts": "^2.11.5", | ||
"jest": "^27.3.1", | ||
"microbundle": "^0.14.2", | ||
"package-build-stats": "^7.3.6", | ||
"prettier": "^2.3.2", | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.5.2", | ||
"prettier": "^2.5.1", | ||
"size-limit": "^7.0.4", | ||
"typescript": "^4.5.3", | ||
"zx": "^4.0.0" | ||
} | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "dist/index.mjs", | ||
"limit": "10 KB" | ||
}, | ||
{ | ||
"path": "dist/tailwind-merge.cjs.production.min.js", | ||
"limit": "10 KB" | ||
} | ||
] | ||
} |
<div align="center"> | ||
<br /> | ||
<a href="https://github.com/dcastil/tailwind-merge"> | ||
<!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v1.0.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END --> | ||
<!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v1.1.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END --> | ||
</a> | ||
@@ -22,3 +22,3 @@ </div> | ||
- Fully typed | ||
- [<!-- AUTOGENERATED START package-gzip-size -->5.9 kB<!-- AUTOGENERATED END --> minified + gzipped](https://bundlephobia.com/package/tailwind-merge) (<!-- AUTOGENERATED START package-composition -->97.2% self, 2.8% hashlru<!-- AUTOGENERATED END -->) | ||
- [Check bundle size on Bundlephobia](https://bundlephobia.com/package/tailwind-merge) | ||
@@ -525,2 +525,3 @@ ## What is it for | ||
isArbitraryWeight(classPart: string): boolean | ||
isArbitraryShadow(classPart: string): boolean | ||
isAny(classPart: string): boolean | ||
@@ -547,2 +548,3 @@ } | ||
- `isArbitraryWeight` checks whether class part is arbitrary value whcih starts with `weight:` or is a number (`[weight:var(--value)]`, `[450]`) which is necessary for font-weight classNames. | ||
- `isArbitraryShadow` checks whether class part is arbitrary value which starts with the same pattern as a shadow value (`[0_35px_60px_-15px_rgba(0,0,0,0.3)]`), namely with two lengths separated by a underscore. | ||
- `isAny` always returns true. Be careful with this validator as it might match unwanted classes. I use it primarily to match colors or when I'm ceertain there are no other class groups in a namespace. | ||
@@ -549,0 +551,0 @@ |
@@ -1,8 +0,8 @@ | ||
export { twMerge } from './tailwind-merge' | ||
export { getDefaultConfig } from './default-config' | ||
export { extendTailwindMerge } from './extend-tailwind-merge' | ||
export { createTailwindMerge } from './create-tailwind-merge' | ||
export type { Config } from './types' | ||
export * as validators from './validators' | ||
export { mergeConfigs } from './merge-configs' | ||
export { fromTheme } from './from-theme' | ||
export { twMerge } from './lib/tailwind-merge' | ||
export { getDefaultConfig } from './lib/default-config' | ||
export { extendTailwindMerge } from './lib/extend-tailwind-merge' | ||
export { createTailwindMerge } from './lib/create-tailwind-merge' | ||
export type { Config } from './lib/types' | ||
export * as validators from './lib/validators' | ||
export { mergeConfigs } from './lib/merge-configs' | ||
export { fromTheme } from './lib/from-theme' |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
13
60
606
653517
8408
1
1
1
No