This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

14
frontend/node_modules/tailwind-merge/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { twJoin } from './lib/tw-join';
export { createTailwindMerge } from './lib/create-tailwind-merge';
export { getDefaultConfig } from './lib/default-config';
export { extendTailwindMerge } from './lib/extend-tailwind-merge';
export { fromTheme } from './lib/from-theme';
export { mergeConfigs } from './lib/merge-configs';
export { twJoin, type ClassNameValue } from './lib/tw-join';
export { twMerge } from './lib/tw-merge';
export type { Config } from './lib/types';
export * as validators from './lib/validators';
/**
* @deprecated Will be removed in next major version. Use `twJoin` instead.
*/
export declare const join: typeof twJoin;

8
frontend/node_modules/tailwind-merge/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./tailwind-merge.cjs.production.min.js')
} else {
module.exports = require('./tailwind-merge.cjs.development.js')
}

View File

@@ -0,0 +1,19 @@
import { ClassGroupId, ClassValidator, Config } from './types';
export interface ClassPartObject {
nextPart: Map<string, ClassPartObject>;
validators: ClassValidatorObject[];
classGroupId?: ClassGroupId;
}
interface ClassValidatorObject {
classGroupId: ClassGroupId;
validator: ClassValidator;
}
export declare function createClassUtils(config: Config): {
getClassGroupId: (className: string) => string | undefined;
getConflictingClassGroupIds: (classGroupId: ClassGroupId, hasPostfixModifier: boolean) => readonly string[];
};
/**
* Exported for testing only
*/
export declare function createClassMap(config: Config): ClassPartObject;
export {};

View File

@@ -0,0 +1,141 @@
var CLASS_PART_SEPARATOR = '-';
function createClassUtils(config) {
var classMap = createClassMap(config);
var conflictingClassGroups = config.conflictingClassGroups,
_config$conflictingCl = config.conflictingClassGroupModifiers,
conflictingClassGroupModifiers = _config$conflictingCl === void 0 ? {} : _config$conflictingCl;
function getClassGroupId(className) {
var 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, hasPostfixModifier) {
var conflicts = conflictingClassGroups[classGroupId] || [];
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
return [].concat(conflicts, conflictingClassGroupModifiers[classGroupId]);
}
return conflicts;
}
return {
getClassGroupId: getClassGroupId,
getConflictingClassGroupIds: getConflictingClassGroupIds
};
}
function getGroupRecursive(classParts, classPartObject) {
if (classParts.length === 0) {
return classPartObject.classGroupId;
}
var currentClassPart = classParts[0];
var nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
var classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
if (classGroupFromNextClassPart) {
return classGroupFromNextClassPart;
}
if (classPartObject.validators.length === 0) {
return undefined;
}
var classRest = classParts.join(CLASS_PART_SEPARATOR);
return classPartObject.validators.find(function (_ref) {
var validator = _ref.validator;
return validator(classRest);
})?.classGroupId;
}
var arbitraryPropertyRegex = /^\[(.+)\]$/;
function getGroupIdForArbitraryProperty(className) {
if (arbitraryPropertyRegex.test(className)) {
var arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
var property = 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) {
var theme = config.theme,
prefix = config.prefix;
var classMap = {
nextPart: new Map(),
validators: []
};
var prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
prefixedClassGroupEntries.forEach(function (_ref2) {
var classGroupId = _ref2[0],
classGroup = _ref2[1];
processClassesRecursively(classGroup, classMap, classGroupId, theme);
});
return classMap;
}
function processClassesRecursively(classGroup, classPartObject, classGroupId, theme) {
classGroup.forEach(function (classDefinition) {
if (typeof classDefinition === 'string') {
var 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: classGroupId
});
return;
}
Object.entries(classDefinition).forEach(function (_ref3) {
var key = _ref3[0],
classGroup = _ref3[1];
processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
});
});
}
function getPart(classPartObject, path) {
var currentClassPartObject = classPartObject;
path.split(CLASS_PART_SEPARATOR).forEach(function (pathPart) {
if (!currentClassPartObject.nextPart.has(pathPart)) {
currentClassPartObject.nextPart.set(pathPart, {
nextPart: new Map(),
validators: []
});
}
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
});
return currentClassPartObject;
}
function isThemeGetter(func) {
return func.isThemeGetter;
}
function getPrefixedClassGroupEntries(classGroupEntries, prefix) {
if (!prefix) {
return classGroupEntries;
}
return classGroupEntries.map(function (_ref4) {
var classGroupId = _ref4[0],
classGroup = _ref4[1];
var prefixedClassGroup = classGroup.map(function (classDefinition) {
if (typeof classDefinition === 'string') {
return prefix + classDefinition;
}
if (typeof classDefinition === 'object') {
return Object.fromEntries(Object.entries(classDefinition).map(function (_ref5) {
var key = _ref5[0],
value = _ref5[1];
return [prefix + key, value];
}));
}
return classDefinition;
});
return [classGroupId, prefixedClassGroup];
});
}
export { createClassMap, createClassUtils };
//# sourceMappingURL=class-utils.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
import { Config } from './types';
export type ConfigUtils = ReturnType<typeof createConfigUtils>;
export declare function createConfigUtils(config: Config): {
getClassGroupId: (className: string) => string | undefined;
getConflictingClassGroupIds: (classGroupId: string, hasPostfixModifier: boolean) => readonly string[];
cache: import("./lru-cache").LruCache<string, string>;
splitModifiers: (className: string) => {
modifiers: string[];
hasImportantModifier: boolean;
baseClassName: string;
maybePostfixModifierPosition: number | undefined;
};
};

