first commit

This commit is contained in:
root
2025-12-28 20:50:08 +00:00
commit b1cd61c7b1
16845 changed files with 1594292 additions and 0 deletions

21
node_modules/tailwind-merge/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Dany Castillo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

37
node_modules/tailwind-merge/README.md generated vendored Normal file
View File

@@ -0,0 +1,37 @@
<!-- This file is autogenerated. If you want to change this content, please do the changes in `./docs/README.md` instead. -->
<div align="center">
<br />
<a href="https://github.com/dcastil/tailwind-merge">
<img src="https://github.com/dcastil/tailwind-merge/raw/v1.14.0/assets/logo.svg" alt="tailwind-merge" height="150px" />
</a>
</div>
# tailwind-merge
Utility function to efficiently merge [Tailwind CSS](https://tailwindcss.com) classes in JS without style conflicts.
```ts
import { twMerge } from 'tailwind-merge'
twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
// → 'hover:bg-dark-red p-3 bg-[#B91C1C]'
```
- Supports Tailwind v3.0 up to v3.3 (if you use Tailwind v2, use [tailwind-merge v0.9.0](https://github.com/dcastil/tailwind-merge/tree/v0.9.0))
- Works in all modern browsers and Node >=12
- Fully typed
- [Check bundle size on Bundlephobia](https://bundlephobia.com/package/tailwind-merge)
## Get started
- [What is it for](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/what-is-it-for.md)
- [When and how to use it](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/when-and-how-to-use-it.md)
- [Features](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/features.md)
- [Configuration](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/configuration.md)
- [Recipes](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/recipes.md)
- [API reference](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/api-reference.md)
- [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/writing-plugins.md)
- [Versioning](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/versioning.md)
- [Contributing](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/contributing.md)
- [Similar packages](https://github.com/dcastil/tailwind-merge/tree/v1.14.0/docs/similar-packages.md)

14
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
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')
}

19
node_modules/tailwind-merge/dist/lib/class-utils.d.ts generated vendored Normal file
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 {};

141
node_modules/tailwind-merge/dist/lib/class-utils.mjs generated vendored Normal file
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

13
node_modules/tailwind-merge/dist/lib/config-utils.d.ts generated vendored Normal file
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;
};
};

14
node_modules/tailwind-merge/dist/lib/config-utils.mjs generated vendored Normal file
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;;;;"}

1952
node_modules/tailwind-merge/dist/lib/default-config.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2041
node_modules/tailwind-merge/dist/lib/default-config.mjs generated vendored Normal file

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;;;;"}

2
node_modules/tailwind-merge/dist/lib/from-theme.d.ts generated vendored Normal file
View File

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

10
node_modules/tailwind-merge/dist/lib/from-theme.mjs generated vendored Normal file
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;;;;"}

5
node_modules/tailwind-merge/dist/lib/lru-cache.d.ts generated vendored Normal file
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>;

45
node_modules/tailwind-merge/dist/lib/lru-cache.mjs generated vendored Normal file
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;

34
node_modules/tailwind-merge/dist/lib/merge-configs.mjs generated vendored Normal file
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

13
node_modules/tailwind-merge/dist/lib/tw-join.d.ts generated vendored Normal file
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 {};

43
node_modules/tailwind-merge/dist/lib/tw-join.mjs generated vendored Normal file
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

1
node_modules/tailwind-merge/dist/lib/tw-join.mjs.map generated vendored Normal file
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;;;;"}

1
node_modules/tailwind-merge/dist/lib/tw-merge.d.ts generated vendored Normal file
View File

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

7
node_modules/tailwind-merge/dist/lib/tw-merge.mjs generated vendored Normal file
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;;;;"}

58
node_modules/tailwind-merge/dist/lib/types.d.ts generated vendored Normal file
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 {};

17
node_modules/tailwind-merge/dist/lib/validators.d.ts generated vendored Normal file
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;

78
node_modules/tailwind-merge/dist/lib/validators.mjs generated vendored Normal file
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

17
node_modules/tailwind-merge/dist/tailwind-merge.mjs generated vendored Normal file
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;;;;"}

75
node_modules/tailwind-merge/package.json generated vendored Normal file
View File

@@ -0,0 +1,75 @@
{
"name": "tailwind-merge",
"version": "1.14.0",
"description": "Merge Tailwind CSS classes without style conflicts",
"keywords": [
"tailwindcss",
"tailwind",
"css",
"classes",
"className",
"classList",
"merge",
"conflict",
"override"
],
"homepage": "https://github.com/dcastil/tailwind-merge",
"bugs": {
"url": "https://github.com/dcastil/tailwind-merge/issues"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/dcastil"
},
"license": "MIT",
"author": "Dany Castillo",
"files": [
"dist",
"src"
],
"source": "src/index.ts",
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/tailwind-merge.mjs",
"default": "./dist/tailwind-merge.mjs"
},
"module": "dist/tailwind-merge.mjs",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/dcastil/tailwind-merge.git"
},
"sideEffects": false,
"scripts": {
"build": "dts build",
"test": "dts test",
"test:watch": "dts test --watch",
"test:exports": "node scripts/test-built-package-exports.cjs && node scripts/test-built-package-exports.mjs",
"lint": "eslint --max-warnings 0 '**'",
"size": "size-limit",
"preversion": "if [ -n \"$DANYS_MACHINE\" ]; then git checkout main && git pull; fi",
"version": "zx scripts/update-readme.mjs",
"postversion": "if [ -n \"$DANYS_MACHINE\" ]; then git push --follow-tags && open https://github.com/dcastil/tailwind-merge/releases; fi"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^8.2.6",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"dts-cli": "^2.0.3",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"globby": "^11.1.0",
"prettier": "^2.8.8",
"size-limit": "^8.2.6",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6",
"zx": "^7.2.2"
},
"publishConfig": {
"provenance": true
}
}