View File

@@ -0,0 +1,14 @@
import { createClassUtils } from './class-utils.mjs';
import { createLruCache } from './lru-cache.mjs';
import { createSplitModifiers } from './modifier-utils.mjs';
function createConfigUtils(config) {
return {
cache: createLruCache(config.cacheSize),
splitModifiers: createSplitModifiers(config),
...createClassUtils(config)
};
}
export { createConfigUtils };
//# sourceMappingURL=config-utils.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config-utils.mjs","sources":["../../src/lib/config-utils.ts"],"sourcesContent":["import { createClassUtils } from './class-utils'\nimport { createLruCache } from './lru-cache'\nimport { createSplitModifiers } from './modifier-utils'\nimport { Config } from './types'\n\nexport type ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createConfigUtils(config: Config) {\n return {\n cache: createLruCache<string, string>(config.cacheSize),\n splitModifiers: createSplitModifiers(config),\n ...createClassUtils(config),\n }\n}\n"],"names":["createConfigUtils","config","cache","createLruCache","cacheSize","splitModifiers","createSplitModifiers","createClassUtils"],"mappings":";;;;AAOM,SAAUA,iBAAiB,CAACC,MAAc,EAAA;EAC5C,OAAO;AACHC,IAAAA,KAAK,EAAEC,cAAc,CAAiBF,MAAM,CAACG,SAAS,CAAC;AACvDC,IAAAA,cAAc,EAAEC,oBAAoB,CAACL,MAAM,CAAC;IAC5C,GAAGM,gBAAgB,CAACN,MAAM,CAAA;GAC7B,CAAA;AACL;;;;"}

View File

@@ -0,0 +1,7 @@
import { ClassNameValue } from './tw-join';
import { Config } from './types';
type CreateConfigFirst = () => Config;
type CreateConfigSubsequent = (config: Config) => Config;
type TailwindMerge = (...classLists: ClassNameValue[]) => string;
export declare function createTailwindMerge(...createConfig: [CreateConfigFirst, ...CreateConfigSubsequent[]]): TailwindMerge;
export {};

View File

@@ -0,0 +1,40 @@
import { createConfigUtils } from './config-utils.mjs';
import { mergeClassList } from './merge-classlist.mjs';
import { twJoin } from './tw-join.mjs';
function createTailwindMerge() {
for (var _len = arguments.length, createConfig = new Array(_len), _key = 0; _key < _len; _key++) {
createConfig[_key] = arguments[_key];
}
var configUtils;
var cacheGet;
var cacheSet;
var functionToCall = initTailwindMerge;
function initTailwindMerge(classList) {
var firstCreateConfig = createConfig[0],
restCreateConfig = createConfig.slice(1);
var config = restCreateConfig.reduce(function (previousConfig, createConfigCurrent) {
return createConfigCurrent(previousConfig);
}, firstCreateConfig());
configUtils = createConfigUtils(config);
cacheGet = configUtils.cache.get;
cacheSet = configUtils.cache.set;
functionToCall = tailwindMerge;
return tailwindMerge(classList);
}
function tailwindMerge(classList) {
var cachedResult = cacheGet(classList);
if (cachedResult) {
return cachedResult;
}
var result = mergeClassList(classList, configUtils);
cacheSet(classList, result);
return result;
}
return function callTailwindMerge() {
return functionToCall(twJoin.apply(null, arguments));
};
}
export { createTailwindMerge };
//# sourceMappingURL=create-tailwind-merge.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-tailwind-merge.mjs","sources":["../../src/lib/create-tailwind-merge.ts"],"sourcesContent":["import { createConfigUtils } from './config-utils'\nimport { mergeClassList } from './merge-classlist'\nimport { ClassNameValue, twJoin } from './tw-join'\nimport { Config } from './types'\n\ntype CreateConfigFirst = () => Config\ntype CreateConfigSubsequent = (config: Config) => Config\ntype TailwindMerge = (...classLists: ClassNameValue[]) => string\ntype ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createTailwindMerge(\n ...createConfig: [CreateConfigFirst, ...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 [firstCreateConfig, ...restCreateConfig] = createConfig\n\n const config = restCreateConfig.reduce(\n (previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig),\n firstCreateConfig(),\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"],"names":["createTailwindMerge","createConfig","configUtils","cacheGet","cacheSet","functionToCall","initTailwindMerge","classList","firstCreateConfig","restCreateConfig","config","reduce","previousConfig","createConfigCurrent","createConfigUtils","cache","get","set","tailwindMerge","cachedResult","result","mergeClassList","callTailwindMerge","twJoin","apply","arguments"],"mappings":";;;;AAUgB,SAAAA,mBAAmB,GACkC;AAAA,EAAA,KAAA,IAAA,IAAA,GAAA,SAAA,CAAA,MAAA,EAA9DC,YAA8D,GAAA,IAAA,KAAA,CAAA,IAAA,CAAA,EAAA,IAAA,GAAA,CAAA,EAAA,IAAA,GAAA,IAAA,EAAA,IAAA,EAAA,EAAA;IAA9DA,YAA8D,CAAA,IAAA,CAAA,GAAA,SAAA,CAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAEjE,EAAA,IAAIC,WAAwB,CAAA;AAC5B,EAAA,IAAIC,QAAqC,CAAA;AACzC,EAAA,IAAIC,QAAqC,CAAA;EACzC,IAAIC,cAAc,GAAGC,iBAAiB,CAAA;EAEtC,SAASA,iBAAiB,CAACC,SAAiB,EAAA;IACxC,IAAOC,iBAAiB,GAAyBP,YAAY,CAAA,CAAA,CAAA;AAAhCQ,MAAAA,gBAAgB,GAAIR,YAAY,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;IAE7D,IAAMS,MAAM,GAAGD,gBAAgB,CAACE,MAAM,CAClC,UAACC,cAAc,EAAEC,mBAAmB,EAAA;MAAA,OAAKA,mBAAmB,CAACD,cAAc,CAAC,CAAA;KAC5EJ,EAAAA,iBAAiB,EAAE,CACtB,CAAA;AAEDN,IAAAA,WAAW,GAAGY,iBAAiB,CAACJ,MAAM,CAAC,CAAA;AACvCP,IAAAA,QAAQ,GAAGD,WAAW,CAACa,KAAK,CAACC,GAAG,CAAA;AAChCZ,IAAAA,QAAQ,GAAGF,WAAW,CAACa,KAAK,CAACE,GAAG,CAAA;AAChCZ,IAAAA,cAAc,GAAGa,aAAa,CAAA;IAE9B,OAAOA,aAAa,CAACX,SAAS,CAAC,CAAA;AACnC,GAAA;EAEA,SAASW,aAAa,CAACX,SAAiB,EAAA;AACpC,IAAA,IAAMY,YAAY,GAAGhB,QAAQ,CAACI,SAAS,CAAC,CAAA;AAExC,IAAA,IAAIY,YAAY,EAAE;AACd,MAAA,OAAOA,YAAY,CAAA;AACtB,KAAA;AAED,IAAA,IAAMC,MAAM,GAAGC,cAAc,CAACd,SAAS,EAAEL,WAAW,CAAC,CAAA;AACrDE,IAAAA,QAAQ,CAACG,SAAS,EAAEa,MAAM,CAAC,CAAA;AAE3B,IAAA,OAAOA,MAAM,CAAA;AACjB,GAAA;EAEA,OAAO,SAASE,iBAAiB,GAAA;IAC7B,OAAOjB,cAAc,CAACkB,MAAM,CAACC,KAAK,CAAC,IAAI,EAAEC,SAAgB,CAAC,CAAC,CAAA;GAC9D,CAAA;AACL;;;;"}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { Config } from './types';
type CreateConfigSubsequent = (config: Config) => Config;
export declare function extendTailwindMerge(configExtension: Partial<Config> | CreateConfigSubsequent, ...createConfig: CreateConfigSubsequent[]): (...classLists: import("./tw-join").ClassNameValue[]) => string;
export {};

View File

@@ -0,0 +1,15 @@
import { createTailwindMerge } from './create-tailwind-merge.mjs';
import { getDefaultConfig } from './default-config.mjs';
import { mergeConfigs } from './merge-configs.mjs';
function extendTailwindMerge(configExtension) {
for (var _len = arguments.length, createConfig = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
createConfig[_key - 1] = arguments[_key];
}
return typeof configExtension === 'function' ? createTailwindMerge.apply(void 0, [getDefaultConfig, configExtension].concat(createConfig)) : createTailwindMerge.apply(void 0, [function () {
return mergeConfigs(getDefaultConfig(), configExtension);
}].concat(createConfig));
}
export { extendTailwindMerge };
//# sourceMappingURL=extend-tailwind-merge.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"extend-tailwind-merge.mjs","sources":["../../src/lib/extend-tailwind-merge.ts"],"sourcesContent":["import { createTailwindMerge } from './create-tailwind-merge'\nimport { getDefaultConfig } from './default-config'\nimport { mergeConfigs } from './merge-configs'\nimport { Config } from './types'\n\ntype CreateConfigSubsequent = (config: Config) => Config\n\nexport function extendTailwindMerge(\n configExtension: Partial<Config> | CreateConfigSubsequent,\n ...createConfig: CreateConfigSubsequent[]\n) {\n return typeof configExtension === 'function'\n ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig)\n : createTailwindMerge(\n () => mergeConfigs(getDefaultConfig(), configExtension),\n ...createConfig,\n )\n}\n"],"names":["extendTailwindMerge","configExtension","createConfig","createTailwindMerge","getDefaultConfig","mergeConfigs"],"mappings":";;;;SAOgBA,mBAAmB,CAC/BC,eAAyD,EAChB;AAAA,EAAA,KAAA,IAAA,IAAA,GAAA,SAAA,CAAA,MAAA,EAAtCC,YAAsC,GAAA,IAAA,KAAA,CAAA,IAAA,GAAA,CAAA,GAAA,IAAA,GAAA,CAAA,GAAA,CAAA,CAAA,EAAA,IAAA,GAAA,CAAA,EAAA,IAAA,GAAA,IAAA,EAAA,IAAA,EAAA,EAAA;IAAtCA,YAAsC,CAAA,IAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAEzC,EAAA,OAAO,OAAOD,eAAe,KAAK,UAAU,GACtCE,mBAAmB,CAAA,KAAA,CAAA,KAAA,CAAA,EAAA,CAACC,gBAAgB,EAAEH,eAAe,CAAKC,CAAAA,MAAAA,CAAAA,YAAY,CAAC,CAAA,GACvEC,mBAAmB,CACf,KAAA,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;AAAA,IAAA,OAAME,YAAY,CAACD,gBAAgB,EAAE,EAAEH,eAAe,CAAC,CAAA;AAAA,GAAA,CAAA,CAAA,MAAA,CACpDC,YAAY,CAClB,CAAA,CAAA;AACX;;;;"}

View File

@@ -0,0 +1,2 @@
import { ThemeGetter } from './types';
export declare function fromTheme(key: string): ThemeGetter;