16
node_modules/tailwind-merge/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
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 const join = twJoin

203
node_modules/tailwind-merge/src/lib/class-utils.ts generated vendored Normal file
View File

@@ -0,0 +1,203 @@
import { ClassGroup, ClassGroupId, ClassValidator, Config, ThemeGetter, ThemeObject } from './types'
export interface ClassPartObject {
nextPart: Map<string, ClassPartObject>
validators: ClassValidatorObject[]
classGroupId?: ClassGroupId
}
interface ClassValidatorObject {
classGroupId: ClassGroupId
validator: ClassValidator
}
const CLASS_PART_SEPARATOR = '-'
export function createClassUtils(config: Config) {
const classMap = createClassMap(config)
const { conflictingClassGroups, conflictingClassGroupModifiers = {} } = config
function getClassGroupId(className: string) {
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: ClassGroupId, hasPostfixModifier: boolean) {
const conflicts = conflictingClassGroups[classGroupId] || []
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]!]
}
return conflicts
}
return {
getClassGroupId,
getConflictingClassGroupIds,
}
}
function getGroupRecursive(
classParts: string[],
classPartObject: ClassPartObject,
): ClassGroupId | undefined {
if (classParts.length === 0) {
return classPartObject.classGroupId
}
const currentClassPart = classParts[0]!
const nextClassPartObject = classPartObject.nextPart.get(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.validators.find(({ validator }) => validator(classRest))?.classGroupId
}
const arbitraryPropertyRegex = /^\[(.+)\]$/
function getGroupIdForArbitraryProperty(className: string) {
if (arbitraryPropertyRegex.test(className)) {
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]
const 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
*/
export function createClassMap(config: Config) {
const { theme, prefix } = config
const classMap: ClassPartObject = {
nextPart: new Map<string, ClassPartObject>(),
validators: [],
}
const prefixedClassGroupEntries = getPrefixedClassGroupEntries(
Object.entries(config.classGroups),
prefix,
)
prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {
processClassesRecursively(classGroup, classMap, classGroupId, theme)
})
return classMap
}
function processClassesRecursively(
classGroup: ClassGroup,
classPartObject: ClassPartObject,
classGroupId: ClassGroupId,
theme: ThemeObject,
) {
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: ClassPartObject, path: string) {
let currentClassPartObject = classPartObject
path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
if (!currentClassPartObject.nextPart.has(pathPart)) {
currentClassPartObject.nextPart.set(pathPart, {
nextPart: new Map(),
validators: [],
})
}
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart)!
})
return currentClassPartObject
}
function isThemeGetter(func: ClassValidator | ThemeGetter): func is ThemeGetter {
return (func as ThemeGetter).isThemeGetter
}
function getPrefixedClassGroupEntries(
classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup]>,
prefix: string | undefined,
): Array<[classGroupId: string, classGroup: ClassGroup]> {
if (!prefix) {
return classGroupEntries
}
return classGroupEntries.map(([classGroupId, classGroup]) => {
const prefixedClassGroup = classGroup.map((classDefinition) => {
if (typeof classDefinition === 'string') {
return prefix + classDefinition
}
if (typeof classDefinition === 'object') {
return Object.fromEntries(
Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]),
)
}
return classDefinition
})
return [classGroupId, prefixedClassGroup]
})
}

14
node_modules/tailwind-merge/src/lib/config-utils.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { createClassUtils } from './class-utils'
import { createLruCache } from './lru-cache'
import { createSplitModifiers } from './modifier-utils'
import { Config } from './types'
export type ConfigUtils = ReturnType<typeof createConfigUtils>
export function createConfigUtils(config: Config) {
return {
cache: createLruCache<string, string>(config.cacheSize),
splitModifiers: createSplitModifiers(config),
...createClassUtils(config),
}
}

View File

@@ -0,0 +1,51 @@
import { createConfigUtils } from './config-utils'
import { mergeClassList } from './merge-classlist'
import { ClassNameValue, twJoin } from './tw-join'
import { Config } from './types'
type CreateConfigFirst = () => Config
type CreateConfigSubsequent = (config: Config) => Config
type TailwindMerge = (...classLists: ClassNameValue[]) => string
type ConfigUtils = ReturnType<typeof createConfigUtils>
export function createTailwindMerge(
...createConfig: [CreateConfigFirst, ...CreateConfigSubsequent[]]
): TailwindMerge {
let configUtils: ConfigUtils
let cacheGet: ConfigUtils['cache']['get']
let cacheSet: ConfigUtils['cache']['set']
let functionToCall = initTailwindMerge
function initTailwindMerge(classList: string) {
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: string) {
const cachedResult = cacheGet(classList)
if (cachedResult) {
return cachedResult
}
const result = mergeClassList(classList, configUtils)
cacheSet(classList, result)
return result
}
return function callTailwindMerge() {
return functionToCall(twJoin.apply(null, arguments as any))
}
}

1783
node_modules/tailwind-merge/src/lib/default-config.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
import { createTailwindMerge } from './create-tailwind-merge'
import { getDefaultConfig } from './default-config'
import { mergeConfigs } from './merge-configs'
import { Config } from './types'
type CreateConfigSubsequent = (config: Config) => Config
export function extendTailwindMerge(
configExtension: Partial<Config> | CreateConfigSubsequent,
...createConfig: CreateConfigSubsequent[]
) {
return typeof configExtension === 'function'
? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig)
: createTailwindMerge(
() => mergeConfigs(getDefaultConfig(), configExtension),
...createConfig,
)
}

9
node_modules/tailwind-merge/src/lib/from-theme.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { ThemeGetter, ThemeObject } from './types'
export function fromTheme(key: string): ThemeGetter {
const themeGetter = (theme: ThemeObject) => theme[key] || []
themeGetter.isThemeGetter = true as const
return themeGetter
}

52
node_modules/tailwind-merge/src/lib/lru-cache.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
// Export is needed because TypeScript complains about an error otherwise:
// 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.
export interface LruCache<Key, Value> {
get(key: Key): Value | undefined
set(key: Key, value: Value): void
}
// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
export function createLruCache<Key, Value>(maxCacheSize: number): LruCache<Key, Value> {
if (maxCacheSize < 1) {
return {
get: () => undefined,
set: () => {},
}
}
let cacheSize = 0
let cache = new Map<Key, Value>()
let previousCache = new Map<Key, Value>()
function update(key: Key, value: Value) {
cache.set(key, value)
cacheSize++
if (cacheSize > maxCacheSize) {
cacheSize = 0
previousCache = cache
cache = new Map()
}
}
return {
get(key) {
let value = cache.get(key)
if (value !== undefined) {
return value
}
if ((value = previousCache.get(key)) !== undefined) {
update(key, value)
return value
}
},
set(key, value) {
if (cache.has(key)) {
cache.set(key, value)
} else {
update(key, value)
}
},
}
}