View File

@@ -0,0 +1,10 @@
function fromTheme(key) {
var themeGetter = function themeGetter(theme) {
return theme[key] || [];
};
themeGetter.isThemeGetter = true;
return themeGetter;
}
export { fromTheme };
//# sourceMappingURL=from-theme.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"from-theme.mjs","sources":["../../src/lib/from-theme.ts"],"sourcesContent":["import { ThemeGetter, ThemeObject } from './types'\n\nexport function fromTheme(key: string): ThemeGetter {\n const themeGetter = (theme: ThemeObject) => theme[key] || []\n\n themeGetter.isThemeGetter = true as const\n\n return themeGetter\n}\n"],"names":["fromTheme","key","themeGetter","theme","isThemeGetter"],"mappings":"AAEM,SAAUA,SAAS,CAACC,GAAW,EAAA;AACjC,EAAA,IAAMC,WAAW,GAAG,SAAdA,WAAW,CAAIC,KAAkB,EAAA;AAAA,IAAA,OAAKA,KAAK,CAACF,GAAG,CAAC,IAAI,EAAE,CAAA;AAAA,GAAA,CAAA;EAE5DC,WAAW,CAACE,aAAa,GAAG,IAAa,CAAA;AAEzC,EAAA,OAAOF,WAAW,CAAA;AACtB;;;;"}

View File

@@ -0,0 +1,5 @@
export interface LruCache<Key, Value> {
get(key: Key): Value | undefined;
set(key: Key, value: Value): void;
}
export declare function createLruCache<Key, Value>(maxCacheSize: number): LruCache<Key, Value>;

View File

@@ -0,0 +1,45 @@
// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
function createLruCache(maxCacheSize) {
if (maxCacheSize < 1) {
return {
get: function get() {
return undefined;
},
set: function set() {}
};
}
var cacheSize = 0;
var cache = new Map();
var previousCache = new Map();
function update(key, value) {
cache.set(key, value);
cacheSize++;
if (cacheSize > maxCacheSize) {
cacheSize = 0;
previousCache = cache;
cache = new Map();
}
}
return {
get: function get(key) {
var value = cache.get(key);
if (value !== undefined) {
return value;
}
if ((value = previousCache.get(key)) !== undefined) {
update(key, value);
return value;
}
},
set: function set(key, value) {
if (cache.has(key)) {
cache.set(key, value);
} else {
update(key, value);
}
}
};
}
export { createLruCache };
//# sourceMappingURL=lru-cache.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"lru-cache.mjs","sources":["../../src/lib/lru-cache.ts"],"sourcesContent":["// 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 function 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 function 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"],"names":["createLruCache","maxCacheSize","get","undefined","set","cacheSize","cache","Map","previousCache","update","key","value","has"],"mappings":"AAOA;AACM,SAAUA,cAAc,CAAaC,YAAoB,EAAA;EAC3D,IAAIA,YAAY,GAAG,CAAC,EAAE;IAClB,OAAO;AACHC,MAAAA,GAAG,EAAE,SAAA,GAAA,GAAA;AAAA,QAAA,OAAMC,SAAS,CAAA;AAAA,OAAA;MACpBC,GAAG,EAAE,eAAK,EAAE;KACf,CAAA;AACJ,GAAA;EAED,IAAIC,SAAS,GAAG,CAAC,CAAA;AACjB,EAAA,IAAIC,KAAK,GAAG,IAAIC,GAAG,EAAc,CAAA;AACjC,EAAA,IAAIC,aAAa,GAAG,IAAID,GAAG,EAAc,CAAA;AAEzC,EAAA,SAASE,MAAM,CAACC,GAAQ,EAAEC,KAAY,EAAA;AAClCL,IAAAA,KAAK,CAACF,GAAG,CAACM,GAAG,EAAEC,KAAK,CAAC,CAAA;AACrBN,IAAAA,SAAS,EAAE,CAAA;IAEX,IAAIA,SAAS,GAAGJ,YAAY,EAAE;AAC1BI,MAAAA,SAAS,GAAG,CAAC,CAAA;AACbG,MAAAA,aAAa,GAAGF,KAAK,CAAA;MACrBA,KAAK,GAAG,IAAIC,GAAG,EAAE,CAAA;AACpB,KAAA;AACL,GAAA;EAEA,OAAO;IACHL,GAAG,EAAA,SAAA,GAAA,CAACQ,GAAG,EAAA;AACH,MAAA,IAAIC,KAAK,GAAGL,KAAK,CAACJ,GAAG,CAACQ,GAAG,CAAC,CAAA;MAE1B,IAAIC,KAAK,KAAKR,SAAS,EAAE;AACrB,QAAA,OAAOQ,KAAK,CAAA;AACf,OAAA;MACD,IAAI,CAACA,KAAK,GAAGH,aAAa,CAACN,GAAG,CAACQ,GAAG,CAAC,MAAMP,SAAS,EAAE;AAChDM,QAAAA,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,CAAA;AAClB,QAAA,OAAOA,KAAK,CAAA;AACf,OAAA;KACJ;AACDP,IAAAA,GAAG,EAACM,SAAAA,GAAAA,CAAAA,GAAG,EAAEC,KAAK,EAAA;AACV,MAAA,IAAIL,KAAK,CAACM,GAAG,CAACF,GAAG,CAAC,EAAE;AAChBJ,QAAAA,KAAK,CAACF,GAAG,CAACM,GAAG,EAAEC,KAAK,CAAC,CAAA;AACxB,OAAA,MAAM;AACHF,QAAAA,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,CAAA;AACrB,OAAA;AACL,KAAA;GACH,CAAA;AACL;;;;"}

View File

@@ -0,0 +1,2 @@
import { ConfigUtils } from './config-utils';
export declare function mergeClassList(classList: string, configUtils: ConfigUtils): string;

View File

@@ -0,0 +1,73 @@
import { sortModifiers, IMPORTANT_MODIFIER } from './modifier-utils.mjs';
var SPLIT_CLASSES_REGEX = /\s+/;
function mergeClassList(classList, configUtils) {
var splitModifiers = configUtils.splitModifiers,
getClassGroupId = configUtils.getClassGroupId,
getConflictingClassGroupIds = configUtils.getConflictingClassGroupIds;
/**
* Set of classGroupIds in following format:
* `{importantModifier}{variantModifiers}{classGroupId}`
* @example 'float'
* @example 'hover:focus:bg-color'
* @example 'md:!pr'
*/
var classGroupsInConflict = new Set();
return classList.trim().split(SPLIT_CLASSES_REGEX).map(function (originalClassName) {
var _splitModifiers = splitModifiers(originalClassName),
modifiers = _splitModifiers.modifiers,
hasImportantModifier = _splitModifiers.hasImportantModifier,
baseClassName = _splitModifiers.baseClassName,
maybePostfixModifierPosition = _splitModifiers.maybePostfixModifierPosition;
var classGroupId = getClassGroupId(maybePostfixModifierPosition ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
var hasPostfixModifier = Boolean(maybePostfixModifierPosition);
if (!classGroupId) {
if (!maybePostfixModifierPosition) {
return {
isTailwindClass: false,
originalClassName: originalClassName
};
}
classGroupId = getClassGroupId(baseClassName);
if (!classGroupId) {
return {
isTailwindClass: false,
originalClassName: originalClassName
};
}
hasPostfixModifier = false;
}
var variantModifier = sortModifiers(modifiers).join(':');
var modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
return {
isTailwindClass: true,
modifierId: modifierId,
classGroupId: classGroupId,
originalClassName: originalClassName,
hasPostfixModifier: hasPostfixModifier
};
}).reverse()
// Last class in conflict wins, so we need to filter conflicting classes in reverse order.
.filter(function (parsed) {
if (!parsed.isTailwindClass) {
return true;
}
var modifierId = parsed.modifierId,
classGroupId = parsed.classGroupId,
hasPostfixModifier = parsed.hasPostfixModifier;
var classId = modifierId + classGroupId;
if (classGroupsInConflict.has(classId)) {
return false;
}
classGroupsInConflict.add(classId);
getConflictingClassGroupIds(classGroupId, hasPostfixModifier).forEach(function (group) {
return classGroupsInConflict.add(modifierId + group);
});
return true;
}).reverse().map(function (parsed) {
return parsed.originalClassName;
}).join(' ');
}
export { mergeClassList };
//# sourceMappingURL=merge-classlist.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { Config } from './types';
/**
* @param baseConfig Config where other config will be merged into. This object will be mutated.
* @param configExtension Partial config to merge into the `baseConfig`.
*/
export declare function mergeConfigs(baseConfig: Config, configExtension: Partial<Config>): Config;

View File

@@ -0,0 +1,34 @@
/**
* @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 (var key in configExtension) {
mergePropertyRecursively(baseConfig, key, configExtension[key]);
}
return baseConfig;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
var overrideTypes = /*#__PURE__*/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 (var nextKey in mergeValue) {
mergePropertyRecursively(baseObject[mergeKey], nextKey, mergeValue[nextKey]);
}
}
}
export { mergeConfigs };
//# sourceMappingURL=merge-configs.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"merge-configs.mjs","sources":["../../src/lib/merge-configs.ts"],"sourcesContent":["import { Config } from './types'\n\n/**\n * @param baseConfig Config where other config will be merged into. This object will be mutated.\n * @param configExtension Partial config to merge into the `baseConfig`.\n */\nexport function mergeConfigs(baseConfig: Config, configExtension: Partial<Config>) {\n for (const key in configExtension) {\n mergePropertyRecursively(baseConfig as any, key, configExtension[key as keyof Config])\n }\n\n return baseConfig\n}\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst overrideTypes = new Set(['string', 'number', 'boolean'])\n\nfunction mergePropertyRecursively(\n baseObject: Record<string, unknown>,\n mergeKey: string,\n mergeValue: unknown,\n) {\n if (\n !hasOwnProperty.call(baseObject, mergeKey) ||\n overrideTypes.has(typeof mergeValue) ||\n mergeValue === null\n ) {\n baseObject[mergeKey] = mergeValue\n return\n }\n\n if (Array.isArray(mergeValue) && Array.isArray(baseObject[mergeKey])) {\n baseObject[mergeKey] = (baseObject[mergeKey] as unknown[]).concat(mergeValue)\n return\n }\n\n if (typeof mergeValue === 'object' && typeof baseObject[mergeKey] === 'object') {\n if (baseObject[mergeKey] === null) {\n baseObject[mergeKey] = mergeValue\n return\n }\n\n for (const nextKey in mergeValue) {\n mergePropertyRecursively(\n baseObject[mergeKey] as Record<string, unknown>,\n nextKey,\n mergeValue[nextKey as keyof object],\n )\n }\n }\n}\n"],"names":["mergeConfigs","baseConfig","configExtension","key","mergePropertyRecursively","hasOwnProperty","Object","prototype","overrideTypes","Set","baseObject","mergeKey","mergeValue","call","has","Array","isArray","concat","nextKey"],"mappings":"AAEA;;;AAGG;AACa,SAAAA,YAAY,CAACC,UAAkB,EAAEC,eAAgC,EAAA;AAC7E,EAAA,KAAK,IAAMC,GAAG,IAAID,eAAe,EAAE;IAC/BE,wBAAwB,CAACH,UAAiB,EAAEE,GAAG,EAAED,eAAe,CAACC,GAAmB,CAAC,CAAC,CAAA;AACzF,GAAA;AAED,EAAA,OAAOF,UAAU,CAAA;AACrB,CAAA;AAEA,IAAMI,cAAc,GAAGC,MAAM,CAACC,SAAS,CAACF,cAAc,CAAA;AACtD,IAAMG,aAAa,gBAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAE9D,SAASL,wBAAwB,CAC7BM,UAAmC,EACnCC,QAAgB,EAChBC,UAAmB,EAAA;EAEnB,IACI,CAACP,cAAc,CAACQ,IAAI,CAACH,UAAU,EAAEC,QAAQ,CAAC,IAC1CH,aAAa,CAACM,GAAG,CAAC,OAAOF,UAAU,CAAC,IACpCA,UAAU,KAAK,IAAI,EACrB;AACEF,IAAAA,UAAU,CAACC,QAAQ,CAAC,GAAGC,UAAU,CAAA;AACjC,IAAA,OAAA;AACH,GAAA;AAED,EAAA,IAAIG,KAAK,CAACC,OAAO,CAACJ,UAAU,CAAC,IAAIG,KAAK,CAACC,OAAO,CAACN,UAAU,CAACC,QAAQ,CAAC,CAAC,EAAE;AAClED,IAAAA,UAAU,CAACC,QAAQ,CAAC,GAAID,UAAU,CAACC,QAAQ,CAAe,CAACM,MAAM,CAACL,UAAU,CAAC,CAAA;AAC7E,IAAA,OAAA;AACH,GAAA;AAED,EAAA,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOF,UAAU,CAACC,QAAQ,CAAC,KAAK,QAAQ,EAAE;AAC5E,IAAA,IAAID,UAAU,CAACC,QAAQ,CAAC,KAAK,IAAI,EAAE;AAC/BD,MAAAA,UAAU,CAACC,QAAQ,CAAC,GAAGC,UAAU,CAAA;AACjC,MAAA,OAAA;AACH,KAAA;AAED,IAAA,KAAK,IAAMM,OAAO,IAAIN,UAAU,EAAE;AAC9BR,MAAAA,wBAAwB,CACpBM,UAAU,CAACC,QAAQ,CAA4B,EAC/CO,OAAO,EACPN,UAAU,CAACM,OAAuB,CAAC,CACtC,CAAA;AACJ,KAAA;AACJ,GAAA;AACL;;;;"}