99
node_modules/tailwind-merge/src/lib/merge-classlist.ts generated vendored Normal file
View File

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

51
node_modules/tailwind-merge/src/lib/merge-configs.ts generated vendored Normal file
View File

@@ -0,0 +1,51 @@
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 function mergeConfigs(baseConfig: Config, configExtension: Partial<Config>) {
for (const key in configExtension) {
mergePropertyRecursively(baseConfig as any, key, configExtension[key as keyof Config])
}
return baseConfig
}
const hasOwnProperty = Object.prototype.hasOwnProperty
const overrideTypes = new Set(['string', 'number', 'boolean'])
function mergePropertyRecursively(
baseObject: Record<string, unknown>,
mergeKey: string,
mergeValue: unknown,
) {
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] as unknown[]).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] as Record<string, unknown>,
nextKey,
mergeValue[nextKey as keyof object],
)
}
}
}

95
node_modules/tailwind-merge/src/lib/modifier-utils.ts generated vendored Normal file
View File

@@ -0,0 +1,95 @@
import { Config } from './types'
export const IMPORTANT_MODIFIER = '!'
export function createSplitModifiers(config: Config) {
const separator = config.separator || ':'
const isSeparatorSingleCharacter = separator.length === 1
const firstSeparatorCharacter = separator[0]
const separatorLength = separator.length
// splitModifiers inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
return function splitModifiers(className: string) {
const modifiers = []
let bracketDepth = 0
let modifierStart = 0
let postfixModifierPosition: number | undefined
for (let index = 0; index < className.length; index++) {
let 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--
}
}
const baseClassNameWithImportantModifier =
modifiers.length === 0 ? className : className.substring(modifierStart)
const hasImportantModifier =
baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
const baseClassName = hasImportantModifier
? baseClassNameWithImportantModifier.substring(1)
: baseClassNameWithImportantModifier
const maybePostfixModifierPosition =
postfixModifierPosition && postfixModifierPosition > modifierStart
? postfixModifierPosition - modifierStart
: undefined
return {
modifiers,
hasImportantModifier,
baseClassName,
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
*/
export function sortModifiers(modifiers: string[]) {
if (modifiers.length <= 1) {
return modifiers
}
const sortedModifiers: string[] = []
let unsortedModifiers: string[] = []
modifiers.forEach((modifier) => {
const isArbitraryVariant = modifier[0] === '['
if (isArbitraryVariant) {
sortedModifiers.push(...unsortedModifiers.sort(), modifier)
unsortedModifiers = []
} else {
unsortedModifiers.push(modifier)
}
})
sortedModifiers.push(...unsortedModifiers.sort())
return sortedModifiers
}

50
node_modules/tailwind-merge/src/lib/tw-join.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
/**
* 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 function twJoin(...classLists: ClassNameValue[]): string
export function twJoin() {
let index = 0
let argument: ClassNameValue
let resolvedValue: string
let string = ''
while (index < arguments.length) {
if ((argument = arguments[index++])) {
if ((resolvedValue = toValue(argument))) {
string && (string += ' ')
string += resolvedValue
}
}
}
return string
}
function toValue(mix: ClassNameArray | string) {
if (typeof mix === 'string') {
return mix
}
let resolvedValue: string
let string = ''
for (let k = 0; k < mix.length; k++) {
if (mix[k]) {
if ((resolvedValue = toValue(mix[k] as ClassNameArray | string))) {
string && (string += ' ')
string += resolvedValue
}
}
}
return string
}

4
node_modules/tailwind-merge/src/lib/tw-merge.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { createTailwindMerge } from './create-tailwind-merge'
import { getDefaultConfig } from './default-config'
export const twMerge = createTailwindMerge(getDefaultConfig)

58
node_modules/tailwind-merge/src/lib/types.ts generated vendored Normal file
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[]>

104
node_modules/tailwind-merge/src/lib/validators.ts generated vendored Normal file
View File

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