View File

@@ -0,0 +1,14 @@
import { Config } from './types';
export declare const IMPORTANT_MODIFIER = "!";
export declare function createSplitModifiers(config: Config): (className: string) => {
modifiers: string[];
hasImportantModifier: boolean;
baseClassName: string;
maybePostfixModifierPosition: number | undefined;
};
/**
* Sorts modifiers according to following schema:
* - Predefined modifiers are sorted alphabetically
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
*/
export declare function sortModifiers(modifiers: string[]): string[];

View File

@@ -0,0 +1,69 @@
var IMPORTANT_MODIFIER = '!';
function createSplitModifiers(config) {
var separator = config.separator || ':';
var isSeparatorSingleCharacter = separator.length === 1;
var firstSeparatorCharacter = separator[0];
var separatorLength = separator.length;
// splitModifiers inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
return function splitModifiers(className) {
var modifiers = [];
var bracketDepth = 0;
var modifierStart = 0;
var postfixModifierPosition;
for (var index = 0; index < className.length; index++) {
var currentCharacter = className[index];
if (bracketDepth === 0) {
if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {
modifiers.push(className.slice(modifierStart, index));
modifierStart = index + separatorLength;
continue;
}
if (currentCharacter === '/') {
postfixModifierPosition = index;
continue;
}
}
if (currentCharacter === '[') {
bracketDepth++;
} else if (currentCharacter === ']') {
bracketDepth--;
}
}
var baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
var hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
var baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
var maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
return {
modifiers: modifiers,
hasImportantModifier: hasImportantModifier,
baseClassName: baseClassName,
maybePostfixModifierPosition: maybePostfixModifierPosition
};
};
}
/**
* Sorts modifiers according to following schema:
* - Predefined modifiers are sorted alphabetically
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
*/
function sortModifiers(modifiers) {
if (modifiers.length <= 1) {
return modifiers;
}
var sortedModifiers = [];
var unsortedModifiers = [];
modifiers.forEach(function (modifier) {
var isArbitraryVariant = modifier[0] === '[';
if (isArbitraryVariant) {
sortedModifiers.push.apply(sortedModifiers, unsortedModifiers.sort().concat([modifier]));
unsortedModifiers = [];
} else {
unsortedModifiers.push(modifier);
}
});
sortedModifiers.push.apply(sortedModifiers, unsortedModifiers.sort());
return sortedModifiers;
}
export { IMPORTANT_MODIFIER, createSplitModifiers, sortModifiers };
//# sourceMappingURL=modifier-utils.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
/**
* The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
*
* Specifically:
* - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
* - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
*
* Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
*/
export type ClassNameValue = ClassNameArray | string | null | undefined | 0 | false;
type ClassNameArray = ClassNameValue[];
export declare function twJoin(...classLists: ClassNameValue[]): string;
export {};

View File

@@ -0,0 +1,43 @@
/**
* The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
*
* Specifically:
* - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
* - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
*
* Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
*/
function twJoin() {
var index = 0;
var argument;
var resolvedValue;
var string = '';
while (index < arguments.length) {
if (argument = arguments[index++]) {
if (resolvedValue = toValue(argument)) {
string && (string += ' ');
string += resolvedValue;
}
}
}
return string;
}
function toValue(mix) {
if (typeof mix === 'string') {
return mix;
}
var resolvedValue;
var string = '';
for (var k = 0; k < mix.length; k++) {
if (mix[k]) {
if (resolvedValue = toValue(mix[k])) {
string && (string += ' ');
string += resolvedValue;
}
}
}
return string;
}
export { twJoin };
//# sourceMappingURL=tw-join.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tw-join.mjs","sources":["../../src/lib/tw-join.ts"],"sourcesContent":["/**\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 | 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\nfunction 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"],"names":["twJoin","index","argument","resolvedValue","string","arguments","length","toValue","mix","k"],"mappings":"AAAA;;;;;;;;AAQG;SAMaA,MAAM,GAAA;EAClB,IAAIC,KAAK,GAAG,CAAC,CAAA;AACb,EAAA,IAAIC,QAAwB,CAAA;AAC5B,EAAA,IAAIC,aAAqB,CAAA;EACzB,IAAIC,MAAM,GAAG,EAAE,CAAA;AAEf,EAAA,OAAOH,KAAK,GAAGI,SAAS,CAACC,MAAM,EAAE;AAC7B,IAAA,IAAKJ,QAAQ,GAAGG,SAAS,CAACJ,KAAK,EAAE,CAAC,EAAG;AACjC,MAAA,IAAKE,aAAa,GAAGI,OAAO,CAACL,QAAQ,CAAC,EAAG;AACrCE,QAAAA,MAAM,KAAKA,MAAM,IAAI,GAAG,CAAC,CAAA;AACzBA,QAAAA,MAAM,IAAID,aAAa,CAAA;AAC1B,OAAA;AACJ,KAAA;AACJ,GAAA;AACD,EAAA,OAAOC,MAAM,CAAA;AACjB,CAAA;AAEA,SAASG,OAAO,CAACC,GAA4B,EAAA;AACzC,EAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AACzB,IAAA,OAAOA,GAAG,CAAA;AACb,GAAA;AAED,EAAA,IAAIL,aAAqB,CAAA;EACzB,IAAIC,MAAM,GAAG,EAAE,CAAA;AAEf,EAAA,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,GAAG,CAACF,MAAM,EAAEG,CAAC,EAAE,EAAE;AACjC,IAAA,IAAID,GAAG,CAACC,CAAC,CAAC,EAAE;MACR,IAAKN,aAAa,GAAGI,OAAO,CAACC,GAAG,CAACC,CAAC,CAA4B,CAAC,EAAG;AAC9DL,QAAAA,MAAM,KAAKA,MAAM,IAAI,GAAG,CAAC,CAAA;AACzBA,QAAAA,MAAM,IAAID,aAAa,CAAA;AAC1B,OAAA;AACJ,KAAA;AACJ,GAAA;AAED,EAAA,OAAOC,MAAM,CAAA;AACjB;;;;"}

View File

@@ -0,0 +1 @@
export declare const twMerge: (...classLists: import("./tw-join").ClassNameValue[]) => string;

View File

@@ -0,0 +1,7 @@
import { createTailwindMerge } from './create-tailwind-merge.mjs';
import { getDefaultConfig } from './default-config.mjs';
var twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
export { twMerge };
//# sourceMappingURL=tw-merge.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tw-merge.mjs","sources":["../../src/lib/tw-merge.ts"],"sourcesContent":["import { createTailwindMerge } from './create-tailwind-merge'\nimport { getDefaultConfig } from './default-config'\n\nexport const twMerge = createTailwindMerge(getDefaultConfig)\n"],"names":["twMerge","createTailwindMerge","getDefaultConfig"],"mappings":";;;IAGaA,OAAO,gBAAGC,mBAAmB,CAACC,gBAAgB;;;;"}

View File

@@ -0,0 +1,58 @@
export interface Config {
/**
* Integer indicating size of LRU cache used for memoizing results.
* - Cache might be up to twice as big as `cacheSize`
* - No cache is used for values <= 0
*/
cacheSize: number;
/**
* Prefix added to Tailwind-generated classes
* @see https://tailwindcss.com/docs/configuration#prefix
*/
prefix?: string;
/**
* Custom separator for modifiers in Tailwind classes
* @see https://tailwindcss.com/docs/configuration#separator
*/
separator?: string;
/**
* Theme scales used in classGroups.
* The keys are the same as in the Tailwind config but the values are sometimes defined more broadly.
*/
theme: ThemeObject;
/**
* Object with groups of classes.
* @example
* {
* // Creates group of classes `group`, `of` and `classes`
* 'group-id': ['group', 'of', 'classes'],
* // Creates group of classes `look-at-me-other` and `look-at-me-group`.
* 'other-group': [{ 'look-at-me': ['other', 'group']}]
* }
*/
classGroups: Record<ClassGroupId, ClassGroup>;
/**
* Conflicting classes across groups.
* The key is ID of class group which creates conflict, values are IDs of class groups which receive a conflict.
* A class group ID is the key of a class group in classGroups object.
* @example { gap: ['gap-x', 'gap-y'] }
*/
conflictingClassGroups: Record<ClassGroupId, readonly ClassGroupId[]>;
/**
* Postfix modifiers conflicting with other class groups.
* A class group ID is the key of a class group in classGroups object.
* @example { 'font-size': ['leading'] }
*/
conflictingClassGroupModifiers?: Record<ClassGroupId, readonly ClassGroupId[]>;
}
export type ThemeObject = Record<string, ClassGroup>;
export type ClassGroupId = string;
export type ClassGroup = readonly ClassDefinition[];
type ClassDefinition = string | ClassValidator | ThemeGetter | ClassObject;
export type ClassValidator = (classPart: string) => boolean;
export interface ThemeGetter {
(theme: ThemeObject): ClassGroup;
isThemeGetter: true;
}
type ClassObject = Record<string, readonly ClassDefinition[]>;
export {};

View File

@@ -0,0 +1,17 @@
export declare function isLength(value: string): boolean;
export declare function isArbitraryLength(value: string): boolean;
export declare function isArbitrarySize(value: string): boolean;
export declare function isArbitraryPosition(value: string): boolean;
export declare function isArbitraryUrl(value: string): boolean;
export declare function isArbitraryNumber(value: string): boolean;
/**
* @deprecated Will be removed in next major version. Use `isArbitraryNumber` instead.
*/
export declare const isArbitraryWeight: typeof isArbitraryNumber;
export declare function isNumber(value: string): boolean;
export declare function isPercent(value: string): boolean;
export declare function isInteger(value: string): boolean;
export declare function isArbitraryValue(value: string): boolean;
export declare function isAny(): boolean;
export declare function isTshirtSize(value: string): boolean;
export declare function isArbitraryShadow(value: string): boolean;

View File

@@ -0,0 +1,78 @@
var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
var fractionRegex = /^\d+\/\d+$/;
var stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
var lengthUnitRegex = /\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$/;
// Shadow always begins with x and y offset separated by underscore
var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
function isLength(value) {
return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
}
function isArbitraryLength(value) {
return getIsArbitraryValue(value, 'length', isLengthOnly);
}
function isArbitrarySize(value) {
return getIsArbitraryValue(value, 'size', isNever);
}
function isArbitraryPosition(value) {
return getIsArbitraryValue(value, 'position', isNever);
}
function isArbitraryUrl(value) {
return getIsArbitraryValue(value, 'url', isUrl);
}
function isArbitraryNumber(value) {
return getIsArbitraryValue(value, 'number', isNumber);
}
/**
* @deprecated Will be removed in next major version. Use `isArbitraryNumber` instead.
*/
var isArbitraryWeight = isArbitraryNumber;
function isNumber(value) {
return !Number.isNaN(Number(value));
}
function isPercent(value) {
return value.endsWith('%') && isNumber(value.slice(0, -1));
}
function isInteger(value) {
return isIntegerOnly(value) || getIsArbitraryValue(value, 'number', isIntegerOnly);
}
function isArbitraryValue(value) {
return arbitraryValueRegex.test(value);
}
function isAny() {
return true;
}
function isTshirtSize(value) {
return tshirtUnitRegex.test(value);
}
function isArbitraryShadow(value) {
return getIsArbitraryValue(value, '', isShadow);
}
function getIsArbitraryValue(value, label, testValue) {
var result = arbitraryValueRegex.exec(value);
if (result) {
if (result[1]) {
return result[1] === label;
}
return testValue(result[2]);
}
return false;
}
function isLengthOnly(value) {
return lengthUnitRegex.test(value);
}
function isNever() {
return false;
}
function isUrl(value) {
return value.startsWith('url(');
}
function isIntegerOnly(value) {
return Number.isInteger(Number(value));
}
function isShadow(value) {
return shadowRegex.test(value);
}
export { isAny, isArbitraryLength, isArbitraryNumber, isArbitraryPosition, isArbitraryShadow, isArbitrarySize, isArbitraryUrl, isArbitraryValue, isArbitraryWeight, isInteger, isLength, isNumber, isPercent, isTshirtSize };
//# sourceMappingURL=validators.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
import { twJoin } from './lib/tw-join.mjs';
export { createTailwindMerge } from './lib/create-tailwind-merge.mjs';
export { getDefaultConfig } from './lib/default-config.mjs';
export { extendTailwindMerge } from './lib/extend-tailwind-merge.mjs';
export { fromTheme } from './lib/from-theme.mjs';
export { mergeConfigs } from './lib/merge-configs.mjs';
export { twMerge } from './lib/tw-merge.mjs';
import * as validators from './lib/validators.mjs';
export { validators };
/**
* @deprecated Will be removed in next major version. Use `twJoin` instead.
*/
var join = twJoin;
export { join, twJoin };
//# sourceMappingURL=tailwind-merge.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tailwind-merge.mjs","sources":["../src/index.ts"],"sourcesContent":["import { twJoin } from './lib/tw-join'\n\nexport { createTailwindMerge } from './lib/create-tailwind-merge'\nexport { getDefaultConfig } from './lib/default-config'\nexport { extendTailwindMerge } from './lib/extend-tailwind-merge'\nexport { fromTheme } from './lib/from-theme'\nexport { mergeConfigs } from './lib/merge-configs'\nexport { twJoin, type ClassNameValue } from './lib/tw-join'\nexport { twMerge } from './lib/tw-merge'\nexport type { Config } from './lib/types'\nexport * as validators from './lib/validators'\n\n/**\n * @deprecated Will be removed in next major version. Use `twJoin` instead.\n */\nexport const join = twJoin\n"],"names":["join","twJoin"],"mappings":";;;;;;;;;;AAYA;;AAEG;AACI,IAAMA,IAAI,GAAGC;;;;"}